From: Vadim Zeitlin Date: Mon, 12 Oct 2009 22:44:23 +0000 (+0000) Subject: Fix conversion from wxColour to NSColor in wxOSX/Cocoa wxDVC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f115ff4a4f4939c27047a6ecfc55a99eb7c3fcad Fix conversion from wxColour to NSColor in wxOSX/Cocoa wxDVC. 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 --- diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index da69f41d75..50ca83236f 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -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.]; } } }