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

Side by Side Diff: webkit/glue/webcursor_mac.mm

Issue 155320: Fix custom cursors on Mac. Null and 0 turn out not to be opposites.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/api/src/WebImageCG.cpp ('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) 2008 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "webkit/glue/webcursor.h" 5 #include "webkit/glue/webcursor.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 custom_size.width()*4, 42 custom_size.width()*4,
43 cg_color.get(), 43 cg_color.get(),
44 kCGImageAlphaPremultipliedLast | 44 kCGImageAlphaPremultipliedLast |
45 kCGBitmapByteOrder32Big)); 45 kCGBitmapByteOrder32Big));
46 return CGBitmapContextCreateImage(context.get()); 46 return CGBitmapContextCreateImage(context.get());
47 } 47 }
48 48
49 NSCursor* CreateCustomCursor(const std::vector<char>& custom_data, 49 NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
50 const gfx::Size& custom_size, 50 const gfx::Size& custom_size,
51 const gfx::Point& hotspot) { 51 const gfx::Point& hotspot) {
52 DCHECK(!custom_data.empty());
pink (ping after 24hrs) 2009/07/09 21:30:31 is it worth being over-protective (since this take
darin (slow to review) 2009/07/09 21:35:45 we should only reach here if webkit tries to send
53
52 scoped_cftyperef<CGImageRef> cg_image( 54 scoped_cftyperef<CGImageRef> cg_image(
53 CreateCGImageFromCustomData(custom_data, custom_size)); 55 CreateCGImageFromCustomData(custom_data, custom_size));
54 56
55 NSBitmapImageRep* ns_bitmap = 57 NSBitmapImageRep* ns_bitmap =
56 [[NSBitmapImageRep alloc] initWithCGImage:cg_image.get()]; 58 [[NSBitmapImageRep alloc] initWithCGImage:cg_image.get()];
57 NSImage* cursor_image = [[NSImage alloc] init]; 59 NSImage* cursor_image = [[NSImage alloc] init];
58 DCHECK(cursor_image); 60 DCHECK(cursor_image);
59 [cursor_image addRepresentation:ns_bitmap]; 61 [cursor_image addRepresentation:ns_bitmap];
60 [ns_bitmap release]; 62 [ns_bitmap release];
61 63
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return true; 211 return true;
210 } 212 }
211 213
212 void WebCursor::CleanupPlatformData() { 214 void WebCursor::CleanupPlatformData() {
213 return; 215 return;
214 } 216 }
215 217
216 void WebCursor::CopyPlatformData(const WebCursor& other) { 218 void WebCursor::CopyPlatformData(const WebCursor& other) {
217 return; 219 return;
218 } 220 }
OLDNEW
« no previous file with comments | « webkit/api/src/WebImageCG.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698