diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-23 16:30:21 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-24 09:32:35 +0200 |
commit | 6ce2e29078265c41e83f9094244e638eba82e836 (patch) | |
tree | d96a72e11869e2c600baa407984c4bf21b0c733d | |
parent | a617267fff99c9d262b28948f142014fecc1d1d3 (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>
(cherry picked from commit b9064c0780232610af9e4d45ba5c85b9496d1f75)
-rw-r--r-- | vcl/source/window/paint.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 4b6e8f5e07bd..7b006286e2df 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) |