OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "examples/ui/spinning_cube/spinning_cube_view.h" | 5 #include "examples/ui/spinning_cube/spinning_cube_view.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 callback.Run(true); | 142 callback.Run(true); |
143 } | 143 } |
144 | 144 |
145 void SpinningCubeView::OnDraw( | 145 void SpinningCubeView::OnDraw( |
146 const mojo::gfx::composition::FrameInfo& frame_info, | 146 const mojo::gfx::composition::FrameInfo& frame_info, |
147 const base::TimeDelta& time_delta) { | 147 const base::TimeDelta& time_delta) { |
148 // Update the state of the cube. | 148 // Update the state of the cube. |
149 cube_.UpdateForTimeDelta(time_delta.InSecondsF()); | 149 cube_.UpdateForTimeDelta(time_delta.InSecondsF()); |
150 | 150 |
151 // Update the contents of the scene. | 151 // Update the contents of the scene. |
152 mojo::Rect bounds; | 152 mojo::RectF bounds; |
153 bounds.width = size_.width; | 153 bounds.width = size_.width; |
154 bounds.height = size_.height; | 154 bounds.height = size_.height; |
155 | 155 |
156 auto update = mojo::gfx::composition::SceneUpdate::New(); | 156 auto update = mojo::gfx::composition::SceneUpdate::New(); |
157 mojo::gfx::composition::ResourcePtr cube_resource = gl_renderer()->DrawGL( | 157 mojo::gfx::composition::ResourcePtr cube_resource = gl_renderer()->DrawGL( |
158 size_, true, | 158 size_, true, |
159 base::Bind(&SpinningCubeView::DrawCubeWithGL, base::Unretained(this))); | 159 base::Bind(&SpinningCubeView::DrawCubeWithGL, base::Unretained(this))); |
160 DCHECK(cube_resource); | 160 DCHECK(cube_resource); |
161 update->resources.insert(kCubeImageResourceId, cube_resource.Pass()); | 161 update->resources.insert(kCubeImageResourceId, cube_resource.Pass()); |
162 | 162 |
(...skipping 17 matching lines...) Expand all Loading... |
180 // Loop! | 180 // Loop! |
181 choreographer_.ScheduleDraw(); | 181 choreographer_.ScheduleDraw(); |
182 } | 182 } |
183 | 183 |
184 void SpinningCubeView::DrawCubeWithGL() { | 184 void SpinningCubeView::DrawCubeWithGL() { |
185 cube_.set_size(size_.width, size_.height); | 185 cube_.set_size(size_.width, size_.height); |
186 cube_.Draw(); | 186 cube_.Draw(); |
187 } | 187 } |
188 | 188 |
189 } // namespace examples | 189 } // namespace examples |
OLD | NEW |