RepositoryExternal.mk                                      |    1 
 download.lst                                               |    4 
 external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 |   58 ------
 external/pdfium/Library_pdfium.mk                          |  116 +++++++------
 external/pdfium/UnpackedTarball_pdfium.mk                  |   15 +
 external/pdfium/build.patch.1                              |  110 ------------
 external/pdfium/c++20-comparison.patch                     |   13 +
 external/pdfium/ubsan.patch                                |   26 +-
 external/pdfium/visibility.patch.1                         |   30 ---
 external/pdfium/windows7.patch.1                           |   34 +++
 svx/source/svdraw/svdpdf.cxx                               |   31 +--
 vcl/qa/cppunit/pdfexport/pdfexport.cxx                     |    6 
 12 files changed, 161 insertions(+), 283 deletions(-)

New commits:
commit 0b93ea09ec9e3716ca54f15b63bd43d6ca381ee3
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Nov 19 09:03:40 2018 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Dec 17 13:56:16 2020 +0100

    external: update pdfium from 3550 to 4137
    
    This is a combination of 9 commits, which brings pdfium to the same
    version as cp-6.4 (ignoring recent changes).
    
    This is the 1st commit message:
    
    external: update pdfium to 3613
    
    (cherry picked from commit ec11c1aee04eacb00d94a6359f959b990ddb6923)
    
    This is the commit message #2:
    
    external: update pdfium to 3667
    
    (cherry picked from commit 2044475c8cb33b76591aa6de77dd43a0bf9f5145)
    
    Conflicts:
            solenv/flatpak-manifest.in
    
    This is the commit message #3:
    
    external: update pdfium to 3730
    
    (cherry picked from commit 8743247493ba90098e3e32cf30de0e8995569852)
    
    This is the commit message #4:
    
    pdfium: avoid problems with SetForm using WIN32_LEAN_AND_MEAN
    
    So that it does not get defined to SetFormA() or SetFormW() and still
    requires no patching.
    
    (cherry picked from commit 66c29fd202f22a36edbb929ddcc1f1cadb0a6e8f)
    
    This is the commit message #5:
    
    external: update pdfium to 3794
    
    (cherry picked from commit 3dbe66b7895a412ad7ad9aede4be383489d805de)
    
    Conflicts:
            external/pdfium/Library_pdfium.mk
    
    This is the commit message #6:
    
    external: update pdfium to 3849
    
    (cherry picked from commit 0ee0ca3036629b69bf20b448d74991fd133f08ac)
    
    Conflicts:
            external/pdfium/inc/pch/precompiled_pdfium.hxx
    
    This is the commit message #7:
    
    external: update pdfium to 3896
    
    (cherry picked from commit 735af14843eab3e75ac9ed6f0773ce7bb3241c8a)
    
    Conflicts:
            external/pdfium/inc/pch/precompiled_pdfium.hxx
            solenv/flatpak-manifest.in
    
    This is the commit message #8:
    
    external: update pdfium to 3963
    
    Also simplify visibility.patch.1.
    
    (cherry picked from commit 71cb2705af38df7f382014fb68f43bed98abf9b4)
    
    Conflicts:
            solenv/flatpak-manifest.in
            svx/source/svdraw/svdpdf.cxx
    
    This is the commit message #9:
    
    external: update pdfium from 3963 to 4137
    
    This is a combination of 6 commits, which brings pdfium to the same
    version as libreoffice-7-0.
    
    (cherry picked from commit 2cd3ddad396043c8c1af2e03bd1c53db084ccbf0)
    
    Conflicts:
            external/pdfium/inc/pch/precompiled_pdfium.hxx
            solenv/flatpak-manifest.in
            svx/source/svdraw/svdpdf.cxx
            vcl/qa/cppunit/pdfexport/pdfexport.cxx
            vcl/source/pdf/PDFiumLibrary.cxx
    
    Change-Id: Ib7c12461e04fa97bf55ee967e8d6c9bcf92fdf4a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107869
    Tested-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9c5fa4999362..25e75482c404 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4090,6 +4090,7 @@ ifneq ($(ENABLE_PDFIUM),)
 define gb_LinkTarget__use_pdfium
 $(call gb_LinkTarget_set_include,$(1),\
        -I$(call gb_UnpackedTarball_get_dir,pdfium)/public \
+       -DCOMPONENT_BUILD \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),pdfium)
diff --git a/download.lst b/download.lst
index ac943bfadb04..91ef3d83aa4d 100644
--- a/download.lst
+++ b/download.lst
@@ -214,8 +214,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := 
owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 
66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 
572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679
-export PDFIUM_TARBALL := pdfium-3550.tar.bz2
+export PDFIUM_SHA256SUM := 
9a2f9bddca935a263f06c81003483473a525ccd0f4e517bc75fceb914d4c54b6
+export PDFIUM_TARBALL := pdfium-4137.tar.bz2
 export PIXMAN_SHA256SUM := 
21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
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
deleted file mode 100644
index 08b272526578..000000000000
--- a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2
+++ /dev/null
@@ -1,58 +0,0 @@
-From faeac63865eeb791501d7535f1e7a7c7fc807b04 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:29:15 +0200
-Subject: [PATCH 03/14] svx: import PDF images as BGRA
-
----
- pdfium/fpdfsdk/fpdf_editimg.cpp | 20 ++++++++++++++++++++
- pdfium/public/fpdfview.h        |  3 +++
- 2 files changed, 23 insertions(+)
-
-diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
-index fed1581..3f400c7 100644
---- a/pdfium/fpdfsdk/fpdf_editimg.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
-@@ -186,6 +186,26 @@ FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object) {
-   return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
- }
- 
-+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
-+FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
-+  CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
-+  if (!pObj || !pObj->IsImage())
-+    return nullptr;
-+
-+  RetainPtr<CPDF_Image> pImg = pObj->AsImage()->GetImage();
-+  if (!pImg)
-+    return nullptr;
-+
-+  RetainPtr<CFX_DIBBase> pSource = pImg->LoadDIBBase();
-+  if (!pSource)
-+    return nullptr;
-+
-+  RetainPtr<CFX_DIBitmap> pBitmap;
-+  pBitmap = pSource->CloneConvert(FXDIB_Argb);
-+
-+  return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
-+}
-+
- FPDF_EXPORT unsigned long FPDF_CALLCONV
- FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
-                                  void* buffer,
-diff --git a/pdfium/public/fpdfview.h b/pdfium/public/fpdfview.h
-index 0ccd140..b451b9c 100644
---- a/pdfium/public/fpdfview.h
-+++ b/pdfium/public/fpdfview.h
-@@ -905,6 +905,9 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV 
FPDFBitmap_CreateEx(int width,
- //          function; see the list of such formats above.
- FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
- 
-+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
-+FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object);
-+
- // Function: FPDFBitmap_FillRect
- //          Fill a rectangle in a bitmap.
- // Parameters:
--- 
-2.16.3
-
diff --git a/external/pdfium/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index f9a62bf75b46..1016d2fc832b 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -20,13 +20,15 @@ $(eval $(call gb_Library_set_include,pdfium,\
 ))
 
 $(eval $(call gb_Library_add_defs,pdfium,\
-    -DPDFIUM_DLLIMPLEMENTATION \
+    -DFPDF_IMPLEMENTATION \
     -DUSE_SYSTEM_LCMS2 \
     -DUSE_SYSTEM_LIBJPEG \
     -DUSE_SYSTEM_ZLIB \
     -DUSE_SYSTEM_ICUUC \
     -DMEMORY_TOOL_REPLACES_ALLOCATOR \
     -DUNICODE \
+    -DWIN32_LEAN_AND_MEAN \
+    -DCOMPONENT_BUILD \
 ))
 
 # Don't show warnings upstream doesn't care about.
@@ -41,15 +43,12 @@ $(eval $(call 
gb_Library_set_generated_cxx_suffix,pdfium,cpp))
 
 # pdfium
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/cfx_systemhandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annothandlermgr \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiteration \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannothandler \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_datetime \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_formfillenvironment \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pageview \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widget \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widgethandler \
@@ -79,20 +78,20 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_save \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_text \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
-    UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_pauseadapter \
-    UnpackedTarball/pdfium/fpdfsdk/cpdf_annotcontext \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
 ))
 
 # fdrm
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_aes \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_sha \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_aes \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_sha \
 ))
 
 # formfiller
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/formfiller/cba_fontmap \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_checkbox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_combobox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_formfiller \
@@ -169,8 +168,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/UniKS-UTF16-H_0 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_modulemgr \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_pagerendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \
@@ -185,7 +182,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_color \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorspace \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorstate \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmark \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarks \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarkitem \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentparser \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_docpagedata \
@@ -200,7 +197,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pagemodule \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectholder \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectlist \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_path \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pathobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pattern \
@@ -237,9 +233,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/fpdf_parser_utility \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_walker \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_read_validator \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_charposlist \
+    UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \
@@ -251,12 +246,12 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_renderstatus \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_textrenderer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphs \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphmap \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendershading \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_encryptor \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_flateencoder \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_cttgsubtable \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_stockfontarray \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cid2unicodemap \
@@ -278,11 +273,17 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_page_object_avail \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transparency \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibbase \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transparency \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dib \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_occontext \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_annotcontext \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercontext \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfuncdib \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
 ))
 
 # fpdfdoc
@@ -290,7 +291,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cline \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_aaction \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_action \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_actionfields \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annot \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annotlist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_apsettings \
@@ -298,18 +298,16 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_bookmarktree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_defaultappearance \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_dest \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_docjsactions \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_filespec \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formcontrol \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formfield \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_iconfit \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interform \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interactiveform \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_link \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_linklist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_metadata \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_nametree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_numbertree \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_occontext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_pagelabel \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_variabletext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_viewerpreferences \
@@ -320,6 +318,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/ctypeset \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structelement \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structtree \
+    UnpackedTarball/pdfium/core/fpdfdoc/cba_fontmap \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_color_utils \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_icon \
 ))
 
 # fpdftext
@@ -332,7 +333,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # fxcodec
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec \
+    UnpackedTarball/pdfium/core/fxcodec/fx_codec \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithIntDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_BitStream \
@@ -349,18 +350,21 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_Segment \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_TrdProc \
-    UnpackedTarball/pdfium/core/fxcodec/bmp/fx_bmp \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_scanlinedecoder \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gif \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gifcontext \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_lzwdecompressor \
-    UnpackedTarball/pdfium/core/fxcodec/codec/cfx_codec_memory \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_faxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_iccmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jbig2module \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpegmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/cfx_codec_memory \
+    UnpackedTarball/pdfium/core/fxcodec/fax/faxmodule \
+    UnpackedTarball/pdfium/core/fxcodec/scanlinedecoder \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2module \
+    UnpackedTarball/pdfium/core/fxcodec/jpeg/jpegmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/cjpx_decoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/jpx_decode_utils \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_DocumentContext \
+    UnpackedTarball/pdfium/core/fxcodec/basic/basicmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/jpxmodule \
+    UnpackedTarball/pdfium/core/fxcodec/flate/flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/icc/iccmodule \
 ))
 
 # fxcrt
@@ -373,7 +377,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_memory \
     UnpackedTarball/pdfium/core/fxcrt/fx_stream \
     UnpackedTarball/pdfium/core/fxcrt/fx_system \
-    UnpackedTarball/pdfium/core/fxcrt/fx_ucddata \
     UnpackedTarball/pdfium/core/fxcrt/fx_unicode \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmldocument \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmlelement \
@@ -410,11 +413,13 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_random \
     UnpackedTarball/pdfium/core/fxcrt/fx_string \
     UnpackedTarball/pdfium/core/fxcrt/widestring \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_seekablemultistream \
     UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssdata \
     UnpackedTarball/pdfium/core/fxcrt/fx_codepage \
+    UnpackedTarball/pdfium/core/fxcrt/fx_number \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
     UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
+    UnpackedTarball/pdfium/core/fxcrt/observed_ptr \
+    UnpackedTarball/pdfium/core/fxcrt/string_data_template \
 ))
 
 # fxge
@@ -423,7 +428,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibextractor \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \
-    UnpackedTarball/pdfium/core/fxge/dib/cfx_filtereddib \
+    UnpackedTarball/pdfium/core/fxge/cfx_drawutils \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \
@@ -451,7 +456,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/agg/fx_agg_driver \
     UnpackedTarball/pdfium/core/fxge/cfx_cliprgn \
     UnpackedTarball/pdfium/core/fxge/cfx_color \
-    UnpackedTarball/pdfium/core/fxge/cfx_facecache \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphcache \
     UnpackedTarball/pdfium/core/fxge/cfx_folderfontinfo \
     UnpackedTarball/pdfium/core/fxge/cfx_font \
     UnpackedTarball/pdfium/core/fxge/cfx_fontcache \
@@ -464,11 +469,16 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cfx_renderdevice \
     UnpackedTarball/pdfium/core/fxge/cfx_substfont \
     UnpackedTarball/pdfium/core/fxge/cfx_unicodeencoding \
-    UnpackedTarball/pdfium/core/fxge/cttfontdesc \
     UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
     UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_text \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphbitmap \
+    UnpackedTarball/pdfium/core/fxge/scoped_font_transform \
+    UnpackedTarball/pdfium/core/fxge/text_glyph_pos \
+    UnpackedTarball/pdfium/core/fxge/fx_font \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \
+    UnpackedTarball/pdfium/core/fxge/dib/cfx_cmyk_to_srgb \
+    UnpackedTarball/pdfium/core/fxge/text_char_pos \
+    UnpackedTarball/pdfium/core/fxge/cfx_face \
 ))
 
 # javascript, build with pdf_enable_v8 disabled.
@@ -480,21 +490,19 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # pwl
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_appstream \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_appstream \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_button \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_caret \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_combo_box \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_ctrl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_impl \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_font_map \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_icon \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_box \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_impl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_scroll_bar \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_special_button \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer_handler \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_timer \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_wnd \
 ))
 
@@ -546,6 +554,12 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/spin_lock 
\
     
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_alloc
 \
     UnpackedTarball/pdfium/third_party/base/debug/alias \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/oom_callback
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_bucket
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \
 ))
 
 # skia_shared
@@ -624,18 +638,24 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/fx_win32_gdipext \
     UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
+    UnpackedTarball/pdfium/third_party/base/win/win_util \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,pdfium,\
     gdi32 \
 ))
+
+$(eval $(call gb_Library_add_defs,pdfium,\
+    -DWIN32 \
+))
 endif
 
 ifeq ($(OS),MACOSX)
 # fxge
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/apple/fx_apple_platform \
-    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_imp \
+    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_impl \
     UnpackedTarball/pdfium/core/fxge/apple/fx_quartz_device \
 ))
 
@@ -652,7 +672,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafont \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafontmgr \
     UnpackedTarball/pdfium/core/fxge/android/cfx_androidfontinfo \
-    UnpackedTarball/pdfium/core/fxge/android/fx_android_imp \
+    UnpackedTarball/pdfium/core/fxge/android/fx_android_impl \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiapathfont \
 ))
 endif
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index d99f1077da98..93d3fede6e3c 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -8,12 +8,12 @@
 #
 
 pdfium_patches :=
-pdfium_patches += visibility.patch.1
 pdfium_patches += ubsan.patch
 # Fixes build on our baseline.
 pdfium_patches += build.patch.1
-# Adds missing editing API
-pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
+# Avoids Windows 8 build dependency.
+pdfium_patches += windows7.patch.1
+pdfium_patches += c++20-comparison.patch
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
@@ -38,7 +38,14 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/page_allocator.cc 
third_party/base/allocator/partition_allocator/page_allocator.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_alloc.cc 
third_party/base/allocator/partition_allocator/partition_alloc.cpp && \
     mv third_party/base/allocator/partition_allocator/spin_lock.cc 
third_party/base/allocator/partition_allocator/spin_lock.cpp && \
-       mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp \
+    mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp && \
+    mv third_party/base/allocator/partition_allocator/oom_callback.cc 
third_party/base/allocator/partition_allocator/oom_callback.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_bucket.cc 
third_party/base/allocator/partition_allocator/partition_bucket.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_oom.cc 
third_party/base/allocator/partition_allocator/partition_oom.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_page.cc 
third_party/base/allocator/partition_allocator/partition_page.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_root_base.cc 
third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
+    mv third_party/base/allocator/partition_allocator/random.cc 
third_party/base/allocator/partition_allocator/random.cpp && \
+    mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 721c1784719d..16544f0c7c81 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -1,24 +1,3 @@
-diff --git a/core/fxge/dib/cfx_imagetransformer.cpp 
b/core/fxge/dib/cfx_imagetransformer.cpp
-index 8e01127b0..f4ce4d915 100644
---- a/core/fxge/dib/cfx_imagetransformer.cpp
-+++ b/core/fxge/dib/cfx_imagetransformer.cpp
-@@ -315,14 +315,14 @@ bool CFX_ImageTransformer::Continue(IFX_PauseIndicator* 
pPause) {
-   } else if (pDestMask) {
-     CalcData cdata = {
-         pDestMask.Get(), result2stretch, pSrcMaskBuf,
--        m_Storer.GetBitmap()->m_pAlphaMask->GetPitch(),
-+        static_cast<uint32_t>(m_Storer.GetBitmap()->m_pAlphaMask->GetPitch()),
-     };
-     CalcMask(cdata);
-   }
- 
-   CalcData cdata = {pTransformed.Get(), result2stretch,
-                     m_Storer.GetBitmap()->GetBuffer(),
--                    m_Storer.GetBitmap()->GetPitch()};
-+                    static_cast<uint32_t>(m_Storer.GetBitmap()->GetPitch())};
-   if (m_Storer.GetBitmap()->IsAlphaMask()) {
-     CalcAlpha(cdata);
-   } else {
 diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
 index 323de4ffc..f11a0b0ad 100644
 --- a/core/fpdfdoc/cpdf_metadata.cpp
@@ -32,38 +11,6 @@ index 323de4ffc..f11a0b0ad 100644
  
    std::vector<UnsupportedFeature> unsupported;
    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
-diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp
-index 20c5fc343..a40cd1eae 100644
---- a/fpdfsdk/cpdf_annotcontext.cpp
-+++ b/fpdfsdk/cpdf_annotcontext.cpp
-@@ -16,12 +16,12 @@ CPDF_AnnotContext::CPDF_AnnotContext(CPDF_Dictionary* 
pAnnotDict,
-                                      CPDF_Page* pPage,
-                                      CPDF_Stream* pStream)
-     : m_pAnnotDict(pAnnotDict), m_pPage(pPage) {
--  SetForm(pStream);
-+  SetForm_(pStream);
- }
- 
- CPDF_AnnotContext::~CPDF_AnnotContext() = default;
- 
--void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) {
-+void CPDF_AnnotContext::SetForm_(CPDF_Stream* pStream) {
-   if (!pStream)
-     return;
- 
-diff --git a/fpdfsdk/cpdf_annotcontext.h b/fpdfsdk/cpdf_annotcontext.h
-index 38cc91e03..7904ae044 100644
---- a/fpdfsdk/cpdf_annotcontext.h
-+++ b/fpdfsdk/cpdf_annotcontext.h
-@@ -23,7 +23,7 @@ class CPDF_AnnotContext {
-                     CPDF_Stream* pStream);
-   ~CPDF_AnnotContext();
- 
--  void SetForm(CPDF_Stream* pStream);
-+  void SetForm_(CPDF_Stream* pStream);
-   bool HasForm() const { return !!m_pAnnotForm; }
-   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
-   CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..f71c362e2 100644
 --- a/third_party/base/span.h
@@ -77,37 +24,6 @@ index 0fb627ba8..f71c362e2 100644
    span& operator=(const span& other) noexcept = default;
    ~span() noexcept {
      if (!size_) {
-diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
-index d3bf38d31..e8aea9707 100644
---- a/fpdfsdk/fpdf_annot.cpp
-+++ b/fpdfsdk/fpdf_annot.cpp
-@@ -389,7 +389,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, 
FPDF_PAGEOBJECT obj) {
- 
-   // Get the annotation's corresponding form object for parsing its AP stream.
-   if (!pAnnot->HasForm())
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
- 
-   // Check that the object did not come from the same annotation. If this 
check
-   // succeeds, then it is assumed that the object came from
-@@ -425,7 +425,7 @@ FPDF_EXPORT int FPDF_CALLCONV 
FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot) {
-     if (!pStream)
-       return 0;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
-   return pdfium::CollectionSize<int>(*pAnnot->GetForm()->GetPageObjectList());
- }
-@@ -442,7 +442,7 @@ FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index) {
-     if (!pStream)
-       return nullptr;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
- 
-   return FPDFPageObjectFromCPDFPageObject(
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..dda1fc8bc 100644
 --- a/third_party/base/span.h
@@ -121,29 +37,3 @@ index 0fb627ba8..dda1fc8bc 100644
        : span(container.data(), container.size()) {}
    template <
        typename Container,
-diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
-index 7f4eb86c0..5e227f86e 100644
---- a/core/fpdfdoc/cpdf_dest.h
-+++ b/core/fpdfdoc/cpdf_dest.h
-@@ -41,7 +41,7 @@
-               float* pZoom) const;
- 
-  private:
--  UnownedPtr<const CPDF_Array> const m_pArray;
-+  UnownedPtr<const CPDF_Array> m_pArray;
- };
- 
- #endif  // CORE_FPDFDOC_CPDF_DEST_H_
-diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
-index 7050f695b..916afed8b 100644
---- a/core/fpdfdoc/cpdf_filespec.h
-+++ b/core/fpdfdoc/cpdf_filespec.h
-@@ -41,7 +41,7 @@ class CPDF_FileSpec {
- 
-  private:
-   UnownedPtr<const CPDF_Object> const m_pObj;
--  UnownedPtr<CPDF_Object> const m_pWritableObj;
-+  UnownedPtr<CPDF_Object> m_pWritableObj;
- };
- 
- #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
diff --git a/external/pdfium/c++20-comparison.patch 
b/external/pdfium/c++20-comparison.patch
new file mode 100644
index 000000000000..025f9ba010db
--- /dev/null
+++ b/external/pdfium/c++20-comparison.patch
@@ -0,0 +1,13 @@
+--- core/fxcrt/fx_memory_wrappers.h
++++ core/fxcrt/fx_memory_wrappers.h
+@@ -70,8 +70,8 @@
+   }
+ 
+   // There's no state, so they are all the same,
+-  bool operator==(const FxAllocAllocator& that) { return true; }
+-  bool operator!=(const FxAllocAllocator& that) { return false; }
++  bool operator==(const FxAllocAllocator& that) const { return true; }
++  bool operator!=(const FxAllocAllocator& that) const { return false; }
+ };
+ 
+ #endif  // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 91428326fc5d..8610e24f2828 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,18 +1,18 @@
---- core/fxcrt/string_data_template.h
-+++ core/fxcrt/string_data_template.h
-@@ -78,7 +78,8 @@
+--- core/fxcrt/string_data_template.cpp
++++ core/fxcrt/string_data_template.cpp
+@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t 
offset,
+   ASSERT(nLen >= 0);
+   ASSERT(offset + nLen <= m_nAllocLength);
  
-   void CopyContentsAt(size_t offset, const CharType* pStr, size_t nLen) {
-     ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
--    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-+    if (nLen != 0)
-+      memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-     m_String[offset + nLen] = 0;
-   }
+-  memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
++  if (nLen != 0)
++    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+   m_String[offset + nLen] = 0;
+ }
  
---- core/fxge/cfx_facecache.cpp
-+++ core/fxge/cfx_facecache.cpp
-@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> 
CFX_FaceCache::RenderGlyph(
+--- core/fxge/cfx_glyphcache.cpp
++++ core/fxge/cfx_glyphcache.cpp
+@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> 
CFX_GlyphCache::RenderGlyph(
        }
      }
    } else {
diff --git a/external/pdfium/visibility.patch.1 
b/external/pdfium/visibility.patch.1
deleted file mode 100644
index 04e89b38ab10..000000000000
--- a/external/pdfium/visibility.patch.1
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/public/fpdfview.h b/public/fpdfview.h
-index 1ff0aeb26..f48036f2b 100644
---- a/public/fpdfview.h
-+++ b/public/fpdfview.h
-@@ -129,14 +129,20 @@ typedef int FPDF_ANNOTATION_SUBTYPE;
- // Dictionary value types.
- typedef int FPDF_OBJECT_TYPE;
- 
--#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
--// On Windows system, functions are exported in a DLL
-+#if defined(PDFIUM_DLLIMPLEMENTATION)
-+#ifdef _WIN32
- #define FPDF_EXPORT __declspec(dllexport)
--#define FPDF_CALLCONV __stdcall
- #else
--#define FPDF_EXPORT
--#define FPDF_CALLCONV
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
-+#endif
-+#else
-+#ifdef _WIN32
-+#define FPDF_EXPORT __declspec(dllimport)
-+#else
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
- #endif
-+#endif
-+#define FPDF_CALLCONV
- 
- // Exported Functions
- #ifdef __cplusplus
diff --git a/external/pdfium/windows7.patch.1 b/external/pdfium/windows7.patch.1
new file mode 100644
index 000000000000..d33f273ff4ca
--- /dev/null
+++ b/external/pdfium/windows7.patch.1
@@ -0,0 +1,34 @@
+diff --git a/third_party/base/win/win_util.cc 
b/third_party/base/win/win_util.cc
+index ae2dba84d..7a3718848 100644
+--- a/third_party/base/win/win_util.cc
++++ b/third_party/base/win/win_util.cc
+@@ -12,28 +12,7 @@ namespace base {
+ namespace win {
+ 
+ bool IsUser32AndGdi32Available() {
+-  static auto is_user32_and_gdi32_available = []() {
+-    // If win32k syscalls aren't disabled, then user32 and gdi32 are 
available.
+-
+-    typedef decltype(
+-        GetProcessMitigationPolicy)* GetProcessMitigationPolicyType;
+-    GetProcessMitigationPolicyType get_process_mitigation_policy_func =
+-        reinterpret_cast<GetProcessMitigationPolicyType>(GetProcAddress(
+-            GetModuleHandle(L"kernel32.dll"), "GetProcessMitigationPolicy"));
+-
+-    if (!get_process_mitigation_policy_func)
+-      return true;
+-
+-    PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {};
+-    if (get_process_mitigation_policy_func(GetCurrentProcess(),
+-                                           ProcessSystemCallDisablePolicy,
+-                                           &policy, sizeof(policy))) {
+-      return policy.DisallowWin32kSystemCalls == 0;
+-    }
+-
+-    return true;
+-  }();
+-  return is_user32_and_gdi32_available;
++  return true;
+ }
+ 
+ }  // namespace win
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 8f79523b4c3e..9e49a3d1e90a 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -223,7 +223,7 @@ void ImpSdrPdfImport::DoObjects(SvdProgressInfo* 
pProgrInfo, sal_uInt32* pAction
         // Load the page text to extract it when we get text elements.
         FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage);
 
-        const int nPageObjectCount = FPDFPage_CountObject(pPdfPage);
+        const int nPageObjectCount = FPDFPage_CountObjects(pPdfPage);
         if (pProgrInfo)
             pProgrInfo->SetActionCount(nPageObjectCount);
 
@@ -859,9 +859,9 @@ void ImpSdrPdfImport::ImportForm(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     // Get the form matrix to perform correct translation/scaling of the form 
sub-objects.
     const Matrix aOldMatrix = mCurMatrix;
 
-    double a, b, c, d, e, f;
-    FPDFFormObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
-    mCurMatrix = Matrix(a, b, c, d, e, f);
+    FS_MATRIX matrix;
+    FPDFFormObj_GetMatrix(pPageObject, &matrix);
+    mCurMatrix = Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
 
     const int nCount = FPDFFormObj_CountObjects(pPageObject);
     for (int nIndex = 0; nIndex < nCount; ++nIndex)
@@ -889,8 +889,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     if (left == right || top == bottom)
         return;
 
-    double a, b, c, d, e, f;
-    FPDFText_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
+    FS_MATRIX matrix;
+    FPDFTextObj_GetMatrix(pPageObject, &matrix);
     Matrix aTextMatrix(mCurMatrix);
 
     aTextMatrix.Transform(left, right, top, bottom);
@@ -908,8 +908,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     OUString sText(pText.get(), nActualChars);
 
     const double dFontSize = FPDFTextObj_GetFontSize(pPageObject);
-    double dFontSizeH = fabs(sqrt2(a, c) * dFontSize);
-    double dFontSizeV = fabs(sqrt2(b, d) * dFontSize);
+    double dFontSizeH = fabs(sqrt2(matrix.a, matrix.c) * dFontSize);
+    double dFontSizeV = fabs(sqrt2(matrix.b, matrix.d) * dFontSize);
     dFontSizeH = lcl_PointToPixel(dFontSizeH);
     dFontSizeV = lcl_PointToPixel(dFontSizeV);
     dFontSizeH = lcl_ToLogic(dFontSizeH);
@@ -942,7 +942,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     Color aTextColor(COL_TRANSPARENT);
     bool bFill = false;
     bool bUse = true;
-    switch (FPDFText_GetTextRenderMode(pPageObject))
+    switch (FPDFTextObj_GetTextRenderMode(pPageObject))
     {
         case FPDF_TEXTRENDERMODE_FILL:
         case FPDF_TEXTRENDERMODE_FILL_CLIP:
@@ -952,6 +952,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
             break;
         case FPDF_TEXTRENDERMODE_STROKE:
         case FPDF_TEXTRENDERMODE_STROKE_CLIP:
+        case FPDF_TEXTRENDERMODE_UNKNOWN:
             break;
         case FPDF_TEXTRENDERMODE_INVISIBLE:
         case FPDF_TEXTRENDERMODE_CLIP:
@@ -1063,7 +1064,7 @@ void ImpSdrPdfImport::MapScaling()
 void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT pPageObject, int 
/*nPageObjectIndex*/)
 {
     std::unique_ptr<std::remove_pointer<FPDF_BITMAP>::type, FPDFBitmapDeleter> 
bitmap(
-        FPDFImageObj_GetBitmapBgra(pPageObject));
+        FPDFImageObj_GetBitmap(pPageObject));
     if (!bitmap)
     {
         SAL_WARN("sd.filter", "Failed to get IMAGE");
@@ -1126,9 +1127,9 @@ void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT 
pPageObject, int /*nPageObject
 
 void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int 
/*nPageObjectIndex*/)
 {
-    double a, b, c, d, e, f;
-    FPDFPath_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
-    Matrix aPathMatrix(a, b, c, d, e, f);
+    FS_MATRIX matrix;
+    FPDFPath_GetMatrix(pPageObject, &matrix);
+    Matrix aPathMatrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
     aPathMatrix.Concatinate(mCurMatrix);
 
     basegfx::B2DPolyPolygon aPolyPoly;
@@ -1231,12 +1232,12 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT 
pPageObject, int /*nPageObjectI
     unsigned int nG;
     unsigned int nB;
     unsigned int nA;
-    FPDFPath_GetFillColor(pPageObject, &nR, &nG, &nB, &nA);
+    FPDFPageObj_GetFillColor(pPageObject, &nR, &nG, &nB, &nA);
     mpVD->SetFillColor(Color(nR, nG, nB));
 
     if (bStroke)
     {
-        FPDFPath_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
+        FPDFPageObj_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
         mpVD->SetLineColor(Color(nR, nG, nB));
     }
     else
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index da3da74fc63d..0ac88bc96db9 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -292,7 +292,7 @@ void PdfExportTest::testTdf105461()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, 
&nAlpha);
         if (RGB_COLORDATA(nRed, nGreen, nBlue) == COL_YELLOW)
             ++nYellowPathCount;
     }
@@ -346,7 +346,7 @@ void PdfExportTest::testTdf107868()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, 
&nAlpha);
         if (RGB_COLORDATA(nRed, nGreen, nBlue) == COL_WHITE)
             ++nWhitePathCount;
     }
@@ -773,7 +773,7 @@ void PdfExportTest::testTdf108963()
             continue;
 
         unsigned int nRed = 0, nGreen = 0, nBlue = 0, nAlpha = 0;
-        FPDFPath_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, &nAlpha);
+        FPDFPageObj_GetFillColor(pPdfPageObject, &nRed, &nGreen, &nBlue, 
&nAlpha);
         if (RGB_COLORDATA(nRed, nGreen, nBlue) == COL_YELLOW)
         {
             ++nYellowPathCount;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to