OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 GPU_DEMOS_FRAMEWORK_WINDOW_H_ | 5 #ifndef GPU_DEMOS_FRAMEWORK_WINDOW_H_ |
6 #define GPU_DEMOS_FRAMEWORK_WINDOW_H_ | 6 #define GPU_DEMOS_FRAMEWORK_WINDOW_H_ |
7 | 7 |
| 8 #include "app/gfx/native_widget_types.h" |
8 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
9 #include "gpu/demos/framework/demo.h" | |
10 #include "gpu/demos/framework/platform.h" | |
11 | 10 |
12 namespace gpu { | 11 namespace gpu { |
13 namespace demos { | 12 namespace demos { |
14 | 13 |
| 14 class Demo; |
| 15 |
15 // Acts as a framework for standalone demos. It creates a window and delegates | 16 // Acts as a framework for standalone demos. It creates a window and delegates |
16 // all events to demo to perform rendering and other tasks. | 17 // all events to demo to perform rendering and other tasks. |
17 class Window { | 18 class Window { |
18 public: | 19 public: |
19 Window(); | 20 Window(); |
20 virtual ~Window(); | 21 virtual ~Window(); |
21 | 22 |
22 // Initializes and creates a window with given dimensions. | 23 // Initializes and creates a window with given dimensions. |
23 bool Init(int width, int height); | 24 bool Init(int width, int height); |
24 | 25 |
25 // Enters the event processing loop. | 26 // Enters the event processing loop. |
26 void MainLoop(); | 27 void MainLoop(); |
27 | 28 |
28 void OnPaint(); | 29 void OnPaint(); |
29 | 30 |
30 private: | 31 private: |
31 NativeWindowHandle window_handle_; | 32 // Creates and shows a native window with the given title and dimensions. |
| 33 gfx::NativeWindow CreateNativeWindow(const wchar_t* title, |
| 34 int width, int height); |
| 35 // Converts native window handle to NPAPI plugin window handle. |
| 36 gfx::PluginWindowHandle PluginWindow(gfx::NativeWindow hwnd); |
| 37 // Creates an OpenGL ES 2.0 rendering context for the given window. |
| 38 bool CreateRenderContext(gfx::PluginWindowHandle hwnd); |
| 39 |
| 40 gfx::NativeWindow window_handle_; |
32 scoped_ptr<Demo> demo_; | 41 scoped_ptr<Demo> demo_; |
33 | 42 |
34 DISALLOW_COPY_AND_ASSIGN(Window); | 43 DISALLOW_COPY_AND_ASSIGN(Window); |
35 }; | 44 }; |
36 | 45 |
37 } // namespace demos | 46 } // namespace demos |
38 } // namespace gpu | 47 } // namespace gpu |
39 #endif // GPU_DEMOS_FRAMEWORK_WINDOW_H_ | 48 #endif // GPU_DEMOS_FRAMEWORK_WINDOW_H_ |
| 49 |
OLD | NEW |