Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp

Issue 2044453003: Add missing const to CPDF_Stream::InitStream() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_stream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (!data || !size) { 108 if (!data || !size) {
109 return; 109 return;
110 } 110 }
111 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); 111 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
112 CPDF_Dictionary* pFormDict = new CPDF_Dictionary; 112 CPDF_Dictionary* pFormDict = new CPDF_Dictionary;
113 pFormDict->SetAtName("Type", "XObject"); 113 pFormDict->SetAtName("Type", "XObject");
114 pFormDict->SetAtName("Subtype", "Form"); 114 pFormDict->SetAtName("Subtype", "Form");
115 CFX_FloatRect bbox = m_pPage->GetPageBBox(); 115 CFX_FloatRect bbox = m_pPage->GetPageBBox();
116 matrix.TransformRect(bbox); 116 matrix.TransformRect(bbox);
117 pFormDict->SetAtRect("BBox", bbox); 117 pFormDict->SetAtRect("BBox", bbox);
118 pStream->InitStream((uint8_t*)data, size, pFormDict); 118 pStream->InitStream(data, size, pFormDict);
119 buf << "q " << matrix << " cm "; 119 buf << "q " << matrix << " cm ";
120 CFX_ByteString name = RealizeResource(pStream, "XObject"); 120 CFX_ByteString name = RealizeResource(pStream, "XObject");
121 buf << "/" << PDF_NameEncode(name) << " Do Q\n"; 121 buf << "/" << PDF_NameEncode(name) << " Do Q\n";
122 } 122 }
123 void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { 123 void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
124 CPDF_Dictionary* pDict = m_pPage->m_pFormDict; 124 CPDF_Dictionary* pDict = m_pPage->m_pFormDict;
125 CPDF_Object* pContent = pDict ? pDict->GetDirectObjectBy("Contents") : NULL; 125 CPDF_Object* pContent = pDict ? pDict->GetDirectObjectBy("Contents") : NULL;
126 if (!pContent) 126 if (!pContent)
127 return; 127 return;
128 128
(...skipping 29 matching lines...) Expand all
158 CPDF_StreamAcc contentStream; 158 CPDF_StreamAcc contentStream;
159 contentStream.LoadAllData(pStream); 159 contentStream.LoadAllData(pStream);
160 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); 160 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
161 } 161 }
162 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); 162 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
163 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); 163 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
164 m_pDocument->AddIndirectObject(pStream); 164 m_pDocument->AddIndirectObject(pStream);
165 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, 165 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument,
166 pStream->GetObjNum()); 166 pStream->GetObjNum());
167 } 167 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698