From d9826495fe0e279c6e2d587a656c7452cc2dc71f Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 6 Oct 2018 00:32:16 +0000 Subject: Encapsulate CPDF_PageObject's rect member. At the same time, change it from 4 floats to a CFX_FloatRect. Change-Id: I00ded941723d6a264b7a17c73fd337e66b449308 Reviewed-on: https://pdfium-review.googlesource.com/c/43570 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- core/fpdfapi/page/cpdf_pageobject.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'core/fpdfapi/page/cpdf_pageobject.h') diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h index 1dfe20b6f9..013ef0d03b 100644 --- a/core/fpdfapi/page/cpdf_pageobject.h +++ b/core/fpdfapi/page/cpdf_pageobject.h @@ -54,12 +54,11 @@ class CPDF_PageObject : public CPDF_GraphicStates { void SetDirty(bool value) { m_bDirty = value; } bool IsDirty() const { return m_bDirty; } - void TransformClipPath(CFX_Matrix& matrix); - void TransformGeneralState(CFX_Matrix& matrix); + void TransformClipPath(const CFX_Matrix& matrix); + void TransformGeneralState(const CFX_Matrix& matrix); - CFX_FloatRect GetRect() const { - return CFX_FloatRect(m_Left, m_Bottom, m_Right, m_Top); - } + void SetRect(const CFX_FloatRect& rect) { m_Rect = rect; } + const CFX_FloatRect& GetRect() const { return m_Rect; } FX_RECT GetBBox() const; FX_RECT GetTransformedBBox(const CFX_Matrix& matrix) const; @@ -75,20 +74,18 @@ class CPDF_PageObject : public CPDF_GraphicStates { m_ContentStream = new_content_stream; } - float m_Left; - float m_Right; - float m_Top; - float m_Bottom; CPDF_ContentMark m_ContentMark; protected: void CopyData(const CPDF_PageObject* pSrcObject); + CFX_FloatRect m_Rect; + private: CPDF_PageObject(const CPDF_PageObject& src) = delete; void operator=(const CPDF_PageObject& src) = delete; - bool m_bDirty; + bool m_bDirty = false; int32_t m_ContentStream; }; -- cgit v1.2.3