91652504c87ed8f781f17ddbd88abc6a0d18f241 braney Wed May 22 16:24:35 2013 -0700 fix problem with clipping rectangles reported in refs #10847 diff --git src/lib/memgfx.c src/lib/memgfx.c index 00c0995..06306f5 100644 --- src/lib/memgfx.c +++ src/lib/memgfx.c @@ -318,30 +318,39 @@ } void mgDrawBoxNormal(struct memGfx *mg, int x, int y, int width, int height, Color color) { int i; Color *pt; int x2 = x + width; int y2 = y + height; int wrapCount; if (x < mg->clipMinX) x = mg->clipMinX; if (y < mg->clipMinY) y = mg->clipMinY; +if (x2 < mg->clipMinX) + x2 = mg->clipMinX; +if (y2 < mg->clipMinY) + y2 = mg->clipMinY; + +if (x > mg->clipMaxX) + x = mg->clipMaxX; +if (y > mg->clipMaxY) + y = mg->clipMaxY; if (x2 > mg->clipMaxX) x2 = mg->clipMaxX; if (y2 > mg->clipMaxY) y2 = mg->clipMaxY; width = x2-x; height = y2-y; if (width > 0 && height > 0) { pt = _mgPixAdr(mg,x,y); /*colorBin[x][color]++; increment color count for this pixel */ wrapCount = _mgBpr(mg) - width; while (--height >= 0) { //Color src = *pt; i = width;