[Libreoffice-commits] core.git: vcl/inc vcl/skia vcl/unx vcl/win
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 6 10:14:53 UTC 2020
vcl/inc/unx/salinst.h | 2 ++
vcl/inc/win/salinst.h | 1 +
vcl/skia/salbmp.cxx | 19 ++++++++++---------
vcl/unx/generic/app/salinst.cxx | 10 ++++++++++
vcl/win/app/salinst.cxx | 10 ++++++++++
5 files changed, 33 insertions(+), 9 deletions(-)
New commits:
commit b8c3ca05d04fb0bf3c27c889747bef99abcdf306
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Dec 19 20:26:03 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Jan 6 11:14:23 2020 +0100
set BackendCapabilities::mbSupportsBitmap32 for Skia again
This got reverted in 84f84f59ce7c83a99e4e340071d58b6557dbe91a,
but using 24bpp bitmaps means SkiaSalBitmap::GetAsSkBitmap() does
a needless 24bpp->32bpp conversion, and this whole rgb/a separation
is kind of lame ancient cruft that it'd be better to get rid of,
so enable this again to find all the code that can't handle 32bpp
bitmaps properly, so that they can be fixed.
Change-Id: I9bbd8ff94a4ad680cb42dee649e371c5716a9d20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85545
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index beff802c40c7..05b9f45f72e8 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -80,6 +80,8 @@ 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 bcd3540ad8a9..c06e51c84050 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -73,6 +73,7 @@ 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 9f81965de88d..4430d7f672cd 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -23,7 +23,9 @@
#include <tools/helpers.hxx>
#include <salgdi.hxx>
+#include <salinst.hxx>
#include <scanlinewriter.hxx>
+#include <svdata.hxx>
#include <SkCanvas.h>
#include <SkImage.h>
@@ -108,16 +110,15 @@ bool SkiaSalBitmap::CreateBitmapData()
}
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 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.
+ assert(ImplGetSVData()->mpDefInst->GetBackendCapabilities()->mbSupportsBitmap32);
if (!mBitmap.tryAllocPixels(
- SkImageInfo::Make(mSize.Width(), mSize.Height(), colorType, kUnpremul_SkAlphaType)))
+ SkImageInfo::Make(mSize.Width(), mSize.Height(), colorType, kPremul_SkAlphaType)))
{
return false;
}
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index f253f70d7d93..e5b2a92b89ce 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -224,4 +224,14 @@ 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 cd9332e0c728..4b97215b6dac 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -1074,4 +1074,14 @@ 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: */
More information about the Libreoffice-commits
mailing list