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

Unified Diff: ui/gfx/image/image_skia_util_mac.mm

Issue 10834382: mac: Remove implicit conversion from ImageSkia to SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/image/image_skia_util_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia_util_mac.mm
diff --git a/ui/gfx/image/image_skia_util_mac.mm b/ui/gfx/image/image_skia_util_mac.mm
index 7fc9053ab1c6713a2c936d2edb53be1eeed43ddb..3b36325e40a4845e4783a6e6bc9d09f3e7bb471c 100644
--- a/ui/gfx/image/image_skia_util_mac.mm
+++ b/ui/gfx/image/image_skia_util_mac.mm
@@ -102,4 +102,24 @@ NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia) {
return [image.release() autorelease];
}
+NSImage* NSImageFromImageSkiaWithColorSpace(const gfx::ImageSkia& image_skia,
+ CGColorSpaceRef color_space) {
+ if (image_skia.empty())
+ return nil;
+
+ scoped_nsobject<NSImage> image([[NSImage alloc] init]);
+
+ const std::vector<gfx::ImageSkiaRep>& image_reps =
+ image_skia.GetRepresentations();
+ for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin();
+ it != image_reps.end(); ++it) {
+ [image addRepresentation:
+ gfx::SkBitmapToNSBitmapImageRepWithColorSpace(it->sk_bitmap(),
+ color_space)];
+ }
+
+ [image setSize:NSMakeSize(image_skia.width(), image_skia.height())];
+ return [image.release() autorelease];
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/image/image_skia_util_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698