| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 5 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/base/cursor/cursors_aura.h" | 9 #include "ui/base/cursor/cursors_aura.h" |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 PlatformCursor platform_cursor) { | 72 PlatformCursor platform_cursor) { |
| 73 return make_scoped_refptr(ToBitmapCursorOzone(platform_cursor)); | 73 return make_scoped_refptr(ToBitmapCursorOzone(platform_cursor)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) { | 76 PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) { |
| 77 return GetDefaultCursorInternal(type).get(); | 77 return GetDefaultCursorInternal(type).get(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 PlatformCursor BitmapCursorFactoryOzone::CreateImageCursor( | 80 PlatformCursor BitmapCursorFactoryOzone::CreateImageCursor( |
| 81 const SkBitmap& bitmap, | 81 const SkBitmap& bitmap, |
| 82 const gfx::Point& hotspot) { | 82 const gfx::Point& hotspot, |
| 83 float bitmap_dpi) { |
| 83 BitmapCursorOzone* cursor = new BitmapCursorOzone(bitmap, hotspot); | 84 BitmapCursorOzone* cursor = new BitmapCursorOzone(bitmap, hotspot); |
| 84 cursor->AddRef(); // Balanced by UnrefImageCursor. | 85 cursor->AddRef(); // Balanced by UnrefImageCursor. |
| 85 return ToPlatformCursor(cursor); | 86 return ToPlatformCursor(cursor); |
| 86 } | 87 } |
| 87 | 88 |
| 88 PlatformCursor BitmapCursorFactoryOzone::CreateAnimatedCursor( | 89 PlatformCursor BitmapCursorFactoryOzone::CreateAnimatedCursor( |
| 89 const std::vector<SkBitmap>& bitmaps, | 90 const std::vector<SkBitmap>& bitmaps, |
| 90 const gfx::Point& hotspot, | 91 const gfx::Point& hotspot, |
| 91 int frame_delay_ms) { | 92 int frame_delay_ms, |
| 93 float bitmap_dpi) { |
| 92 DCHECK_LT(0U, bitmaps.size()); | 94 DCHECK_LT(0U, bitmaps.size()); |
| 93 BitmapCursorOzone* cursor = | 95 BitmapCursorOzone* cursor = |
| 94 new BitmapCursorOzone(bitmaps, hotspot, frame_delay_ms); | 96 new BitmapCursorOzone(bitmaps, hotspot, frame_delay_ms); |
| 95 cursor->AddRef(); // Balanced by UnrefImageCursor. | 97 cursor->AddRef(); // Balanced by UnrefImageCursor. |
| 96 return ToPlatformCursor(cursor); | 98 return ToPlatformCursor(cursor); |
| 97 } | 99 } |
| 98 | 100 |
| 99 void BitmapCursorFactoryOzone::RefImageCursor(PlatformCursor cursor) { | 101 void BitmapCursorFactoryOzone::RefImageCursor(PlatformCursor cursor) { |
| 100 ToBitmapCursorOzone(cursor)->AddRef(); | 102 ToBitmapCursorOzone(cursor)->AddRef(); |
| 101 } | 103 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 cursor = GetDefaultCursorInternal(kCursorPointer); | 119 cursor = GetDefaultCursorInternal(kCursorPointer); |
| 118 DCHECK(cursor.get()) << "Failed to load default cursor bitmap"; | 120 DCHECK(cursor.get()) << "Failed to load default cursor bitmap"; |
| 119 default_cursors_[type] = cursor; | 121 default_cursors_[type] = cursor; |
| 120 } | 122 } |
| 121 | 123 |
| 122 // Returned owned default cursor for this type. | 124 // Returned owned default cursor for this type. |
| 123 return default_cursors_[type]; | 125 return default_cursors_[type]; |
| 124 } | 126 } |
| 125 | 127 |
| 126 } // namespace ui | 128 } // namespace ui |
| OLD | NEW |