GUI: Take advantage of Surface::getPixels.

This commit is contained in:
Johannes Schickel 2013-08-03 02:36:28 +02:00
parent e0c9c1d261
commit b1bd9322a1
3 changed files with 10 additions and 10 deletions

View file

@ -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.getBasePtr(0, 0), screen.w * screen.h * screen.format.bytesPerPixel);
Common::MemoryReadStream bitmapStream((const byte*)screen.getPixels(), screen.w * screen.h * screen.format.bytesPerPixel);
computeStreamMD5(bitmapStream, md5);
return true;
}

View file

@ -389,7 +389,7 @@ bool ThemeEngine::init() {
_overlayFormat = _system->getOverlayFormat();
setGraphicsMode(_graphicsMode);
if (_screen.getBasePtr(0, 0) && _backBuffer.getBasePtr(0, 0)) {
if (_screen.getPixels() && _backBuffer.getPixels()) {
_initOk = true;
}
@ -439,7 +439,7 @@ bool ThemeEngine::init() {
void ThemeEngine::clearAll() {
if (_initOk) {
_system->clearOverlay();
_system->grabOverlay(_screen.getBasePtr(0, 0), _screen.pitch);
_system->grabOverlay(_screen.getPixels(), _screen.pitch);
}
}
@ -1219,7 +1219,7 @@ void ThemeEngine::updateScreen(bool render) {
}
_vectorRenderer->setSurface(&_screen);
memcpy(_screen.getBasePtr(0, 0), _backBuffer.getBasePtr(0, 0), _screen.pitch * _screen.h);
memcpy(_screen.getPixels(), _backBuffer.getPixels(), _screen.pitch * _screen.h);
_bufferQueue.clear();
}
@ -1287,7 +1287,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) {
addDirtyRect(Common::Rect(0, 0, _screen.w, _screen.h));
}
memcpy(_backBuffer.getBasePtr(0, 0), _screen.getBasePtr(0, 0), _screen.pitch * _screen.h);
memcpy(_backBuffer.getPixels(), _screen.getPixels(), _screen.pitch * _screen.h);
_vectorRenderer->setSurface(&_screen);
}
@ -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<int, int> colorToIndex;
const OverlayColor *src = (const OverlayColor *)cursor->getBasePtr(0, 0);
const OverlayColor *src = (const OverlayColor *)cursor->getPixels();
for (uint y = 0; y < _cursorHeight; ++y) {
for (uint x = 0; x < _cursorWidth; ++x) {
byte r, g, b;

View file

@ -396,7 +396,7 @@ PicButtonWidget::~PicButtonWidget() {
void PicButtonWidget::setGfx(const Graphics::Surface *gfx) {
_gfx.free();
if (!gfx || !gfx->getBasePtr(0, 0))
if (!gfx || !gfx->getPixels())
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.getBasePtr(0, 0)) {
if (_gfx.getPixels()) {
// 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->getBasePtr(0, 0))
if (!gfx || !gfx->getPixels())
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.getBasePtr(0, 0)) {
if (_gfx.getPixels()) {
// Check whether the set up surface needs to be converted to the GUI
// color format.
const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();