Chromium Code Reviews| Index: chrome/browser/browser_theme_provider_mac.mm |
| =================================================================== |
| --- chrome/browser/browser_theme_provider_mac.mm (revision 22295) |
| +++ chrome/browser/browser_theme_provider_mac.mm (working copy) |
| @@ -7,8 +7,23 @@ |
| #import <Cocoa/Cocoa.h> |
| #include "base/logging.h" |
| +#include "skia/ext/skia_utils.h" |
| #include "skia/ext/skia_utils_mac.h" |
| +namespace { |
| + |
| +void HSLToHSB(const skia::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { |
|
Erik does not do reviews
2009/08/03 22:09:42
One nit perhaps worth mentioning in a comment is t
Avi (use Gerrit)
2009/08/04 13:58:21
But Skia::HSL also uses [0.0, 1.0). I think that a
|
| + SkColor color = skia::HSLToSkColor(1.0, hsl); // alpha value doesn't matter |
| + SkScalar hsv[3]; |
| + SkColorToHSV(color, hsv); |
| + |
| + *h = SkScalarToDouble(hsv[0]) / 360.0; |
| + *s = SkScalarToDouble(hsv[1]); |
| + *b = SkScalarToDouble(hsv[2]); |
| +} |
| + |
| +} |
| + |
| NSImage* BrowserThemeProvider::GetNSImageNamed(int id) { |
| DCHECK(CalledOnValidThread()); |
| @@ -63,13 +78,12 @@ |
| TintMap::iterator tint_iter = tints_.find(GetTintKey(id)); |
| if (tint_iter != tints_.end()) { |
| skia::HSL tint = tint_iter->second; |
| + CGFloat hue, saturation, brightness; |
| + HSLToHSB(tint, &hue, &saturation, &brightness); |
| - // The tint is HSL, not HSB, but we're cheating for now. TODO(avi,alcor): |
| - // determine how much this matters and fix it if necessary. |
| - // http://crbug.com/15760 |
| - NSColor* tint_color = [NSColor colorWithCalibratedHue:tint.h |
| - saturation:tint.s |
| - brightness:tint.l |
| + NSColor* tint_color = [NSColor colorWithCalibratedHue:hue |
| + saturation:saturation |
| + brightness:brightness |
| alpha:1.0]; |
| // We loaded successfully. Cache the color. |