| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 52 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); | 52 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); |
| 53 m_pDocument->AddIndirectObject(pStream); | 53 m_pDocument->AddIndirectObject(pStream); |
| 54 pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); | 54 pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); |
| 55 } | 55 } |
| 56 CFX_ByteString CPDF_PageContentGenerate::RealizeResource( | 56 CFX_ByteString CPDF_PageContentGenerate::RealizeResource( |
| 57 CPDF_Object* pResourceObj, | 57 CPDF_Object* pResourceObj, |
| 58 const FX_CHAR* szType) { | 58 const FX_CHAR* szType) { |
| 59 if (m_pPage->m_pResources == NULL) { | 59 if (!m_pPage->m_pResources) { |
| 60 m_pPage->m_pResources = new CPDF_Dictionary; | 60 m_pPage->m_pResources = new CPDF_Dictionary; |
| 61 int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); | 61 int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); |
| 62 m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); | 62 m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); |
| 63 } | 63 } |
| 64 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType); | 64 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType); |
| 65 if (pResList == NULL) { | 65 if (!pResList) { |
| 66 pResList = new CPDF_Dictionary; | 66 pResList = new CPDF_Dictionary; |
| 67 m_pPage->m_pResources->SetAt(szType, pResList); | 67 m_pPage->m_pResources->SetAt(szType, pResList); |
| 68 } | 68 } |
| 69 m_pDocument->AddIndirectObject(pResourceObj); | 69 m_pDocument->AddIndirectObject(pResourceObj); |
| 70 CFX_ByteString name; | 70 CFX_ByteString name; |
| 71 int idnum = 1; | 71 int idnum = 1; |
| 72 while (1) { | 72 while (1) { |
| 73 name.Format("FX%c%d", szType[0], idnum); | 73 name.Format("FX%c%d", szType[0], idnum); |
| 74 if (!pResList->KeyExist(name)) { | 74 if (!pResList->KeyExist(name)) { |
| 75 break; | 75 break; |
| (...skipping 80 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 |