summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-09-02 21:52:06 +0000
committertron <tron@openttd.org>2006-09-02 21:52:06 +0000
commit2d9b3aa4cc910c5366678f3b4a1f8609bcf4896f (patch)
tree99dfb1ebd76f071a55e7a7d7a678233230d5386c
parentedd5f925685e5e13872a0eb8d920f74dba2debee (diff)
downloadopenttd-2d9b3aa4cc910c5366678f3b4a1f8609bcf4896f.tar.xz
(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()
-rw-r--r--gfx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gfx.c b/gfx.c
index d0f6fd044..cfd9fa58e 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1862,7 +1862,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
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 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
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 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
if (height > o->height - top) {
height = o->height - top;
- if (height < 0) return false;
+ if (height <= 0) return false;
}
n->height = height;