diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-15 16:34:32 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-15 16:34:32 -0700 |
commit | 943ea142b6a7e6edc91fe3c307013129e6eb0ef3 (patch) | |
tree | 8de4aaa7bb8eb3d463246d2a2f400006e60bae99 /fpdfsdk/src/fpdfeditimg.cpp | |
parent | b456ba7f62fa416f456ef78750c18fd2bdf837be (diff) | |
download | pdfium-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/fpdfeditimg.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfeditimg.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp index 0c8ea1627a..73fc251195 100644 --- a/fpdfsdk/src/fpdfeditimg.cpp +++ b/fpdfsdk/src/fpdfeditimg.cpp @@ -30,7 +30,9 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; pImgObj->m_GeneralState.GetModify(); for (int index = 0; index < nCount; index++) { - CPDF_Page* pPage = (CPDF_Page*)pages[index]; + CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); + if (!pPage) + continue; pImgObj->m_pImage->ResetCache(pPage, NULL); } pImgObj->m_pImage->SetJpegImage(pFile); @@ -69,7 +71,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; pImgObj->m_GeneralState.GetModify(); for (int index = 0; index < nCount; index++) { - CPDF_Page* pPage = (CPDF_Page*)pages[index]; + CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); + if (!pPage) + continue; pImgObj->m_pImage->ResetCache(pPage, NULL); } pImgObj->m_pImage->SetImage(pBmp, FALSE); |