[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 2 10:53:24 UTC 2020
vcl/skia/gdiimpl.cxx | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
New commits:
commit 266a0b3862734638a824e571fdc7c316eab1ac1e
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat Jun 27 08:09:52 2020 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 2 12:52:50 2020 +0200
cache raster scaling also in Skia's drawAlphaBitmap()
Change-Id: I52849097267326cb362b113241179a766d286a6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97273
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit 172b9142194699d0e847703b0e0cfcabcb1de1ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97292
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 8bfa4cf4e746..78aa2c4c39fe 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1336,11 +1336,23 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
assert(dynamic_cast<const SkiaSalBitmap*>(&rAlphaBitmap));
// In raster mode use mergeCacheBitmaps(), which will cache the result, avoiding repeated
// alpha blending or scaling. In GPU mode it is simpler to just use SkShader.
- sk_sp<SkImage> image = mergeCacheBitmaps(static_cast<const SkiaSalBitmap&>(rSourceBitmap),
- static_cast<const SkiaSalBitmap*>(&rAlphaBitmap),
- rSourceBitmap.GetSize());
+ SalTwoRect imagePosAry(rPosAry);
+ Size imageSize = rSourceBitmap.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 == rSourceBitmap.GetSize().Width()
+ && rPosAry.mnSrcHeight == rSourceBitmap.GetSize().Height())
+ {
+ imagePosAry.mnSrcWidth = imagePosAry.mnDestWidth;
+ imagePosAry.mnSrcHeight = imagePosAry.mnDestHeight;
+ imageSize = Size(imagePosAry.mnSrcWidth, imagePosAry.mnSrcHeight);
+ }
+ sk_sp<SkImage> image
+ = mergeCacheBitmaps(static_cast<const SkiaSalBitmap&>(rSourceBitmap),
+ static_cast<const SkiaSalBitmap*>(&rAlphaBitmap), imageSize);
if (image)
- drawImage(rPosAry, image);
+ drawImage(imagePosAry, image);
else
drawShader(
rPosAry,
More information about the Libreoffice-commits
mailing list