diff options
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/lab/image.cpp | 45 | ||||
-rw-r--r-- | engines/lab/image.h | 1 | ||||
-rw-r--r-- | engines/lab/lab.h | 1 | ||||
-rw-r--r-- | engines/lab/special.cpp | 8 | ||||
-rw-r--r-- | engines/lab/vga.cpp | 45 |
6 files changed, 53 insertions, 53 deletions
diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index ce0b49740b..2f2109af7b 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -642,7 +642,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; @@ -662,9 +662,9 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); if (curY == lastY) - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 1); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 1); else - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); curY += 4; linesdone++; diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 2107f7af35..0fd7425dc4 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -180,4 +180,49 @@ void Image::readScreenImage(uint16 x, uint16 y) { } } +/*****************************************************************************/ +/* Blits a piece of one image to another. */ +/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ +/*****************************************************************************/ +void Image::bltBitMap(uint16 xs, uint16 ys, Image *imDest, + uint16 xd, uint16 yd, uint16 width, uint16 height) { + // I think the old code assumed that the source image data was valid for the given box. + // I will proceed on that assumption. + int sx = xs; + int sy = ys; + int dx = xd; + int dy = yd; + int w = width; + int h = height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > imDest->_width) + w = imDest->_width - dx; + + if (dy + h > imDest->_height) + h = imDest->_height - dy; + + if (w > 0 && h > 0) { + byte *s = _imageData + sy * _width + sx; + byte *d = imDest->_imageData + dy * imDest->_width + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += _width; + d += imDest->_width; + } + } +} + } // End of namespace Lab diff --git a/engines/lab/image.h b/engines/lab/image.h index 2befa93f00..450c177373 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -46,6 +46,7 @@ public: void drawImage(uint16 x, uint16 y); void drawMaskImage(uint16 x, uint16 y); void readScreenImage(uint16 x, uint16 y); + void bltBitMap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); }; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index a439a3a7eb..f4b223a025 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -145,7 +145,6 @@ public: void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4d71b443e1..419e0d3a05 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -194,7 +194,7 @@ static void changeCombination(uint16 number) { g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, VGAScaleY(65) + (Images[combnum])->_height); - g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); + Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); } for (uint16 i = 0; i < 6; i++) @@ -626,14 +626,14 @@ static void turnPage(bool FromLeft) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } } @@ -655,7 +655,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { ScreenImage._imageData = getCurrentDrawingBuffer(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); + JBackImage.bltBitMap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); else turnPage((bool)(wipenum == 1)); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 9ccb5f5c54..959218e98c 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -143,51 +143,6 @@ byte *LabEngine::getCurrentDrawingBuffer() { } /*****************************************************************************/ -/* Blits a piece of one image to another. */ -/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ -/*****************************************************************************/ -void LabEngine::bltBitMap(Image *imSource, uint16 xs, uint16 ys, Image *imDest, - uint16 xd, uint16 yd, uint16 width, uint16 height) { - // I think the old code assumed that the source image data was valid for the given box. - // I will proceed on that assumption. - int sx = xs; - int sy = ys; - int dx = xd; - int dy = yd; - int w = width; - int h = height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > imDest->_width) - w = imDest->_width - dx; - - if (dy + h > imDest->_height) - h = imDest->_height - dy; - - if (w > 0 && h > 0) { - byte *s = imSource->_imageData + sy * imSource->_width + sx; - byte *d = imDest->_imageData + dy * imDest->_width + dx; - - while (h-- > 0) { - memcpy(d, s, w); - s += imSource->_width; - d += imDest->_width; - } - } -} - -/*****************************************************************************/ /* Scrolls the display in the x direction by blitting. */ /* The _tempScrollData variable must be initialized to some memory, or this */ /* function will fail. */ |