You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2003/10/21 03:17:11 UTC

cvs commit: xml-batik/sources/org/apache/batik/gvt FillShapePainter.java ShapeNode.java

deweese     2003/10/20 18:17:11

  Modified:    sources/org/apache/batik/bridge SVGShapeElementBridge.java
               sources/org/apache/batik/gvt FillShapePainter.java
                        ShapeNode.java
  Log:
  Greatly reduced the inital overhead of pointer events.
  Now computes 'sensitive bounding box' from source geometry bounding boxes
  rather than from union of sensitive regions.
  
  Revision  Changes    Path
  1.26      +2 -1      xml-batik/sources/org/apache/batik/bridge/SVGShapeElementBridge.java
  
  Index: SVGShapeElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGShapeElementBridge.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- SVGShapeElementBridge.java	6 Oct 2003 00:56:00 -0000	1.25
  +++ SVGShapeElementBridge.java	21 Oct 2003 01:17:11 -0000	1.26
  @@ -200,6 +200,7 @@
           case SVGCSSEngine.FILL_OPACITY_INDEX:
           case SVGCSSEngine.STROKE_INDEX:
           case SVGCSSEngine.STROKE_OPACITY_INDEX:
  +            // Opportunity to just 'update' the existing shape painters...
           case SVGCSSEngine.STROKE_WIDTH_INDEX:
           case SVGCSSEngine.STROKE_LINECAP_INDEX:
           case SVGCSSEngine.STROKE_LINEJOIN_INDEX:
  
  
  
  1.13      +2 -2      xml-batik/sources/org/apache/batik/gvt/FillShapePainter.java
  
  Index: FillShapePainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/FillShapePainter.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FillShapePainter.java	8 Aug 2003 11:39:14 -0000	1.12
  +++ FillShapePainter.java	21 Oct 2003 01:17:11 -0000	1.13
  @@ -142,7 +142,7 @@
       public Rectangle2D getSensitiveBounds2D() {
           if (shape == null)
               return  null;
  -	    return shape.getBounds2D();
  +        return shape.getBounds2D();
       }
   
       /**
  
  
  
  1.24      +50 -4     xml-batik/sources/org/apache/batik/gvt/ShapeNode.java
  
  Index: ShapeNode.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/ShapeNode.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ShapeNode.java	11 Sep 2003 10:40:24 -0000	1.23
  +++ ShapeNode.java	21 Oct 2003 01:17:11 -0000	1.24
  @@ -284,9 +284,55 @@
           if (sensitiveBounds != null)
               return sensitiveBounds;
   
  -        Shape sensitive = getSensitiveArea();
  -        if (sensitive == null) return null;
  -        sensitiveBounds = sensitive.getBounds2D();
  +        if (shapePainter == null)
  +            return null;
  +
  +        // <!> NOT REALLY NICE CODE BUT NO OTHER WAY
  +        ShapePainter strokeShapePainter = null;
  +        ShapePainter fillShapePainter = null;
  +        if (shapePainter instanceof StrokeShapePainter) {
  +            strokeShapePainter = shapePainter;
  +        } else if (shapePainter instanceof FillShapePainter) {
  +            fillShapePainter = shapePainter;
  +        } else if (shapePainter instanceof CompositeShapePainter) {
  +            CompositeShapePainter cp = (CompositeShapePainter)shapePainter;
  +
  +            for (int i=0; i < cp.getShapePainterCount(); ++i) {
  +                ShapePainter sp = cp.getShapePainter(i);
  +                if (sp instanceof StrokeShapePainter) {
  +                    strokeShapePainter = sp;
  +                } else if (sp instanceof FillShapePainter) {
  +                    fillShapePainter = sp;
  +                }
  +            }
  +        } else return null; // Don't know what we have...
  +
  +
  +        switch(pointerEventType) {
  +        case VISIBLE_PAINTED:
  +        case PAINTED:
  +            sensitiveBounds = shapePainter.getPaintedBounds2D();
  +            break;
  +        case VISIBLE_FILL:
  +        case FILL:
  +            if (fillShapePainter != null) {
  +                sensitiveBounds = fillShapePainter.getSensitiveBounds2D();
  +            }
  +            break;
  +        case VISIBLE_STROKE:
  +        case STROKE:
  +            if (strokeShapePainter != null) {
  +                sensitiveBounds = strokeShapePainter.getSensitiveBounds2D();
  +            }
  +            break;
  +        case VISIBLE:
  +        case ALL:
  +            sensitiveBounds = shapePainter.getSensitiveBounds2D();
  +            break;
  +        case NONE:
  +        default:
  +            // nothing to tdo
  +        }
           return sensitiveBounds;
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org