a55621dbf68e0472fc2df259203c5e90e446f7c6 braney Fri May 3 11:52:56 2013 -0700 fix clipping error in anti-aliased lines refs #10744 diff --git src/lib/memgfx.c src/lib/memgfx.c index 6ed6038..00c0995 100644 --- src/lib/memgfx.c +++ src/lib/memgfx.c @@ -395,30 +395,33 @@ } break; case MG_WRITE_MODE_MULTIPLY: { mgDrawBoxMultiply(mg,x,y, width, height, color); } break; } } inline void mixDot(struct memGfx *img, int x, int y, float frac, Color col) /* Puts a single dot on the image, mixing it with what is already there * based on the frac argument. */ { +if ((x < img->clipMinX) || (x > img->clipMaxX) || (y < img->clipMinY) || (y > img->clipMaxY)) + return; + Color *pt = _mgPixAdr(img,x,y); float invFrac = 1 - frac; int r = COLOR_32_RED(*pt) * invFrac + COLOR_32_RED(col) * frac; int g = COLOR_32_GREEN(*pt) * invFrac + COLOR_32_GREEN(col) * frac; int b = COLOR_32_BLUE(*pt) * invFrac + COLOR_32_BLUE(col) * frac; mgPutDot(img,x,y,MAKECOLOR_32(r,g,b)); } #define fraction(X) (((double)(X))-(double)(int)(X)) #define invFraction(X) (1.0-fraction(X)) void mgAliasLine( struct memGfx *mg, int x1, int y1, int x2, int y2, Color color) /* Draw an antialiased line using the Wu algorithm. */