diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-04-09 22:16:05 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-01 08:59:15 +0200 |
commit | 8a97819f1109e72e55883106464c7f06045b08cf (patch) | |
tree | dcb17fab6cfa3a99fb47672e37af6a6a260e1cb4 /external | |
parent | svx: refactor PDF text importing (diff) | |
download | core-8a97819f1109e72e55883106464c7f06045b08cf.tar.gz core-8a97819f1109e72e55883106464c7f06045b08cf.zip |
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')
-rw-r--r-- | external/pdfium/edit.patch.1 | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/external/pdfium/edit.patch.1 b/external/pdfium/edit.patch.1 index b7cd86e5ff2d..da72f96f46fc 100644 --- a/external/pdfium/edit.patch.1 +++ b/external/pdfium/edit.patch.1 @@ -34,6 +34,37 @@ index 0a01ae0..fad2920 100644 if (bPattern) { DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke); +diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp +index 0d7ba56..37bdf99 100644 +--- a/fpdfsdk/fpdfeditimg.cpp ++++ b/fpdfsdk/fpdfeditimg.cpp +@@ -167,6 +167,26 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) { + return 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/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index ca2cf3f..ac36788 100644 --- a/fpdfsdk/fpdfeditpage.cpp @@ -283,3 +314,17 @@ index 043dc16..fe3b971 100644 // Function: FPDFLink_LoadWebLinks // Prepare information about weblinks in a page. // Parameters: +diff --git a/public/fpdfview.h b/public/fpdfview.h +index 35e87ae..80ab0ad 100644 +--- a/public/fpdfview.h ++++ b/public/fpdfview.h +@@ -908,6 +908,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: |