summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-02-17 16:07:15 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-02-19 14:24:27 +0100
commitc530c1b3e01015f551dd6737ef2dc0e661458310 (patch)
tree572895374a94bc0b1d785b1413262a391e060265 /canvas
parent6453e424f6da3a45745746fac1e8d8e5fb7c7538 (diff)
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@collabora.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/vcl/spritehelper.cxx16
1 files changed, 12 insertions, 4 deletions
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()) );
}
}