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 #ifndef UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ |
6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ | 6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 #include "ui/ozone/platform/dri/hardware_cursor_delegate.h" | 13 #include "ui/ozone/platform/dri/hardware_cursor_delegate.h" |
14 #include "ui/ozone/public/surface_factory_ozone.h" | 14 #include "ui/ozone/public/surface_factory_ozone.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 class DriBuffer; | 18 class DriBuffer; |
19 class DriWindowManager; | 19 class DriWindowDelegateManager; |
20 class DriWrapper; | 20 class DriWrapper; |
21 class ScreenManager; | 21 class ScreenManager; |
22 class SurfaceOzoneCanvas; | 22 class SurfaceOzoneCanvas; |
23 | 23 |
24 // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers. | 24 // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers. |
25 // This implementation is used in conjunction with the software rendering | 25 // This implementation is used in conjunction with the software rendering |
26 // path. | 26 // path. |
27 class DriSurfaceFactory : public SurfaceFactoryOzone, | 27 class DriSurfaceFactory : public SurfaceFactoryOzone, |
28 public HardwareCursorDelegate { | 28 public HardwareCursorDelegate { |
29 public: | 29 public: |
30 static const gfx::AcceleratedWidget kDefaultWidgetHandle; | 30 static const gfx::AcceleratedWidget kDefaultWidgetHandle; |
31 | 31 |
32 DriSurfaceFactory(DriWrapper* drm, | 32 DriSurfaceFactory(DriWrapper* drm, |
33 ScreenManager* screen_manager, | 33 ScreenManager* screen_manager, |
34 DriWindowManager* window_manager); | 34 DriWindowDelegateManager* window_manager); |
35 virtual ~DriSurfaceFactory(); | 35 virtual ~DriSurfaceFactory(); |
36 | 36 |
37 // Describes the state of the hardware after initialization. | 37 // Describes the state of the hardware after initialization. |
38 enum HardwareState { | 38 enum HardwareState { |
39 UNINITIALIZED, | 39 UNINITIALIZED, |
40 INITIALIZED, | 40 INITIALIZED, |
41 FAILED, | 41 FAILED, |
42 }; | 42 }; |
43 | 43 |
44 // Open the display device. | 44 // Open the display device. |
(...skipping 19 matching lines...) Expand all Loading... |
64 | 64 |
65 protected: | 65 protected: |
66 // Draw the last set cursor & update the cursor plane. | 66 // Draw the last set cursor & update the cursor plane. |
67 void ResetCursor(); | 67 void ResetCursor(); |
68 | 68 |
69 // Draw next frame in an animated cursor. | 69 // Draw next frame in an animated cursor. |
70 void OnCursorAnimationTimeout(); | 70 void OnCursorAnimationTimeout(); |
71 | 71 |
72 DriWrapper* drm_; // Not owned. | 72 DriWrapper* drm_; // Not owned. |
73 ScreenManager* screen_manager_; // Not owned. | 73 ScreenManager* screen_manager_; // Not owned. |
74 DriWindowManager* window_manager_; // Not owned. | 74 DriWindowDelegateManager* window_manager_; // Not owned. |
75 HardwareState state_; | 75 HardwareState state_; |
76 | 76 |
77 scoped_refptr<DriBuffer> cursor_buffers_[2]; | 77 scoped_refptr<DriBuffer> cursor_buffers_[2]; |
78 int cursor_frontbuffer_; | 78 int cursor_frontbuffer_; |
79 | 79 |
80 gfx::AcceleratedWidget cursor_widget_; | 80 gfx::AcceleratedWidget cursor_widget_; |
81 std::vector<SkBitmap> cursor_bitmaps_; | 81 std::vector<SkBitmap> cursor_bitmaps_; |
82 gfx::Point cursor_location_; | 82 gfx::Point cursor_location_; |
83 int cursor_frame_; | 83 int cursor_frame_; |
84 int cursor_frame_delay_ms_; | 84 int cursor_frame_delay_ms_; |
85 base::RepeatingTimer<DriSurfaceFactory> cursor_timer_; | 85 base::RepeatingTimer<DriSurfaceFactory> cursor_timer_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(DriSurfaceFactory); | 87 DISALLOW_COPY_AND_ASSIGN(DriSurfaceFactory); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace ui | 90 } // namespace ui |
91 | 91 |
92 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ | 92 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_ |
OLD | NEW |