vcl/skia/salbmp.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit f62846d54ef9d4eb447cf405b74b6f47599d6d69
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Oct 8 15:58:21 2020 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Fri Oct 9 11:08:14 2020 +0200

    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.lu...@collabora.com>

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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to