(svn r6351) -Fix: Due to some off-by-one errors the width or height of a clipping rectangle could become 0, which isn't sensible. This should fix a very rare and hard to trigger assertion in GfxFillRect()
authortron
Sat, 02 Sep 2006 21:52:06 +0000
changeset 4525 fa3aabcd12bc
parent 4524 3d2786df6ffd
child 4526 77ef74d28e76
(svn r6351) -Fix: Due to some off-by-one errors the width or height of a clipping rectangle could become 0, which isn't sensible. This should fix a very rare and hard to trigger assertion in GfxFillRect()
gfx.c
--- a/gfx.c	Sat Sep 02 21:16:46 2006 +0000
+++ b/gfx.c	Sat Sep 02 21:52:06 2006 +0000
@@ -1862,7 +1862,7 @@
 
 	if ((left -= o->left) < 0) {
 		width += left;
-		if (width < 0) return false;
+		if (width <= 0) return false;
 		n->left = -left;
 		left = 0;
 	} else {
@@ -1871,13 +1871,13 @@
 
 	if (width > o->width - left) {
 		width = o->width - left;
-		if (width < 0) return false;
+		if (width <= 0) return false;
 	}
 	n->width = width;
 
 	if ((top -= o->top) < 0) {
 		height += top;
-		if (height < 0) return false;
+		if (height <= 0) return false;
 		n->top = -top;
 		top = 0;
 	} else {
@@ -1888,7 +1888,7 @@
 
 	if (height > o->height - top) {
 		height = o->height - top;
-		if (height < 0) return false;
+		if (height <= 0) return false;
 	}
 	n->height = height;