Mercurial > MadButterfly
comparison src/shape_path.c @ 73:9ab15ebc9061
Observer for mouse events
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 18 Aug 2008 01:59:26 +0800 |
parents | 1ca417f741f1 |
children | 7d0580f89468 |
comparison
equal
deleted
inserted
replaced
72:171a8cb7e4b5 | 73:9ab15ebc9061 |
---|---|
35 (x)++; \ | 35 (x)++; \ |
36 } | 36 } |
37 #define OK 0 | 37 #define OK 0 |
38 #define ERR -1 | 38 #define ERR -1 |
39 | 39 |
40 void sh_path_free(shape_t *shape) { | 40 static void sh_path_free(shape_t *shape) { |
41 sh_path_t *path = (sh_path_t *)shape; | 41 sh_path_t *path = (sh_path_t *)shape; |
42 if(path->user_data) | 42 if(path->user_data) |
43 free(path->user_data); | 43 free(path->user_data); |
44 if(path->dev_data) | 44 if(path->dev_data) |
45 free(path->dev_data); | 45 free(path->dev_data); |
379 free(path->dev_data); | 379 free(path->dev_data); |
380 free(path); | 380 free(path); |
381 return NULL; | 381 return NULL; |
382 } | 382 } |
383 memcpy(path->dev_data, path->user_data, cmd_cnt); | 383 memcpy(path->dev_data, path->user_data, cmd_cnt); |
384 | |
385 path->shape.free = sh_path_free; | |
384 | 386 |
385 return (shape_t *)path; | 387 return (shape_t *)path; |
386 } | 388 } |
387 | 389 |
388 /*! \brief Transform a path from user space to device space. | 390 /*! \brief Transform a path from user space to device space. |
590 CU_ASSERT(path->cmd_len == ((5 + RESERVED_AIXS + 3) & ~0x3)); | 592 CU_ASSERT(path->cmd_len == ((5 + RESERVED_AIXS + 3) & ~0x3)); |
591 CU_ASSERT(path->arg_len == 12); | 593 CU_ASSERT(path->arg_len == 12); |
592 CU_ASSERT(strcmp(path->user_data, "MLCLZ") == 0); | 594 CU_ASSERT(strcmp(path->user_data, "MLCLZ") == 0); |
593 CU_ASSERT(strcmp(path->dev_data, "MLCLZ") == 0); | 595 CU_ASSERT(strcmp(path->dev_data, "MLCLZ") == 0); |
594 | 596 |
597 geo_init(&geo); | |
595 path->shape.geo = &geo; | 598 path->shape.geo = &geo; |
596 geo.shape = (shape_t *)path; | 599 geo.shape = (shape_t *)path; |
597 | 600 |
598 coord.aggr_matrix[0] = 1; | 601 coord.aggr_matrix[0] = 1; |
599 coord.aggr_matrix[1] = 0; | 602 coord.aggr_matrix[1] = 0; |