summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-04-26 11:46:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-26 11:46:02 -0700
commit5cc24654fb345189140acb4711ff981e1c720951 (patch)
tree1e9e11a9136363e2b330ffbbce6fdf9e3827b5b1 /fpdfsdk
parent76c53794b6202ec37f6dcace5f2ae86870e953b6 (diff)
downloadpdfium-5cc24654fb345189140acb4711ff981e1c720951.tar.xz
Clean up CPDF_Page.
- Merge CPDF_Page::Load() into ctor. - Remove always nullptr param for CPDF_Page::ParseContent(). - Remove unneeded indirection in IPDF_RenderModule. - Delete CPDF_ParseOptions. - Fix up CPDF_Pattern. Review URL: https://codereview.chromium.org/1918113002
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp5
-rw-r--r--fpdfsdk/fpdfeditpage.cpp5
-rw-r--r--fpdfsdk/fpdfview.cpp12
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_page.cpp10
-rw-r--r--fpdfsdk/javascript/Document.cpp10
5 files changed, 18 insertions, 24 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index e445d9abfa..fe81246a0b 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -45,9 +45,8 @@ FX_BOOL IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) {
void GetContentsRect(CPDF_Document* pDoc,
CPDF_Dictionary* pDict,
CPDF_RectArray* pRectArray) {
- std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page);
- pPDFPage->Load(pDoc, pDict, FALSE);
- pPDFPage->ParseContent(nullptr);
+ std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false));
+ pPDFPage->ParseContent();
for (auto& pPageObject : *pPDFPage->GetPageObjectList()) {
if (!pPageObject)
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index acd259cc6b..c4273fe64f 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -100,9 +100,8 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
new CPDFXFA_Page((CPDFXFA_Document*)document, page_index);
pPage->LoadPDFPage(pPageDict);
#else // PDF_ENABLE_XFA
- CPDF_Page* pPage = new CPDF_Page;
- pPage->Load(pDoc, pPageDict);
- pPage->ParseContent(nullptr);
+ CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true);
+ pPage->ParseContent();
#endif // PDF_ENABLE_XFA
return pPage;
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index dec1059e1a..2283e941a9 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -502,10 +502,10 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
#else // PDF_ENABLE_XFA
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (!pDict)
- return NULL;
- CPDF_Page* pPage = new CPDF_Page;
- pPage->Load(pDoc, pDict);
- pPage->ParseContent(nullptr);
+ return nullptr;
+
+ CPDF_Page* pPage = new CPDF_Page(pDoc, pDict, true);
+ pPage->ParseContent();
return pPage;
#endif // PDF_ENABLE_XFA
}
@@ -958,8 +958,8 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (!pDict)
return FALSE;
- CPDF_Page page;
- page.Load(pDoc, pDict);
+
+ CPDF_Page page(pDoc, pDict, true);
*width = page.GetPageWidth();
*height = page.GetPageHeight();
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
index 8c0d6bbf98..22c8f995f2 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
@@ -46,9 +46,8 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage() {
return FALSE;
if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) {
- m_pPDFPage.reset(new CPDF_Page);
- m_pPDFPage->Load(pPDFDoc, pDict);
- m_pPDFPage->ParseContent(nullptr);
+ m_pPDFPage.reset(new CPDF_Page(pPDFDoc, pDict, true));
+ m_pPDFPage->ParseContent();
}
return TRUE;
}
@@ -95,9 +94,8 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
if (!m_pDocument || m_iPageIndex < 0 || !pageDict)
return FALSE;
- m_pPDFPage.reset(new CPDF_Page());
- m_pPDFPage->Load(m_pDocument->GetPDFDoc(), pageDict);
- m_pPDFPage->ParseContent(nullptr);
+ m_pPDFPage.reset(new CPDF_Page(m_pDocument->GetPDFDoc(), pageDict, true));
+ m_pPDFPage->ParseContent();
return TRUE;
}
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index fa2f7ae4e4..12d8c2df31 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -1348,9 +1348,8 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
if (!pPageDict)
return FALSE;
- CPDF_Page page;
- page.Load(pDocument, pPageDict);
- page.ParseContent(nullptr);
+ CPDF_Page page(pDocument, pPageDict, true);
+ page.ParseContent();
int nWords = 0;
CFX_WideString swRet;
@@ -1404,9 +1403,8 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
if (!pPageDict)
return FALSE;
- CPDF_Page page;
- page.Load(pDocument, pPageDict);
- page.ParseContent(nullptr);
+ CPDF_Page page(pDocument, pPageDict, true);
+ page.ParseContent();
int nWords = 0;
for (auto& pPageObj : *page.GetPageObjectList()) {