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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "public/fpdf_edit.h" 7 #include "public/fpdf_edit.h"
8 8
9 #include "fpdfsdk/include/fsdk_define.h" 9 #include "fpdfsdk/include/fsdk_define.h"
10 #include "public/fpdf_formfill.h" 10 #include "public/fpdf_formfill.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 "Page")) { 133 "Page")) {
134 return; 134 return;
135 } 135 }
136 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj; 136 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
137 if (!pPageObj) 137 if (!pPageObj)
138 return; 138 return;
139 139
140 pPage->GetPageObjectList()->push_back( 140 pPage->GetPageObjectList()->push_back(
141 std::unique_ptr<CPDF_PageObject>(pPageObj)); 141 std::unique_ptr<CPDF_PageObject>(pPageObj));
142 142
143 switch (pPageObj->m_Type) { 143 switch (pPageObj->GetType()) {
144 case FPDF_PAGEOBJ_PATH: { 144 case FPDF_PAGEOBJ_PATH: {
145 CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; 145 CPDF_PathObject* pPathObj = pPageObj->AsPath();
146 pPathObj->CalcBoundingBox(); 146 pPathObj->CalcBoundingBox();
147 break; 147 break;
148 } 148 }
149 case FPDF_PAGEOBJ_TEXT: { 149 case FPDF_PAGEOBJ_TEXT: {
150 break; 150 break;
151 } 151 }
152 case FPDF_PAGEOBJ_IMAGE: { 152 case FPDF_PAGEOBJ_IMAGE: {
153 CPDF_ImageObject* pImageObj = (CPDF_ImageObject*)pPageObj; 153 CPDF_ImageObject* pImageObj = pPageObj->AsImage();
154 pImageObj->CalcBoundingBox(); 154 pImageObj->CalcBoundingBox();
155 break; 155 break;
156 } 156 }
157 case FPDF_PAGEOBJ_SHADING: { 157 case FPDF_PAGEOBJ_SHADING: {
158 CPDF_ShadingObject* pShadingObj = (CPDF_ShadingObject*)pPageObj; 158 CPDF_ShadingObject* pShadingObj = pPageObj->AsShading();
159 pShadingObj->CalcBoundingBox(); 159 pShadingObj->CalcBoundingBox();
160 break; 160 break;
161 } 161 }
162 case FPDF_PAGEOBJ_FORM: { 162 case FPDF_PAGEOBJ_FORM: {
163 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; 163 CPDF_FormObject* pFormObj = pPageObj->AsForm();
164 pFormObj->CalcBoundingBox(); 164 pFormObj->CalcBoundingBox();
165 break; 165 break;
166 } 166 }
167 default: 167 default:
168 break; 168 break;
169 } 169 }
170 } 170 }
171 171
172 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { 172 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) {
173 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 173 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return TRUE; 209 return TRUE;
210 210
211 CPDF_Dictionary* pSMaskDict = 211 CPDF_Dictionary* pSMaskDict =
212 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; 212 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL;
213 if (pSMaskDict) 213 if (pSMaskDict)
214 return TRUE; 214 return TRUE;
215 215
216 if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f) 216 if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f)
217 return TRUE; 217 return TRUE;
218 218
219 if (pPageObj->m_Type == CPDF_PageObject::PATH) { 219 if (pPageObj->IsPath()) {
220 if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f) 220 if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f)
221 return TRUE; 221 return TRUE;
222 } 222 }
223 223
224 if (pPageObj->m_Type == CPDF_PageObject::FORM) { 224 if (pPageObj->IsForm()) {
225 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; 225 CPDF_FormObject* pFormObj = pPageObj->AsForm();
226 if (pFormObj->m_pForm && 226 if (pFormObj->m_pForm &&
227 (pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED)) 227 (pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED))
228 return TRUE; 228 return TRUE;
229 if (pFormObj->m_pForm && 229 if (pFormObj->m_pForm &&
230 (!(pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED) && 230 (!(pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED) &&
231 (pFormObj->m_pForm->m_Transparency & PDFTRANS_GROUP))) 231 (pFormObj->m_pForm->m_Transparency & PDFTRANS_GROUP)))
232 return TRUE; 232 return TRUE;
233 } 233 }
234 return FALSE; 234 return FALSE;
235 } 235 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
305 "Page")) { 305 "Page")) {
306 return; 306 return;
307 } 307 }
308 CPDF_Dictionary* pDict = pPage->m_pFormDict; 308 CPDF_Dictionary* pDict = pPage->m_pFormDict;
309 rotate %= 4; 309 rotate %= 4;
310 310
311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
312 } 312 }
OLDNEW
« 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