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 "core/include/fpdfapi/fpdf_module.h" | 7 #include "core/include/fpdfapi/fpdf_module.h" |
8 #include "core/include/fpdfapi/fpdf_page.h" | 8 #include "core/include/fpdfapi/fpdf_page.h" |
9 #include "core/include/fpdfapi/fpdf_serial.h" | 9 #include "core/include/fpdfapi/fpdf_serial.h" |
10 #include "core/src/fpdfapi/fpdf_page/pageint.h" | 10 #include "core/src/fpdfapi/fpdf_page/pageint.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (!pPageObject) { | 31 if (!pPageObject) { |
32 return FALSE; | 32 return FALSE; |
33 } | 33 } |
34 return m_pageObjects.Add(pPageObject); | 34 return m_pageObjects.Add(pPageObject); |
35 } | 35 } |
36 void CPDF_PageContentGenerator::GenerateContent() { | 36 void CPDF_PageContentGenerator::GenerateContent() { |
37 CFX_ByteTextBuf buf; | 37 CFX_ByteTextBuf buf; |
38 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; | 38 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; |
39 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { | 39 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { |
40 CPDF_PageObject* pPageObj = m_pageObjects[i]; | 40 CPDF_PageObject* pPageObj = m_pageObjects[i]; |
41 if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) { | 41 if (!pPageObj || pPageObj->m_Type != CPDF_PageObject::IMAGE) { |
42 continue; | 42 continue; |
43 } | 43 } |
44 ProcessImage(buf, (CPDF_ImageObject*)pPageObj); | 44 ProcessImage(buf, (CPDF_ImageObject*)pPageObj); |
45 } | 45 } |
46 CPDF_Object* pContent = | 46 CPDF_Object* pContent = |
47 pPageDict ? pPageDict->GetElementValue("Contents") : NULL; | 47 pPageDict ? pPageDict->GetElementValue("Contents") : NULL; |
48 if (pContent) { | 48 if (pContent) { |
49 pPageDict->RemoveAt("Contents"); | 49 pPageDict->RemoveAt("Contents"); |
50 } | 50 } |
51 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); | 51 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 CPDF_StreamAcc contentStream; | 156 CPDF_StreamAcc contentStream; |
157 contentStream.LoadAllData(pStream); | 157 contentStream.LoadAllData(pStream); |
158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); | 158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); |
159 } | 159 } |
160 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); | 160 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); |
161 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); | 161 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); |
162 m_pDocument->AddIndirectObject(pStream); | 162 m_pDocument->AddIndirectObject(pStream); |
163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, | 163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, |
164 pStream->GetObjNum()); | 164 pStream->GetObjNum()); |
165 } | 165 } |
OLD | NEW |