diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-27 21:38:21 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-28 09:07:12 +0200 |
commit | 64acf709a616c45d20c9cb5b1bcce0da34593661 (patch) | |
tree | 1c3a614bec70ce4b25a42145db2d922695e55420 /external | |
parent | a30e805bf782207a91a22519180801c21561253d (diff) |
pdfium: replace FPDFPath_GetDrawMode() patch with backport
Change-Id: I86c7c0f73a21f670676716d7c22f519ed82da145
Reviewed-on: https://gerrit.libreoffice.org/56544
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'external')
-rw-r--r-- | external/pdfium/0006-Add-FPDFPath_GetDrawMode-API.patch.1 | 94 | ||||
-rw-r--r-- | external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 | 46 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 2 |
3 files changed, 100 insertions, 42 deletions
diff --git a/external/pdfium/0006-Add-FPDFPath_GetDrawMode-API.patch.1 b/external/pdfium/0006-Add-FPDFPath_GetDrawMode-API.patch.1 new file mode 100644 index 000000000000..b9c9326c5f07 --- /dev/null +++ b/external/pdfium/0006-Add-FPDFPath_GetDrawMode-API.patch.1 @@ -0,0 +1,94 @@ +From 3285732ee73e97feb3fed4da6abc41b1c705ed30 Mon Sep 17 00:00:00 2001 +Date: Wed, 30 May 2018 13:30:10 +0000 +Subject: [PATCH] Add FPDFPath_GetDrawMode() API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It was already possible to set the draw mode of a path object, this is +the other direction. + +Change-Id: Id0ee98dd8dfe433edd0e4715fc009ad4d1625981 +Reviewed-on: https://pdfium-review.googlesource.com/33010 +Reviewed-by: dsinclair <dsinclair@chromium.org> +Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> +Commit-Queue: dsinclair <dsinclair@chromium.org> +--- + fpdfsdk/fpdf_edit_embeddertest.cpp | 7 +++++++ + fpdfsdk/fpdf_editpath.cpp | 18 ++++++++++++++++++ + public/fpdf_edit.h | 16 ++++++++++++++-- + 3 files changed, 39 insertions(+), 2 deletions(-) + +diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp +index aca2bebf8..558a8e3de 100644 +--- a/fpdfsdk/fpdf_editpath.cpp ++++ b/fpdfsdk/fpdf_editpath.cpp +@@ -235,6 +235,24 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, + return true; + } + ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, ++ int* fillmode, ++ FPDF_BOOL* stroke) { ++ auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path); ++ if (!pPathObj || !fillmode || !stroke) ++ return false; ++ ++ if (pPathObj->m_FillType == FXFILL_ALTERNATE) ++ *fillmode = FPDF_FILLMODE_ALTERNATE; ++ else if (pPathObj->m_FillType == FXFILL_WINDING) ++ *fillmode = FPDF_FILLMODE_WINDING; ++ else ++ *fillmode = FPDF_FILLMODE_NONE; ++ ++ *stroke = pPathObj->m_bStroke; ++ return true; ++} ++ + FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineJoin(FPDF_PAGEOBJECT path, + int line_join) { + if (!path) +diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h +index 49018df05..2faa9ecba 100644 +--- a/public/fpdf_edit.h ++++ b/public/fpdf_edit.h +@@ -48,6 +48,7 @@ + #define FPDF_SEGMENT_BEZIERTO 1 + #define FPDF_SEGMENT_MOVETO 2 + ++#define FPDF_FILLMODE_NONE 0 + #define FPDF_FILLMODE_ALTERNATE 1 + #define FPDF_FILLMODE_WINDING 2 + +@@ -899,8 +900,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_Close(FPDF_PAGEOBJECT path); + // Set the drawing mode of a path. + // + // path - the handle to the path object. +-// fillmode - the filling mode to be set: 0 for no fill, 1 for alternate, 2 for +-// winding. ++// fillmode - the filling mode to be set: one of the FPDF_FILLMODE_* flags. + // stroke - a boolean specifying if the path should be stroked or not. + // + // Returns TRUE on success +@@ -908,6 +908,18 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, + int fillmode, + FPDF_BOOL stroke); + ++// Experimental API. ++// Get the drawing mode of a path. ++// ++// path - the handle to the path object. ++// fillmode - the filling mode of the path: one of the FPDF_FILLMODE_* flags. ++// stroke - a boolean specifying if the path is stroked or not. ++// ++// Returns TRUE on success ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, ++ int* fillmode, ++ FPDF_BOOL* stroke); ++ + // Create a new text object using one of the standard PDF fonts. + // + // document - handle to the document. +-- +2.16.4 + diff --git a/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 b/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 index bab68ec594ca..3dba5e2c2caf 100644 --- a/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 +++ b/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 @@ -12,33 +12,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpath.cpp b/pdfium/fpdfsdk/fpdf_editpath.cpp index 55f9fce..f41db64 100644 --- a/pdfium/fpdfsdk/fpdf_editpath.cpp +++ b/pdfium/fpdfsdk/fpdf_editpath.cpp -@@ -245,6 +245,25 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, - return true; - } - -+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, -+ int* fillmode, -+ FPDF_BOOL* stroke) -+{ -+ auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path); -+ if (!pPathObj || !fillmode || !stroke) -+ return false; -+ -+ if (pPathObj->m_FillType == FXFILL_ALTERNATE) -+ *fillmode = FPDF_FILLMODE_ALTERNATE; -+ else if (pPathObj->m_FillType == FXFILL_WINDING) -+ *fillmode = FPDF_FILLMODE_WINDING; -+ else -+ *fillmode = 0; // no fill -+ -+ *stroke = pPathObj->m_bStroke; -+ return true; -+} -+ - FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineJoin(FPDF_PAGEOBJECT path, - int line_join) { - if (!path) -@@ -277,6 +296,30 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineCap(FPDF_PAGEOBJECT path, +@@ -285,6 +285,30 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineCap(FPDF_PAGEOBJECT path, pPathObj->SetDirty(true); } @@ -73,22 +47,10 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h index b44bc71..89ec8cf 100644 --- a/pdfium/public/fpdf_edit.h +++ b/pdfium/public/fpdf_edit.h -@@ -907,6 +907,36 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, - int fillmode, - FPDF_BOOL stroke); +@@ -920,6 +920,24 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, + int* fillmode, + FPDF_BOOL* stroke); -+// Get the drawing mode of a path. -+// -+// path - the handle to the path object. -+// fillmode - the filling mode to be set: 0 for no fill, 1 for alternate, 2 for -+// winding. -+// stroke - a boolean specifying if the path should be stroked or not. -+// -+// Returns TRUE on success -+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, -+ int* fillmode, -+ FPDF_BOOL* stroke); -+ +// Get the matrix of a particular text object. +// +// path_object - Handle of path object returned by FPDFPath_NewPathObj diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index f3568dc30aa0..c9ee200112c2 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -20,6 +20,8 @@ pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2 pdfium_patches += 0004-svx-support-PDF-text-color.patch.2 # Backport of <https://pdfium-review.googlesource.com/32770>. pdfium_patches += 0005-svx-support-Paths-in-PDFs-while-importing.patch.1 +# Backport of <https://pdfium-review.googlesource.com/33010>. +pdfium_patches += 0006-Add-FPDFPath_GetDrawMode-API.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 |