OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_IMPL_H_ | |
6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_IMPL_H_ | |
7 | |
8 #include "base/timer/timer.h" | |
9 #include "ui/gfx/geometry/point.h" | |
10 #include "ui/gfx/geometry/rect.h" | |
11 #include "ui/gfx/native_widget_types.h" | |
12 #include "ui/ozone/ozone_export.h" | |
13 #include "ui/ozone/platform/dri/display_change_observer.h" | |
14 #include "ui/ozone/platform/dri/dri_window_delegate.h" | |
15 | |
16 namespace ui { | |
17 | |
18 class DriBuffer; | |
19 class DrmDeviceManager; | |
20 class HardwareDisplayController; | |
21 class ScreenManager; | |
22 | |
23 class OZONE_EXPORT DriWindowDelegateImpl : public DriWindowDelegate, | |
24 public DisplayChangeObserver { | |
25 public: | |
26 DriWindowDelegateImpl(gfx::AcceleratedWidget widget, | |
27 DrmDeviceManager* device_manager, | |
28 ScreenManager* screen_manager); | |
29 ~DriWindowDelegateImpl() override; | |
30 | |
31 // DriWindowDelegate: | |
32 void Initialize() override; | |
33 void Shutdown() override; | |
34 gfx::AcceleratedWidget GetAcceleratedWidget() override; | |
35 HardwareDisplayController* GetController() override; | |
36 void OnBoundsChanged(const gfx::Rect& bounds) override; | |
37 void SetCursor(const std::vector<SkBitmap>& bitmaps, | |
38 const gfx::Point& location, | |
39 int frame_delay_ms) override; | |
40 void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps, | |
41 const gfx::Point& location) override; | |
42 void MoveCursor(const gfx::Point& location) override; | |
43 | |
44 // DisplayChangeObserver: | |
45 void OnDisplayChanged(HardwareDisplayController* controller) override; | |
46 void OnDisplayRemoved(HardwareDisplayController* controller) override; | |
47 | |
48 private: | |
49 // Draw the last set cursor & update the cursor plane. | |
50 void ResetCursor(bool bitmap_only); | |
51 | |
52 // Draw next frame in an animated cursor. | |
53 void OnCursorAnimationTimeout(); | |
54 | |
55 void UpdateWidgetToDrmDeviceMapping(); | |
56 | |
57 // When |controller_| changes this is called to reallocate the cursor buffers | |
58 // since the allocation DRM device may have changed. | |
59 void UpdateCursorBuffers(); | |
60 | |
61 gfx::AcceleratedWidget widget_; | |
62 | |
63 DrmDeviceManager* device_manager_; // Not owned. | |
64 ScreenManager* screen_manager_; // Not owned. | |
65 | |
66 // The current bounds of the window. | |
67 gfx::Rect bounds_; | |
68 | |
69 // The controller associated with the current window. This may be nullptr if | |
70 // the window isn't over an active display. | |
71 HardwareDisplayController* controller_; | |
72 | |
73 base::RepeatingTimer<DriWindowDelegateImpl> cursor_timer_; | |
74 | |
75 scoped_refptr<DriBuffer> cursor_buffers_[2]; | |
76 int cursor_frontbuffer_; | |
77 | |
78 std::vector<SkBitmap> cursor_bitmaps_; | |
79 gfx::Point cursor_location_; | |
80 int cursor_frame_; | |
81 int cursor_frame_delay_ms_; | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(DriWindowDelegateImpl); | |
84 }; | |
85 | |
86 } // namespace ui | |
87 | |
88 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_IMPL_H_ | |
OLD | NEW |