summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_page.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_page.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 496ed7cc58..5ea575e307 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -35,10 +35,7 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
CPDF_Object* pageAttr = GetPageAttr("Resources");
m_pResources = pageAttr ? pageAttr->GetDict() : nullptr;
m_pPageResources = m_pResources;
- CPDF_Object* pRotate = GetPageAttr("Rotate");
- int rotate = pRotate ? pRotate->GetInteger() / 90 % 4 : 0;
- if (rotate < 0)
- rotate += 4;
+ int rotate = GetPageRotation();
CPDF_Array* pMediaBox = ToArray(GetPageAttr("MediaBox"));
CFX_FloatRect mediabox;
@@ -176,6 +173,12 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos,
return matrix;
}
+int CPDF_Page::GetPageRotation() const {
+ CPDF_Object* pRotate = GetPageAttr("Rotate");
+ int rotate = pRotate ? (pRotate->GetInteger() / 90) % 4 : 0;
+ return (rotate < 0) ? (rotate + 4) : rotate;
+}
+
bool GraphicsData::operator<(const GraphicsData& other) const {
if (fillAlpha != other.fillAlpha)
return fillAlpha < other.fillAlpha;