Skip to content

Commit 2eab36f

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #277
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929000 13f79535-47bb-0310-9956-ffa450edef68
1 parent 02fb6be commit 2eab36f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
105105
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown;
106106
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
107+
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry;
107108
import org.apache.pdfbox.util.Matrix;
108109
import org.apache.pdfbox.util.Vector;
109110

@@ -1559,14 +1560,17 @@ public void showAnnotation(PDAnnotation annotation) throws IOException
15591560
if (annotation.isNoRotate() && getCurrentPage().getRotation() != 0)
15601561
{
15611562
appearance = annotation.getAppearance();
1562-
if (appearance != null && appearance.getNormalAppearance() != null &&
1563-
appearance.getNormalAppearance().isStream() &&
1564-
hasTransparency(appearance.getNormalAppearance().getAppearanceStream()))
1563+
if (appearance != null)
15651564
{
1566-
// PDFBOX-4744: avoid appearances with transparency groups until we have fixed
1567-
// the rendering. A real solution should probably be
1568-
// in PDFStreamEngine.processAnnotation().
1569-
annotation.constructAppearances();
1565+
PDAppearanceEntry appearanceEntry = appearance.getNormalAppearance();
1566+
if (appearanceEntry != null && appearanceEntry.isStream() &&
1567+
hasTransparency(appearanceEntry.getAppearanceStream()))
1568+
{
1569+
// PDFBOX-4744: avoid appearances with transparency groups until we have fixed
1570+
// the rendering. A real solution should probably be
1571+
// in PDFStreamEngine.processAnnotation().
1572+
annotation.constructAppearances();
1573+
}
15701574
}
15711575
PDRectangle rect = annotation.getRectangle();
15721576
AffineTransform savedTransform = graphics.getTransform();

0 commit comments

Comments
 (0)