diff options
Diffstat (limited to 'gpu/demos/framework/demo.cc')
-rw-r--r-- | gpu/demos/framework/demo.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gpu/demos/framework/demo.cc b/gpu/demos/framework/demo.cc new file mode 100644 index 0000000..49fa519 --- /dev/null +++ b/gpu/demos/framework/demo.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/demos/framework/demo.h" +#include "gpu/demos/framework/demo_factory.h" + +namespace gpu { +namespace demos { + +Demo::Demo() : width_(0), height_(0) { +} + +Demo::~Demo() { +} + +void Demo::InitWindowSize(int width, int height) { + width_ = width; + height_ = height; +} + +void Demo::Draw() { + float elapsed_sec = 0.0f; + const base::Time current_time = base::Time::Now(); + if (!last_draw_time_.is_null()) { + base::TimeDelta time_delta = current_time - last_draw_time_; + elapsed_sec = static_cast<float>(time_delta.InSecondsF()); + } + last_draw_time_ = current_time; + + Render(elapsed_sec); +} + +} // namespace demos +} // namespace gpu |