pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1777662 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Date Fri, 06 Jan 2017 17:26:11 GMT
Author: tilman
Date: Fri Jan  6 17:26:10 2017
New Revision: 1777662

URL: http://svn.apache.org/viewvc?rev=1777662&view=rev
Log:
PDFBOX-3000: skip non-softmask empty transparency groups

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1777662&r1=1777661&r2=1777662&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Fri Jan
 6 17:26:10 2017
@@ -1073,6 +1073,12 @@ public class PageDrawer extends PDFGraph
     {
         TransparencyGroup group =
                 new TransparencyGroup(form, false, getGraphicsState().getCurrentTransformationMatrix());
+        BufferedImage image = group.getImage();
+        if (image == null)
+        {
+            // image is empty, don't bother
+            return;
+        }
 
         graphics.setComposite(getGraphicsState().getNonStrokingJavaComposite());
         setClip();
@@ -1098,14 +1104,13 @@ public class PageDrawer extends PDFGraph
 
         if (flipTG)
         {
-            graphics.translate(0, group.getImage().getHeight());
+            graphics.translate(0, image.getHeight());
             graphics.scale(1, -1);
         }
 
         PDSoftMask softMask = getGraphicsState().getSoftMask();
         if (softMask != null)
         {
-            BufferedImage image = group.getImage();
             Paint awtPaint = new TexturePaint(image,
                     new Rectangle2D.Float(0, 0, image.getWidth(), image.getHeight()));
             awtPaint = applySoftMaskToPaint(awtPaint, softMask);
@@ -1115,7 +1120,7 @@ public class PageDrawer extends PDFGraph
         }
         else
         {
-            graphics.drawImage(group.getImage(), null, null);
+            graphics.drawImage(image, null, null);
         }
 
         graphics.setTransform(prev);
@@ -1160,7 +1165,7 @@ public class PageDrawer extends PDFGraph
             Area clip = (Area)getGraphicsState().getCurrentClippingPath().clone();
             clip.intersect(new Area(transformedBox));
             Rectangle2D clipRect = clip.getBounds2D();
-            if (isSoftMask && clipRect.isEmpty())
+            if (clipRect.isEmpty())
             {
                 image = null;
                 bbox = null;
@@ -1241,7 +1246,7 @@ public class PageDrawer extends PDFGraph
             finally 
             {
                 flipTG = oldFlipTG;
-                lastClip = lastClipOriginal;                
+                lastClip = lastClipOriginal;
                 graphics.dispose();
                 graphics = g2dOriginal;
                 clipWindingRule = clipWindingRuleOriginal;



Mime
View raw message