Skip to content

Commit

Permalink
PDFBOX-4892: optimize, as suggested by valerybokov
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1893757 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Sep 30, 2021
1 parent 11a34a3 commit 9ac493e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,19 @@ public void generateAppearanceStreams()
public void generateNormalAppearance()
{
PDAnnotationHighlight annotation = (PDAnnotationHighlight) getAnnotation();
PDRectangle rect = annotation.getRectangle();

float[] pathsArray = annotation.getQuadPoints();
if (pathsArray == null)
{
return;
}
AnnotationBorder ab = AnnotationBorder.getAnnotationBorder(annotation, annotation.getBorderStyle());
PDColor color = annotation.getColor();
if (color == null || color.getComponents().length == 0)
{
return;
}
PDRectangle rect = annotation.getRectangle();
AnnotationBorder ab = AnnotationBorder.getAnnotationBorder(annotation, annotation.getBorderStyle());

// Adjust rectangle even if not empty, see PLPDF.com-MarkupAnnotations.pdf
//TODO in a class structure this should be overridable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ public void generateAppearanceStreams()
public void generateNormalAppearance()
{
PDAnnotationInk ink = (PDAnnotationInk) getAnnotation();
PDColor color = ink.getColor();
if (color == null || color.getComponents().length == 0)
{
return;
}
// PDF spec does not mention /Border for ink annotations, but it is used if /BS is not available
AnnotationBorder ab = AnnotationBorder.getAnnotationBorder(ink, ink.getBorderStyle());
PDColor color = ink.getColor();
if (color == null || color.getComponents().length == 0 || Float.compare(ab.width, 0) == 0)
if (Float.compare(ab.width, 0) == 0)
{
return;
}
Expand Down

0 comments on commit 9ac493e

Please sign in to comment.