summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-30 14:13:53 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-11-30 15:44:11 +0100
commitafdfc9bb5d56fde866882e7d87869ecafed1e3d0 (patch)
treebb3d10fb079ae891857c1857acafc207a83f156e /vcl
parentc30bad79fad6b7d046b71fc35bc9ecc03b590bce (diff)
handle Skia not drawing GPU-backend shader to a bitmap (tdf#145797)
https: //bugs.chromium.org/p/skia/issues/detail?id=12685 Change-Id: I4de51b154e270df470102c357c25bdfa430a4488 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126118 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/osx/bitmap.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/vcl/skia/osx/bitmap.cxx b/vcl/skia/osx/bitmap.cxx
index 77e34697aa50..16d32191a627 100644
--- a/vcl/skia/osx/bitmap.cxx
+++ b/vcl/skia/osx/bitmap.cxx
@@ -66,9 +66,18 @@ CGImageRef createCGImage(const Image& rImage)
assert(dynamic_cast<SkiaSalBitmap*>(alphaBitmap.ImplGetSalBitmap().get()) != nullptr);
SkiaSalBitmap* skiaAlpha
= static_cast<SkiaSalBitmap*>(alphaBitmap.ImplGetSalBitmap().get());
+#if 0
+ // Drawing to a bitmap using a shader from a GPU-backed image fails silently.
+ // https://bugs.chromium.org/p/skia/issues/detail?id=12685
paint.setShader(SkShaders::Blend(SkBlendMode::kDstOut,
skiaBitmap->GetSkShader(SkSamplingOptions()),
skiaAlpha->GetAlphaSkShader(SkSamplingOptions())));
+#else
+ sk_sp<SkImage> imB = skiaBitmap->GetSkImage()->makeNonTextureImage();
+ sk_sp<SkImage> imA = skiaAlpha->GetAlphaSkImage()->makeNonTextureImage();
+ paint.setShader(SkShaders::Blend(SkBlendMode::kDstOut, imB->makeShader(SkSamplingOptions()),
+ imA->makeShader(SkSamplingOptions())));
+#endif
SkCanvas canvas(targetBitmap);
canvas.concat(matrix);
canvas.drawPaint(paint);