summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfeditimg.cpp
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-10-28 23:03:33 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-03 11:10:11 -0800
commitfdc00a7042d912aafaabddae4d9c84199921ef23 (patch)
tree32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /fpdfsdk/src/fpdfeditimg.cpp
parente9b38fa38de2c95d8260be31c57d9272c4d127ed (diff)
downloadpdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'fpdfsdk/src/fpdfeditimg.cpp')
-rw-r--r--fpdfsdk/src/fpdfeditimg.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp
index c29d2b74f8..188b5f070d 100644
--- a/fpdfsdk/src/fpdfeditimg.cpp
+++ b/fpdfsdk/src/fpdfeditimg.cpp
@@ -6,6 +6,8 @@
#include "../include/fsdk_define.h"
#include "../include/fpdfedit.h"
+#include "../include/fpdfxfa/fpdfxfa_doc.h"
+#include "../include/fpdfxfa/fpdfxfa_page.h"
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document)
@@ -13,14 +15,14 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document)
if (!document)
return NULL;
CPDF_ImageObject* pImageObj = FX_NEW CPDF_ImageObject;
- CPDF_Image* pImg = FX_NEW CPDF_Image((CPDF_Document *)document);
+ CPDF_Image* pImg = FX_NEW CPDF_Image(((CPDFXFA_Document *)document)->GetPDFDoc());
pImageObj->m_pImage = pImg;
return pImageObj;
}
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess)
{
- if (!image_object || !fileAccess)
+ if (!image_object || !fileAccess || !pages)
return FALSE;
IFX_FileRead* pFile = FX_NEW CPDF_CustomAccess(fileAccess);
@@ -29,7 +31,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCou
pImgObj->m_GeneralState.GetModify();
for (int index=0;index<nCount;index++)
{
- CPDF_Page* pPage = (CPDF_Page*)pages[index];
+ CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage();
+ if (!pPage)
+ continue;
pImgObj->m_pImage->ResetCache(pPage,NULL);
}
pImgObj->m_pImage->SetJpegImage(pFile);
@@ -56,7 +60,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix (FPDF_PAGEOBJECT image_object
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object,FPDF_BITMAP bitmap)
{
- if (!image_object || !bitmap)
+ if (!image_object || !bitmap || !pages)
return FALSE;
CFX_DIBitmap* pBmp = NULL;
pBmp = (CFX_DIBitmap*)bitmap;
@@ -64,7 +68,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,F
pImgObj->m_GeneralState.GetModify();
for (int index=0;index<nCount;index++)
{
- CPDF_Page* pPage = (CPDF_Page*)pages[index];
+ CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage();
+ if (!pPage) continue;
pImgObj->m_pImage->ResetCache(pPage,NULL);
}
pImgObj->m_pImage->SetImage(pBmp,FALSE);