diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-05-19 21:28:31 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-07 10:45:31 +0200 |
commit | 92550f9b04785f83ee7229c815e88e847db194dc (patch) | |
tree | 3513e3c10bf13670a434e5e092603f0517a8b57e /external | |
parent | 80ae4c7a2a6ff336e3bb7462d62fe01b5cb514b8 (diff) |
svx: update PDFium patch and code
Change-Id: I07c6a7c65d5631b70da64927a35d7a3b371eff25
Diffstat (limited to 'external')
-rw-r--r-- | external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 | 137 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 138 insertions, 0 deletions
diff --git a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 new file mode 100644 index 000000000000..6974739862a3 --- /dev/null +++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 @@ -0,0 +1,137 @@ +From f701ff3ce04a4e7e757a9f3ee62b4967749455dd Mon Sep 17 00:00:00 2001 +From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> +Date: Tue, 5 Jun 2018 14:27:55 +0200 +Subject: [PATCH 14/14] svx: update PDFium patch and code + +--- + pdfium/fpdfsdk/cpdfsdk_helpers.h | 2 ++ + pdfium/fpdfsdk/fpdf_editimg.cpp | 2 +- + pdfium/fpdfsdk/fpdf_editpage.cpp | 19 ++++++++++++------- + pdfium/public/fpdf_edit.h | 16 ++++++++-------- + 4 files changed, 23 insertions(+), 16 deletions(-) + +diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h +index 477bb74..c907ad8 100644 +--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h ++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h +@@ -40,6 +40,8 @@ class CPDF_TextPage; + class CPDF_TextPageFind; + class IPDFSDK_PauseAdapter; + class FX_PATHPOINT; ++class CPDF_TextObject; ++class CPDF_FormObject; + + #ifdef PDF_ENABLE_XFA + class CPDFXFA_Context; +diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp +index 3f400c7..968b84a 100644 +--- a/pdfium/fpdfsdk/fpdf_editimg.cpp ++++ b/pdfium/fpdfsdk/fpdf_editimg.cpp +@@ -203,7 +203,7 @@ FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) { + RetainPtr<CFX_DIBitmap> pBitmap; + pBitmap = pSource->CloneConvert(FXDIB_Argb); + +- return pBitmap.Leak(); ++ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak()); + } + + FPDF_EXPORT unsigned long FPDF_CALLCONV +diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp +index 29c8b01..a52e1a9 100644 +--- a/pdfium/fpdfsdk/fpdf_editpage.cpp ++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp +@@ -718,7 +718,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, + int ret_count = byte_str_len / sizeof(unsigned short); + + ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator. +- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len); ++ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len); + return ret_count; + } + +@@ -758,7 +758,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object, + int ret_count = byte_str_len / kBytesPerCharacter; + + ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator. +- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len); ++ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len); + return ret_count; + } + +@@ -801,10 +801,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, + return false; + } + +- const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB(); +- *R = FXSYS_GetRValue(RGB); +- *G = FXSYS_GetGValue(RGB); +- *B = FXSYS_GetBValue(RGB); ++ const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor(); ++ if (pColor == nullptr) ++ return false; ++ ++ int r, g, b; ++ pColor->GetRGB(&r, &g, &b); ++ *R = r; ++ *G = g; ++ *B = b; + *A = static_cast<unsigned int>( + (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f); + +@@ -834,7 +839,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index) + const CFX_Matrix& matrix = pFrmObj->form_matrix(); + const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList(); + if (pObjectList) +- return pObjectList->GetPageObjectByIndex(index); ++ return FPDFPageObjectFromCPDFPageObject(pObjectList->GetPageObjectByIndex(index)); + } + + return nullptr; +diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h +index e14b2a5..4351649 100644 +--- a/pdfium/public/fpdf_edit.h ++++ b/pdfium/public/fpdf_edit.h +@@ -660,32 +660,32 @@ FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object, + unsigned int* B, + unsigned int* A); + +-// Set the stroke width of a path. ++// Get the stroke width of a path. + // + // path - the handle to the path object. + // width - the width of the stroke. + // + // Returns TRUE on success + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +-FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); ++FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width); + +-// Set the stroke width of a page object. ++// Set the stroke width of a path. + // +-// path - the handle to the page object. ++// path - the handle to the path object. + // width - the width of the stroke. + // + // Returns TRUE on success + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +-FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); ++FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); + +-// Get the stroke width of a path. ++// Set the stroke width of a page object. + // +-// path - the handle to the path object. ++// path - the handle to the page object. + // width - the width of the stroke. + // + // Returns TRUE on success + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +-FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width); ++FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); + + // Set the line join of |page_object|. + // +-- +2.16.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index 333150d016a0..294a6498898e 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -27,6 +27,7 @@ pdfium_patches += 0010-svx-support-importing-forms-from-PDFs.patch.2 pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2 pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2 pdfium_patches += 0013-svx-cleanup-pdfium-importer.patch.2 +pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) |