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

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

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() Created 4 years, 8 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_edit/fpdf_edit_create.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); 67 CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType);
68 if (!pResList) { 68 if (!pResList) {
69 pResList = new CPDF_Dictionary; 69 pResList = new CPDF_Dictionary;
70 m_pPage->m_pResources->SetAt(szType, pResList); 70 m_pPage->m_pResources->SetAt(szType, pResList);
71 } 71 }
72 m_pDocument->AddIndirectObject(pResourceObj); 72 m_pDocument->AddIndirectObject(pResourceObj);
73 CFX_ByteString name; 73 CFX_ByteString name;
74 int idnum = 1; 74 int idnum = 1;
75 while (1) { 75 while (1) {
76 name.Format("FX%c%d", szType[0], idnum); 76 name.Format("FX%c%d", szType[0], idnum);
77 if (!pResList->KeyExist(name)) { 77 if (!pResList->KeyExist(name.AsByteStringC())) {
78 break; 78 break;
79 } 79 }
80 idnum++; 80 idnum++;
81 } 81 }
82 pResList->AddReference(name, m_pDocument, pResourceObj->GetObjNum()); 82 pResList->AddReference(name.AsByteStringC(), m_pDocument,
83 pResourceObj->GetObjNum());
83 return name; 84 return name;
84 } 85 }
85 void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, 86 void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
86 CPDF_ImageObject* pImageObj) { 87 CPDF_ImageObject* pImageObj) {
87 if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || 88 if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) ||
88 (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { 89 (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) {
89 return; 90 return;
90 } 91 }
91 buf << "q " << pImageObj->m_Matrix << " cm "; 92 buf << "q " << pImageObj->m_Matrix << " cm ";
92 if (!pImageObj->m_pImage->IsInline()) { 93 if (!pImageObj->m_pImage->IsInline()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 CPDF_StreamAcc contentStream; 160 CPDF_StreamAcc contentStream;
160 contentStream.LoadAllData(pStream); 161 contentStream.LoadAllData(pStream);
161 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); 162 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
162 } 163 }
163 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); 164 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
164 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); 165 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
165 m_pDocument->AddIndirectObject(pStream); 166 m_pDocument->AddIndirectObject(pStream);
166 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, 167 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument,
167 pStream->GetObjNum()); 168 pStream->GetObjNum());
168 } 169 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698