[Libreoffice-commits] core.git: Branch 'feature/skia' - 4 commits - solenv/gbuild vcl/inc vcl/opengl vcl/skia vcl/unx vcl/win

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 24 09:29:34 UTC 2019


 solenv/gbuild/PrecompiledHeaders.mk |    2 ++
 vcl/inc/opengl/gdiimpl.hxx          |    2 ++
 vcl/inc/salgdiimpl.hxx              |    3 +++
 vcl/inc/skia/gdiimpl.hxx            |    2 ++
 vcl/opengl/gdiimpl.cxx              |   12 ++++++++++++
 vcl/skia/gdiimpl.cxx                |   22 +++++++++++++++++-----
 vcl/unx/generic/gdi/gdiimpl.cxx     |   24 ++++++++++++++++++++++++
 vcl/unx/generic/gdi/gdiimpl.hxx     |    2 ++
 vcl/unx/generic/gdi/salgdi2.cxx     |   20 +-------------------
 vcl/win/gdi/gdiimpl.cxx             |   19 +++++++++++++++++++
 vcl/win/gdi/gdiimpl.hxx             |    2 ++
 vcl/win/gdi/salgdi2.cxx             |   15 +--------------
 12 files changed, 87 insertions(+), 38 deletions(-)

New commits:
commit 559d6824f9e2c38bca2eb52e91baf8a298da7575
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 24 11:23:13 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Oct 24 11:27:23 2019 +0200

    fix SkiaSalGraphicsImpl::drawAlphaBitmap()
    
    The alpha bitmap is inverse, i.e. it has 0x00 where the source bitmap
    should be drawn and 0xff where it should be transparent. This makes
    the logo in the about dialog visible, without this everything but
    the logo itself would be drawn.
    
    Change-Id: I4dc9ef3ab91ae6ae2df0de135838bae5976b6b8d

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 5d6acd5150f1..5fd44115cb44 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -797,10 +797,10 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
     SkCanvas canvas(tmpBitmap);
     SkPaint paint;
     paint.setBlendMode(SkBlendMode::kSrc); // copy as is, including alpha
+    canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
+    paint.setBlendMode(SkBlendMode::kDstOut);
     canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rAlphaBitmap).GetAlphaSkBitmap(), 0, 0,
                       &paint);
-    paint.setBlendMode(SkBlendMode::kSrcIn);
-    canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
     drawBitmap(rPosAry, tmpBitmap);
     return true;
 }
commit 51963f343a77e32d21b38cfd6bd397c9ac2c6274
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 24 11:12:29 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Oct 24 11:27:18 2019 +0200

    transform to device coords in Skia drawPolyPolygon()
    
    Otherwise the logo in the about dialog is rendered outside
    the graphics device size.
    
    Change-Id: I610653293fccedd5d8c17f51afcdab55ada2d1d4

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 4e973c92282f..5d6acd5150f1 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -406,8 +406,6 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo
                                           const basegfx::B2DPolyPolygon& rPolyPolygon,
                                           double fTransparency)
 {
-    (void)rObjectToDevice;
-
     const bool bHasFill(mFillColor != SALCOLOR_NONE);
     const bool bHasLine(mLineColor != SALCOLOR_NONE);
 
@@ -418,7 +416,9 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo
     preDraw();
 
     SkPath aPath;
-    lclPolyPolygonToPath(rPolyPolygon, aPath);
+    basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon);
+    aPolyPolygon.transform(rObjectToDevice);
+    lclPolyPolygonToPath(aPolyPolygon, aPath);
 
     SkPaint aPaint;
     if (mFillColor != SALCOLOR_NONE)
commit ca2b886481da77a464afb7bb1e8dd5cada699d6e
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 24 10:48:25 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Oct 24 11:27:10 2019 +0200

    fix PCH reuse with Skia
    
    Change-Id: I8e28fdfc423ccec801fc1e1bc7f525c3e48f0343

diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index 0da579ef95e5..a91b97b137be 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -134,6 +134,8 @@ gb_PrecompiledHeader_ignore_flags_system := \
 -DSYSTEM_ZLIB \
 -DDISABLE_CVE_TESTS \
 -DCPPUNIT_PLUGIN_EXPORT='extern "C" SAL_DLLPUBLIC_EXPORT' \
+-DSK_USER_CONFIG_HEADER=% \
+-DSKIA_DLL \
 -include $(SRCDIR)/pch/inc/clangfix.hxx \
 
 # Probably also update pch/inc/clangfix.hxx if you extend the list.
commit 0b87ac4e5c5c6304f61d6f845b245abf0c31abcd
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 23 16:04:28 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Oct 24 11:26:20 2019 +0200

    reimplement supportsOperation() for Skia and OpenGL
    
    The shared X11 implementation depends on XRender, which doesn't make
    any sense.
    
    Change-Id: I82f36e0835a993a8b226af211d8635336960d7ec

diff --git a/vcl/inc/opengl/gdiimpl.hxx b/vcl/inc/opengl/gdiimpl.hxx
index b0b1de88b185..95e3aa261472 100644
--- a/vcl/inc/opengl/gdiimpl.hxx
+++ b/vcl/inc/opengl/gdiimpl.hxx
@@ -377,6 +377,8 @@ public:
 
     virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override;
 
+    virtual bool supportsOperation(OutDevSupportType eType) const override;
+
     /// queue an idle flush of contents of the back-buffer to the screen
     void flush();
 
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 0deb2b8612d3..2a314ed207c1 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -27,6 +27,7 @@
 
 #include <vcl/salgtype.hxx>
 #include <vcl/region.hxx>
+#include <vcl/vclenum.hxx>
 
 #include <com/sun/star/drawing/LineCap.hpp>
 
@@ -200,6 +201,8 @@ public:
                     sal_uInt8 nTransparency ) = 0;
 
     virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0;
+
+    virtual bool supportsOperation(OutDevSupportType eType) const = 0;
 };
 
 #endif
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index ee9b00ad4ce8..d0cd0dc2d52b 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -187,6 +187,8 @@ public:
 
     void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap);
 
+    virtual bool supportsOperation(OutDevSupportType eType) const override;
+
 #ifdef DBG_UTIL
     void dump(const char* file) const;
     static void dump(const SkBitmap& bitmap, const char* file);
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 0f0e40dd7eaa..85c2464e3306 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2258,4 +2258,16 @@ void OpenGLSalGraphicsImpl::doFlush()
     VCL_GL_INFO( "doFlush - end." );
 }
 
+bool OpenGLSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const
+{
+    switch (eType)
+    {
+        case OutDevSupportType::B2DDraw:
+        case OutDevSupportType::TransparentRect:
+            return true;
+        default:
+            return false;
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index a7ba9233d654..4e973c92282f 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -850,6 +850,18 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
     return false;
 }
 
+bool SkiaSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const
+{
+    switch (eType)
+    {
+        case OutDevSupportType::B2DDraw:
+        case OutDevSupportType::TransparentRect:
+            return true;
+        default:
+            return false;
+    }
+}
+
 #ifdef DBG_UTIL
 void SkiaSalGraphicsImpl::dump(const char* file) const
 {
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 39154e85ee91..5486aac4798b 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1901,4 +1901,28 @@ bool X11SalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/, co
     return false;
 }
 
+bool X11SalGraphicsImpl::supportsOperation(OutDevSupportType eType) const
+{
+    bool bRet = false;
+    switch (eType)
+    {
+        case OutDevSupportType::TransparentRect:
+        case OutDevSupportType::B2DDraw:
+        {
+            XRenderPeer& rPeer = XRenderPeer::GetInstance();
+            const SalDisplay* pSalDisp = mrParent.GetDisplay();
+            const SalVisual& rSalVis = pSalDisp->GetVisual(mrParent.GetScreenNumber());
+
+            Visual* pDstXVisual = rSalVis.GetVisual();
+            XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat(pDstXVisual);
+            if (pDstVisFmt)
+                bRet = true;
+        }
+        break;
+        default:
+            break;
+    }
+    return bRet;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index edacdac787c5..d40c31692ea9 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -282,6 +282,8 @@ public:
 
     virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override;
 
+    virtual bool supportsOperation(OutDevSupportType eType) const override;
+
 public:
     void Init() override;
 };
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 2e10ac7b0bed..3cdea8f97ef0 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -180,25 +180,7 @@ void X11SalGraphics::invert( long       nX,
 
 bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const
 {
-    bool bRet = false;
-    switch( eType )
-    {
-    case OutDevSupportType::TransparentRect:
-    case OutDevSupportType::B2DDraw:
-        {
-            XRenderPeer& rPeer = XRenderPeer::GetInstance();
-            const SalDisplay* pSalDisp = GetDisplay();
-            const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
-
-            Visual* pDstXVisual = rSalVis.GetVisual();
-            XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat( pDstXVisual );
-            if( pDstVisFmt )
-                bRet = true;
-        }
-        break;
-    default: break;
-    }
-    return bRet;
+    return mxImpl->supportsOperation(eType);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index d8b4d0905a2c..29f8cbc0ed73 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2576,4 +2576,23 @@ bool WinSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/,
     return false;
 }
 
+bool WinSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const
+{
+    static bool bAllowForTest(true);
+    bool bRet = false;
+
+    switch (eType)
+    {
+        case OutDevSupportType::TransparentRect:
+            bRet = mbVirDev || mbWindow;
+            break;
+        case OutDevSupportType::B2DDraw:
+            bRet = bAllowForTest;
+            break;
+        default:
+            break;
+    }
+    return bRet;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 63eecf521750..53fc4224f69d 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -238,6 +238,8 @@ public:
 
     virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
             const Gradient& rGradient) override;
+
+    virtual bool supportsOperation(OutDevSupportType eType) const override;
 };
 
 #endif // INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx
index 5c086cbdc14c..9c5c44deb35e 100644
--- a/vcl/win/gdi/salgdi2.cxx
+++ b/vcl/win/gdi/salgdi2.cxx
@@ -48,20 +48,7 @@
 
 bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const
 {
-    static bool bAllowForTest(true);
-    bool bRet = false;
-
-    switch( eType )
-    {
-    case OutDevSupportType::TransparentRect:
-        bRet = mbVirDev || mbWindow;
-        break;
-    case OutDevSupportType::B2DDraw:
-        bRet = bAllowForTest;
-        break;
-    default: break;
-    }
-    return bRet;
+    return mpImpl->supportsOperation(eType);
 }
 
 void WinSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics )


More information about the Libreoffice-commits mailing list