changeset 1423:d82a828e8e26

Optimize the performance. If properties is not changed, we don't call rdman_coord_changed.
author wycc
date Sat, 09 Apr 2011 03:36:51 +0800
parents 84368f4bc988
children bd3d5ac8e748
files nodejs/coord.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/coord.cc	Fri Apr 08 09:47:00 2011 +0800
+++ b/nodejs/coord.cc	Sat Apr 09 03:36:51 2011 +0800
@@ -201,6 +201,8 @@
         return 0;
     }
 
+    if (coord_get_matrix(coord)[idx] == v) return v;
+
     coord_get_matrix(coord)[idx] = v;
 
     js_rt = GET(self, "mbrt")->ToObject();
@@ -295,7 +297,7 @@
     js_rt = GET(self, "mbrt")->ToObject();
     ASSERT(js_rt != NULL);
     rdman = xnjsmb_rt_rdman(js_rt);
-
+    if ((coord->flags & COF_HIDDEN) == 0) return;
     coord_show(coord);
     rdman_coord_changed(rdman, coord);
 }
@@ -309,6 +311,7 @@
     ASSERT(js_rt != NULL);
     rdman = xnjsmb_rt_rdman(js_rt);
 
+    if ((coord->flags & COF_HIDDEN) != 0) return;
     coord_hide(coord);
     rdman_coord_changed(rdman, coord);
 }
@@ -323,6 +326,7 @@
     ASSERT(js_rt != NULL);
     rdman = xnjsmb_rt_rdman(js_rt);
 
+    if (coord_get_opacity(coord) == value->NumberValue()) return;
     
     coord_set_opacity(coord, value->NumberValue());
     rdman_coord_changed(rdman, coord);