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

Side by Side Diff: core/src/fpdfdoc/doc_bookmark.cpp

Issue 1751753002: Remove implicit conversions and some cleanup (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 9 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/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_form.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 <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "core/include/fpdfdoc/fpdf_doc.h" 10 #include "core/include/fpdfdoc/fpdf_doc.h"
11 11
12 CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( 12 CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
13 const CPDF_Bookmark& parent) const { 13 const CPDF_Bookmark& parent) const {
14 if (!parent.m_pDict) { 14 if (!parent.GetDict()) {
15 CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDictBy("Outlines"); 15 CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDictBy("Outlines");
16 if (!pRoot) { 16 if (!pRoot)
17 return CPDF_Bookmark(); 17 return CPDF_Bookmark();
18 }
19 return CPDF_Bookmark(pRoot->GetDictBy("First")); 18 return CPDF_Bookmark(pRoot->GetDictBy("First"));
20 } 19 }
21 return CPDF_Bookmark(parent.m_pDict->GetDictBy("First")); 20 return CPDF_Bookmark(parent.GetDict()->GetDictBy("First"));
22 } 21 }
22
23 CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( 23 CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling(
24 const CPDF_Bookmark& bookmark) const { 24 const CPDF_Bookmark& bookmark) const {
25 if (!bookmark.m_pDict) { 25 if (!bookmark.GetDict())
26 return CPDF_Bookmark(); 26 return CPDF_Bookmark();
27 } 27
28 CPDF_Dictionary* pNext = bookmark.m_pDict->GetDictBy("Next"); 28 CPDF_Dictionary* pNext = bookmark.GetDict()->GetDictBy("Next");
29 return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext); 29 return pNext == bookmark.GetDict() ? CPDF_Bookmark() : CPDF_Bookmark(pNext);
30 } 30 }
31
31 FX_DWORD CPDF_Bookmark::GetColorRef() const { 32 FX_DWORD CPDF_Bookmark::GetColorRef() const {
32 if (!m_pDict) { 33 if (!m_pDict) {
33 return 0; 34 return 0;
34 } 35 }
35 CPDF_Array* pColor = m_pDict->GetArrayBy("C"); 36 CPDF_Array* pColor = m_pDict->GetArrayBy("C");
36 if (!pColor) { 37 if (!pColor) {
37 return FXSYS_RGB(0, 0, 0); 38 return FXSYS_RGB(0, 0, 0);
38 } 39 }
39 int r = FXSYS_round(pColor->GetNumberAt(0) * 255); 40 int r = FXSYS_round(pColor->GetNumberAt(0) * 255);
40 int g = FXSYS_round(pColor->GetNumberAt(1) * 255); 41 int g = FXSYS_round(pColor->GetNumberAt(1) * 255);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (CPDF_Array* pArray = pDest->AsArray()) 83 if (CPDF_Array* pArray = pDest->AsArray())
83 return CPDF_Dest(pArray); 84 return CPDF_Dest(pArray);
84 return CPDF_Dest(); 85 return CPDF_Dest();
85 } 86 }
86 CPDF_Action CPDF_Bookmark::GetAction() const { 87 CPDF_Action CPDF_Bookmark::GetAction() const {
87 if (!m_pDict) { 88 if (!m_pDict) {
88 return CPDF_Action(); 89 return CPDF_Action();
89 } 90 }
90 return CPDF_Action(m_pDict->GetDictBy("A")); 91 return CPDF_Action(m_pDict->GetDictBy("A"));
91 } 92 }
OLDNEW
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698