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

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

Issue 1424913007: Added ImageFamily::CreateExact, which scales the best image to size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master-plus
Patch Set: Added test for CreateExact on an non-N32 bitmap. Created 5 years, 1 month 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_family.h
diff --git a/ui/gfx/image/image_family.h b/ui/gfx/image/image_family.h
index c092b2a87ca521a4ff78678581fc332b3bfed8fa..e8920b9a88f44bc8530191e4a6dbbbee0da99c27 100644
--- a/ui/gfx/image/image_family.h
+++ b/ui/gfx/image/image_family.h
@@ -136,6 +136,17 @@ class GFX_EXPORT ImageFamily {
// NULL.
const gfx::Image* GetBest(const gfx::Size& size) const;
+ // Gets an image of size |width|x|height|. If no image of that exact size
+ // exists, chooses the nearest larger image using GetBest() and scales it to
+ // the desired size. If there are no images in the family, returns an empty
+ // image.
+ gfx::Image CreateExact(int width, int height) const;
+
+ // Gets an image of size |size|. If no image of that exact size exists,
+ // chooses the nearest larger image using GetBest() and scales it to the
+ // desired size. If there are no images in the family, returns an empty image.
+ gfx::Image CreateExact(const gfx::Size& size) const;
Peter Kasting 2015/11/05 05:49:27 Does anyone call this variant? In an ideal world
Matt Giuca 2015/11/05 06:22:50 The code I've got lined up behind this uses the gf
Peter Kasting 2015/11/05 06:24:57 I don't think it's a big deal either way and you o
Robert Sesek 2015/11/05 16:05:56 I tend to agree with Peter that it'd be good to on
Matt Giuca 2015/11/06 04:15:18 OK since neither of you feel strongly, I'll keep i
+
private:
// Find the closest aspect ratio in the map to |desired_aspect|.
// Ties are broken by the thinner aspect.
« ui/gfx/icon_util.cc ('K') | « ui/gfx/icon_util.cc ('k') | ui/gfx/image/image_family.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698