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

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

Issue 2474283005: Revert of Unify some code (Closed)
Patch Set: Created 4 years, 1 month 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/parser/cpdf_document.h ('k') | core/fpdfapi/parser/cpdf_document_unittest.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/parser/cpdf_document.h" 7 #include "core/fpdfapi/parser/cpdf_document.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "core/fpdfapi/cpdf_modulemgr.h" 13 #include "core/fpdfapi/cpdf_modulemgr.h"
14 #include "core/fpdfapi/font/cpdf_fontencoding.h" 14 #include "core/fpdfapi/font/cpdf_fontencoding.h"
15 #include "core/fpdfapi/page/cpdf_docpagedata.h" 15 #include "core/fpdfapi/page/cpdf_docpagedata.h"
16 #include "core/fpdfapi/page/cpdf_pagemodule.h" 16 #include "core/fpdfapi/page/cpdf_pagemodule.h"
17 #include "core/fpdfapi/page/pageint.h" 17 #include "core/fpdfapi/page/pageint.h"
18 #include "core/fpdfapi/parser/cpdf_array.h" 18 #include "core/fpdfapi/parser/cpdf_array.h"
19 #include "core/fpdfapi/parser/cpdf_dictionary.h" 19 #include "core/fpdfapi/parser/cpdf_dictionary.h"
20 #include "core/fpdfapi/parser/cpdf_linearized.h"
21 #include "core/fpdfapi/parser/cpdf_number.h" 20 #include "core/fpdfapi/parser/cpdf_number.h"
22 #include "core/fpdfapi/parser/cpdf_parser.h" 21 #include "core/fpdfapi/parser/cpdf_parser.h"
23 #include "core/fpdfapi/parser/cpdf_reference.h" 22 #include "core/fpdfapi/parser/cpdf_reference.h"
24 #include "core/fpdfapi/parser/cpdf_stream.h" 23 #include "core/fpdfapi/parser/cpdf_stream.h"
25 #include "core/fpdfapi/render/render_int.h" 24 #include "core/fpdfapi/render/render_int.h"
26 #include "core/fxcodec/JBig2_DocumentContext.h" 25 #include "core/fxcodec/JBig2_DocumentContext.h"
27 #include "core/fxge/cfx_unicodeencoding.h" 26 #include "core/fxge/cfx_unicodeencoding.h"
28 #include "core/fxge/fx_font.h" 27 #include "core/fxge/fx_font.h"
29 #include "third_party/base/ptr_util.h" 28 #include "third_party/base/ptr_util.h"
30 #include "third_party/base/stl_util.h" 29 #include "third_party/base/stl_util.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum()); 371 CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum());
373 if (pInfoObj) 372 if (pInfoObj)
374 m_pInfoDict = pInfoObj->GetDict(); 373 m_pInfoDict = pInfoObj->GetDict();
375 } 374 }
376 375
377 void CPDF_Document::LoadDoc() { 376 void CPDF_Document::LoadDoc() {
378 LoadDocInternal(); 377 LoadDocInternal();
379 m_PageList.SetSize(RetrievePageCount()); 378 m_PageList.SetSize(RetrievePageCount());
380 } 379 }
381 380
382 void CPDF_Document::LoadLinearizedDoc( 381 void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams) {
383 const CPDF_Linearized* pLinearizationParams) {
384 m_bLinearized = true; 382 m_bLinearized = true;
385 LoadDocInternal(); 383 LoadDocInternal();
386 m_PageList.SetSize(pLinearizationParams->GetPageCount()); 384
387 m_iFirstPageNo = pLinearizationParams->GetFirstPageNo(); 385 uint32_t dwPageCount = 0;
388 m_dwFirstPageObjNum = pLinearizationParams->GetFirstPageObjNum(); 386 CPDF_Object* pCount = pLinearizationParams->GetObjectFor("N");
387 if (ToNumber(pCount))
388 dwPageCount = pCount->GetInteger();
389 m_PageList.SetSize(dwPageCount);
390
391 CPDF_Object* pNo = pLinearizationParams->GetObjectFor("P");
392 if (ToNumber(pNo))
393 m_iFirstPageNo = pNo->GetInteger();
394
395 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O");
396 if (ToNumber(pObjNum))
397 m_dwFirstPageObjNum = pObjNum->GetInteger();
389 } 398 }
390 399
391 void CPDF_Document::LoadPages() { 400 void CPDF_Document::LoadPages() {
392 m_PageList.SetSize(RetrievePageCount()); 401 m_PageList.SetSize(RetrievePageCount());
393 } 402 }
394 403
395 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, 404 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage,
396 int* nPagesToGo, 405 int* nPagesToGo,
397 size_t level) { 406 size_t level) {
398 if (*nPagesToGo < 0) 407 if (*nPagesToGo < 0)
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 pBBox, pLogFont->lfWeight / 5); 1045 pBBox, pLogFont->lfWeight / 5);
1037 pFontDesc->SetIntegerFor("CapHeight", capheight); 1046 pFontDesc->SetIntegerFor("CapHeight", capheight);
1038 pFontDict->SetReferenceFor("FontDescriptor", this, 1047 pFontDict->SetReferenceFor("FontDescriptor", this,
1039 AddIndirectObject(pFontDesc)); 1048 AddIndirectObject(pFontDesc));
1040 hFont = SelectObject(hDC, hFont); 1049 hFont = SelectObject(hDC, hFont);
1041 DeleteObject(hFont); 1050 DeleteObject(hFont);
1042 DeleteDC(hDC); 1051 DeleteDC(hDC);
1043 return LoadFont(pBaseDict); 1052 return LoadFont(pBaseDict);
1044 } 1053 }
1045 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1054 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_document.h ('k') | core/fpdfapi/parser/cpdf_document_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698