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 vh...@apache.org on 2001/02/12 20:28:57 UTC

cvs commit: xml-batik/sources/org/apache/batik/bridge SVGViewport.java

vhardy      01/02/12 11:28:57

  Modified:    sources/org/apache/batik/bridge SVGViewport.java
  Log:
  Fixed SVGViewPort infinite loop bug when viewport size was defined with
  percentages. Fixes bug #554.
  
  Revision  Changes    Path
  1.4       +21 -8     xml-batik/sources/org/apache/batik/bridge/SVGViewport.java
  
  Index: SVGViewport.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGViewport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SVGViewport.java	2001/02/01 13:45:47	1.3
  +++ SVGViewport.java	2001/02/12 19:28:55	1.4
  @@ -18,12 +18,14 @@
    * Defines a viewport using an <tt>SVGSVGElement</tt>.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: SVGViewport.java,v 1.3 2001/02/01 13:45:47 tkormann Exp $
  + * @version $Id: SVGViewport.java,v 1.4 2001/02/12 19:28:55 vhardy Exp $
    */
   public class SVGViewport implements Viewport, SVGConstants {
   
  -    private SVGSVGElement svgSvgElement;
  -    private UnitProcessor.Context uctx;
  +    // private SVGSVGElement svgSvgElement;
  +    // private UnitProcessor.Context uctx;
  +    private float width;
  +    private float height;
   
       /**
        * Constructs a new viewport with the specified <tt>SVGSVGElement</tt>.
  @@ -32,14 +34,17 @@
        */
       public SVGViewport(SVGSVGElement svgSvgElement,
                          UnitProcessor.Context uctx) {
  -        this.svgSvgElement = svgSvgElement;
  -        this.uctx = uctx;
  -    }
  +        // this.svgSvgElement = svgSvgElement;
  +        // this.uctx = uctx;
  +        width = computeWidth(svgSvgElement, uctx);
  +        height = computeHeight(svgSvgElement, uctx);
  +     }
   
       /**
        * Returns the width of this <tt>SVGSVGElement</tt>.
        */
  -    public float getWidth() {
  +    private float computeWidth(SVGSVGElement svgSvgElement,
  +                               UnitProcessor.Context uctx) {
           String s = svgSvgElement.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE);
           LengthParser p = new LengthParser();
           UnitProcessor.UnitResolver ur = new UnitProcessor.UnitResolver();
  @@ -55,7 +60,8 @@
       /**
        * Returns the height of this viewport.
        */
  -    public float getHeight() {
  +    private float computeHeight(SVGSVGElement svgSvgElement,
  +                                UnitProcessor.Context uctx) {
           String s = svgSvgElement.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE);
           LengthParser p = new LengthParser();
           UnitProcessor.UnitResolver ur = new UnitProcessor.UnitResolver();
  @@ -68,4 +74,11 @@
                                               uctx);
       }
   
  +    public float getWidth(){
  +        return width;
  +    }
  +
  +    public float getHeight(){
  +        return height;
  +    }
   }