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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 09:43:53 UTC 2018


 vcl/qt5/Qt5Bitmap.cxx        |    3 ++-
 vcl/qt5/Qt5Frame.cxx         |    1 +
 vcl/qt5/Qt5VirtualDevice.cxx |    1 +
 vcl/qt5/Qt5Widget.cxx        |   12 +++++++++++-
 4 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 5edc23dbc53773536265fd6a54319d9cd1cd9e99
Author:     Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Wed Nov 7 17:48:06 2018 +0300
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Fri Nov 16 10:43:27 2018 +0100

    tdf#120777 KDE5: Update initialization of QImages
    
    Make sure that created empty QImages are filled with transparent pixels.
    
    Copying data from previous QImage on widget resize removes blanking
    on window resize when qt5 vcl plugin is used.
    
    Change-Id: If072a4b8b334bc87dbe4aaea9aa8774bb5e202ee
    Reviewed-on: https://gerrit.libreoffice.org/63029
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/qt5/Qt5Bitmap.cxx b/vcl/qt5/Qt5Bitmap.cxx
index eb2037c214c8..defd0280ac24 100644
--- a/vcl/qt5/Qt5Bitmap.cxx
+++ b/vcl/qt5/Qt5Bitmap.cxx
@@ -63,6 +63,7 @@ bool Qt5Bitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPale
     else
     {
         m_pImage.reset(new QImage(toQSize(rSize), getBitFormat(nBitCount)));
+        m_pImage->fill(Qt::transparent);
         m_pBuffer.reset();
     }
     m_aPalette = rPal;
@@ -129,7 +130,7 @@ bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
         // convert 4bit indexed palette to 32bit ARGB
         m_pImage.reset(new QImage(pBitmap->m_aSize.Width(), pBitmap->m_aSize.Height(),
                                   getBitFormat(nNewBitCount)));
-        m_pImage->fill(0);
+        m_pImage->fill(Qt::transparent);
 
         // prepare a whole palette
         const BitmapPalette& rPal = pBitmap->m_aPalette;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index f6428af8b91c..ad043ebd3ab8 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -211,6 +211,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
         {
             m_pQt5Graphics.reset(new Qt5Graphics(this));
             m_pQImage.reset(new QImage(m_pQWidget->size(), Qt5_DefaultFormat32));
+            m_pQImage->fill(Qt::transparent);
             m_pQt5Graphics->ChangeQImage(m_pQImage.get());
         }
         return m_pQt5Graphics.get();
diff --git a/vcl/qt5/Qt5VirtualDevice.cxx b/vcl/qt5/Qt5VirtualDevice.cxx
index a26ec627bea5..f1c7d9606c8f 100644
--- a/vcl/qt5/Qt5VirtualDevice.cxx
+++ b/vcl/qt5/Qt5VirtualDevice.cxx
@@ -76,6 +76,7 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(long nNewDX, long nNewDY, sal_uInt8* p
             m_pImage.reset(new QImage(nNewDX, nNewDY, Qt5_DefaultFormat32));
     }
 
+    m_pImage->fill(Qt::transparent);
     m_pImage->setDevicePixelRatio(m_fScale);
 
     // update device in existing graphics
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 9edb7d15f89f..1c032e2a75ce 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -86,7 +86,17 @@ void Qt5Widget::resizeEvent(QResizeEvent* pEvent)
     }
     else
     {
-        QImage* pImage = new QImage(size(), Qt5_DefaultFormat32);
+        QImage* pImage = nullptr;
+
+        if (m_pFrame->m_pQImage)
+            pImage = new QImage(
+                m_pFrame->m_pQImage->copy(0, 0, pEvent->size().width(), pEvent->size().height()));
+        else
+        {
+            pImage = new QImage(size(), Qt5_DefaultFormat32);
+            pImage->fill(Qt::transparent);
+        }
+
         m_pFrame->m_pQt5Graphics->ChangeQImage(pImage);
         m_pFrame->m_pQImage.reset(pImage);
     }


More information about the Libreoffice-commits mailing list