Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2034)

Unified Diff: chrome/browser/browser_theme_provider_mac.mm

Issue 159810: Do proper HSL > HSB conversion.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698