From ce8e51e6c444f6caaa160bf8b1decd5d7ec84e6f Mon Sep 17 00:00:00 2001 From: rbpotter Date: Fri, 28 Apr 2017 12:42:47 -0700 Subject: Fix rotations 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 Commit-Queue: Lei Zhang --- fpdfsdk/fpdfeditpage.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'fpdfsdk/fpdfeditpage.cpp') diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 511b7f5b4b..739723f6ee 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -133,20 +133,7 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!IsPageObject(pPage)) return -1; - - CPDF_Dictionary* pDict = pPage->m_pFormDict; - while (pDict) { - if (pDict->KeyExist("Rotate")) { - CPDF_Object* pRotateObj = pDict->GetObjectFor("Rotate")->GetDirect(); - return pRotateObj ? pRotateObj->GetInteger() / 90 : 0; - } - if (!pDict->KeyExist("Parent")) - break; - - pDict = ToDictionary(pDict->GetObjectFor("Parent")->GetDirect()); - } - - return 0; + return pPage->GetPageRotation(); } DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, -- cgit v1.2.3