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/fpdf_page/include/cpdf_clippath.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_clippath.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; | 278 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; |
279 CPDF_Object* pContentObj = | 279 CPDF_Object* pContentObj = |
280 pPageDic ? pPageDic->GetElement("Contents") : nullptr; | 280 pPageDic ? pPageDic->GetElement("Contents") : nullptr; |
281 if (!pContentObj) | 281 if (!pContentObj) |
282 pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; | 282 pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; |
283 if (!pContentObj) | 283 if (!pContentObj) |
284 return; | 284 return; |
285 | 285 |
286 CFX_ByteTextBuf strClip; | 286 CFX_ByteTextBuf strClip; |
287 CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath; | 287 CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath; |
288 FX_DWORD i; | 288 uint32_t i; |
289 for (i = 0; i < pClipPath->GetPathCount(); i++) { | 289 for (i = 0; i < pClipPath->GetPathCount(); i++) { |
290 CPDF_Path path = pClipPath->GetPath(i); | 290 CPDF_Path path = pClipPath->GetPath(i); |
291 int iClipType = pClipPath->GetClipType(i); | 291 int iClipType = pClipPath->GetClipType(i); |
292 if (path.GetPointCount() == 0) { | 292 if (path.GetPointCount() == 0) { |
293 // Empty clipping (totally clipped out) | 293 // Empty clipping (totally clipped out) |
294 strClip << "0 0 m W n "; | 294 strClip << "0 0 m W n "; |
295 } else { | 295 } else { |
296 OutputPath(strClip, path); | 296 OutputPath(strClip, path); |
297 if (iClipType == FXFILL_WINDING) | 297 if (iClipType == FXFILL_WINDING) |
298 strClip << "W n\n"; | 298 strClip << "W n\n"; |
(...skipping 24 matching lines...) Expand all Loading... |
323 } else if (pDirectObj->IsStream()) { | 323 } else if (pDirectObj->IsStream()) { |
324 pContentArray = new CPDF_Array(); | 324 pContentArray = new CPDF_Array(); |
325 pContentArray->AddReference(pDoc, pStream->GetObjNum()); | 325 pContentArray->AddReference(pDoc, pStream->GetObjNum()); |
326 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); | 326 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); |
327 pPageDic->SetAtReference("Contents", pDoc, | 327 pPageDic->SetAtReference("Contents", pDoc, |
328 pDoc->AddIndirectObject(pContentArray)); | 328 pDoc->AddIndirectObject(pContentArray)); |
329 } | 329 } |
330 } | 330 } |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |