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

Side by Side Diff: core/fpdfapi/parser/cpdf_document.h

Issue 2414423002: Traverse PDF page tree only once in CPDF_Document (Closed)
Patch Set: 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
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 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
9 9
10 #include <functional> 10 #include <functional>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, 100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
101 FX_BOOL bVert, 101 FX_BOOL bVert,
102 FX_BOOL bTranslateName = FALSE); 102 FX_BOOL bTranslateName = FALSE);
103 #endif 103 #endif
104 104
105 private: 105 private:
106 friend class CPDF_TestDocument; 106 friend class CPDF_TestDocument;
107 107
108 // Retrieve page count information by getting count value from the tree nodes 108 // Retrieve page count information by getting count value from the tree nodes
109 int RetrievePageCount() const; 109 int RetrievePageCount() const;
110 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, 110 void TraversePDFPages(CPDF_Dictionary* pPages, int iPage, int level);
111 int iPage,
112 int nPagesToGo,
113 int level);
114 int FindPageIndex(CPDF_Dictionary* pNode, 111 int FindPageIndex(CPDF_Dictionary* pNode,
115 uint32_t& skip_count, 112 uint32_t& skip_count,
116 uint32_t objnum, 113 uint32_t objnum,
117 int& index, 114 int& index,
118 int level = 0); 115 int level = 0);
119 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; 116 CPDF_Object* ParseIndirectObject(uint32_t objnum) override;
120 void LoadDocInternal(); 117 void LoadDocInternal();
121 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); 118 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict);
122 CPDF_Dictionary* GetPagesDict() const; 119 CPDF_Dictionary* GetPagesDict() const;
123 CPDF_Dictionary* ProcessbCJK( 120 CPDF_Dictionary* ProcessbCJK(
124 CPDF_Dictionary* pBaseDict, 121 CPDF_Dictionary* pBaseDict,
125 int charset, 122 int charset,
126 FX_BOOL bVert, 123 FX_BOOL bVert,
127 CFX_ByteString basefont, 124 CFX_ByteString basefont,
128 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); 125 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert);
129 126
130 std::unique_ptr<CPDF_Parser> m_pParser; 127 std::unique_ptr<CPDF_Parser> m_pParser;
131 CPDF_Dictionary* m_pRootDict; 128 CPDF_Dictionary* m_pRootDict;
132 CPDF_Dictionary* m_pInfoDict; 129 CPDF_Dictionary* m_pInfoDict;
133 bool m_bLinearized; 130 bool m_bLinearized;
131 bool m_bPagesTraversed;
134 int m_iFirstPageNo; 132 int m_iFirstPageNo;
135 uint32_t m_dwFirstPageObjNum; 133 uint32_t m_dwFirstPageObjNum;
136 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. 134 // TODO(thestig): Figure out why this cannot be a std::unique_ptr.
137 CPDF_DocPageData* m_pDocPage; 135 CPDF_DocPageData* m_pDocPage;
138 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; 136 std::unique_ptr<CPDF_DocRenderData> m_pDocRender;
139 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; 137 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext;
140 std::unique_ptr<CPDF_LinkList> m_pLinksContext; 138 std::unique_ptr<CPDF_LinkList> m_pLinksContext;
141 CFX_ArrayTemplate<uint32_t> m_PageList; 139 CFX_ArrayTemplate<uint32_t> m_PageList;
142 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; 140 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
143 }; 141 };
144 142
145 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 143 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_document.cpp » ('j') | core/fpdfapi/parser/cpdf_document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698