weijiang8410 / cakejs

Automatically exported from code.google.com/p/cakejs
0 stars 0 forks source link

Only redraw when scene changed (automatically!) #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
CAKE redraws the canvas on every frame, even if the scene hasn't changed
between frames. This causes a lot of useless CPU use.

The way that the redrawOnlyWhenChanged -flag works is very manual, a better
way to do it would be to store the previous frame state and compare it to
the current state in the update-phase.

Using setters (defined in CanvasNode#initialize) would work for a limited
set of operations (that is, changing state through assignment.) Comparing
frame states would be less fragile.

Original issue reported on code.google.com by Ilmari.H...@gmail.com on 12 Mar 2008 at 5:47

GoogleCodeExporter commented 9 years ago

Original comment by Ilmari.H...@gmail.com on 12 Mar 2008 at 5:56

GoogleCodeExporter commented 9 years ago
Made animators and append/remove set the changed-flag, propagating flag up in
handleUpdate.

If you use animators and remember to set this.changed in event listeners, 
everything
should work ok.

Original comment by Ilmari.H...@gmail.com on 21 Mar 2008 at 3:49