[Libreoffice-commits] core.git: vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 21 14:33:11 UTC 2020
vcl/skia/SkiaHelper.cxx | 3 ++-
vcl/skia/gdiimpl.cxx | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit d14ed4c3365605060a4b8a72946dd27910cecdc4
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu May 21 15:33:11 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 21 16:32:31 2020 +0200
fix image caching in Skia (tdf#133215)
The image size should be part of the key.
Change-Id: I615e5d99ec347941fa06655b89902f3db84aef22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94634
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index aab6560b2554..3331cb7cb2b4 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -489,7 +489,8 @@ sk_sp<SkImage> findCachedImage(const OString& key)
if (it->key == key)
{
sk_sp<SkImage> ret = it->image;
- SAL_INFO("vcl.skia.trace", "findcachedimage " << it->image << " found");
+ SAL_INFO("vcl.skia.trace",
+ "findcachedimage " << key << " : " << it->image << " found");
imageCache->splice(imageCache->begin(), *imageCache, it);
return ret;
}
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index fdb1efc2d55f..051243ad2a8d 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1276,7 +1276,10 @@ static sk_sp<SkImage> mergeBitmaps(const SkiaSalBitmap& bitmap, const SkiaSalBit
if (!blockCaching)
{
OStringBuffer keyBuf;
- keyBuf.append("0x")
+ keyBuf.append(targetSize.Width())
+ .append("x")
+ .append(targetSize.Height())
+ .append("_0x")
.append(reinterpret_cast<sal_IntPtr>(&bitmap), 16)
.append("_0x")
.append(reinterpret_cast<sal_IntPtr>(alphaBitmap), 16)
@@ -1288,7 +1291,10 @@ static sk_sp<SkImage> mergeBitmaps(const SkiaSalBitmap& bitmap, const SkiaSalBit
key = keyBuf.makeStringAndClear();
image = SkiaHelper::findCachedImage(key);
if (image)
+ {
+ assert(image->width() == targetSize.Width() && image->height() == targetSize.Height());
return image;
+ }
}
// Combine bitmap + alpha bitmap into one temporary bitmap with alpha.
// If scaling is needed, first apply the alpha, then scale, otherwise the scaling might affect the alpha values.
More information about the Libreoffice-commits
mailing list