summaryrefslogtreecommitdiffstats
path: root/gpu/demos/framework/demo.cc
blob: bc05b41124f435f384c44911b06530ed744541a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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), last_draw_time_(0) {
}

Demo::~Demo() {
}

void Demo::InitWindowSize(int width, int height) {
  width_ = width;
  height_ = height;
}

void Demo::Draw() {
  float elapsed_sec = 0.0f;
  clock_t current_time = clock();
  if (last_draw_time_ != 0) {
    elapsed_sec = static_cast<float>(current_time - last_draw_time_) /
        CLOCKS_PER_SEC;
  }
  last_draw_time_ = current_time;

  Render(elapsed_sec);
}

bool Demo::IsAnimated() {
  return false;
}

}  // namespace demos
}  // namespace gpu