summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r--fpdfsdk/fpdfannot.cpp66
1 files changed, 13 insertions, 53 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index fee99c844b..5c4aae2075 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -601,45 +601,18 @@ FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot,
if (!pAnnotDict)
return false;
- // If the annotation's appearance stream is defined, then retrieve the
- // quadpoints defined by the "BBox" entry in the AP dictionary, since its
- // "BBox" entry comes from annotation dictionary's "QuadPoints" entry, but
- // takes priority over "QuadPoints" when rendering. Otherwise, retrieve
- // the "Quadpoints" entry from the annotation dictionary.
- CPDF_Array* pArray;
- CPDF_Stream* pStream =
- FPDFDOC_GetAnnotAP(pAnnotDict, CPDF_Annot::AppearanceMode::Normal);
- if (pStream) {
- pArray = pStream->GetDict()->GetArrayFor("BBox");
- if (!pArray)
- return false;
-
- // Convert the BBox array into quadpoint coordinates. BBox array follows the
- // order of a rectangle array: (left, bottom, right, up); and quadpoints
- // follows the following order: (top-left vertex, top-right vertex, bottom-
- // left vertex, bottom-right vertex).
- quadPoints->x1 = pArray->GetNumberAt(0);
- quadPoints->y1 = pArray->GetNumberAt(3);
- quadPoints->x2 = pArray->GetNumberAt(2);
- quadPoints->y2 = pArray->GetNumberAt(3);
- quadPoints->x3 = pArray->GetNumberAt(0);
- quadPoints->y3 = pArray->GetNumberAt(1);
- quadPoints->x4 = pArray->GetNumberAt(2);
- quadPoints->y4 = pArray->GetNumberAt(1);
- } else {
- pArray = pAnnotDict->GetArrayFor("QuadPoints");
- if (!pArray)
- return false;
-
- quadPoints->x1 = pArray->GetNumberAt(0);
- quadPoints->y1 = pArray->GetNumberAt(1);
- quadPoints->x2 = pArray->GetNumberAt(2);
- quadPoints->y2 = pArray->GetNumberAt(3);
- quadPoints->x3 = pArray->GetNumberAt(4);
- quadPoints->y3 = pArray->GetNumberAt(5);
- quadPoints->x4 = pArray->GetNumberAt(6);
- quadPoints->y4 = pArray->GetNumberAt(7);
- }
+ CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints");
+ if (!pArray)
+ return false;
+
+ quadPoints->x1 = pArray->GetNumberAt(0);
+ quadPoints->y1 = pArray->GetNumberAt(1);
+ quadPoints->x2 = pArray->GetNumberAt(2);
+ quadPoints->y2 = pArray->GetNumberAt(3);
+ quadPoints->x3 = pArray->GetNumberAt(4);
+ quadPoints->y3 = pArray->GetNumberAt(5);
+ quadPoints->x4 = pArray->GetNumberAt(6);
+ quadPoints->y4 = pArray->GetNumberAt(7);
return true;
}
@@ -683,20 +656,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot,
if (!pAnnotDict)
return false;
- // If the annotation's appearance stream is defined and the annotation is of
- // a type that does not have quadpoints, then retrieve the rectangle defined
- // by the "BBox" entry in the AP dictionary, since its "BBox" entry comes
- // from annotation dictionary's "Rect" entry, but takes priority over "Rect"
- // when rendering. Otherwise, retrieve the "Rect" entry from the annotation
- // dictionary.
- CFX_FloatRect rt;
- CPDF_Stream* pStream =
- FPDFDOC_GetAnnotAP(pAnnotDict, CPDF_Annot::AppearanceMode::Normal);
- if (!pStream || FPDFAnnot_HasAttachmentPoints(annot))
- rt = pAnnotDict->GetRectFor("Rect");
- else
- rt = pStream->GetDict()->GetRectFor("BBox");
-
+ CFX_FloatRect rt = pAnnotDict->GetRectFor("Rect");
rect->left = rt.left;
rect->bottom = rt.bottom;
rect->right = rt.right;