mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 19:16:21 +00:00
LAB: Merge all of the different image drawing functions
This commit is contained in:
parent
6f3644f377
commit
ea6d4579e2
@ -706,7 +706,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) {
|
||||
|
||||
imDest._imageData = _vm->getCurrentDrawingBuffer();
|
||||
|
||||
imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2);
|
||||
imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false);
|
||||
_vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1);
|
||||
curY += 4;
|
||||
linesdone++;
|
||||
@ -726,9 +726,9 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) {
|
||||
imDest._imageData = _vm->getCurrentDrawingBuffer();
|
||||
|
||||
if (curY == lastY)
|
||||
imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1);
|
||||
imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1, false);
|
||||
else
|
||||
imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2);
|
||||
imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false);
|
||||
|
||||
curY += 4;
|
||||
linesdone++;
|
||||
|
@ -50,26 +50,48 @@ Image::Image(Common::File *s) {
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Draws an image to the screen. */
|
||||
/* Blits a piece of one image to another. */
|
||||
/*****************************************************************************/
|
||||
void Image::drawImage(uint16 x, uint16 y) {
|
||||
int w = _width;
|
||||
int h = _height;
|
||||
void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest,
|
||||
uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked) {
|
||||
int w = width;
|
||||
int h = height;
|
||||
int destWidth = (imDest) ? imDest->_width : g_lab->_screenWidth;
|
||||
int destHeight = (imDest) ? imDest->_height : g_lab->_screenHeight;
|
||||
byte *destBuffer = (imDest) ? imDest->_imageData : g_lab->getCurrentDrawingBuffer();
|
||||
|
||||
if (x + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - x;
|
||||
if (xd + w > destWidth)
|
||||
w = destWidth - xd;
|
||||
|
||||
if (y + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - y;
|
||||
if (yd + h > destHeight)
|
||||
h = destHeight - yd;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = _imageData;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x;
|
||||
if (w > 0 && h > 0) {
|
||||
byte *s = _imageData + ys * _width + xs;
|
||||
byte *d = destBuffer + yd * destWidth + xd;
|
||||
|
||||
while (h-- > 0) {
|
||||
memcpy(d, s, w);
|
||||
s += _width;
|
||||
d += g_lab->_screenWidth;
|
||||
if (!masked) {
|
||||
while (h-- > 0) {
|
||||
memcpy(d, s, w);
|
||||
s += _width;
|
||||
d += destWidth;
|
||||
}
|
||||
} else {
|
||||
while (h-- > 0) {
|
||||
byte *ss = s;
|
||||
byte *dd = d;
|
||||
int ww = w;
|
||||
|
||||
while (ww-- > 0) {
|
||||
byte c = *ss++;
|
||||
|
||||
if (c) *dd++ = c - 1;
|
||||
else dd++;
|
||||
}
|
||||
|
||||
s += _width;
|
||||
d += destWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,36 +99,15 @@ void Image::drawImage(uint16 x, uint16 y) {
|
||||
/*****************************************************************************/
|
||||
/* Draws an image to the screen. */
|
||||
/*****************************************************************************/
|
||||
void Image::drawImage(uint16 x, uint16 y) {
|
||||
blitBitmap(0, 0, NULL, x, y, _width, _height, false);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Draws an image to the screen with transparency. */
|
||||
/*****************************************************************************/
|
||||
void Image::drawMaskImage(uint16 x, uint16 y) {
|
||||
int w = _width;
|
||||
int h = _height;
|
||||
|
||||
if (x + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - x;
|
||||
|
||||
if (y + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - y;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = _imageData;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x;
|
||||
|
||||
while (h-- > 0) {
|
||||
byte *ss = s;
|
||||
byte *dd = d;
|
||||
int ww = w;
|
||||
|
||||
while (ww-- > 0) {
|
||||
byte c = *ss++;
|
||||
|
||||
if (c) *dd++ = c - 1;
|
||||
else dd++;
|
||||
}
|
||||
|
||||
s += _width;
|
||||
d += g_lab->_screenWidth;
|
||||
}
|
||||
}
|
||||
blitBitmap(0, 0, NULL, x, y, _width, _height, true);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -134,33 +135,4 @@ 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 w = width;
|
||||
int h = height;
|
||||
|
||||
if (xd + w > imDest->_width)
|
||||
w = imDest->_width - xd;
|
||||
|
||||
if (yd + h > imDest->_height)
|
||||
h = imDest->_height - yd;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
byte *s = _imageData + ys * _width + xs;
|
||||
byte *d = imDest->_imageData + yd * imDest->_width + xd;
|
||||
|
||||
while (h-- > 0) {
|
||||
memcpy(d, s, w);
|
||||
s += _width;
|
||||
d += imDest->_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Lab
|
||||
|
@ -46,7 +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);
|
||||
void blitBitmap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked);
|
||||
};
|
||||
|
||||
|
||||
|
@ -482,7 +482,7 @@ void LabEngine::changeCombination(uint16 number) {
|
||||
|
||||
scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height);
|
||||
|
||||
Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2);
|
||||
Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false);
|
||||
}
|
||||
|
||||
for (uint16 i = 0; i < 6; i++)
|
||||
|
@ -273,14 +273,14 @@ static void turnPage(bool FromLeft) {
|
||||
g_lab->_music->updateMusic();
|
||||
g_lab->waitTOF();
|
||||
ScreenImage._imageData = g_lab->getCurrentDrawingBuffer();
|
||||
JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight);
|
||||
JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false);
|
||||
}
|
||||
} else {
|
||||
for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) {
|
||||
g_lab->_music->updateMusic();
|
||||
g_lab->waitTOF();
|
||||
ScreenImage._imageData = g_lab->getCurrentDrawingBuffer();
|
||||
JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight);
|
||||
JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {
|
||||
ScreenImage._imageData = getCurrentDrawingBuffer();
|
||||
|
||||
if (wipenum == 0)
|
||||
JBackImage.bltBitMap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight);
|
||||
JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight, false);
|
||||
else
|
||||
turnPage((bool)(wipenum == 1));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user