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

Unified Diff: fpdfsdk/src/fpdfeditpage.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 | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfeditpage.cpp
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 6c140791313f58135f51ff01205bff7b3f1237bf..b833a61c02ec3f03b7f42e3f625532fbca2130c3 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -140,9 +140,9 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
pPage->GetPageObjectList()->push_back(
std::unique_ptr<CPDF_PageObject>(pPageObj));
- switch (pPageObj->m_Type) {
+ switch (pPageObj->GetType()) {
case FPDF_PAGEOBJ_PATH: {
- CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
+ CPDF_PathObject* pPathObj = pPageObj->AsPath();
pPathObj->CalcBoundingBox();
break;
}
@@ -150,17 +150,17 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
break;
}
case FPDF_PAGEOBJ_IMAGE: {
- CPDF_ImageObject* pImageObj = (CPDF_ImageObject*)pPageObj;
+ CPDF_ImageObject* pImageObj = pPageObj->AsImage();
pImageObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_SHADING: {
- CPDF_ShadingObject* pShadingObj = (CPDF_ShadingObject*)pPageObj;
+ CPDF_ShadingObject* pShadingObj = pPageObj->AsShading();
pShadingObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_FORM: {
- CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj;
+ CPDF_FormObject* pFormObj = pPageObj->AsForm();
pFormObj->CalcBoundingBox();
break;
}
@@ -216,13 +216,13 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f)
return TRUE;
- if (pPageObj->m_Type == CPDF_PageObject::PATH) {
+ if (pPageObj->IsPath()) {
if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f)
return TRUE;
}
- if (pPageObj->m_Type == CPDF_PageObject::FORM) {
- CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj;
+ if (pPageObj->IsForm()) {
+ CPDF_FormObject* pFormObj = pPageObj->AsForm();
if (pFormObj->m_pForm &&
(pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED))
return TRUE;
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698