summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-10-06 21:31:02 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-10-07 16:17:58 +0200
commit6456ffec9d2082cc61d4ae60cad99e3c4ebfe82d (patch)
treef41d2f336e8e431e84a7286082a45e3039556ade
parentc356f669e294ca978e9a41e1e8e7ccbb4e9a1a09 (diff)
faster Skia from-image conversions if no alpha is involved
Skia's drawImage() is faster if alpha types match. So if the source is opaque, use that and not unpremultiplied alpha (which is technically the same if no alpha is involved, but it leads to a slower path). Change-Id: Ie55eaa55099a9a4c9e6db1e66e212da0acef71f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104043 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--vcl/skia/salbmp.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 24f955891e05..bbf1e6f0670e 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -995,6 +995,9 @@ void SkiaSalBitmap::EnsureBitmapData()
if (mBitCount == 32)
alphaType = kPremul_SkAlphaType;
#endif
+ // But if the source image has no alpha, then use no alpha (faster to convert).
+ if (mImage->imageInfo().alphaType() == kOpaque_SkAlphaType)
+ alphaType = kOpaque_SkAlphaType;
SkBitmap bitmap;
if (!bitmap.tryAllocPixels(SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), alphaType)))
abort();