From: Vadim Zeitlin Date: Wed, 5 Aug 2009 17:25:33 +0000 (+0000) Subject: Set brush origin for hatch brushes too. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1dc39a1fb565cbdc90f8537599551a3556efce8a Set brush origin for hatch brushes too. They don't explicitly use a bitmap but MSDN still says that their origin should be set to align brushes used on different windows. Closes #11072. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index d25954bd32..46eebf25c5 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1543,15 +1543,22 @@ void wxMSWDCImpl::SetBrush(const wxBrush& brush) if ( brush.IsOk() ) { // we must make sure the brush is aligned with the logical coordinates - // before selecting it + // before selecting it or using the same brush for the background of + // different windows would result in discontinuities + wxSize sizeBrushBitmap = wxDefaultSize; wxBitmap *stipple = brush.GetStipple(); if ( stipple && stipple->IsOk() ) + sizeBrushBitmap = stipple->GetSize(); + else if ( brush.IsHatch() ) + sizeBrushBitmap = wxSize(8, 8); + + if ( sizeBrushBitmap.IsFullySpecified() ) { if ( !::SetBrushOrgEx ( GetHdc(), - m_deviceOriginX % stipple->GetWidth(), - m_deviceOriginY % stipple->GetHeight(), + m_deviceOriginX % sizeBrushBitmap.x, + m_deviceOriginY % sizeBrushBitmap.y, NULL // [out] previous brush origin ) ) {