OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Define the interface for a generic simulation, and a factory method for | 5 // Define the interface for a generic simulation, and a factory method for |
6 // instantiating different models. | 6 // instantiating different models. |
7 | 7 |
8 #ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ | 8 #ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ |
9 #define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ | 9 #define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "gpu/tools/compositor_model_bench/render_tree.h" | 14 #include "gpu/tools/compositor_model_bench/render_tree.h" |
15 | 15 |
16 enum RenderModel { | 16 enum RenderModel { |
17 ForwardRenderModel | 17 ForwardRenderModel |
18 }; | 18 }; |
19 | 19 |
20 const char* ModelToString(RenderModel m); | 20 const char* ModelToString(RenderModel m); |
21 | 21 |
22 class RenderModelSimulator { | 22 class RenderModelSimulator { |
23 public: | 23 public: |
24 virtual ~RenderModelSimulator(); | 24 virtual ~RenderModelSimulator(); |
25 virtual void Update() = 0; | 25 virtual void Update() = 0; |
26 virtual void Resize(int width, int height) = 0; | 26 virtual void Resize(int width, int height) = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 explicit RenderModelSimulator(RenderNode* root); | 29 explicit RenderModelSimulator(std::unique_ptr<RenderNode> root); |
| 30 |
30 std::unique_ptr<RenderNode> root_; | 31 std::unique_ptr<RenderNode> root_; |
31 | 32 |
32 private: | 33 private: |
33 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderModelSimulator); | 34 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderModelSimulator); |
34 }; | 35 }; |
35 | 36 |
36 RenderModelSimulator* ConstructSimulationModel(RenderModel model, | 37 std::unique_ptr<RenderModelSimulator> ConstructSimulationModel( |
37 RenderNode* render_tree_root, | 38 RenderModel model, |
38 int window_width, | 39 std::unique_ptr<RenderNode> render_tree_root, |
39 int window_height); | 40 int window_width, |
| 41 int window_height); |
40 | 42 |
41 #endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ | 43 #endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_MODELS_H_ |
42 | 44 |
OLD | NEW |