deweese 2003/03/19 16:18:59 Modified: sources/org/apache/batik/bridge SVGTextElementBridge.java sources/org/apache/batik/gvt UpdateTracker.java test-resources/org/apache/batik/test samplesRendering.xml Log: 1) Fixed a rendering bug involving transform changes on groups with preceeding bounds changes on children. Revision Changes Path 1.77 +14 -32 xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java Index: SVGTextElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- SVGTextElementBridge.java 14 Mar 2003 21:53:20 -0000 1.76 +++ SVGTextElementBridge.java 20 Mar 2003 00:18:59 -0000 1.77 @@ -184,21 +184,7 @@ Element e, GraphicsNode node) { e.normalize(); - AttributedString as = buildAttributedString(ctx, e); - addGlyphPositionAttributes(as, e, ctx); - if (ctx.isDynamic()) { - layoutedText = new AttributedString(as.getIterator()); - } - TextNode tn = (TextNode)node; - tn.setAttributedCharacterIterator(as.getIterator()); - - // now add the painting attributes, cannot do it before this because - // some of the Paint objects need to know the bounds of the text - // and this isn't know until the text node aci is set - TextDecoration textDecoration = - getTextDecoration(e, tn, new TextDecoration(), ctx); - addPaintAttributes(as, e, tn, textDecoration, ctx); - tn.setAttributedCharacterIterator(as.getIterator()); + computeLayoutedText(ctx, e, node); // // DO NOT CALL super, 'opacity' is handle during addPaintAttributes() @@ -371,7 +357,7 @@ default: } if (layoutedText == null) { - computeLayoutedText(); + computeLayoutedText(ctx, e, node); } } @@ -432,7 +418,7 @@ //an operation occured onto the children of the //text element, check if the layout was discarded if (layoutedText == null) { - computeLayoutedText(); + computeLayoutedText(ctx, e, node); } } @@ -485,10 +471,14 @@ * update <code>layoutedText</code> with the new * value. */ - protected void computeLayoutedText() { + protected void computeLayoutedText(BridgeContext ctx, + Element e, + GraphicsNode node) { AttributedString as = buildAttributedString(ctx, e); addGlyphPositionAttributes(as, e, ctx); - layoutedText = new AttributedString(as.getIterator()); + if (ctx.isDynamic()) { + layoutedText = new AttributedString(as.getIterator()); + } TextNode tn = (TextNode)node; tn.setAttributedCharacterIterator(as.getIterator()); TextDecoration textDecoration = @@ -525,7 +515,7 @@ ((TextNode)node).setLocation(getLocation(ctx, e)); } - computeLayoutedText(); + computeLayoutedText(ctx, e, node); } else{ super.handleDOMAttrModifiedEvent(evt); @@ -560,15 +550,7 @@ case SVGCSSEngine.KERNING_INDEX: { if (!hasNewACI) { hasNewACI = true; - AttributedString as = buildAttributedString(ctx, e); - addGlyphPositionAttributes(as, e, ctx); - layoutedText = new AttributedString(as.getIterator()); - TextNode tn = (TextNode)node; - tn.setAttributedCharacterIterator(as.getIterator()); - TextDecoration textDecoration = - getTextDecoration(e, tn, new TextDecoration(), ctx); - addPaintAttributes(as, e, tn, textDecoration, ctx); - tn.setAttributedCharacterIterator(as.getIterator()); + computeLayoutedText(ctx, e, node); } break; } @@ -2089,7 +2071,7 @@ attrName.equals(SVG_DY_ATTRIBUTE) || attrName.equals(SVG_ROTATE_ATTRIBUTE)) { //recompute the layout of the text node - textBridge.computeLayoutedText(); + textBridge.computeLayoutedText(ctx, e, node); } } } @@ -2131,7 +2113,7 @@ attrName.equals(SVG_DY_ATTRIBUTE) || attrName.equals(SVG_ROTATE_ATTRIBUTE)) { //recompute the layout of the text node - textBridge.computeLayoutedText(); + textBridge.computeLayoutedText(ctx, e, node); } } } 1.15 +30 -33 xml-batik/sources/org/apache/batik/gvt/UpdateTracker.java Index: UpdateTracker.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/UpdateTracker.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- UpdateTracker.java 19 Nov 2002 16:53:14 -0000 1.14 +++ UpdateTracker.java 20 Mar 2003 00:18:59 -0000 1.15 @@ -69,6 +69,9 @@ AffineTransform oat; oat = (AffineTransform)dirtyNodes.get(gnWRef); + if (oat != null){ + oat = new AffineTransform(oat); + } Rectangle2D srcORgn = (Rectangle2D)fromBounds.remove(gnWRef); @@ -77,14 +80,14 @@ AffineTransform nat = gn.getTransform(); if (nat != null){ - nat = (nat == null) ? null : new AffineTransform(nat); + nat = new AffineTransform(nat); } // System.out.println("Rgns: " + srcORgn + " - " + srcNRgn); // System.out.println("ATs: " + oat + " - " + nat); Shape oRgn = srcORgn; Shape nRgn = srcNRgn; - + do { // Filter f; // f = gn.getGraphicsNodeRable(false); @@ -100,25 +103,24 @@ if (gn == null) break; // We reached the top of the tree - gnWRef = gn.getWeakReference(); - + // Get the parent's current Affine AffineTransform at = gn.getTransform(); - - if (oat != null){ - // oRgn = oat.createTransformedShape(srcORgn); - if (at != null){ - oat.preConcatenate(at); - } - } else { - oat = (at == null) ? null : new AffineTransform(at); + // Get the parent's Affine last time we rendered. + gnWRef = gn.getWeakReference(); + AffineTransform poat = (AffineTransform)dirtyNodes.get(gnWRef); + if (poat == null) poat = at; + if (poat != null) { + if (oat != null) + oat.preConcatenate(poat); + else + oat = new AffineTransform(poat); } - if (nat != null){ - // nRgn = nat.createTransformedShape(srcNRgn); - if (at != null){ + + if (at != null){ + if (nat != null) nat.preConcatenate(at); - } - } else { - nat = (at == null) ? null : new AffineTransform(at); + else + nat = new AffineTransform(at); } } while (true); @@ -168,34 +170,29 @@ if (doPut) { AffineTransform at = gn.getTransform(); if (at != null) at = (AffineTransform)at.clone(); + else at = new AffineTransform(); dirtyNodes.put(gnWRef, at); } - Rectangle2D r2d = null; - if ( gnce.getFrom() != null ){ - r2d = (Rectangle2D)gnce.getFrom().clone(); - } - + Rectangle2D r2d = gnce.getFrom(); if (r2d == null) r2d = gn.getBounds(); if (r2d != null) { Rectangle2D rgn = (Rectangle2D)fromBounds.remove(gnWRef); if (rgn != null) - r2d.add(rgn); + r2d = r2d.createUnion(rgn); + else + r2d = (Rectangle2D)r2d.clone(); fromBounds.put(gnWRef, r2d); } - if ( gnce.getTo() != null ){ - r2d = (Rectangle2D)gnce.getTo().clone(); - } - else{ - r2d = null; - } - + r2d = gnce.getTo(); if (r2d != null) { Rectangle2D rgn = (Rectangle2D)toBounds.remove(gnWRef); if (rgn != null) - r2d.add(rgn); + r2d = r2d.createUnion(rgn); + else + r2d = (Rectangle2D)r2d.clone(); toBounds.put(gnWRef, r2d); } } 1.94 +2 -1 xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml Index: samplesRendering.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- samplesRendering.xml 4 Mar 2003 18:22:22 -0000 1.93 +++ samplesRendering.xml 20 Mar 2003 00:18:59 -0000 1.94 @@ -307,6 +307,7 @@ <testGroup id="tests.spec.scripting"> <test id="samples/tests/spec/scripting/add.svg" /> <test id="samples/tests/spec/scripting/bug12933.svg" /> + <test id="samples/tests/spec/scripting/boundsTransformChange.svg" /> <test id="samples/tests/spec/scripting/circle.svg" /> <test id="samples/tests/spec/scripting/currentScaleTranslate.svg" /> <test id="samples/tests/spec/scripting/ellipse.svg" />
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]