mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 05:36:12 +00:00
LAB: Remove dead code
In all cases, dx and dy are always positive
This commit is contained in:
parent
021cb4c526
commit
d50e9f3541
@ -53,32 +53,18 @@ Image::Image(Common::File *s) {
|
||||
/* Draws an image to the screen. */
|
||||
/*****************************************************************************/
|
||||
void Image::drawImage(uint16 x, uint16 y) {
|
||||
int sx = 0, sy = 0;
|
||||
int dx = x, dy = y;
|
||||
int w = _width;
|
||||
int h = _height;
|
||||
|
||||
if (dx < 0) {
|
||||
sx -= dx;
|
||||
w += dx;
|
||||
dx = 0;
|
||||
}
|
||||
if (x + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - x;
|
||||
|
||||
if (dy < 0) {
|
||||
sy -= dy;
|
||||
w += dy;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
if (y + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - y;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = _imageData + sy * _width + sx;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx;
|
||||
byte *s = _imageData;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x;
|
||||
|
||||
while (h-- > 0) {
|
||||
memcpy(d, s, w);
|
||||
@ -92,32 +78,18 @@ void Image::drawImage(uint16 x, uint16 y) {
|
||||
/* Draws an image to the screen. */
|
||||
/*****************************************************************************/
|
||||
void Image::drawMaskImage(uint16 x, uint16 y) {
|
||||
int sx = 0, sy = 0;
|
||||
int dx = x, dy = y;
|
||||
int w = _width;
|
||||
int h = _height;
|
||||
|
||||
if (dx < 0) {
|
||||
sx -= dx;
|
||||
w += dx;
|
||||
dx = 0;
|
||||
}
|
||||
if (x + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - x;
|
||||
|
||||
if (dy < 0) {
|
||||
sy -= dy;
|
||||
w += dy;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
if (y + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - y;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = _imageData + sy * _width + sx;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx;
|
||||
byte *s = _imageData;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x;
|
||||
|
||||
while (h-- > 0) {
|
||||
byte *ss = s;
|
||||
@ -141,32 +113,18 @@ void Image::drawMaskImage(uint16 x, uint16 y) {
|
||||
/* Reads an image from the screen. */
|
||||
/*****************************************************************************/
|
||||
void Image::readScreenImage(uint16 x, uint16 y) {
|
||||
int sx = 0, sy = 0;
|
||||
int dx = x, dy = y;
|
||||
int w = _width;
|
||||
int h = _height;
|
||||
|
||||
if (dx < 0) {
|
||||
sx -= dx;
|
||||
w += dx;
|
||||
dx = 0;
|
||||
}
|
||||
if (x + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - x;
|
||||
|
||||
if (dy < 0) {
|
||||
sy -= dy;
|
||||
w += dy;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
if (y + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - y;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = _imageData + sy * _width + sx;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx;
|
||||
byte *s = _imageData;
|
||||
byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x;
|
||||
|
||||
while (h-- > 0) {
|
||||
memcpy(s, d, w);
|
||||
@ -184,34 +142,18 @@ 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 (xd + w > imDest->_width)
|
||||
w = imDest->_width - xd;
|
||||
|
||||
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 (yd + h > imDest->_height)
|
||||
h = imDest->_height - yd;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
byte *s = _imageData + sy * _width + sx;
|
||||
byte *d = imDest->_imageData + dy * imDest->_width + dx;
|
||||
byte *s = _imageData + ys * _width + xs;
|
||||
byte *d = imDest->_imageData + yd * imDest->_width + xd;
|
||||
|
||||
while (h-- > 0) {
|
||||
memcpy(d, s, w);
|
||||
|
@ -144,25 +144,14 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16
|
||||
y1 = temp;
|
||||
}
|
||||
|
||||
if (dx > 0) {
|
||||
im._width = x2 - x1 + 1 - dx;
|
||||
im._height = y2 - y1 + 1;
|
||||
im._width = x2 - x1 + 1 - dx;
|
||||
im._height = y2 - y1 + 1;
|
||||
|
||||
im.readScreenImage(x1, y1);
|
||||
im.drawImage(x1 + dx, y1);
|
||||
im.readScreenImage(x1, y1);
|
||||
im.drawImage(x1 + dx, y1);
|
||||
|
||||
setAPen(0);
|
||||
rectFill(x1, y1, x1 + dx - 1, y2);
|
||||
} else if (dx < 0) {
|
||||
im._width = x2 - x1 + 1 + dx;
|
||||
im._height = y2 - y1 + 1;
|
||||
|
||||
im.readScreenImage(x1 - dx, y1);
|
||||
im.drawImage(x1, y1);
|
||||
|
||||
setAPen(0);
|
||||
rectFill(x2 + dx + 1, y1, x2, y2);
|
||||
}
|
||||
setAPen(0);
|
||||
rectFill(x1, y1, x1 + dx - 1, y2);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -186,25 +175,14 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16
|
||||
y1 = temp;
|
||||
}
|
||||
|
||||
if (dy > 0) {
|
||||
im._width = x2 - x1 + 1;
|
||||
im._height = y2 - y1 + 1 - dy;
|
||||
im._width = x2 - x1 + 1;
|
||||
im._height = y2 - y1 + 1 - dy;
|
||||
|
||||
im.readScreenImage(x1, y1);
|
||||
im.drawImage(x1, y1 + dy);
|
||||
im.readScreenImage(x1, y1);
|
||||
im.drawImage(x1, y1 + dy);
|
||||
|
||||
setAPen(0);
|
||||
rectFill(x1, y1, x2, y1 + dy - 1);
|
||||
} else if (dy < 0) {
|
||||
im._width = x2 - x1 + 1;
|
||||
im._height = y2 - y1 + 1 + dy;
|
||||
|
||||
im.readScreenImage(x1, y1 - dy);
|
||||
im.drawImage(x1, y1);
|
||||
|
||||
setAPen(0);
|
||||
rectFill(x1, y2 + dy + 1, x2, y2);
|
||||
}
|
||||
setAPen(0);
|
||||
rectFill(x1, y1, x2, y1 + dy - 1);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -218,29 +196,17 @@ void LabEngine::setAPen(byte pennum) {
|
||||
/* Fills in a rectangle. */
|
||||
/*****************************************************************************/
|
||||
void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||
int dx = x1;
|
||||
int dy = y1;
|
||||
int w = x2 - x1 + 1;
|
||||
int h = y2 - y1 + 1;
|
||||
|
||||
if (dx < 0) {
|
||||
w += dx;
|
||||
dx = 0;
|
||||
}
|
||||
if (x1 + w > _screenWidth)
|
||||
w = _screenWidth - x1;
|
||||
|
||||
if (dy < 0) {
|
||||
w += dy;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (dx + w > _screenWidth)
|
||||
w = _screenWidth - dx;
|
||||
|
||||
if (dy + h > _screenHeight)
|
||||
h = _screenHeight - dy;
|
||||
if (y1 + h > _screenHeight)
|
||||
h = _screenHeight - y1;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx;
|
||||
char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1;
|
||||
|
||||
while (h-- > 0) {
|
||||
char *dd = d;
|
||||
@ -273,35 +239,23 @@ void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) {
|
||||
/* Overlays a region on the screen using the desired pen color. */
|
||||
/*****************************************************************************/
|
||||
void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||
int dx = x1;
|
||||
int dy = y1;
|
||||
int w = x2 - x1 + 1;
|
||||
int h = y2 - y1 + 1;
|
||||
|
||||
if (dx < 0) {
|
||||
w += dx;
|
||||
dx = 0;
|
||||
}
|
||||
if (x1 + w > _screenWidth)
|
||||
w = _screenWidth - x1;
|
||||
|
||||
if (dy < 0) {
|
||||
w += dy;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (dx + w > _screenWidth)
|
||||
w = _screenWidth - dx;
|
||||
|
||||
if (dy + h > _screenHeight)
|
||||
h = _screenHeight - dy;
|
||||
if (y1 + h > _screenHeight)
|
||||
h = _screenHeight - y1;
|
||||
|
||||
if ((w > 0) && (h > 0)) {
|
||||
char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx;
|
||||
char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1;
|
||||
|
||||
while (h-- > 0) {
|
||||
char *dd = d;
|
||||
int ww = w;
|
||||
|
||||
if (dy & 1) {
|
||||
if (y1 & 1) {
|
||||
dd++;
|
||||
ww--;
|
||||
}
|
||||
@ -313,7 +267,7 @@ void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, ui
|
||||
}
|
||||
|
||||
d += _screenWidth;
|
||||
dy++;
|
||||
y1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user