]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix conversion from wxColour to NSColor in wxOSX/Cocoa wxDVC.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Oct 2009 22:44:23 +0000 (22:44 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Oct 2009 22:44:23 +0000 (22:44 +0000)
wxColour components are in 0.255 range while NSColor ones are in 0..1 one. The
old code compiled just fine but didn't work correctly for any colours which
had any channel with value different from 0 and 255 (unsurprisingly, my tests
only used wxRED, wxGREEN and wxBLUE which all passed...).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/dataview.mm

index da69f41d75783cee7928885efa45a39d12e89983..50ca83236f2ef4c9bcf2a699633a8c588d819126 100644 (file)
@@ -1547,10 +1547,10 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
                 }
 
                 const wxColour& c = attr.GetColour();
-                colText = [NSColor colorWithDeviceRed:c.Red()
-                                                  green:c.Green()
-                                                  blue:c.Blue()
-                                                  alpha:c.Alpha()];
+                colText = [NSColor colorWithDeviceRed:c.Red() / 255.
+                                                  green:c.Green() / 255.
+                                                  blue:c.Blue() / 255.
+                                                  alpha:c.Alpha() / 255.];
             }
         }
     }