summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-01-09 14:10:00 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-01-09 15:26:31 +0100
commit994b8e52fc02c7468a243efd5e3ba7ffcd81e283 (patch)
tree106db5f9d3a945b5abc6f2d98ee21e83af9e56a2 /vcl
parent3aa151e4de4c02b094acb6fa8a919cc86051a6fd (diff)
add setting to config_skia.h whether to use 32bpp bitmaps
As said in previous Skia commits about BackendCapabilities::mbSupportsBitmap32 this should be preferrably enabled, but there are still parts of LO code that have a problem with it, so make it easier to enable/disable this. Change-Id: Iae7a8d5fc77a27372c00f6745317d168e8b2a05b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86489 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/salbmp.cxx16
-rw-r--r--vcl/unx/generic/app/salinst.cxx3
-rw-r--r--vcl/win/app/salinst.cxx3
3 files changed, 16 insertions, 6 deletions
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 172b7c37ef92..568996723011 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -111,15 +111,19 @@ bool SkiaSalBitmap::CreateBitmapData()
}
if (colorType != kUnknown_SkColorType)
{
- // If vcl::BackendCapabilities::mbSupportsBitmap32 is set,
- // BitmapReadAccess::ImplSetAccessPointers() uses functions that use premultiplied
- // alpha. If not set, it would use functions that would read just RGB, so using
- // premultiplied alpha here would change those values.
- // Using kPremul_SkAlphaType should be better for performance, so ensure
- // the flag is set.
+ // If vcl::BackendCapabilities::mbSupportsBitmap32 is set,
+ // BitmapReadAccess::ImplSetAccessPointers() uses functions that use premultiplied
+ // alpha. If not set, it would use functions that would read just RGB, so using
+ // premultiplied alpha here would change those values.
+#if SKIA_USE_BITMAP32
assert(ImplGetSVData()->mpDefInst->GetBackendCapabilities()->mbSupportsBitmap32);
if (!mBitmap.tryAllocPixels(
SkImageInfo::Make(mSize.Width(), mSize.Height(), colorType, kPremul_SkAlphaType)))
+#else
+ assert(!ImplGetSVData()->mpDefInst->GetBackendCapabilities()->mbSupportsBitmap32);
+ if (!mBitmap.tryAllocPixels(
+ SkImageInfo::Make(mSize.Width(), mSize.Height(), colorType, kUnpremul_SkAlphaType)))
+#endif
{
return false;
}
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index e5b2a92b89ce..bf4a71d5f6fc 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -34,6 +34,7 @@
#include <config_features.h>
#include <vcl/skia/SkiaHelper.hxx>
+#include <config_skia.h>
// plugin factory function
extern "C"
@@ -228,9 +229,11 @@ std::shared_ptr<vcl::BackendCapabilities> X11SalInstance::GetBackendCapabilities
{
auto pBackendCapabilities = SalInstance::GetBackendCapabilities();
#if HAVE_FEATURE_SKIA
+#if SKIA_USE_BITMAP32
if( SkiaHelper::isVCLSkiaEnabled())
pBackendCapabilities->mbSupportsBitmap32 = true;
#endif
+#endif
return pBackendCapabilities;
}
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 4b97215b6dac..26ce820a1b67 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -50,6 +50,7 @@
#include <config_features.h>
#include <vcl/skia/SkiaHelper.hxx>
#if HAVE_FEATURE_SKIA
+#include <config_skia.h>
#include <skia/salbmp.hxx>
#include <skia/win/gdiimpl.hxx>
#endif
@@ -1078,9 +1079,11 @@ std::shared_ptr<vcl::BackendCapabilities> WinSalInstance::GetBackendCapabilities
{
auto pBackendCapabilities = SalInstance::GetBackendCapabilities();
#if HAVE_FEATURE_SKIA
+#if SKIA_USE_BITMAP32
if( SkiaHelper::isVCLSkiaEnabled())
pBackendCapabilities->mbSupportsBitmap32 = true;
#endif
+#endif
return pBackendCapabilities;
}