From 103e926c0765c45267c1cfac0eb07a201e5084bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:26:04 +0200 Subject: GUI: Prefer getBasePtr instead of direct Surface::pixels access. --- gui/EventRecorder.cpp | 2 +- gui/ThemeEngine.cpp | 6 +++--- gui/widget.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index fd0093d266..4f569b75c5 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -522,7 +522,7 @@ bool EventRecorder::grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5 warning("Can't save screenshot"); return false; } - Common::MemoryReadStream bitmapStream((const byte*)screen.pixels, screen.w * screen.h * screen.format.bytesPerPixel); + Common::MemoryReadStream bitmapStream((const byte*)screen.getBasePtr(0, 0), screen.w * screen.h * screen.format.bytesPerPixel); computeStreamMD5(bitmapStream, md5); return true; } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 3ce043cb39..80f3946729 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -389,7 +389,7 @@ bool ThemeEngine::init() { _overlayFormat = _system->getOverlayFormat(); setGraphicsMode(_graphicsMode); - if (_screen.pixels && _backBuffer.pixels) { + if (_screen.getBasePtr(0, 0) && _backBuffer.getBasePtr(0, 0)) { _initOk = true; } @@ -439,7 +439,7 @@ bool ThemeEngine::init() { void ThemeEngine::clearAll() { if (_initOk) { _system->clearOverlay(); - _system->grabOverlay(_screen.pixels, _screen.pitch); + _system->grabOverlay(_screen.getBasePtr(0, 0), _screen.pitch); } } @@ -1326,7 +1326,7 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; Common::HashMap colorToIndex; - const OverlayColor *src = (const OverlayColor *)cursor->pixels; + const OverlayColor *src = (const OverlayColor *)cursor->getBasePtr(0, 0); for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { byte r, g, b; diff --git a/gui/widget.cpp b/gui/widget.cpp index c3f10a861f..197250a940 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -396,7 +396,7 @@ PicButtonWidget::~PicButtonWidget() { void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getBasePtr(0, 0)) return; if (gfx->format.bytesPerPixel == 1) { @@ -429,7 +429,7 @@ void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (_gfx.pixels) { + if (_gfx.getBasePtr(0, 0)) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); @@ -646,7 +646,7 @@ GraphicsWidget::~GraphicsWidget() { void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getBasePtr(0, 0)) return; if (gfx->format.bytesPerPixel == 1) { @@ -676,7 +676,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (_gfx.pixels) { + if (_gfx.getBasePtr(0, 0)) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); -- cgit v1.2.3