summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorrbpotter <rbpotter@chromium.org>2016-12-14 11:44:31 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 11:44:31 -0800
commitf085db37c21ad2bd66e349f9307fc89b426217f5 (patch)
tree1743d925a4b6aae683e31b4e58f793166c13c8d1 /fpdfsdk
parent0d73909e89a5c93917b9cb73fe5c03c484f2793d (diff)
downloadpdfium-f085db37c21ad2bd66e349f9307fc89b426217f5.tar.xz
Add inline JPEGs.
Allows JPEG data to be copied into the file rather than left in a separate file. This is needed to allow rasterized PDFs to avoid saving image files for each page. See Chromium issue 2524143003 for chromium changes. BUG=534945, 550205, 480628 Review-Url: https://codereview.chromium.org/2529543003
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfeditimg.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 531a9abc8c..56875e233e 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -24,11 +24,11 @@ FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
return pImageObj;
}
-DLLEXPORT FPDF_BOOL STDCALL
-FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
- int nCount,
- FPDF_PAGEOBJECT image_object,
- FPDF_FILEACCESS* fileAccess) {
+FPDF_BOOL FPDFImageObj_LoadJpegHelper(FPDF_PAGE* pages,
+ int nCount,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_FILEACCESS* fileAccess,
+ bool inlineJpeg) {
if (!image_object || !fileAccess || !pages)
return false;
@@ -40,11 +40,33 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
if (pPage)
pImgObj->GetImage()->ResetCache(pPage, nullptr);
}
- pImgObj->GetImage()->SetJpegImage(pFile);
+
+ if (inlineJpeg)
+ pImgObj->GetImage()->SetJpegImageInline(pFile);
+ else
+ pImgObj->GetImage()->SetJpegImage(pFile);
return true;
}
+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);
+}
+
+DLLEXPORT FPDF_BOOL STDCALL
+FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages,
+ int nCount,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_FILEACCESS* fileAccess) {
+ return FPDFImageObj_LoadJpegHelper(pages, nCount, image_object, fileAccess,
+ true);
+}
+
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
double a,
double b,