| OLD | NEW |
| 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 "webkit/glue/webcursor.h" | 5 #include "webkit/glue/webcursor.h" |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "NativeImageSkia.h" | 8 #include "NativeImageSkia.h" |
| 9 #include "PlatformCursor.h" | 9 #include "PlatformCursor.h" |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool WebCursor::IsEqual(const WebCursor& other) const { | 72 bool WebCursor::IsEqual(const WebCursor& other) const { |
| 73 if (!IsCustom()) | 73 if (!IsCustom()) |
| 74 return type_ == other.type_; | 74 return type_ == other.type_; |
| 75 | 75 |
| 76 return hotspot_ == other.hotspot_ && | 76 return hotspot_ == other.hotspot_ && |
| 77 custom_size_ == other.custom_size_ && | 77 custom_size_ == other.custom_size_ && |
| 78 custom_data_ == other.custom_data_; | 78 custom_data_ == other.custom_data_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 #if !defined(OS_MACOSX) | 81 #if !defined(OS_MACOSX) |
| 82 // The Mac version of Chromium is built with PLATFORM(CG) while all other |
| 83 // versions are PLATFORM(SKIA). We'll keep this Skia implementation here for |
| 84 // common use and put the Mac implementation in webcursor_mac.mm. |
| 82 void WebCursor::SetCustomData(WebCore::Image* image) { | 85 void WebCursor::SetCustomData(WebCore::Image* image) { |
| 83 WebCore::NativeImagePtr image_ptr = image->nativeImageForCurrentFrame(); | 86 WebCore::NativeImagePtr image_ptr = image->nativeImageForCurrentFrame(); |
| 84 if (!image_ptr) | 87 if (!image_ptr) |
| 85 return; | 88 return; |
| 86 | 89 |
| 87 // Fill custom_data_ directly with the NativeImage pixels. | 90 // Fill custom_data_ directly with the NativeImage pixels. |
| 88 SkAutoLockPixels bitmap_lock(*image_ptr); | 91 SkAutoLockPixels bitmap_lock(*image_ptr); |
| 89 custom_data_.resize(image_ptr->getSize()); | 92 custom_data_.resize(image_ptr->getSize()); |
| 90 memcpy(&custom_data_[0], image_ptr->getPixels(), image_ptr->getSize()); | 93 memcpy(&custom_data_[0], image_ptr->getPixels(), image_ptr->getSize()); |
| 91 custom_size_.set_width(image_ptr->width()); | 94 custom_size_.set_width(image_ptr->width()); |
| 92 custom_size_.set_height(image_ptr->height()); | 95 custom_size_.set_height(image_ptr->height()); |
| 93 } | 96 } |
| 94 #else | |
| 95 // The above code should work on the Mac to but evanm was getting forward | |
| 96 // declaration errors. | |
| 97 void WebCursor::SetCustomData(WebCore::Image* image) { | |
| 98 NOTIMPLEMENTED(); | |
| 99 } | |
| 100 #endif | 97 #endif |
| OLD | NEW |