| Index: skia/ext/skia_utils_mac.mm
|
| diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
|
| index 463fd5268147e99a152fbe54c05b8a5ed06e0bf0..5da38dffde6d54c4ce0a50ef687c0db8661d1113 100644
|
| --- a/skia/ext/skia_utils_mac.mm
|
| +++ b/skia/ext/skia_utils_mac.mm
|
| @@ -10,6 +10,7 @@
|
| #include "base/scoped_cftyperef.h"
|
| #include "base/scoped_ptr.h"
|
| #include "skia/ext/bitmap_platform_device_mac.h"
|
| +#include "third_party/skia/include/utils/mac/SkCGUtils.h"
|
|
|
| namespace gfx {
|
|
|
| @@ -165,4 +166,17 @@ SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque) {
|
| return bitmap;
|
| }
|
|
|
| +NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) {
|
| + // First convert SkBitmap to CGImageRef.
|
| + CGImageRef cgimage = SkCreateCGImageRef(skiaBitmap);
|
| +
|
| + // Now convert to NSImage.
|
| + NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc]
|
| + initWithCGImage:cgimage] autorelease];
|
| + CFRelease(cgimage);
|
| + NSImage* image = [[[NSImage alloc] init] autorelease];
|
| + [image addRepresentation:bitmap];
|
| + return image;
|
| +}
|
| +
|
| } // namespace gfx
|
|
|