backport update Skia to chrome/m85 snapshot to libreoffice-7-0

This is for https://gerrit.libreoffice.org/c/core/+/103190 , I think
detecting silent misdrawings is a good enough reason. There haven't
been yet any problems with any Skia updates on master (at least
that I'm aware of), so I consider this worth it.

Change-Id: I3af3517c9c213e0db8365aecd0a008d817ca4dcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97592
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
(cherry picked from commit 3dfc6d42edfd469436ad177ad1ebc5526679aa99)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103560
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/bin/update_pch b/bin/update_pch
index 8055007..00cd506 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -633,7 +633,7 @@ def parse_makefile(groups, lines, lineno, lastif, ifstack):
            if EXCLUDE_SYSTEM and ifstack:
                continue
            file = line + '.' + suffix
            if ',' in line or '(' in line or ')' in line:
            if ',' in line or '(' in line or ')' in line or file.startswith('-'):
                #print('passing: ' + line)
                pass # $if() probably, or something similar
            else:
diff --git a/configure.ac b/configure.ac
index 4f2c414..745fe95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6829,6 +6829,7 @@ CXXFLAGS_INTRINSICS_SSE41=
CXXFLAGS_INTRINSICS_SSE42=
CXXFLAGS_INTRINSICS_AVX=
CXXFLAGS_INTRINSICS_AVX2=
CXXFLAGS_INTRINSICS_AVX512=
CXXFLAGS_INTRINSICS_F16C=
CXXFLAGS_INTRINSICS_FMA=

@@ -6840,6 +6841,7 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
    flag_sse42=-msse4.2
    flag_avx=-mavx
    flag_avx2=-mavx2
    flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
    flag_f16c=-mf16c
    flag_fma=-mfma
else
@@ -6854,6 +6856,7 @@ else
    flag_sse42=-arch:SSE2
    flag_avx=-arch:AVX
    flag_avx2=-arch:AVX2
    flag_avx512=-arch:AVX512
    # These are part of -arch:AVX2
    flag_f16c=-arch:AVX2
    flag_fma=-arch:AVX2
@@ -6985,6 +6988,26 @@ if test "${can_compile_avx2}" = "yes" ; then
    CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
fi

AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $flag_avx512"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
    #include <immintrin.h>
    int main () {
        __m512i a = _mm512_loadu_si512(0);
        return 0;
    }
    ])],
    [can_compile_avx512=yes],
    [can_compile_avx512=no])
AC_LANG_POP([C++])
CXXFLAGS=$save_CXXFLAGS
AC_MSG_RESULT([${can_compile_avx512}])
if test "${can_compile_avx512}" = "yes" ; then
    CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
fi

AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
@@ -7034,6 +7057,7 @@ AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
AC_SUBST([CXXFLAGS_INTRINSICS_FMA])

@@ -11103,6 +11127,7 @@ CLANG_CXXFLAGS_INTRINSICS_SSE41=
CLANG_CXXFLAGS_INTRINSICS_SSE42=
CLANG_CXXFLAGS_INTRINSICS_AVX=
CLANG_CXXFLAGS_INTRINSICS_AVX2=
CLANG_CXXFLAGS_INTRINSICS_AVX512=
CLANG_CXXFLAGS_INTRINSICS_F16C=
CLANG_CXXFLAGS_INTRINSICS_FMA=

@@ -11159,6 +11184,7 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
        flag_sse42=-msse4.2
        flag_avx=-mavx
        flag_avx2=-mavx2
        flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
        flag_f16c=-mf16c
        flag_fma=-mfma

@@ -11288,6 +11314,26 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
            CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
        fi

        AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
        AC_LANG_PUSH([C++])
        save_CXXFLAGS=$CXXFLAGS
        CXXFLAGS="$CXXFLAGS $flag_avx512"
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([
            #include <immintrin.h>
            int main () {
                __m512i a = _mm512_loadu_si512(0);
                return 0;
            }
            ])],
            [can_compile_avx512=yes],
            [can_compile_avx512=no])
        AC_LANG_POP([C++])
        CXXFLAGS=$save_CXXFLAGS
        AC_MSG_RESULT([${can_compile_avx512}])
        if test "${can_compile_avx512}" = "yes" ; then
            CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
        fi

        AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
        AC_LANG_PUSH([C++])
        save_CXXFLAGS=$CXXFLAGS
@@ -11342,6 +11388,7 @@ AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)

diff --git a/download.lst b/download.lst
index 6398a09..38f971c 100644
--- a/download.lst
+++ b/download.lst
@@ -239,8 +239,8 @@ export RHINO_SHA256SUM := 1fb458d6aab06932693cc8a9b6e4e70944ee1ff052fa63606e3131
export RHINO_TARBALL := 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
export SERF_SHA256SUM := 6988d394b62c3494635b6f0760bc3079f9a0cd380baf0f6b075af1eb9fa5e700
export SERF_TARBALL := serf-1.2.1.tar.bz2
export SKIA_SHA256SUM := f88dc1a500d29c87ef5251c5a6c3ea66aa4c7daf0cf5d349ece64b36f7623be0
export SKIA_TARBALL := skia-m84-c1baf6e1c2a5454148adb516f0f833483b5a0353.tar.xz
export SKIA_SHA256SUM := 3294877fa2b61b220d98a0f7bfc11325429b13edd2cf455444c703ee3a14d760
export SKIA_TARBALL := skia-m85-e684c6daef6bfb774a325a069eda1f76ca6ac26c.tar.xz
export STAROFFICE_SHA256SUM := f94fb0ad8216f97127bedef163a45886b43c62deac5e5b0f5e628e234220c8db
export STAROFFICE_VERSION_MICRO := 7
export STAROFFICE_TARBALL := libstaroffice-0.0.$(STAROFFICE_VERSION_MICRO).tar.xz
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index 47140da..1cd4ada 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -204,6 +204,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/core/SkImageInfo \
    UnpackedTarball/skia/src/core/SkLatticeIter \
    UnpackedTarball/skia/src/core/SkLineClipper \
    UnpackedTarball/skia/src/core/SkLegacyGpuBlurUtils \
    UnpackedTarball/skia/src/core/SkLocalMatrixImageFilter \
    UnpackedTarball/skia/src/core/SkMalloc \
    UnpackedTarball/skia/src/core/SkMallocPixelRef \
@@ -227,6 +228,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/core/SkPaint \
    UnpackedTarball/skia/src/core/SkPaintPriv \
    UnpackedTarball/skia/src/core/SkPath \
    UnpackedTarball/skia/src/core/SkPathBuilder \
    UnpackedTarball/skia/src/core/SkPathEffect \
    UnpackedTarball/skia/src/core/SkPathMeasure \
    UnpackedTarball/skia/src/core/SkPathRef \
@@ -515,10 +517,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/effects/generated/GrHSLToRGBFilterEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrLumaColorFilterEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrMagnifierEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrMatrixEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrMixerEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrOverrideInputFragmentProcessor \
    UnpackedTarball/skia/src/gpu/effects/generated/GrPremulInputFragmentProcessor \
    UnpackedTarball/skia/src/gpu/effects/generated/GrRectBlurEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrRGBToHSLFilterEffect \
    UnpackedTarball/skia/src/gpu/effects/generated/GrRRectBlurEffect \
@@ -532,6 +532,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/effects/GrDistanceFieldGeoProc \
    UnpackedTarball/skia/src/gpu/effects/GrGaussianConvolutionFragmentProcessor \
    UnpackedTarball/skia/src/gpu/effects/GrMatrixConvolutionEffect \
    UnpackedTarball/skia/src/gpu/effects/GrMatrixEffect \
    UnpackedTarball/skia/src/gpu/effects/GrOvalEffect \
    UnpackedTarball/skia/src/gpu/effects/GrPorterDuffXferProcessor \
    UnpackedTarball/skia/src/gpu/effects/GrRRectEffect \
@@ -629,6 +630,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/GrProgramInfo \
    UnpackedTarball/skia/src/gpu/GrProxyProvider \
    UnpackedTarball/skia/src/gpu/GrRecordingContext \
    UnpackedTarball/skia/src/gpu/GrRectanizerPow2 \
    UnpackedTarball/skia/src/gpu/GrRectanizerSkyline \
    UnpackedTarball/skia/src/gpu/GrRenderTask \
    UnpackedTarball/skia/src/gpu/GrReducedClip \
@@ -638,6 +640,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/GrResourceAllocator \
    UnpackedTarball/skia/src/gpu/GrResourceCache \
    UnpackedTarball/skia/src/gpu/GrResourceProvider \
    UnpackedTarball/skia/src/gpu/GrRingBuffer \
    UnpackedTarball/skia/src/gpu/GrSamplePatternDictionary \
    UnpackedTarball/skia/src/gpu/GrShaderCaps \
    UnpackedTarball/skia/src/gpu/GrShaderUtils \
@@ -657,6 +660,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/GrSWMaskHelper \
    UnpackedTarball/skia/src/gpu/GrTestUtils \
    UnpackedTarball/skia/src/gpu/GrTriangulator \
    UnpackedTarball/skia/src/gpu/GrUniformDataManager \
    UnpackedTarball/skia/src/gpu/GrTextureAdjuster \
    UnpackedTarball/skia/src/gpu/GrTexture \
    UnpackedTarball/skia/src/gpu/GrTextureMaker \
@@ -677,7 +681,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/ops/GrAALinearizingConvexPathRenderer \
    UnpackedTarball/skia/src/gpu/ops/GrAtlasTextOp \
    UnpackedTarball/skia/src/gpu/ops/GrClearOp \
    UnpackedTarball/skia/src/gpu/ops/GrClearStencilClipOp \
    UnpackedTarball/skia/src/gpu/ops/GrDashLinePathRenderer \
    UnpackedTarball/skia/src/gpu/ops/GrDashOp \
    UnpackedTarball/skia/src/gpu/ops/GrDefaultPathRenderer \
@@ -708,15 +711,16 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/gpu/tessellate/GrDrawAtlasPathOp \
    UnpackedTarball/skia/src/gpu/tessellate/GrFillPathShader \
    UnpackedTarball/skia/src/gpu/tessellate/GrStencilPathShader \
    UnpackedTarball/skia/src/gpu/tessellate/GrStrokeGeometry \
    UnpackedTarball/skia/src/gpu/tessellate/GrTessellatePathOp \
    UnpackedTarball/skia/src/gpu/tessellate/GrTessellationPathRenderer \
    UnpackedTarball/skia/src/gpu/text/GrAtlasManager \
    UnpackedTarball/skia/src/gpu/text/GrDistanceFieldAdjustTable \
    UnpackedTarball/skia/src/gpu/text/GrSDFMaskFilter \
    UnpackedTarball/skia/src/gpu/text/GrSDFTOptions \
    UnpackedTarball/skia/src/gpu/text/GrStrikeCache \
    UnpackedTarball/skia/src/gpu/text/GrTextBlobCache \
    UnpackedTarball/skia/src/gpu/text/GrTextBlob \
    UnpackedTarball/skia/src/gpu/text/GrTextContext \
    UnpackedTarball/skia/src/image/SkImage_GpuBase \
    UnpackedTarball/skia/src/image/SkImage_Gpu \
    UnpackedTarball/skia/src/image/SkImage_GpuYUVA \
@@ -788,11 +792,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/opts/SkOpts_crc32 \
))

# This one needs to #define some things before #include <immintrin.h>, but the header would get introduced
# already by the PCH. Add a dummy flag to avoid PCH use.
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
    UnpackedTarball/skia/src/core/SkOpts_skx, \
    -DDUMMY_AVOID_PCH=1 \
    UnpackedTarball/skia/src/opts/SkOpts_skx, $(CXXFLAGS_INTRINSICS_AVX512)  $(CLANG_CXXFLAGS_INTRINSICS_AVX512)\
))

$(eval $(call gb_Library_add_generated_exception_objects,skia,\
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index 20b81c3..5caeff2 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -32,13 +32,13 @@ skia_patches := \
    windows-do-not-modify-logfont.patch.0 \
    windows-text-gamma.patch.0 \
    windows-force-unicode-api.patch.0 \
    operator-eq-bool.patch.0 \
    operator-eq-bool.patch.1 \
    fix-without-gl.patch.0 \
    extend-rgb-to-rgba.patch.0 \
    windows-typeface-directwrite.patch.0 \
    windows-raster-surface-no-copies.patch.1 \
    fix-windows-dwrite.patch.1 \
    c++20.patch.0 \
    public-make-from-backend-texture.patch.1 \

$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))

diff --git a/external/skia/c++20.patch.0 b/external/skia/c++20.patch.0
deleted file mode 100644
index 167c8d8..0000000
--- a/external/skia/c++20.patch.0
+++ /dev/null
@@ -1,10 +0,0 @@
--- src/core/SkVM.h
+++ src/core/SkVM.h
@@ -909,6 +909,7 @@
     static inline F32 max(float x, F32  y) { return y->max(x,y); }
 
     static inline I32 operator==(F32   x, F32a y) { return x->eq(x,y); }
+    static inline I32 operator==(F32   x, float y) { return x->eq(x,y); }
     static inline I32 operator==(float x, F32  y) { return y->eq(x,y); }
     static inline I32 eq_op(float x, F32  y) { return y->eq(x,y); }
 
diff --git a/external/skia/inc/pch/precompiled_skia.hxx b/external/skia/inc/pch/precompiled_skia.hxx
index e3d41a0..a28dd58 100644
--- a/external/skia/inc/pch/precompiled_skia.hxx
+++ b/external/skia/inc/pch/precompiled_skia.hxx
@@ -13,7 +13,7 @@
 manual changes will be rewritten by the next run of update_pch.sh (which presumably
 also fixes all possible problems, so it's usually better to use it).

 Generated on 2020-05-18 11:43:55 using:
 Generated on 2020-06-30 17:38:10 using:
 ./bin/update_pch external/skia skia --cutoff=1 --exclude:system --include:module --include:local

 If after updating build fails, use the following command to locate conflicting headers:
@@ -70,7 +70,7 @@
#include <rtl/alloc.h>
#include <sal/log.hxx>
#endif // PCH_LEVEL >= 2
#if PCH_LEVEL >= 3
// PCH_LEVEL >= 3
#include <include/c/sk_canvas.h>
#include <include/c/sk_colorspace.h>
#include <include/c/sk_data.h>
@@ -125,6 +125,7 @@
#include <include/core/SkOverdrawCanvas.h>
#include <include/core/SkPaint.h>
#include <include/core/SkPath.h>
#include <include/core/SkPathBuilder.h>
#include <include/core/SkPathEffect.h>
#include <include/core/SkPathMeasure.h>
#include <include/core/SkPicture.h>
@@ -150,6 +151,7 @@
#include <include/core/SkStrokeRec.h>
#include <include/core/SkSurface.h>
#include <include/core/SkSurfaceCharacterization.h>
#include <include/core/SkSurfaceProps.h>
#include <include/core/SkSwizzle.h>
#include <include/core/SkTextBlob.h>
#include <include/core/SkTileMode.h>
@@ -195,6 +197,7 @@
#include <include/effects/SkPictureImageFilter.h>
#include <include/effects/SkRuntimeEffect.h>
#include <include/effects/SkShaderMaskFilter.h>
#include <include/effects/SkStrokeAndFillPathEffect.h>
#include <include/effects/SkTableColorFilter.h>
#include <include/effects/SkTableMaskFilter.h>
#include <include/effects/SkTileImageFilter.h>
@@ -320,6 +323,7 @@
#include <src/core/SkClipOpPriv.h>
#include <src/core/SkClipStack.h>
#include <src/core/SkClipStackDevice.h>
#include <src/core/SkColorFilterBase.h>
#include <src/core/SkColorFilterPriv.h>
#include <src/core/SkColorFilter_Matrix.h>
#include <src/core/SkColorSpacePriv.h>
@@ -330,6 +334,7 @@
#include <src/core/SkCoverageModePriv.h>
#include <src/core/SkCpu.h>
#include <src/core/SkCubicClipper.h>
#include <src/core/SkDeferredDisplayListPriv.h>
#include <src/core/SkDescriptor.h>
#include <src/core/SkDevice.h>
#include <src/core/SkDiscardableMemory.h>
@@ -407,7 +412,6 @@
#include <src/core/SkRasterClip.h>
#include <src/core/SkRasterPipeline.h>
#include <src/core/SkReadBuffer.h>
#include <src/core/SkReader32.h>
#include <src/core/SkRecord.h>
#include <src/core/SkRecordDraw.h>
#include <src/core/SkRecordOpts.h>
@@ -480,7 +484,9 @@
#include <src/gpu/GrAppliedClip.h>
#include <src/gpu/GrAuditTrail.h>
#include <src/gpu/GrAutoLocaleSetter.h>
#include <src/gpu/GrBackendSurfaceMutableStateImpl.h>
#include <src/gpu/GrBackendTextureImageGenerator.h>
#include <src/gpu/GrBackendUtils.h>
#include <src/gpu/GrBaseContextPriv.h>
#include <src/gpu/GrBitmapTextureMaker.h>
#include <src/gpu/GrBlend.h>
@@ -547,6 +553,7 @@
#include <src/gpu/GrProgramInfo.h>
#include <src/gpu/GrProxyProvider.h>
#include <src/gpu/GrRecordingContextPriv.h>
#include <src/gpu/GrRectanizerPow2.h>
#include <src/gpu/GrRectanizerSkyline.h>
#include <src/gpu/GrReducedClip.h>
#include <src/gpu/GrRenderTarget.h>
@@ -560,11 +567,13 @@
#include <src/gpu/GrResourceCache.h>
#include <src/gpu/GrResourceProvider.h>
#include <src/gpu/GrResourceProviderPriv.h>
#include <src/gpu/GrRingBuffer.h>
#include <src/gpu/GrSPIRVUniformHandler.h>
#include <src/gpu/GrSPIRVVaryingHandler.h>
#include <src/gpu/GrSWMaskHelper.h>
#include <src/gpu/GrSamplePatternDictionary.h>
#include <src/gpu/GrSamplerState.h>
#include <src/gpu/GrScissorState.h>
#include <src/gpu/GrSemaphore.h>
#include <src/gpu/GrShaderCaps.h>
#include <src/gpu/GrShaderUtils.h>
@@ -599,6 +608,7 @@
#include <src/gpu/GrTracing.h>
#include <src/gpu/GrTransferFromRenderTask.h>
#include <src/gpu/GrTriangulator.h>
#include <src/gpu/GrUniformDataManager.h>
#include <src/gpu/GrUserStencilSettings.h>
#include <src/gpu/GrVertexWriter.h>
#include <src/gpu/GrWaitRenderTask.h>
@@ -641,6 +651,7 @@
#include <src/gpu/effects/GrDistanceFieldGeoProc.h>
#include <src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h>
#include <src/gpu/effects/GrMatrixConvolutionEffect.h>
#include <src/gpu/effects/GrMatrixEffect.h>
#include <src/gpu/effects/GrOvalEffect.h>
#include <src/gpu/effects/GrPorterDuffXferProcessor.h>
#include <src/gpu/effects/GrRRectEffect.h>
@@ -664,10 +675,8 @@
#include <src/gpu/effects/generated/GrHSLToRGBFilterEffect.h>
#include <src/gpu/effects/generated/GrLumaColorFilterEffect.h>
#include <src/gpu/effects/generated/GrMagnifierEffect.h>
#include <src/gpu/effects/generated/GrMatrixEffect.h>
#include <src/gpu/effects/generated/GrMixerEffect.h>
#include <src/gpu/effects/generated/GrOverrideInputFragmentProcessor.h>
#include <src/gpu/effects/generated/GrPremulInputFragmentProcessor.h>
#include <src/gpu/effects/generated/GrRGBToHSLFilterEffect.h>
#include <src/gpu/effects/generated/GrRRectBlurEffect.h>
#include <src/gpu/effects/generated/GrRectBlurEffect.h>
@@ -719,7 +728,6 @@
#include <src/gpu/ops/GrAALinearizingConvexPathRenderer.h>
#include <src/gpu/ops/GrAtlasTextOp.h>
#include <src/gpu/ops/GrClearOp.h>
#include <src/gpu/ops/GrClearStencilClipOp.h>
#include <src/gpu/ops/GrDashLinePathRenderer.h>
#include <src/gpu/ops/GrDashOp.h>
#include <src/gpu/ops/GrDefaultPathRenderer.h>
@@ -749,16 +757,19 @@
#include <src/gpu/tessellate/GrFillPathShader.h>
#include <src/gpu/tessellate/GrMiddleOutPolygonTriangulator.h>
#include <src/gpu/tessellate/GrMidpointContourParser.h>
#include <src/gpu/tessellate/GrResolveLevelCounter.h>
#include <src/gpu/tessellate/GrStencilPathShader.h>
#include <src/gpu/tessellate/GrStrokeGeometry.h>
#include <src/gpu/tessellate/GrTessellatePathOp.h>
#include <src/gpu/tessellate/GrTessellationPathRenderer.h>
#include <src/gpu/tessellate/GrWangsFormula.h>
#include <src/gpu/text/GrAtlasManager.h>
#include <src/gpu/text/GrDistanceFieldAdjustTable.h>
#include <src/gpu/text/GrSDFMaskFilter.h>
#include <src/gpu/text/GrSDFTOptions.h>
#include <src/gpu/text/GrStrikeCache.h>
#include <src/gpu/text/GrTextBlob.h>
#include <src/gpu/text/GrTextBlobCache.h>
#include <src/gpu/text/GrTextContext.h>
#include <src/gpu/text/GrTextTarget.h>
#include <src/gpu/vk/GrVkBuffer.h>
#include <src/gpu/vk/GrVkCaps.h>
@@ -907,6 +918,7 @@
#include <src/sksl/ir/SkSLNullLiteral.h>
#include <src/sksl/ir/SkSLPostfixExpression.h>
#include <src/sksl/ir/SkSLPrefixExpression.h>
#include <src/sksl/ir/SkSLProgram.h>
#include <src/sksl/ir/SkSLReturnStatement.h>
#include <src/sksl/ir/SkSLSection.h>
#include <src/sksl/ir/SkSLSetting.h>
@@ -941,8 +953,8 @@
#include <tools/gpu/vk/VkTestUtils.h>
#include <tools/sk_app/VulkanWindowContext.h>
#include <vulkan/vulkan_core.h>
#endif // PCH_LEVEL >= 3
#if PCH_LEVEL >= 4
#endif // PCH_LEVEL >= 4
#include <skia_compiler.hxx>
// PCH_LEVEL >= 4
// PCH_LEVEL >= 5

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/external/skia/make-api-visible.patch.1 b/external/skia/make-api-visible.patch.1
index 2bf3a0f..bb574b7 100644
--- a/external/skia/make-api-visible.patch.1
+++ b/external/skia/make-api-visible.patch.1
@@ -1,5 +1,5 @@
diff --git a/tools/sk_app/unix/WindowContextFactory_unix.h b/tools/sk_app/unix/WindowContextFactory_unix.h
index 47310970d5..e02e6eb5b7 100644
index 11bd2d2ac2..09c92dc417 100644
--- a/tools/sk_app/unix/WindowContextFactory_unix.h
+++ b/tools/sk_app/unix/WindowContextFactory_unix.h
@@ -36,15 +36,15 @@ struct XlibWindowInfo {
@@ -23,10 +23,10 @@ index 47310970d5..e02e6eb5b7 100644
 }  // namespace window_context_factory
 
diff --git a/tools/sk_app/win/WindowContextFactory_win.h b/tools/sk_app/win/WindowContextFactory_win.h
index 33dd6d413b..647e5ff81a 100644
index c05a4f0acf..fc27cd2afb 100644
--- a/tools/sk_app/win/WindowContextFactory_win.h
+++ b/tools/sk_app/win/WindowContextFactory_win.h
@@ -20,17 +20,17 @@ struct DisplayParams;
@@ -20,21 +20,21 @@ struct DisplayParams;
 
 namespace window_context_factory {
 
@@ -39,6 +39,11 @@ index 33dd6d413b..647e5ff81a 100644
-std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, const DisplayParams&);
+SK_API std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, const DisplayParams&);
 
 #ifdef SK_DIRECT3D
-std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, const DisplayParams&);
+SK_API std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, const DisplayParams&);
 #endif
 
 #ifdef SK_DAWN
-std::unique_ptr<WindowContext> MakeDawnD3D12ForWin(HWND, const DisplayParams&);
+SK_API std::unique_ptr<WindowContext> MakeDawnD3D12ForWin(HWND, const DisplayParams&);
diff --git a/external/skia/operator-eq-bool.patch.0 b/external/skia/operator-eq-bool.patch.0
deleted file mode 100644
index 1c2c77b..0000000
--- a/external/skia/operator-eq-bool.patch.0
+++ /dev/null
@@ -1,21 +0,0 @@
--- ./src/core/SkVM.cpp.sav	2020-04-06 12:42:22.976205876 +0200
+++ ./src/core/SkVM.cpp	2020-04-06 12:50:57.465941063 +0200
@@ -1162,7 +1162,7 @@ namespace skvm {
         // Map min channel to 0, max channel to s, and scale the middle proportionally.
         auto scale = [&](auto c) {
             // TODO: better to divide and check for non-finite result?
-            return select(sat == 0.0f, 0.0f
+            return select(eq_op(0.0f, sat), 0.0f
                                      , ((c - mn) * s) / sat);
         };
         *r = scale(*r);
--- ./src/core/SkVM.h.sav	2020-04-06 12:08:50.833128845 +0200
+++ ./src/core/SkVM.h	2020-04-06 12:51:13.369987701 +0200
@@ -875,6 +875,7 @@ namespace skvm {
 
     static inline I32 operator==(F32   x, F32a y) { return x->eq(x,y); }
     static inline I32 operator==(float x, F32  y) { return y->eq(x,y); }
+    static inline I32 eq_op(float x, F32  y) { return y->eq(x,y); }
 
     static inline I32 operator!=(F32   x, F32a y) { return x->neq(x,y); }
     static inline I32 operator!=(float x, F32  y) { return y->neq(x,y); }
diff --git a/external/skia/operator-eq-bool.patch.1 b/external/skia/operator-eq-bool.patch.1
new file mode 100644
index 0000000..d6dc3c1
--- /dev/null
+++ b/external/skia/operator-eq-bool.patch.1
@@ -0,0 +1,25 @@
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index 654ab8f97c..e7b3137d8e 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -1173,7 +1173,7 @@ namespace skvm {
         // Map min channel to 0, max channel to s, and scale the middle proportionally.
         auto scale = [&](auto c) {
             // TODO: better to divide and check for non-finite result?
-            return select(sat == 0.0f, 0.0f
+            return select(eq_op(0.0f, sat), 0.0f
                                      , ((c - mn) * s) / sat);
         };
         *r = scale(*r);
diff --git a/src/core/SkVM.h b/src/core/SkVM.h
index db5b273c45..5cf1ebba3c 100644
--- a/src/core/SkVM.h
+++ b/src/core/SkVM.h
@@ -882,6 +882,7 @@ namespace skvm {
     static inline I32 operator==(I32 x, I32 y) { return x->eq(x,y); }
     static inline I32 operator==(I32 x, int y) { return x->eq(x,y); }
     static inline I32 operator==(int x, I32 y) { return y->eq(x,y); }
+    static inline I32 eq_op(float x, F32  y) { return y->eq(x,y); }
 
     static inline I32 operator!=(I32 x, I32 y) { return x->neq(x,y); }
     static inline I32 operator!=(I32 x, int y) { return x->neq(x,y); }
diff --git a/external/skia/public-make-from-backend-texture.patch.1 b/external/skia/public-make-from-backend-texture.patch.1
new file mode 100644
index 0000000..7543ff8
--- /dev/null
+++ b/external/skia/public-make-from-backend-texture.patch.1
@@ -0,0 +1,44 @@
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index bf151c05de..95e84022d4 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -243,7 +243,7 @@ public:
                                                 RenderTargetReleaseProc releaseProc = nullptr,
                                                 ReleaseContext releaseContext = nullptr);
 
-#if GR_TEST_UTILS
+//#if GR_TEST_UTILS
     // TODO: Remove this.
     static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context,
                                                             const GrBackendTexture& backendTexture,
@@ -252,7 +252,7 @@ public:
                                                             SkColorType colorType,
                                                             sk_sp<SkColorSpace> colorSpace,
                                                             const SkSurfaceProps* surfaceProps);
-#endif
+//#endif
 
 #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
     /** Private.
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 87c7a81b16..1842487030 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -666,7 +666,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
     return sk_make_sp<SkSurface_Gpu>(std::move(device));
 }
 
-#if GR_TEST_UTILS
+//#if GR_TEST_UTILS
 sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
                                                                  const GrBackendTexture& tex,
                                                                  GrSurfaceOrigin origin,
@@ -700,7 +700,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
     }
     return sk_make_sp<SkSurface_Gpu>(std::move(device));
 }
-#endif
+//#endif
 
 #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
 sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
diff --git a/external/skia/share-grcontext.patch.1 b/external/skia/share-grcontext.patch.1
index a6d815d..1c7da21 100644
--- a/external/skia/share-grcontext.patch.1
+++ b/external/skia/share-grcontext.patch.1
@@ -1,5 +1,5 @@
diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp
index c2b26b4254..fe1afd30a1 100644
index 970c67ec0c..371bd8ab0c 100644
--- a/tools/sk_app/VulkanWindowContext.cpp
+++ b/tools/sk_app/VulkanWindowContext.cpp
@@ -24,8 +24,10 @@
@@ -228,11 +228,11 @@ index c2b26b4254..fe1afd30a1 100644
+        fDestroySwapchainKHR(fShared->fDevice, swapchainCreateInfo.oldSwapchain, nullptr);
     }
 
     this->createBuffers(swapchainCreateInfo.imageFormat, colorType);
@@ -323,10 +340,10 @@ bool VulkanWindowContext::createSwapchain(int width, int height,
 }
     this->createBuffers(swapchainCreateInfo.imageFormat, colorType,
@@ -325,10 +342,10 @@ bool VulkanWindowContext::createSwapchain(int width, int height,
 
 void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType) {
 void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType,
                                         VkSharingMode sharingMode) {
-    fGetSwapchainImagesKHR(fDevice, fSwapchain, &fImageCount, nullptr);
+    fGetSwapchainImagesKHR(fShared->fDevice, fSwapchain, &fImageCount, nullptr);
     SkASSERT(fImageCount);
@@ -242,16 +242,16 @@ index c2b26b4254..fe1afd30a1 100644
 
     // set up initial image layouts and create surfaces
     fImageLayouts = new VkImageLayout[fImageCount];
@@ -341,7 +358,7 @@ void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType)
@@ -343,7 +360,7 @@ void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType,
         info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
         info.fFormat = format;
         info.fLevelCount = 1;
-        info.fCurrentQueueFamily = fPresentQueueIndex;
+        info.fCurrentQueueFamily = fShared->fPresentQueueIndex;
         info.fSharingMode = sharingMode;
 
         if (fSampleCount == 1) {
             GrBackendRenderTarget backendRT(fWidth, fHeight, fSampleCount, info);
@@ -372,8 +389,8 @@ void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType)
@@ -375,8 +392,8 @@ void VulkanWindowContext::createBuffers(VkFormat format, SkColorType colorType,
     fBackbuffers = new BackbufferInfo[fImageCount + 1];
     for (uint32_t i = 0; i < fImageCount + 1; ++i) {
         fBackbuffers[i].fImageIndex = -1;
@@ -262,7 +262,7 @@ index c2b26b4254..fe1afd30a1 100644
                                 &fBackbuffers[i].fRenderSemaphore));
         SkASSERT(result == VK_SUCCESS);
     }
@@ -385,8 +402,8 @@ void VulkanWindowContext::destroyBuffers() {
@@ -388,8 +405,8 @@ void VulkanWindowContext::destroyBuffers() {
     if (fBackbuffers) {
         for (uint32_t i = 0; i < fImageCount + 1; ++i) {
             fBackbuffers[i].fImageIndex = -1;
@@ -273,7 +273,7 @@ index c2b26b4254..fe1afd30a1 100644
                                         fBackbuffers[i].fRenderSemaphore,
                                         nullptr));
         }
@@ -411,41 +428,59 @@ VulkanWindowContext::~VulkanWindowContext() {
@@ -414,41 +431,59 @@ VulkanWindowContext::~VulkanWindowContext() {
 void VulkanWindowContext::destroyContext() {
     if (this->isValid()) {
         fQueueWaitIdle(fPresentQueue);
@@ -346,7 +346,7 @@ index c2b26b4254..fe1afd30a1 100644
 }
 
 VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer() {
@@ -471,35 +506,35 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
@@ -474,35 +509,35 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
     semaphoreInfo.pNext = nullptr;
     semaphoreInfo.flags = 0;
     VkSemaphore semaphore;
@@ -388,7 +388,16 @@ index c2b26b4254..fe1afd30a1 100644
             return nullptr;
         }
     }
@@ -543,4 +578,6 @@ void VulkanWindowContext::swapBuffers() {
@@ -528,7 +563,7 @@ void VulkanWindowContext::swapBuffers() {
     GrFlushInfo info;
     info.fNumSemaphores = 1;
     info.fSignalSemaphores = &beSemaphore;
-    GrBackendSurfaceMutableState presentState(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, fPresentQueueIndex);
+    GrBackendSurfaceMutableState presentState(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, fShared->fPresentQueueIndex);
     surface->flush(info, &presentState);
     surface->getContext()->submit();
 
@@ -548,4 +583,6 @@ void VulkanWindowContext::swapBuffers() {
     fQueuePresentKHR(fPresentQueue, &presentInfo);
 }
 
@@ -396,7 +405,7 @@ index c2b26b4254..fe1afd30a1 100644
+
 }   //namespace sk_app
diff --git a/tools/sk_app/VulkanWindowContext.h b/tools/sk_app/VulkanWindowContext.h
index 2db9e79ae6..aa48fc2951 100644
index 5e245aff70..c6c866372f 100644
--- a/tools/sk_app/VulkanWindowContext.h
+++ b/tools/sk_app/VulkanWindowContext.h
@@ -19,18 +19,36 @@
@@ -455,7 +464,7 @@ index 2db9e79ae6..aa48fc2951 100644
     struct BackbufferInfo {
         uint32_t        fImageIndex;          // image this is associated with
@@ -64,11 +88,6 @@ private:
     void createBuffers(VkFormat format, SkColorType colorType);
     void createBuffers(VkFormat format, SkColorType colorType, VkSharingMode);
     void destroyBuffers();
 
-    VkInstance fInstance = VK_NULL_HANDLE;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 2f308ad..12a06b2 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -361,7 +361,7 @@ void SkiaSalGraphicsImpl::destroySurface()
    // commands referring to the surface data. This is probably a Skia bug,
    // but work around it here.
    if (mSurface)
        mSurface->flush();
        mSurface->flushAndSubmit();
    mSurface.reset();
    mWindowContext.reset();
    mIsGPU = false;
@@ -444,7 +444,7 @@ void SkiaSalGraphicsImpl::flushDrawing()
    checkPendingDrawing();
    if (mXorMode)
        applyXor();
    mSurface->flush();
    mSurface->flushAndSubmit();
}

bool SkiaSalGraphicsImpl::setClipRegion(const vcl::Region& region)
@@ -827,7 +827,7 @@ void SkiaSalGraphicsImpl::performDrawPolyPolygon(const basegfx::B2DPolyPolygon& 
    // only on Linux (not Windows on the same machine), with both AMDGPU and Mesa,
    // and only when antialiasing is enabled. Flushing seems to avoid the problem.
    if (useAA && SkiaHelper::getVendor() == DriverBlocklist::VendorAMD)
        mSurface->flush();
        mSurface->flushAndSubmit();
#endif
}

diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index 6e3e99e..a4cbe06 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -277,7 +277,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsMaskImage() const
    // The data we got is upside-down.
    SkMatrix matrix;
    matrix.preTranslate(0, maRects.mnSrcHeight);
    matrix.setConcat(matrix, SkMatrix::MakeScale(1, -1));
    matrix.setConcat(matrix, SkMatrix::Scale(1, -1));
    canvas8.concat(matrix);
    canvas8.drawBitmap(tmpBitmap, 0, 0, &paint8);
    bitmap8.setImmutable();
@@ -307,7 +307,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImage() const
    // The data we got is upside-down.
    SkMatrix matrix;
    matrix.preTranslate(0, maRects.mnSrcHeight);
    matrix.setConcat(matrix, SkMatrix::MakeScale(1, -1));
    matrix.setConcat(matrix, SkMatrix::Scale(1, -1));
    canvas->concat(matrix);
    canvas->drawBitmapRect(tmpBitmap,
                           SkRect::MakeXYWH(0, 0, maRects.mnSrcWidth, maRects.mnSrcHeight),
@@ -358,7 +358,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImageDiff(const SkiaCompatibleDC& white) c
    // The data we got is upside-down.
    SkMatrix matrix;
    matrix.preTranslate(0, tmpBitmap.height());
    matrix.setConcat(matrix, SkMatrix::MakeScale(1, -1));
    matrix.setConcat(matrix, SkMatrix::Scale(1, -1));
    canvas->concat(matrix);
    canvas->drawBitmap(tmpBitmap, 0, 0, &paint);
    canvas->restore();