diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-11-21 12:17:13 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:18 +0100 |
commit | 84f84f59ce7c83a99e4e340071d58b6557dbe91a (patch) | |
tree | d4412749f34bef5558b72037a0c62ef65d889de4 | |
parent | 8f7e6f583953c6cdc9736d5dd120fddbde98ce8b (diff) |
revert BackendCapabilities::mbSupportsBitmap32 for Skia
It appears that there are still some paths that do not expect
bitmaps to be truly 32bit, so better revert to the old safe (and
poor, complicated and inefficient) way of pretty much ignoring
the alpha channel in SkiaSalBitmap, and let BitmapEx handle
it by using an extra alpha bitmap.
Change-Id: I4318c05f4ceafc5de48e19eeae5efe2abed2ec69
-rw-r--r-- | vcl/inc/unx/salinst.h | 2 | ||||
-rw-r--r-- | vcl/inc/win/salinst.h | 1 | ||||
-rw-r--r-- | vcl/skia/salbmp.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/app/salinst.cxx | 10 | ||||
-rw-r--r-- | vcl/win/app/salinst.cxx | 10 |
5 files changed, 9 insertions, 24 deletions
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index a84c659917cd..1b4b6c1af6f8 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -81,8 +81,6 @@ public: virtual void AfterAppInit() override; - std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override; - // dtrans implementation virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index c06e51c84050..bcd3540ad8a9 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -73,7 +73,6 @@ public: virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; virtual OUString getOSVersion() override; - virtual std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override; static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo); }; diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx index 9910693d6336..fb0c3608028d 100644 --- a/vcl/skia/salbmp.cxx +++ b/vcl/skia/salbmp.cxx @@ -80,8 +80,16 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap } if (colorType != kUnknown_SkColorType) { + // TODO + // As long as vcl::BackendCapabilities::mbSupportsBitmap32 is not set, we must use + // unpremultiplied alpha. This is because without mbSupportsBitmap32 set VCL uses + // an extra bitmap for the alpha channel and then merges the channels together + // into colors. kPremul_SkAlphaType would provide better performance, but + // without mbSupportsBitmap32 BitmapReadAccess::ImplSetAccessPointers() would use + // functions that merely read RGB without A, so the premultiplied values would + // not be converted back to unpremultiplied values. if (!mBitmap.tryAllocPixels( - SkImageInfo::Make(rSize.Width(), rSize.Height(), colorType, kPremul_SkAlphaType))) + SkImageInfo::Make(rSize.Width(), rSize.Height(), colorType, kUnpremul_SkAlphaType))) { return false; } diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 3ec713ca0e72..3c39a1addbd9 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -220,14 +220,4 @@ std::unique_ptr<GenPspGraphics> X11SalInstance::CreatePrintGraphics() return std::make_unique<GenPspGraphics>(); } -std::shared_ptr<vcl::BackendCapabilities> X11SalInstance::GetBackendCapabilities() -{ - auto pBackendCapabilities = SalInstance::GetBackendCapabilities(); -#if HAVE_FEATURE_SKIA - if( SkiaHelper::isVCLSkiaEnabled()) - pBackendCapabilities->mbSupportsBitmap32 = true; -#endif - return pBackendCapabilities; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 7c7bfc6e76e0..1915fb6f6b97 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -1067,14 +1067,4 @@ OUString WinSalInstance::getOSVersion() return aVer.makeStringAndClear(); } -std::shared_ptr<vcl::BackendCapabilities> WinSalInstance::GetBackendCapabilities() -{ - auto pBackendCapabilities = SalInstance::GetBackendCapabilities(); -#if HAVE_FEATURE_SKIA - if( SkiaHelper::isVCLSkiaEnabled()) - pBackendCapabilities->mbSupportsBitmap32 = true; -#endif - return pBackendCapabilities; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |