[Libreoffice-commits] core.git: external/pdfium

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 5 07:06:02 UTC 2018


 external/pdfium/0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1   |  143 ++++++++++
 external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2                  |   77 -----
 external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 |   27 -
 external/pdfium/UnpackedTarball_pdfium.mk                                         |    3 
 4 files changed, 145 insertions(+), 105 deletions(-)

New commits:
commit 2f324e5305ea8d2fb309804cda2195a8e7351133
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 4 22:47:08 2018 +0200

    pdfium: replace FPDFPath_GetMatrix() patch with backport
    
    Change-Id: Ibf358e42f6411777819d0f46a4fe93c9b5ed9594
    Reviewed-on: https://gerrit.libreoffice.org/56975
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/external/pdfium/0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1 b/external/pdfium/0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1
new file mode 100644
index 000000000000..655d040f6888
--- /dev/null
+++ b/external/pdfium/0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1
@@ -0,0 +1,143 @@
+From 97f4d67fbf0707feea298afa2f6471013185e066 Mon Sep 17 00:00:00 2001
+Date: Mon, 4 Jun 2018 14:47:17 +0000
+Subject: [PATCH] Add FPDFPath_GetMatrix() and FPDFPath_SetMatrix() APIs
+
+This is similar to the existing FPDFImageObj_SetMatrix(), but this
+exposes the matrix of CPDF_PathObject and provides both a getter and a
+setter.
+
+Change-Id: Ib90a64929dae1b2be3889eca57e4af822d7823be
+Reviewed-on: https://pdfium-review.googlesource.com/33670
+Reviewed-by: dsinclair <dsinclair at chromium.org>
+Commit-Queue: dsinclair <dsinclair at chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 30 +++++++++++++++++++++++
+ fpdfsdk/fpdf_editpath.cpp          | 49 +++++++++++++++++++++++++++++++++++++
+ fpdfsdk/fpdf_view_c_api_test.c     |  2 ++
+ public/fpdf_edit.h                 | 50 ++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 131 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp
+index 558a8e3de..368c37416 100644
+--- a/fpdfsdk/fpdf_editpath.cpp
++++ b/fpdfsdk/fpdf_editpath.cpp
+@@ -253,6 +253,55 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
+   return true;
+ }
+ 
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path,
++                                                       double* a,
++                                                       double* b,
++                                                       double* c,
++                                                       double* d,
++                                                       double* e,
++                                                       double* f) {
++  if (!path || !a || !b || !c || !d || !e || !f)
++    return false;
++
++  CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
++  if (!pPathObj)
++    return false;
++
++  *a = pPathObj->m_Matrix.a;
++  *b = pPathObj->m_Matrix.b;
++  *c = pPathObj->m_Matrix.c;
++  *d = pPathObj->m_Matrix.d;
++  *e = pPathObj->m_Matrix.e;
++  *f = pPathObj->m_Matrix.f;
++
++  return true;
++}
++
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path,
++                                                       double a,
++                                                       double b,
++                                                       double c,
++                                                       double d,
++                                                       double e,
++                                                       double f) {
++  if (!path)
++    return false;
++
++  CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
++  if (!pPathObj)
++    return false;
++
++  pPathObj->m_Matrix.a = a;
++  pPathObj->m_Matrix.b = b;
++  pPathObj->m_Matrix.c = c;
++  pPathObj->m_Matrix.d = d;
++  pPathObj->m_Matrix.e = e;
++  pPathObj->m_Matrix.f = f;
++  pPathObj->SetDirty(true);
++
++  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 2faa9ecba..4c870149b 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -920,6 +920,56 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
+                                                          int* fillmode,
+                                                          FPDF_BOOL* stroke);
+ 
++// Experimental API.
++// Get the transform matrix of a path.
++//
++//   path - handle to a path.
++//   a    - matrix value.
++//   b    - matrix value.
++//   c    - matrix value.
++//   d    - matrix value.
++//   e    - matrix value.
++//   f    - matrix value.
++//
++// The matrix is composed as:
++//   |a c e|
++//   |b d f|
++// and used to scale, rotate, shear and translate the path.
++//
++// Returns TRUE on success.
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path,
++                                                       double* a,
++                                                       double* b,
++                                                       double* c,
++                                                       double* d,
++                                                       double* e,
++                                                       double* f);
++
++// Experimental API.
++// Set the transform matrix of a path.
++//
++//   path - handle to a path.
++//   a    - matrix value.
++//   b    - matrix value.
++//   c    - matrix value.
++//   d    - matrix value.
++//   e    - matrix value.
++//   f    - matrix value.
++//
++// The matrix is composed as:
++//   |a c e|
++//   |b d f|
++// and can be used to scale, rotate, shear and translate the path.
++//
++// Returns TRUE on success.
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path,
++                                                       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.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
deleted file mode 100644
index 3dba5e2c2caf..000000000000
--- a/external/pdfium/0006-svx-improve-path-importing-from-PDF.patch.2
+++ /dev/null
@@ -1,77 +0,0 @@
-From 51fc36477e4d955470fd407f43151b9727fd8b02 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at 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
-@@ -285,6 +285,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
-@@ -920,6 +920,24 @@ 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/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 b/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
index 946a21cb42a4..d85b33177f06 100644
--- a/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
+++ b/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
@@ -71,33 +71,6 @@ index ac1ff42..a483edf 100644
    for (auto& point : m_Points)
      point.m_Point = pMatrix->Transform(point.m_Point);
  }
-diff --git a/pdfium/fpdfsdk/fpdf_editpath.cpp b/pdfium/fpdfsdk/fpdf_editpath.cpp
-index f41db64..017dbcd 100644
---- a/pdfium/fpdfsdk/fpdf_editpath.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpath.cpp
-@@ -308,14 +308,14 @@ FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object,
-   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;
-+  CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path_object);
-+  const CFX_Matrix& pMatrix = pPathObj->m_Matrix;
-+  *a = pMatrix.a;
-+  *b = pMatrix.b;
-+  *c = pMatrix.c;
-+  *d = pMatrix.d;
-+  *e = pMatrix.e;
-+  *f = pMatrix.f;
- 
-   return true;
- }
 -- 
 2.16.3
 
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index c9ee200112c2..aa197395312b 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -22,7 +22,8 @@ pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
 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
+# Backport of <https://pdfium-review.googlesource.com/33670>.
+pdfium_patches += 0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1
 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
 pdfium_patches += 0009-svx-support-color-text-for-imported-PDFs.patch.2


More information about the Libreoffice-commits mailing list