summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_page.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-09 22:08:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-09 22:08:41 +0000
commitbc5dd9e7901ee56e0db66e76bf2e4903ab3d3fcd (patch)
tree0c62ff1e2e3695dbd98b8472d4846f792d1d87b4 /core/fpdfapi/page/cpdf_page.cpp
parent2404eba504ac36ce2bfd2f7d6092f9e3898de9b0 (diff)
downloadpdfium-bc5dd9e7901ee56e0db66e76bf2e4903ab3d3fcd.tar.xz
Use CFX_Size in CPDF_Page and fpdf_ppo.cpp.
Instead of having separate floats for width and height. Also remove some out parameters and just return them instead. Change-Id: I798b1453910c89477d422dcb7c0805b90823bf98 Reviewed-on: https://pdfium-review.googlesource.com/26090 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_page.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index ee7b5d408a..ba93f4a7d3 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -22,10 +22,7 @@
CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
CPDF_Dictionary* pPageDict,
bool bPageCache)
- : CPDF_PageObjectHolder(pDocument, pPageDict),
- m_PageWidth(100),
- m_PageHeight(100),
- m_pView(nullptr) {
+ : CPDF_PageObjectHolder(pDocument, pPageDict), m_PageSize(100, 100) {
if (bPageCache)
m_pPageRender = pdfium::MakeUnique<CPDF_PageRenderCache>(this);
if (!pPageDict)
@@ -45,12 +42,12 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
else
m_BBox.Intersect(mediabox);
- m_PageWidth = m_BBox.Width();
- m_PageHeight = m_BBox.Height();
+ m_PageSize.width = m_BBox.Width();
+ m_PageSize.height = m_BBox.Height();
int rotate = GetPageRotation();
if (rotate % 2)
- std::swap(m_PageWidth, m_PageHeight);
+ std::swap(m_PageSize.width, m_PageSize.height);
switch (rotate) {
case 0:
@@ -126,7 +123,7 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos,
int xSize,
int ySize,
int iRotate) const {
- if (m_PageWidth == 0 || m_PageHeight == 0)
+ if (m_PageSize.width == 0 || m_PageSize.height == 0)
return CFX_Matrix();
float x0 = 0;
@@ -171,9 +168,9 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos,
break;
}
CFX_Matrix matrix = m_PageMatrix;
- matrix.Concat(CFX_Matrix((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth,
- (x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight,
- x0, y0));
+ matrix.Concat(CFX_Matrix(
+ (x2 - x0) / m_PageSize.width, (y2 - y0) / m_PageSize.width,
+ (x1 - x0) / m_PageSize.height, (y1 - y0) / m_PageSize.height, x0, y0));
return matrix;
}