Skip to content

Commit 63b8130

Browse files
committed
PDFBOX-5966: do y-axis flip only if flipTG isn't set
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1924247 13f79535-47bb-0310-9956-ffa450edef68
1 parent 855c625 commit 63b8130

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,13 +2001,23 @@ PDRectangle getBBox()
20012001

20022002
Rectangle2D getBounds()
20032003
{
2004-
// apply the underlying Graphics2D device's DPI transform and y-axis flip
2005-
Rectangle2D r =
2006-
new Rectangle2D.Double(
2007-
minX - pageSize.getLowerLeftX() * xformScalingFactorX,
2008-
(pageSize.getLowerLeftY() + pageSize.getHeight()) * xformScalingFactorY - minY - height,
2009-
width,
2010-
height);
2004+
Rectangle2D r;
2005+
if (flipTG)
2006+
{
2007+
// Fixes PDFBOX-5966 and PDFBOX-5251, but not pdfium 1317, which has similar PDF code.
2008+
// https://bugs.chromium.org/p/pdfium/issues/detail?id=1317
2009+
r = new Rectangle2D.Double(minX, minY, width, height);
2010+
}
2011+
else
2012+
{
2013+
// y-axis flip
2014+
r = new Rectangle2D.Double(
2015+
minX - pageSize.getLowerLeftX() * xformScalingFactorX,
2016+
(pageSize.getLowerLeftY() + pageSize.getHeight()) * xformScalingFactorY - minY - height,
2017+
width,
2018+
height);
2019+
}
2020+
// apply the underlying Graphics2D device's DPI transform
20112021
// this adjusts the rectangle to the rotated image to put the soft mask at the correct position
20122022
//TODO
20132023
// 1. change transparencyGroup.getBounds() to getOrigin(), because size isn't used in SoftMask,

0 commit comments

Comments
 (0)