]> git.saurik.com Git - wxWidgets.git/commitdiff
under 10.4 there are some theme brushes represented as pure grayscale, convert them...
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 23 Feb 2008 14:48:21 +0000 (14:48 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 23 Feb 2008 14:48:21 +0000 (14:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/colour.cpp

index 4d91726650dd40ab9e8a7005eece2e38710899b7..ecd3cee9dea76f096408040f4bf69d7ee103b549 100644 (file)
@@ -103,17 +103,25 @@ void wxColour::InitCGColorRef( CGColorRef col )
 {
     m_cgColour.reset( col );
     size_t noComp = CGColorGetNumberOfComponents( col );
-    if ( noComp >=3 && noComp <= 4 )
+    if ( noComp >= 1 && noComp <= 4 )
     {
         // TODO verify whether we really are on a RGB color space
+        m_alpha = wxALPHA_OPAQUE;
         const CGFloat *components = CGColorGetComponents( col );
-        m_red = (int)(components[0]*255+0.5);
-        m_green = (int)(components[1]*255+0.5);
-        m_blue = (int)(components[2]*255+0.5);
-        if ( noComp == 4 )
-            m_alpha =  (int)(components[3]*255+0.5);
+        if ( noComp >= 3 )
+        {
+            m_red = (int)(components[0]*255+0.5);
+            m_green = (int)(components[1]*255+0.5);
+            m_blue = (int)(components[2]*255+0.5);
+            if ( noComp == 4 )
+                m_alpha =  (int)(components[3]*255+0.5);
+        }
         else
-            m_alpha = wxALPHA_OPAQUE;
+        {
+            m_red = (int)(components[0]*255+0.5);
+            m_green = (int)(components[0]*255+0.5);
+            m_blue = (int)(components[0]*255+0.5);
+        }
     }
     else
     {