You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2004/09/03 10:06:01 UTC

cvs commit: xml-fop/src/java/org/apache/fop/svg PDFGraphics2D.java

jeremias    2004/09/03 01:06:01

  Modified:    src/java/org/apache/fop/svg PDFGraphics2D.java
  Log:
  Remove unnecessary scale factor. This made all images added via SVG three times bigger than they need to be. The scale factor doesn't exist in PSGraphics2D.
  Here's where this scale factor was introduced:
  http://cvs.apache.org/viewcvs.cgi/xml-fop/src/org/apache/fop/svg/Attic/PDFGraphics2D.java?r1=1.18&r2=1.19&diff_format=h
  Also reported by Jay Chiu for Fop 0.20.5 (Feb 2004)
  
  Revision  Changes    Path
  1.17      +4 -7      xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PDFGraphics2D.java	22 Apr 2004 21:38:41 -0000	1.16
  +++ PDFGraphics2D.java	3 Sep 2004 08:06:01 -0000	1.17
  @@ -437,17 +437,14 @@
           if (imageInfo == null) {
               // OK, have to build and add a PDF image
   
  -            // scale factor
  -            final int scaleFactor = 3;
  -
  -            Dimension size = new Dimension(width * scaleFactor, height * scaleFactor);
  +            Dimension size = new Dimension(width, height);
               BufferedImage buf = buildBufferedImage(size);
   
               java.awt.Graphics2D g = buf.createGraphics();
               g.setComposite(AlphaComposite.SrcOver);
               g.setBackground(new Color(1, 1, 1, 0));
               g.setPaint(new Color(1, 1, 1, 0));
  -            g.fillRect(0, 0, width * scaleFactor, height * scaleFactor);
  +            g.fillRect(0, 0, width, height);
               g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight()));
               g.setComposite(gc.getComposite());
   
  @@ -456,7 +453,7 @@
               }
               g.dispose();
   
  -            final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3];
  +            final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3 /*for RGB*/];
               byte[] mask = new byte[buf.getWidth() * buf.getHeight()];
               boolean hasMask = false;
               //boolean binaryMask = true;
  @@ -467,7 +464,7 @@
               int count = 0;
               int maskpos = 0;
               int[] iarray;
  -            int i, j, val, alpha, add, mult;
  +            int i, j, val, alpha;
               switch (bd.getDataType()) {
                   case DataBuffer.TYPE_INT:
                   int[][] idata = ((DataBufferInt)bd).getBankData();
  
  
  

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