[Libreoffice-commits] core.git: Branch 'feature/skia' - 5 commits - configure.ac external/skia vcl/backendtest vcl/inc vcl/qa vcl/skia vcl/source
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 20 10:34:56 UTC 2019
Rebased ref, commits from common ancestor:
commit d0b30908314ad11ab15ad9d08bb266bf2ed2f3b3
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 19 18:08:07 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 20 11:33:04 2019 +0100
build Skia only on selected platforms
Feel free to adjust your platform as necessary.
Change-Id: I3003a643c39b6afeb3102f97280f20534b9c7f77
diff --git a/configure.ac b/configure.ac
index 846944f09ae5..1990783f5f70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -577,6 +577,7 @@ case "$host_os" in
solaris*)
build_gstreamer_1_0=yes
test_freetype=yes
+ build_skia=yes
_os=SunOS
dnl ===========================================================
@@ -603,6 +604,7 @@ linux-gnu*|k*bsd*-gnu*)
build_gstreamer_1_0=yes
test_kf5=yes
test_gtk3_kde5=yes
+ build_skia=yes
test_gdb_index=yes
test_split_debug=yes
if test "$enable_fuzzers" != yes; then
@@ -641,6 +643,7 @@ cygwin*|interix*)
test_xrender=no
test_freetype=no
test_fontconfig=no
+ build_skia=yes
_os=WINNT
DLLPOST=".dll"
@@ -695,6 +698,7 @@ freebsd*)
test_kf5=yes
test_gtk3_kde5=yes
test_freetype=yes
+ build_skia=yes
AC_MSG_CHECKING([the FreeBSD operating system release])
if test -n "$with_os_version"; then
OSVERSION="$with_os_version"
@@ -722,6 +726,7 @@ freebsd*)
test_kf5=yes
test_gtk3_kde5=yes
test_freetype=yes
+ build_skia=yes
PTHREAD_LIBS="-pthread -lpthread"
_os=NetBSD
;;
@@ -745,6 +750,7 @@ dragonfly*)
test_kf5=yes
test_gtk3_kde5=yes
test_freetype=yes
+ build_skia=yes
PTHREAD_LIBS="-pthread"
_os=DragonFly
;;
@@ -10866,7 +10872,7 @@ AC_SUBST(POPPLER_LIBS)
# Skia?
AC_MSG_CHECKING([whether to build Skia])
ENABLE_SKIA=
-if test "$enable_skia" != "no"; then
+if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
AC_MSG_RESULT([yes])
ENABLE_SKIA=TRUE
AC_DEFINE(HAVE_FEATURE_SKIA)
commit 2602d5ccdaa9b65c46209fb6293023247d605d3d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 19 14:54:22 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 20 11:33:04 2019 +0100
avoid some compiler warnings in Skia VCL code
Mostly warnings from the 'casttovoid' Clang plugin, which is rather
annoying here.
Change-Id: I3d69697143f690211cdd26d1b9a4c0efe9397197
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index 34e37e771f1f..a7e857ffd1fd 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -262,7 +262,7 @@ TestResult OutputDeviceTestCommon::checkAALines(Bitmap& rBitmap)
return checkHorizontalVerticalDiagonalLines(rBitmap, constLineColor, 30); // 30 color values threshold delta
}
-void checkResult(TestResult eResult, TestResult & eTotal)
+static void checkResult(TestResult eResult, TestResult & eTotal)
{
if (eTotal == TestResult::Failed)
return;
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 0036b2d89f7a..517bad0db5c8 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -251,7 +251,8 @@ protected:
friend inline std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalGraphicsImpl* graphics)
{ // O - offscreen, G - GPU-based, R - raster
- return stream << (void*)graphics << " " << Size(graphics->GetWidth(), graphics->GetHeight())
+ return stream << static_cast<const void*>(graphics) << " "
+ << Size(graphics->GetWidth(), graphics->GetHeight())
<< (graphics->isOffscreen() ? "O" : "") << (graphics->isGPU() ? "G" : "R");
}
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index c5922685c5b7..ed0f374162d6 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -83,8 +83,8 @@ private:
operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalBitmap* bitmap)
{ // TODO GPU-based, once it's done
// B - has SkBitmap, A - has alpha SkBitmap, D - has data buffer
- return stream << (void*)bitmap << " " << bitmap->GetSize() << "/" << bitmap->mBitCount
- << (!bitmap->mBitmap.drawsNothing() ? "B" : "")
+ return stream << static_cast<const void*>(bitmap) << " " << bitmap->GetSize() << "/"
+ << bitmap->mBitCount << (!bitmap->mBitmap.drawsNothing() ? "B" : "")
<< (!bitmap->mAlphaBitmap.drawsNothing() ? "A" : "")
<< (bitmap->mBuffer.get() ? "D" : "");
}
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index 810e8f9b0b11..040f189be74f 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -103,8 +103,9 @@ static bool initRenderMethodToUse()
SkiaHelper::RenderMethod SkiaHelper::renderMethodToUse()
{
static bool methodToUseInited = initRenderMethodToUse();
- (void)methodToUseInited; // Used just to ensure thread-safe one-time init.
- return methodToUse;
+ if (methodToUseInited) // Used just to ensure thread-safe one-time init.
+ return methodToUse;
+ abort();
}
void SkiaHelper::disableRenderMethod(RenderMethod method)
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 271f1a61321c..dfa7eb7a7320 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -439,10 +439,9 @@ void SkiaSalGraphicsImpl::SetFillColor() { mFillColor = SALCOLOR_NONE; }
void SkiaSalGraphicsImpl::SetFillColor(Color nColor) { mFillColor = nColor; }
-void SkiaSalGraphicsImpl::SetXORMode(bool bSet, bool bInvertOnly)
+void SkiaSalGraphicsImpl::SetXORMode(bool, bool)
{
- (void)bSet;
- (void)bInvertOnly;
+ // TODO
}
void SkiaSalGraphicsImpl::SetROPLineColor(SalROPColor nROPColor)
@@ -631,9 +630,9 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev
const basegfx::B2DVector& rLineWidths,
basegfx::B2DLineJoin eLineJoin,
css::drawing::LineCap eLineCap, double fMiterMinimumAngle,
- bool bPixelSnapHairline)
+ bool /*bPixelSnapHairline*/)
{
- (void)bPixelSnapHairline;
+ //(void)bPixelSnapHairline; // TODO
if (rPolyLine.count() == 0 || fTransparency < 0.0 || fTransparency >= 1.0
|| mLineColor == SALCOLOR_NONE)
@@ -720,32 +719,22 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev
return true;
}
-bool SkiaSalGraphicsImpl::drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
- const PolyFlags* pFlgAry)
+bool SkiaSalGraphicsImpl::drawPolyLineBezier(sal_uInt32, const SalPoint*, const PolyFlags*)
{
- (void)nPoints;
- (void)pPtAry;
- (void)pFlgAry;
+ // TODO?
return false;
}
-bool SkiaSalGraphicsImpl::drawPolygonBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
- const PolyFlags* pFlgAry)
+bool SkiaSalGraphicsImpl::drawPolygonBezier(sal_uInt32, const SalPoint*, const PolyFlags*)
{
- (void)nPoints;
- (void)pPtAry;
- (void)pFlgAry;
+ // TODO?
return false;
}
-bool SkiaSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
- const SalPoint* const* pPtAry,
- const PolyFlags* const* pFlgAry)
+bool SkiaSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32, const sal_uInt32*,
+ const SalPoint* const*, const PolyFlags* const*)
{
- (void)nPoly;
- (void)pPoints;
- (void)pPtAry;
- (void)pFlgAry;
+ // TODO?
return false;
}
@@ -1005,15 +994,9 @@ void SkiaSalGraphicsImpl::invert(sal_uInt32 nPoints, const SalPoint* pPointArray
invert(aPolygon, eFlags);
}
-bool SkiaSalGraphicsImpl::drawEPS(long nX, long nY, long nWidth, long nHeight, void* pPtr,
- sal_uInt32 nSize)
+bool SkiaSalGraphicsImpl::drawEPS(long, long, long, long, void*, sal_uInt32)
{
- (void)nX;
- (void)nY;
- (void)nWidth;
- (void)nHeight;
- (void)pPtr;
- (void)nSize;
+ // TODO?
return false;
}
@@ -1122,11 +1105,9 @@ bool SkiaSalGraphicsImpl::drawAlphaRect(long nX, long nY, long nWidth, long nHei
return true;
}
-bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
- const Gradient& rGradient)
+bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon&, const Gradient&)
{
- (void)rPolygon;
- (void)rGradient;
+ // TODO?
return false;
}
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index c1ff1f13e9e3..de49400cd481 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -164,15 +164,11 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
// TODO copy data
SAL_INFO("vcl.skia", "copy(" << this << "): (" << &src << ")");
abort();
- return true;
}
-bool SkiaSalBitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
- Size& rSize, bool bMask)
+bool SkiaSalBitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanvas>&, Size&, bool)
{
- (void)rBitmapCanvas;
- (void)rSize;
- (void)bMask;
+ // TODO?
return false;
}
@@ -187,9 +183,9 @@ Size SkiaSalBitmap::GetSize() const { return mSize; }
sal_uInt16 SkiaSalBitmap::GetBitCount() const { return mBitCount; }
-BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
+BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode /*nMode*/)
{
- (void)nMode; // TODO
+ //(void)nMode; // TODO
if (mBitmap.drawsNothing() && !mBuffer)
return nullptr;
BitmapBuffer* buffer = new BitmapBuffer;
@@ -257,27 +253,23 @@ void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode)
delete pBuffer;
}
-bool SkiaSalBitmap::GetSystemData(BitmapSystemData& rData)
+bool SkiaSalBitmap::GetSystemData(BitmapSystemData&)
{
- (void)rData;
+ // TODO?
return false;
}
bool SkiaSalBitmap::ScalingSupported() const { return false; }
-bool SkiaSalBitmap::Scale(const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag)
+bool SkiaSalBitmap::Scale(const double&, const double&, BmpScaleFlag)
{
- (void)rScaleX;
- (void)rScaleY;
- (void)nScaleFlag;
+ // TODO?
return false;
}
-bool SkiaSalBitmap::Replace(const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol)
+bool SkiaSalBitmap::Replace(const Color&, const Color&, sal_uInt8)
{
- (void)rSearchColor;
- (void)rReplaceColor;
- (void)nTol;
+ // TODO?
return false;
}
@@ -298,10 +290,10 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
// Convert 24bpp RGB/BGR to 32bpp RGBA/BGRA.
std::unique_ptr<sal_uInt8[]> data(new sal_uInt8[mSize.Height() * mSize.Width() * 4]);
sal_uInt8* dest = data.get();
- for (int y = 0; y < mSize.Height(); ++y)
+ for (long y = 0; y < mSize.Height(); ++y)
{
const sal_uInt8* src = mBuffer.get() + mScanlineSize * y;
- for (int x = 0; x < mSize.Width(); ++x)
+ for (long x = 0; x < mSize.Width(); ++x)
{
*dest++ = *src++;
*dest++ = *src++;
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index 28a46ccc262b..c9aca589edba 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -148,7 +148,7 @@ std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataBitCount( const sal_uInt8*
{
assert( bitCount == 1 || bitCount == 4 || bitCount == 8 );
static const int bpp[] = { 1, 3, 3, 4, 4 };
- std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ (int)type ]] );
+ std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ static_cast<int>(type) ]] );
std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
const sal_uInt8* pSrcData = src;
commit bb42aa9b850c2a15a646dcdac7b71a52b211fa68
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 18 16:40:25 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 20 11:33:03 2019 +0100
solve the Skia lerp() conflict differently
New versions of libstdc++ provide lerp() in the global namespace,
older ones don't, but it depends on the libstdc++ version and not
the c++ version. Since the function is local, just "rename" it.
Change-Id: I37896190c620350739fba9b8ce6544f945519244
diff --git a/external/skia/lerp.patch b/external/skia/lerp.patch
index c87a965e7caf..2062c21f2df0 100644
--- a/external/skia/lerp.patch
+++ b/external/skia/lerp.patch
@@ -1,14 +1,12 @@
---- skia/src/shaders/SkPerlinNoiseShader.cpp.sav 2019-07-29 14:37:30.429563360 +0200
-+++ skia/src/shaders/SkPerlinNoiseShader.cpp 2019-07-29 16:45:29.736231751 +0200
-@@ -573,9 +573,11 @@ static SkScalar fade(SkScalar t) {
+diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp
+index 812dc1694f..60b8d617c6 100644
+--- a/src/shaders/SkPerlinNoiseShader.cpp
++++ b/src/shaders/SkPerlinNoiseShader.cpp
+@@ -573,6 +573,7 @@ static SkScalar fade(SkScalar t) {
return t * t * t * (t * (t * 6 - 15) + 10);
}
-+#if __cplusplus <= 201703L
++#define lerp skia_lerp
static SkScalar lerp(SkScalar t, SkScalar a, SkScalar b) {
return a + t * (b - a);
}
-+#endif
-
- static SkScalar grad(int hash, SkScalar x, SkScalar y, SkScalar z) {
- int h = hash & 15;
commit bb01153834703740fbf4e1e9115ffd496157cabf
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 18 13:52:09 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 20 11:33:02 2019 +0100
avoid unused parameter warning in non-debug build
Change-Id: I3ea06a872d5348f7681602a6d68ff69990f2cd7e
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 1090c33b73e0..0f253a797097 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -59,6 +59,7 @@ public:
{
// This ensures that all backends return a valid name.
assert(!name.isEmpty());
+ (void)name;
return false;
}
commit 0a531f6d448ac0049012dcbf1072f5cbb9d4a6cd
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 18 12:24:59 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 20 11:32:57 2019 +0100
make about dialog differentiate between Skia with Vulkan or raster
Since they are technically still two different rendering implementations.
Change-Id: I83c324b384b7acfcc84e729271d00b995327eec6
diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc
index 65e829648f23..6c86cec3e747 100644
--- a/vcl/inc/strings.hrc
+++ b/vcl/inc/strings.hrc
@@ -126,7 +126,8 @@
#define SV_APP_OSVERSION NC_("SV_APP_OSVERSION", "OS: ")
#define SV_APP_UIRENDER NC_("SV_APP_UIRENDER", "UI render: ")
#define SV_APP_GL NC_("SV_APP_GL", "GL")
-#define SV_APP_SKIA NC_("SV_APP_SKIA", "Skia")
+#define SV_APP_SKIA_VULKAN NC_("SV_APP_SKIA_VULKAN", "Skia/Vulkan")
+#define SV_APP_SKIA_RASTER NC_("SV_APP_SKIA_RASTER", "Skia/Raster")
#define SV_APP_DEFAULT NC_("SV_APP_DEFAULT", "default")
#define SV_MSGBOX_INFO NC_("SV_MSGBOX_INFO", "Information")
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 3de5548a274e..2cb14d64882a 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1154,9 +1154,21 @@ OUString Application::GetHWOSConfInfo()
aDetails.append( VclResId(SV_APP_GL) );
else
#endif
+#if HAVE_FEATURE_SKIA
if ( SkiaHelper::isVCLSkiaEnabled() )
- aDetails.append( VclResId(SV_APP_SKIA) );
+ {
+ switch(SkiaHelper::renderMethodToUse())
+ {
+ case SkiaHelper::RenderVulkan:
+ aDetails.append( VclResId(SV_APP_SKIA_VULKAN) );
+ break;
+ case SkiaHelper::RenderRaster:
+ aDetails.append( VclResId(SV_APP_SKIA_RASTER) );
+ break;
+ }
+ }
else
+#endif
aDetails.append( VclResId(SV_APP_DEFAULT) );
aDetails.append( "; " );
More information about the Libreoffice-commits
mailing list