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

Side by Side Diff: ui/ozone/platform/drm/host/drm_cursor.cc

Issue 2088533002: Refactor ozone drm cursor code for mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/drm/host/drm_cursor.h" 5 #include "ui/ozone/platform/drm/host/drm_cursor.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "ui/gfx/geometry/point_conversions.h" 8 #include "ui/gfx/geometry/point_conversions.h"
9 #include "ui/ozone/platform/drm/host/drm_window_host.h" 9 #include "ui/ozone/platform/drm/host/drm_window_host.h"
10 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" 10 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
11 11
12 #if defined(OS_CHROMEOS) 12 #if defined(OS_CHROMEOS)
13 #include "ui/events/ozone/chromeos/cursor_controller.h" 13 #include "ui/events/ozone/chromeos/cursor_controller.h"
14 #endif 14 #endif
15 15
16 namespace ui { 16 namespace ui {
17 17
18 namespace { 18 namespace {
19 19
20 class NullProxy : public DrmCursorProxy { 20 class NullProxy : public DrmCursorProxy {
21 public: 21 public:
22 NullProxy() {} 22 NullProxy() {}
23 ~NullProxy() override {} 23 ~NullProxy() override {}
24 24
25 void CursorSet(gfx::AcceleratedWidget window, 25 void CursorSet(gfx::AcceleratedWidget window,
26 const std::vector<SkBitmap>& bitmaps, 26 const std::vector<SkBitmap>& bitmaps,
27 const gfx::Point& point, 27 const gfx::Point& point,
28 int frame_delay_ms) override {} 28 int frame_delay_ms) override {}
29 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override {} 29 void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override {}
30 void InitializeOnEvdev() override {}
30 31
31 private: 32 private:
32 DISALLOW_COPY_AND_ASSIGN(NullProxy); 33 DISALLOW_COPY_AND_ASSIGN(NullProxy);
33 }; 34 };
34 35
35 } // namespace 36 } // namespace
36 37
37 DrmCursor::DrmCursor(DrmWindowHostManager* window_manager) 38 DrmCursor::DrmCursor(DrmWindowHostManager* window_manager)
38 : window_(gfx::kNullAcceleratedWidget), 39 : window_(gfx::kNullAcceleratedWidget),
39 window_manager_(window_manager), 40 window_manager_(window_manager),
40 proxy_(new NullProxy()) {} 41 proxy_(new NullProxy()) {
42 evdev_thread_checker_.DetachFromThread();
43 }
41 44
42 DrmCursor::~DrmCursor() {} 45 DrmCursor::~DrmCursor() {}
43 46
44 void DrmCursor::SetDrmCursorProxy(DrmCursorProxy* proxy) { 47 void DrmCursor::SetDrmCursorProxy(DrmCursorProxy* proxy) {
45 TRACE_EVENT0("drmcursor", "DrmCursor::SetDrmCursorProxy"); 48 TRACE_EVENT0("drmcursor", "DrmCursor::SetDrmCursorProxy");
46 DCHECK(thread_checker_.CalledOnValidThread()); 49 DCHECK(thread_checker_.CalledOnValidThread());
47 base::AutoLock lock(lock_); 50 base::AutoLock lock(lock_);
48 proxy_.reset(proxy); 51 proxy_.reset(proxy);
49 } 52 }
50 53
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 173
171 // TODO(spang): Moving between windows doesn't work here, but 174 // TODO(spang): Moving between windows doesn't work here, but
172 // is not needed for current uses. 175 // is not needed for current uses.
173 SetCursorLocationLocked(screen_location - 176 SetCursorLocationLocked(screen_location -
174 display_bounds_in_screen_.OffsetFromOrigin()); 177 display_bounds_in_screen_.OffsetFromOrigin());
175 178
176 SendCursorMoveLocked(); 179 SendCursorMoveLocked();
177 } 180 }
178 181
179 void DrmCursor::MoveCursor(const gfx::Vector2dF& delta) { 182 void DrmCursor::MoveCursor(const gfx::Vector2dF& delta) {
183 DCHECK(evdev_thread_checker_.CalledOnValidThread());
180 TRACE_EVENT0("drmcursor", "DrmCursor::MoveCursor"); 184 TRACE_EVENT0("drmcursor", "DrmCursor::MoveCursor");
181 base::AutoLock lock(lock_); 185 base::AutoLock lock(lock_);
182 186
183 if (window_ == gfx::kNullAcceleratedWidget) 187 if (window_ == gfx::kNullAcceleratedWidget)
184 return; 188 return;
185 189
186 gfx::Point location; 190 gfx::Point location;
187 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
188 gfx::Vector2dF transformed_delta = delta; 192 gfx::Vector2dF transformed_delta = delta;
189 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( 193 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow(
(...skipping 13 matching lines...) Expand all
203 gfx::PointF DrmCursor::GetLocation() { 207 gfx::PointF DrmCursor::GetLocation() {
204 base::AutoLock lock(lock_); 208 base::AutoLock lock(lock_);
205 return location_ + display_bounds_in_screen_.OffsetFromOrigin(); 209 return location_ + display_bounds_in_screen_.OffsetFromOrigin();
206 } 210 }
207 211
208 gfx::Rect DrmCursor::GetCursorConfinedBounds() { 212 gfx::Rect DrmCursor::GetCursorConfinedBounds() {
209 base::AutoLock lock(lock_); 213 base::AutoLock lock(lock_);
210 return confined_bounds_ + display_bounds_in_screen_.OffsetFromOrigin(); 214 return confined_bounds_ + display_bounds_in_screen_.OffsetFromOrigin();
211 } 215 }
212 216
217 void DrmCursor::InitializeOnEvdev() {
218 DCHECK(evdev_thread_checker_.CalledOnValidThread());
219 proxy_->InitializeOnEvdev();
220 }
221
213 void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) { 222 void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) {
214 gfx::PointF clamped_location = location; 223 gfx::PointF clamped_location = location;
215 clamped_location.SetToMax(gfx::PointF(confined_bounds_.origin())); 224 clamped_location.SetToMax(gfx::PointF(confined_bounds_.origin()));
216 // Right and bottom edges are exclusive. 225 // Right and bottom edges are exclusive.
217 clamped_location.SetToMin( 226 clamped_location.SetToMin(
218 gfx::PointF(confined_bounds_.right() - 1, confined_bounds_.bottom() - 1)); 227 gfx::PointF(confined_bounds_.right() - 1, confined_bounds_.bottom() - 1));
219 228
220 location_ = clamped_location; 229 location_ = clamped_location;
221 } 230 }
222 231
(...skipping 26 matching lines...) Expand all
249 } 258 }
250 259
251 void DrmCursor::MoveLockTested(gfx::AcceleratedWidget window, 260 void DrmCursor::MoveLockTested(gfx::AcceleratedWidget window,
252 const gfx::Point& point) { 261 const gfx::Point& point) {
253 lock_.AssertAcquired(); 262 lock_.AssertAcquired();
254 proxy_->Move(window, point); 263 proxy_->Move(window, point);
255 } 264 }
256 265
257 266
258 } // namespace ui 267 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_cursor.h ('k') | ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698