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
This commit is contained in:
Luboš Luňák 2019-11-21 12:17:13 +01:00
parent 8f7e6f5839
commit 84f84f59ce
5 changed files with 9 additions and 24 deletions

View file

@ -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;

View file

@ -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);
};

View file

@ -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;
}

View file

@ -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: */

View file

@ -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: */