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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 DriWindow* window = window_manager_->GetWindow(cursor_window_); | 65 DriWindow* window = window_manager_->GetWindow(cursor_window_); |
66 const gfx::Size& size = window->GetBounds().size(); | 66 const gfx::Size& size = window->GetBounds().size(); |
67 cursor_location_.SetToMax(gfx::PointF(0, 0)); | 67 cursor_location_.SetToMax(gfx::PointF(0, 0)); |
68 // Right and bottom edges are exclusive. | 68 // Right and bottom edges are exclusive. |
69 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); | 69 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); |
70 | 70 |
71 if (cursor_.get()) | 71 if (cursor_.get()) |
72 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location()); | 72 hardware_->MoveHardwareCursor(cursor_window_, bitmap_location()); |
73 } | 73 } |
74 | 74 |
| 75 void DriCursor::MoveCursorTo(const gfx::PointF& location) { |
| 76 MoveCursorTo(cursor_window_, location); |
| 77 } |
| 78 |
75 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { | 79 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { |
76 MoveCursorTo(cursor_window_, cursor_location_ + delta); | 80 MoveCursorTo(cursor_window_, cursor_location_ + delta); |
77 } | 81 } |
78 | 82 |
| 83 gfx::Rect DriCursor::GetCursorDisplayBounds() { |
| 84 if (cursor_window_ == gfx::kNullAcceleratedWidget) |
| 85 return gfx::Rect(); |
| 86 |
| 87 DriWindow* window = window_manager_->GetWindow(cursor_window_); |
| 88 return window->GetBounds(); |
| 89 } |
| 90 |
79 gfx::AcceleratedWidget DriCursor::GetCursorWindow() { | 91 gfx::AcceleratedWidget DriCursor::GetCursorWindow() { |
80 return cursor_window_; | 92 return cursor_window_; |
81 } | 93 } |
82 | 94 |
83 bool DriCursor::IsCursorVisible() { | 95 bool DriCursor::IsCursorVisible() { |
84 return cursor_.get(); | 96 return cursor_.get(); |
85 } | 97 } |
86 | 98 |
87 gfx::PointF DriCursor::location() { | 99 gfx::PointF DriCursor::location() { |
88 return cursor_location_; | 100 return cursor_location_; |
89 } | 101 } |
90 | 102 |
91 gfx::Point DriCursor::bitmap_location() { | 103 gfx::Point DriCursor::bitmap_location() { |
92 return gfx::ToFlooredPoint(cursor_location_) - | 104 return gfx::ToFlooredPoint(cursor_location_) - |
93 cursor_->hotspot().OffsetFromOrigin(); | 105 cursor_->hotspot().OffsetFromOrigin(); |
94 } | 106 } |
95 | 107 |
96 } // namespace ui | 108 } // namespace ui |
OLD | NEW |