diff options
Diffstat (limited to 'fpdfsdk/fpdfeditimg.cpp')
-rw-r--r-- | fpdfsdk/fpdfeditimg.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index ad5605011c..69151d1999 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -13,22 +13,13 @@ #include "fpdfsdk/fsdk_define.h" #include "third_party/base/ptr_util.h" -DLLEXPORT FPDF_PAGEOBJECT STDCALL -FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) { - CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); - if (!pDoc) - return nullptr; +namespace { - CPDF_ImageObject* pImageObj = new CPDF_ImageObject; - pImageObj->SetOwnedImage(pdfium::MakeUnique<CPDF_Image>(pDoc)); - return pImageObj; -} - -FPDF_BOOL FPDFImageObj_LoadJpegHelper(FPDF_PAGE* pages, - int nCount, - FPDF_PAGEOBJECT image_object, - FPDF_FILEACCESS* fileAccess, - bool inlineJpeg) { +bool LoadJpegHelper(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_FILEACCESS* fileAccess, + bool inlineJpeg) { if (!image_object || !fileAccess || !pages) return false; @@ -49,13 +40,30 @@ FPDF_BOOL FPDFImageObj_LoadJpegHelper(FPDF_PAGE* pages, return true; } +} // namespace + +DLLEXPORT FPDF_PAGEOBJECT STDCALL +FPDFPageObj_NewImageObj(FPDF_DOCUMENT document) { + CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); + if (!pDoc) + return nullptr; + + CPDF_ImageObject* pImageObj = new CPDF_ImageObject; + pImageObj->SetOwnedImage(pdfium::MakeUnique<CPDF_Image>(pDoc)); + return pImageObj; +} + +DLLEXPORT FPDF_PAGEOBJECT STDCALL +FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) { + return FPDFPageObj_NewImageObj(document); +} + DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount, FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess) { - return FPDFImageObj_LoadJpegHelper(pages, nCount, image_object, fileAccess, - false); + return LoadJpegHelper(pages, nCount, image_object, fileAccess, false); } DLLEXPORT FPDF_BOOL STDCALL @@ -63,8 +71,7 @@ FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, int nCount, FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess) { - return FPDFImageObj_LoadJpegHelper(pages, nCount, image_object, fileAccess, - true); + return LoadJpegHelper(pages, nCount, image_object, fileAccess, true); } DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, |