OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAMILY_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_FAMILY_H_ |
6 #define UI_GFX_IMAGE_IMAGE_FAMILY_H_ | 6 #define UI_GFX_IMAGE_IMAGE_FAMILY_H_ |
7 | 7 |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ~ImageFamily(); | 99 ~ImageFamily(); |
100 | 100 |
101 // Gets an iterator to the first image. | 101 // Gets an iterator to the first image. |
102 const_iterator begin() const { return const_iterator(map_.begin()); } | 102 const_iterator begin() const { return const_iterator(map_.begin()); } |
103 // Gets an iterator to one after the last image. | 103 // Gets an iterator to one after the last image. |
104 const_iterator end() const { return const_iterator(map_.end()); } | 104 const_iterator end() const { return const_iterator(map_.end()); } |
105 | 105 |
106 // Determines whether the image family has no images in it. | 106 // Determines whether the image family has no images in it. |
107 bool empty() const { return map_.empty(); } | 107 bool empty() const { return map_.empty(); } |
108 | 108 |
| 109 // Returns the number of images in the family. |
| 110 size_t size() const { return map_.size(); } |
| 111 |
109 // Removes all images from the family. | 112 // Removes all images from the family. |
110 void clear() { return map_.clear(); } | 113 void clear() { return map_.clear(); } |
111 | 114 |
112 // Adds an image to the family. If another image is already present at the | 115 // Adds an image to the family. If another image is already present at the |
113 // same size, it will be overwritten. | 116 // same size, it will be overwritten. |
114 void Add(const gfx::Image& image); | 117 void Add(const gfx::Image& image); |
115 | 118 |
116 // Adds an image to the family. If another image is already present at the | 119 // Adds an image to the family. If another image is already present at the |
117 // same size, it will be overwritten. | 120 // same size, it will be overwritten. |
118 void Add(const gfx::ImageSkia& image_skia); | 121 void Add(const gfx::ImageSkia& image_skia); |
(...skipping 28 matching lines...) Expand all Loading... |
147 // |map_| of aspect ratio |aspect|. | 150 // |map_| of aspect ratio |aspect|. |
148 const gfx::Image* GetWithExactAspect(float aspect, int width) const; | 151 const gfx::Image* GetWithExactAspect(float aspect, int width) const; |
149 | 152 |
150 // Map from (aspect ratio, width) to image. | 153 // Map from (aspect ratio, width) to image. |
151 std::map<MapKey, gfx::Image> map_; | 154 std::map<MapKey, gfx::Image> map_; |
152 }; | 155 }; |
153 | 156 |
154 } // namespace gfx | 157 } // namespace gfx |
155 | 158 |
156 #endif // UI_GFX_IMAGE_IMAGE_FAMILY_H_ | 159 #endif // UI_GFX_IMAGE_IMAGE_FAMILY_H_ |
OLD | NEW |