OLD | NEW |
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 "core/fpdfapi/page/cpdf_clippath.h" | 9 #include "core/fpdfapi/page/cpdf_clippath.h" |
10 #include "core/fpdfapi/page/cpdf_page.h" | 10 #include "core/fpdfapi/page/cpdf_page.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 // Need to transform the patterns as well. | 169 // Need to transform the patterns as well. |
170 CPDF_Dictionary* pRes = pPageDic->GetDictFor("Resources"); | 170 CPDF_Dictionary* pRes = pPageDic->GetDictFor("Resources"); |
171 if (pRes) { | 171 if (pRes) { |
172 CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern"); | 172 CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern"); |
173 if (pPattenDict) { | 173 if (pPattenDict) { |
174 for (const auto& it : *pPattenDict) { | 174 for (const auto& it : *pPattenDict) { |
175 CPDF_Object* pObj = it.second; | 175 CPDF_Object* pObj = it.second.get(); |
176 if (pObj->IsReference()) | 176 if (pObj->IsReference()) |
177 pObj = pObj->GetDirect(); | 177 pObj = pObj->GetDirect(); |
178 | 178 |
179 CPDF_Dictionary* pDict = nullptr; | 179 CPDF_Dictionary* pDict = nullptr; |
180 if (pObj->IsDictionary()) | 180 if (pObj->IsDictionary()) |
181 pDict = pObj->AsDictionary(); | 181 pDict = pObj->AsDictionary(); |
182 else if (CPDF_Stream* pObjStream = pObj->AsStream()) | 182 else if (CPDF_Stream* pObjStream = pObj->AsStream()) |
183 pDict = pObjStream->GetDict(); | 183 pDict = pObjStream->GetDict(); |
184 else | 184 else |
185 continue; | 185 continue; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } else if (pDirectObj->IsStream()) { | 327 } else if (pDirectObj->IsStream()) { |
328 pContentArray = new CPDF_Array(); | 328 pContentArray = new CPDF_Array(); |
329 pContentArray->AddReference(pDoc, pStream->GetObjNum()); | 329 pContentArray->AddReference(pDoc, pStream->GetObjNum()); |
330 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); | 330 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); |
331 pPageDic->SetReferenceFor("Contents", pDoc, | 331 pPageDic->SetReferenceFor("Contents", pDoc, |
332 pDoc->AddIndirectObject(pContentArray)); | 332 pDoc->AddIndirectObject(pContentArray)); |
333 } | 333 } |
334 } | 334 } |
335 } | 335 } |
336 } | 336 } |
OLD | NEW |