tkormann    02/02/22 08:52:09

  Modified:    sources/org/apache/batik/bridge BridgeContext.java
                        RepaintManager.java
               sources/org/apache/batik/gvt AbstractGraphicsNode.java
               sources/org/apache/batik/gvt/renderer DynamicRenderer.java
                        ImageRenderer.java StaticRenderer.java
               sources/org/apache/batik/script/rhino RhinoInterpreter.java
  Log:
  little performance improvements
  
  Revision  Changes    Path
  1.37      +23 -1     xml-batik/sources/org/apache/batik/bridge/BridgeContext.java
  
  Index: BridgeContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeContext.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- BridgeContext.java        21 Feb 2002 10:06:47 -0000      1.36
  +++ BridgeContext.java        22 Feb 2002 16:52:09 -0000      1.37
  @@ -47,7 +47,7 @@
    * a SVG DOM tree such as the current viewport or the user agent.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Thierry Kormann</a>
  - * @version $Id: BridgeContext.java,v 1.36 2002/02/21 10:06:47 vhardy Exp $
  + * @version $Id: BridgeContext.java,v 1.37 2002/02/22 16:52:09 tkormann Exp $
    */
   public class BridgeContext implements ErrorConstants {
   
  @@ -159,6 +159,10 @@
        */
       private static InterpreterPool sharedPool = new InterpreterPool();
   
  +    //static int total;
  +    //static int alive;
  +    //int number;
  +
       /**
        * Constructs a new bridge context.
        * @param userAgent the user agent
  @@ -193,7 +197,25 @@
           this.interpreterPool = interpreterPool;
           this.documentLoader = documentLoader;
           registerSVGBridges(this);
  +
  +        // start debug leak
  +        /*
  +        total++;
  +        alive++;
  +        number = total;
  +        System.out.println("--- Create BridgeContext #"+number+" alive: "+alive);
  +        // end debug leak
  +        */
  +    }
  +
  +    /* start debug leak
  +    protected void finalize() throws Throwable {
  +        super.finalize();
  +        alive--;
  +        System.out.println("--- BridgeContext #"+number+" goes to GC. left: 
"+alive);
       }
  +    // end debug leak
  +    */
   
       // properties
   
  
  
  
  1.9       +2 -8      xml-batik/sources/org/apache/batik/bridge/RepaintManager.java
  
  Index: RepaintManager.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/RepaintManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RepaintManager.java       21 Feb 2002 10:33:43 -0000      1.8
  +++ RepaintManager.java       22 Feb 2002 16:52:09 -0000      1.9
  @@ -26,7 +26,7 @@
    * This class manages the rendering of a GVT tree.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: RepaintManager.java,v 1.8 2002/02/21 10:33:43 hillion Exp $
  + * @version $Id: RepaintManager.java,v 1.9 2002/02/22 16:52:09 tkormann Exp $
    */
   public class RepaintManager {
       
  @@ -105,13 +105,7 @@
        * in the image have been modified and need to be rerendered..
        */
       public void modifiedAreas(List areas) {
  -        AffineTransform at = renderer.getTransform();
  -        Iterator i = areas.iterator();
  -        while (i.hasNext()) {
  -            Shape s = (Shape)i.next();
  -            Rectangle r = at.createTransformedShape(s).getBounds();
  -            renderer.flush(r);
  -        }
  +        renderer.flush(areas);
       }
   
       /**
  
  
  
  1.36      +11 -11    xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java
  
  Index: AbstractGraphicsNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- AbstractGraphicsNode.java 19 Feb 2002 18:01:29 -0000      1.35
  +++ AbstractGraphicsNode.java 22 Feb 2002 16:52:09 -0000      1.36
  @@ -54,7 +54,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Thierry Kormann</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Emmanuel Tissandier</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Thomas DeWeese</a>
  - * @version $Id: AbstractGraphicsNode.java,v 1.35 2002/02/19 18:01:29 deweese Exp $
  + * @version $Id: AbstractGraphicsNode.java,v 1.36 2002/02/22 16:52:09 tkormann Exp $
    */
   public abstract class AbstractGraphicsNode implements GraphicsNode {
   
  @@ -420,7 +420,6 @@
        * @param g2d the Graphics2D to use
        */
       public void paint(Graphics2D g2d){
  -
           // first, make sure we haven't been interrupted
           if (Thread.currentThread().isInterrupted()) {
               return;
  @@ -455,14 +454,14 @@
           }
   
           Shape curClip = g2d.getClip();
  -        g2d.setRenderingHint(RenderingHintsKeyExt.KEY_AREA_OF_INTEREST,
  +        g2d.setRenderingHint(RenderingHintsKeyExt.KEY_AREA_OF_INTEREST, 
                                curClip);
   
           // Check if any painting is needed at all. Get the clip (in user space)
           // and see if it intersects with this node's bounds (in user space).
           boolean paintNeeded = true;
           Rectangle2D bounds = getBounds();
  -        Shape g2dClip = g2d.getClip();
  +        Shape g2dClip = curClip; //g2d.getClip();
           if (g2dClip != null) {
               Rectangle2D clipBounds = g2dClip.getBounds2D();
               if(bounds != null && !bounds.intersects(clipBounds.getX(),
  @@ -478,10 +477,10 @@
               AffineTransform txf = g2d.getTransform();
               boolean antialiasedClip = false;
               if(clip != null){
  -                antialiasedClip =
  -                    isAntialiasedClip(g2d.getTransform(),
  +                antialiasedClip = false;
  +                    /*                    isAntialiasedClip(g2d.getTransform(),
                                         g2d.getRenderingHints(),
  -                                      clip.getClipPath());
  +                                      clip.getClipPath());*/
               }
   
               boolean useOffscreen = isOffscreenBufferNeeded();
  @@ -535,7 +534,9 @@
           }
           g2d.setTransform(defaultTransform);
           g2d.setClip(defaultClip);
  -        g2d.setComposite(defaultComposite);
  +        if (composite != null) {
  +            g2d.setComposite(defaultComposite);
  +        }
       }
   
       /**
  @@ -572,7 +573,6 @@
       protected boolean isAntialiasedClip(AffineTransform usr2dev,
                                           RenderingHints hints,
                                           Shape clip){
  -        boolean antialiased = false;
           //
           // Antialias clip if:
           // + Antialiasing is on *or* rendering quality is on
  @@ -586,6 +586,7 @@
           // of the current Graphics2D's clip and this node's clip)
           // is not a rectangle.
           //
  +        boolean antialiased = false;
           if((hints.get(RenderingHints.KEY_ANTIALIASING) ==
               RenderingHints.VALUE_ANTIALIAS_ON) ||
              (hints.get(RenderingHints.KEY_RENDERING) ==
  @@ -596,8 +597,7 @@
                   antialiased = true;
               }
           }
  -        // return antialiased;
  -        return false;
  +        return antialiased;
       }
   
       //
  
  
  
  1.10      +11 -3     
xml-batik/sources/org/apache/batik/gvt/renderer/DynamicRenderer.java
  
  Index: DynamicRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/DynamicRenderer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DynamicRenderer.java      21 Feb 2002 22:13:10 -0000      1.9
  +++ DynamicRenderer.java      22 Feb 2002 16:52:09 -0000      1.10
  @@ -30,7 +30,7 @@
    * Simple implementation of the Renderer that supports dynamic updates.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Thierry Kormann</a>
  - * @version $Id: DynamicRenderer.java,v 1.9 2002/02/21 22:13:10 deweese Exp $
  + * @version $Id: DynamicRenderer.java,v 1.10 2002/02/22 16:52:09 tkormann Exp $
    */
   public class DynamicRenderer extends StaticRenderer {
   
  @@ -52,12 +52,20 @@
       RectListManager damagedAreas;
   
       protected CachableRed setupCache(CachableRed img) {
  -        /* Don't do any caching of content for dynamic case */
  +        // Don't do any caching of content for dynamic case
           return img;
       }
   
       public void flush(Rectangle r) {
  -        /* Since we don't cache we don't need to flush */
  +        // Since we don't cache we don't need to flush
  +        return;
  +    }
  +
  +    /**
  +     * Flush a list of rectangles of cached image data.
  +     */
  +    public void flush(List areas) {
  +        // Since we don't cache we don't need to flush
           return;
       }
   
  
  
  
  1.3       +10 -1     
xml-batik/sources/org/apache/batik/gvt/renderer/ImageRenderer.java
  
  Index: ImageRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/ImageRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ImageRenderer.java        18 Jul 2001 22:04:54 -0000      1.2
  +++ ImageRenderer.java        22 Feb 2002 16:52:09 -0000      1.3
  @@ -11,11 +11,13 @@
   import java.awt.image.BufferedImage;
   import java.awt.Rectangle;
   
  +import java.util.List;
  +
   /**
    * Interface for GVT Renderers that render into raster images.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Hardy</a>
  - * @version $Id: ImageRenderer.java,v 1.2 2001/07/18 22:04:54 deweese Exp $
  + * @version $Id: ImageRenderer.java,v 1.3 2002/02/22 16:52:09 tkormann Exp $
    */
   public interface ImageRenderer extends Renderer{
       /**
  @@ -42,4 +44,11 @@
        * Flush a rectangle of cached image data (preliminary interface).
        */
       public void flush(Rectangle r);
  +
  +    /**
  +     * Flush a list of rectangles of cached image data (preliminary
  +     * interface). Each area are transformed via the usr2dev's renderer
  +     * transform before the flush(Rectangle) is called.
  +     */
  +    public void flush(List areas);
   }
  
  
  
  1.22      +13 -1     
xml-batik/sources/org/apache/batik/gvt/renderer/StaticRenderer.java
  
  Index: StaticRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/StaticRenderer.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StaticRenderer.java       31 Jan 2002 21:57:35 -0000      1.21
  +++ StaticRenderer.java       22 Feb 2002 16:52:09 -0000      1.22
  @@ -45,7 +45,7 @@
    * rendering in an offscreen buffer image.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]>Vincent Hardy</a>
  - * @version $Id: StaticRenderer.java,v 1.21 2002/01/31 21:57:35 deweese Exp $
  + * @version $Id: StaticRenderer.java,v 1.22 2002/02/22 16:52:09 tkormann Exp $
    */
   public class StaticRenderer implements ImageRenderer {
       /**
  @@ -420,6 +420,18 @@
           tcr.flushCache(tcr.getBounds());
       }
   
  +    /**
  +     * Flush a list of rectangles of cached image data.
  +     */
  +    public void flush(List areas) {
  +        AffineTransform at = getTransform();
  +        Iterator i = areas.iterator();
  +        while (i.hasNext()) {
  +            Shape s = (Shape)i.next();
  +            Rectangle r = at.createTransformedShape(s).getBounds();
  +            flush(r);
  +        }
  +    }
   
       /**
        * Flush a rectangle of cached image data.
  
  
  
  1.12      +6 -2      
xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java
  
  Index: RhinoInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RhinoInterpreter.java     12 Feb 2002 07:08:17 -0000      1.11
  +++ RhinoInterpreter.java     22 Feb 2002 16:52:09 -0000      1.12
  @@ -37,7 +37,7 @@
    * A simple implementation of <code>Interpreter</code> interface to use
    * Rhino ECMAScript interpreter.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christophe Jolif</a>
  - * @version $Id: RhinoInterpreter.java,v 1.11 2002/02/12 07:08:17 hillion Exp $
  + * @version $Id: RhinoInterpreter.java,v 1.12 2002/02/22 16:52:09 tkormann Exp $
    */
   public class RhinoInterpreter implements Interpreter {
       private static String[] TO_BE_IMPORTED = {
  @@ -74,6 +74,9 @@
        * @see org.apache.batik.script.InterpreterPool
        */
       public RhinoInterpreter() {
  +        Context.setCachingEnabled(false); // reset the cache
  +        Context.setCachingEnabled(true);  // enable caching again
  +
           // entering a context
           Context ctx = Context.enter();
           try {
  @@ -152,6 +155,7 @@
        */
       public Object evaluate(String scriptstr)
           throws InterpreterException {
  + 
           Context ctx = Context.enter();
           ctx.setWrapHandler(wrapHandler);
           Script script = null;
  @@ -160,7 +164,7 @@
           // between nlog(n) and log(n) because it is
           // an AbstractSequentialList
           while (it.hasNext()) {
  -            if ((et = (Entry)(it.next())).str == scriptstr) {
  +            if ((et = (Entry)(it.next())).str.equals(scriptstr)) {
                   // if it is not at the end, remove it because
                   // it will change from place (it is faster
                   // to remove it now)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to