summaryrefslogtreecommitdiff
path: root/external/pdfium
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-04-09 22:16:05 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-07 10:45:22 +0200
commit3b292a6df013135a9485619acdea15062b4002e7 (patch)
tree46456014cd01c263cac5c1aab82499b42a7cee65 /external/pdfium
parentddbecd021e1a9722362f401084acad2bdc6a0da1 (diff)
svx: import PDF images as BGRA
This makes it trivial to support all sort of odd bit-format and 8-bit paletted images. Change-Id: I4555794eccd0ee2906f9a39bd93957ad3775432c
Diffstat (limited to 'external/pdfium')
-rw-r--r--external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.258
-rw-r--r--external/pdfium/UnpackedTarball_pdfium.mk1
2 files changed, 59 insertions, 0 deletions
diff --git a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
new file mode 100644
index 000000000000..21c3d007fb3d
--- /dev/null
+++ b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
@@ -0,0 +1,58 @@
+From faeac63865eeb791501d7535f1e7a7c7fc807b04 Mon Sep 17 00:00:00 2001
+From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
+Date: Tue, 5 Jun 2018 11:29:15 +0200
+Subject: [PATCH 03/14] svx: import PDF images as BGRA
+
+---
+ pdfium/fpdfsdk/fpdf_editimg.cpp | 20 ++++++++++++++++++++
+ pdfium/public/fpdfview.h | 3 +++
+ 2 files changed, 23 insertions(+)
+
+diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
+index fed1581..3f400c7 100644
+--- a/pdfium/fpdfsdk/fpdf_editimg.cpp
++++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
+@@ -186,6 +186,26 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) {
+ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
+ }
+
++FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
++FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
++ CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
++ if (!pObj || !pObj->IsImage())
++ return nullptr;
++
++ RetainPtr<CPDF_Image> pImg = pObj->AsImage()->GetImage();
++ if (!pImg)
++ return nullptr;
++
++ RetainPtr<CFX_DIBSource> pSource = pImg->LoadDIBSource();
++ if (!pSource)
++ return nullptr;
++
++ RetainPtr<CFX_DIBitmap> pBitmap;
++ pBitmap = pSource->CloneConvert(FXDIB_Argb);
++
++ return pBitmap.Leak();
++}
++
+ FPDF_EXPORT unsigned long FPDF_CALLCONV
+ FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+diff --git a/pdfium/public/fpdfview.h b/pdfium/public/fpdfview.h
+index 0ccd140..b451b9c 100644
+--- a/pdfium/public/fpdfview.h
++++ b/pdfium/public/fpdfview.h
+@@ -905,6 +905,9 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
+ // function; see the list of such formats above.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
+
++FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
++FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object);
++
+ // Function: FPDFBitmap_FillRect
+ // Fill a rectangle in a bitmap.
+ // Parameters:
+--
+2.16.3
+
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 22e762695300..7da652c4532c 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -16,6 +16,7 @@ pdfium_patches += build.patch.1
# Adds missing editing API
pdfium_patches += 0001-svx-import-PDF-text-using-PDFium.patch.2
pdfium_patches += 0002-svx-more-accurate-PDF-text-importing.patch.2
+pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
$(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))