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

Side by Side Diff: skia/ext/skia_utils_mac.mm

Issue 348069: Restoring r29827.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/skia_utils_mac.h" 5 #include "skia/ext/skia_utils_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_cftyperef.h" 10 #include "base/scoped_cftyperef.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) { 170 NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) {
171 // First convert SkBitmap to CGImageRef. 171 // First convert SkBitmap to CGImageRef.
172 CGImageRef cgimage = SkCreateCGImageRef(skiaBitmap); 172 CGImageRef cgimage = SkCreateCGImageRef(skiaBitmap);
173 173
174 // Now convert to NSImage. 174 // Now convert to NSImage.
175 NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] 175 NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc]
176 initWithCGImage:cgimage] autorelease]; 176 initWithCGImage:cgimage] autorelease];
177 CFRelease(cgimage); 177 CFRelease(cgimage);
178 NSImage* image = [[[NSImage alloc] init] autorelease]; 178 NSImage* image = [[[NSImage alloc] init] autorelease];
179 [image addRepresentation:bitmap]; 179 [image addRepresentation:bitmap];
180 [image setSize:NSMakeSize(skiaBitmap.width(), skiaBitmap.height())];
180 return image; 181 return image;
181 } 182 }
182 183
183 } // namespace gfx 184 } // namespace gfx
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698