| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "chrome/common/gfx/color_utils.h" | 12 #include "chrome/common/gfx/color_utils.h" |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/gfx/skia_utils.h" | |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "skia/include/SkBitmap.h" | 16 #include "skia/include/SkBitmap.h" |
| 18 | 17 |
| 18 #if defined(OS_WIN) |
| 19 #include "skia/ext/skia_utils_win.h" |
| 20 #endif |
| 21 |
| 19 namespace color_utils { | 22 namespace color_utils { |
| 20 | 23 |
| 21 // These transformations are based on the equations in: | 24 // These transformations are based on the equations in: |
| 22 // http://en.wikipedia.org/wiki/Lab_color | 25 // http://en.wikipedia.org/wiki/Lab_color |
| 23 // http://en.wikipedia.org/wiki/SRGB_color_space#Specification_of_the_transforma
tion | 26 // http://en.wikipedia.org/wiki/SRGB_color_space#Specification_of_the_transforma
tion |
| 24 // See also: | 27 // See also: |
| 25 // http://www.brucelindbloom.com/index.html?ColorCalculator.html | 28 // http://www.brucelindbloom.com/index.html?ColorCalculator.html |
| 26 | 29 |
| 27 static const double kCIEConversionAlpha = 0.055; | 30 static const double kCIEConversionAlpha = 0.055; |
| 28 static const double kCIEConversionGamma = 2.2; | 31 static const double kCIEConversionGamma = 2.2; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 248 } |
| 246 } | 249 } |
| 247 } | 250 } |
| 248 | 251 |
| 249 SkColor SetColorAlpha(SkColor c, SkAlpha alpha) { | 252 SkColor SetColorAlpha(SkColor c, SkAlpha alpha) { |
| 250 return SkColorSetARGB(alpha, SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); | 253 return SkColorSetARGB(alpha, SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); |
| 251 } | 254 } |
| 252 | 255 |
| 253 SkColor GetSysSkColor(int which) { | 256 SkColor GetSysSkColor(int which) { |
| 254 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
| 255 return gfx::COLORREFToSkColor(::GetSysColor(which)); | 258 return skia::COLORREFToSkColor(::GetSysColor(which)); |
| 256 #else | 259 #else |
| 257 NOTIMPLEMENTED(); | 260 NOTIMPLEMENTED(); |
| 258 return SK_ColorLTGRAY; | 261 return SK_ColorLTGRAY; |
| 259 #endif | 262 #endif |
| 260 } | 263 } |
| 261 | 264 |
| 262 } // namespace color_utils | 265 } // namespace color_utils |
| 263 | 266 |
| OLD | NEW |