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

Unified Diff: skia/ext/skia_utils_mac.mm

Issue 131018: Add favicons to tabs on the Mac (Closed)
Patch Set: Rebase Created 11 years, 6 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 | « skia/ext/skia_utils_mac.h ('k') | skia/ext/skia_utils_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « skia/ext/skia_utils_mac.h ('k') | skia/ext/skia_utils_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698