diff options
author | Patrick Luby <plubius@neooffice.org> | 2023-08-10 16:25:11 -0400 |
---|---|---|
committer | Patrick Luby <plubius@neooffice.org> | 2023-08-13 19:46:13 +0200 |
commit | 926c5246b6694d469a6caed5d7ea4c3a68648468 (patch) | |
tree | 6e6597b2c4105389ddf1cfbc72daaee3407a0d3b /vcl/skia/salbmp.cxx | |
parent | 2bda87fd8758448267c447ba26f1932325a1338d (diff) |
Related tdf#156630 and tdf#156629 force snapshot of alpha mask
On macOS, with Skia/Metal or Skia/Raster with a Retina display
(i.e. 2.0 window scale), the alpha mask gets upscaled in certain
cases.
This bug appears to be caused by pending scaling of an existing
SkImage in the bitmap parameter. So, force the SkiaSalBitmap to
handle its pending scaling.
This change consolidates the three duplicate fixes added in the
following commits into the AlphaMask(const Bitmap&) constructor.
commit 12fd870113a663dde5ceb38c61f1986a34095d0e
commit ce2d9f5dd4b6a26847c4779bce4866d969ff4400
From my light testing, the bitmap's SkImage is not scaled except
when running macOS with a Retina display. The only exception is
that this fix will be triggered on all platforms when exporting
to PDF images with an alpha mask.
Change-Id: Iea5afd55aac984ca606b2b4b44e457d81d76fac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155568
Tested-by: Jenkins
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Diffstat (limited to 'vcl/skia/salbmp.cxx')
-rw-r--r-- | vcl/skia/salbmp.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx index 8e07a00ec2d2..b5da2e4bd432 100644 --- a/vcl/skia/salbmp.cxx +++ b/vcl/skia/salbmp.cxx @@ -224,6 +224,20 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode) assert(!mEraseColorSet); break; case BitmapAccessMode::Info: + // Related tdf#156630 and tdf#156629 force snapshot of alpha mask + // On macOS, with Skia/Metal or Skia/Raster with a Retina display + // (i.e. 2.0 window scale), the alpha mask gets upscaled in certain + // cases. + // This bug appears to be caused by pending scaling of an existing + // SkImage in the bitmap parameter. So, force the SkiaSalBitmap to + // handle its pending scaling. + // Note: also handle pending scaling if SAL_FORCE_HIDPI_SCALING is + // set otherwise exporting the following animated .png image will + // fail: + // https://bugs.documentfoundation.org/attachment.cgi?id=188792 + if ((mPixelsSize != mSize || getenv("SAL_FORCE_HIDPI_SCALING")) && mImage) + EnsureBitmapData(); + assert(mPixelsSize == mSize); break; } #ifdef DBG_UTIL |