summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils_mac.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 18:16:39 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 18:16:39 +0000
commit3194e1ed74d74c12ff6dc6b9c0b0b5236cb1634a (patch)
treeb7e5e5277693298bcfaf1c3149e34a2789636314 /skia/ext/skia_utils_mac.mm
parent291d87ee329b9283c74125bbd933f19e629dcac1 (diff)
downloadchromium_src-3194e1ed74d74c12ff6dc6b9c0b0b5236cb1634a.zip
chromium_src-3194e1ed74d74c12ff6dc6b9c0b0b5236cb1634a.tar.gz
chromium_src-3194e1ed74d74c12ff6dc6b9c0b0b5236cb1634a.tar.bz2
Add favicons to tabs on the Mac. Also moved SkBitmapToNSImage() to
skia/ext/skia_utils_mac.h and removed chrome/browser/cocoa/cocoa_utils.h. Patch by rsesek. BUG=13565 http://codereview.chromium.org/131018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/skia_utils_mac.mm')
-rw-r--r--skia/ext/skia_utils_mac.mm14
1 files changed, 14 insertions, 0 deletions
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
index 463fd52..5da38df 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