sschwieb commented on a change in pull request #127:
URL: https://github.com/apache/pdfbox/pull/127#discussion_r684560995
##########
File path: pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
##########
@@ -382,25 +382,30 @@ else if (!(colorSpace instanceof PDPattern))
*/
protected final void setClip()
{
- Area clippingPath = getGraphicsState().getCurrentClippingPath();
- if (clippingPath != lastClip)
+ List<GeneralPath> clippingPaths =
getGraphicsState().getCurrentClippingPaths();
+ if (clippingPaths != lastClips)
{
- if (clippingPath.getPathIterator(null).isDone())
- {
- // PDFBOX-4821: avoid bug with java printing that empty
clipping path is ignored by
- // replacing with empty rectangle, works because this is not
an empty path
- graphics.setClip(new Rectangle());
- }
- else
- {
- graphics.setClip(clippingPath);
- }
+ transferClip(getGraphicsState(), graphics);
if (initialClip != null)
{
// apply the remembered initial clip, but transform it first
//TODO see PDFBOX-4583
}
- lastClip = clippingPath;
+ lastClips = clippingPaths;
+ }
+ }
+
+ protected void transferClip(PDGraphicsState graphicsState, Graphics2D
graphics) {
+ Area clippingPath = graphicsState.getCurrentClippingPath();
Review comment:
Subclasses can override this method and decide what to do by looking at
`getCurrentClippingPaths()`. For instance, they could ignore the initial
clipping path (page boundaries) if this seems reasonable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]