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

Side by Side Diff: fpdfsdk/src/fpdf_transformpage.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_ext.cpp ('k') | fpdfsdk/src/fpdfeditpage.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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fpdf_transformpage.h" 8 #include "../include/fpdf_transformpage.h"
9 9
10 DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bo ttom, float right, float top) 10 DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bo ttom, float right, float top)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom, rect.W idth(), rect.Height()); 89 bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom, rect.W idth(), rect.Height());
90 textBuf<<bsClipping; 90 textBuf<<bsClipping;
91 91
92 CFX_ByteString bsMatix; 92 CFX_ByteString bsMatix;
93 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,matrix->c,m atrix->d,matrix->e,matrix->f); 93 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,matrix->c,m atrix->d,matrix->e,matrix->f);
94 textBuf<<bsMatix; 94 textBuf<<bsMatix;
95 95
96 96
97 CPDF_Page* pPage = (CPDF_Page*)page; 97 CPDF_Page* pPage = (CPDF_Page*)page;
98 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; 98 CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
99 » CPDF_Object* pContentObj = pPageDic->GetElement("Contents"); 99 » CPDF_Object* pContentObj = pPageDic ? pPageDic->GetElement("Contents") : NULL;
100 if(!pContentObj) 100 if(!pContentObj)
101 » » pContentObj = pPageDic->GetArray("Contents"); 101 » » pContentObj = pPageDic ? pPageDic->GetArray("Contents") : NULL;
102 if(!pContentObj) 102 if(!pContentObj)
103 return FALSE; 103 return FALSE;
104 104
105 CPDF_Dictionary* pDic = FX_NEW CPDF_Dictionary; 105 CPDF_Dictionary* pDic = FX_NEW CPDF_Dictionary;
106 CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL,0, pDic); 106 CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL,0, pDic);
107 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); 107 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE);
108 CPDF_Document* pDoc = pPage->m_pDocument; 108 CPDF_Document* pDoc = pPage->m_pDocument;
109 if(!pDoc) 109 if(!pDoc)
110 return FALSE; 110 return FALSE;
111 pDoc->AddIndirectObject(pStream); 111 pDoc->AddIndirectObject(pStream);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 } 254 }
255 } 255 }
256 256
257 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip Path) 257 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip Path)
258 { 258 {
259 if(!page) 259 if(!page)
260 return; 260 return;
261 CPDF_Page* pPage = (CPDF_Page*)page; 261 CPDF_Page* pPage = (CPDF_Page*)page;
262 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; 262 CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
263 » CPDF_Object* pContentObj = pPageDic->GetElement("Contents"); 263 » CPDF_Object* pContentObj = pPageDic ? pPageDic->GetElement("Contents") : NULL;
264 if(!pContentObj) 264 if(!pContentObj)
265 » » pContentObj = pPageDic->GetArray("Contents"); 265 » » pContentObj = pPageDic ? pPageDic->GetArray("Contents") : NULL;
266 if(!pContentObj) 266 if(!pContentObj)
267 return; 267 return;
268 268
269 CFX_ByteTextBuf strClip; 269 CFX_ByteTextBuf strClip;
270 CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath; 270 CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath;
271 FX_DWORD i; 271 FX_DWORD i;
272 for (i = 0; i < pClipPath->GetPathCount(); i ++) { 272 for (i = 0; i < pClipPath->GetPathCount(); i ++) {
273 CPDF_Path path = pClipPath->GetPath(i); 273 CPDF_Path path = pClipPath->GetPath(i);
274 int iClipType = pClipPath->GetClipType(i); 274 int iClipType = pClipPath->GetClipType(i);
275 if (path.GetPointCount() == 0) { 275 if (path.GetPointCount() == 0) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 { 316 {
317 pContentArray = FX_NEW CPDF_Array(); 317 pContentArray = FX_NEW CPDF_Array();
318 pContentArray->AddReference(pDoc,pStream->GetObj Num()); 318 pContentArray->AddReference(pDoc,pStream->GetObj Num());
319 pContentArray->AddReference(pDoc,pDirectObj->Get ObjNum()); 319 pContentArray->AddReference(pDoc,pDirectObj->Get ObjNum());
320 pPageDic->SetAtReference("Contents", pDoc, pDoc- >AddIndirectObject(pContentArray)); 320 pPageDic->SetAtReference("Contents", pDoc, pDoc- >AddIndirectObject(pContentArray));
321 } 321 }
322 } 322 }
323 } 323 }
324 } 324 }
325 325
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_ext.cpp ('k') | fpdfsdk/src/fpdfeditpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698