OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ | 5 #ifndef EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ |
6 #define EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ | 6 #define EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "examples/spinning_cube/spinning_cube.h" | 8 #include "examples/spinning_cube/spinning_cube.h" |
9 #include "mojo/public/c/gpu/MGL/mgl.h" | 9 #include "mojo/public/c/gpu/MGL/mgl.h" |
10 #include "mojo/services/geometry/interfaces/geometry.mojom.h" | 10 #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
11 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" | 11 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" |
12 | 12 |
13 namespace examples { | 13 namespace examples { |
14 | 14 |
15 class GLES2ClientImpl { | 15 class GLES2ClientImpl { |
16 public: | 16 public: |
17 explicit GLES2ClientImpl(mojo::ContextProviderPtr context_provider); | 17 explicit GLES2ClientImpl(mojo::ContextProviderPtr context_provider); |
18 virtual ~GLES2ClientImpl(); | 18 virtual ~GLES2ClientImpl(); |
19 | 19 |
20 void SetSize(const mojo::Size& size); | 20 void SetSize(const mojo::Size& size); |
21 void HandleInputEvent(const mojo::Event& event); | 21 void HandleInputEvent(const mojo::Event& event); |
22 void Draw(); | 22 void Draw(); |
23 | 23 |
24 private: | 24 private: |
25 void ContextCreated(mojo::CommandBufferPtr command_buffer); | 25 void ContextCreated( |
| 26 mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer); |
26 void ContextLost(); | 27 void ContextLost(); |
27 static void ContextLostThunk(void* closure); | 28 static void ContextLostThunk(void* closure); |
28 void WantToDraw(); | 29 void WantToDraw(); |
29 | 30 |
30 MojoTimeTicks last_time_; | 31 MojoTimeTicks last_time_; |
31 mojo::Size size_; | 32 mojo::Size size_; |
32 SpinningCube cube_; | 33 SpinningCube cube_; |
33 mojo::PointF capture_point_; | 34 mojo::PointF capture_point_; |
34 mojo::PointF last_drag_point_; | 35 mojo::PointF last_drag_point_; |
35 MojoTimeTicks drag_start_time_; | 36 MojoTimeTicks drag_start_time_; |
36 bool waiting_to_draw_; | 37 bool waiting_to_draw_; |
37 | 38 |
38 mojo::ContextProviderPtr context_provider_; | 39 mojo::ContextProviderPtr context_provider_; |
39 MGLContext context_; | 40 MGLContext context_; |
40 | 41 |
41 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl); | 42 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace examples | 45 } // namespace examples |
45 | 46 |
46 #endif // EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ | 47 #endif // EXAMPLES_SPINNING_CUBE_GLES2_CLIENT_IMPL_H_ |
OLD | NEW |