OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_UI_DEMO_MUS_DEMO_H_ | 5 #ifndef SERVICES_UI_DEMO_MUS_DEMO_H_ |
6 #define SERVICES_UI_DEMO_MUS_DEMO_H_ | 6 #define SERVICES_UI_DEMO_MUS_DEMO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "services/shell/public/cpp/service.h" | 17 #include "services/shell/public/cpp/service.h" |
18 #include "services/ui/public/cpp/window_manager_delegate.h" | 18 #include "services/ui/public/cpp/window_manager_delegate.h" |
19 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 19 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 class BitmapUploader; | 23 class BitmapUploader; |
24 class GpuService; | |
25 | |
26 namespace demo { | 24 namespace demo { |
27 | 25 |
28 // A simple MUS Demo mojo app. This app connects to the mojo:ui, creates a new | 26 // A simple MUS Demo mojo app. This app connects to the mojo:ui, creates a new |
29 // window and draws a spinning square in the center of the window. Provides a | 27 // window and draws a spinning square in the center of the window. Provides a |
30 // simple way to demonstrate that the graphic stack works as intended. | 28 // simple way to demonstrate that the graphic stack works as intended. |
31 class MusDemo : public shell::Service, | 29 class MusDemo : public shell::Service, |
32 public WindowTreeClientDelegate, | 30 public WindowTreeClientDelegate, |
33 public WindowManagerDelegate { | 31 public WindowManagerDelegate { |
34 public: | 32 public: |
35 MusDemo(); | 33 MusDemo(); |
(...skipping 28 matching lines...) Expand all Loading... |
64 void OnWmCancelMoveLoop(Window* window) override; | 62 void OnWmCancelMoveLoop(Window* window) override; |
65 | 63 |
66 // Allocate a bitmap the same size as the window to draw into. | 64 // Allocate a bitmap the same size as the window to draw into. |
67 void AllocBitmap(); | 65 void AllocBitmap(); |
68 | 66 |
69 // Draws one frame, incrementing the rotation angle. | 67 // Draws one frame, incrementing the rotation angle. |
70 void DrawFrame(); | 68 void DrawFrame(); |
71 | 69 |
72 Window* window_ = nullptr; | 70 Window* window_ = nullptr; |
73 WindowTreeClient* window_tree_client_ = nullptr; | 71 WindowTreeClient* window_tree_client_ = nullptr; |
74 std::unique_ptr<GpuService> gpu_service_; | |
75 | 72 |
76 // Used to send frames to mus. | 73 // Used to send frames to mus. |
77 std::unique_ptr<ui::BitmapUploader> uploader_; | 74 std::unique_ptr<ui::BitmapUploader> uploader_; |
78 | 75 |
79 // Bitmap that is the same size as our client window area. | 76 // Bitmap that is the same size as our client window area. |
80 SkBitmap bitmap_; | 77 SkBitmap bitmap_; |
81 | 78 |
82 // Timer for calling DrawFrame(). | 79 // Timer for calling DrawFrame(). |
83 base::RepeatingTimer timer_; | 80 base::RepeatingTimer timer_; |
84 | 81 |
85 // Current rotation angle for drawing. | 82 // Current rotation angle for drawing. |
86 double angle_ = 0.0; | 83 double angle_ = 0.0; |
87 | 84 |
88 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 85 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
89 }; | 86 }; |
90 | 87 |
91 } // namespace demo | 88 } // namespace demo |
92 } // namespace ui | 89 } // namespace ui |
93 | 90 |
94 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 91 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
OLD | NEW |