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/ozone/platform/dri/dri_cursor.h" | 5 #include "ui/ozone/platform/dri/dri_cursor.h" |
6 | 6 |
7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
8 #include "ui/gfx/geometry/point.h" | 8 #include "ui/gfx/geometry/point.h" |
9 #include "ui/gfx/geometry/point_conversions.h" | 9 #include "ui/gfx/geometry/point_conversions.h" |
10 #include "ui/gfx/geometry/point_f.h" | 10 #include "ui/gfx/geometry/point_f.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (cursor_ == cursor || cursor_window_ != widget) | 33 if (cursor_ == cursor || cursor_window_ != widget) |
34 return; | 34 return; |
35 | 35 |
36 cursor_ = cursor; | 36 cursor_ = cursor; |
37 ShowCursor(); | 37 ShowCursor(); |
38 } | 38 } |
39 | 39 |
40 void DriCursor::ShowCursor() { | 40 void DriCursor::ShowCursor() { |
41 DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget); | 41 DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget); |
42 if (cursor_.get()) | 42 if (cursor_.get()) |
43 hardware_->SetHardwareCursor(cursor_window_, | 43 hardware_->SetHardwareCursor(cursor_window_, cursor_->bitmaps(), |
44 cursor_->bitmaps(), | 44 bitmap_location(), cursor_->frame_delay_ms()); |
45 bitmap_location(), | |
46 cursor_->frame_delay_ms()); | |
47 else | 45 else |
48 HideCursor(); | 46 HideCursor(); |
49 } | 47 } |
50 | 48 |
51 void DriCursor::HideCursor() { | 49 void DriCursor::HideCursor() { |
52 DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget); | 50 DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget); |
53 hardware_->SetHardwareCursor( | 51 hardware_->SetHardwareCursor(cursor_window_, std::vector<SkBitmap>(), |
54 cursor_window_, std::vector<SkBitmap>(), gfx::Point(), 0); | 52 gfx::Point(), 0); |
55 } | 53 } |
56 | 54 |
57 void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget, | 55 void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget, |
58 const gfx::PointF& location) { | 56 const gfx::PointF& location) { |
59 if (widget != cursor_window_ && cursor_window_ != gfx::kNullAcceleratedWidget) | 57 if (widget != cursor_window_ && cursor_window_ != gfx::kNullAcceleratedWidget) |
60 HideCursor(); | 58 HideCursor(); |
61 | 59 |
62 cursor_window_ = widget; | 60 cursor_window_ = widget; |
63 cursor_location_ = location; | 61 cursor_location_ = location; |
64 | 62 |
(...skipping 25 matching lines...) Expand all Loading... |
90 gfx::PointF DriCursor::location() { | 88 gfx::PointF DriCursor::location() { |
91 return cursor_location_; | 89 return cursor_location_; |
92 } | 90 } |
93 | 91 |
94 gfx::Point DriCursor::bitmap_location() { | 92 gfx::Point DriCursor::bitmap_location() { |
95 return gfx::ToFlooredPoint(cursor_location_) - | 93 return gfx::ToFlooredPoint(cursor_location_) - |
96 cursor_->hotspot().OffsetFromOrigin(); | 94 cursor_->hotspot().OffsetFromOrigin(); |
97 } | 95 } |
98 | 96 |
99 } // namespace ui | 97 } // namespace ui |
OLD | NEW |