Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1171)

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page.cpp

Issue 1709393002: Remove PageObject's m_Type and add As<Type> functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index b1de6d6de26e6f7276b7dc60b937e8fa35fdb140..0bcd15be207a48197a9ff4fdb755165585433a3e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -12,7 +12,7 @@
#include "core/include/fpdfapi/fpdf_page.h"
#include "third_party/base/stl_util.h"
-CPDF_PageObject* CPDF_PageObject::Create(int type) {
+CPDF_PageObject* CPDF_PageObject::Create(Type type) {
switch (type) {
case TEXT:
return new CPDF_TextObject;
@@ -29,12 +29,12 @@ CPDF_PageObject* CPDF_PageObject::Create(int type) {
}
CPDF_PageObject::~CPDF_PageObject() {}
CPDF_PageObject* CPDF_PageObject::Clone() const {
- CPDF_PageObject* pObj = Create(m_Type);
+ CPDF_PageObject* pObj = Create(GetType());
pObj->Copy(this);
return pObj;
}
void CPDF_PageObject::Copy(const CPDF_PageObject* pSrc) {
- if (m_Type != pSrc->m_Type) {
+ if (GetType() != pSrc->GetType()) {
return;
}
CopyData(pSrc);
@@ -56,7 +56,7 @@ void CPDF_PageObject::RemoveClipPath() {
m_ClipPath.SetNull();
}
void CPDF_PageObject::RecalcBBox() {
- switch (m_Type) {
+ switch (GetType()) {
case TEXT:
((CPDF_TextObject*)this)->RecalcPositionData();
break;
@@ -93,8 +93,7 @@ FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const {
}
CPDF_TextObject::CPDF_TextObject()
- : CPDF_PageObject(TEXT),
- m_PosX(0),
+ : m_PosX(0),
m_PosY(0),
m_nChars(0),
m_pCharCodes(nullptr),
@@ -611,8 +610,7 @@ void CPDF_TextObject::SetTextState(CPDF_TextState TextState) {
CalcPositionData(nullptr, nullptr, 0);
}
-CPDF_ShadingObject::CPDF_ShadingObject()
- : CPDF_PageObject(SHADING), m_pShading(nullptr) {}
+CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {}
CPDF_ShadingObject::~CPDF_ShadingObject() {}
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698