Clear does nothing if we have a non valid brush (ie wxNullBrush)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-03-28 19:26:21 +00:00
parent 1cb4a8aabe
commit f6809556cf

View File

@@ -1649,10 +1649,9 @@ void wxDC::Clear(void)
wxCHECK_RET(Ok(), wxT("Invalid DC")); wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacFastPortSetter helper(this) ; wxMacFastPortSetter helper(this) ;
Rect rect = { -31000 , -31000 , 31000 , 31000 } ; Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
if (m_backgroundBrush.GetStyle() != wxTRANSPARENT) if ( m_backgroundBrush.Ok() && m_backgroundBrush.GetStyle() != wxTRANSPARENT)
{ {
::PenNormal() ; ::PenNormal() ;
//MacInstallBrush() ;
MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ; MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
::EraseRect( &rect ) ; ::EraseRect( &rect ) ;
} }
@@ -1913,37 +1912,40 @@ void wxDC::MacInstallPen() const
void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background ) void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
{ {
Pattern whiteColor ; Pattern whiteColor ;
switch( background.MacGetBrushKind() ) if ( background.Ok() )
{ {
case kwxMacBrushTheme : switch( background.MacGetBrushKind() )
{ {
::SetThemeBackground( background.MacGetTheme() , wxDisplayDepth() , true ) ; case kwxMacBrushTheme :
break ;
}
case kwxMacBrushThemeBackground :
{
Rect extent ;
ThemeBackgroundKind bg = background.MacGetThemeBackground( &extent ) ;
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
break ;
}
case kwxMacBrushColour :
{
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
int brushStyle = background.GetStyle();
if (brushStyle == wxSOLID)
::BackPat(GetQDGlobalsWhite(&whiteColor));
else if (IS_HATCH(brushStyle))
{ {
Pattern pat ; ::SetThemeBackground( background.MacGetTheme() , wxDisplayDepth() , true ) ;
wxMacGetPattern(brushStyle, &pat); break ;
::BackPat(&pat);
} }
else case kwxMacBrushThemeBackground :
{ {
::BackPat(GetQDGlobalsWhite(&whiteColor)); Rect extent ;
ThemeBackgroundKind bg = background.MacGetThemeBackground( &extent ) ;
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
break ;
}
case kwxMacBrushColour :
{
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
int brushStyle = background.GetStyle();
if (brushStyle == wxSOLID)
::BackPat(GetQDGlobalsWhite(&whiteColor));
else if (IS_HATCH(brushStyle))
{
Pattern pat ;
wxMacGetPattern(brushStyle, &pat);
::BackPat(&pat);
}
else
{
::BackPat(GetQDGlobalsWhite(&whiteColor));
}
break ;
} }
break ;
} }
} }
} }