Author: tilman
Date: Wed Jul  9 11:28:17 2025
New Revision: 1927089

URL: http://svn.apache.org/viewvc?rev=1927089&view=rev
Log:
PDFBOX-6033: move some clipping operations from endPath ("n") to clip ("W")

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=1927089&r1=1927088&r2=1927089&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 
Wed Jul  9 11:28:17 2025
@@ -960,6 +960,22 @@ public class PageDrawer extends PDFGraph
     {
         // the clipping path will not be updated until the succeeding painting 
operator is called
         clipWindingRule = windingRule;
+        if (clipWindingRule != -1)
+        {
+            linePath.setWindingRule(clipWindingRule);
+
+            if (!linePath.getPathIterator(null).isDone())
+            {
+                // PDFBOX-4949 / PDF.js 12306: don't clip if "W n" only
+                getGraphicsState().intersectClippingPath(adjustClip(linePath));
+            }
+
+            // PDFBOX-3836: lastClip needs to be reset, because after 
intersection it is still the same 
+            // object, thus setClip() would believe that it is cached.
+            lastClips = null;
+
+            clipWindingRule = -1;
+        }
     }
 
     @Override
@@ -995,22 +1011,6 @@ public class PageDrawer extends PDFGraph
     @Override
     public void endPath()
     {
-        if (clipWindingRule != -1)
-        {
-            linePath.setWindingRule(clipWindingRule);
-
-            if (!linePath.getPathIterator(null).isDone())
-            {
-                // PDFBOX-4949 / PDF.js 12306: don't clip if "W n" only
-                getGraphicsState().intersectClippingPath(adjustClip(linePath));
-            }
-
-            // PDFBOX-3836: lastClip needs to be reset, because after 
intersection it is still the same 
-            // object, thus setClip() would believe that it is cached.
-            lastClips = null;
-
-            clipWindingRule = -1;
-        }
         linePath.reset();
     }
     


Reply via email to