[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/inc vcl/qt5

Katarina Behrens Katarina.Behrens at cib.de
Thu May 17 11:06:24 UTC 2018


 vcl/inc/qt5/Qt5Tools.hxx     |    6 ++++++
 vcl/qt5/Qt5Graphics_GDI.cxx  |    2 +-
 vcl/qt5/Qt5Graphics_Text.cxx |    2 +-
 vcl/qt5/Qt5Painter.cxx       |    4 ++--
 4 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 14b000986d1bc98bb3ecb7ada5b10f33ee7bdefe
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu May 17 12:55:55 2018 +0200

    Unify Color -> QColor conversion
    
    this also resolves build failures on 32bit platforms
    
    Change-Id: I53fa2faae52a8cb322644c5bd5e5e84d71110d8e

diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index d632a5ed8ce5..06c02572473c 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -26,6 +26,7 @@
 
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
+#include <tools/color.hxx>
 #include <tools/gen.hxx>
 
 #include <memory>
@@ -55,6 +56,11 @@ inline QSize toQSize(const Size& rSize) { return QSize(rSize.Width(), rSize.Heig
 
 inline Size toSize(const QSize& rSize) { return Size(rSize.width(), rSize.height()); }
 
+inline QColor toQColor(const Color& rColor)
+{
+    return QColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetTransparency() );
+}
+
 static constexpr QImage::Format Qt5_DefaultFormat32 = QImage::Format_ARGB32;
 
 inline QImage::Format getBitFormat(sal_uInt16 nBitCount)
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index fe1b98112b33..8c1445970f62 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -172,7 +172,7 @@ void Qt5Graphics::drawPixel(long nX, long nY)
 void Qt5Graphics::drawPixel(long nX, long nY, SalColor nSalColor)
 {
     Qt5Painter aPainter(*this);
-    aPainter.setPen(QColor(QRgb(nSalColor)));
+    aPainter.setPen(toQColor(nSalColor));
     aPainter.setPen(Qt::SolidLine);
     aPainter.drawPoint(nX, nY);
     aPainter.update(nX, nY, 1, 1);
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index b31975e6f527..a7d005d426cd 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -185,7 +185,7 @@ void Qt5Graphics::DrawTextLayout(const CommonSalLayout &rLayout )
     aGlyphRun.setRawFont( aRawFont );
 
     Qt5Painter aPainter(*this);
-    QColor aColor = QColor::fromRgb(QRgb(m_aTextColor));
+    QColor aColor = toQColor(m_aTextColor);
     aPainter.setPen(aColor);
     aPainter.drawGlyphRun( QPointF(), aGlyphRun );
 }
diff --git a/vcl/qt5/Qt5Painter.cxx b/vcl/qt5/Qt5Painter.cxx
index 5bf0db22b3f0..88e9b10b1885 100644
--- a/vcl/qt5/Qt5Painter.cxx
+++ b/vcl/qt5/Qt5Painter.cxx
@@ -37,7 +37,7 @@ Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTr
         setClipRegion(rGraphics.m_aClipRegion);
     if (SALCOLOR_NONE != rGraphics.m_aLineColor)
     {
-        QColor aColor = QColor::fromRgb(QRgb(rGraphics.m_aLineColor));
+        QColor aColor = toQColor(rGraphics.m_aLineColor);
         aColor.setAlpha(nTransparency);
         setPen(aColor);
     }
@@ -45,7 +45,7 @@ Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTr
         setPen(Qt::NoPen);
     if (bPrepareBrush && SALCOLOR_NONE != rGraphics.m_aFillColor)
     {
-        QColor aColor = QColor::fromRgb(QRgb(rGraphics.m_aFillColor));
+        QColor aColor = toQColor(rGraphics.m_aFillColor);
         aColor.setAlpha(nTransparency);
         setBrush(Qt::SolidPattern);
         setBrush(aColor);


More information about the Libreoffice-commits mailing list