diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-21 09:16:37 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-22 09:04:02 +0200 |
commit | 40bb0d6da2a6bdf504b9e1501ab3bc8c25896d05 (patch) | |
tree | 49a08677a6fec631c3abb4cb99510c4b0f834d2f | |
parent | 4a82543b3419339ae554485c582a80c41a57c417 (diff) |
pdfium: replace FPDFPath_GetStrokeWidth() patch with backport
Change-Id: I43b8eb81b720e83eba887600116b01026e018af9
Reviewed-on: https://gerrit.libreoffice.org/56220
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
5 files changed, 65 insertions, 101 deletions
diff --git a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1 b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1 new file mode 100644 index 000000000000..792e3461b446 --- /dev/null +++ b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1 @@ -0,0 +1,62 @@ +From f912b5deb5e0db286d6d203b73c189d67cf7534f Mon Sep 17 00:00:00 2001 +From: Miklos Vajna <vmiklos@collabora.co.uk> +Date: Tue, 22 May 2018 14:27:29 +0000 +Subject: [PATCH] Add FPDFPageObj_GetStrokeWidth() API + +It was already possible to set the stroke width of a page object, this +is the other direction. + +Change-Id: I5c4681b232768fc928bc7a169f223877284d4812 +Reviewed-on: https://pdfium-review.googlesource.com/32770 +Reviewed-by: dsinclair <dsinclair@chromium.org> +Commit-Queue: dsinclair <dsinclair@chromium.org> +--- + fpdfsdk/fpdf_editpage.cpp | 10 ++++++++++ + public/fpdf_edit.h | 10 ++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp +index 1a98f3d7c..83703c3e0 100644 +--- a/fpdfsdk/fpdf_editpage.cpp ++++ b/fpdfsdk/fpdf_editpage.cpp +@@ -593,6 +593,16 @@ FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width) { + return true; + } + ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV ++FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width) { ++ auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object); ++ if (!pPageObj || !width) ++ return false; ++ ++ *width = pPageObj->m_GraphState.GetLineWidth(); ++ return true; ++} ++ + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV + FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join) { + if (!page_object) +diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h +index fa9902ee9..49018df05 100644 +--- a/public/fpdf_edit.h ++++ b/public/fpdf_edit.h +@@ -678,6 +678,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV + FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); + ++// Experimental API. ++// Get the stroke width of a page object. ++// ++// path - the handle to the page object. ++// width - the width of the stroke. ++// ++// Returns TRUE on success ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV ++FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width); ++ + // Set the line join of |page_object|. + // + // page_object - handle to a page object. +-- +2.16.4 + diff --git a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2 b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2 deleted file mode 100644 index ed0e4d4af418..000000000000 --- a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2 +++ /dev/null @@ -1,54 +0,0 @@ -From 42afb017a64ffcc89f670df5f5a0d42a6e710b20 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:30:22 +0200 -Subject: [PATCH 05/14] svx: support Paths in PDFs while importing - ---- - pdfium/fpdfsdk/fpdf_editpath.cpp | 10 ++++++++++ - pdfium/public/fpdf_edit.h | 9 +++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/pdfium/fpdfsdk/fpdf_editpath.cpp b/pdfium/fpdfsdk/fpdf_editpath.cpp -index aca2beb..55f9fce 100644 ---- a/pdfium/fpdfsdk/fpdf_editpath.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpath.cpp -@@ -117,6 +117,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width) { - return true; - } - -+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV -+FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width) { -+ auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path); -+ if (!pPathObj || !width) -+ return false; -+ -+ *width = pPathObj->m_GraphState.GetLineWidth(); -+ return true; -+} -+ - FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetFillColor(FPDF_PAGEOBJECT path, - unsigned int R, - unsigned int G, -diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h -index fa9902e..b44bc71 100644 ---- a/pdfium/public/fpdf_edit.h -+++ b/pdfium/public/fpdf_edit.h -@@ -678,6 +678,15 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); - FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV - FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); - -+// 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_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width); -+ - // Set the line join of |page_object|. - // - // page_object - handle to a page object. --- -2.16.3 - 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 index 6974739862a3..8bf3e920f180 100644 --- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 +++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 @@ -87,51 +87,6 @@ index 29c8b01..a52e1a9 100644 } 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 c73da438821d..f3568dc30aa0 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -18,7 +18,8 @@ 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 pdfium_patches += 0004-svx-support-PDF-text-color.patch.2 -pdfium_patches += 0005-svx-support-Paths-in-PDFs-while-importing.patch.2 +# Backport of <https://pdfium-review.googlesource.com/32770>. +pdfium_patches += 0005-svx-support-Paths-in-PDFs-while-importing.patch.1 pdfium_patches += 0006-svx-improve-path-importing-from-PDF.patch.2 pdfium_patches += 0007-svx-improved-text-importing-from-PDF.patch.2 pdfium_patches += 0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 81909736199a..f5d741bdfd80 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -1113,7 +1113,7 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int /*nPageObjectI aPolyPoly.transform(aTransform); float fWidth = 1; - FPDFPath_GetStrokeWidth(pPageObject, &fWidth); + FPDFPageObj_GetStrokeWidth(pPageObject, &fWidth); const double dWidth = 0.5 * fabs(sqrt2(aPathMatrix.a(), aPathMatrix.c()) * fWidth); mnLineWidth = lcl_ToLogic(lcl_PointToPixel(dWidth)); |