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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 1918113002: Clean up CPDF_Page. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: delete more dead code Created 4 years, 7 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 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 "public/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return nullptr; 495 return nullptr;
496 496
497 if (page_index < 0 || page_index >= pDoc->GetPageCount()) 497 if (page_index < 0 || page_index >= pDoc->GetPageCount())
498 return nullptr; 498 return nullptr;
499 499
500 #ifdef PDF_ENABLE_XFA 500 #ifdef PDF_ENABLE_XFA
501 return pDoc->GetPage(page_index); 501 return pDoc->GetPage(page_index);
502 #else // PDF_ENABLE_XFA 502 #else // PDF_ENABLE_XFA
503 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); 503 CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
504 if (!pDict) 504 if (!pDict)
505 return NULL; 505 return nullptr;
506 CPDF_Page* pPage = new CPDF_Page; 506
507 pPage->Load(pDoc, pDict); 507 CPDF_Page* pPage = new CPDF_Page(pDoc, pDict, true);
508 pPage->ParseContent(nullptr); 508 pPage->ParseContent();
509 return pPage; 509 return pPage;
510 #endif // PDF_ENABLE_XFA 510 #endif // PDF_ENABLE_XFA
511 } 511 }
512 512
513 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page) { 513 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page) {
514 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 514 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
515 return pPage ? pPage->GetPageWidth() : 0.0; 515 return pPage ? pPage->GetPageWidth() : 0.0;
516 } 516 }
517 517
518 DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page) { 518 DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page) {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 return FALSE; 951 return FALSE;
952 CPDFXFA_Page* pPage = pDoc->GetPage(page_index); 952 CPDFXFA_Page* pPage = pDoc->GetPage(page_index);
953 if (!pPage) 953 if (!pPage)
954 return FALSE; 954 return FALSE;
955 *width = pPage->GetPageWidth(); 955 *width = pPage->GetPageWidth();
956 *height = pPage->GetPageHeight(); 956 *height = pPage->GetPageHeight();
957 #else // PDF_ENABLE_XFA 957 #else // PDF_ENABLE_XFA
958 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); 958 CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
959 if (!pDict) 959 if (!pDict)
960 return FALSE; 960 return FALSE;
961 CPDF_Page page; 961
962 page.Load(pDoc, pDict); 962 CPDF_Page page(pDoc, pDict, true);
dsinclair 2016/04/26 14:08:24 This isn't a bug that it doesn't call parseContent
Lei Zhang 2016/04/26 17:25:38 It's not a bug. The ctor sets the page size.
963 *width = page.GetPageWidth(); 963 *width = page.GetPageWidth();
964 *height = page.GetPageHeight(); 964 *height = page.GetPageHeight();
965 #endif // PDF_ENABLE_XFA 965 #endif // PDF_ENABLE_XFA
966 966
967 return TRUE; 967 return TRUE;
968 } 968 }
969 969
970 DLLEXPORT FPDF_BOOL STDCALL 970 DLLEXPORT FPDF_BOOL STDCALL
971 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) { 971 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) {
972 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 972 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 if (!buffer) { 1161 if (!buffer) {
1162 *buflen = len; 1162 *buflen = len;
1163 } else if (*buflen >= len) { 1163 } else if (*buflen >= len) {
1164 memcpy(buffer, utf16Name.c_str(), len); 1164 memcpy(buffer, utf16Name.c_str(), len);
1165 *buflen = len; 1165 *buflen = len;
1166 } else { 1166 } else {
1167 *buflen = -1; 1167 *buflen = -1;
1168 } 1168 }
1169 return (FPDF_DEST)pDestObj; 1169 return (FPDF_DEST)pDestObj;
1170 } 1170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698