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

This commit is contained in:
Johannes Schickel 2013-08-03 00:40:03 +02:00
parent 8617edea04
commit dd67e9f099
6 changed files with 11 additions and 11 deletions

View file

@ -103,10 +103,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
if (frame) { if (frame) {
if (scaleBuffer) { if (scaleBuffer) {
// TODO: Probably should do aspect ratio correction in e.g. GK1 Windows // TODO: Probably should do aspect ratio correction in e.g. GK1 Windows
g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); g_sci->_gfxScreen->scale2x((const byte *)frame->getBasePtr(0, 0), scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel);
g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height); g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height);
} else { } else {
g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height); g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, width, height);
} }
if (videoDecoder->hasDirtyPalette()) { if (videoDecoder->hasDirtyPalette()) {

View file

@ -532,7 +532,7 @@ void GfxFrameout::showVideo() {
if (videoDecoder->needsUpdate()) { if (videoDecoder->needsUpdate()) {
const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
if (frame) { if (frame) {
g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h);
if (videoDecoder->hasDirtyPalette()) if (videoDecoder->hasDirtyPalette())
g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256); g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256);

View file

@ -129,7 +129,7 @@ void GfxMacIconBar::drawIcon(uint16 iconIndex, bool selected) {
void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) { void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
if (surface) if (surface)
g_system->copyRectToScreen(surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height()); g_system->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, rect.left, rect.top, rect.width(), rect.height());
} }
void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) { void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
@ -153,7 +153,7 @@ void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::
*((byte *)newSurf.getBasePtr(j, i)) = 0; *((byte *)newSurf.getBasePtr(j, i)) = 0;
} }
g_system->copyRectToScreen(newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height()); g_system->copyRectToScreen(newSurf.getBasePtr(0, 0), newSurf.pitch, rect.left, rect.top, rect.width(), rect.height());
newSurf.free(); newSurf.free();
} }
@ -224,7 +224,7 @@ Graphics::Surface *GfxMacIconBar::createImage(uint32 iconIndex, bool isSelected)
} }
void GfxMacIconBar::remapColors(Graphics::Surface *surf, const byte *palette) { void GfxMacIconBar::remapColors(Graphics::Surface *surf, const byte *palette) {
byte *pixels = (byte *)surf->pixels; byte *pixels = (byte *)surf->getBasePtr(0, 0);
// Remap to the screen palette // Remap to the screen palette
for (uint16 i = 0; i < surf->w * surf->h; i++) { for (uint16 i = 0; i < surf->w * surf->h; i++) {

View file

@ -170,14 +170,14 @@ void GfxScreen::copyToScreen() {
void GfxScreen::copyFromScreen(byte *buffer) { void GfxScreen::copyFromScreen(byte *buffer) {
// TODO this ignores the pitch // TODO this ignores the pitch
Graphics::Surface *screen = g_system->lockScreen(); Graphics::Surface *screen = g_system->lockScreen();
memcpy(buffer, screen->pixels, _displayPixels); memcpy(buffer, screen->getBasePtr(0, 0), _displayPixels);
g_system->unlockScreen(); g_system->unlockScreen();
} }
void GfxScreen::kernelSyncWithFramebuffer() { void GfxScreen::kernelSyncWithFramebuffer() {
// TODO this ignores the pitch // TODO this ignores the pitch
Graphics::Surface *screen = g_system->lockScreen(); Graphics::Surface *screen = g_system->lockScreen();
memcpy(_displayScreen, screen->pixels, _displayPixels); memcpy(_displayScreen, screen->getBasePtr(0, 0), _displayPixels);
g_system->unlockScreen(); g_system->unlockScreen();
} }

View file

@ -210,7 +210,7 @@ void RobotDecoder::readNextPacket() {
// Copy over the decompressed frame // Copy over the decompressed frame
byte *inFrame = decompressedFrame; byte *inFrame = decompressedFrame;
byte *outFrame = (byte *)surface->pixels; byte *outFrame = (byte *)surface->getBasePtr(0, 0);
// Black out the surface // Black out the surface
memset(outFrame, 0, surface->w * surface->h); memset(outFrame, 0, surface->w * surface->h);

View file

@ -119,7 +119,7 @@ const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() {
_fileStream->seek(offset); _fileStream->seek(offset);
if (frameType == kSeqFrameFull) { if (frameType == kSeqFrameFull) {
byte *dst = (byte *)_surface->pixels + frameTop * SEQ_SCREEN_WIDTH + frameLeft; byte *dst = (byte *)_surface->getBasePtr(frameLeft, frameTop);
byte *linebuf = new byte[frameWidth]; byte *linebuf = new byte[frameWidth];
@ -133,7 +133,7 @@ const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() {
} else { } else {
byte *buf = new byte[frameSize]; byte *buf = new byte[frameSize];
_fileStream->read(buf, frameSize); _fileStream->read(buf, frameSize);
decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, (byte *)_surface->pixels + SEQ_SCREEN_WIDTH * frameTop, frameLeft, frameWidth, frameHeight, colorKey); decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, (byte *)_surface->getBasePtr(0, frameTop), frameLeft, frameWidth, frameHeight, colorKey);
delete[] buf; delete[] buf;
} }