| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gpu/demos/framework/demo.h" | 5 #include "gpu/demos/framework/demo.h" |
| 6 #include "gpu/demos/framework/demo_factory.h" | 6 #include "gpu/demos/framework/demo_factory.h" |
| 7 | 7 |
| 8 namespace gpu { | 8 namespace gpu { |
| 9 namespace demos { | 9 namespace demos { |
| 10 | 10 |
| 11 Demo::Demo() : width_(0), height_(0), last_draw_time_(0) { | 11 Demo::Demo() : width_(0), height_(0), last_draw_time_(0) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 Demo::~Demo() { | 14 Demo::~Demo() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 void Demo::InitWindowSize(int width, int height) { | |
| 18 width_ = width; | |
| 19 height_ = height; | |
| 20 } | |
| 21 | |
| 22 void Demo::Draw() { | 17 void Demo::Draw() { |
| 23 float elapsed_sec = 0.0f; | 18 float elapsed_sec = 0.0f; |
| 24 clock_t current_time = clock(); | 19 clock_t current_time = clock(); |
| 25 if (last_draw_time_ != 0) { | 20 if (last_draw_time_ != 0) { |
| 26 elapsed_sec = static_cast<float>(current_time - last_draw_time_) / | 21 elapsed_sec = static_cast<float>(current_time - last_draw_time_) / |
| 27 CLOCKS_PER_SEC; | 22 CLOCKS_PER_SEC; |
| 28 } | 23 } |
| 29 last_draw_time_ = current_time; | 24 last_draw_time_ = current_time; |
| 30 | 25 |
| 31 Render(elapsed_sec); | 26 Render(elapsed_sec); |
| 32 } | 27 } |
| 33 | 28 |
| 34 bool Demo::IsAnimated() { | 29 bool Demo::IsAnimated() { |
| 35 return false; | 30 return false; |
| 36 } | 31 } |
| 37 | 32 |
| 33 void Demo::Resize(int width, int height) { |
| 34 width_ = width; |
| 35 height_ = height; |
| 36 } |
| 37 |
| 38 } // namespace demos | 38 } // namespace demos |
| 39 } // namespace gpu | 39 } // namespace gpu |
| OLD | NEW |