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

Side by Side Diff: core/fpdfdoc/cpdf_annotlist.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compile Created 4 years, 2 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 | « core/fpdfapi/fpdf_parser/include/cpdf_document.h ('k') | core/fpdfdoc/cpdf_filespec.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/fpdfdoc/include/cpdf_annotlist.h" 7 #include "core/fpdfdoc/include/cpdf_annotlist.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 12 matching lines...) Expand all
23 CPDF_Dictionary* pParentDict = pAnnot->GetAnnotDict(); 23 CPDF_Dictionary* pParentDict = pAnnot->GetAnnotDict();
24 if (!pParentDict) 24 if (!pParentDict)
25 return std::unique_ptr<CPDF_Annot>(); 25 return std::unique_ptr<CPDF_Annot>();
26 26
27 // TODO(jaepark): We shouldn't strip BOM for some strings and not for others. 27 // TODO(jaepark): We shouldn't strip BOM for some strings and not for others.
28 // See pdfium:593. 28 // See pdfium:593.
29 CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents"); 29 CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
30 if (sContents.IsEmpty()) 30 if (sContents.IsEmpty())
31 return std::unique_ptr<CPDF_Annot>(); 31 return std::unique_ptr<CPDF_Annot>();
32 32
33 CPDF_Dictionary* pAnnotDict = new CPDF_Dictionary; 33 CPDF_Dictionary* pAnnotDict =
34 new CPDF_Dictionary(pDocument->GetByteStringPool());
34 pAnnotDict->SetNameFor("Type", "Annot"); 35 pAnnotDict->SetNameFor("Type", "Annot");
35 pAnnotDict->SetNameFor("Subtype", "Popup"); 36 pAnnotDict->SetNameFor("Subtype", "Popup");
36 pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T")); 37 pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T"));
37 pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode()); 38 pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode());
38 39
39 CFX_FloatRect rect = pParentDict->GetRectFor("Rect"); 40 CFX_FloatRect rect = pParentDict->GetRectFor("Rect");
40 rect.Normalize(); 41 rect.Normalize();
41 CFX_FloatRect popupRect(0, 0, 200, 200); 42 CFX_FloatRect popupRect(0, 0, 200, 200);
42 popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); 43 popupRect.Translate(rect.left, rect.bottom - popupRect.Height());
43 44
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 CPDF_RenderContext* pContext, 176 CPDF_RenderContext* pContext,
176 FX_BOOL bPrinting, 177 FX_BOOL bPrinting,
177 CFX_Matrix* pMatrix, 178 CFX_Matrix* pMatrix,
178 FX_BOOL bShowWidget, 179 FX_BOOL bShowWidget,
179 CPDF_RenderOptions* pOptions) { 180 CPDF_RenderOptions* pOptions) {
180 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN 181 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN
181 : ANNOTFLAG_INVISIBLE; 182 : ANNOTFLAG_INVISIBLE;
182 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags, 183 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags,
183 pOptions, nullptr); 184 pOptions, nullptr);
184 } 185 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_document.h ('k') | core/fpdfdoc/cpdf_filespec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698