summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-02-22 17:27:07 -0800
committerWei Li <weili@chromium.org>2016-02-22 17:27:07 -0800
commit4f4de9a14eed86bb49340079b9bd43ed7a3caf70 (patch)
tree2a97fb41237f4058d6fc69c9695405fb4aefabc5 /core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
parentd219a247dfaa697f9761ee558b58c23680509058 (diff)
downloadpdfium-4f4de9a14eed86bb49340079b9bd43ed7a3caf70.tar.xz
refactor CPDF_PageObject and subclasses
Use virtual functions to replace type based logic; remove unused functions; disable default copy constructor/assign operator. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1720003003 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
index 09d7b87780..75d7d2a362 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
@@ -10,21 +10,26 @@
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-void CPDF_PathObject::CopyData(const CPDF_PageObject* pSrc) {
- const CPDF_PathObject* pSrcObj = (const CPDF_PathObject*)pSrc;
- m_Path = pSrcObj->m_Path;
- m_FillType = pSrcObj->m_FillType;
- m_bStroke = pSrcObj->m_bStroke;
- m_Matrix = pSrcObj->m_Matrix;
+CPDF_PathObject::CPDF_PathObject() {}
+
+CPDF_PathObject::~CPDF_PathObject() {}
+
+CPDF_PathObject* CPDF_PathObject::Clone() const {
+ CPDF_PathObject* obj = new CPDF_PathObject;
+ obj->CopyData(this);
+
+ obj->m_Path = m_Path;
+ obj->m_FillType = m_FillType;
+ obj->m_bStroke = m_bStroke;
+ obj->m_Matrix = m_Matrix;
+ return obj;
}
+
void CPDF_PathObject::Transform(const CFX_Matrix& matrix) {
m_Matrix.Concat(matrix);
CalcBoundingBox();
}
-void CPDF_PathObject::SetGraphState(CPDF_GraphState GraphState) {
- m_GraphState = GraphState;
- CalcBoundingBox();
-}
+
void CPDF_PathObject::CalcBoundingBox() {
if (m_Path.IsNull()) {
return;