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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 rect.Width(), rect.Height()); | 113 rect.Width(), rect.Height()); |
114 textBuf << bsClipping; | 114 textBuf << bsClipping; |
115 | 115 |
116 CFX_ByteString bsMatix; | 116 CFX_ByteString bsMatix; |
117 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c, | 117 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c, |
118 matrix->d, matrix->e, matrix->f); | 118 matrix->d, matrix->e, matrix->f); |
119 textBuf << bsMatix; | 119 textBuf << bsMatix; |
120 | 120 |
121 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; | 121 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; |
122 CPDF_Object* pContentObj = | 122 CPDF_Object* pContentObj = |
123 pPageDic ? pPageDic->GetElement("Contents") : nullptr; | 123 pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr; |
124 if (!pContentObj) | 124 if (!pContentObj) |
125 pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; | 125 pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; |
126 if (!pContentObj) | 126 if (!pContentObj) |
127 return FALSE; | 127 return FALSE; |
128 | 128 |
129 CPDF_Dictionary* pDic = new CPDF_Dictionary; | 129 CPDF_Dictionary* pDic = new CPDF_Dictionary; |
130 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); | 130 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); |
131 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); | 131 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); |
132 CPDF_Document* pDoc = pPage->m_pDocument; | 132 CPDF_Document* pDoc = pPage->m_pDocument; |
133 if (!pDoc) | 133 if (!pDoc) |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, | 272 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, |
273 FPDF_CLIPPATH clipPath) { | 273 FPDF_CLIPPATH clipPath) { |
274 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 274 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
275 if (!pPage) | 275 if (!pPage) |
276 return; | 276 return; |
277 | 277 |
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->GetObjectBy("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 uint32_t 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); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |