vcl/source/window/paint.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit b9064c0780232610af9e4d45ba5c85b9496d1f75
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Jun 23 16:30:21 2015 +0200

    vcl: fix window vs buffer map mode mismatch in PaintHelper
    
    This avoids painting the first few menu items in really large scale on
    the whole window after window resize.
    
    Change-Id: I2469403684b1ae3b93892d49536115df2cef81bc
    Reviewed-on: https://gerrit.libreoffice.org/16429
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 49f20a4..610575f 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -48,6 +48,7 @@ private:
     vcl::Region* m_pChildRegion;
     Rectangle m_aSelectionRect;
     Rectangle m_aPaintRect;
+    MapMode m_aPaintRectMapMode;
     vcl::Region m_aPaintRegion;
     sal_uInt16 m_nPaintFlags;
     bool m_bPop : 1;
@@ -117,6 +118,9 @@ void PaintHelper::CreateBuffer()
 
     SetupBuffer();
 
+    // Remember what was the map mode of m_aPaintRect.
+    m_aPaintRectMapMode = m_pWindow->GetMapMode();
+
     // update the output size now, after all the settings were copied
     m_pBuffer->SetOutputSize(m_pWindow->GetOutputSize());
 
@@ -171,7 +175,15 @@ void PaintHelper::PaintBuffer()
     // [ie. everything you can see was painted directly to the
     // window either above or in eg. an event handler]
     if (!getenv("VCL_DOUBLEBUFFERING_AVOID_PAINT"))
+    {
+        // The map mode of m_pWindow and/or m_pBuffer may have changed since
+        // CreateBuffer(), set it back to what it was, otherwise unwanted
+        // scaling or translating may happen.
+        m_pWindow->SetMapMode(m_aPaintRectMapMode);
+        m_pBuffer->SetMapMode(m_aPaintRectMapMode);
+
         m_pWindow->DrawOutDev(m_aPaintRect.TopLeft(), m_aPaintRect.GetSize(), 
m_aPaintRect.TopLeft(), m_aPaintRect.GetSize(), *m_pBuffer.get());
+    }
 }
 
 void PaintHelper::DoPaint(const vcl::Region* pRegion)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to