diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-04-13 18:59:56 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-07 10:45:24 +0200 |
commit | 2f72dcaae544f5a8103120264086919c55936ba8 (patch) | |
tree | 78b93c313c10fb4d528a36b8a5d376917688a903 /external/pdfium | |
parent | svx: support Paths in PDFs while importing (diff) | |
download | core-2f72dcaae544f5a8103120264086919c55936ba8.tar.gz core-2f72dcaae544f5a8103120264086919c55936ba8.zip |
svx: improve path importing from PDF
Change-Id: I8e63b2a35d841e065ef32fea95c0a5f22ca6f049
(cherry picked from commit 819d11b7ae198a6a8e864852a3654ddbed389ecb)
Diffstat (limited to 'external/pdfium')
-rw-r--r-- | external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 | 115 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 116 insertions, 0 deletions
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 new file mode 100644 index 000000000000..bab68ec594ca --- /dev/null +++ b/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2 @@ -0,0 +1,115 @@ +From 51fc36477e4d955470fd407f43151b9727fd8b02 Mon Sep 17 00:00:00 2001 +From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> +Date: Tue, 5 Jun 2018 11:31:05 +0200 +Subject: [PATCH 06/14] svx: improve path importing from PDF + +--- + pdfium/fpdfsdk/fpdf_editpath.cpp | 43 ++++++++++++++++++++++++++++++++++++++++ + pdfium/public/fpdf_edit.h | 30 ++++++++++++++++++++++++++++ + 2 files changed, 73 insertions(+) + +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, + pPathObj->SetDirty(true); + } + ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV ++FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object, ++ double* a, ++ double* b, ++ double* c, ++ double* d, ++ double* e, ++ double* f) ++{ ++ if (!path_object || !a || !b || !c || !d || !e || !f) ++ return false; ++ ++ auto* pPathObj = CPDFPageObjectFromFPDFPageObject(path_object); ++ CFX_Matrix* pMatrix = pPathObj->m_GeneralState.GetMutableMatrix(); ++ *a = pMatrix->a; ++ *b = pMatrix->b; ++ *c = pMatrix->c; ++ *d = pMatrix->d; ++ *e = pMatrix->e; ++ *f = pMatrix->f; ++ ++ return true; ++} ++ + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV + FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y) { + auto* pPathPoint = FXPathPointFromFPDFPathSegment(segment); +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); + ++// 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 ++// a - Pointer to a double value receiving coefficient "a" of the matrix. ++// b - Pointer to a double value receiving coefficient "b" of the matrix. ++// c - Pointer to a double value receiving coefficient "c" of the matrix. ++// d - Pointer to a double value receiving coefficient "d" of the matrix. ++// e - Pointer to a double value receiving coefficient "e" of the matrix. ++// f - Pointer to a double value receiving coefficient "f" of the matrix. ++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV ++FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object, ++ double* a, ++ double* b, ++ double* c, ++ double* d, ++ double* e, ++ double* f); ++ + // Create a new text object using one of the standard PDF fonts. + // + // document - handle to the document. +-- +2.16.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index b10194ef3b14..af7841dcd120 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -19,6 +19,7 @@ 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 +pdfium_patches += 0006-svx-improve-path-importing-from-PDF.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) |