summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-24 18:30:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-24 18:30:30 +0000
commitf4f2b6d45e00c67a3c508618a829330a67b827ba (patch)
tree559993f43ae437d8a1f07f7388fecd72bc119868 /core
parent02d42b65b779e29737275a258cb9f30fa8449e5e (diff)
downloadpdfium-f4f2b6d45e00c67a3c508618a829330a67b827ba.tar.xz
Start making CPDF_PathObject members private.
Also move member initialization to the header. Change-Id: I557380ae774ddf887cefeb56df2a33e5b7cff8a4 Reviewed-on: https://pdfium-review.googlesource.com/c/44510 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.h9
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp6
5 files changed, 14 insertions, 9 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index b0f0ca686a..1aca4bb8cf 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -352,7 +352,7 @@ void CPDF_PageContentGenerator::ProcessPath(std::ostringstream* buf,
CPDF_PathObject* pPathObj) {
ProcessGraphics(buf, pPathObj);
- *buf << pPathObj->m_Matrix << " cm ";
+ *buf << pPathObj->matrix() << " cm ";
auto& pPoints = pPathObj->m_Path.GetPoints();
if (pPathObj->m_Path.IsRect()) {
diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp
index 4fb8f10a6b..eafbe77ca2 100644
--- a/core/fpdfapi/page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/page/cpdf_pathobject.cpp
@@ -7,11 +7,11 @@
#include "core/fpdfapi/page/cpdf_pathobject.h"
CPDF_PathObject::CPDF_PathObject(int32_t content_stream)
- : CPDF_PageObject(content_stream), m_FillType(0), m_bStroke(false) {}
+ : CPDF_PageObject(content_stream) {}
CPDF_PathObject::CPDF_PathObject() : CPDF_PathObject(kNoContentStream) {}
-CPDF_PathObject::~CPDF_PathObject() {}
+CPDF_PathObject::~CPDF_PathObject() = default;
CPDF_PageObject::Type CPDF_PathObject::GetType() const {
return PATH;
diff --git a/core/fpdfapi/page/cpdf_pathobject.h b/core/fpdfapi/page/cpdf_pathobject.h
index 0a1e4d01f9..dd4cd55a79 100644
--- a/core/fpdfapi/page/cpdf_pathobject.h
+++ b/core/fpdfapi/page/cpdf_pathobject.h
@@ -27,9 +27,14 @@ class CPDF_PathObject final : public CPDF_PageObject {
void CalcBoundingBox();
+ const CFX_Matrix& matrix() const { return m_Matrix; }
+ void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
+
CPDF_Path m_Path;
- int m_FillType;
- bool m_bStroke;
+ int m_FillType = 0;
+ bool m_bStroke = false;
+
+ private:
CFX_Matrix m_Matrix;
};
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 6e930f62bb..03e87ce37d 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -1478,7 +1478,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) {
pPathObj->m_bStroke = bStroke;
pPathObj->m_FillType = FillType;
pPathObj->m_Path = Path;
- pPathObj->m_Matrix = matrix;
+ pPathObj->set_matrix(matrix);
SetGraphicStates(pPathObj.get(), true, false, true);
pPathObj->CalcBoundingBox();
m_pObjectHolder->AppendPageObject(std::move(pPathObj));
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 6943661cf3..6b17e09642 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1251,7 +1251,7 @@ bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0;
uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0;
- CFX_Matrix path_matrix = pPathObj->m_Matrix;
+ CFX_Matrix path_matrix = pPathObj->matrix();
path_matrix.Concat(mtObj2Device);
if (!IsAvailableMatrix(path_matrix))
return true;
@@ -1415,7 +1415,7 @@ bool CPDF_RenderStatus::ClipPattern(const CPDF_PageObject* pPageObj,
bool CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
const CFX_Matrix& mtObj2Device,
bool bStroke) {
- CFX_Matrix path_matrix = pPathObj->m_Matrix;
+ CFX_Matrix path_matrix = pPathObj->matrix();
path_matrix.Concat(mtObj2Device);
if (bStroke) {
CFX_GraphState graphState = pPathObj->m_GraphState;
@@ -2007,9 +2007,9 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_Origin.x,
charpos.m_Origin.y));
path.m_Path.Append(pPath, &matrix);
- path.m_Matrix = *pTextMatrix;
path.m_bStroke = bStroke;
path.m_FillType = bFill ? FXFILL_WINDING : 0;
+ path.set_matrix(*pTextMatrix);
path.CalcBoundingBox();
ProcessPath(&path, mtObj2Device);
}