mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-06 19:08:15 +00:00
LAB: Moved bltBitMap to Image class
This commit is contained in:
parent
88ede5d2d5
commit
17d6e5e860
@ -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++;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
||||
|
@ -142,51 +142,6 @@ byte *LabEngine::getCurrentDrawingBuffer() {
|
||||
return _displayBuffer;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* 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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user