OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" | 7 #include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" | 9 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); | 67 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); |
68 if (!pResList) { | 68 if (!pResList) { |
69 pResList = new CPDF_Dictionary; | 69 pResList = new CPDF_Dictionary; |
70 m_pPage->m_pResources->SetAt(szType, pResList); | 70 m_pPage->m_pResources->SetAt(szType, pResList); |
71 } | 71 } |
72 m_pDocument->AddIndirectObject(pResourceObj); | 72 m_pDocument->AddIndirectObject(pResourceObj); |
73 CFX_ByteString name; | 73 CFX_ByteString name; |
74 int idnum = 1; | 74 int idnum = 1; |
75 while (1) { | 75 while (1) { |
76 name.Format("FX%c%d", szType[0], idnum); | 76 name.Format("FX%c%d", szType[0], idnum); |
77 if (!pResList->KeyExist(name.AsByteStringC())) { | 77 if (!pResList->KeyExist(name.AsStringC())) { |
78 break; | 78 break; |
79 } | 79 } |
80 idnum++; | 80 idnum++; |
81 } | 81 } |
82 pResList->AddReference(name.AsByteStringC(), m_pDocument, | 82 pResList->AddReference(name.AsStringC(), m_pDocument, |
83 pResourceObj->GetObjNum()); | 83 pResourceObj->GetObjNum()); |
84 return name; | 84 return name; |
85 } | 85 } |
86 void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, | 86 void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, |
87 CPDF_ImageObject* pImageObj) { | 87 CPDF_ImageObject* pImageObj) { |
88 if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || | 88 if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || |
89 (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { | 89 (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { |
90 return; | 90 return; |
91 } | 91 } |
92 buf << "q " << pImageObj->m_Matrix << " cm "; | 92 buf << "q " << pImageObj->m_Matrix << " cm "; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 CPDF_StreamAcc contentStream; | 160 CPDF_StreamAcc contentStream; |
161 contentStream.LoadAllData(pStream); | 161 contentStream.LoadAllData(pStream); |
162 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); | 162 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); |
163 } | 163 } |
164 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); | 164 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); |
165 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); | 165 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); |
166 m_pDocument->AddIndirectObject(pStream); | 166 m_pDocument->AddIndirectObject(pStream); |
167 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, | 167 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, |
168 pStream->GetObjNum()); | 168 pStream->GetObjNum()); |
169 } | 169 } |
OLD | NEW |