(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()

pull/155/head
tron 18 years ago
parent edd5f92568
commit 2d9b3aa4cc

@ -1862,7 +1862,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
if ((left -= o->left) < 0) { if ((left -= o->left) < 0) {
width += left; width += left;
if (width < 0) return false; if (width <= 0) return false;
n->left = -left; n->left = -left;
left = 0; left = 0;
} else { } else {
@ -1871,13 +1871,13 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
if (width > o->width - left) { if (width > o->width - left) {
width = o->width - left; width = o->width - left;
if (width < 0) return false; if (width <= 0) return false;
} }
n->width = width; n->width = width;
if ((top -= o->top) < 0) { if ((top -= o->top) < 0) {
height += top; height += top;
if (height < 0) return false; if (height <= 0) return false;
n->top = -top; n->top = -top;
top = 0; top = 0;
} else { } else {
@ -1888,7 +1888,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
if (height > o->height - top) { if (height > o->height - top) {
height = o->height - top; height = o->height - top;
if (height < 0) return false; if (height <= 0) return false;
} }
n->height = height; n->height = height;

Loading…
Cancel
Save