summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview.cpp
diff options
context:
space:
mode:
authorrbpotter <rbpotter@chromium.org>2017-04-28 12:42:47 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-29 00:13:24 +0000
commitce8e51e6c444f6caaa160bf8b1decd5d7ec84e6f (patch)
tree7a5def9963d8a21b787c66892b2e523c8034ef83 /fpdfsdk/fpdfview.cpp
parent75b656a185ded6423b170546b89a945ac7aed74d (diff)
downloadpdfium-chromium/3086.tar.xz
Normalize rotations read from PDF documents. Make FPDFPage_GetRotation always return a value 0 to 3 as specified in fpdf_edit.h instead of returning the page rotation / 90 (page rotation may be negative for some PDFs). BUG=chromium:713197 Change-Id: Ie477803f7d298b777a3ace89b21cfda8b7f6808b Reviewed-on: https://pdfium-review.googlesource.com/4532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r--fpdfsdk/fpdfview.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 4fea392228..c928ebe445 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -740,19 +740,7 @@ FX_RECT GetMaskDimensionsAndOffsets(CPDF_Page* pPage,
static_cast<int>(mask_box.bottom * scale_y);
// Get page rotation
- int page_rotation = 0;
- CPDF_Dictionary* pDict = pPage->m_pFormDict;
- while (pDict) {
- if (pDict->KeyExist("Rotate")) {
- CPDF_Object* pRotateObj = pDict->GetObjectFor("Rotate")->GetDirect();
- page_rotation = pRotateObj ? pRotateObj->GetInteger() / 90 : 0;
- break;
- }
- if (!pDict->KeyExist("Parent"))
- break;
-
- pDict = ToDictionary(pDict->GetObjectFor("Parent")->GetDirect());
- }
+ int page_rotation = pPage->GetPageRotation();
// Compute offsets
int offset_x = 0;