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

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

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments, rebase, fix embedder test 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 | « fpdfsdk/src/fpdf_flatten.cpp ('k') | fpdfsdk/src/fpdfedit_embeddertest.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_transformpage.h" 7 #include "public/fpdf_transformpage.h"
8 8
9 #include "fpdfsdk/include/fsdk_define.h" 9 #include "fpdfsdk/include/fsdk_define.h"
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 pDoc->AddIndirectObject(pContentArray)); 153 pDoc->AddIndirectObject(pContentArray));
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 // Need to transform the patterns as well. 158 // Need to transform the patterns as well.
159 CPDF_Dictionary* pRes = pPageDic->GetDict("Resources"); 159 CPDF_Dictionary* pRes = pPageDic->GetDict("Resources");
160 if (pRes) { 160 if (pRes) {
161 CPDF_Dictionary* pPattenDict = pRes->GetDict("Pattern"); 161 CPDF_Dictionary* pPattenDict = pRes->GetDict("Pattern");
162 if (pPattenDict) { 162 if (pPattenDict) {
163 FX_POSITION pos = pPattenDict->GetStartPos(); 163 for (const auto& it : *pPattenDict) {
164 while (pos) { 164 CPDF_Object* pObj = it.second;
165 CPDF_Dictionary* pDict = nullptr;
166 CFX_ByteString key;
167 CPDF_Object* pObj = pPattenDict->GetNextElement(pos, key);
168 if (pObj->IsReference()) 165 if (pObj->IsReference())
169 pObj = pObj->GetDirect(); 166 pObj = pObj->GetDirect();
170 167
168 CPDF_Dictionary* pDict = nullptr;
171 if (pObj->IsDictionary()) 169 if (pObj->IsDictionary())
172 pDict = pObj->AsDictionary(); 170 pDict = pObj->AsDictionary();
173 else if (CPDF_Stream* pStream = pObj->AsStream()) 171 else if (CPDF_Stream* pStream = pObj->AsStream())
174 pDict = pStream->GetDict(); 172 pDict = pStream->GetDict();
175 else 173 else
176 continue; 174 continue;
177 175
178 CFX_Matrix m = pDict->GetMatrix("Matrix"); 176 CFX_Matrix m = pDict->GetMatrix("Matrix");
179 CFX_Matrix t = *(CFX_Matrix*)matrix; 177 CFX_Matrix t = *(CFX_Matrix*)matrix;
180 m.Concat(t); 178 m.Concat(t);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } else if (pDirectObj->IsStream()) { 314 } else if (pDirectObj->IsStream()) {
317 pContentArray = new CPDF_Array(); 315 pContentArray = new CPDF_Array();
318 pContentArray->AddReference(pDoc, pStream->GetObjNum()); 316 pContentArray->AddReference(pDoc, pStream->GetObjNum());
319 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); 317 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
320 pPageDic->SetAtReference("Contents", pDoc, 318 pPageDic->SetAtReference("Contents", pDoc,
321 pDoc->AddIndirectObject(pContentArray)); 319 pDoc->AddIndirectObject(pContentArray));
322 } 320 }
323 } 321 }
324 } 322 }
325 } 323 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_flatten.cpp ('k') | fpdfsdk/src/fpdfedit_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698