summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Luby <plubius@neooffice.org>2023-11-03 09:13:22 -0400
committerPatrick Luby <plubius@neooffice.org>2023-11-03 18:33:23 +0100
commite4821ce3e0eb814f8942b9451183b4589e901ec3 (patch)
treeee3791553ea1e5cef814bdbd97f6b49ecf4cc3d2
parent2a5dac6d75b346a77652dec05cafa6562177d40f (diff)
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 <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
-rw-r--r--vcl/skia/salbmp.cxx12
1 files changed, 12 insertions, 0 deletions
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;
}