[Libreoffice-commits] core.git: Branch 'feature/skia' - 2 commits - configure.ac vcl/backendtest vcl/inc vcl/skia vcl/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 19 17:46:33 UTC 2019


Rebased ref, commits from common ancestor:
commit ccf5d284dc03893b157b597094ebc1ad7927e12a
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: Tue Nov 19 18:45:32 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 39571ba20edfc61ae9302bfb72d21fbf3760e7d2
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: Tue Nov 19 18:35:28 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;


More information about the Libreoffice-commits mailing list