summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp19
-rw-r--r--core/fpdfapi/page/cpdf_page.h15
2 files changed, 16 insertions, 18 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;
}
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index e1b5bcfa44..c7aa12e474 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -28,7 +28,7 @@ class CPDF_Page : public CPDF_PageObjectHolder {
bool bPageCache);
~CPDF_Page() override;
- // CPDF_PageObjectHolder
+ // CPDF_PageObjectHolder:
bool IsPage() const override;
void ParseContent();
@@ -39,9 +39,11 @@ class CPDF_Page : public CPDF_PageObjectHolder {
int ySize,
int iRotate) const;
- float GetPageWidth() const { return m_PageWidth; }
- float GetPageHeight() const { return m_PageHeight; }
- CFX_FloatRect GetPageBBox() const { return m_BBox; }
+ float GetPageWidth() const { return m_PageSize.width; }
+ float GetPageHeight() const { return m_PageSize.height; }
+ const CFX_SizeF& GetPageSize() const { return m_PageSize; }
+
+ const CFX_FloatRect& GetPageBBox() const { return m_BBox; }
int GetPageRotation() const;
CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender.get(); }
@@ -59,10 +61,9 @@ class CPDF_Page : public CPDF_PageObjectHolder {
CPDF_Object* GetPageAttr(const ByteString& name) const;
CFX_FloatRect GetBox(const ByteString& name) const;
- float m_PageWidth;
- float m_PageHeight;
+ CFX_SizeF m_PageSize;
CFX_Matrix m_PageMatrix;
- View* m_pView;
+ View* m_pView = nullptr;
std::unique_ptr<CPDF_PageRenderCache> m_pPageRender;
std::unique_ptr<CPDF_PageRenderContext> m_pRenderContext;
};