summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-23 16:30:21 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-23 16:23:15 +0000
commitb9064c0780232610af9e4d45ba5c85b9496d1f75 (patch)
tree93ef95ef9bda80b60e7eadaea88db64d7ab9d160
parentf7ed8b99b628625851fb28ec1a3dead710c8871c (diff)
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 <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--vcl/source/window/paint.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 49f20a4c9f2d..610575f85884 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)