summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-10-08 15:58:21 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-10-09 11:08:14 +0200
commitf62846d54ef9d4eb447cf405b74b6f47599d6d69 (patch)
treef24289bd596711d1654a7b4eded4eefda3fd79cb /vcl
parentb69ea390ff475f58b8f0da3abf0c158021aba4d2 (diff)
32bpp SKIA_USE_BITMAP32 bitmaps always need kPremul_SkAlphaType
I'm not sure if kOpaque_SkAlphaType would guarantee 255 in the alpha, so better be safe. This should be a rare case anyway. Change-Id: Iadec97a83621403a56f62ac07e238d8e98a3a905 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104090 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/salbmp.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 531c9661be64..d1cd76b61d5f 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -995,18 +995,18 @@ void SkiaSalBitmap::EnsureBitmapData()
// Try to fill mBuffer from mImage.
assert(mImage->colorType() == kN32_SkColorType);
SkiaZone zone;
- // Use kUnpremul_SkAlphaType to make Skia convert from premultiplied alpha when reading
- // from the SkImage, in case there is any alpha involved. If converting to bpp<32 formats,
- // we will ignore the alpha when converting to mBuffer. Unless bpp==32 and SKIA_USE_BITMAP32,
- // in which case keep the format, since SKIA_USE_BITMAP32 implies premultiplied alpha.
+ // If the source image has no alpha, then use no alpha (faster to convert), otherwise
+ // use kUnpremul_SkAlphaType to make Skia convert from premultiplied alpha when reading
+ // from the SkImage (the alpha will be ignored if converting to bpp<32 formats, but
+ // the color channels must be unpremultiplied. Unless bpp==32 and SKIA_USE_BITMAP32,
+ // in which case use kPremul_SkAlphaType, since SKIA_USE_BITMAP32 implies premultiplied alpha.
SkAlphaType alphaType = kUnpremul_SkAlphaType;
+ if (mImage->imageInfo().alphaType() == kOpaque_SkAlphaType)
+ alphaType = kOpaque_SkAlphaType;
#if SKIA_USE_BITMAP32
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();