[Scummvm-cvs-logs] CVS: scummvm/graphics surface.cpp,1.7,1.8
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Tue May 17 05:19:06 CEST 2005
Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32333
Modified Files:
surface.cpp
Log Message:
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.)
Index: surface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- surface.cpp 8 May 2005 21:24:33 -0000 1.7
+++ surface.cpp 17 May 2005 12:17:30 -0000 1.8
@@ -27,14 +27,18 @@
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) {
More information about the Scummvm-git-logs
mailing list