Chromium Code Reviews| 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..9830da4adea30a714f5717e0a5571d6abfb3d2bd 100644 |
| --- a/ui/gfx/image/image_skia_util_mac.mm |
| +++ b/ui/gfx/image/image_skia_util_mac.mm |
| @@ -102,4 +102,23 @@ 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]); |
| + |
| + std::vector<gfx::ImageSkiaRep> image_reps = image_skia.GetRepresentations(); |
|
Nico
2012/08/17 05:32:35
const ref?
sadrul
2012/08/17 05:57:43
Done.
|
| + 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 |