Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |