Move stats update to onFrame handler.

This commit is contained in:
Jürg Lehni 2011-12-27 16:06:47 +01:00
parent df5c33571f
commit 7b03dbedb9
2 changed files with 3 additions and 2 deletions

View file

@ -50,8 +50,6 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
draw: function(checkRedraw) {
if (checkRedraw && !this._redrawNeeded)
return false;
if (this._stats)
this._stats.update();
// Initial tests conclude that clearing the canvas using clearRect
// is always faster than setting canvas.width = canvas.width
// http://jsperf.com/clearrect-vs-setting-width/7

View file

@ -58,6 +58,9 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
count: count++
}));
before = now;
// Update framerate stats
if (that._stats)
that._stats.update();
// Automatically draw view on each frame.
that.draw(true);
};