Skip to content

Commit

Permalink
WINTERMUTE: Take advantage of Surface::getPixels.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Aug 3, 2013
1 parent 4318410 commit 0ee407c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
Expand Up @@ -187,9 +187,9 @@ bool BaseRenderOSystem::flip() {
}
if (_needsFlip || _disableDirtyRects || _tempDisableDirtyRects) {
if (_disableDirtyRects || _tempDisableDirtyRects) {
g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
}
// g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
// g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height());
delete _dirtyRect;
_dirtyRect = nullptr;
g_system->updateScreen();
Expand Down Expand Up @@ -682,7 +682,7 @@ void BaseRenderOSystem::endSaveLoad() {
_drawNum = 1;

_renderSurface->fillRect(Common::Rect(0, 0, _renderSurface->h, _renderSurface->w), _renderSurface->format.ARGBToColor(255, 0, 0, 0));
g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h);
g_system->updateScreen();
}

Expand Down
6 changes: 3 additions & 3 deletions engines/wintermute/graphics/transparent_surface.cpp
Expand Up @@ -160,8 +160,8 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur
format = surf.format;
// We need to cast the const qualifier away here because 'pixels'
// always needs to be writable. 'surf' however is a constant Surface,
// thus getBasePtr will always return const pixel data.
pixels = const_cast<void *>(surf.getBasePtr(0, 0));
// thus getPixels will always return const pixel data.
pixels = const_cast<void *>(surf.getPixels());
}
}

Expand Down Expand Up @@ -339,7 +339,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
if ((width != srcImage.w) || (height != srcImage.h)) {
// Scale the image
img = imgScaled = srcImage.scale(width, height);
savedPixels = (byte *)img->getBasePtr(0, 0);
savedPixels = (byte *)img->getPixels();
} else {
img = &srcImage;
}
Expand Down
4 changes: 2 additions & 2 deletions engines/wintermute/video/video_theora_player.cpp
Expand Up @@ -369,14 +369,14 @@ void VideoTheoraPlayer::writeAlpha() {
if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) {
assert(_alphaImage->getSurface()->format.bytesPerPixel == 4);
assert(_surface.format.bytesPerPixel == 4);
const byte *alphaData = (const byte *)_alphaImage->getSurface()->getBasePtr(0, 0);
const byte *alphaData = (const byte *)_alphaImage->getSurface()->getPixels();
#ifdef SCUMM_LITTLE_ENDIAN
int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8);
#else
int alphaPlace = 3 - (_alphaImage->getSurface()->format.aShift / 8);
#endif
alphaData += alphaPlace;
byte *imgData = (byte *)_surface.getBasePtr(0, 0);
byte *imgData = (byte *)_surface.getPixels();
#ifdef SCUMM_LITTLE_ENDIAN
imgData += (_surface.format.aShift / 8);
#else
Expand Down

0 comments on commit 0ee407c

Please sign in to comment.