diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-09 01:07:42 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-09 01:07:42 +0000 |
commit | 4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f (patch) | |
tree | 69a1e9f78b3a5fa8b909cfab336826b09c44235f /skia/ext/image_operations.cc | |
parent | 5085ee0b4bfbe4625e63ee6975bb95702e13e0aa (diff) | |
download | chromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.zip chromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.tar.gz chromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.tar.bz2 |
This is the first pass at themes.
This CL is paired with http://codereview.chromium.org/67284
This CL (for commit purposes) includes http://codereview.chromium.org/67284
BUG=4463,11232,11233,11234,11235
Review URL: http://codereview.chromium.org/99030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/image_operations.cc')
-rw-r--r-- | skia/ext/image_operations.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc index a6ccec4..07fb97b 100644 --- a/skia/ext/image_operations.cc +++ b/skia/ext/image_operations.cc @@ -16,7 +16,6 @@ #include "SkBitmap.h" #include "skia/ext/convolver.h" #include "skia/include/SkColorPriv.h" -#include "skia/ext/skia_utils.h" namespace skia { @@ -460,7 +459,7 @@ SkBitmap ImageOperations::CreateBlurredBitmap(const SkBitmap& bitmap, // static SkBitmap ImageOperations::CreateHSLShiftedBitmap(const SkBitmap& bitmap, - float hsl_shift[3]) { + HSL hsl_shift) { DCHECK(bitmap.empty() == false); DCHECK(bitmap.config() == SkBitmap::kARGB_8888_Config); @@ -494,30 +493,30 @@ SkBitmap ImageOperations::CreateHSLShiftedBitmap(const SkBitmap& bitmap, static_cast<int>(b * 255.0)); } - float pixel_hsl[3]; + HSL pixel_hsl = { 0, 0, 0 }; SkColorToHSL(color, pixel_hsl); // Replace the hue with the tint's hue. - if (hsl_shift[0] >= 0) - pixel_hsl[0] = hsl_shift[0]; + if (hsl_shift.h >= 0) + pixel_hsl.h = hsl_shift.h; // Change the saturation. - if (hsl_shift[1] >= 0) { - if (hsl_shift[1] <= 0.5) { - pixel_hsl[1] *= hsl_shift[1] * 2.0; + if (hsl_shift.s >= 0) { + if (hsl_shift.s <= 0.5) { + pixel_hsl.s *= hsl_shift.s * 2.0; } else { - pixel_hsl[1] = pixel_hsl[1] + (1.0 - pixel_hsl[1]) * - ((hsl_shift[1] - 0.5) * 2.0); + pixel_hsl.s = pixel_hsl.s + (1.0 - pixel_hsl.s) * + ((hsl_shift.s - 0.5) * 2.0); } } // Change the lightness. - if (hsl_shift[2] >= 0) { - if (hsl_shift[2] <= 0.5) { - pixel_hsl[2] *= hsl_shift[2] * 2.0; + if (hsl_shift.l >= 0) { + if (hsl_shift.l <= 0.5) { + pixel_hsl.l *= hsl_shift.l * 2.0; } else { - pixel_hsl[2] = pixel_hsl[2] + (1.0 - pixel_hsl[2]) * - ((hsl_shift[2] - 0.5) * 2.0); + pixel_hsl.l = pixel_hsl.l + (1.0 - pixel_hsl.l) * + ((hsl_shift.l - 0.5) * 2.0); } } |