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

Jan-Marek Glogowski glogow at fbihome.de
Wed Jan 3 09:20:51 UTC 2018


 vcl/qt5/Qt5Graphics.cxx      |    1 +
 vcl/qt5/Qt5Graphics_GDI.cxx  |    8 ++++++--
 vcl/qt5/Qt5VirtualDevice.cxx |    8 ++++----
 vcl/qt5/Qt5VirtualDevice.hxx |    5 +++--
 4 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit d857e2780e882810bd2d615c0a5252c35c54d987
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sat Dec 9 23:12:02 2017 +0000

    Qt5 fix alpha drawing of start center image
    
    Drawing the bottom-left start center image had multiple errors.
    New images didn't set the default clip rect and weren't correctly
    resized. The damage handling was also missing for alpha bitmaps.
    
    Change-Id: Idabacbb8b507c990a24006152f064ae4f144b89e
    Reviewed-on: https://gerrit.libreoffice.org/47277
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index 72226fbc308f..a81c941cf17f 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -41,6 +41,7 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
     , m_pTextStyle{ nullptr, }
     , m_aTextColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) )
 {
+    ResetClipRegion();
 }
 
 Qt5Graphics::~Qt5Graphics()
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 4d7f8cf1a8b9..7f0bb5929602 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -151,7 +151,10 @@ bool Qt5Graphics::setClipRegion(const vcl::Region& rRegion)
 
 void Qt5Graphics::ResetClipRegion()
 {
-    m_aClipRegion = QRegion(m_pQImage->rect());
+    if (m_pQImage)
+        m_aClipRegion = QRegion(m_pQImage->rect());
+    else
+        m_aClipRegion = QRegion();
     if (!m_aClipPath.isEmpty())
     {
         QPainterPath aPath;
@@ -490,7 +493,7 @@ static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlph
                 if (x && !(x % 8))
                     ++alpha_line;
                 if (0 == (*alpha_line & (1 << (x % 8))))
-                    image_line[0] = 0;
+                    image_line[3] = 0;
             }
         }
     }
@@ -509,6 +512,7 @@ bool Qt5Graphics::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rS
     aPainter.drawImage(
         QPoint(rPosAry.mnDestX, rPosAry.mnDestY), aImage,
         QRect(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
+    aPainter.update(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
     return true;
 }
 
diff --git a/vcl/qt5/Qt5VirtualDevice.cxx b/vcl/qt5/Qt5VirtualDevice.cxx
index aa8ae4958e0c..fc0c66232853 100644
--- a/vcl/qt5/Qt5VirtualDevice.cxx
+++ b/vcl/qt5/Qt5VirtualDevice.cxx
@@ -58,10 +58,10 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(long nNewDX, long nNewDY, sal_uInt8* p
     if (nNewDY == 0)
         nNewDY = 1;
 
-    if (m_pImage && m_aFrameSize.getX() != nNewDX && m_aFrameSize.getY() != nNewDY)
+    if (m_pImage && m_aFrameSize.width() == nNewDX && m_aFrameSize.height() == nNewDY)
         return true;
 
-    m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY);
+    m_aFrameSize = QSize(nNewDX, nNewDY);
 
     nNewDX *= m_fScale;
     nNewDY *= m_fScale;
@@ -87,8 +87,8 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(long nNewDX, long nNewDY, sal_uInt8* p
     return true;
 }
 
-long Qt5VirtualDevice::GetWidth() const { return m_pImage ? m_aFrameSize.getX() : 0; }
+long Qt5VirtualDevice::GetWidth() const { return m_pImage ? m_aFrameSize.width() : 0; }
 
-long Qt5VirtualDevice::GetHeight() const { return m_pImage ? m_aFrameSize.getY() : 0; }
+long Qt5VirtualDevice::GetHeight() const { return m_pImage ? m_aFrameSize.height() : 0; }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5VirtualDevice.hxx b/vcl/qt5/Qt5VirtualDevice.hxx
index 56f3107e4cc7..80ed0fcf92d1 100644
--- a/vcl/qt5/Qt5VirtualDevice.hxx
+++ b/vcl/qt5/Qt5VirtualDevice.hxx
@@ -20,11 +20,12 @@
 #pragma once
 
 #include <salvd.hxx>
-#include <basegfx/vector/b2ivector.hxx>
 
 #include <memory>
 #include <list>
 
+#include <QtCore/QSize>
+
 class Qt5Graphics;
 class QImage;
 enum class DeviceFormat;
@@ -34,7 +35,7 @@ class Qt5VirtualDevice : public SalVirtualDevice
     std::list<Qt5Graphics*> m_aGraphics;
     std::unique_ptr<QImage> m_pImage;
     DeviceFormat m_eFormat;
-    basegfx::B2IVector m_aFrameSize;
+    QSize m_aFrameSize;
     double m_fScale;
 
 public:


More information about the Libreoffice-commits mailing list