Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: ui/ozone/platform/dri/dri_cursor.cc

Issue 762963002: ozone: dri: Cache display bounds in DriCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_cursor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/dri_cursor.cc
diff --git a/ui/ozone/platform/dri/dri_cursor.cc b/ui/ozone/platform/dri/dri_cursor.cc
index d500bbbc38fd2bfaa04df1cedcfc1fe2afa1fa7b..e03cf9341e86929990e5d35aa5c0b27497024d5e 100644
--- a/ui/ozone/platform/dri/dri_cursor.cc
+++ b/ui/ozone/platform/dri/dri_cursor.cc
@@ -61,14 +61,13 @@ void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget,
if (widget != cursor_window_ && cursor_window_ != gfx::kNullAcceleratedWidget)
HideCursor();
+ DriWindow* window = window_manager_->GetWindow(widget);
+
cursor_window_ = widget;
cursor_location_ = location;
+ cursor_display_bounds_ = window->GetBounds();
- if (cursor_window_ == gfx::kNullAcceleratedWidget)
- return;
-
- DriWindow* window = window_manager_->GetWindow(cursor_window_);
- const gfx::Size& size = window->GetBounds().size();
+ const gfx::Size& size = cursor_display_bounds_.size();
cursor_location_.SetToMax(gfx::PointF(0, 0));
// Right and bottom edges are exclusive.
cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1));
@@ -88,6 +87,9 @@ void DriCursor::MoveCursorTo(const gfx::PointF& location) {
}
void DriCursor::MoveCursor(const gfx::Vector2dF& delta) {
+ if (cursor_window_ == gfx::kNullAcceleratedWidget)
+ return;
+
#if defined(OS_CHROMEOS)
gfx::Vector2dF transformed_delta = delta;
ui::CursorController::GetInstance()->ApplyCursorConfigForWindow(
@@ -99,11 +101,7 @@ void DriCursor::MoveCursor(const gfx::Vector2dF& delta) {
}
gfx::Rect DriCursor::GetCursorDisplayBounds() {
- if (cursor_window_ == gfx::kNullAcceleratedWidget)
- return gfx::Rect();
-
- DriWindow* window = window_manager_->GetWindow(cursor_window_);
- return window->GetBounds();
+ return cursor_display_bounds_;
}
gfx::AcceleratedWidget DriCursor::GetCursorWindow() {
« no previous file with comments | « ui/ozone/platform/dri/dri_cursor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698