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

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

Issue 1632143002: War on #defines, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add const. Created 4 years, 11 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 | « core/src/fpdftext/fpdf_text_search.cpp ('k') | fpdfsdk/src/fpdf_transformpage.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_flatten.h" 7 #include "public/fpdf_flatten.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 pDocument->AddIndirectObject(pNewContents)); 200 pDocument->AddIndirectObject(pNewContents));
201 201
202 CFX_ByteString sStream; 202 CFX_ByteString sStream;
203 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); 203 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
204 pNewContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 204 pNewContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
205 FALSE); 205 FALSE);
206 } 206 }
207 return; 207 return;
208 } 208 }
209 209
210 int iType = pContentsObj->GetType();
211 CPDF_Array* pContentsArray = NULL; 210 CPDF_Array* pContentsArray = NULL;
212 211
213 switch (iType) { 212 switch (pContentsObj->GetType()) {
214 case PDFOBJ_STREAM: { 213 case CPDF_Object::STREAM: {
215 pContentsArray = new CPDF_Array; 214 pContentsArray = new CPDF_Array;
216 CPDF_Stream* pContents = pContentsObj->AsStream(); 215 CPDF_Stream* pContents = pContentsObj->AsStream();
217 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContents); 216 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContents);
218 CPDF_StreamAcc acc; 217 CPDF_StreamAcc acc;
219 acc.LoadAllData(pContents); 218 acc.LoadAllData(pContents);
220 CFX_ByteString sStream = "q\n"; 219 CFX_ByteString sStream = "q\n";
221 CFX_ByteString sBody = 220 CFX_ByteString sBody =
222 CFX_ByteString((const FX_CHAR*)acc.GetData(), acc.GetSize()); 221 CFX_ByteString((const FX_CHAR*)acc.GetData(), acc.GetSize());
223 sStream = sStream + sBody + "\nQ"; 222 sStream = sStream + sBody + "\nQ";
224 pContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 223 pContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
225 FALSE); 224 FALSE);
226 pContentsArray->AddReference(pDocument, dwObjNum); 225 pContentsArray->AddReference(pDocument, dwObjNum);
227 break; 226 break;
228 } 227 }
229 228
230 case PDFOBJ_ARRAY: { 229 case CPDF_Object::ARRAY: {
231 pContentsArray = pContentsObj->AsArray(); 230 pContentsArray = pContentsObj->AsArray();
232 break; 231 break;
233 } 232 }
234 default: 233 default:
235 break; 234 break;
236 } 235 }
237 236
238 if (!pContentsArray) 237 if (!pContentsArray)
239 return; 238 return;
240 239
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 513 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
515 FALSE); 514 FALSE);
516 } 515 }
517 pPageDict->RemoveAt("Annots"); 516 pPageDict->RemoveAt("Annots");
518 517
519 ObjectArray.RemoveAll(); 518 ObjectArray.RemoveAll();
520 RectArray.RemoveAll(); 519 RectArray.RemoveAll();
521 520
522 return FLATTEN_SUCCESS; 521 return FLATTEN_SUCCESS;
523 } 522 }
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text_search.cpp ('k') | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698