external/skia: C++20 comparison operator fix

Missing const leads to overload resolution ambiguity when a synthesized
candidate of operator == for a reversed-argument rewrite conflicts with the
actual operator ==, due to the asymmetric const-ness of the implicit object
parameter and the RHS parameter:

> In file included from workdir/UnpackedTarball/skia/src/shaders/SkLightingShader.cpp:15:
> In file included from workdir/UnpackedTarball/skia/src/core/SkReadBuffer.h:13:
> In file included from workdir/UnpackedTarball/skia/include/core/SkFont.h:13:
> In file included from workdir/UnpackedTarball/skia/include/core/SkTypeface.h:16:
> In file included from workdir/UnpackedTarball/skia/include/core/SkString.h:15:
> workdir/UnpackedTarball/skia/include/private/SkTArray.h:389:35: error: use of overloaded operator '!=' is ambiguous (with operand types 'SkLights::Light' and 'SkLights::Light')
>             if (fItemArray[index] != right.fItemArray[index]) {
>                 ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
> workdir/UnpackedTarball/skia/src/shaders/SkLightingShader.cpp:268:35: note: in instantiation of member function 'SkTArray<SkLights::Light, false>::operator==' requested here
>         return fDirectionalLights == lightingFP.fDirectionalLights &&
>                                   ^
> workdir/UnpackedTarball/skia/src/shaders/SkLights.h:90:14: note: candidate function
>         bool operator!=(const Light& other) { return !(this->operator==(other)); }
>              ^
> workdir/UnpackedTarball/skia/src/shaders/SkLights.h:83:14: note: candidate function
>         bool operator==(const Light& other) {
>              ^
> workdir/UnpackedTarball/skia/src/shaders/SkLights.h:83:14: note: candidate function (with reversed parameter order)

Change-Id: I61b28e191b36f84df6920b4143809d1f497b9113
Reviewed-on: https://gerrit.libreoffice.org/83900
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Michael Stahl <michael.stahl@cib.de>
This commit is contained in:
Stephan Bergmann 2019-11-27 12:48:08 +01:00 committed by Michael Stahl
parent ba7ecfabfe
commit 59ef53fb95
2 changed files with 21 additions and 1 deletions

View file

@ -21,7 +21,8 @@ skia_patches := \
no-trace-resources-on-exit.patch.1 \
fix-alpha-difference-copy.patch.1 \
libvulkan-name.patch.1 \
share-grcontext.patch.1
share-grcontext.patch.1 \
c++20-comparison.patch.0 \
$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))

19
external/skia/c++20-comparison.patch.0 vendored Normal file
View file

@ -0,0 +1,19 @@
--- src/shaders/SkLights.h
+++ src/shaders/SkLights.h
@@ -80,14 +80,14 @@
return *this;
}
- bool operator==(const Light& other) {
+ bool operator==(const Light& other) const {
return (fType == other.fType) &&
(fColor == other.fColor) &&
(fDirOrPos == other.fDirOrPos) &&
(fIntensity == other.fIntensity);
}
- bool operator!=(const Light& other) { return !(this->operator==(other)); }
+ bool operator!=(const Light& other) const { return !(this->operator==(other)); }
private:
friend class SkLights;