Kaydet (Commit) 40bb0d6d authored tarafından Miklos Vajna's avatar Miklos Vajna

pdfium: replace FPDFPath_GetStrokeWidth() patch with backport

Change-Id: I43b8eb81b720e83eba887600116b01026e018af9
Reviewed-on: https://gerrit.libreoffice.org/56220
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 4a82543b
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
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
......@@ -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
......@@ -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
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment