deweese 02/04/23 14:58:13 Modified: sources/org/apache/batik/ext/awt/image/rendered PadRed.java Log: Fixed a long standing bug in PadRed's replicate mode. Revision Changes Path 1.11 +22 -5 xml-batik/sources/org/apache/batik/ext/awt/image/rendered/PadRed.java Index: PadRed.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/PadRed.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- PadRed.java 5 Dec 2001 13:46:05 -0000 1.10 +++ PadRed.java 23 Apr 2002 21:58:13 -0000 1.11 @@ -32,7 +32,7 @@ * This is an implementation of a Pad operation as a RenderedImage. * * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: PadRed.java,v 1.10 2001/12/05 13:46:05 deweese Exp $ */ + * @version $Id: PadRed.java,v 1.11 2002/04/23 21:58:13 deweese Exp $ */ public class PadRed extends AbstractRed { static final boolean DEBUG=false; @@ -311,10 +311,27 @@ int height = wrR.height; Rectangle r; - if (wrR.intersects(srcR)) - r = wrR.intersection(srcR); - else - r = new Rectangle(0,0,0,0); + { + // Calculate an intersection that makes some sense + // even when the rects don't really intersect + // (The x and y ranges will be correct if they + // overlap in one dimension even if they don't + // intersect in both dimensions). + int minX = (srcR.x > x) ? srcR.x : x; + int maxX = (((srcR.x+srcR.width-1) < (x+width-1)) ? + ( srcR.x+srcR.width-1) : (x+width-1)); + int minY = (srcR.y > y) ? srcR.y : y; + int maxY = (((srcR.y+srcR.height-1) < (y+height-1)) ? + ( srcR.y+srcR.height-1) : (y+height-1)); + + int x0 = minX; + int w = maxX-minX+1; + int y0 = minY; + int h = maxY-minY+1; + if (w <0 ) { x0 = 0; w = 0; } + if (h <0 ) { y0 = 0; h = 0; } + r = new Rectangle(x0, y0, w, h); + } // We split the edge drawing up into four parts. //
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]