summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_progressive.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-15 16:34:32 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-15 16:34:32 -0700
commit943ea142b6a7e6edc91fe3c307013129e6eb0ef3 (patch)
tree8de4aaa7bb8eb3d463246d2a2f400006e60bae99 /fpdfsdk/src/fpdf_progressive.cpp
parentb456ba7f62fa416f456ef78750c18fd2bdf837be (diff)
downloadpdfium-943ea142b6a7e6edc91fe3c307013129e6eb0ef3.tar.xz
Introduce CPDFPageFromFPFDPage()
Abstracts the way that pages are passed to the embedder between XFA and master. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1406543004 .
Diffstat (limited to 'fpdfsdk/src/fpdf_progressive.cpp')
-rw-r--r--fpdfsdk/src/fpdf_progressive.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/fpdfsdk/src/fpdf_progressive.cpp b/fpdfsdk/src/fpdf_progressive.cpp
index aaa55a18f6..b13eb553cc 100644
--- a/fpdfsdk/src/fpdf_progressive.cpp
+++ b/fpdfsdk/src/fpdf_progressive.cpp
@@ -18,16 +18,13 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
int rotate,
int flags,
IFSDK_PAUSE* pause) {
- if (bitmap == NULL || page == NULL)
+ if (!bitmap || !pause || pause->version != 1)
return FPDF_RENDER_FAILED;
- if (!pause)
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
return FPDF_RENDER_FAILED;
- if (pause->version != 1)
- return FPDF_RENDER_FAILED;
-
- CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifdef _SKIA_SUPPORT_
@@ -59,16 +56,13 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
IFSDK_PAUSE* pause) {
- if (page == NULL)
- return FPDF_RENDER_FAILED;
-
- if (!pause)
+ if (!pause || pause->version != 1)
return FPDF_RENDER_FAILED;
- if (pause->version != 1)
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
return FPDF_RENDER_FAILED;
- CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1);
if (pContext && pContext->m_pRenderer) {
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
@@ -80,10 +74,10 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
}
DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) {
- if (!page)
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
return;
- CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1);
if (!pContext)
return;