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

Side by Side Diff: ui/ozone/platform/dri/dri_window_delegate_impl.cc

Issue 795933008: Allow ability to handle cursor position changes on gpu IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_window_delegate_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_window_delegate_impl.h" 5 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkDevice.h" 9 #include "third_party/skia/include/core/SkDevice.h"
10 #include "third_party/skia/include/core/SkSurface.h" 10 #include "third_party/skia/include/core/SkSurface.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 cursor_location_ = location; 101 cursor_location_ = location;
102 cursor_frame_ = 0; 102 cursor_frame_ = 0;
103 cursor_frame_delay_ms_ = frame_delay_ms; 103 cursor_frame_delay_ms_ = frame_delay_ms;
104 cursor_timer_.Stop(); 104 cursor_timer_.Stop();
105 105
106 if (cursor_frame_delay_ms_) 106 if (cursor_frame_delay_ms_)
107 cursor_timer_.Start( 107 cursor_timer_.Start(
108 FROM_HERE, base::TimeDelta::FromMilliseconds(cursor_frame_delay_ms_), 108 FROM_HERE, base::TimeDelta::FromMilliseconds(cursor_frame_delay_ms_),
109 this, &DriWindowDelegateImpl::OnCursorAnimationTimeout); 109 this, &DriWindowDelegateImpl::OnCursorAnimationTimeout);
110 110
111 ResetCursor(); 111 ResetCursor(false);
112 } 112 }
113 113
114 void DriWindowDelegateImpl::MoveCursor(const gfx::Point& location) { 114 void DriWindowDelegateImpl::MoveCursor(const gfx::Point& location) {
115 cursor_location_ = location; 115 cursor_location_ = location;
116 116
117 if (controller_) 117 if (controller_)
118 controller_->MoveCursor(location); 118 controller_->MoveCursor(location);
119 } 119 }
120 120
121 void DriWindowDelegateImpl::ResetCursor() { 121 void DriWindowDelegateImpl::ResetCursor(bool bitmap_only) {
122 if (cursor_bitmaps_.size()) { 122 if (cursor_bitmaps_.size()) {
123 // Draw new cursor into backbuffer. 123 // Draw new cursor into backbuffer.
124 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(), 124 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(),
125 cursor_bitmaps_[cursor_frame_]); 125 cursor_bitmaps_[cursor_frame_]);
126 126
127 // Reset location & buffer. 127 // Reset location & buffer.
128 if (controller_) { 128 if (controller_) {
129 controller_->MoveCursor(cursor_location_); 129 if (!bitmap_only)
130 controller_->MoveCursor(cursor_location_);
130 controller_->SetCursor(cursor_buffers_[cursor_frontbuffer_ ^ 1]); 131 controller_->SetCursor(cursor_buffers_[cursor_frontbuffer_ ^ 1]);
131 cursor_frontbuffer_ ^= 1; 132 cursor_frontbuffer_ ^= 1;
132 } 133 }
133 } else { 134 } else {
134 // No cursor set. 135 // No cursor set.
135 if (controller_) 136 if (controller_)
136 controller_->UnsetCursor(); 137 controller_->UnsetCursor();
137 } 138 }
138 } 139 }
139 140
140 void DriWindowDelegateImpl::OnCursorAnimationTimeout() { 141 void DriWindowDelegateImpl::OnCursorAnimationTimeout() {
141 cursor_frame_++; 142 cursor_frame_++;
142 cursor_frame_ %= cursor_bitmaps_.size(); 143 cursor_frame_ %= cursor_bitmaps_.size();
143 144
144 ResetCursor(); 145 ResetCursor(true);
145 } 146 }
146 147
147 } // namespace ui 148 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_window_delegate_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698