summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-15 20:07:51 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-11-16 10:40:00 +0100
commit07e5e9f4c4318c19dd553459132efa71d456eaef (patch)
treef97b978a8e329d5795af76c111a4316d9bf5d54d /vcl
parent6792e6e5e49d11a54256b75c4c5a476bb2f10b4a (diff)
don't bother caching bitmaps that prefer shaders
Change-Id: Ibc78371f9e2ba92470714847bb6a5b8b96d1037f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125264 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/gdiimpl.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index de1e8c47cb12..b97d2f28c428 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1611,6 +1611,9 @@ sk_sp<SkImage> SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma
return image;
if (alphaBitmap && alphaBitmap->IsFullyOpaqueAsAlpha())
alphaBitmap = nullptr; // the alpha can be ignored
+ if (bitmap.PreferSkShader() && (!alphaBitmap || alphaBitmap->PreferSkShader()))
+ return image;
+
// Probably not much point in caching of just doing a copy.
if (alphaBitmap == nullptr && targetSize == bitmap.GetSize())
return image;
@@ -1730,7 +1733,8 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
= mergeCacheBitmaps(rSkiaSourceBitmap, &rSkiaAlphaBitmap, imageSize * mScaling);
if (image)
drawImage(imagePosAry, image, mScaling);
- else if (rSkiaAlphaBitmap.IsFullyOpaqueAsAlpha()) // alpha can be ignored
+ else if (rSkiaAlphaBitmap.IsFullyOpaqueAsAlpha()
+ && !rSkiaSourceBitmap.PreferSkShader()) // alpha can be ignored
drawBitmap(rPosAry, rSkiaSourceBitmap);
else
drawShader(rPosAry,
@@ -1744,11 +1748,6 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkiaSalBitmap& bitmap,
SkBlendMode blendMode)
{
- if (bitmap.PreferSkShader())
- {
- drawShader(rPosAry, bitmap.GetSkShader(makeSamplingOptions(rPosAry, mScaling)), blendMode);
- return;
- }
// Use mergeCacheBitmaps(), which may decide to cache the result, avoiding repeated
// scaling.
SalTwoRect imagePosAry(rPosAry);
@@ -1766,6 +1765,8 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkiaSalBit
sk_sp<SkImage> image = mergeCacheBitmaps(bitmap, nullptr, imageSize * mScaling);
if (image)
drawImage(imagePosAry, image, mScaling, blendMode);
+ else if (bitmap.PreferSkShader())
+ drawShader(rPosAry, bitmap.GetSkShader(makeSamplingOptions(rPosAry, mScaling)), blendMode);
else
drawImage(rPosAry, bitmap.GetSkImage(), 1, blendMode);
}