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

Side by Side Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 361553002: Remove "this==NULL" and adjust corresponding callers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix if check warning Created 6 years, 5 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/fpdfppo.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 "x:/pdf/fpdfapi5/include/fpdfapi.h" 7 // #include "x:/pdf/fpdfapi5/include/fpdfapi.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fpdfedit.h" 9 #include "../include/fpdfedit.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 CPDF_Page* pPage = FX_NEW CPDF_Page; 95 CPDF_Page* pPage = FX_NEW CPDF_Page;
96 pPage->Load(pDoc,pPageDict); 96 pPage->Load(pDoc,pPageDict);
97 pPage->ParseContent(); 97 pPage->ParseContent();
98 98
99 return pPage; 99 return pPage;
100 } 100 }
101 101
102 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) 102 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page)
103 { 103 {
104 CPDF_Page* pPage = (CPDF_Page*)page; 104 CPDF_Page* pPage = (CPDF_Page*)page;
105 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") 105 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
106 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page")) 106 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page"))
107 { 107 {
108 return -1; 108 return -1;
109 } 109 }
110 CPDF_Dictionary* pDict = pPage->m_pFormDict; 110 CPDF_Dictionary* pDict = pPage->m_pFormDict;
111 111
112 int rotate = 0; 112 int rotate = 0;
113 if(pDict != NULL) 113 if(pDict != NULL)
114 { 114 {
115 » » if(pDict->KeyExist("Rotate")) 115 » » if (pDict->KeyExist("Rotate"))
116 » » » rotate = pDict->GetElement("Rotate")->GetDirect()->GetIn teger() / 90; 116 » » » rotate = pDict->GetElement("Rotate")->GetDirect()? pDict ->GetElement("Rotate")->GetDirect()->GetInteger() / 90 : 0;
117 else 117 else
118 { 118 {
119 if(pDict->KeyExist("Parent")) 119 if(pDict->KeyExist("Parent"))
120 { 120 {
121 CPDF_Dictionary* pPages = (CPDF_Dictionary*)pDic t->GetElement("Parent")->GetDirect(); 121 CPDF_Dictionary* pPages = (CPDF_Dictionary*)pDic t->GetElement("Parent")->GetDirect();
122 while(pPages) 122 while(pPages)
123 { 123 {
124 if(pPages->KeyExist("Rotate")) 124 if(pPages->KeyExist("Rotate"))
125 { 125 {
126 » » » » » » rotate = pPages->GetElement("Rot ate")->GetDirect()->GetInteger() / 90; 126 » » » » » » rotate = pPages->GetElement("Rot ate")->GetDirect()? pPages->GetElement("Rotate")->GetDirect()->GetInteger() / 90 : 0;
127 break; 127 break;
128 } 128 }
129 else if(pPages->KeyExist("Parent")) 129 else if(pPages->KeyExist("Parent"))
130 pPages = (CPDF_Dictionary*)pPage s->GetElement("Parent")->GetDirect(); 130 pPages = (CPDF_Dictionary*)pPage s->GetElement("Parent")->GetDirect();
131 else break; 131 else break;
132 } 132 }
133 } 133 }
134 } 134 }
135 } 135 }
136 else 136 else
137 { 137 {
138 return -1; 138 return -1;
139 } 139 }
140 140
141 return rotate; 141 return rotate;
142 } 142 }
143 143
144 DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT pag e_obj) 144 DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT pag e_obj)
145 { 145 {
146 CPDF_Page* pPage = (CPDF_Page*)page; 146 CPDF_Page* pPage = (CPDF_Page*)page;
147 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") 147 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
148 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page")) 148 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page"))
149 { 149 {
150 return; 150 return;
151 } 151 }
152 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj; 152 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
153 if(pPageObj == NULL) 153 if(pPageObj == NULL)
154 return; 154 return;
155 FX_POSITION LastPersition = pPage->GetLastObjectPosition(); 155 FX_POSITION LastPersition = pPage->GetLastObjectPosition();
156 156
157 pPage->InsertObject(LastPersition, pPageObj); 157 pPage->InsertObject(LastPersition, pPageObj);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 // pPage->ParseContent(); 194 // pPage->ParseContent();
195 //pPage->GenerateContent(); 195 //pPage->GenerateContent();
196 196
197 } 197 }
198 198
199 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) 199 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page)
200 { 200 {
201 CPDF_Page* pPage = (CPDF_Page*)page; 201 CPDF_Page* pPage = (CPDF_Page*)page;
202 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") 202 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
203 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page")) 203 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page"))
204 { 204 {
205 return -1; 205 return -1;
206 } 206 }
207 return pPage->CountObjects(); 207 return pPage->CountObjects();
208 // return 0; 208 // return 0;
209 } 209 }
210 210
211 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index) 211 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index)
212 { 212 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return TRUE; 256 return TRUE;
257 if(pFormObj->m_pForm && (!(pFormObj->m_pForm->m_Transparency & P DFTRANS_ISOLATED) && (pFormObj->m_pForm->m_Transparency & PDFTRANS_GROUP))) 257 if(pFormObj->m_pForm && (!(pFormObj->m_pForm->m_Transparency & P DFTRANS_ISOLATED) && (pFormObj->m_pForm->m_Transparency & PDFTRANS_GROUP)))
258 return TRUE; 258 return TRUE;
259 } 259 }
260 return FALSE; 260 return FALSE;
261 } 261 }
262 262
263 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) 263 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page)
264 { 264 {
265 CPDF_Page* pPage = (CPDF_Page*)page; 265 CPDF_Page* pPage = (CPDF_Page*)page;
266 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") 266 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
267 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page")) 267 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page"))
268 { 268 {
269 return FALSE; 269 return FALSE;
270 } 270 }
271 CPDF_PageContentGenerate CG(pPage); 271 CPDF_PageContentGenerate CG(pPage);
272 CG.GenerateContent(); 272 CG.GenerateContent();
273 273
274 return TRUE; 274 return TRUE;
275 } 275 }
276 276
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 //Transform AP's rectangle 311 //Transform AP's rectangle
312 //To Do 312 //To Do
313 313
314 } 314 }
315 315
316 } 316 }
317 317
318 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) 318 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate)
319 { 319 {
320 CPDF_Page* pPage = (CPDF_Page*)page; 320 CPDF_Page* pPage = (CPDF_Page*)page;
321 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") 321 » if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type ") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
322 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page")) 322 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin g().Compare("Page"))
323 { 323 {
324 return; 324 return;
325 } 325 }
326 CPDF_Dictionary* pDict = pPage->m_pFormDict; 326 CPDF_Dictionary* pDict = pPage->m_pFormDict;
327 rotate %=4; 327 rotate %=4;
328 328
329 pDict->SetAt("Rotate", FX_NEW CPDF_Number(rotate * 90)); 329 pDict->SetAt("Rotate", FX_NEW CPDF_Number(rotate * 90));
330 } 330 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698