| 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 13 matching lines...) Expand all Loading... |
| 24 << matrix.e << " " << matrix.f; | 24 << matrix.e << " " << matrix.f; |
| 25 return ar; | 25 return ar; |
| 26 } | 26 } |
| 27 | 27 |
| 28 CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) | 28 CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) |
| 29 : m_pPage(pPage), m_pDocument(m_pPage->m_pDocument) { | 29 : m_pPage(pPage), m_pDocument(m_pPage->m_pDocument) { |
| 30 for (const auto& pObj : *pPage->GetPageObjectList()) | 30 for (const auto& pObj : *pPage->GetPageObjectList()) |
| 31 InsertPageObject(pObj.get()); | 31 InsertPageObject(pObj.get()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 CPDF_PageContentGenerator::~CPDF_PageContentGenerator() {} |
| 35 |
| 34 FX_BOOL CPDF_PageContentGenerator::InsertPageObject( | 36 FX_BOOL CPDF_PageContentGenerator::InsertPageObject( |
| 35 CPDF_PageObject* pPageObject) { | 37 CPDF_PageObject* pPageObject) { |
| 36 return pPageObject && m_pageObjects.Add(pPageObject); | 38 return pPageObject && m_pageObjects.Add(pPageObject); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void CPDF_PageContentGenerator::GenerateContent() { | 41 void CPDF_PageContentGenerator::GenerateContent() { |
| 40 CFX_ByteTextBuf buf; | 42 CFX_ByteTextBuf buf; |
| 41 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; | 43 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; |
| 42 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { | 44 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { |
| 43 CPDF_PageObject* pPageObj = m_pageObjects[i]; | 45 CPDF_PageObject* pPageObj = m_pageObjects[i]; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 CPDF_StreamAcc contentStream; | 161 CPDF_StreamAcc contentStream; |
| 160 contentStream.LoadAllData(pStream); | 162 contentStream.LoadAllData(pStream); |
| 161 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); | 163 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); |
| 162 } | 164 } |
| 163 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); | 165 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); |
| 164 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); | 166 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); |
| 165 m_pDocument->AddIndirectObject(pStream); | 167 m_pDocument->AddIndirectObject(pStream); |
| 166 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, | 168 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, |
| 167 pStream->GetObjNum()); | 169 pStream->GetObjNum()); |
| 168 } | 170 } |
| OLD | NEW |