| 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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_serial.h" | 8 #include "../../../include/fpdfapi/fpdf_serial.h" |
| 9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" |
| 10 #include "../../../include/fxcodec/fx_codec.h" | 10 #include "../../../include/fxcodec/fx_codec.h" |
| 11 #include "../fpdf_page/pageint.h" | 11 #include "../fpdf_page/pageint.h" |
| 12 CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& ar, CFX_AffineMatrix& matrix) | 12 CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& ar, CFX_AffineMatrix& matrix) |
| 13 { | 13 { |
| 14 ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << "
" << matrix.e << " " << matrix.f; | 14 ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << "
" << matrix.e << " " << matrix.f; |
| 15 return ar; | 15 return ar; |
| 16 } | 16 } |
| 17 CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) : m_pPage(p
Page) | 17 CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) : m_pPage(p
Page) |
| 18 { | 18 { |
| 19 m_pDocument = NULL; | 19 m_pDocument = NULL; |
| 20 if (m_pPage) { | 20 if (m_pPage) { |
| 21 m_pDocument = m_pPage->m_pDocument; | 21 m_pDocument = m_pPage->m_pDocument; |
| 22 } | 22 } |
| 23 FX_POSITION pos = pPage->GetFirstObjectPosition(); |
| 24 while (pos) { |
| 25 InsertPageObject(pPage->GetNextObject(pos)); |
| 26 } |
| 23 } | 27 } |
| 24 CPDF_PageContentGenerate::~CPDF_PageContentGenerate() | 28 CPDF_PageContentGenerate::~CPDF_PageContentGenerate() |
| 25 { | 29 { |
| 26 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { | |
| 27 CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_pageObjects[i]; | |
| 28 if (pPageObj) { | |
| 29 pPageObj->Release(); | |
| 30 } | |
| 31 } | |
| 32 } | 30 } |
| 33 FX_BOOL CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject) | 31 FX_BOOL CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject) |
| 34 { | 32 { |
| 35 if (!pPageObject) { | 33 if (!pPageObject) { |
| 36 return FALSE; | 34 return FALSE; |
| 37 } | 35 } |
| 38 return m_pageObjects.Add(pPageObject); | 36 return m_pageObjects.Add(pPageObject); |
| 39 } | 37 } |
| 40 void CPDF_PageContentGenerate::GenerateContent() | 38 void CPDF_PageContentGenerate::GenerateContent() |
| 41 { | 39 { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } else if (type == PDFOBJ_STREAM) { | 155 } else if (type == PDFOBJ_STREAM) { |
| 158 CPDF_StreamAcc contentStream; | 156 CPDF_StreamAcc contentStream; |
| 159 contentStream.LoadAllData((CPDF_Stream*)pContent); | 157 contentStream.LoadAllData((CPDF_Stream*)pContent); |
| 160 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matri
x); | 158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matri
x); |
| 161 } | 159 } |
| 162 CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); | 160 CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); |
| 163 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); | 161 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); |
| 164 m_pDocument->AddIndirectObject(pStream); | 162 m_pDocument->AddIndirectObject(pStream); |
| 165 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetOb
jNum()); | 163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetOb
jNum()); |
| 166 } | 164 } |
| OLD | NEW |