vcl/source/app/salvtables.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit ce2d9f5dd4b6a26847c4779bce4866d969ff4400
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Thu Aug 10 11:59:48 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Thu Aug 10 19:39:56 2023 +0200

    Related tdf#156629 force snapshot of alpha mask
    
    On macOS, with Skia/Metal with a Retina display (i.e. 2.0 window
    scale), the alpha mask gets upscaled for the font color and the
    character background color icons in Writer's properties sidebar
    with most icon sets. The Breeze and Colibre icon sets running in
    light mode are the most obvious cases.
    
    This bug appears to be caused by asynchronous rendering of the
    returned image. So, we force a copy of the alpha mask in case it
    changes before the image is actually drawn.
    
    Change-Id: Ie3aa3b26acaee4bd9173e6b356137980c070c7c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155562
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f5275eb5c68e..80772536adeb 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -861,7 +861,21 @@ Image createImage(const OUString& rImage)
 
 Image createImage(const VirtualDevice& rDevice)
 {
-    return Image(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel()));
+    BitmapEx aBitmapEx(rDevice.GetBitmapEx(Point(), 
rDevice.GetOutputSizePixel()));
+
+    // Related tdf#156629 force snapshot of alpha mask
+    // On macOS, with Skia/Metal with a Retina display (i.e. 2.0 window
+    // scale), the alpha mask gets upscaled for the font color and the
+    // character background color icons in Writer's properties sidebar
+    // with most icon sets. The Breeze and Colibre icon sets running in
+    // light mode are the most obvious cases.
+    // This bug appears to be caused by asynchronous rendering of the
+    // returned image. So, we force a copy of the alpha mask in case it
+    // changes before the image is actually drawn.
+    AlphaMask aAlphaMask(aBitmapEx.GetAlphaMask());
+    AlphaMask::ScopedReadAccess pAccessAlpha(aAlphaMask);
+
+    return Image(BitmapEx(aBitmapEx.GetBitmap(), aAlphaMask));
 }
 
 sal_uInt16 insert_to_menu(sal_uInt16 nLastId, PopupMenu* pMenu, int pos, const 
OUString& rId,

Reply via email to