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

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

Issue 10928093: Adds an iOS implementation of gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@skia
Patch Set: Cleanup. Created 8 years, 3 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.h
diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h
index 999e397c6176a863002a30430f80e1c63651e471..1dc120ddd9e652b8f9237708fce920276b632366 100644
--- a/ui/gfx/image/image.h
+++ b/ui/gfx/image/image.h
@@ -52,6 +52,7 @@ class UI_EXPORT Image {
enum RepresentationType {
kImageRepGdk,
kImageRepCocoa,
+ kImageRepCocoaTouch,
kImageRepCairo,
kImageRepSkia,
kImageRepPNG,
@@ -80,6 +81,9 @@ class UI_EXPORT Image {
#if defined(TOOLKIT_GTK)
// Does not increase |pixbuf|'s reference count; expects to take ownership.
explicit Image(GdkPixbuf* pixbuf);
+#elif defined(OS_IOS)
+ // Does not retain |image|; expects to take ownership.
+ explicit Image(UIImage* image);
#elif defined(OS_MACOSX)
// Does not retain |image|; expects to take ownership.
// A single NSImage object can contain multiple bitmaps so there's no reason
@@ -106,6 +110,8 @@ class UI_EXPORT Image {
#if defined(TOOLKIT_GTK)
GdkPixbuf* ToGdkPixbuf() const;
CairoCachedSurface* const ToCairo() const;
+#elif defined(OS_IOS)
+ UIImage* ToUIImage() const;
#elif defined(OS_MACOSX)
NSImage* ToNSImage() const;
#endif
@@ -117,7 +123,7 @@ class UI_EXPORT Image {
// image is empty.
ImageSkia AsImageSkia() const;
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) && !defined(OS_IOS)
// Same as ToSkBitmap(), but returns nil if this image is empty.
NSImage* AsNSImage() const;
#endif
@@ -133,13 +139,17 @@ class UI_EXPORT Image {
SkBitmap* CopySkBitmap() const;
#if defined(TOOLKIT_GTK)
GdkPixbuf* CopyGdkPixbuf() const;
+#elif defined(OS_IOS)
+ UIImage* CopyUIImage() const;
#elif defined(OS_MACOSX)
NSImage* CopyNSImage() const;
#endif
// DEPRECATED ----------------------------------------------------------------
// Conversion handlers. These wrap the ToType() variants.
-#if defined(OS_MACOSX)
+#if defined(OS_IOS)
+ operator UIImage*() const;
Robert Sesek 2012/09/13 16:14:24 Remove. We're trying to kill the operators.
rohitrao (ping after 24h) 2012/09/13 17:57:57 I probably need to keep this in the downstream tre
+#elif defined(OS_MACOSX)
operator NSImage*() const;
#endif
// ---------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698