NEVERHOOD: Prefer getBasePtr over direct Surface::pixels access.

This commit is contained in:
Johannes Schickel 2013-08-03 00:00:35 +02:00
parent 6eb9c8da9e
commit 82b96d33ad
3 changed files with 6 additions and 6 deletions

View File

@ -183,7 +183,7 @@ void Mouse::updateCursor() {
_drawOffset = _mouseCursorResource.getRect();
_surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2);
Graphics::Surface *cursorSurface = _surface->getSurface();
CursorMan.replaceCursor((const byte*)cursorSurface->pixels,
CursorMan.replaceCursor((const byte*)cursorSurface->getBasePtr(0, 0),
cursorSurface->w, cursorSurface->h, -_drawOffset.x, -_drawOffset.y, 0);
}

View File

@ -39,7 +39,7 @@ SpriteResource::~SpriteResource() {
void SpriteResource::draw(Graphics::Surface *destSurface, bool flipX, bool flipY) {
if (_pixels) {
byte *dest = (byte*)destSurface->pixels;
byte *dest = (byte*)destSurface->getBasePtr(0, 0);
const int destPitch = destSurface->pitch;
if (_rle)
unpackSpriteRle(_pixels, _dimensions.width, _dimensions.height, dest, destPitch, flipX, flipY);
@ -116,7 +116,7 @@ AnimResource::~AnimResource() {
void AnimResource::draw(uint frameIndex, Graphics::Surface *destSurface, bool flipX, bool flipY) {
const AnimFrameInfo frameInfo = _frames[frameIndex];
byte *dest = (byte*)destSurface->pixels;
byte *dest = (byte*)destSurface->getBasePtr(0, 0);
const int destPitch = destSurface->pitch;
_currSpriteData = _spriteData + frameInfo.spriteDataOffs;
_width = frameInfo.drawOffset.width;
@ -298,7 +298,7 @@ void MouseCursorResource::draw(int frameNum, Graphics::Surface *destSurface) {
const int sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment
const int destPitch = destSurface->pitch;
const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32;
byte *dest = (byte*)destSurface->pixels;
byte *dest = (byte*)destSurface->getBasePtr(0, 0);
for (int16 yc = 0; yc < 32; yc++) {
memcpy(dest, source, 32);
source += sourcePitch;

View File

@ -54,7 +54,7 @@ void Screen::update() {
if (_fullRefresh) {
// NOTE When playing a fullscreen/doubled Smacker video usually a full screen refresh is needed
_vm->_system->copyRectToScreen((const byte*)_backScreen->pixels, _backScreen->pitch, 0, 0, 640, 480);
_vm->_system->copyRectToScreen((const byte*)_backScreen->getBasePtr(0, 0), _backScreen->pitch, 0, 0, 640, 480);
_fullRefresh = false;
return;
}
@ -174,7 +174,7 @@ void Screen::updatePalette() {
}
void Screen::clear() {
memset(_backScreen->pixels, 0, _backScreen->pitch * _backScreen->h);
memset(_backScreen->getBasePtr(0, 0), 0, _backScreen->pitch * _backScreen->h);
_fullRefresh = true;
clearRenderQueue();
}