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

Side by Side Diff: ui/gfx/image/image_skia.h

Issue 10699065: chromeos: Fix pixelated icons in app list and launcher (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_ 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_
6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_ 6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "ui/base/ui_export.h" 13 #include "ui/base/ui_export.h"
14 #include "ui/gfx/image/image_skia_rep.h" 14 #include "ui/gfx/image/image_skia_rep.h"
15 #include "ui/gfx/shadow_value.h"
15 16
16 namespace gfx { 17 namespace gfx {
17 18
19 class Size;
20
18 namespace internal { 21 namespace internal {
19 class ImageSkiaStorage; 22 class ImageSkiaStorage;
20 } // namespace internal 23 } // namespace internal
21 24
22 // Container for the same image at different densities, similar to NSImage. 25 // Container for the same image at different densities, similar to NSImage.
23 // Image height and width are in DIP (Device Indepent Pixel) coordinates. 26 // Image height and width are in DIP (Device Indepent Pixel) coordinates.
24 // 27 //
25 // ImageSkia should be used whenever possible instead of SkBitmap. 28 // ImageSkia should be used whenever possible instead of SkBitmap.
26 // Functions that mutate the image should operate on the gfx::ImageSkiaRep 29 // Functions that mutate the image should operate on the gfx::ImageSkiaRep
27 // returned from ImageSkia::GetRepresentation, not on ImageSkia. 30 // returned from ImageSkia::GetRepresentation, not on ImageSkia.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 bool isNull() const { return storage_ == NULL; } 96 bool isNull() const { return storage_ == NULL; }
94 97
95 // Width and height of image in DIP coordinate system. 98 // Width and height of image in DIP coordinate system.
96 int width() const; 99 int width() const;
97 int height() const; 100 int height() const;
98 101
99 // Wrapper function for SkBitmap::extractBitmap. 102 // Wrapper function for SkBitmap::extractBitmap.
100 // Operates on each stored image rep. 103 // Operates on each stored image rep.
101 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const; 104 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const;
102 105
106 // Returns a resized image by running skia::ImageOperations::Resize on
107 // all representations.
108 ImageSkia Resize(const gfx::Size& size) const;
109
110 // Returns an image with drop shadows added for all representations.
111 ImageSkia CreateDropShadow(const gfx::ShadowValues& shadows) const;
oshima 2012/07/03 03:47:26 Can you use new interface gfx::ImageSkiaSource (ht
xiyuan 2012/07/03 22:16:00 Done.
112
103 // Returns pointer to an SkBitmap contained by this object. 113 // Returns pointer to an SkBitmap contained by this object.
104 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is 114 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is
105 // done. 115 // done.
106 const SkBitmap* bitmap() const; 116 const SkBitmap* bitmap() const;
107 117
108 // Returns a vector with the image reps contained in this object. 118 // Returns a vector with the image reps contained in this object.
109 std::vector<gfx::ImageSkiaRep> image_reps() const; 119 std::vector<gfx::ImageSkiaRep> image_reps() const;
110 120
111 private: 121 private:
112 // Initialize ImageSkiaStorage with passed in parameters. 122 // Initialize ImageSkiaStorage with passed in parameters.
113 // If the image rep's bitmap is empty, ImageStorage is set to NULL. 123 // If the image rep's bitmap is empty, ImageStorage is set to NULL.
114 void Init(const gfx::ImageSkiaRep& image_rep); 124 void Init(const gfx::ImageSkiaRep& image_rep);
115 125
116 // A null image rep to return as not to return a temporary. 126 // A null image rep to return as not to return a temporary.
117 static gfx::ImageSkiaRep& NullImageRep(); 127 static gfx::ImageSkiaRep& NullImageRep();
118 128
119 // Returns the iterator of the image rep whose density best matches 129 // Returns the iterator of the image rep whose density best matches
120 // |scale_factor|. 130 // |scale_factor|.
121 // ImageSkiaStorage cannot be NULL when this function is called. 131 // ImageSkiaStorage cannot be NULL when this function is called.
122 ImageSkiaReps::iterator FindRepresentation( 132 ImageSkiaReps::iterator FindRepresentation(
123 ui::ScaleFactor scale_factor) const; 133 ui::ScaleFactor scale_factor) const;
124 134
125 // A refptr so that ImageRepSkia can be copied cheaply. 135 // A refptr so that ImageRepSkia can be copied cheaply.
126 scoped_refptr<internal::ImageSkiaStorage> storage_; 136 scoped_refptr<internal::ImageSkiaStorage> storage_;
127 }; 137 };
128 138
129 } // namespace gfx 139 } // namespace gfx
130 140
131 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ 141 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_
OLDNEW
« no previous file with comments | « ui/app_list/icon_cache.cc ('k') | ui/gfx/image/image_skia.cc » ('j') | ui/gfx/shadow_value.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698