diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-05 17:31:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-06 10:09:01 +0200 |
commit | 966a51dfc63e2a783282dfd0379bf5c987b1e136 (patch) | |
tree | 8ace17f60c22eaef42c5a4bc56e46d61031bc29b /vcl/unx | |
parent | 00df1cd5d663216cf59465d3c6c23dafd0de6f81 (diff) |
Resolves: tdf#125461 32bit XImage is not premultiplied
regressions since...
commit 86ea64f216819696cd86d1926aff0a138ace2baf
Date: Fri Feb 15 13:14:32 2019 +0100
Support for native 32bit Bitmap in VCL and SVP (cairo) backend
32bit cairo data is premultiplied with alpha but not so 32bit XImages which
don't have alpha at all, so restore the pre-change 32bit accessors, which
effectively ignore their alpha channel, beside the post-change ones and
toggle which one to use depending on the back end capability
Change-Id: Ibfec18b4ddb6e93ab19e44e7127e7a16982e2f49
Reviewed-on: https://gerrit.libreoffice.org/78665
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index 38a39e729fc3..26c4163893e4 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -80,6 +80,15 @@ public: virtual sal_uInt32 GetDepth () const override; }; +namespace +{ + bool Bitmap32IsPreMultipled() + { + auto pBackendCapabilities = ImplGetSVData()->mpDefInst->GetBackendCapabilities(); + return pBackendCapabilities->mbSupportsBitmap32; + } +} + SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) : mpBmpBuffer(pBuffer) { @@ -122,16 +131,31 @@ SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) case ScanlineFormat::N24BitTcRgb: mpFncGetPixel = BitmapReadAccess::GetPixelForN24BitTcRgb; break; case ScanlineFormat::N32BitTcAbgr: - mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcAbgr; break; + if (Bitmap32IsPreMultipled()) + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcAbgr; + else + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcXbgr; + break; case ScanlineFormat::N32BitTcArgb: - mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcArgb; break; + if (Bitmap32IsPreMultipled()) + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcArgb; + else + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcXrgb; + break; case ScanlineFormat::N32BitTcBgra: - mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcBgra; break; + if (Bitmap32IsPreMultipled()) + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcBgra; + else + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcBgrx; + break; case ScanlineFormat::N32BitTcRgba: - mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcRgba; break; + if (Bitmap32IsPreMultipled()) + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcRgba; + else + mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcRgbx; + break; case ScanlineFormat::N32BitTcMask: mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcMask; break; - default: OSL_FAIL("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format"); mpFncGetPixel = nullptr; |