Mercurial > MadButterfly
comparison src/shape_image.c @ 779:8e9481bf1cc0
Avoid float divide to improve performance
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 30 Aug 2010 13:43:01 +0800 |
parents | 61c217f8cec8 |
children | 586e50f82c1f |
comparison
equal
deleted
inserted
replaced
778:61c217f8cec8 | 779:8e9481bf1cc0 |
---|---|
68 * \param img_data is image data whose owner-ship is transfered. | 68 * \param img_data is image data whose owner-ship is transfered. |
69 */ | 69 */ |
70 shape_t *rdman_shape_image_new(redraw_man_t *rdman, | 70 shape_t *rdman_shape_image_new(redraw_man_t *rdman, |
71 co_aix x, co_aix y, co_aix w, co_aix h) { | 71 co_aix x, co_aix y, co_aix w, co_aix h) { |
72 sh_image_t *img; | 72 sh_image_t *img; |
73 mb_img_fmt_t fmt; | |
74 int r; | |
75 | 73 |
76 img = O_ALLOC(sh_image_t); | 74 img = O_ALLOC(sh_image_t); |
77 if(img == NULL) | 75 if(img == NULL) |
78 return NULL; | 76 return NULL; |
79 | 77 |
156 * | 154 * |
157 * \note Image is not rescaled for size of the shape. | 155 * \note Image is not rescaled for size of the shape. |
158 */ | 156 */ |
159 void sh_image_draw(shape_t *shape, mbe_t *cr) { | 157 void sh_image_draw(shape_t *shape, mbe_t *cr) { |
160 sh_image_t *img = (sh_image_t *)shape; | 158 sh_image_t *img = (sh_image_t *)shape; |
161 mbe_pattern_t *saved_source; | |
162 co_aix *aggr; | |
163 | 159 |
164 mbe_move_to(cr, img->poses[0][0], img->poses[0][1]); | 160 mbe_move_to(cr, img->poses[0][0], img->poses[0][1]); |
165 mbe_line_to(cr, img->poses[1][0], img->poses[1][1]); | 161 mbe_line_to(cr, img->poses[1][0], img->poses[1][1]); |
166 mbe_line_to(cr, img->poses[2][0], img->poses[2][1]); | 162 mbe_line_to(cr, img->poses[2][0], img->poses[2][1]); |
167 mbe_line_to(cr, img->poses[3][0], img->poses[3][1]); | 163 mbe_line_to(cr, img->poses[3][0], img->poses[3][1]); |