diff options
Diffstat (limited to 'engines/sci/graphics/screen.cpp')
-rw-r--r-- | engines/sci/graphics/screen.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 74503c0c77..0df163dd7b 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -170,14 +170,14 @@ void GfxScreen::copyToScreen() { void GfxScreen::copyFromScreen(byte *buffer) { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(buffer, screen->pixels, _displayPixels); + memcpy(buffer, screen->getPixels(), _displayPixels); g_system->unlockScreen(); } void GfxScreen::kernelSyncWithFramebuffer() { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(_displayScreen, screen->pixels, _displayPixels); + memcpy(_displayScreen, screen->getPixels(), _displayPixels); g_system->unlockScreen(); } @@ -286,11 +286,15 @@ void GfxScreen::putPixelOnDisplay(int x, int y, byte color) { * with flood fill, due to small difference in the Bresenham logic. */ void GfxScreen::drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) { - int16 left = startPoint.x; - int16 top = startPoint.y; - int16 right = endPoint.x; - int16 bottom = endPoint.y; - + int16 maxWidth = _width - 1; + int16 maxHeight = _height - 1; + // we need to clip values here, lsl3 room 620 background picture draws a line from 0, 199 t 320, 199 + // otherwise we would get heap corruption. + int16 left = CLIP<int16>(startPoint.x, 0, maxWidth); + int16 top = CLIP<int16>(startPoint.y, 0, maxHeight); + int16 right = CLIP<int16>(endPoint.x, 0, maxWidth); + int16 bottom = CLIP<int16>(endPoint.y, 0, maxHeight); + //set_drawing_flag byte drawMask = getDrawingMask(color, priority, control); |