[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 28 10:56:47 UTC 2020
vcl/skia/gdiimpl.cxx | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
New commits:
commit 531693b437dd15d76ac0aa76992d647f6bbee1a9
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 20 11:40:13 2020 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Nov 28 11:56:14 2020 +0100
cache one more place when drawing Skia images
Change-Id: I845dc8524c95676a25153be62b15553cdf57c8ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106786
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit a66a3c3c55f6e338bc9cc0a3b71136786a71f1e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106746
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index c7035e7d3de7..ee2e72889152 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1664,7 +1664,27 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkiaSalBit
SkBlendMode blendMode)
{
if (bitmap.PreferSkShader())
+ {
drawShader(rPosAry, bitmap.GetSkShader(), blendMode);
+ return;
+ }
+ // In raster mode use mergeCacheBitmaps(), which will cache the result, avoiding repeated
+ // scaling. In GPU mode it is simpler to just use SkShader.
+ SalTwoRect imagePosAry(rPosAry);
+ Size imageSize = bitmap.GetSize();
+ // If the bitmap will be scaled, prefer to do it in mergeCacheBitmaps(), if possible.
+ if ((rPosAry.mnSrcWidth != rPosAry.mnDestWidth || rPosAry.mnSrcHeight != rPosAry.mnDestHeight)
+ && rPosAry.mnSrcX == 0 && rPosAry.mnSrcY == 0
+ && rPosAry.mnSrcWidth == bitmap.GetSize().Width()
+ && rPosAry.mnSrcHeight == bitmap.GetSize().Height())
+ {
+ imagePosAry.mnSrcWidth = imagePosAry.mnDestWidth;
+ imagePosAry.mnSrcHeight = imagePosAry.mnDestHeight;
+ imageSize = Size(imagePosAry.mnSrcWidth, imagePosAry.mnSrcHeight);
+ }
+ sk_sp<SkImage> image = mergeCacheBitmaps(bitmap, nullptr, imageSize);
+ if (image)
+ drawImage(imagePosAry, image, blendMode);
else
drawImage(rPosAry, bitmap.GetSkImage(), blendMode);
}
More information about the Libreoffice-commits
mailing list