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

Unified Diff: ui/gfx/image/image_skia_operations.cc

Issue 10783015: Add ability to store hidpi theme images in data pack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « ui/gfx/image/image_skia_operations.h ('k') | ui/gfx/image/image_skia_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « ui/gfx/image/image_skia_operations.h ('k') | ui/gfx/image/image_skia_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698