| 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" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 pContent = pArray->GetElement(i); | 135 pContent = pArray->GetElement(i); |
| 136 if (!pContent || pContent->GetType() != PDFOBJ_STREAM) { | 136 if (!pContent || pContent->GetType() != PDFOBJ_STREAM) { |
| 137 continue; | 137 continue; |
| 138 } | 138 } |
| 139 CPDF_StreamAcc* pStream = new CPDF_StreamAcc(); | 139 CPDF_StreamAcc* pStream = new CPDF_StreamAcc(); |
| 140 pStream->LoadAllData((CPDF_Stream*)pContent); | 140 pStream->LoadAllData((CPDF_Stream*)pContent); |
| 141 pContentArray[i] = pStream; | 141 pContentArray[i] = pStream; |
| 142 size += pContentArray[i]->GetSize() + 1; | 142 size += pContentArray[i]->GetSize() + 1; |
| 143 } | 143 } |
| 144 int pos = 0; | 144 int pos = 0; |
| 145 FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, size); | 145 FX_LPBYTE pBuf = FX_Alloc(uint8_t, size); |
| 146 for (i = 0; i < iCount; ++i) { | 146 for (i = 0; i < iCount; ++i) { |
| 147 FXSYS_memcpy32(pBuf + pos, pContentArray[i]->GetData(), pContentArra
y[i]->GetSize()); | 147 FXSYS_memcpy32(pBuf + pos, pContentArray[i]->GetData(), pContentArra
y[i]->GetSize()); |
| 148 pos += pContentArray[i]->GetSize() + 1; | 148 pos += pContentArray[i]->GetSize() + 1; |
| 149 pBuf[pos - 1] = ' '; | 149 pBuf[pos - 1] = ' '; |
| 150 delete pContentArray[i]; | 150 delete pContentArray[i]; |
| 151 } | 151 } |
| 152 ProcessForm(buf, pBuf, size, matrix); | 152 ProcessForm(buf, pBuf, size, matrix); |
| 153 FX_Free(pBuf); | 153 FX_Free(pBuf); |
| 154 FX_Free(pContentArray); | 154 FX_Free(pContentArray); |
| 155 } else if (type == PDFOBJ_STREAM) { | 155 } else if (type == PDFOBJ_STREAM) { |
| 156 CPDF_StreamAcc contentStream; | 156 CPDF_StreamAcc contentStream; |
| 157 contentStream.LoadAllData((CPDF_Stream*)pContent); | 157 contentStream.LoadAllData((CPDF_Stream*)pContent); |
| 158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matri
x); | 158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matri
x); |
| 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, pStream->GetOb
jNum()); | 163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetOb
jNum()); |
| 164 } | 164 } |
| OLD | NEW |