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

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

Issue 9455062: Add gfx::Image::Image(const SkBitmap&) constructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | ui/gfx/image/image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // An Image wraps an image any flavor, be it platform-native GdkBitmap/NSImage, 5 // An Image wraps an image any flavor, be it platform-native GdkBitmap/NSImage,
6 // or a SkBitmap. This also provides easy conversion to other image types 6 // or a SkBitmap. This also provides easy conversion to other image types
7 // through operator overloading. It will cache the converted representations 7 // through operator overloading. It will cache the converted representations
8 // internally to prevent double-conversion. 8 // internally to prevent double-conversion.
9 // 9 //
10 // The lifetime of both the initial representation and any converted ones are 10 // The lifetime of both the initial representation and any converted ones are
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap; 59 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap;
60 60
61 // Creates an empty image with no representations. 61 // Creates an empty image with no representations.
62 Image(); 62 Image();
63 63
64 // Creates a new image with the default representation. The object will take 64 // Creates a new image with the default representation. The object will take
65 // ownership of the image. 65 // ownership of the image.
66 explicit Image(const SkBitmap* bitmap); 66 explicit Image(const SkBitmap* bitmap);
67 67
68 // Creates a new image by copying the bitmap for use as the default
69 // representation.
70 explicit Image(const SkBitmap& bitmap);
71
68 // To create an Image that supports multiple resolutions pass a vector 72 // To create an Image that supports multiple resolutions pass a vector
69 // of bitmaps, one for each resolution. 73 // of bitmaps, one for each resolution.
70 explicit Image(const std::vector<const SkBitmap*>& bitmaps); 74 explicit Image(const std::vector<const SkBitmap*>& bitmaps);
71 75
72 #if defined(TOOLKIT_USES_GTK) 76 #if defined(TOOLKIT_USES_GTK)
73 // Does not increase |pixbuf|'s reference count; expects to take ownership. 77 // Does not increase |pixbuf|'s reference count; expects to take ownership.
74 explicit Image(GdkPixbuf* pixbuf); 78 explicit Image(GdkPixbuf* pixbuf);
75 #elif defined(OS_MACOSX) 79 #elif defined(OS_MACOSX)
76 // Does not retain |image|; expects to take ownership. 80 // Does not retain |image|; expects to take ownership.
77 // A single NSImage object can contain multiple bitmaps so there's no reason 81 // A single NSImage object can contain multiple bitmaps so there's no reason
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // be cheaply copied. 165 // be cheaply copied.
162 scoped_refptr<internal::ImageStorage> storage_; 166 scoped_refptr<internal::ImageStorage> storage_;
163 167
164 friend class ::ImageTest; 168 friend class ::ImageTest;
165 friend class ::ImageMacTest; 169 friend class ::ImageMacTest;
166 }; 170 };
167 171
168 } // namespace gfx 172 } // namespace gfx
169 173
170 #endif // UI_GFX_IMAGE_IMAGE_H_ 174 #endif // UI_GFX_IMAGE_IMAGE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/image/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698