Index: ui/gfx/image/image_skia_operations.cc |
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc |
index 8a563cac8ec12c26af36a2d9173e8721b656b538..c4bbce4ac6fa482259dd75f71423fc7e8a427470 100644 |
--- a/ui/gfx/image/image_skia_operations.cc |
+++ b/ui/gfx/image/image_skia_operations.cc |
@@ -143,7 +143,7 @@ class TiledImageSource : public gfx::ImageSkiaSource { |
} |
private: |
- const ImageSkia& source_; |
+ const ImageSkia source_; |
const int src_x_; |
const int src_y_; |
const int dst_w_; |
@@ -152,6 +152,32 @@ class TiledImageSource : public gfx::ImageSkiaSource { |
DISALLOW_COPY_AND_ASSIGN(TiledImageSource); |
}; |
+class HSLImageSource : public gfx::ImageSkiaSource { |
+ public: |
+ HSLImageSource(const ImageSkia& image, |
+ const color_utils::HSL& hsl_shift) |
+ : image_(image), |
+ hsl_shift_(hsl_shift) { |
+ } |
+ |
+ virtual ~HSLImageSource() { |
+ } |
+ |
+ // gfx::ImageSkiaSource overrides: |
+ virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { |
+ ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor); |
+ return gfx::ImageSkiaRep( |
+ SkBitmapOperations::CreateHSLShiftedBitmap(image_rep.sk_bitmap(), |
+ hsl_shift_), image_rep.scale_factor()); |
+ } |
+ |
+ private: |
+ const gfx::ImageSkia image_; |
+ const color_utils::HSL hsl_shift_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HSLImageSource); |
+}; |
+ |
// ImageSkiaSource which uses SkBitmapOperations::CreateButtonBackground |
// to generate image reps for the target image. |
class ButtonImageSource: public gfx::ImageSkiaSource { |
@@ -310,6 +336,13 @@ ImageSkia ImageSkiaOperations::CreateTiledImage(const ImageSkia& source, |
} |
// static |
+ImageSkia ImageSkiaOperations::CreateHSLShiftedImage( |
+ const ImageSkia& image, |
+ const color_utils::HSL& hsl_shift) { |
+ return ImageSkia(new HSLImageSource(image, hsl_shift), image.size()); |
+} |
+ |
+// static |
ImageSkia ImageSkiaOperations::CreateButtonBackground(SkColor color, |
const ImageSkia& image, |
const ImageSkia& mask) { |