[Libreoffice-commits] core.git: 2 commits - bin/find-unneeded-includes external/pdfium

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 07:07:08 UTC 2018


 bin/find-unneeded-includes                                                 |   16 +
 external/pdfium/0001-Add-FPDFFormObj_GetMatrix-API.patch.1                 |   96 ++++++++++
 external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2                 |    2 
 external/pdfium/0004-svx-support-PDF-text-color.patch.2                    |   46 ----
 external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 |   91 ---------
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2              |   41 ----
 external/pdfium/UnpackedTarball_pdfium.mk                                  |    5 
 7 files changed, 115 insertions(+), 182 deletions(-)

New commits:
commit 1b267db43b35cc0dcd6d50712efe52ed32fa6e7b
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Sep 11 21:41:19 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Sep 12 09:06:57 2018 +0200

    pdfium: replace FPDFFormObj_GetMatrix patch with backport
    
    Change-Id: Ic819fb1097986437cae99f4769bd93f20b6db44a
    Reviewed-on: https://gerrit.libreoffice.org/60358
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/external/pdfium/0001-Add-FPDFFormObj_GetMatrix-API.patch.1 b/external/pdfium/0001-Add-FPDFFormObj_GetMatrix-API.patch.1
new file mode 100644
index 000000000000..a7661b9e507b
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFFormObj_GetMatrix-API.patch.1
@@ -0,0 +1,96 @@
+From 46b437333e53295869afde696ed31043c1f6c717 Mon Sep 17 00:00:00 2001
+Date: Tue, 14 Aug 2018 19:15:43 +0000
+Subject: [PATCH] Add FPDFFormObj_GetMatrix() API
+
+This is similar to FPDFText_GetMatrix() (wrapping
+CPDF_TextObject::GetTextMatrix()) and FPDFPath_GetMatrix() (wrapping
+CPDF_PathObject::m_Matrix), but wraps the matrix of form objects:
+CPDF_FormObject::form_matrix().
+
+Change-Id: Ic4ce7ad8050012f54de356bb936263d3e4f097ca
+Reviewed-on: https://pdfium-review.googlesource.com/39930
+Commit-Queue: Lei Zhang <thestig at chromium.org>
+Reviewed-by: Lei Zhang <thestig at chromium.org>
+Reviewed-by: Henrique Nakashima <hnakashima at chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 34 ++++++++++++++++++++++++++++++++++
+ fpdfsdk/fpdf_editpage.cpp          | 27 +++++++++++++++++++++++++++
+ fpdfsdk/fpdf_view_c_api_test.c     |  1 +
+ public/fpdf_edit.h                 | 26 ++++++++++++++++++++++++++
+ 4 files changed, 88 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
+index 438a0624f..0ff7a119a 100644
+--- a/fpdfsdk/fpdf_editpage.cpp
++++ b/fpdfsdk/fpdf_editpage.cpp
+@@ -842,3 +842,30 @@ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index) {
+   return FPDFPageObjectFromCPDFPageObject(
+       pObjectList->GetPageObjectByIndex(index));
+ }
++
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
++                      double* a,
++                      double* b,
++                      double* c,
++                      double* d,
++                      double* e,
++                      double* f) {
++  if (!form_object || !a || !b || !c || !d || !e || !f)
++    return false;
++
++  auto* pPageObj = CPDFPageObjectFromFPDFPageObject(form_object);
++  CPDF_FormObject* pFormObj = pPageObj->AsForm();
++  if (!pFormObj)
++    return false;
++
++  const CFX_Matrix& matrix = pFormObj->form_matrix();
++  *a = matrix.a;
++  *b = matrix.b;
++  *c = matrix.c;
++  *d = matrix.d;
++  *e = matrix.e;
++  *f = matrix.f;
++
++  return true;
++}
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index 83fedba90..577ae7fac 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -1313,6 +1313,32 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
+ 
++// Experimental API.
++// Get the transform matrix of a form object.
++//
++//   form_object - handle to a form.
++//   a           - pointer to out variable to receive matrix value.
++//   b           - pointer to out variable to receive matrix value.
++//   c           - pointer to out variable to receive matrix value.
++//   d           - pointer to out variable to receive matrix value.
++//   e           - pointer to out variable to receive matrix value.
++//   f           - pointer to out variable to receive matrix value.
++//
++// The matrix is composed as:
++//   |a c e|
++//   |b d f|
++// and used to scale, rotate, shear and translate the form object.
++//
++// Returns TRUE on success.
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
++                      double* a,
++                      double* b,
++                      double* c,
++                      double* d,
++                      double* e,
++                      double* f);
++
+ #ifdef __cplusplus
+ }  // extern "C"
+ #endif  // __cplusplus
+-- 
+2.16.4
+
diff --git a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
index 21c3d007fb3d..c6dd469c07a9 100644
--- a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
+++ b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
@@ -33,7 +33,7 @@ index fed1581..3f400c7 100644
 +  RetainPtr<CFX_DIBitmap> pBitmap;
 +  pBitmap = pSource->CloneConvert(FXDIB_Argb);
 +
-+  return pBitmap.Leak();
++  return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
 +}
 +
  FPDF_EXPORT unsigned long FPDF_CALLCONV
diff --git a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
deleted file mode 100644
index cffb8fb80530..000000000000
--- a/external/pdfium/0004-svx-support-PDF-text-color.patch.2
+++ /dev/null
@@ -1,46 +0,0 @@
-From 914467a56b9c4cd6a27cfa9b7ed61ebfb5a122d3 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:29:49 +0200
-Subject: [PATCH 04/14] svx: support PDF text color
-
----
- pdfium/fpdfsdk/cpdfsdk_helpers.h |  5 +++++
- pdfium/fpdfsdk/fpdf_editpage.cpp | 30 +++++++++++++++++++++++++-----
- pdfium/public/fpdf_edit.h        | 16 ++++++++++++++++
- 3 files changed, 46 insertions(+), 5 deletions(-)
-
-diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-index d93ecfc..13362cf 100644
---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
-+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-@@ -204,6 +204,11 @@ inline CPDF_TextPageFind* CPDFTextPageFindFromFPDFSchHandle(
-   return reinterpret_cast<CPDF_TextPageFind*>(handle);
- }
- 
-+inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
-+    FPDF_PAGEOBJECT page_object) {
-+  return reinterpret_cast<CPDF_TextObject*>(page_object);
-+}
-+
- ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
- 
- #ifdef PDF_ENABLE_XFA
-diff --git a/pdfium/fpdfsdk/fpdf_edittext.cpp b/pdfium/fpdfsdk/fpdf_edittext.cpp
-index c38873faa..aa3287ef4 100644
---- a/pdfium/fpdfsdk/fpdf_edittext.cpp
-+++ b/pdfium/fpdfsdk/fpdf_edittext.cpp
-@@ -398,11 +398,6 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
-   return pDoc->LoadFont(fontDict);
- }
- 
--CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
--  auto* obj = CPDFPageObjectFromFPDFPageObject(page_object);
--  return obj ? obj->AsText() : nullptr;
--}
--
- }  // namespace
- 
- FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
--- 
-2.16.3
-
diff --git a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 b/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
deleted file mode 100644
index db6057899bc7..000000000000
--- a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
+++ /dev/null
@@ -1,91 +0,0 @@
-From c82f6e80d94f8598221009035c8f336f5f656333 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:35:14 +0200
-Subject: [PATCH 11/14] svx: correctly possition form objects from PDF
-
----
- pdfium/fpdfsdk/fpdf_editpage.cpp | 25 +++++++++++++++++++++++++
- pdfium/public/fpdf_edit.h        | 18 ++++++++++++++++++
- 2 files changed, 43 insertions(+)
-
-diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-index 13362cf..477bb74 100644
---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
-+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-@@ -209,6 +209,11 @@ inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
-   return reinterpret_cast<CPDF_TextObject*>(page_object);
- }
- 
-+inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(
-+    FPDF_PAGEOBJECT page_object) {
-+  return reinterpret_cast<CPDF_FormObject*>(page_object);
-+}
-+
- ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
- 
- #ifdef PDF_ENABLE_XFA
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index bf68250..f4a1688 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -688,3 +688,28 @@ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index) {
-   return FPDFPageObjectFromCPDFPageObject(
-       pObjectList->GetPageObjectByIndex(index));
- }
-+
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
-+                      double* a,
-+                      double* b,
-+                      double* c,
-+                      double* d,
-+                      double* e,
-+                      double* f)
-+{
-+  if (!form_object || !a || !b || !c || !d || !e || !f)
-+    return;
-+
-+  CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
-+  if (pFrmObj)
-+  {
-+    const CFX_Matrix& matrix = pFrmObj->form_matrix();
-+    *a = matrix.a;
-+    *b = matrix.b;
-+    *c = matrix.c;
-+    *d = matrix.d;
-+    *e = matrix.e;
-+    *f = matrix.f;
-+  }
-+}
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index ca76954..f249e64 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -1190,6 +1190,24 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
- FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
- FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
- 
-+// Get the matrix of a particular form object.
-+//
-+// form_object - Handle of form object
-+//   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 void FPDF_CALLCONV
-+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object,
-+                      double* a,
-+                      double* b,
-+                      double* c,
-+                      double* d,
-+                      double* e,
-+                      double* f);
-+
- #ifdef __cplusplus
- }  // extern "C"
- #endif  // __cplusplus
--- 
-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
deleted file mode 100644
index 3c53a2772e05..000000000000
--- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
+++ /dev/null
@@ -1,41 +0,0 @@
-From f701ff3ce04a4e7e757a9f3ee62b4967749455dd Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 14:27:55 +0200
-Subject: [PATCH 14/14] svx: update PDFium patch and code
-
----
- pdfium/fpdfsdk/cpdfsdk_helpers.h |  2 ++
- pdfium/fpdfsdk/fpdf_editimg.cpp  |  2 +-
- pdfium/fpdfsdk/fpdf_editpage.cpp | 19 ++++++++++++-------
- pdfium/public/fpdf_edit.h        | 16 ++++++++--------
- 4 files changed, 23 insertions(+), 16 deletions(-)
-
-diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-index 477bb74..c907ad8 100644
---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
-+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-@@ -40,6 +40,8 @@ class CPDF_TextPage;
- class CPDF_TextPageFind;
- class IPDFSDK_PauseAdapter;
- class FX_PATHPOINT;
-+class CPDF_TextObject;
-+class CPDF_FormObject;
- 
- #ifdef PDF_ENABLE_XFA
- class CPDFXFA_Context;
-diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
-index 3f400c7..968b84a 100644
---- a/pdfium/fpdfsdk/fpdf_editimg.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
-@@ -203,7 +203,7 @@ FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
-   RetainPtr<CFX_DIBitmap> pBitmap;
-   pBitmap = pSource->CloneConvert(FXDIB_Argb);
- 
--  return pBitmap.Leak();
-+  return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
- }
- 
- FPDF_EXPORT unsigned long FPDF_CALLCONV
--- 
-2.16.3
-
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 0357fdfd4ec1..5d7708ade96c 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -25,10 +25,9 @@ pdfium_patches += 0001-Add-FPDFFormObj_GetObject-API.patch.1
 pdfium_patches += 0001-Add-FPDFText_GetFontName-API.patch.1
 # Backport of <https://pdfium-review.googlesource.com/39530>.
 pdfium_patches += 0001-Add-FPDFTextObj_GetText-API.patch.1
+# Backport of <https://pdfium-review.googlesource.com/39930>.
+pdfium_patches += 0001-Add-FPDFFormObj_GetMatrix-API.patch.1
 pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
-pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
-pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2
-pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
commit 5fe2c43a94c6d90090809c08e39af58a44974c26
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Sep 11 17:32:11 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Sep 12 09:06:44 2018 +0200

    IWYU: ignore UNO include files, similar to how the clang loplugin does
    
    Otherwise we could break some external code for no good reason.
    
    Change-Id: I01b1e266425688d3d4b5293c0f8609d78c6b7f2f
    Reviewed-on: https://gerrit.libreoffice.org/60331
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 2e3d15f2230c..e912a9155c82 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -179,6 +179,19 @@ def run_tool(task_queue, failed_files):
         task_queue.task_done()
 
 
+def isInUnoIncludeFile(path):
+    return path.startswith("include/com/") \
+            or path.startswith("include/cppu/") \
+            or path.startswith("include/cppuhelper/") \
+            or path.startswith("include/osl/") \
+            or path.startswith("include/rtl/") \
+            or path.startswith("include/sal/") \
+            or path.startswith("include/salhelper/") \
+            or path.startswith("include/systools/") \
+            or path.startswith("include/typelib/") \
+            or path.startswith("include/uno/")
+
+
 def tidy(compileCommands, paths):
     return_code = 0
     try:
@@ -191,6 +204,9 @@ def tidy(compileCommands, paths):
             t.start()
 
         for path in sorted(paths):
+            if isInUnoIncludeFile(path):
+                continue
+
             moduleName = path.split("/")[0]
 
             rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + ".yaml")


More information about the Libreoffice-commits mailing list