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

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

Issue 1879683002: Remove CPDF_Object::GetConstString and overrides (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Move bLuminosity down. 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 | « core/fpdfdoc/cpvt_generateap.cpp ('k') | core/fpdfdoc/doc_basic.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 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/fpdfapi/fpdf_page/include/cpdf_form.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 25 matching lines...) Expand all
36 36
37 uint32_t dwObjNum = pDict->GetObjNum(); 37 uint32_t dwObjNum = pDict->GetObjNum();
38 if (dwObjNum == 0) { 38 if (dwObjNum == 0) {
39 dwObjNum = m_pDocument->AddIndirectObject(pDict); 39 dwObjNum = m_pDocument->AddIndirectObject(pDict);
40 CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); 40 CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum);
41 pAnnots->InsertAt(i, pAction); 41 pAnnots->InsertAt(i, pAction);
42 pAnnots->RemoveAt(i + 1); 42 pAnnots->RemoveAt(i + 1);
43 pDict = pAnnots->GetDictAt(i); 43 pDict = pAnnots->GetDictAt(i);
44 } 44 }
45 m_AnnotList.push_back(new CPDF_Annot(pDict, this)); 45 m_AnnotList.push_back(new CPDF_Annot(pDict, this));
46 if (bRegenerateAP && pDict->GetConstStringBy("Subtype") == "Widget" && 46 if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
47 CPDF_InterForm::UpdatingAPEnabled()) { 47 CPDF_InterForm::UpdatingAPEnabled()) {
48 FPDF_GenerateAP(m_pDocument, pDict); 48 FPDF_GenerateAP(m_pDocument, pDict);
49 } 49 }
50 } 50 }
51 } 51 }
52 52
53 CPDF_AnnotList::~CPDF_AnnotList() { 53 CPDF_AnnotList::~CPDF_AnnotList() {
54 for (CPDF_Annot* annot : m_AnnotList) 54 for (CPDF_Annot* annot : m_AnnotList)
55 delete annot; 55 delete annot;
56 } 56 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 if (dwAnnotFlags & 0x02) { 121 if (dwAnnotFlags & 0x02) {
122 DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, TRUE, 122 DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, TRUE,
123 pOptions, pClipRect); 123 pOptions, pClipRect);
124 } 124 }
125 } 125 }
126 126
127 CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList) 127 CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
128 : m_pAnnotDict(pDict), 128 : m_pAnnotDict(pDict),
129 m_pList(pList), 129 m_pList(pList),
130 m_sSubtype(m_pAnnotDict->GetConstStringBy("Subtype")) {} 130 m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")) {}
131
131 CPDF_Annot::~CPDF_Annot() { 132 CPDF_Annot::~CPDF_Annot() {
132 ClearCachedAP(); 133 ClearCachedAP();
133 } 134 }
135
134 void CPDF_Annot::ClearCachedAP() { 136 void CPDF_Annot::ClearCachedAP() {
135 for (const auto& pair : m_APMap) { 137 for (const auto& pair : m_APMap) {
136 delete pair.second; 138 delete pair.second;
137 } 139 }
138 m_APMap.clear(); 140 m_APMap.clear();
139 } 141 }
140 CFX_ByteString CPDF_Annot::GetSubType() const { 142 CFX_ByteString CPDF_Annot::GetSubType() const {
141 return m_sSubtype; 143 return m_sSubtype;
142 } 144 }
143 145
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 CFX_PathData path; 349 CFX_PathData path;
348 width /= 2; 350 width /= 2;
349 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, 351 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width,
350 rect.top - width); 352 rect.top - width);
351 int fill_type = 0; 353 int fill_type = 0;
352 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { 354 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) {
353 fill_type |= FXFILL_NOPATHSMOOTH; 355 fill_type |= FXFILL_NOPATHSMOOTH;
354 } 356 }
355 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); 357 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type);
356 } 358 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.cpp ('k') | core/fpdfdoc/doc_basic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698