comparison nodejs/coord.cc @ 1451:5d89aa30310c

Revert changeset #2bcacd29d95f to remove unncessary functions
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 13 Apr 2011 14:38:25 +0800
parents ef3908d9a3d2
children 0cb89e204824
comparison
equal deleted inserted replaced
1450:6644ef3d75eb 1451:5d89aa30310c
339 339
340 opacity = coord_get_opacity(coord); 340 opacity = coord_get_opacity(coord);
341 return Number::New(opacity); 341 return Number::New(opacity);
342 } 342 }
343 343
344 #define cc(i) (coord_get_matrix(coord)[i])
345 static void
346 xnjsmb_coord_set_y(Handle<Object> self, coord_t *coord, Handle<Value> value, const char **str)
347 {
348 Handle<Object> js_rt;
349 redraw_man_t *rdman;
350 co_aix y,ty;
351 co_aix xx,yy;
352
353 js_rt = GET(self, "mbrt")->ToObject();
354 ASSERT(js_rt != NULL);
355 rdman = xnjsmb_rt_rdman(js_rt);
356
357
358 ty = value->NumberValue();
359 xx = GET(self,"_x")->ToNumber()->NumberValue();
360 yy = GET(self,"_y")->ToNumber()->NumberValue();
361 y = ty-cc(3)*xx-cc(4)*yy;
362 coord_get_matrix(coord)[5] = y;
363 rdman_coord_changed(rdman, coord);
364 }
365
366 static Handle<Value>
367 xnjsmb_coord_get_y(Handle<Object> self, coord_t *coord,
368 const char **err) {
369 co_aix y;
370 co_aix xx,yy;
371
372 xx = GET(self,"_x")->ToNumber()->NumberValue();
373 yy = GET(self,"_y")->ToNumber()->NumberValue();
374
375 y = cc(3)*xx+cc(4)*yy+cc(5);
376 return Number::New(y);
377 }
378 static void
379 xnjsmb_coord_set_x(Handle<Object> self, coord_t *coord, Handle<Value> value, const char **str)
380 {
381 Handle<Object> js_rt;
382 redraw_man_t *rdman;
383 co_aix x,tx;
384 co_aix xx,yy;
385
386 xx = GET(self,"_x")->ToNumber()->NumberValue();
387 yy = GET(self,"_y")->ToNumber()->NumberValue();
388 js_rt = GET(self, "mbrt")->ToObject();
389 ASSERT(js_rt != NULL);
390 rdman = xnjsmb_rt_rdman(js_rt);
391
392 tx = value->NumberValue();
393 x = tx-cc(0)*xx-cc(1)*yy;
394 coord_get_matrix(coord)[2] = x;
395 rdman_coord_changed(rdman, coord);
396 }
397
398 static Handle<Value>
399 xnjsmb_coord_get_x(Handle<Object> self, coord_t *coord,
400 const char **err) {
401 co_aix x;
402 co_aix xx,yy;
403
404 xx = GET(self,"_x")->ToNumber()->NumberValue();
405 yy = GET(self,"_y")->ToNumber()->NumberValue();
406
407 x = cc(0)*xx+cc(1)*yy+cc(2);
408 return Number::New(x);
409 }
410 #undef m
411
412 #include "coord-inc.h" 344 #include "coord-inc.h"
413 345
414 /*! \brief This function used by \ref xnjsmb_mb_rt to wrap coord object. 346 /*! \brief This function used by \ref xnjsmb_mb_rt to wrap coord object.
415 */ 347 */
416 Handle<Value> export_xnjsmb_auto_coord_new(coord_t *coord) { 348 Handle<Value> export_xnjsmb_auto_coord_new(coord_t *coord) {