diff options
author | Lei Zhang <thestig@chromium.org> | 2018-03-22 18:39:05 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-22 18:39:05 +0000 |
commit | aaed698534284ca45a986ae7344246cffbc6faa9 (patch) | |
tree | 196ef8371b5b63ef8cccd3869424e25690f823d6 /core/fpdfdoc/cpdf_annot.cpp | |
parent | f9f0e511c4a8a4b7f29624012ddcc00fb7cc8ba9 (diff) | |
download | pdfium-aaed698534284ca45a986ae7344246cffbc6faa9.tar.xz |
Consolidate QuadPoints reading code in fpdfsdk.chromium/3380chromium/3379
Also fix nits in QuadPoints code in cpdf_annot.cpp.
Change-Id: I7852b673d3dca906e6d250cb3cfa305f8ea7e742
Reviewed-on: https://pdfium-review.googlesource.com/28893
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_annot.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 91cdb12d9f..42bda6e319 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -205,9 +205,12 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { return pResult; } -// Static. +// static CFX_FloatRect CPDF_Annot::RectFromQuadPointsArray(const CPDF_Array* pArray, size_t nIndex) { + ASSERT(pArray); + ASSERT(nIndex < pArray->GetCount() / 8); + // QuadPoints are defined with 4 pairs of numbers // ([ pair0, pair1, pair2, pair3 ]), where // pair0 = top_left @@ -224,7 +227,7 @@ CFX_FloatRect CPDF_Annot::RectFromQuadPointsArray(const CPDF_Array* pArray, pArray->GetNumberAt(2 + nIndex * 8), pArray->GetNumberAt(3 + nIndex * 8)); } -// Static. +// static CFX_FloatRect CPDF_Annot::BoundingRectFromQuadPoints( CPDF_Dictionary* pAnnotDict) { CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); @@ -240,23 +243,21 @@ CFX_FloatRect CPDF_Annot::BoundingRectFromQuadPoints( return ret; } -// Static. +// static CFX_FloatRect CPDF_Annot::RectFromQuadPoints(CPDF_Dictionary* pAnnotDict, size_t nIndex) { CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); - if (!pArray) return CFX_FloatRect(); - return RectFromQuadPointsArray(pArray, nIndex); } -// Static. +// static bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) { return !!(pAnnotDict->GetIntegerFor("F") & ANNOTFLAG_HIDDEN); } -// Static. +// static CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype( const ByteString& sSubtype) { if (sSubtype == "Text") @@ -316,7 +317,7 @@ CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype( return CPDF_Annot::Subtype::UNKNOWN; } -// Static. +// static ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) { if (nSubtype == CPDF_Annot::Subtype::TEXT) return "Text"; @@ -375,7 +376,7 @@ ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) { return ""; } -// Static. +// static size_t CPDF_Annot::QuadPointCount(const CPDF_Array* pArray) { return pArray->GetCount() / 8; } |