Merge pull request #365 from lordhoto/protected-pixels

Make Graphics::Surface::pixels protected.
This commit is contained in:
Johannes Schickel 2013-08-07 12:24:59 -07:00
commit 7f8308e0eb
158 changed files with 597 additions and 595 deletions

View file

@ -57,7 +57,7 @@ void BaseBackend::initBackend() {
void BaseBackend::fillScreen(uint32 col) { void BaseBackend::fillScreen(uint32 col) {
Graphics::Surface *screen = lockScreen(); Graphics::Surface *screen = lockScreen();
if (screen && screen->pixels) if (screen && screen->getPixels())
memset(screen->pixels, col, screen->h * screen->pitch); memset(screen->getPixels(), col, screen->h * screen->pitch);
unlockScreen(); unlockScreen();
} }

View file

@ -357,7 +357,7 @@ void OpenGLGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x,
// Copy buffer data to game screen internal buffer // Copy buffer data to game screen internal buffer
const byte *src = (const byte *)buf; const byte *src = (const byte *)buf;
byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel; byte *dst = (byte *)_screenData.getBasePtr(x, y);
for (int i = 0; i < h; i++) { for (int i = 0; i < h; i++) {
memcpy(dst, src, w * _screenData.format.bytesPerPixel); memcpy(dst, src, w * _screenData.format.bytesPerPixel);
src += pitch; src += pitch;
@ -385,15 +385,15 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) {
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
if (_screenFormat.bytesPerPixel == 1) { if (_screenFormat.bytesPerPixel == 1) {
memset(_screenData.pixels, col, _screenData.h * _screenData.pitch); memset(_screenData.getPixels(), col, _screenData.h * _screenData.pitch);
} else if (_screenFormat.bytesPerPixel == 2) { } else if (_screenFormat.bytesPerPixel == 2) {
uint16 *pixels = (uint16 *)_screenData.pixels; uint16 *pixels = (uint16 *)_screenData.getPixels();
uint16 col16 = (uint16)col; uint16 col16 = (uint16)col;
for (int i = 0; i < _screenData.w * _screenData.h; i++) { for (int i = 0; i < _screenData.w * _screenData.h; i++) {
pixels[i] = col16; pixels[i] = col16;
} }
} else if (_screenFormat.bytesPerPixel == 3) { } else if (_screenFormat.bytesPerPixel == 3) {
uint8 *pixels = (uint8 *)_screenData.pixels; uint8 *pixels = (uint8 *)_screenData.getPixels();
byte r = (col >> 16) & 0xFF; byte r = (col >> 16) & 0xFF;
byte g = (col >> 8) & 0xFF; byte g = (col >> 8) & 0xFF;
byte b = col & 0xFF; byte b = col & 0xFF;
@ -404,13 +404,13 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) {
pixels += 3; pixels += 3;
} }
} else if (_screenFormat.bytesPerPixel == 4) { } else if (_screenFormat.bytesPerPixel == 4) {
uint32 *pixels = (uint32 *)_screenData.pixels; uint32 *pixels = (uint32 *)_screenData.getPixels();
for (int i = 0; i < _screenData.w * _screenData.h; i++) { for (int i = 0; i < _screenData.w * _screenData.h; i++) {
pixels[i] = col; pixels[i] = col;
} }
} }
#else #else
memset(_screenData.pixels, col, _screenData.h * _screenData.pitch); memset(_screenData.getPixels(), col, _screenData.h * _screenData.pitch);
#endif #endif
_screenNeedsRedraw = true; _screenNeedsRedraw = true;
} }
@ -463,12 +463,12 @@ Graphics::PixelFormat OpenGLGraphicsManager::getOverlayFormat() const {
void OpenGLGraphicsManager::clearOverlay() { void OpenGLGraphicsManager::clearOverlay() {
// Set all pixels to 0 // Set all pixels to 0
memset(_overlayData.pixels, 0, _overlayData.h * _overlayData.pitch); memset(_overlayData.getPixels(), 0, _overlayData.h * _overlayData.pitch);
_overlayNeedsRedraw = true; _overlayNeedsRedraw = true;
} }
void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) { void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) {
const byte *src = (byte *)_overlayData.pixels; const byte *src = (byte *)_overlayData.getPixels();
byte *dst = (byte *)buf; byte *dst = (byte *)buf;
for (int i = 0; i < _overlayData.h; i++) { for (int i = 0; i < _overlayData.h; i++) {
// Copy overlay data to buffer // Copy overlay data to buffer
@ -509,7 +509,7 @@ void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x,
return; return;
// Copy buffer data to internal overlay surface // Copy buffer data to internal overlay surface
byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; byte *dst = (byte *)_overlayData.getBasePtr(0, y);
for (int i = 0; i < h; i++) { for (int i = 0; i < h; i++) {
memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel); memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel);
src += pitch; src += pitch;
@ -609,7 +609,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
_cursorData.create(w, h, _cursorFormat); _cursorData.create(w, h, _cursorFormat);
// Save cursor data // Save cursor data
memcpy(_cursorData.pixels, buf, h * _cursorData.pitch); memcpy(_cursorData.getPixels(), buf, h * _cursorData.pitch);
// Set cursor info // Set cursor info
_cursorState.w = w; _cursorState.w = w;
@ -688,7 +688,7 @@ void OpenGLGraphicsManager::refreshGameScreen() {
byte *surface = new byte[w * h * 3]; byte *surface = new byte[w * h * 3];
// Convert the paletted buffer to RGB888 // Convert the paletted buffer to RGB888
const byte *src = (byte *)_screenData.pixels + y * _screenData.pitch; const byte *src = (byte *)_screenData.getBasePtr(0, y);
src += x * _screenData.format.bytesPerPixel; src += x * _screenData.format.bytesPerPixel;
byte *dst = surface; byte *dst = surface;
for (int i = 0; i < h; i++) { for (int i = 0; i < h; i++) {
@ -708,8 +708,7 @@ void OpenGLGraphicsManager::refreshGameScreen() {
delete[] surface; delete[] surface;
} else { } else {
// Update the texture // Update the texture
_gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch + _gameTexture->updateBuffer((byte *)_screenData.getBasePtr(x, y), _screenData.pitch, x, y, w, h);
x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h);
} }
_screenNeedsRedraw = false; _screenNeedsRedraw = false;
@ -730,7 +729,7 @@ void OpenGLGraphicsManager::refreshOverlay() {
byte *surface = new byte[w * h * 3]; byte *surface = new byte[w * h * 3];
// Convert the paletted buffer to RGB888 // Convert the paletted buffer to RGB888
const byte *src = (byte *)_overlayData.pixels + y * _overlayData.pitch; const byte *src = (byte *)_overlayData.getBasePtr(0, y);
src += x * _overlayData.format.bytesPerPixel; src += x * _overlayData.format.bytesPerPixel;
byte *dst = surface; byte *dst = surface;
for (int i = 0; i < h; i++) { for (int i = 0; i < h; i++) {
@ -750,8 +749,7 @@ void OpenGLGraphicsManager::refreshOverlay() {
delete[] surface; delete[] surface;
} else { } else {
// Update the texture // Update the texture
_overlayTexture->updateBuffer((byte *)_overlayData.pixels + y * _overlayData.pitch + _overlayTexture->updateBuffer((byte *)_overlayData.getBasePtr(x, y), _overlayData.pitch, x, y, w, h);
x * _overlayData.format.bytesPerPixel, _overlayData.pitch, x, y, w, h);
} }
_overlayNeedsRedraw = false; _overlayNeedsRedraw = false;
@ -780,7 +778,7 @@ void OpenGLGraphicsManager::refreshCursor() {
palette = _cursorPalette; palette = _cursorPalette;
// Convert the paletted cursor to RGBA8888 // Convert the paletted cursor to RGBA8888
const byte *src = (byte *)_cursorData.pixels; const byte *src = (byte *)_cursorData.getPixels();
for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
// Check for keycolor // Check for keycolor
if (src[i] != _cursorKeyColor) { if (src[i] != _cursorKeyColor) {
@ -796,7 +794,7 @@ void OpenGLGraphicsManager::refreshCursor() {
// Convert the RGB cursor to RGBA8888 // Convert the RGB cursor to RGBA8888
if (_cursorFormat.bytesPerPixel == 2) { if (_cursorFormat.bytesPerPixel == 2) {
const uint16 *src = (uint16 *)_cursorData.pixels; const uint16 *src = (uint16 *)_cursorData.getPixels();
for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
// Check for keycolor // Check for keycolor
if (src[i] != _cursorKeyColor) { if (src[i] != _cursorKeyColor) {
@ -808,7 +806,7 @@ void OpenGLGraphicsManager::refreshCursor() {
dst += 4; dst += 4;
} }
} else if (_cursorFormat.bytesPerPixel == 4) { } else if (_cursorFormat.bytesPerPixel == 4) {
const uint32 *src = (uint32 *)_cursorData.pixels; const uint32 *src = (uint32 *)_cursorData.getPixels();
for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
// Check for keycolor // Check for keycolor
if (src[i] != _cursorKeyColor) { if (src[i] != _cursorKeyColor) {
@ -1356,7 +1354,7 @@ void OpenGLGraphicsManager::updateOSD() {
_osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat); _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat);
else else
// Clear everything // Clear everything
memset(_osdSurface.pixels, 0, _osdSurface.h * _osdSurface.pitch); memset(_osdSurface.getPixels(), 0, _osdSurface.h * _osdSurface.pitch);
// Determine a rect which would contain the message string (clipped to the // Determine a rect which would contain the message string (clipped to the
// screen dimensions). // screen dimensions).
@ -1390,7 +1388,7 @@ void OpenGLGraphicsManager::updateOSD() {
} }
// Update the texture // Update the texture
_osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0, _osdTexture->updateBuffer(_osdSurface.getPixels(), _osdSurface.pitch, 0, 0,
_osdSurface.w, _osdSurface.h); _osdSurface.w, _osdSurface.h);
} }
#endif #endif

View file

@ -1308,15 +1308,13 @@ Graphics::Surface *SurfaceSdlGraphicsManager::lockScreen() {
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
_framebuffer.pixels = _screen->pixels; _framebuffer.init(_screen->w, _screen->h, _screen->pitch, _screen->pixels,
_framebuffer.w = _screen->w;
_framebuffer.h = _screen->h;
_framebuffer.pitch = _screen->pitch;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
_framebuffer.format = _screenFormat; _screenFormat
#else #else
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); Graphics::PixelFormat::createFormatCLUT8()
#endif #endif
);
return &_framebuffer; return &_framebuffer;
} }
@ -1340,8 +1338,8 @@ void SurfaceSdlGraphicsManager::unlockScreen() {
void SurfaceSdlGraphicsManager::fillScreen(uint32 col) { void SurfaceSdlGraphicsManager::fillScreen(uint32 col) {
Graphics::Surface *screen = lockScreen(); Graphics::Surface *screen = lockScreen();
if (screen && screen->pixels) if (screen && screen->getPixels())
memset(screen->pixels, col, screen->h * screen->pitch); memset(screen->getPixels(), col, screen->h * screen->pitch);
unlockScreen(); unlockScreen();
} }
@ -2062,15 +2060,12 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) {
error("displayMessageOnOSD: SDL_LockSurface failed: %s", SDL_GetError()); error("displayMessageOnOSD: SDL_LockSurface failed: %s", SDL_GetError());
Graphics::Surface dst; Graphics::Surface dst;
dst.pixels = _osdSurface->pixels; dst.init(_osdSurface->w, _osdSurface->h, _osdSurface->pitch, _osdSurface->pixels,
dst.w = _osdSurface->w; Graphics::PixelFormat(_osdSurface->format->BytesPerPixel,
dst.h = _osdSurface->h; 8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss,
dst.pitch = _osdSurface->pitch; 8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss,
dst.format = Graphics::PixelFormat(_osdSurface->format->BytesPerPixel, _osdSurface->format->Rshift, _osdSurface->format->Gshift,
8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss, _osdSurface->format->Bshift, _osdSurface->format->Ashift));
8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss,
_osdSurface->format->Rshift, _osdSurface->format->Gshift,
_osdSurface->format->Bshift, _osdSurface->format->Ashift);
// The font we are going to use: // The font we are going to use:
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);

View file

@ -552,7 +552,7 @@ Graphics::Surface *OSystem_Android::lockScreen() {
GLTHREADCHECK; GLTHREADCHECK;
Graphics::Surface *surface = _game_texture->surface(); Graphics::Surface *surface = _game_texture->surface();
assert(surface->pixels); assert(surface->getPixels());
return surface; return surface;
} }
@ -645,7 +645,7 @@ void OSystem_Android::grabOverlay(void *buf, int pitch) {
assert(surface->format.bytesPerPixel == sizeof(uint16)); assert(surface->format.bytesPerPixel == sizeof(uint16));
byte *dst = (byte *)buf; byte *dst = (byte *)buf;
const byte *src = (const byte *)surface->pixels; const byte *src = (const byte *)surface->getPixels();
uint h = surface->h; uint h = surface->h;
do { do {

View file

@ -233,7 +233,7 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
_pixels = new byte[w * h * _surface.format.bytesPerPixel]; _pixels = new byte[w * h * _surface.format.bytesPerPixel];
assert(_pixels); assert(_pixels);
_surface.pixels = _pixels; _surface.setPixels(_pixels);
fillBuffer(0); fillBuffer(0);
@ -256,7 +256,7 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
} }
void GLESTexture::fillBuffer(uint32 color) { void GLESTexture::fillBuffer(uint32 color) {
assert(_surface.pixels); assert(_surface.getPixels());
if (_pixelFormat.bytesPerPixel == 1 || if (_pixelFormat.bytesPerPixel == 1 ||
((color & 0xff) == ((color >> 8) & 0xff))) ((color & 0xff) == ((color >> 8) & 0xff)))
@ -377,7 +377,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
assert(_pixels); assert(_pixels);
// fixup surface, for the outside this is a CLUT8 surface // fixup surface, for the outside this is a CLUT8 surface
_surface.pixels = _pixels; _surface.setPixels(_pixels);
fillBuffer(0); fillBuffer(0);
@ -386,8 +386,8 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
} }
void GLESFakePaletteTexture::fillBuffer(uint32 color) { void GLESFakePaletteTexture::fillBuffer(uint32 color) {
assert(_surface.pixels); assert(_surface.getPixels());
memset(_surface.pixels, color & 0xff, _surface.pitch * _surface.h); memset(_surface.getPixels(), color & 0xff, _surface.pitch * _surface.h);
setDirty(); setDirty();
} }

View file

@ -711,11 +711,7 @@ Graphics::Surface *OSystem_Dreamcast::lockScreen()
if (!screen) if (!screen)
return 0; return 0;
_framebuffer.pixels = screen; _framebuffer.init(_screen_w, _screen_h, SCREEN_W*2, screen, screenFormats[_screenFormat]);
_framebuffer.w = _screen_w;
_framebuffer.h = _screen_h;
_framebuffer.pitch = SCREEN_W*2;
_framebuffer.format = screenFormats[_screenFormat];
return &_framebuffer; return &_framebuffer;
} }

View file

@ -296,7 +296,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int
// to save a few pennies/euro cents on the hardware. // to save a few pennies/euro cents on the hardware.
if (_frameBufferExists) { if (_frameBufferExists) {
bg = (u16 *)_framebuffer.pixels; bg = (u16 *)_framebuffer.getPixels();
stride = _framebuffer.pitch; stride = _framebuffer.pitch;
} else { } else {
bg = (u16 *)DS::get8BitBackBuffer(); bg = (u16 *)DS::get8BitBackBuffer();
@ -455,7 +455,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int
dmaCopyHalfWords(3, src, dest1, w); dmaCopyHalfWords(3, src, dest1, w);
if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) { if ((!_frameBufferExists) || (buf == _framebuffer.getPixels())) {
dmaCopyHalfWords(2, src, dest2, w); dmaCopyHalfWords(2, src, dest2, w);
} }
@ -476,7 +476,7 @@ void OSystem_DS::updateScreen() {
_frameBufferExists = false; _frameBufferExists = false;
// Copy temp framebuffer back to screen // Copy temp framebuffer back to screen
copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h); copyRectToScreen((byte *)_framebuffer.getPixels(), _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
} }
DS::displayMode16BitFlipBuffer(); DS::displayMode16BitFlipBuffer();
@ -755,11 +755,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
if (DS::isCpuScalerEnabled()) { if (DS::isCpuScalerEnabled()) {
_framebuffer.pixels = DS::getScalerBuffer(); _framebuffer.init(DS::getGameWidth(), DS::getGameHeight(), DS::getGameWidth(),
_framebuffer.w = DS::getGameWidth(); DS::getScalerBuffer(), Graphics::PixelFormat::createFormatCLUT8());
_framebuffer.h = DS::getGameHeight();
_framebuffer.pitch = DS::getGameWidth();
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
} else { } else {
@ -780,11 +777,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
dmaCopyHalfWords(3, srcLine, destLine, width); dmaCopyHalfWords(3, srcLine, destLine, width);
} }
_framebuffer.pixels = dest; _framebuffer.init(width, height, width, dest, Graphics::PixelFormat::createFormatCLUT8());
_framebuffer.w = width;
_framebuffer.h = height;
_framebuffer.pitch = width;
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
} }
@ -798,8 +791,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
for (int y = 0; y < DS::getGameHeight(); y++) { for (int y = 0; y < DS::getGameHeight(); y++) {
DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth()); DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++) { for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x]; *(((u16 *) (_framebuffer.getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x];
// *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x]; // *(((u16 *) (surf->getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
} }
}*/ }*/

View file

@ -365,7 +365,7 @@ const char *iPhone_getDocumentsDir() {
_mouseTexCoords[5] = _mouseTexCoords[7] = _videoContext.mouseHeight / (GLfloat)_videoContext.mouseTexture.h; _mouseTexCoords[5] = _mouseTexCoords[7] = _videoContext.mouseHeight / (GLfloat)_videoContext.mouseTexture.h;
glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError(); glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.pixels); printOpenGLError(); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.getPixels()); printOpenGLError();
} }
- (void)updateMainSurface { - (void)updateMainSurface {
@ -377,7 +377,7 @@ const char *iPhone_getDocumentsDir() {
// Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
// due to the iPhone internals having to convert the whole texture back from its internal format when used. // due to the iPhone internals having to convert the whole texture back from its internal format when used.
// In the future we could use several tiled textures instead. // In the future we could use several tiled textures instead.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.pixels); printOpenGLError(); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.getPixels()); printOpenGLError();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError(); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
} }
@ -386,7 +386,7 @@ const char *iPhone_getDocumentsDir() {
glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError(); glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError();
glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError(); glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.pixels); printOpenGLError(); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.getPixels()); printOpenGLError();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError(); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
} }

View file

@ -78,7 +78,7 @@ OSystem_IPHONE::~OSystem_IPHONE() {
// Prevent accidental freeing of the screen texture here. This needs to be // Prevent accidental freeing of the screen texture here. This needs to be
// checked since we might use the screen texture as framebuffer in the case // checked since we might use the screen texture as framebuffer in the case
// of hi-color games for example. // of hi-color games for example.
if (_framebuffer.pixels == _videoContext->screenTexture.pixels) if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels())
_framebuffer.free(); _framebuffer.free();
_mouseBuffer.free(); _mouseBuffer.free();
} }

View file

@ -76,8 +76,8 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
// In case we use the screen texture as frame buffer we reset the pixels // In case we use the screen texture as frame buffer we reset the pixels
// pointer here to avoid freeing the screen texture. // pointer here to avoid freeing the screen texture.
if (_framebuffer.pixels == _videoContext->screenTexture.pixels) if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels())
_framebuffer.pixels = 0; _framebuffer.setPixels(0);
// Create the screen texture right here. We need to do this here, since // Create the screen texture right here. We need to do this here, since
// when a game requests hi-color mode, we actually set the framebuffer // when a game requests hi-color mode, we actually set the framebuffer
@ -310,7 +310,7 @@ void OSystem_IPHONE::hideOverlay() {
void OSystem_IPHONE::clearOverlay() { void OSystem_IPHONE::clearOverlay() {
//printf("clearOverlay()\n"); //printf("clearOverlay()\n");
bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch); bzero(_videoContext->overlayTexture.getPixels(), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
dirtyFullOverlayScreen(); dirtyFullOverlayScreen();
} }
@ -319,7 +319,7 @@ void OSystem_IPHONE::grabOverlay(void *buf, int pitch) {
int h = _videoContext->overlayHeight; int h = _videoContext->overlayHeight;
byte *dst = (byte *)buf; byte *dst = (byte *)buf;
const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0); const byte *src = (const byte *)_videoContext->overlayTexture.getPixels();
do { do {
memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16)); memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16));
src += _videoContext->overlayTexture.pitch; src += _videoContext->overlayTexture.pitch;
@ -417,7 +417,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot
#endif #endif
assert(pixelFormat.bytesPerPixel == 1 || pixelFormat.bytesPerPixel == 2); assert(pixelFormat.bytesPerPixel == 1 || pixelFormat.bytesPerPixel == 2);
if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.pixels) if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.getPixels())
_mouseBuffer.create(w, h, pixelFormat); _mouseBuffer.create(w, h, pixelFormat);
_videoContext->mouseWidth = w; _videoContext->mouseWidth = w;
@ -428,7 +428,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot
_mouseKeyColor = keycolor; _mouseKeyColor = keycolor;
memcpy(_mouseBuffer.getBasePtr(0, 0), buf, h * _mouseBuffer.pitch); memcpy(_mouseBuffer.getPixels(), buf, h * _mouseBuffer.pitch);
_mouseDirty = true; _mouseDirty = true;
_mouseNeedTextureUpdate = true; _mouseNeedTextureUpdate = true;
@ -464,7 +464,7 @@ void OSystem_IPHONE::updateMouseTexture() {
else else
palette = _gamePaletteRGBA5551; palette = _gamePaletteRGBA5551;
uint16 *mouseBuf = (uint16 *)mouseTexture.getBasePtr(0, 0); uint16 *mouseBuf = (uint16 *)mouseTexture.getPixels();
for (uint x = 0; x < _videoContext->mouseWidth; ++x) { for (uint x = 0; x < _videoContext->mouseWidth; ++x) {
for (uint y = 0; y < _videoContext->mouseHeight; ++y) { for (uint y = 0; y < _videoContext->mouseHeight; ++y) {
const byte color = *(const byte *)_mouseBuffer.getBasePtr(x, y); const byte color = *(const byte *)_mouseBuffer.getBasePtr(x, y);
@ -475,12 +475,12 @@ void OSystem_IPHONE::updateMouseTexture() {
} }
} }
} else { } else {
if (crossBlit((byte *)mouseTexture.getBasePtr(0, 0), (const byte *)_mouseBuffer.getBasePtr(0, 0), mouseTexture.pitch, if (crossBlit((byte *)mouseTexture.getPixels(), (const byte *)_mouseBuffer.getPixels(), mouseTexture.pitch,
_mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) { _mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) {
if (!_mouseBuffer.format.aBits()) { if (!_mouseBuffer.format.aBits()) {
// Apply color keying since the original cursor had no alpha channel. // Apply color keying since the original cursor had no alpha channel.
const uint16 *src = (const uint16 *)_mouseBuffer.getBasePtr(0, 0); const uint16 *src = (const uint16 *)_mouseBuffer.getPixels();
uint8 *dstRaw = (uint8 *)mouseTexture.getBasePtr(0, 0); uint8 *dstRaw = (uint8 *)mouseTexture.getPixels();
for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) { for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) {
uint16 *dst = (uint16 *)dstRaw; uint16 *dst = (uint16 *)dstRaw;
@ -495,7 +495,7 @@ void OSystem_IPHONE::updateMouseTexture() {
} else { } else {
// TODO: Log this! // TODO: Log this!
// Make the cursor all transparent... we really need a better fallback ;-). // Make the cursor all transparent... we really need a better fallback ;-).
memset(mouseTexture.getBasePtr(0, 0), 0, mouseTexture.h * mouseTexture.pitch); memset(mouseTexture.getPixels(), 0, mouseTexture.h * mouseTexture.pitch);
} }
} }

View file

@ -605,11 +605,7 @@ void OSystem_N64::updateScreen() {
} }
Graphics::Surface *OSystem_N64::lockScreen() { Graphics::Surface *OSystem_N64::lockScreen() {
_framebuffer.pixels = _offscreen_pal; _framebuffer.init(_gameWidth, _gameHeight, _screenWidth, _offscreen_pal, Graphics::PixelFormat::createFormatCLUT8());
_framebuffer.w = _gameWidth;
_framebuffer.h = _gameHeight;
_framebuffer.pitch = _screenWidth;
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
return &_framebuffer; return &_framebuffer;
} }

View file

@ -392,12 +392,8 @@ void Gs2dScreen::copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w
Graphics::Surface *Gs2dScreen::lockScreen() { Graphics::Surface *Gs2dScreen::lockScreen() {
WaitSema(g_DmacSema); WaitSema(g_DmacSema);
_framebuffer.pixels = _screenBuf; // -not- _pitch; ! It's EE mem, not Tex
_framebuffer.w = _width; _framebuffer.init(_width, _height, _width, _screenBuf, Graphics::PixelFormat::createFormatCLUT8());
_framebuffer.h = _height;
_framebuffer.pitch = _width; // -not- _pitch; ! It's EE mem, not Tex
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
return &_framebuffer; return &_framebuffer;
} }

View file

@ -192,11 +192,8 @@ void Screen::setScummvmPixelFormat(const Graphics::PixelFormat *format) {
Graphics::Surface *Screen::lockAndGetForEditing() { Graphics::Surface *Screen::lockAndGetForEditing() {
DEBUG_ENTER_FUNC(); DEBUG_ENTER_FUNC();
_frameBuffer.pixels = _buffer.getPixels(); _frameBuffer.init(_buffer.getSourceWidth(), _buffer.getSourceHeight(), _buffer.getBytesPerPixel() * _buffer.getWidth(),
_frameBuffer.w = _buffer.getSourceWidth(); _buffer.getPixels(), _pixelFormat);
_frameBuffer.h = _buffer.getSourceHeight();
_frameBuffer.pitch = _buffer.getBytesPerPixel() * _buffer.getWidth();
_frameBuffer.format = _pixelFormat;
// We'll set to dirty once we unlock the screen // We'll set to dirty once we unlock the screen
return &_frameBuffer; return &_frameBuffer;

View file

@ -528,16 +528,13 @@ void OSystem_Wii::updateScreen() {
} }
Graphics::Surface *OSystem_Wii::lockScreen() { Graphics::Surface *OSystem_Wii::lockScreen() {
_surface.pixels = _gamePixels; _surface.init(_gameWidth, _gameHeight,
_surface.w = _gameWidth;
_surface.h = _gameHeight;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
_surface.pitch = _gameWidth * _pfGame.bytesPerPixel; _gameWidth * _pfGame.bytesPerPixel, _gamePixels, _pfGame
_surface.format = _pfGame;
#else #else
_surface.pitch = _gameWidth; _gameWidth, _gamePixels, Graphics::PixelFormat::createFormatCLUT8()
_surface.format = Graphics::PixelFormat::createFormatCLUT8();
#endif #endif
);
return &_surface; return &_surface;
} }

View file

@ -36,7 +36,7 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16
if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor)) if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor))
return; return;
const OverlayColor *src = (const OverlayColor *)surf_src->pixels; const OverlayColor *src = (const OverlayColor *)surf_src->getPixels();
int blitW = surf_src->w; int blitW = surf_src->w;
int blitH = surf_src->h; int blitH = surf_src->h;
@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() {
_system->clearOverlay(); _system->clearOverlay();
} }
_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
_system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); _system->grabOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch);
setupCursor(); setupCursor();
@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() {
removeCursor(); removeCursor();
_system->copyRectToOverlay(_overlayBackup.pixels, _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h); _system->copyRectToOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h);
if (!g_gui.isActive()) _system->hideOverlay(); if (!g_gui.isActive()) _system->hideOverlay();
_overlayBackup.free(); _overlayBackup.free();
@ -262,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() {
_screenH = newScreenH; _screenH = newScreenH;
_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
_system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); _system->grabOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch);
if (!_kbd->checkModeResolutions()) { if (!_kbd->checkModeResolutions()) {
_displaying = false; _displaying = false;
@ -356,7 +356,7 @@ void VirtualKeyboardGUI::redraw() {
Graphics::Surface surf; Graphics::Surface surf;
surf.create(w, h, _system->getOverlayFormat()); surf.create(w, h, _system->getOverlayFormat());
OverlayColor *dst = (OverlayColor *)surf.pixels; OverlayColor *dst = (OverlayColor *)surf.getPixels();
const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
while (h--) { while (h--) {
@ -371,7 +371,7 @@ void VirtualKeyboardGUI::redraw() {
blit(&surf, &_dispSurface, _dispX - _dirtyRect.left, blit(&surf, &_dispSurface, _dispX - _dirtyRect.left,
_dispY - _dirtyRect.top, _dispBackColor); _dispY - _dirtyRect.top, _dispBackColor);
} }
_system->copyRectToOverlay(surf.pixels, surf.pitch, _system->copyRectToOverlay(surf.getPixels(), surf.pitch,
_dirtyRect.left, _dirtyRect.top, surf.w, surf.h); _dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
surf.free(); surf.free();

View file

@ -272,7 +272,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
if (!surface) if (!surface)
return; return;
byte *src = (byte *)surface->pixels; const byte *src = (const byte *)surface->getPixels();
dst += y * pitch + x; dst += y * pitch + x;
do { do {
@ -344,7 +344,7 @@ void MoviePlayerDXA::handleNextFrame() {
bool MoviePlayerDXA::processFrame() { bool MoviePlayerDXA::processFrame() {
Graphics::Surface *screen = _vm->_system->lockScreen(); Graphics::Surface *screen = _vm->_system->lockScreen();
copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); copyFrameToBuffer((byte *)screen->getPixels(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch);
_vm->_system->unlockScreen(); _vm->_system->unlockScreen();
uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound); uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound);
@ -443,7 +443,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
if (!surface) if (!surface)
return; return;
byte *src = (byte *)surface->pixels; const byte *src = (const byte *)surface->getPixels();
dst += y * pitch + x; dst += y * pitch + x;
do { do {
@ -495,7 +495,7 @@ void MoviePlayerSMK::nextFrame() {
bool MoviePlayerSMK::processFrame() { bool MoviePlayerSMK::processFrame() {
Graphics::Surface *screen = _vm->_system->lockScreen(); Graphics::Surface *screen = _vm->_system->lockScreen();
copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); copyFrameToBuffer((byte *)screen->getPixels(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch);
_vm->_system->unlockScreen(); _vm->_system->unlockScreen();
uint32 waitTime = getTimeToNextFrame(); uint32 waitTime = getTimeToNextFrame();

View file

@ -2924,7 +2924,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dstPitch = screen->pitch; dstPitch = screen->pitch;
h = 8; h = 8;
w = 6; w = 6;
@ -2961,7 +2961,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
error("windowDrawChar: Unknown language %d", _language); error("windowDrawChar: Unknown language %d", _language);
} }
} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dstPitch = screen->pitch; dstPitch = screen->pitch;
h = 8; h = 8;
w = 6; w = 6;
@ -2986,14 +2986,14 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
error("windowDrawChar: Unknown language %d", _language); error("windowDrawChar: Unknown language %d", _language);
} }
} else if (getGameType() == GType_ELVIRA1) { } else if (getGameType() == GType_ELVIRA1) {
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dstPitch = screen->pitch; dstPitch = screen->pitch;
h = 8; h = 8;
w = 6; w = 6;
src = english_elvira1Font + (chr - 32) * 8; src = english_elvira1Font + (chr - 32) * 8;
} else { } else {
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dstPitch = screen->pitch; dstPitch = screen->pitch;
h = 8; h = 8;
w = 8; w = 8;

View file

@ -362,7 +362,7 @@ void AGOSEngine::windowScroll(WindowBlock *window) {
w = window->width * 8; w = window->width * 8;
h = (window->height -1) * 8; h = (window->height -1) * 8;
dst = (byte *)screen->pixels + window->y * screen->pitch + window->x * 8; dst = (byte *)screen->getBasePtr(window->x * 8, window->y);
src = dst + 8 * screen->pitch; src = dst + 8 * screen->pitch;
do { do {

View file

@ -32,15 +32,15 @@
namespace AGOS { namespace AGOS {
byte *AGOSEngine::getBackBuf() { byte *AGOSEngine::getBackBuf() {
return (byte *)_backBuf->pixels; return (byte *)_backBuf->getPixels();
} }
byte *AGOSEngine::getBackGround() { byte *AGOSEngine::getBackGround() {
return (byte *)_backGroundBuf->pixels; return (byte *)_backGroundBuf->getPixels();
} }
byte *AGOSEngine::getScaleBuf() { byte *AGOSEngine::getScaleBuf() {
return (byte *)_scaleBuf->pixels; return (byte *)_scaleBuf->getPixels();
} }
#ifdef ENABLE_AGOS2 #ifdef ENABLE_AGOS2
@ -226,7 +226,7 @@ void AGOSEngine::animateSprites() {
debug(0, "Using special wall"); debug(0, "Using special wall");
uint8 color, h, len; uint8 color, h, len;
byte *dst = (byte *)_window4BackScn->pixels; byte *dst = (byte *)_window4BackScn->getPixels();
color = (_variableArray[293] & 1) ? 13 : 15; color = (_variableArray[293] & 1) ? 13 : 15;
_wallOn = 2; _wallOn = 2;
@ -256,7 +256,7 @@ void AGOSEngine::animateSprites() {
} else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) { } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) {
// Used by the Unholy Barrier spell // Used by the Unholy Barrier spell
uint8 color, h, len; uint8 color, h, len;
byte *dst = (byte *)_window4BackScn->pixels; byte *dst = (byte *)_window4BackScn->getPixels();
color = 1; color = 1;
_wallOn = 2; _wallOn = 2;
@ -491,7 +491,7 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) {
int16 y = vsp->y - _scrollY; int16 y = vsp->y - _scrollY;
if (_window3Flag == 1) { if (_window3Flag == 1) {
animTable->srcPtr = (const byte *)_window4BackScn->pixels; animTable->srcPtr = (const byte *)_window4BackScn->getPixels();
} else { } else {
int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8; int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8;
int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y); int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y);
@ -565,7 +565,7 @@ void AGOSEngine::displayBoxStars() {
if (x_ >= 311) if (x_ >= 311)
continue; continue;
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += (((screen->pitch / 4) * y_) * 4) + x_; dst += (((screen->pitch / 4) * y_) * 4) + x_;
@ -673,7 +673,7 @@ void AGOSEngine::scrollScreen() {
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
src = getBackGround(); src = getBackGround();
dst = (byte *)_window4BackScn->pixels; dst = (byte *)_window4BackScn->getPixels();
for (int i = 0; i < _scrollHeight; i++) { for (int i = 0; i < _scrollHeight; i++) {
memcpy(dst, src, _screenWidth); memcpy(dst, src, _screenWidth);
src += _backGroundBuf->pitch; src += _backGroundBuf->pitch;
@ -725,7 +725,7 @@ void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) {
void AGOSEngine::fillBackFromFront() { void AGOSEngine::fillBackFromFront() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *src = (byte *)screen->pixels; byte *src = (byte *)screen->getPixels();
byte *dst = getBackBuf(); byte *dst = getBackBuf();
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {
@ -748,7 +748,7 @@ void AGOSEngine::fillBackGroundFromBack() {
void AGOSEngine::fillBackGroundFromFront() { void AGOSEngine::fillBackGroundFromFront() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *src = (byte *)screen->pixels; byte *src = (byte *)screen->getPixels();
byte *dst = getBackGround(); byte *dst = getBackGround();
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {
@ -785,7 +785,7 @@ void AGOSEngine::displayScreen() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
if (getGameType() == GType_PP || getGameType() == GType_FF) { if (getGameType() == GType_PP || getGameType() == GType_FF) {
byte *src = getBackBuf(); byte *src = getBackBuf();
byte *dst = (byte *)screen->pixels; byte *dst = (byte *)screen->getPixels();
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {
memcpy(dst, src, _screenWidth); memcpy(dst, src, _screenWidth);
src += _backBuf->pitch; src += _backBuf->pitch;
@ -798,9 +798,9 @@ void AGOSEngine::displayScreen() {
_window4Flag = 0; _window4Flag = 0;
uint16 srcWidth, width, height; uint16 srcWidth, width, height;
byte *dst = (byte *)screen->pixels; byte *dst = (byte *)screen->getPixels();
const byte *src = (const byte *)_window4BackScn->pixels; const byte *src = (const byte *)_window4BackScn->getPixels();
if (_window3Flag == 1) { if (_window3Flag == 1) {
src = getBackGround(); src = getBackGround();
} }
@ -831,8 +831,8 @@ void AGOSEngine::displayScreen() {
if (_window6Flag == 2) { if (_window6Flag == 2) {
_window6Flag = 0; _window6Flag = 0;
byte *src = (byte *)_window6BackScn->pixels; byte *src = (byte *)_window6BackScn->getPixels();
byte *dst = (byte *)screen->pixels + 51 * screen->pitch; byte *dst = (byte *)screen->getBasePtr(0, 51);
for (int i = 0; i < 80; i++) { for (int i = 0; i < 80; i++) {
memcpy(dst, src, _window6BackScn->w); memcpy(dst, src, _window6BackScn->w);
dst += screen->pitch; dst += screen->pitch;

View file

@ -365,7 +365,7 @@ void AGOSEngine::drawStuff(const byte *src, uint xoffs) {
const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 135; const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 135;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels + y * screen->pitch + xoffs; byte *dst = (byte *)screen->getBasePtr(xoffs, y);
for (uint h = 0; h < 6; h++) { for (uint h = 0; h < 6; h++) {
memcpy(dst, src, 4); memcpy(dst, src, 4);

View file

@ -649,7 +649,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
state->surf2_addr = getBackGround(); state->surf2_addr = getBackGround();
state->surf2_pitch = _backGroundBuf->pitch; state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _window4BackScn->pitch; state->surf_pitch = _window4BackScn->pitch;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@ -666,7 +666,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
state->surf2_addr = getBackGround(); state->surf2_addr = getBackGround();
state->surf2_pitch = _backGroundBuf->pitch; state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _videoWindows[18] * 16; state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@ -678,7 +678,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
_window4Flag = 1; _window4Flag = 1;
} else { } else {
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
@ -696,7 +696,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
state->surf2_addr = getBackGround(); state->surf2_addr = getBackGround();
state->surf2_pitch = _backGroundBuf->pitch; state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _window4BackScn->pitch; state->surf_pitch = _window4BackScn->pitch;
} }
@ -712,7 +712,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
state->surf2_addr = getBackGround(); state->surf2_addr = getBackGround();
state->surf2_pitch = _backGroundBuf->pitch; state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
@ -861,7 +861,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
uint16 xoffs = 0, yoffs = 0; uint16 xoffs = 0, yoffs = 0;
if (getGameType() == GType_WW) { if (getGameType() == GType_WW) {
if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) { if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) {
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _videoWindows[18] * 16; state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@ -873,7 +873,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
_window4Flag = 1; _window4Flag = 1;
} else { } else {
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
@ -881,7 +881,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
} }
} else if (getGameType() == GType_ELVIRA2) { } else if (getGameType() == GType_ELVIRA2) {
if (_windowNum == 4 || _windowNum >= 10) { if (_windowNum == 4 || _windowNum >= 10) {
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _videoWindows[18] * 16; state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@ -893,7 +893,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
_window4Flag = 1; _window4Flag = 1;
} else { } else {
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
@ -901,19 +901,19 @@ void AGOSEngine::drawImage(VC10_state *state) {
} }
} else if (getGameType() == GType_ELVIRA1) { } else if (getGameType() == GType_ELVIRA1) {
if (_windowNum == 6) { if (_windowNum == 6) {
state->surf_addr = (byte *)_window6BackScn->pixels; state->surf_addr = (byte *)_window6BackScn->getPixels();
state->surf_pitch = _window6BackScn->pitch; state->surf_pitch = _window6BackScn->pitch;
xoffs = state->x * 8; xoffs = state->x * 8;
yoffs = state->y; yoffs = state->y;
} else if (_windowNum == 2 || _windowNum == 3) { } else if (_windowNum == 2 || _windowNum == 3) {
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y; yoffs = vlut[1] + state->y;
} else { } else {
state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _videoWindows[18] * 16; state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@ -926,7 +926,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
_window4Flag = 1; _window4Flag = 1;
} }
} else { } else {
state->surf_addr = (byte *)screen->pixels; state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch; state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8; xoffs = (vlut[0] * 2 + state->x) * 8;
@ -973,7 +973,7 @@ void AGOSEngine::horizontalScroll(VC10_state *state) {
vcWriteVar(251, _scrollX); vcWriteVar(251, _scrollX);
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
dst = (byte *)_window4BackScn->pixels; dst = (byte *)_window4BackScn->getPixels();
dstPitch = _window4BackScn->pitch; dstPitch = _window4BackScn->pitch;
} else { } else {
dst = getBackBuf(); dst = getBackBuf();
@ -1375,10 +1375,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
} else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) { } else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) {
// The DOS Floppy demo was based off Waxworks engine // The DOS Floppy demo was based off Waxworks engine
if (updateWindow == 4 || updateWindow >= 10) { if (updateWindow == 4 || updateWindow >= 10) {
src = (byte *)_window4BackScn->pixels; src = (byte *)_window4BackScn->getPixels();
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3 || updateWindow == 9) { } else if (updateWindow == 3 || updateWindow == 9) {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} else { } else {
_system->unlockScreen(); _system->unlockScreen();
@ -1387,13 +1387,13 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
} }
} else if (getGameType() == GType_SIMON1) { } else if (getGameType() == GType_SIMON1) {
if (updateWindow == 4) { if (updateWindow == 4) {
src = (byte *)_window4BackScn->pixels; src = (byte *)_window4BackScn->getPixels();
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} else if (updateWindow >= 10) { } else if (updateWindow >= 10) {
src = (byte *)_window4BackScn->pixels + xoffs + yoffs * 320; src = (byte *)_window4BackScn->getBasePtr(xoffs, yoffs);
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 0) { } else if (updateWindow == 0) {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} else { } else {
_system->unlockScreen(); _system->unlockScreen();
@ -1402,10 +1402,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
} }
} else if (getGameType() == GType_WW) { } else if (getGameType() == GType_WW) {
if (updateWindow == 4 || updateWindow >= 10) { if (updateWindow == 4 || updateWindow >= 10) {
src = (byte *)_window4BackScn->pixels; src = (byte *)_window4BackScn->getPixels();
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3 || updateWindow == 9) { } else if (updateWindow == 3 || updateWindow == 9) {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} else { } else {
_system->unlockScreen(); _system->unlockScreen();
@ -1414,10 +1414,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
} }
} else if (getGameType() == GType_ELVIRA2) { } else if (getGameType() == GType_ELVIRA2) {
if (updateWindow == 4 || updateWindow >= 10) { if (updateWindow == 4 || updateWindow >= 10) {
src = (byte *)_window4BackScn->pixels; src = (byte *)_window4BackScn->getPixels();
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3) { } else if (updateWindow == 3) {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} else { } else {
_system->unlockScreen(); _system->unlockScreen();
@ -1427,17 +1427,17 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
} else if (getGameType() == GType_ELVIRA1) { } else if (getGameType() == GType_ELVIRA1) {
if (updateWindow == 6) { if (updateWindow == 6) {
_window6Flag = 1; _window6Flag = 1;
src = (byte *)_window6BackScn->pixels; src = (byte *)_window6BackScn->getPixels();
srcWidth = 48; srcWidth = 48;
} else if (updateWindow == 2 || updateWindow == 3) { } else if (updateWindow == 2 || updateWindow == 3) {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} else { } else {
src = (byte *)_window4BackScn->pixels; src = (byte *)_window4BackScn->getPixels();
srcWidth = _videoWindows[18] * 16; srcWidth = _videoWindows[18] * 16;
} }
} else { } else {
src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; src = (byte *)screen->getBasePtr(xoffs, yoffs);
srcWidth = screen->pitch; srcWidth = screen->pitch;
} }
@ -1451,13 +1451,13 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
if (getGameType() == GType_PN && !_wiped && !specialCase) { if (getGameType() == GType_PN && !_wiped && !specialCase) {
uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15; uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15;
dst = (byte *)screen->pixels + 48; dst = (byte *)screen->getBasePtr(48, 0);
memset(dst, color, 224); memset(dst, color, 224);
dst = (byte *)screen->pixels + 132 * screen->pitch + 48; dst = (byte *)screen->getBasePtr(48, 132);
memset(dst, color, 224); memset(dst, color, 224);
} else if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette) { } else if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette) {
dst = (byte *)screen->pixels + 133 * screen->pitch; dst = (byte *)screen->getBasePtr(0, 133);
for (int h = 0; h < 67; h++) { for (int h = 0; h < 67; h++) {
for (int w = 0; w < _screenWidth; w++) for (int w = 0; w < _screenWidth; w++)
@ -1479,7 +1479,7 @@ void AGOSEngine::drawEdging() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels + 136 * screen->pitch; dst = (byte *)screen->getBasePtr(0, 136);
uint8 len = 52; uint8 len = 52;
while (len--) { while (len--) {
@ -1488,7 +1488,7 @@ void AGOSEngine::drawEdging() {
dst += screen->pitch; dst += screen->pitch;
} }
dst = (byte *)screen->pixels + 187 * screen->pitch; dst = (byte *)screen->getBasePtr(0, 187);
memset(dst, color, _screenWidth); memset(dst, color, _screenWidth);
_system->unlockScreen(); _system->unlockScreen();

View file

@ -202,7 +202,7 @@ void AGOSEngine_Simon2::drawIcon(WindowBlock *window, uint icon, uint x, uint y)
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += 110; dst += 110;
dst += x; dst += x;
@ -228,7 +228,7 @@ void AGOSEngine_Simon1::drawIcon(WindowBlock *window, uint icon, uint x, uint y)
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += (x + window->x) * 8; dst += (x + window->x) * 8;
dst += (y * 25 + window->y) * screen->pitch; dst += (y * 25 + window->y) * screen->pitch;
@ -256,7 +256,7 @@ void AGOSEngine_Waxworks::drawIcon(WindowBlock *window, uint icon, uint x, uint
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += (x + window->x) * 8; dst += (x + window->x) * 8;
dst += (y * 20 + window->y) * screen->pitch; dst += (y * 20 + window->y) * screen->pitch;
@ -284,7 +284,7 @@ void AGOSEngine_Elvira2::drawIcon(WindowBlock *window, uint icon, uint x, uint y
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += (x + window->x) * 8; dst += (x + window->x) * 8;
dst += (y * 8 + window->y) * screen->pitch; dst += (y * 8 + window->y) * screen->pitch;
@ -312,7 +312,7 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
dst += (x + window->x) * 8; dst += (x + window->x) * 8;
dst += (y * 8 + window->y) * screen->pitch; dst += (y * 8 + window->y) * screen->pitch;
@ -339,7 +339,7 @@ void AGOSEngine::drawIcon(WindowBlock *window, uint icon, uint x, uint y) {
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels + y * screen->pitch + x * 8; dst = (byte *)screen->getBasePtr(x * 8, y);
src = _iconFilePtr + icon * 146; src = _iconFilePtr + icon * 146;
if (icon == 0xFF) { if (icon == 0xFF) {
@ -951,7 +951,7 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) {
} }
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels + y * screen->pitch + x * 8; byte *dst = (byte *)screen->getBasePtr(x * 8, y);
for (h = 0; h < 19; h++) { for (h = 0; h < 19; h++) {
for (w = 0; w < 16; w++) { for (w = 0; w < 16; w++) {
@ -1042,7 +1042,7 @@ static const byte hitBarData[12 * 7] = {
// Personal Nightmare specific // Personal Nightmare specific
void AGOSEngine_PN::drawIconHitBar() { void AGOSEngine_PN::drawIconHitBar() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels + 3 * screen->pitch + 6 * 8; byte *dst = (byte *)screen->getBasePtr(6 * 8, 3);
const byte *src = hitBarData; const byte *src = hitBarData;
uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15; uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15;

View file

@ -164,7 +164,7 @@ void AGOSEngine::unlightMenuStrip() {
mouseOff(); mouseOff();
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
src = (byte *)screen->pixels + 8 * screen->pitch + 272; src = (byte *)screen->getBasePtr(272, 8);
w = 48; w = 48;
h = 82; h = 82;
@ -192,7 +192,7 @@ void AGOSEngine::lightMenuBox(uint hitarea) {
mouseOff(); mouseOff();
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; src = (byte *)screen->getBasePtr(ha->x, ha->y);
w = ha->width; w = ha->width;
h = ha->height; h = ha->height;

View file

@ -973,7 +973,7 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) {
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; src = (byte *)screen->getBasePtr(ha->x, ha->y);
// WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations // WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations
if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) { if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) {

View file

@ -1179,7 +1179,7 @@ void AGOSEngine::vc32_saveScreen() {
if (getGameType() == GType_PN) { if (getGameType() == GType_PN) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = getBackGround(); byte *dst = getBackGround();
byte *src = (byte *)screen->pixels; byte *src = (byte *)screen->getPixels();
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {
memcpy(dst, src, _screenWidth); memcpy(dst, src, _screenWidth);
dst += _backGroundBuf->pitch; dst += _backGroundBuf->pitch;
@ -1193,7 +1193,7 @@ void AGOSEngine::vc32_saveScreen() {
uint16 height = _videoWindows[4 * 4 + 3]; uint16 height = _videoWindows[4 * 4 + 3];
byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs); byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs);
byte *src = (byte *)_window4BackScn->pixels; byte *src = (byte *)_window4BackScn->getPixels();
uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16; uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16;
for (; height > 0; height--) { for (; height > 0; height--) {
memcpy(dst, src, width); memcpy(dst, src, width);
@ -1247,7 +1247,7 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) {
if (getGameType() == GType_ELVIRA1 && num == 3) { if (getGameType() == GType_ELVIRA1 && num == 3) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels; byte *dst = (byte *)screen->getPixels();
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {
memset(dst, color, _screenWidth); memset(dst, color, _screenWidth);
dst += screen->pitch; dst += screen->pitch;
@ -1258,7 +1258,10 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) {
uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16; uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16;
uint16 yoffs = (vlut[1] - _videoWindows[17]); uint16 yoffs = (vlut[1] - _videoWindows[17]);
uint16 dstWidth = _videoWindows[18] * 16; uint16 dstWidth = _videoWindows[18] * 16;
byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; // TODO: Is there any known connection between dstWidth and the pitch
// of the _window4BackScn Surface? If so, we might be able to pass
// yoffs as proper y parameter to getBasePtr.
byte *dst = (byte *)_window4BackScn->getBasePtr(xoffs, 0) + yoffs * dstWidth;
setMoveRect(0, 0, vlut[2] * 16, vlut[3]); setMoveRect(0, 0, vlut[2] * 16, vlut[3]);

View file

@ -76,7 +76,7 @@ void AGOSEngine::vc45_setWindowPalette() {
uint8 height = vlut[3]; uint8 height = vlut[3];
if (num == 4) { if (num == 4) {
byte *dst = (byte *)_window4BackScn->pixels; byte *dst = (byte *)_window4BackScn->getPixels();
for (uint8 h = 0; h < height; h++) { for (uint8 h = 0; h < height; h++) {
for (uint8 w = 0; w < width; w++) { for (uint8 w = 0; w < width; w++) {
@ -223,11 +223,11 @@ void AGOSEngine::vc53_dissolveIn() {
uint16 count = dissolveCheck * 2; uint16 count = dissolveCheck * 2;
while (count--) { while (count--) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; byte *dstPtr = (byte *)screen->getBasePtr(x, y);
yoffs = _rnd.getRandomNumber(dissolveY); yoffs = _rnd.getRandomNumber(dissolveY);
dst = dstPtr + yoffs * screen->pitch; dst = dstPtr + yoffs * screen->pitch;
src = (byte *)_window4BackScn->pixels + yoffs * _window4BackScn->pitch; src = (byte *)_window4BackScn->getBasePtr(0, yoffs);
xoffs = _rnd.getRandomNumber(dissolveX); xoffs = _rnd.getRandomNumber(dissolveX);
dst += xoffs; dst += xoffs;
@ -296,7 +296,7 @@ void AGOSEngine::vc54_dissolveOut() {
uint16 count = dissolveCheck * 2; uint16 count = dissolveCheck * 2;
while (count--) { while (count--) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; byte *dstPtr = (byte *)screen->getBasePtr(x, y);
color |= dstPtr[0] & 0xF0; color |= dstPtr[0] & 0xF0;
yoffs = _rnd.getRandomNumber(dissolveY); yoffs = _rnd.getRandomNumber(dissolveY);
@ -378,7 +378,7 @@ void AGOSEngine::fullFade() {
void AGOSEngine::vc56_fullScreen() { void AGOSEngine::vc56_fullScreen() {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels; byte *dst = (byte *)screen->getPixels();
byte *src = _curVgaFile2 + 800; byte *src = _curVgaFile2 + 800;
for (int i = 0; i < _screenHeight; i++) { for (int i = 0; i < _screenHeight; i++) {

View file

@ -155,7 +155,7 @@ void AGOSEngine::vc48_specialEffect() {
if (getPlatform() == Common::kPlatformDOS) { if (getPlatform() == Common::kPlatformDOS) {
if (num == 1) { if (num == 1) {
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels; byte *dst = (byte *)screen->getPixels();
for (uint h = 0; h < _screenHeight; h++) { for (uint h = 0; h < _screenHeight; h++) {
for (uint w = 0; w < _screenWidth; w++) { for (uint w = 0; w < _screenWidth; w++) {
@ -205,7 +205,7 @@ void AGOSEngine_PN::clearVideoWindow(uint16 num, uint16 color) {
uint16 yoffs = vlut[1]; uint16 yoffs = vlut[1];
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels + xoffs + yoffs * screen->pitch; byte *dst = (byte *)screen->getBasePtr(xoffs, yoffs);
for (uint h = 0; h < vlut[3]; h++) { for (uint h = 0; h < vlut[3]; h++) {
memset(dst, color, vlut[2] * 16); memset(dst, color, vlut[2] * 16);
dst += screen->pitch; dst += screen->pitch;

View file

@ -213,7 +213,10 @@ void AGOSEngine_Simon2::clearVideoWindow(uint16 num, uint16 color) {
uint16 xoffs = vlut[0] * 16; uint16 xoffs = vlut[0] * 16;
uint16 yoffs = vlut[1]; uint16 yoffs = vlut[1];
uint16 dstWidth = _videoWindows[18] * 16; uint16 dstWidth = _videoWindows[18] * 16;
byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; // TODO: Is there any known connection between dstWidth and the pitch
// of the _window4BackScn Surface? If so, we might be able to pass
// yoffs as proper y parameter to getBasePtr.
byte *dst = (byte *)_window4BackScn->getBasePtr(xoffs, 0) + yoffs * dstWidth;
setMoveRect(0, 0, vlut[2] * 16, vlut[3]); setMoveRect(0, 0, vlut[2] * 16, vlut[3]);

View file

@ -143,7 +143,7 @@ void AGOSEngine::vc61() {
uint h, tmp; uint h, tmp;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dstPtr = (byte *)screen->pixels; dstPtr = (byte *)screen->getPixels();
if (a == 6) { if (a == 6) {
src = _curVgaFile2 + 800; src = _curVgaFile2 + 800;

View file

@ -170,7 +170,7 @@ void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, u
_videoLockOut |= 0x8000; _videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
byte *dst = (byte *)screen->pixels + y * screen->pitch + x; byte *dst = (byte *)screen->getBasePtr(x, y);
uint8 color = window->fillColor; uint8 color = window->fillColor;
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
@ -232,7 +232,7 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) {
uint i; uint i;
Graphics::Surface *screen = _system->lockScreen(); Graphics::Surface *screen = _system->lockScreen();
dst = (byte *)screen->pixels; dst = (byte *)screen->getPixels();
src = getBackGround(); src = getBackGround();
dst += y * screen->pitch; dst += y * screen->pitch;

View file

@ -358,7 +358,7 @@ void CGEEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &he
// Create a thumbnail and save it // Create a thumbnail and save it
Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface *thumb = new Graphics::Surface();
Graphics::Surface *s = _vga->_page[0]; Graphics::Surface *s = _vga->_page[0];
::createThumbnail(thumb, (const byte *)s->pixels, kScrWidth, kScrHeight, thumbPalette); ::createThumbnail(thumb, (const byte *)s->getPixels(), kScrWidth, kScrHeight, thumbPalette);
Graphics::saveThumbnail(*out, *thumb); Graphics::saveThumbnail(*out, *thumb);
thumb->free(); thumb->free();
delete thumb; delete thumb;

View file

@ -826,7 +826,7 @@ void Vga::update() {
} }
} }
g_system->copyRectToScreen(Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight); g_system->copyRectToScreen(Vga::_page[0]->getPixels(), kScrWidth, 0, 0, kScrWidth, kScrHeight);
g_system->updateScreen(); g_system->updateScreen();
} }
@ -845,7 +845,7 @@ void Bitmap::xShow(int16 x, int16 y) {
debugC(4, kCGEDebugBitmap, "Bitmap::xShow(%d, %d)", x, y); debugC(4, kCGEDebugBitmap, "Bitmap::xShow(%d, %d)", x, y);
const byte *srcP = (const byte *)_v; const byte *srcP = (const byte *)_v;
byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight); byte *destEndP = (byte *)_vm->_vga->_page[1]->getBasePtr(0, kScrHeight);
byte *lookupTable = _m; byte *lookupTable = _m;
// Loop through processing data for each plane. The game originally ran in plane mapped mode, where a // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
@ -898,7 +898,7 @@ void Bitmap::show(int16 x, int16 y) {
debugC(5, kCGEDebugBitmap, "Bitmap::show(%d, %d)", x, y); debugC(5, kCGEDebugBitmap, "Bitmap::show(%d, %d)", x, y);
const byte *srcP = (const byte *)_v; const byte *srcP = (const byte *)_v;
byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight); byte *destEndP = (byte *)_vm->_vga->_page[1]->getBasePtr(0, kScrHeight);
// Loop through processing data for each plane. The game originally ran in plane mapped mode, where a // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
// given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data

View file

@ -39,7 +39,7 @@ bool Sprite::contains(const Common::Point &pos) const {
return false; return false;
if (adjustedPos.y < 0 || adjustedPos.y >= _surface.h) if (adjustedPos.y < 0 || adjustedPos.y >= _surface.h)
return false; return false;
byte *pixels = (byte *)_surface.pixels; const byte *pixels = (const byte *)_surface.getPixels();
return (pixels[(_surface.h - adjustedPos.y - 1) * _surface.w + adjustedPos.x] != 0); return (pixels[(_surface.h - adjustedPos.y - 1) * _surface.w + adjustedPos.x] != 0);
} }
@ -541,7 +541,7 @@ void ComposerEngine::redraw() {
for (uint i = 0; i < _dirtyRects.size(); i++) { for (uint i = 0; i < _dirtyRects.size(); i++) {
const Common::Rect &rect = _dirtyRects[i]; const Common::Rect &rect = _dirtyRects[i];
byte *pixels = (byte *)_screen.pixels + (rect.top * _screen.pitch) + rect.left; byte *pixels = (byte *)_screen.getBasePtr(rect.left, rect.top);
_system->copyRectToScreen(pixels, _screen.pitch, rect.left, rect.top, rect.width(), rect.height()); _system->copyRectToScreen(pixels, _screen.pitch, rect.left, rect.top, rect.width(), rect.height());
} }
_system->updateScreen(); _system->updateScreen();
@ -794,7 +794,7 @@ bool ComposerEngine::initSprite(Sprite &sprite) {
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
sprite._surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); sprite._surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
decompressBitmap(type, stream, (byte *)sprite._surface.pixels, size, width, height); decompressBitmap(type, stream, (byte *)sprite._surface.getPixels(), size, width, height);
} else { } else {
// there are some sprites (e.g. a -998x-998 one in Gregory's title screen) // there are some sprites (e.g. a -998x-998 one in Gregory's title screen)
// which have an invalid size, but the original engine doesn't notice for // which have an invalid size, but the original engine doesn't notice for
@ -814,13 +814,13 @@ void ComposerEngine::drawSprite(const Sprite &sprite) {
int y = sprite._pos.y; int y = sprite._pos.y;
// incoming data is BMP-style (bottom-up), so flip it // incoming data is BMP-style (bottom-up), so flip it
byte *pixels = (byte *)_screen.pixels; byte *pixels = (byte *)_screen.getPixels();
for (int j = 0; j < sprite._surface.h; j++) { for (int j = 0; j < sprite._surface.h; j++) {
if (j + y < 0) if (j + y < 0)
continue; continue;
if (j + y >= _screen.h) if (j + y >= _screen.h)
break; break;
byte *in = (byte *)sprite._surface.pixels + (sprite._surface.h - j - 1) * sprite._surface.w; const byte *in = (const byte *)sprite._surface.getBasePtr(0, sprite._surface.h - j - 1);
byte *out = pixels + ((j + y) * _screen.w) + x; byte *out = pixels + ((j + y) * _screen.w) + x;
for (int i = 0; i < sprite._surface.w; i++) for (int i = 0; i < sprite._surface.w; i++)
if ((x + i >= 0) && (x + i < _screen.w) && in[i]) if ((x + i >= 0) && (x + i < _screen.w) && in[i])

View file

@ -110,7 +110,7 @@ void Screen::copyToScreen() {
// If a full update is needed, update the whole screen // If a full update is needed, update the whole screen
if (_surface->needsFullUpdate()) { if (_surface->needsFullUpdate()) {
byte *ptr = (byte *)_surface->getBasePtr(0, 0); byte *ptr = (byte *)_surface->getPixels();
_vm->_system->copyRectToScreen(ptr, kScreenWidth, _vm->_system->copyRectToScreen(ptr, kScreenWidth,
0, 0, kScreenWidth, kScreenHeight); 0, 0, kScreenWidth, kScreenHeight);
@ -138,7 +138,7 @@ void Screen::copyToScreen() {
* Clears the screen and marks the whole screen dirty. * Clears the screen and marks the whole screen dirty.
*/ */
void Screen::clearScreen() { void Screen::clearScreen() {
byte *ptr = (byte *)_surface->getBasePtr(0, 0); byte *ptr = (byte *)_surface->getPixels();
_surface->markDirty(); _surface->markDirty();

View file

@ -80,7 +80,7 @@ void Surface::markClean() {
* @brief Fills the surface with the specified color * @brief Fills the surface with the specified color
*/ */
void Surface::fill(uint color) { void Surface::fill(uint color) {
byte *ptr = (byte *)getBasePtr(0, 0); byte *ptr = (byte *)getPixels();
memset(ptr, color, w * h); memset(ptr, color, w * h);
} }

View file

@ -132,7 +132,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra
byte *prevFrame = (byte *)malloc(64000); byte *prevFrame = (byte *)malloc(64000);
Graphics::Surface *screenSurf = _system->lockScreen(); Graphics::Surface *screenSurf = _system->lockScreen();
byte *screenBuffer = (byte *)screenSurf->pixels; byte *screenBuffer = (byte *)screenSurf->getPixels();
uint16 screenPitch = screenSurf->pitch; uint16 screenPitch = screenSurf->pitch;
for (int y = 0; y < 200; y++) { for (int y = 0; y < 200; y++) {
memcpy(prevFrame+y*320, screenBuffer+y*screenPitch, 320); memcpy(prevFrame+y*320, screenBuffer+y*screenPitch, 320);
@ -449,7 +449,7 @@ void DrasculaEngine::screenSaver() {
int x1_, y1_, off1, off2; int x1_, y1_, off1, off2;
Graphics::Surface *screenSurf = _system->lockScreen(); Graphics::Surface *screenSurf = _system->lockScreen();
byte *screenBuffer = (byte *)screenSurf->pixels; byte *screenBuffer = (byte *)screenSurf->getPixels();
uint16 screenPitch = screenSurf->pitch; uint16 screenPitch = screenSurf->pitch;
for (int i = 0; i < 200; i++) { for (int i = 0; i < 200; i++) {
for (int j = 0; j < 320; j++) { for (int j = 0; j < 320; j++) {
@ -538,7 +538,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
waitFrameSSN(); waitFrameSSN();
Graphics::Surface *screenSurf = _system->lockScreen(); Graphics::Surface *screenSurf = _system->lockScreen();
byte *screenBuffer = (byte *)screenSurf->pixels; byte *screenBuffer = (byte *)screenSurf->getPixels();
uint16 screenPitch = screenSurf->pitch; uint16 screenPitch = screenSurf->pitch;
if (FrameSSN) if (FrameSSN)
mixVideo(screenBuffer, screenSurface, screenPitch); mixVideo(screenBuffer, screenSurface, screenPitch);
@ -557,7 +557,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
free(BufferSSN); free(BufferSSN);
waitFrameSSN(); waitFrameSSN();
Graphics::Surface *screenSurf = _system->lockScreen(); Graphics::Surface *screenSurf = _system->lockScreen();
byte *screenBuffer = (byte *)screenSurf->pixels; byte *screenBuffer = (byte *)screenSurf->getPixels();
uint16 screenPitch = screenSurf->pitch; uint16 screenPitch = screenSurf->pitch;
if (FrameSSN) if (FrameSSN)
mixVideo(screenBuffer, screenSurface, screenPitch); mixVideo(screenBuffer, screenSurface, screenPitch);

View file

@ -821,7 +821,7 @@ bool Surface::loadIFF(Common::SeekableReadStream &stream) {
return false; return false;
resize(decoder.getSurface()->w, decoder.getSurface()->h); resize(decoder.getSurface()->w, decoder.getSurface()->h);
memcpy(_vidMem, decoder.getSurface()->pixels, decoder.getSurface()->w * decoder.getSurface()->h); memcpy(_vidMem, decoder.getSurface()->getPixels(), decoder.getSurface()->w * decoder.getSurface()->h);
return true; return true;
} }

View file

@ -734,7 +734,11 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest,
if (!surface) if (!surface)
return false; return false;
Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)surface->pixels); // FIXME? This currently casts away const from the pixel data. However, it
// is only used read-only in this case (as far as I can tell). Not casting
// the const qualifier away will lead to an additional allocation and copy
// of the frame data which is undesirable.
Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast<void *>(surface->getPixels()));
dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp); dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp);
return true; return true;

View file

@ -82,8 +82,8 @@ void GraphicsMan::mergeFgAndBg() {
uint32 i; uint32 i;
byte *countf, *countb; byte *countf, *countb;
countf = (byte *)_foreground.getBasePtr(0, 0); countf = (byte *)_foreground.getPixels();
countb = (byte *)_background.getBasePtr(0, 0); countb = (byte *)_background.getPixels();
for (i = 640 * 320; i; i--) { for (i = 640 * 320; i; i--) {
if (255 == *(countf)) { if (255 == *(countf)) {
*(countf) = *(countb); *(countf) = *(countb);
@ -94,7 +94,7 @@ void GraphicsMan::mergeFgAndBg() {
} }
void GraphicsMan::updateScreen(Graphics::Surface *source) { void GraphicsMan::updateScreen(Graphics::Surface *source) {
_vm->_system->copyRectToScreen(source->getBasePtr(0, 0), 640, 0, 80, 640, 320); _vm->_system->copyRectToScreen(source->getPixels(), 640, 0, 80, 640, 320);
change(); change();
} }

View file

@ -160,7 +160,7 @@ bool ROQPlayer::playFrameInternal() {
if (_dirty) { if (_dirty) {
// Update the screen // Update the screen
_syst->copyRectToScreen(_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h); _syst->copyRectToScreen(_bg->getPixels(), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
_syst->updateScreen(); _syst->updateScreen();
// Clear the dirty flag // Clear the dirty flag
@ -291,8 +291,8 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
} }
// Clear the buffers with black YUV values // Clear the buffers with black YUV values
byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0); byte *ptr1 = (byte *)_currBuf->getPixels();
byte *ptr2 = (byte *)_prevBuf->getBasePtr(0, 0); byte *ptr2 = (byte *)_prevBuf->getPixels();
for (int i = 0; i < width * height; i++) { for (int i = 0; i < width * height; i++) {
*ptr1++ = 0; *ptr1++ = 0;
*ptr1++ = 128; *ptr1++ = 128;
@ -436,11 +436,11 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder(); Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder();
jpg->loadStream(*_file); jpg->loadStream(*_file);
const byte *y = (const byte *)jpg->getComponent(1)->getBasePtr(0, 0); const byte *y = (const byte *)jpg->getComponent(1)->getPixels();
const byte *u = (const byte *)jpg->getComponent(2)->getBasePtr(0, 0); const byte *u = (const byte *)jpg->getComponent(2)->getPixels();
const byte *v = (const byte *)jpg->getComponent(3)->getBasePtr(0, 0); const byte *v = (const byte *)jpg->getComponent(3)->getPixels();
byte *ptr = (byte *)_currBuf->getBasePtr(0, 0); byte *ptr = (byte *)_currBuf->getPixels();
for (int i = 0; i < _currBuf->w * _currBuf->h; i++) { for (int i = 0; i < _currBuf->w * _currBuf->h; i++) {
*ptr++ = *y++; *ptr++ = *y++;
*ptr++ = *u++; *ptr++ = *u++;

View file

@ -373,7 +373,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) { DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) {
rect.translate(0, -80); rect.translate(0, -80);
_vm->_graphicsMan->_foreground.frameRect(rect, 250); _vm->_graphicsMan->_foreground.frameRect(rect, 250);
_vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320); _vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
_vm->_system->updateScreen(); _vm->_system->updateScreen();
} }
@ -983,7 +983,7 @@ void Script::o_strcmpnejmp_var() { // 0x21
void Script::o_copybgtofg() { // 0x22 void Script::o_copybgtofg() { // 0x22
debugScript(1, true, "COPY_BG_TO_FG"); debugScript(1, true, "COPY_BG_TO_FG");
memcpy(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_background.getBasePtr(0, 0), 640 * 320); memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * 320);
} }
void Script::o_strcmpeqjmp() { // 0x23 void Script::o_strcmpeqjmp() { // 0x23

View file

@ -358,7 +358,7 @@ void VDXPlayer::getStill(Common::ReadStream *in) {
byte *buf; byte *buf;
if (_flagOne) { if (_flagOne) {
// Paint to the foreground // Paint to the foreground
buf = (byte *)_fg->getBasePtr(0, 0); buf = (byte *)_fg->getPixels();
if (_flag2Byte) { if (_flag2Byte) {
mask = 0xff; mask = 0xff;
} else { } else {
@ -370,7 +370,7 @@ void VDXPlayer::getStill(Common::ReadStream *in) {
_flagFirstFrame = true; _flagFirstFrame = true;
} else { } else {
// Paint to the background // Paint to the background
buf = (byte *)_bg->getBasePtr(0, 0); buf = (byte *)_bg->getPixels();
} }
// Read the palette // Read the palette
@ -486,9 +486,9 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth)
// TODO: Verify just the else block is required // TODO: Verify just the else block is required
//if (_flagOne) { //if (_flagOne) {
// Paint to the foreground // Paint to the foreground
//dest = (byte *)_fg->getBasePtr(0, 0) + offset; //dest = (byte *)_fg->getPixels() + offset;
//} else { //} else {
dest = (byte *)_bg->getBasePtr(0, 0) + offset; dest = (byte *)_bg->getPixels() + offset;
//} //}
// Move the pointers to the beginning of the current block // Move the pointers to the beginning of the current block
@ -496,8 +496,8 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth)
dest += blockOff; dest += blockOff;
byte *fgBuf = 0; byte *fgBuf = 0;
if (_flagSeven) { if (_flagSeven) {
fgBuf = (byte *)_fg->getBasePtr(0, 0) + offset + blockOff; fgBuf = (byte *)_fg->getPixels() + offset + blockOff;
//byte *bgBuf = (byte *)_bg->getBasePtr(0, 0) + offset + blockOff; //byte *bgBuf = (byte *)_bg->getPixels() + offset + blockOff;
} }
for (int y = TILE_SIZE; y; y--) { for (int y = TILE_SIZE; y; y--) {
@ -550,7 +550,7 @@ void VDXPlayer::fadeIn(uint8 *targetpal) {
// TODO: Is it required? If so, move to an appropiate place // TODO: Is it required? If so, move to an appropiate place
// Copy the foreground to the background // Copy the foreground to the background
memcpy((byte *)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), (byte *)_vm->_graphicsMan->_background.getBasePtr(0, 0), 640 * 320); memcpy((byte *)_vm->_graphicsMan->_foreground.getPixels(), (byte *)_vm->_graphicsMan->_background.getPixels(), 640 * 320);
// Start a fadein // Start a fadein
_vm->_graphicsMan->fadeIn(targetpal); _vm->_graphicsMan->fadeIn(targetpal);

View file

@ -691,7 +691,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) {
Graphics::Surface thumb8; Graphics::Surface thumb8;
_vm->_saveLoad->convertThumb16To8(header._thumbnail, &thumb8); _vm->_saveLoad->convertThumb16To8(header._thumbnail, &thumb8);
byte *thumb = (byte *)thumb8.pixels; byte *thumb = (byte *)thumb8.getPixels();
int16 startPosX_ = _vm->_events->_startPos.x; int16 startPosX_ = _vm->_events->_startPos.x;
switch (slotNumber) { switch (slotNumber) {

View file

@ -325,7 +325,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte
// Copy out the dimensions and pixels of the decoded surface // Copy out the dimensions and pixels of the decoded surface
_largeScreenFl = s->w > SCREEN_WIDTH; _largeScreenFl = s->w > SCREEN_WIDTH;
Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); Common::copy((const byte *)s->getPixels(), (const byte *)s->getBasePtr(0, s->h), surface);
// Copy out the palette // Copy out the palette
const byte *palSrc = pcxDecoder.getPalette(); const byte *palSrc = pcxDecoder.getPalette();
@ -1202,7 +1202,7 @@ void GraphicsManager::displayZones() {
void GraphicsManager::displayLines() { void GraphicsManager::displayLines() {
Graphics::Surface *screenSurface = g_system->lockScreen(); Graphics::Surface *screenSurface = g_system->lockScreen();
uint16* pixels = (uint16*)screenSurface->pixels; uint16 *pixels = (uint16 *)screenSurface->getPixels();
for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) {
int i = 0; int i = 0;

View file

@ -233,14 +233,14 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) {
Graphics::Surface thumb8; Graphics::Surface thumb8;
thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.pixels, _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.getPixels(),
_vm->_events->_startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); _vm->_events->_startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80);
// Convert the 8-bit pixel to 16 bit surface // Convert the 8-bit pixel to 16 bit surface
s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
const byte *srcP = (const byte *)thumb8.pixels; const byte *srcP = (const byte *)thumb8.getPixels();
uint16 *destP = (uint16 *)s->pixels; uint16 *destP = (uint16 *)s->getPixels();
for (int yp = 0; yp < h; ++yp) { for (int yp = 0; yp < h; ++yp) {
// Copy over the line, using the source pixels as lookups into the pixels palette // Copy over the line, using the source pixels as lookups into the pixels palette
@ -299,8 +299,8 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su
pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]); pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]);
} }
const uint16 *srcP = (const uint16 *)thumb16->pixels; const uint16 *srcP = (const uint16 *)thumb16->getPixels();
byte *destP = (byte *)thumb8->pixels; byte *destP = (byte *)thumb8->getPixels();
for (int yp = 0; yp < thumb16->h; ++yp) { for (int yp = 0; yp < thumb16->h; ++yp) {
const uint16 *lineSrcP = srcP; const uint16 *lineSrcP = srcP;

View file

@ -140,8 +140,8 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
_arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat()); _arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat());
_arrayBmp[i * 2 + 1] = new Graphics::Surface(); _arrayBmp[i * 2 + 1] = new Graphics::Surface();
_arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat()); _arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat());
byte *src = (byte *)_arrayBmp[i * 2]->pixels; byte *src = (byte *)_arrayBmp[i * 2]->getPixels();
byte *dst = (byte *)_arrayBmp[i * 2 + 1]->pixels; byte *dst = (byte *)_arrayBmp[i * 2 + 1]->getPixels();
for (int j = 0; j < _arrayBmp[i * 2]->h; j++) { for (int j = 0; j < _arrayBmp[i * 2]->h; j++) {
src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j); src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j);

View file

@ -89,11 +89,7 @@ void intro_v1d::preNewGame() {
void intro_v1d::introInit() { void intro_v1d::introInit() {
_introState = 0; _introState = 0;
_introTicks = 0; _introTicks = 0;
_surf.w = 320; _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8());
_surf.h = 200;
_surf.pixels = _vm->_screen->getFrontBuffer();
_surf.pitch = 320;
_surf.format = Graphics::PixelFormat::createFormatCLUT8();
_vm->_screen->displayList(kDisplayInit); _vm->_screen->displayList(kDisplayInit);
} }
@ -243,11 +239,7 @@ void intro_v2d::preNewGame() {
void intro_v2d::introInit() { void intro_v2d::introInit() {
_vm->_screen->displayList(kDisplayInit); _vm->_screen->displayList(kDisplayInit);
_vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen
_surf.w = 320; _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8());
_surf.h = 200;
_surf.pixels = _vm->_screen->getFrontBuffer();
_surf.pitch = 320;
_surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128]; char buffer[128];
@ -289,11 +281,7 @@ void intro_v3d::preNewGame() {
void intro_v3d::introInit() { void intro_v3d::introInit() {
_vm->_screen->displayList(kDisplayInit); _vm->_screen->displayList(kDisplayInit);
_vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen
_surf.w = 320; _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8());
_surf.h = 200;
_surf.pixels = _vm->_screen->getFrontBuffer();
_surf.pitch = 320;
_surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128]; char buffer[128];
if (_vm->_boot._registered) if (_vm->_boot._registered)

View file

@ -270,7 +270,7 @@ void Animation::play() {
draw(s); draw(s);
// XXX: Update the screen // XXX: Update the screen
g_system->copyRectToScreen(s->pixels, s->pitch, 0, 0, s->w, s->h); g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
// Free the temporary surface // Free the temporary surface
s->free(); s->free();

View file

@ -128,8 +128,8 @@ AnimFrame::~AnimFrame() {
} }
Common::Rect AnimFrame::draw(Graphics::Surface *s) { Common::Rect AnimFrame::draw(Graphics::Surface *s) {
byte *inp = (byte *)_image.pixels; byte *inp = (byte *)_image.getPixels();
uint16 *outp = (uint16 *)s->pixels; uint16 *outp = (uint16 *)s->getPixels();
for (int i = 0; i < 640 * 480; i++, inp++, outp++) { for (int i = 0; i < 640 * 480; i++, inp++, outp++) {
if (*inp) if (*inp)
*outp = _palette[*inp]; *outp = _palette[*inp];
@ -155,7 +155,7 @@ void AnimFrame::decomp4(Common::SeekableReadStream *in, const FrameInfo &f) {
} }
void AnimFrame::decomp34(Common::SeekableReadStream *in, const FrameInfo &f, byte mask, byte shift) { void AnimFrame::decomp34(Common::SeekableReadStream *in, const FrameInfo &f, byte mask, byte shift) {
byte *p = (byte *)_image.getBasePtr(0, 0); byte *p = (byte *)_image.getPixels();
uint32 skip = f.initialSkip / 2; uint32 skip = f.initialSkip / 2;
uint32 size = f.decompressedEndOffset / 2; uint32 size = f.decompressedEndOffset / 2;
@ -200,7 +200,7 @@ void AnimFrame::decomp34(Common::SeekableReadStream *in, const FrameInfo &f, byt
} }
void AnimFrame::decomp5(Common::SeekableReadStream *in, const FrameInfo &f) { void AnimFrame::decomp5(Common::SeekableReadStream *in, const FrameInfo &f) {
byte *p = (byte *)_image.getBasePtr(0, 0); byte *p = (byte *)_image.getPixels();
uint32 skip = f.initialSkip / 2; uint32 skip = f.initialSkip / 2;
uint32 size = f.decompressedEndOffset / 2; uint32 size = f.decompressedEndOffset / 2;
@ -235,7 +235,7 @@ void AnimFrame::decomp5(Common::SeekableReadStream *in, const FrameInfo &f) {
} }
void AnimFrame::decomp7(Common::SeekableReadStream *in, const FrameInfo &f) { void AnimFrame::decomp7(Common::SeekableReadStream *in, const FrameInfo &f) {
byte *p = (byte *)_image.getBasePtr(0, 0); byte *p = (byte *)_image.getPixels();
uint32 skip = f.initialSkip / 2; uint32 skip = f.initialSkip / 2;
uint32 size = f.decompressedEndOffset / 2; uint32 size = f.decompressedEndOffset / 2;
@ -288,7 +288,7 @@ void AnimFrame::decomp7(Common::SeekableReadStream *in, const FrameInfo &f) {
} }
void AnimFrame::decompFF(Common::SeekableReadStream *in, const FrameInfo &f) { void AnimFrame::decompFF(Common::SeekableReadStream *in, const FrameInfo &f) {
byte *p = (byte *)_image.getBasePtr(0, 0); byte *p = (byte *)_image.getPixels();
uint32 skip = f.initialSkip / 2; uint32 skip = f.initialSkip / 2;
uint32 size = f.decompressedEndOffset / 2; uint32 size = f.decompressedEndOffset / 2;

View file

@ -131,11 +131,11 @@ void GraphicsManager::mergePlanes() {
// Clear screen surface // Clear screen surface
_screen.fillRect(Common::Rect(640, 480), 0); _screen.fillRect(Common::Rect(640, 480), 0);
uint16 *screen = (uint16 *)_screen.pixels; uint16 *screen = (uint16 *)_screen.getPixels();
uint16 *inventory = (uint16 *)_inventory.pixels; uint16 *inventory = (uint16 *)_inventory.getPixels();
uint16 *overlay = (uint16 *)_overlay.pixels; uint16 *overlay = (uint16 *)_overlay.getPixels();
uint16 *backgroundC = (uint16 *)_backgroundC.pixels; uint16 *backgroundC = (uint16 *)_backgroundC.getPixels();
uint16 *backgroundA = (uint16 *)_backgroundA.pixels; uint16 *backgroundA = (uint16 *)_backgroundA.getPixels();
for (int i = 0; i < 640 * 480; i++) { for (int i = 0; i < 640 * 480; i++) {
@ -160,7 +160,7 @@ void GraphicsManager::mergePlanes() {
void GraphicsManager::updateScreen() { void GraphicsManager::updateScreen() {
g_system->fillScreen(0); g_system->fillScreen(0);
g_system->copyRectToScreen(_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480); g_system->copyRectToScreen(_screen.getPixels(), 640 * 2, 0, 0, 640, 480);
} }
} // End of namespace LastExpress } // End of namespace LastExpress

View file

@ -83,7 +83,7 @@ void decompressImage(byte *source, Graphics::Surface &surface, uint16 cmdOffs, u
if ((maskFlags != 0) && (maskFlags != 2) && (pixelFlags != 0) && (pixelFlags != 2) && (cmdFlags != 0)) if ((maskFlags != 0) && (maskFlags != 2) && (pixelFlags != 0) && (pixelFlags != 2) && (cmdFlags != 0))
error("decompressImage() Unsupported flags: cmdFlags = %02X; maskFlags = %02X, pixelFlags = %02X", cmdFlags, maskFlags, pixelFlags); error("decompressImage() Unsupported flags: cmdFlags = %02X; maskFlags = %02X, pixelFlags = %02X", cmdFlags, maskFlags, pixelFlags);
byte *destPtr = (byte *)surface.getBasePtr(0, 0); byte *destPtr = (byte *)surface.getPixels();
byte lineBuf[640 * 4]; byte lineBuf[640 * 4];
byte bitBuf[40]; byte bitBuf[40];
@ -196,7 +196,7 @@ void decompressMovieImage(byte *source, Graphics::Surface &surface, uint16 cmdOf
byte *maskBuffer = source + maskOffs; byte *maskBuffer = source + maskOffs;
byte *pixelBuffer = source + pixelOffs; byte *pixelBuffer = source + pixelOffs;
byte *destPtr = (byte *)surface.getBasePtr(0, 0); byte *destPtr = (byte *)surface.getPixels();
byte bitBuf[40]; byte bitBuf[40];

View file

@ -248,7 +248,7 @@ void PmvPlayer::handleEvents() {
} }
void PmvPlayer::updateScreen() { void PmvPlayer::updateScreen() {
_vm->_system->copyRectToScreen(_surface->pixels, _surface->pitch, _vm->_system->copyRectToScreen(_surface->getPixels(), _surface->pitch,
(320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h); (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h);
_vm->_system->updateScreen(); _vm->_system->updateScreen();
} }

View file

@ -344,12 +344,12 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask
void Screen::updateSprites() { void Screen::updateSprites() {
// TODO: This needs some more work, dirty rectangles are currently not used // TODO: This needs some more work, dirty rectangles are currently not used
memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); memcpy(_workScreen->getPixels(), _backgroundScreen->getPixels(), 64000);
drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0);
drawSpriteChannels(_workScreenDrawCtx, 1, 2); drawSpriteChannels(_workScreenDrawCtx, 1, 2);
_vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); _vm->_system->copyRectToScreen(_workScreen->getPixels(), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
_vm->_screen->updateScreenAndWait(10); _vm->_screen->updateScreenAndWait(10);
} }
@ -593,7 +593,7 @@ void Screen::show() {
return; return;
drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0);
memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); memcpy(_workScreen->getPixels(), _backgroundScreen->getPixels(), 64000);
drawSpriteChannels(_workScreenDrawCtx, 1, 2); drawSpriteChannels(_workScreenDrawCtx, 1, 2);
_fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount); _fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount);
@ -775,7 +775,7 @@ void Screen::unlockScreen() {
} }
void Screen::showWorkScreen() { void Screen::showWorkScreen() {
_vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); _vm->_system->copyRectToScreen(_workScreen->getPixels(), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
} }
void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {

View file

@ -368,7 +368,7 @@ void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" right to left // "Screen slide in" right to left
void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int x = 8; x <= 320; x += 8) { for (int x = 8; x <= 320; x += 8) {
_screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200); _screen->copyRectToScreen(surface->getPixels(), surface->pitch, 320 - x, 0, x, 200);
_screen->updateScreenAndWait(25); _screen->updateScreenAndWait(25);
} }
setPalette(palette); setPalette(palette);
@ -529,7 +529,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen slide in" bottom to top // "Screen slide in" bottom to top
void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
for (int y = 4; y <= 200; y += 4) { for (int y = 4; y <= 200; y += 4) {
_screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y); _screen->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 200 - y, 320, y);
_screen->updateScreenAndWait(25); _screen->updateScreenAndWait(25);
} }

View file

@ -574,7 +574,7 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) {
PictureResource *flex = _vm->_res->getPicture(argv[2]); PictureResource *flex = _vm->_res->getPicture(argv[2]);
if (flex) { if (flex) {
Graphics::Surface *surf = flex->getPicture(); Graphics::Surface *surf = flex->getPicture();
CursorMan.replaceCursor(surf->pixels, surf->w, surf->h, argv[1], argv[0], 0); CursorMan.replaceCursor(surf->getPixels(), surf->w, surf->h, argv[1], argv[0], 0);
_vm->_res->freeResource(flex); _vm->_res->freeResource(flex);
} }
return 0; return 0;

View file

@ -580,7 +580,7 @@ void MohawkBitmap::drawRaw(Graphics::Surface *surface) {
_data->skip(_header.bytesPerRow - _header.width * 3); _data->skip(_header.bytesPerRow - _header.width * 3);
} else { } else {
_data->read((byte *)surface->pixels + y * _header.width, _header.width); _data->read((byte *)surface->getBasePtr(0, y), _header.width);
_data->skip(_header.bytesPerRow - _header.width); _data->skip(_header.bytesPerRow - _header.width);
} }
} }
@ -599,7 +599,7 @@ void MohawkBitmap::drawRLE8(Graphics::Surface *surface, bool isLE) {
for (uint16 i = 0; i < _header.height; i++) { for (uint16 i = 0; i < _header.height; i++) {
uint16 rowByteCount = isLE ? _data->readUint16LE() : _data->readUint16BE(); uint16 rowByteCount = isLE ? _data->readUint16LE() : _data->readUint16BE();
int32 startPos = _data->pos(); int32 startPos = _data->pos();
byte *dst = (byte *)surface->pixels + i * _header.width; byte *dst = (byte *)surface->getBasePtr(0, i);
int16 remaining = _header.width; int16 remaining = _header.width;
while (remaining > 0) { while (remaining > 0) {
@ -779,7 +779,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) {
} }
Graphics::Surface *surface = createSurface(_header.width, _header.height); Graphics::Surface *surface = createSurface(_header.width, _header.height);
memset(surface->pixels, 0, _header.width * _header.height); memset(surface->getPixels(), 0, _header.width * _header.height);
// Expand the <8bpp data to one byte per pixel // Expand the <8bpp data to one byte per pixel
switch (getBitsPerPixel()) { switch (getBitsPerPixel()) {
@ -801,7 +801,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) {
void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) { void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) {
assert(surface->format.bytesPerPixel == 1); assert(surface->format.bytesPerPixel == 1);
byte *dst = (byte *)surface->pixels; byte *dst = (byte *)surface->getPixels();
// Expand the 8 pixels in a byte into a full byte per pixel // Expand the 8 pixels in a byte into a full byte per pixel
@ -830,7 +830,7 @@ void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableRead
// Note that the image is in EGA planar form and not just standard 4bpp // Note that the image is in EGA planar form and not just standard 4bpp
// This seems to contradict the PoP specs which seem to do something else // This seems to contradict the PoP specs which seem to do something else
byte *dst = (byte *)surface->pixels; byte *dst = (byte *)surface->getPixels();
for (uint32 i = 0; i < surface->h; i++) { for (uint32 i = 0; i < surface->h; i++) {
uint x = 0; uint x = 0;

View file

@ -121,11 +121,11 @@ void MystCursorManager::setCursor(uint16 id) {
// Myst ME stores some cursors as 24bpp images instead of 8bpp // Myst ME stores some cursors as 24bpp images instead of 8bpp
if (surface->format.bytesPerPixel == 1) { if (surface->format.bytesPerPixel == 1) {
CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0); CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, 0);
CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256); CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256);
} else { } else {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat);
} }
_vm->_needsUpdate = true; _vm->_needsUpdate = true;

View file

@ -255,7 +255,7 @@ void RivenGraphics::runScheduledTransition() {
} }
// For now, just copy the image to screen without doing any transition. // For now, just copy the image to screen without doing any transition.
_vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->copyRectToScreen(_mainScreen->getPixels(), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
_vm->_system->updateScreen(); _vm->_system->updateScreen();
_scheduledTransition = -1; // Clear scheduled transition _scheduledTransition = -1; // Clear scheduled transition
@ -345,7 +345,7 @@ void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) {
mhkSurface->convertToTrueColor(); mhkSurface->convertToTrueColor();
Graphics::Surface *surface = mhkSurface->getSurface(); Graphics::Surface *surface = mhkSurface->getSurface();
_vm->_system->copyRectToScreen(surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h); _vm->_system->copyRectToScreen(surface->getPixels(), surface->pitch, rect->left, rect->top, surface->w, surface->h);
delete mhkSurface; delete mhkSurface;
} }
@ -420,7 +420,7 @@ void RivenGraphics::updateCredits() {
} else { } else {
// Otheriwse, we're scrolling // Otheriwse, we're scrolling
// Move the screen up one row // Move the screen up one row
memmove(_mainScreen->pixels, _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); memmove(_mainScreen->getPixels(), _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1));
// Only update as long as we're not before the last frame // Only update as long as we're not before the last frame
// Otherwise, we're just moving up a row (which we already did) // Otherwise, we're just moving up a row (which we already did)
@ -437,7 +437,7 @@ void RivenGraphics::updateCredits() {
} }
// Now flush the new screen // Now flush the new screen
_vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->copyRectToScreen(_mainScreen->getPixels(), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
_vm->_system->updateScreen(); _vm->_system->updateScreen();
} }
} }

View file

@ -245,7 +245,7 @@ bool VideoManager::updateMovies() {
// Clip the width/height to make sure we stay on the screen (Myst does this a few times) // Clip the width/height to make sure we stay on the screen (Myst does this a few times)
uint16 width = MIN<int32>(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x); uint16 width = MIN<int32>(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x);
uint16 height = MIN<int32>(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y); uint16 height = MIN<int32>(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y);
_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height); _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height);
// We've drawn something to the screen, make sure we update it // We've drawn something to the screen, make sure we update it
updateScreen = true; updateScreen = true;

View file

@ -897,12 +897,7 @@ Graphics::Surface ScreenSurface::lockArea(const Common::Rect &bounds) {
_dirtyRects.push_back(bounds); _dirtyRects.push_back(bounds);
Graphics::Surface s; Graphics::Surface s;
s.format = format; s.init(bounds.width(), bounds.height(), pitch, getBasePtr(bounds.left, bounds.top), format);
s.pixels = getBasePtr(bounds.left, bounds.top);
s.pitch = pitch;
s.w = bounds.width();
s.h = bounds.height();
return s; return s;
} }
@ -1067,7 +1062,7 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) {
assert((pt.x >= 0) && (pt.y >= 0) && (pt.x <= SCREEN_WIDTH) && (pt.y <= SCREEN_ORIG_HEIGHT)); assert((pt.x >= 0) && (pt.y >= 0) && (pt.x <= SCREEN_WIDTH) && (pt.y <= SCREEN_ORIG_HEIGHT));
Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2));
byte *destP = (byte *)destSurface.pixels; byte *destP = (byte *)destSurface.getPixels();
*destP = palIndex; *destP = palIndex;
*(destP + SCREEN_WIDTH) = palIndex; *(destP + SCREEN_WIDTH) = palIndex;
} }

View file

@ -393,7 +393,7 @@ void Menu::menuUp(int msgId) {
// Get a pointer to the source and destination of the area to restore // Get a pointer to the source and destination of the area to restore
const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10);
Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT));
byte *pDest = (byte *)destArea.getBasePtr(0, 0); byte *pDest = (byte *)destArea.getPixels();
// Copy the data // Copy the data
Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest); Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest);

View file

@ -189,7 +189,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common
Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface *thumb = new Graphics::Surface();
Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette);
Graphics::saveThumbnail(*out, *thumb); Graphics::saveThumbnail(*out, *thumb);
thumb->free(); thumb->free();
delete thumb; delete thumb;

View file

@ -183,7 +183,7 @@ void Mouse::updateCursor() {
_drawOffset = _mouseCursorResource.getRect(); _drawOffset = _mouseCursorResource.getRect();
_surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2); _surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2);
Graphics::Surface *cursorSurface = _surface->getSurface(); Graphics::Surface *cursorSurface = _surface->getSurface();
CursorMan.replaceCursor((const byte*)cursorSurface->pixels, CursorMan.replaceCursor((const byte*)cursorSurface->getPixels(),
cursorSurface->w, cursorSurface->h, -_drawOffset.x, -_drawOffset.y, 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) { void SpriteResource::draw(Graphics::Surface *destSurface, bool flipX, bool flipY) {
if (_pixels) { if (_pixels) {
byte *dest = (byte*)destSurface->pixels; byte *dest = (byte*)destSurface->getPixels();
const int destPitch = destSurface->pitch; const int destPitch = destSurface->pitch;
if (_rle) if (_rle)
unpackSpriteRle(_pixels, _dimensions.width, _dimensions.height, dest, destPitch, flipX, flipY); 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) { void AnimResource::draw(uint frameIndex, Graphics::Surface *destSurface, bool flipX, bool flipY) {
const AnimFrameInfo frameInfo = _frames[frameIndex]; const AnimFrameInfo frameInfo = _frames[frameIndex];
byte *dest = (byte*)destSurface->pixels; byte *dest = (byte*)destSurface->getPixels();
const int destPitch = destSurface->pitch; const int destPitch = destSurface->pitch;
_currSpriteData = _spriteData + frameInfo.spriteDataOffs; _currSpriteData = _spriteData + frameInfo.spriteDataOffs;
_width = frameInfo.drawOffset.width; _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 sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment
const int destPitch = destSurface->pitch; const int destPitch = destSurface->pitch;
const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32;
byte *dest = (byte*)destSurface->pixels; byte *dest = (byte*)destSurface->getPixels();
for (int16 yc = 0; yc < 32; yc++) { for (int16 yc = 0; yc < 32; yc++) {
memcpy(dest, source, 32); memcpy(dest, source, 32);
source += sourcePitch; source += sourcePitch;

View file

@ -54,7 +54,7 @@ void Screen::update() {
if (_fullRefresh) { if (_fullRefresh) {
// NOTE When playing a fullscreen/doubled Smacker video usually a full screen refresh is needed // 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->getPixels(), _backScreen->pitch, 0, 0, 640, 480);
_fullRefresh = false; _fullRefresh = false;
return; return;
} }
@ -174,7 +174,7 @@ void Screen::updatePalette() {
} }
void Screen::clear() { void Screen::clear() {
memset(_backScreen->pixels, 0, _backScreen->pitch * _backScreen->h); memset(_backScreen->getPixels(), 0, _backScreen->pitch * _backScreen->h);
_fullRefresh = true; _fullRefresh = true;
clearRenderQueue(); clearRenderQueue();
} }
@ -257,7 +257,7 @@ void Screen::drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, ND
void Screen::drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect) { void Screen::drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect) {
const byte *source = (const byte*)surface->getBasePtr(0, 0); const byte *source = (const byte*)surface->getPixels();
byte *dest = (byte*)_backScreen->getBasePtr(drawRect.x, drawRect.y); byte *dest = (byte*)_backScreen->getBasePtr(drawRect.x, drawRect.y);
for (int16 yc = 0; yc < surface->h; yc++) { for (int16 yc = 0; yc < surface->h; yc++) {

View file

@ -225,7 +225,7 @@ void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surfac
} }
surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
stream.read(surf.pixels, width * height); stream.read(surf.getPixels(), width * height);
} }
Frames* DosDisk_br::loadPointer(const char *name) { Frames* DosDisk_br::loadPointer(const char *name) {
@ -449,7 +449,7 @@ void AmigaDisk_br::init() {
void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) { void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) {
uint size = surf.w * surf.h; uint size = surf.w * surf.h;
byte *data = (byte *)surf.pixels; byte *data = (byte *)surf.getPixels();
for (uint i = 0; i < size; i++, data++) { for (uint i = 0; i < size; i++, data++) {
if (transparentColor == -1 || transparentColor != *data) if (transparentColor == -1 || transparentColor != *data)
*data += 16; *data += 16;
@ -552,7 +552,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name, uint32 w, uint32 h) {
MaskBuffer *buffer = new MaskBuffer; MaskBuffer *buffer = new MaskBuffer;
// surface width was shrunk to 1/4th of the bitmap width due to the pixel packing // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing
buffer->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); buffer->create(decoder.getSurface()->w * 4, decoder.getSurface()->h);
memcpy(buffer->data, decoder.getSurface()->pixels, buffer->size); memcpy(buffer->data, decoder.getSurface()->getPixels(), buffer->size);
buffer->bigEndian = true; buffer->bigEndian = true;
finalpass(buffer->data, buffer->size); finalpass(buffer->data, buffer->size);
return buffer; return buffer;
@ -612,7 +612,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) {
stream->read(shadow, shadowSize); stream->read(shadow, shadowSize);
for (int32 i = 0; i < surf->h; ++i) { for (int32 i = 0; i < surf->h; ++i) {
byte *src = shadow + shadowWidth * i; byte *src = shadow + shadowWidth * i;
byte *dst = (byte *)surf->pixels + surf->pitch * i; byte *dst = (byte *)surf->getPixels() + surf->pitch * i;
for (int32 j = 0; j < surf->w; ++j, ++dst) { for (int32 j = 0; j < surf->w; ++j, ++dst) {
byte bit = src[j/8] & (1 << (7 - (j & 7))); byte bit = src[j/8] & (1 << (7 - (j & 7)));

View file

@ -482,7 +482,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) {
// read bitmap, mask and path data and extract them into the 3 buffers // read bitmap, mask and path data and extract them into the 3 buffers
info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8()); info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8());
createMaskAndPathBuffers(info); createMaskAndPathBuffers(info);
unpackBackground(stream, (byte *)info.bg.pixels, info._mask->data, info._path->data); unpackBackground(stream, (byte *)info.bg.getPixels(), info._mask->data, info._path->data);
delete stream; delete stream;
} }
@ -976,7 +976,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo& info, const char *name) {
info._mask = new MaskBuffer; info._mask = new MaskBuffer;
// surface width was shrunk to 1/4th of the bitmap width due to the pixel packing // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing
info._mask->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); info._mask->create(decoder.getSurface()->w * 4, decoder.getSurface()->h);
memcpy(info._mask->data, decoder.getSurface()->pixels, info._mask->size); memcpy(info._mask->data, decoder.getSurface()->getPixels(), info._mask->size);
info._mask->bigEndian = true; info._mask->bigEndian = true;
} }
@ -998,7 +998,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo& info, const char *name) {
info._path = new PathBuffer; info._path = new PathBuffer;
// surface width was shrunk to 1/8th of the bitmap width due to the pixel packing // surface width was shrunk to 1/8th of the bitmap width due to the pixel packing
info._path->create(decoder.getSurface()->w * 8, decoder.getSurface()->h); info._path->create(decoder.getSurface()->w * 8, decoder.getSurface()->h);
memcpy(info._path->data, decoder.getSurface()->pixels, info._path->size); memcpy(info._path->data, decoder.getSurface()->getPixels(), info._path->size);
info._path->bigEndian = true; info._path->bigEndian = true;
} }

View file

@ -126,9 +126,7 @@ DECLARE_INSTRUCTION_OPCODE(put) {
inst->_a->getFrameRect(r); inst->_a->getFrameRect(r);
Graphics::Surface v18; Graphics::Surface v18;
v18.w = r.width(); v18.init(r.width(), r.height(), r.width(), inst->_a->getFrameData(), Graphics::PixelFormat::createFormatCLUT8());
v18.h = r.height();
v18.pixels = inst->_a->getFrameData();
int16 x = inst->_opA.getValue(); int16 x = inst->_opA.getValue();
int16 y = inst->_opB.getValue(); int16 y = inst->_opB.getValue();

View file

@ -332,7 +332,7 @@ void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int
void Gfx::clearScreen() { void Gfx::clearScreen() {
if (_doubleBuffering) { if (_doubleBuffering) {
if (_backBuffer.pixels) { if (_backBuffer.getPixels()) {
Common::Rect r(_backBuffer.w, _backBuffer.h); Common::Rect r(_backBuffer.w, _backBuffer.h);
_backBuffer.fillRect(r, 0); _backBuffer.fillRect(r, 0);
} }
@ -419,13 +419,13 @@ void Gfx::updateScreen() {
// is needed // is needed
_overlayMode = false; _overlayMode = false;
bool skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing bool skipBackground = (_backgroundInfo->bg.getPixels() == 0); // don't render frame if background is missing
if (!skipBackground) { if (!skipBackground) {
// background may not cover the whole screen, so adjust bulk update size // background may not cover the whole screen, so adjust bulk update size
uint w = _backgroundInfo->width; uint w = _backgroundInfo->width;
uint h = _backgroundInfo->height; uint h = _backgroundInfo->height;
byte *backgroundData = (byte *)_backgroundInfo->bg.getBasePtr(0, 0); byte *backgroundData = (byte *)_backgroundInfo->bg.getPixels();
uint16 backgroundPitch = _backgroundInfo->bg.pitch; uint16 backgroundPitch = _backgroundInfo->bg.pitch;
copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->_x, _backgroundInfo->_y, w, h); copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->_x, _backgroundInfo->_y, w, h);
} }
@ -450,7 +450,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) {
return; return;
} }
byte *buf = (byte *)surf.pixels; byte *buf = (byte *)surf.getPixels();
for (int i = 0; i < surf.w*surf.h; i++) { for (int i = 0; i < surf.w*surf.h; i++) {
*buf++ |= 0x20; *buf++ |= 0x20;
} }
@ -493,7 +493,7 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask)
r.moveTo(x, y); r.moveTo(x, y);
uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND; uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND;
blt(r, (byte *)surf.pixels, &_backgroundInfo->bg, z, 100, 0); blt(r, (byte *)surf.getPixels(), &_backgroundInfo->bg, z, 100, 0);
} }
void Gfx::fillBackground(const Common::Rect& r, byte color) { void Gfx::fillBackground(const Common::Rect& r, byte color) {
@ -536,12 +536,12 @@ GfxObj *Gfx::renderFloatingLabel(Font *font, char *text) {
setupLabelSurface(*cnv, w, h); setupLabelSurface(*cnv, w, h);
font->setColor((_gameType == GType_BRA) ? 0 : 7); font->setColor((_gameType == GType_BRA) ? 0 : 7);
font->drawString((byte *)cnv->pixels + 1, cnv->w, text); font->drawString((byte *)cnv->getBasePtr(1, 0), cnv->w, text);
font->drawString((byte *)cnv->pixels + 1 + cnv->w * 2, cnv->w, text); font->drawString((byte *)cnv->getBasePtr(1, 2), cnv->w, text);
font->drawString((byte *)cnv->pixels + cnv->w, cnv->w, text); font->drawString((byte *)cnv->getBasePtr(0, 1), cnv->w, text);
font->drawString((byte *)cnv->pixels + 2 + cnv->w, cnv->w, text); font->drawString((byte *)cnv->getBasePtr(2, 1), cnv->w, text);
font->setColor((_gameType == GType_BRA) ? 11 : 1); font->setColor((_gameType == GType_BRA) ? 11 : 1);
font->drawString((byte *)cnv->pixels + 1 + cnv->w, cnv->w, text); font->drawString((byte *)cnv->getBasePtr(1, 1), cnv->w, text);
} else { } else {
w = font->getStringWidth(text); w = font->getStringWidth(text);
h = font->height(); h = font->height();
@ -704,7 +704,7 @@ void Gfx::unregisterLabel(GfxObj *label) {
void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) { void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) {
byte *s = (byte *)src.getBasePtr(r.left, r.top); byte *s = (byte *)src.getBasePtr(r.left, r.top);
byte *d = (byte *)dst.getBasePtr(0, 0); byte *d = (byte *)dst.getPixels();
for (uint16 i = 0; i < r.height(); i++) { for (uint16 i = 0; i < r.height(); i++) {
memcpy(d, s, r.width()); memcpy(d, s, r.width());

View file

@ -499,7 +499,7 @@ void Input::initCursors() {
// TODO: scale mouse cursor (see staticres.cpp) // TODO: scale mouse cursor (see staticres.cpp)
Graphics::Surface *surf2 = new Graphics::Surface; Graphics::Surface *surf2 = new Graphics::Surface;
surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8()); surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8());
memcpy(surf2->pixels, _resMouseArrow_BR_Amiga, 32*16); memcpy(surf2->getPixels(), _resMouseArrow_BR_Amiga, 32*16);
_mouseArrow = new SurfaceToFrames(surf2); _mouseArrow = new SurfaceToFrames(surf2);
} }
break; break;

View file

@ -108,7 +108,7 @@ public:
void highlightItem(ItemPosition pos, byte color); void highlightItem(ItemPosition pos, byte color);
void drawItem(ItemName name, byte *buffer, uint pitch); void drawItem(ItemName name, byte *buffer, uint pitch);
byte* getData() const { return (byte *)_surf.pixels; } byte *getData() { return (byte *)_surf.getPixels(); }
void getRect(Common::Rect &r) const; void getRect(Common::Rect &r) const;
int16 getNumLines() const; int16 getNumLines() const;

View file

@ -85,9 +85,9 @@ void Cursor::setCurrentFrameIndex(int32 index) {
if (_info[index].surface->format.bytesPerPixel == 1) { if (_info[index].surface->format.bytesPerPixel == 1) {
CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount); CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount);
CursorMan.replaceCursor(_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0); CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0);
} else { } else {
CursorMan.replaceCursor(_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format); CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format);
} }
((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty(); ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
@ -203,7 +203,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
// PixMap data // PixMap data
if (pixMap.pixelSize == 8) { if (pixMap.pixelSize == 8) {
cursorInfo.surface->create(pixMap.rowBytes, pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8()); cursorInfo.surface->create(pixMap.rowBytes, pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
cicnStream->read(cursorInfo.surface->pixels, pixMap.rowBytes * pixMap.bounds.height()); cicnStream->read(cursorInfo.surface->getPixels(), pixMap.rowBytes * pixMap.bounds.height());
// While this looks sensible, it actually doesn't work for some cursors // While this looks sensible, it actually doesn't work for some cursors
// (ie. the 'can grab' hand) // (ie. the 'can grab' hand)

View file

@ -318,7 +318,7 @@ void GraphicsManager::shakeTheWorld(TimeValue duration, TimeScale scale) {
} }
if (lastOffset.x != 0 || lastOffset.y != 0) { if (lastOffset.x != 0 || lastOffset.y != 0) {
g_system->copyRectToScreen((byte *)oldScreen.pixels, oldScreen.pitch, 0, 0, 640, 480); g_system->copyRectToScreen((byte *)oldScreen.getPixels(), oldScreen.pitch, 0, 0, 640, 480);
g_system->updateScreen(); g_system->updateScreen();
} }

View file

@ -200,7 +200,7 @@ void Caldoria::start() {
const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); const Graphics::Surface *frame = pullbackMovie->decodeNextFrame();
assert(frame); assert(frame);
assert(frame->format == g_system->getScreenFormat()); assert(frame->format == g_system->getScreenFormat());
g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h); g_system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 64, 112, frame->w, frame->h);
_vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond); _vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond);
bool saveAllowed = _vm->swapSaveAllowed(false); bool saveAllowed = _vm->swapSaveAllowed(false);
@ -216,7 +216,7 @@ void Caldoria::start() {
frame = pullbackMovie->decodeNextFrame(); frame = pullbackMovie->decodeNextFrame();
if (frame) { if (frame) {
g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h); g_system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 64, 112, frame->w, frame->h);
g_system->updateScreen(); g_system->updateScreen();
} }
} }

View file

@ -313,7 +313,7 @@ void PegasusEngine::runIntro() {
const Graphics::Surface *frame = video->decodeNextFrame(); const Graphics::Surface *frame = video->decodeNextFrame();
if (frame) { if (frame) {
_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
_system->updateScreen(); _system->updateScreen();
} }
} }
@ -1367,7 +1367,7 @@ bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16
if (frame->w <= 320 && frame->h <= 240) { if (frame->w <= 320 && frame->h <= 240) {
drawScaledFrame(frame, x, y); drawScaledFrame(frame, x, y);
} else { } else {
_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
_system->updateScreen(); _system->updateScreen();
} }
} }
@ -2270,11 +2270,11 @@ void PegasusEngine::drawScaledFrame(const Graphics::Surface *frame, uint16 x, ui
scaledFrame.create(frame->w * 2, frame->h * 2, frame->format); scaledFrame.create(frame->w * 2, frame->h * 2, frame->format);
if (frame->format.bytesPerPixel == 2) if (frame->format.bytesPerPixel == 2)
scaleFrame<uint16>((uint16 *)frame->pixels, (uint16 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch); scaleFrame<uint16>((const uint16 *)frame->getPixels(), (uint16 *)scaledFrame.getPixels(), frame->w, frame->h, frame->pitch);
else else
scaleFrame<uint32>((uint32 *)frame->pixels, (uint32 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch); scaleFrame<uint32>((const uint32 *)frame->getPixels(), (uint32 *)scaledFrame.getPixels(), frame->w, frame->h, frame->pitch);
_system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); _system->copyRectToScreen((byte *)scaledFrame.getPixels(), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
_system->updateScreen(); _system->updateScreen();
scaledFrame.free(); scaledFrame.free();
} }

View file

@ -70,7 +70,7 @@ void ScreenFader::setFaderValue(const int32 value) {
if (value != getFaderValue()) { if (value != getFaderValue()) {
Fader::setFaderValue(value); Fader::setFaderValue(value);
if (_screen->pixels) { if (_screen->getPixels()) {
// The original game does a gamma fade here using the Mac API. In order to do // The original game does a gamma fade here using the Mac API. In order to do
// that, it would require an immense amount of CPU processing. This does a // that, it would require an immense amount of CPU processing. This does a
// linear fade instead, which looks fairly well, IMO. // linear fade instead, which looks fairly well, IMO.

View file

@ -501,7 +501,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
} }
anim = getAnimation(animId); anim = getAnimation(animId);
displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->pixels; displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->getPixels();
if (playing) { if (playing) {
anim->state = ANIM_PLAYING; anim->state = ANIM_PLAYING;

View file

@ -201,7 +201,7 @@ public:
// Whenever it gets called, the corresponding caller must take care // Whenever it gets called, the corresponding caller must take care
// to add the corresponding dirty rectangle itself // to add the corresponding dirty rectangle itself
byte *getBackBufferPixels() { byte *getBackBufferPixels() {
return (byte *)_backBuffer.pixels; return (byte *)_backBuffer.getPixels();
} }
uint16 getBackBufferWidth() { uint16 getBackBufferWidth() {

View file

@ -212,7 +212,7 @@ bool Scene::playTitle(int title, int time, int mode) {
break; break;
case 2: // display background case 2: // display background
_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h); backBufferSurface->w, backBufferSurface->h);
phase++; phase++;
startTime = curTime; startTime = curTime;
@ -247,7 +247,7 @@ bool Scene::playTitle(int title, int time, int mode) {
frameTime = curTime; frameTime = curTime;
_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h); backBufferSurface->w, backBufferSurface->h);
} }
@ -273,8 +273,8 @@ bool Scene::playTitle(int title, int time, int mode) {
_vm->_anim->endVideo(); _vm->_anim->endVideo();
memset((byte *)backBufferSurface->pixels, 0, backBufferSurface->w * backBufferSurface->h); memset((byte *)backBufferSurface->getPixels(), 0, backBufferSurface->w * backBufferSurface->h);
_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h); backBufferSurface->w, backBufferSurface->h);
return interrupted; return interrupted;

View file

@ -108,7 +108,7 @@ void Scene::playMovie(const char *filename) {
if (smkDecoder->needsUpdate()) { if (smkDecoder->needsUpdate()) {
const Graphics::Surface *frame = smkDecoder->decodeNextFrame(); const Graphics::Surface *frame = smkDecoder->decodeNextFrame();
if (frame) { if (frame) {
_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
if (smkDecoder->hasDirtyPalette()) if (smkDecoder->hasDirtyPalette())
_vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256); _vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256);

View file

@ -468,7 +468,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
pal = decoder.getPalette(); pal = decoder.getPalette();
rect.setWidth(decoder.getSurface()->w); rect.setWidth(decoder.getSurface()->w);
rect.setHeight(decoder.getSurface()->h); rect.setHeight(decoder.getSurface()->h);
_vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->pixels); _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->getPixels());
for (int j = 0; j < PAL_ENTRIES; j++) { for (int j = 0; j < PAL_ENTRIES; j++) {
cPal[j].red = *pal++; cPal[j].red = *pal++;
cPal[j].green = *pal++; cPal[j].green = *pal++;
@ -1120,9 +1120,9 @@ void Scene::draw() {
_vm->_render->getBackGroundSurface()->getRect(rect); _vm->_render->getBackGroundSurface()->getRect(rect);
rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom; rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom;
if (_vm->_render->isFullRefresh()) if (_vm->_render->isFullRefresh())
_vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels); _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getPixels());
else else
_vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels); _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getPixels());
} }
} }

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->getPixels(), 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->getPixels(), 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->getPixels(), 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->getPixels(), 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.getPixels(), 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->getPixels();
// 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->getPixels(), _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->getPixels(), _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->getPixels();
// 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;
} }

View file

@ -994,7 +994,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
if (_draw_bottom < rect.bottom) if (_draw_bottom < rect.bottom)
_draw_bottom = rect.bottom; _draw_bottom = rect.bottom;
v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel; v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y);
codec1_genericDecode(v1); codec1_genericDecode(v1);
@ -1288,7 +1288,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
int32 numskip_before = skip_x + (skip_y * _width); int32 numskip_before = skip_x + (skip_y * _width);
int32 numskip_after = _width - cur_x; int32 numskip_after = _width - cur_x;
byte *dst = (byte *)_out.pixels + height_unk * _out.pitch + width_unk * _vm->_bytesPerPixel; byte *dst = (byte *)_out.getBasePtr(width_unk, height_unk);
akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf); akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf);
return 0; return 0;
@ -1358,7 +1358,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768; palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768;
} }
byte *dstPtr = (byte *)_out.pixels + dst.top * _out.pitch + dst.left * _vm->_bytesPerPixel; byte *dstPtr = (byte *)_out.getBasePtr(dst.left, dst.top);
if (_shadow_mode == 3) { if (_shadow_mode == 3) {
Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bytesPerPixel); Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bytesPerPixel);
} else { } else {

View file

@ -32,13 +32,15 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const
_out = vs; _out = vs;
if (drawToBackBuf) if (drawToBackBuf)
_out.pixels = vs.getBackPixels(0, 0); _out.setPixels(vs.getBackPixels(0, 0));
else else
_out.pixels = vs.getPixels(0, 0); _out.setPixels(vs.getPixels(0, 0));
_actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7;
_out.w = _out.pitch / _vm->_bytesPerPixel; _out.w = _out.pitch / _vm->_bytesPerPixel;
_out.pixels = (byte *)_out.pixels - (_vm->_virtscr[kMainVirtScreen].xstart & 7); // We do not use getBasePtr here because the offset to pixels never used
// _vm->_bytesPerPixel, but it seems unclear why.
_out.setPixels((byte *)_out.getPixels() - (_vm->_virtscr[kMainVirtScreen].xstart & 7));
_numStrips = numStrips; _numStrips = numStrips;

View file

@ -231,7 +231,10 @@ void drawBomp(const BompDrawData &bd) {
} }
src = bd.src; src = bd.src;
dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left); // FIXME: This gets passed a const destination Surface. Intuitively this
// should never get written to. But sadly it does... For now we simply
// cast the const qualifier away.
dst = (byte *)const_cast<void *>(bd.dst.getBasePtr((bd.x + clip.left), bd.y));
const byte maskbit = revBitMask((bd.x + clip.left) & 7); const byte maskbit = revBitMask((bd.x + clip.left) & 7);

View file

@ -799,7 +799,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
if (ignoreCharsetMask || !vs->hasTwoBuffers) { if (ignoreCharsetMask || !vs->hasTwoBuffers) {
dstPtr = vs->getPixels(0, 0); dstPtr = vs->getPixels(0, 0);
} else { } else {
dstPtr = (byte *)_vm->_textSurface.pixels; dstPtr = (byte *)_vm->_textSurface.getPixels();
} }
if (_blitAlso && vs->hasTwoBuffers) { if (_blitAlso && vs->hasTwoBuffers) {
@ -829,7 +829,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
dstPtr = vs->getPixels(_left, drawTop); dstPtr = vs->getPixels(_left, drawTop);
} else { } else {
dstSurface = _vm->_textSurface; dstSurface = _vm->_textSurface;
dstPtr = (byte *)_vm->_textSurface.pixels + (_top - _vm->_screenTop) * _vm->_textSurface.pitch * _vm->_textSurfaceMultiplier + _left * _vm->_textSurfaceMultiplier; dstPtr = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, (_top - _vm->_screenTop) * _vm->_textSurfaceMultiplier);
} }
if (_blitAlso && vs->hasTwoBuffers) { if (_blitAlso && vs->hasTwoBuffers) {
@ -907,7 +907,7 @@ bool CharsetRendererClassic::prepareDraw(uint16 chr) {
void CharsetRendererClassic::drawChar(int chr, Graphics::Surface &s, int x, int y) { void CharsetRendererClassic::drawChar(int chr, Graphics::Surface &s, int x, int y) {
if (!prepareDraw(chr)) if (!prepareDraw(chr))
return; return;
byte *dst = (byte *)s.pixels + y * s.pitch + x; byte *dst = (byte *)s.getBasePtr(x, y);
drawBitsN(s, dst, _charPtr, *_fontPtr, y, _width, _height); drawBitsN(s, dst, _charPtr, *_fontPtr, y, _width, _height);
} }
@ -1242,7 +1242,7 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) {
if (ignoreCharsetMask) { if (ignoreCharsetMask) {
VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen];
s = *vs; s = *vs;
s.pixels = vs->getPixels(0, 0); s.setPixels(vs->getPixels(0, 0));
} else { } else {
s = _vm->_textSurface; s = _vm->_textSurface;
drawTop -= _vm->_screenTop; drawTop -= _vm->_screenTop;
@ -1401,7 +1401,7 @@ void CharsetRendererTownsClassic::drawBitsN(const Graphics::Surface&, byte *dst,
} }
bool scale2x = (_vm->_textSurfaceMultiplier == 2); bool scale2x = (_vm->_textSurfaceMultiplier == 2);
dst = (byte *)_vm->_textSurface.pixels + (_top - _vm->_screenTop) * _vm->_textSurface.pitch * _vm->_textSurfaceMultiplier + _left * _vm->_textSurfaceMultiplier; dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, (_top - _vm->_screenTop) * _vm->_textSurfaceMultiplier);
int y, x; int y, x;
int color; int color;

View file

@ -293,7 +293,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
return 2; return 2;
} }
v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel; v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y);
v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf); v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf);
@ -826,7 +826,7 @@ byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) {
int my = _actorY + y + ty; int my = _actorY + y + ty;
int mx = _actorX + x + tx; int mx = _actorX + x + tx;
if (!(_zbuf && (maskBuf[my * _numStrips + mx / 8] & revBitMask(mx & 7)))) if (!(_zbuf && (maskBuf[my * _numStrips + mx / 8] & revBitMask(mx & 7))))
*((byte *)_out.pixels + my * _out.pitch + mx) = palette[c]; *((byte *)_out.getBasePtr(mx, my)) = palette[c];
} }
} }
} }
@ -1238,7 +1238,7 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
int destY = ypos + y; int destY = ypos + y;
if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) { if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX; byte *dst = (byte *)_out.getBasePtr(destX, destY);
byte *mask = _vm->getMaskBuffer(0, destY, _zbuf); byte *mask = _vm->getMaskBuffer(0, destY, _zbuf);
if (a0->_limb_flipped[limb]) { if (a0->_limb_flipped[limb]) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6); LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);

View file

@ -139,7 +139,7 @@ void ScummEngine_v6::grabCursor(int x, int y, int w, int h) {
return; return;
} }
setCursorFromBuffer((byte *)vs->pixels + (y - vs->topline) * vs->pitch + x, w, h, vs->pitch); setCursorFromBuffer((byte *)vs->getBasePtr(x, y - vs->topline), w, h, vs->pitch);
} }
void ScummEngine_v6::setDefaultCursor() { void ScummEngine_v6::setDefaultCursor() {
@ -417,13 +417,11 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) {
Graphics::Surface s; Graphics::Surface s;
byte buf[16*17]; byte buf[16*17];
memset(buf, 123, 16*17); memset(buf, 123, 16*17);
s.pixels = buf; s.init(_charset->getCharWidth(chr), _charset->getFontHeight(),
s.w = _charset->getCharWidth(chr); _charset->getCharWidth(chr), buf,
s.h = _charset->getFontHeight(); Graphics::PixelFormat::createFormatCLUT8());
s.pitch = s.w;
// s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917 // s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917
assert(s.w <= 16 && s.h <= 17); assert(s.w <= 16 && s.h <= 17);
s.format = Graphics::PixelFormat::createFormatCLUT8();
_charset->drawChar(chr, s, 0, 0); _charset->drawChar(chr, s, 0, 0);

View file

@ -641,7 +641,7 @@ static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) {
x2 = right - 1; x2 = right - 1;
ptr = (byte *)vs->pixels + x1 + y * vs->pitch; ptr = (byte *)vs->getBasePtr(x1, y);
while (x1++ <= x2) { while (x1++ <= x2) {
*ptr++ = color; *ptr++ = color;

View file

@ -421,8 +421,8 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int
} }
_res->createResource(rtBuffer, slot + 1, size); _res->createResource(rtBuffer, slot + 1, size);
vs->pixels = getResourceAddress(rtBuffer, slot + 1); vs->setPixels(getResourceAddress(rtBuffer, slot + 1));
memset(vs->pixels, 0, size); // reset background memset(vs->getBasePtr(0, 0), 0, size); // reset background
if (twobufs) { if (twobufs) {
vs->backBuf = _res->createResource(rtBuffer, slot + 5, size); vs->backBuf = _res->createResource(rtBuffer, slot + 5, size);
@ -612,7 +612,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
// Some paranoia checks // Some paranoia checks
assert(top >= 0 && bottom <= vs->h); assert(top >= 0 && bottom <= vs->h);
assert(x >= 0 && width <= vs->pitch); assert(x >= 0 && width <= vs->pitch);
assert(_textSurface.pixels); assert(_textSurface.getPixels());
// Perform some clipping // Perform some clipping
if (width > vs->w - x) if (width > vs->w - x)
@ -1135,7 +1135,7 @@ void ScummEngine::clearTextSurface() {
_townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0); _townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0);
#endif #endif
fill((byte *)_textSurface.pixels, _textSurface.pitch, fill((byte *)_textSurface.getPixels(), _textSurface.pitch,
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
_game.platform == Common::kPlatformFMTowns ? 0 : _game.platform == Common::kPlatformFMTowns ? 0 :
#endif #endif
@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
if (vs->hasTwoBuffers) if (vs->hasTwoBuffers)
dst = vs->backBuf + y * vs->pitch + x * 8; dst = vs->backBuf + y * vs->pitch + x * 8;
else else
dst = (byte *)vs->pixels + y * vs->pitch + x * 8; dst = (byte *)vs->getBasePtr(x * 8, y);
mask_ptr = getMaskBuffer(x, y, 1); mask_ptr = getMaskBuffer(x, y, 1);
@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
if (vs->hasTwoBuffers) if (vs->hasTwoBuffers)
dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel);
else else
dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); dstPtr = (byte *)vs->getBasePtr(x * 8, y);
transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr);
@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
transpStrip = true; transpStrip = true;
if (vs->hasTwoBuffers) { if (vs->hasTwoBuffers) {
byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); byte *frontBuf = (byte *)vs->getBasePtr(x * 8, y);
if (lightsOn) if (lightsOn)
copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel);
else else
@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) {
vs->bdirty[strip] = bottom; vs->bdirty[strip] = bottom;
bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel;
backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; backbuff_ptr = (byte *)vs->getBasePtr((strip + vs->xstart/8) * 8, top);
numLinesToProcess = bottom - top; numLinesToProcess = bottom - top;
if (numLinesToProcess) { if (numLinesToProcess) {

View file

@ -34,7 +34,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
return; return;
assert(_textSurface.pixels); assert(_textSurface.getPixels());
int m = _textSurfaceMultiplier; int m = _textSurfaceMultiplier;

View file

@ -90,7 +90,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint
if (!surface) if (!surface)
return; return;
byte *src = (byte *)surface->pixels; const byte *src = (const byte *)surface->getPixels();
if (_video->hasDirtyPalette()) if (_video->hasDirtyPalette())
_vm->setPaletteFromPtr(_video->getPalette(), 256); _vm->setPaletteFromPtr(_video->getPalette(), 256);
@ -119,7 +119,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint
dst += y * pitch + x * 2; dst += y * pitch + x * 2;
do { do {
for (uint i = 0; i < w; i++) { for (uint i = 0; i < w; i++) {
uint16 color = *((uint16 *)src + i); uint16 color = *((const uint16 *)src + i);
switch (dstType) { switch (dstType) {
case kDstScreen: case kDstScreen:
WRITE_UINT16(dst + i * 2, color); WRITE_UINT16(dst + i * 2, color);

View file

@ -357,7 +357,10 @@ void NutRenderer::drawFrame(byte *dst, int c, int x, int y) {
} }
void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byte color) { void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byte color) {
byte *dst = (byte *)s.pixels + y * s.pitch + x; // FIXME: This gets passed a const destination Surface. Intuitively this
// should never get written to. But sadly it does... For now we simply
// cast the const qualifier away.
byte *dst = (byte *)const_cast<void *>(s.getBasePtr(x, y));
const int width = MIN((int)_chars[c].width, s.w - x); const int width = MIN((int)_chars[c].width, s.w - x);
const int height = MIN((int)_chars[c].height, s.h - y); const int height = MIN((int)_chars[c].height, s.h - y);
const byte *src = unpackChar(c); const byte *src = unpackChar(c);
@ -391,7 +394,10 @@ void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byt
} }
void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byte color) { void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byte color) {
byte *dst = (byte *)s.pixels + y * s.pitch + x; // FIXME: This gets passed a const destination Surface. Intuitively this
// should never get written to. But sadly it does... For now we simply
// cast the const qualifier away.
byte *dst = (byte *)const_cast<void *>(s.getBasePtr(x, y));
const int width = _vm->_2byteWidth; const int width = _vm->_2byteWidth;
const int height = MIN(_vm->_2byteHeight, s.h - y); const int height = MIN(_vm->_2byteHeight, s.h - y);
const byte *src = _vm->get2byteCharPtr(c); const byte *src = _vm->get2byteCharPtr(c);

View file

@ -1715,7 +1715,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) {
error("object %d is not a blast object", eo->number); error("object %d is not a blast object", eo->number);
bdd.dst = *vs; bdd.dst = *vs;
bdd.dst.pixels = vs->getPixels(0, 0); bdd.dst.setPixels(vs->getPixels(0, 0));
bdd.x = eo->rect.left; bdd.x = eo->rect.left;
bdd.y = eo->rect.top; bdd.y = eo->rect.top;

View file

@ -314,7 +314,7 @@ bool MoviePlayer::playVideo() {
if (_decoderType == kVideoDecoderPSX) if (_decoderType == kVideoDecoderPSX)
drawFramePSX(frame); drawFramePSX(frame);
else else
_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
} }
if (_decoder->hasDirtyPalette()) { if (_decoder->hasDirtyPalette()) {
@ -407,7 +407,7 @@ bool MoviePlayer::playVideo() {
} }
Graphics::Surface *screen = _vm->_system->lockScreen(); Graphics::Surface *screen = _vm->_system->lockScreen();
performPostProcessing((byte *)screen->pixels); performPostProcessing((byte *)screen->getPixels());
_vm->_system->unlockScreen(); _vm->_system->unlockScreen();
_vm->_system->updateScreen(); _vm->_system->updateScreen();
} }
@ -498,7 +498,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
uint16 x = (g_system->getWidth() - scaledFrame.w) / 2; uint16 x = (g_system->getWidth() - scaledFrame.w) / 2;
uint16 y = (g_system->getHeight() - scaledFrame.h) / 2; uint16 y = (g_system->getHeight() - scaledFrame.h) / 2;
_vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); _vm->_system->copyRectToScreen(scaledFrame.getPixels(), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
scaledFrame.free(); scaledFrame.free();
} }

Some files were not shown because too many files have changed in this diff Show more