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

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

Issue 10837215: exhibit 1: explicit null checks Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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 | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc ('k') | 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const std::vector<unsigned char>* ToImagePNG() const; 108 const std::vector<unsigned char>* ToImagePNG() const;
109 const SkBitmap* ToSkBitmap() const; 109 const SkBitmap* ToSkBitmap() const;
110 const ImageSkia* ToImageSkia() const; 110 const ImageSkia* ToImageSkia() const;
111 #if defined(TOOLKIT_GTK) 111 #if defined(TOOLKIT_GTK)
112 GdkPixbuf* ToGdkPixbuf() const; 112 GdkPixbuf* ToGdkPixbuf() const;
113 CairoCachedSurface* const ToCairo() const; 113 CairoCachedSurface* const ToCairo() const;
114 #elif defined(OS_MACOSX) 114 #elif defined(OS_MACOSX)
115 NSImage* ToNSImage() const; 115 NSImage* ToNSImage() const;
116 #endif 116 #endif
117 117
118 // Same as ToSkBitmap(), but returns a null SkBitmap if this image is empty.
119 SkBitmap AsBitmap() const;
120
121 // Same as ToImageSkia(), but returns an empty ImageSkia if this
122 // image is empty.
123 ImageSkia AsImageSkia() const;
124
125 #if defined(OS_MACOSX)
126 // Same as ToSkBitmap(), but returns nil if this image is empty.
127 NSImage* AsNSImage() const;
128 #endif
129
130 // Performs a conversion, like above, but returns a copy of the result rather 118 // Performs a conversion, like above, but returns a copy of the result rather
131 // than a weak pointer. The caller is responsible for deleting the result. 119 // than a weak pointer. The caller is responsible for deleting the result.
132 // Note that the result is only a copy in terms of memory management; the 120 // Note that the result is only a copy in terms of memory management; the
133 // backing pixels are shared amongst all copies (a fact of each of the 121 // backing pixels are shared amongst all copies (a fact of each of the
134 // converted representations, rather than a limitation imposed by Image) and 122 // converted representations, rather than a limitation imposed by Image) and
135 // so the result should be considered immutable. 123 // so the result should be considered immutable.
136 std::vector<unsigned char>* CopyImagePNG() const; 124 std::vector<unsigned char>* CopyImagePNG() const;
137 ImageSkia* CopyImageSkia() const; 125 ImageSkia* CopyImageSkia() const;
138 SkBitmap* CopySkBitmap() const; 126 SkBitmap* CopySkBitmap() const;
139 #if defined(TOOLKIT_GTK) 127 #if defined(TOOLKIT_GTK)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // be cheaply copied. 165 // be cheaply copied.
178 scoped_refptr<internal::ImageStorage> storage_; 166 scoped_refptr<internal::ImageStorage> storage_;
179 167
180 friend class ::ImageTest; 168 friend class ::ImageTest;
181 friend class ::ImageMacTest; 169 friend class ::ImageMacTest;
182 }; 170 };
183 171
184 } // namespace gfx 172 } // namespace gfx
185 173
186 #endif // UI_GFX_IMAGE_IMAGE_H_ 174 #endif // UI_GFX_IMAGE_IMAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc ('k') | ui/gfx/image/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698