vcl/skia/salbmp.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit e4821ce3e0eb814f8942b9451183b4589e901ec3
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Fri Nov 3 09:13:22 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Fri Nov 3 18:33:23 2023 +0100

    tdf#158014 make image immutable after using Skia to invert
    
    I can't explain why inverting using Skia causes this bug on
    macOS but not other platforms. My guess is that Skia on macOS
    is sharing some data when different SkiaSalBitmap instances
    are created from the same OutputDevice. So, mark this
    SkiaSalBitmap instance's image as immutable so that successive
    inversions are done with buffered bitmap data instead of Skia.
    
    Change-Id: I8acf90561c48edba14a5f43d16f375f15f25820c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158880
    Reviewed-by: Patrick Luby <plub...@neooffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index ea5430abdf53..f82833881470 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -688,6 +688,18 @@ bool SkiaSalBitmap::Invert()
                                        paint);
         ResetToSkImage(makeCheckedImageSnapshot(surface));
         DataChanged();
+
+#ifdef MACOSX
+        // tdf#158014 make image immutable after using Skia to invert
+        // I can't explain why inverting using Skia causes this bug on
+        // macOS but not other platforms. My guess is that Skia on macOS
+        // is sharing some data when different SkiaSalBitmap instances
+        // are created from the same OutputDevice. So, mark this
+        // SkiaSalBitmap instance's image as immutable so that successive
+        // inversions are done with buffered bitmap data instead of Skia.
+        mImageImmutable = true;
+#endif
+
         SAL_INFO("vcl.skia.trace", "invert(" << this << ")");
         return true;
     }

Reply via email to