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
This commit is contained in:
Vadim Zeitlin
2009-08-05 17:25:33 +00:00
parent b5a9b87e16
commit 1dc39a1fb5

View File

@@ -1543,15 +1543,22 @@ void wxMSWDCImpl::SetBrush(const wxBrush& brush)
if ( brush.IsOk() ) if ( brush.IsOk() )
{ {
// we must make sure the brush is aligned with the logical coordinates // 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(); wxBitmap *stipple = brush.GetStipple();
if ( stipple && stipple->IsOk() ) if ( stipple && stipple->IsOk() )
sizeBrushBitmap = stipple->GetSize();
else if ( brush.IsHatch() )
sizeBrushBitmap = wxSize(8, 8);
if ( sizeBrushBitmap.IsFullySpecified() )
{ {
if ( !::SetBrushOrgEx if ( !::SetBrushOrgEx
( (
GetHdc(), GetHdc(),
m_deviceOriginX % stipple->GetWidth(), m_deviceOriginX % sizeBrushBitmap.x,
m_deviceOriginY % stipple->GetHeight(), m_deviceOriginY % sizeBrushBitmap.y,
NULL // [out] previous brush origin NULL // [out] previous brush origin
) ) ) )
{ {