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