pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1783260 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java
Date Thu, 16 Feb 2017 17:57:34 GMT
Author: tilman
Date: Thu Feb 16 17:57:34 2017
New Revision: 1783260

URL: http://svn.apache.org/viewvc?rev=1783260&view=rev
Log:
PDFBOX-3688: avoid keeping objects after TexturePaint is created

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java?rev=1783260&r1=1783259&r2=1783260&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaint.java Thu Feb
16 17:57:34 2017
@@ -50,9 +50,7 @@ import org.apache.pdfbox.util.Matrix;
 class TilingPaint implements Paint
 {
     private static final Log LOG = LogFactory.getLog(TilingPaint.class);
-    private final PDTilingPattern pattern;
     private final TexturePaint paint;
-    private final PageDrawer drawer;
     private final Matrix patternMatrix;
     private static final int MAXEDGE;
     private static final String DEFAULTMAXEDGE = "3000";
@@ -103,12 +101,10 @@ class TilingPaint implements Paint
     TilingPaint(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace,
                        PDColor color, AffineTransform xform) throws IOException
     {
-        this.drawer = drawer;
-        this.pattern = pattern;
         // pattern space -> user space
         patternMatrix = Matrix.concatenate(drawer.getInitialMatrix(), pattern.getMatrix());
-        Rectangle2D anchorRect = getAnchorRect();
-        this.paint = new TexturePaint(getImage(colorSpace, color, xform, anchorRect), anchorRect);
+        Rectangle2D anchorRect = getAnchorRect(pattern);
+        paint = new TexturePaint(getImage(drawer, pattern, colorSpace, color, xform, anchorRect),
anchorRect);
     }
 
     /**
@@ -132,8 +128,8 @@ class TilingPaint implements Paint
     /**
      * Returns the pattern image in parent stream coordinates.
      */
-    private BufferedImage getImage(PDColorSpace colorSpace, PDColor color,
-            AffineTransform xform, Rectangle2D anchorRect) throws IOException
+    private BufferedImage getImage(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace
colorSpace, 
+            PDColor color, AffineTransform xform, Rectangle2D anchorRect) throws IOException
     {
         ColorSpace outputCS = ColorSpace.getInstance(ColorSpace.CS_sRGB);
         ColorModel cm = new ComponentColorModel(outputCS, true, false,
@@ -214,7 +210,7 @@ class TilingPaint implements Paint
     /**
      * Returns the anchor rectangle, which includes the XStep/YStep and scaling.
      */
-    private Rectangle2D getAnchorRect()
+    private Rectangle2D getAnchorRect(PDTilingPattern pattern)
     {
         float xStep = pattern.getXStep();
         if (xStep == 0)



Mime
View raw message