[Libreoffice-commits] core.git: canvas/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 19 13:25:09 UTC 2020
canvas/source/vcl/spritehelper.cxx | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit c530c1b3e01015f551dd6737ef2dc0e661458310
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Feb 17 16:07:15 2020 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Feb 19 14:24:27 2020 +0100
avoid pointless alpha->mask conversion
The code is from 2008, so I'm rather sure at least Skia is modern
enough to handle alpha at least as well as a mask (if not better).
Change-Id: Ic53d5740978bce106506a182100eba927a419257
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89010
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx
index 29ec50b63ccf..5bad0ae9697d 100644
--- a/canvas/source/vcl/spritehelper.cxx
+++ b/canvas/source/vcl/spritehelper.cxx
@@ -148,8 +148,14 @@ namespace vclcanvas
// bitmasks are much faster than alphamasks on some platforms
// so convert to bitmask if useful
-#ifndef MACOSX
- if( aMask.GetBitCount() != 1 )
+ bool convertTo1Bpp = aMask.GetBitCount() != 1;
+#ifdef MACOSX
+ convertTo1Bpp = false;
+#endif
+ if( SkiaHelper::isVCLSkiaEnabled())
+ convertTo1Bpp = false;
+
+ if( convertTo1Bpp )
{
OSL_FAIL("CanvasCustomSprite::redraw(): Mask bitmap is not "
"monochrome (performance!)");
@@ -157,12 +163,14 @@ namespace vclcanvas
BitmapFilter::Filter(aMaskEx, BitmapMonochromeFilter(255));
aMask = aMaskEx.GetBitmap();
}
-#endif
// Note: since we retrieved aBmp and aMask
// directly from an OutDev, it's already a
// 'display bitmap' on windows.
- maContent = BitmapEx( aBmp.GetBitmap(), aMask.GetBitmap() );
+ if( aMask.GetBitCount() == 1 )
+ maContent = BitmapEx( aBmp.GetBitmap(), aMask.GetBitmap() );
+ else
+ maContent = BitmapEx( aBmp.GetBitmap(), AlphaMask( aMask.GetBitmap()) );
}
}
More information about the Libreoffice-commits
mailing list