]> git.saurik.com Git - wxWidgets.git/commitdiff
Clear does nothing if we have a non valid brush (ie wxNullBrush)
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 28 Mar 2004 19:26:21 +0000 (19:26 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 28 Mar 2004 19:26:21 +0000 (19:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/dc.cpp

index 005e7d54ea6d210f840bdd256d81f97f6880bd7c..53ab8a3f7fbe5f69208c547e13847cd47a7e0628 100644 (file)
@@ -1649,10 +1649,9 @@ void  wxDC::Clear(void)
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacFastPortSetter helper(this) ;
     Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
-    if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
+    if ( m_backgroundBrush.Ok() && m_backgroundBrush.GetStyle() != wxTRANSPARENT)
     {
         ::PenNormal() ;
-        //MacInstallBrush() ;
         MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
         ::EraseRect( &rect ) ;
     }
@@ -1913,37 +1912,40 @@ void wxDC::MacInstallPen() const
 void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
 {
     Pattern whiteColor ;
-    switch( background.MacGetBrushKind() )
+    if ( background.Ok() )
     {
-        case kwxMacBrushTheme :
+        switch( background.MacGetBrushKind() )
         {
-            ::SetThemeBackground( background.MacGetTheme() , wxDisplayDepth() , true ) ;
-            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))
+            case kwxMacBrushTheme :
             {
-                Pattern pat ;
-                wxMacGetPattern(brushStyle, &pat);
-                ::BackPat(&pat);
+                ::SetThemeBackground( background.MacGetTheme() , wxDisplayDepth() , true ) ;
+                break ;
             }
-            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 ;
         }
     }
 }