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

Unified Diff: ui/gfx/image/image_skia.h

Issue 10780010: Introduces ImageSkia::GetRepresentations() for Mac (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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/image/image_skia.h
diff --git a/ui/gfx/image/image_skia.h b/ui/gfx/image/image_skia.h
index e6ab0acdd599ea224d3b9df9c9a5697014b54b27..e0b39ff3b522ca4770f516e5f02224b4cf5149eb 100644
--- a/ui/gfx/image/image_skia.h
+++ b/ui/gfx/image/image_skia.h
@@ -73,9 +73,9 @@ class UI_EXPORT ImageSkia {
// Removes the image rep of |scale_factor| if present.
void RemoveRepresentation(ui::ScaleFactor scale_factor);
- // Returns true if the object owns a image rep whose density matches
+ // Returns true if the object owns an image rep whose density matches
// |scale_factor| exactly.
- bool HasRepresentation(ui::ScaleFactor scale_factor);
+ bool HasRepresentation(ui::ScaleFactor scale_factor) const;
// Returns the image rep whose density best matches
// |scale_factor|.
@@ -83,6 +83,11 @@ class UI_EXPORT ImageSkia {
const gfx::ImageSkiaRep& GetRepresentation(
ui::ScaleFactor scale_factor) const;
+ // Returns the image reps contained by this object.
+ // If the image has a source, this method will attempt to generate
+ // representations from the source for all supported scale factors.
+ std::vector<ImageSkiaRep> GetRepresentations() const;
+
// Returns true if object is null or its size is empty.
bool empty() const;
@@ -95,16 +100,17 @@ class UI_EXPORT ImageSkia {
int height() const;
gfx::Size size() const;
- // Wrapper function for SkBitmap::extractBitmap.
// Operates on each stored image rep. Note that it may not have
// all image reps for supported scale factors.
// TODO(oshima|pkotwicz): Investigate if this can be eliminated
// after ImageSkiaSource conversion.
bool extractSubset(ImageSkia* dst, const SkIRect& subset) const;
- // Returns pointer to an SkBitmap contained by this object.
- // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is
- // done.
+ // Returns pointer to 1x bitmap contained by this object. If there is no 1x
+ // bitmap, the bitmap whose scale factor is closest to 1x is returned.
+ // This function should only be used in unittests and on platforms which do
+ // not support scale factors other than 1x.
+ // TODO(pkotwicz): Return null SkBitmap when the object has no 1x bitmap.
const SkBitmap* bitmap() const;
// Returns a vector with the image reps contained in this object.

Powered by Google App Engine
This is Rietveld 408576698