From dd1b1911f5d1908efd1382a63d2d6ad703a06909 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 29 Jan 2014 22:24:43 +0000 Subject: [PATCH] Fix wxClientDC::Clear() for scrolled windows in wxMSW. Take the DC origin into account when clearing a window DC and not only a memory one. Closes #2048. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/dc.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index b471bee95c..3f5989e26b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -617,6 +617,7 @@ wxMSW: - Fix coordinates of EVT_MOUSEWHEEL in frames with toolbars (LtJax). - Support "show" verb as well as "open" in wxFileType (Eric Jensen). - Fix display of bitmaps with alpha in wxStaticBitmap (Artur Wieczorek). +- Fix wxClientDC::Clear() for scrolled windows (Artur Wieczorek). - Make wxPrinterDC::DrawIcon() actually work (Artur Wieczorek). wxOSX: diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 2db8a6065c..e6c375b364 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -694,11 +694,13 @@ void wxMSWDCImpl::Clear() if (!m_selectedBitmap.IsOk()) return; - rect.left = -m_deviceOriginX; rect.top = -m_deviceOriginY; - rect.right = m_selectedBitmap.GetWidth()-m_deviceOriginX; - rect.bottom = m_selectedBitmap.GetHeight()-m_deviceOriginY; + rect.left = rect.top = 0; + rect.right = m_selectedBitmap.GetWidth(); + rect.bottom = m_selectedBitmap.GetHeight(); } + ::OffsetRect(&rect, -m_deviceOriginX, -m_deviceOriginY); + #ifndef __WXWINCE__ (void) ::SetMapMode(GetHdc(), MM_TEXT); #endif