OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/demos/framework/demo.h" |
| 6 #include "gpu/demos/framework/demo_factory.h" |
| 7 |
| 8 namespace gpu { |
| 9 namespace demos { |
| 10 |
| 11 Demo::Demo() : width_(0), height_(0) { |
| 12 } |
| 13 |
| 14 Demo::~Demo() { |
| 15 } |
| 16 |
| 17 void Demo::InitWindowSize(int width, int height) { |
| 18 width_ = width; |
| 19 height_ = height; |
| 20 } |
| 21 |
| 22 void Demo::Draw() { |
| 23 float elapsed_sec = 0.0f; |
| 24 const base::Time current_time = base::Time::Now(); |
| 25 if (!last_draw_time_.is_null()) { |
| 26 base::TimeDelta time_delta = current_time - last_draw_time_; |
| 27 elapsed_sec = static_cast<float>(time_delta.InSecondsF()); |
| 28 } |
| 29 last_draw_time_ = current_time; |
| 30 |
| 31 Render(elapsed_sec); |
| 32 } |
| 33 |
| 34 } // namespace demos |
| 35 } // namespace gpu |
OLD | NEW |