Added clipping to drawLine(). This fixes a regression that caused the

debug console to crash ScummVM. (I'm not sure, but I think it was trying to
draw the scrollbar arrows outside the screen when the console was sliding
into view.)

svn-id: r18138
This commit is contained in:
Torbjörn Andersson 2005-05-17 12:17:30 +00:00
parent 8d782007c1
commit bfbbf48585

View File

@ -27,14 +27,18 @@ namespace Graphics {
static void plotPoint1(int x, int y, int color, void *data) {
Surface *s = (Surface *)data;
byte *ptr = (byte *)s->getBasePtr(x, y);
*ptr = (byte)color;
if (x >= 0 && x < s->w && y >= 0 && y < s->h) {
byte *ptr = (byte *)s->getBasePtr(x, y);
*ptr = (byte)color;
}
}
static void plotPoint2(int x, int y, int color, void *data) {
Surface *s = (Surface *)data;
uint16 *ptr = (uint16 *)s->getBasePtr(x, y);
*ptr = (uint16)color;
if (x >= 0 && x < s->w && y >= 0 && y < s->h) {
uint16 *ptr = (uint16 *)s->getBasePtr(x, y);
*ptr = (uint16)color;
}
}
void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {