[Libreoffice-commits] core.git: vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 10 07:47:16 UTC 2018


 vcl/qt5/Qt5Graphics.cxx     |    1 +
 vcl/qt5/Qt5Graphics_GDI.cxx |   13 +++++--------
 vcl/qt5/Qt5Painter.cxx      |    1 -
 3 files changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 3e52c6512e8f00c7f1481a09b50c9c8d5ac1aca5
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Aug 9 14:53:50 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Aug 10 09:46:49 2018 +0200

    Qt5 fix nTransparency handling
    
    So nTransparency is actually also in percent, i.e. max is 100,
    instead of the full byte range, like alpha colors in Qt and VCL.
    
    Fixes "SAL_USE_VCLPLUGIN=qt5 ./bin/run vcldemo --show poly"
    transparency.
    
    Change-Id: I723cbb2d6b5af4a37b18d3e6a5e0c5b81421221a
    Reviewed-on: https://gerrit.libreoffice.org/58789
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index 329d261c6097..fbf7ae05bf6b 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -121,6 +121,7 @@ bool Qt5Graphics::drawNativeControl(ControlType nType, ControlPart nPart,
         Qt5Painter aPainter(*this);
         aPainter.drawImage(QPoint(rControlRegion.getX(), rControlRegion.getY()),
                            m_aControl.getImage());
+        aPainter.update(toQRect(rControlRegion));
     }
     return bHandled;
 }
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 4b4ae0ea545f..1a61fe540e79 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -324,9 +324,6 @@ bool Qt5Graphics::drawPolyLine(const basegfx::B2DPolygon& rPolyLine, double fTra
     if (SALCOLOR_NONE == m_aFillColor && SALCOLOR_NONE == m_aLineColor)
         return true;
 
-    if (basegfx::B2DLineJoin::NONE == eLineJoin)
-        return false;
-
     // short circuit if there is nothing to do
     const int nPointCount = rPolyLine.count();
     if (nPointCount <= 0)
@@ -344,15 +341,13 @@ bool Qt5Graphics::drawPolyLine(const basegfx::B2DPolygon& rPolyLine, double fTra
 
     switch (eLineJoin)
     {
-        case basegfx::B2DLineJoin::NONE:
-            std::abort();
-            return false;
         case basegfx::B2DLineJoin::Bevel:
             aPen.setJoinStyle(Qt::BevelJoin);
             break;
         case basegfx::B2DLineJoin::Round:
             aPen.setJoinStyle(Qt::RoundJoin);
             break;
+        case basegfx::B2DLineJoin::NONE:
         case basegfx::B2DLineJoin::Miter:
             aPen.setMiterLimit(1.0 / sin(fMiterMinimumAngle / 2.0));
             aPen.setJoinStyle(Qt::MiterJoin);
@@ -604,8 +599,10 @@ bool Qt5Graphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
 {
     if (SALCOLOR_NONE == m_aFillColor && SALCOLOR_NONE == m_aLineColor)
         return true;
-
-    Qt5Painter aPainter(*this, true, nTransparency);
+    assert(nTransparency <= 100);
+    if (nTransparency > 100)
+        nTransparency = 100;
+    Qt5Painter aPainter(*this, true, (100 - nTransparency) * (255.0 / 100));
     if (SALCOLOR_NONE != m_aFillColor)
         aPainter.fillRect(nX, nY, nWidth, nHeight, aPainter.brush());
     if (SALCOLOR_NONE != m_aLineColor)
diff --git a/vcl/qt5/Qt5Painter.cxx b/vcl/qt5/Qt5Painter.cxx
index 7fa5c40f7e87..06eeb2895214 100644
--- a/vcl/qt5/Qt5Painter.cxx
+++ b/vcl/qt5/Qt5Painter.cxx
@@ -47,7 +47,6 @@ Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTr
     {
         QColor aColor = toQColor(rGraphics.m_aFillColor);
         aColor.setAlpha(nTransparency);
-        setBrush(Qt::SolidPattern);
         setBrush(aColor);
     }
     setCompositionMode(rGraphics.m_eCompositionMode);


More information about the Libreoffice-commits mailing list