Mercurial > MadButterfly
changeset 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 | 16d8a1d48717 |
files | src/coord.c src/shape_image.c |
diffstat | 2 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coord.c Mon Aug 30 13:07:49 2010 +0800 +++ b/src/coord.c Mon Aug 30 13:43:01 2010 +0800 @@ -144,12 +144,14 @@ reverse[2] = -working[2]; reverse[5] = -working[5]; - reverse[0] /= working[0]; - reverse[1] /= working[0]; - reverse[2] /= working[0]; - reverse[3] /= working[4]; - reverse[4] /= working[4]; - reverse[5] /= working[4]; + factor = 1 / working[0]; + reverse[0] *= factor; + reverse[1] *= factor; + reverse[2] *= factor; + factor = 1 / working[4]; + reverse[3] *= factor; + reverse[4] *= factor; + reverse[5] *= factor; } /*! \brief Update aggregate matrices of elements under a sub-tree.
--- a/src/shape_image.c Mon Aug 30 13:07:49 2010 +0800 +++ b/src/shape_image.c Mon Aug 30 13:43:01 2010 +0800 @@ -70,8 +70,6 @@ shape_t *rdman_shape_image_new(redraw_man_t *rdman, co_aix x, co_aix y, co_aix w, co_aix h) { sh_image_t *img; - mb_img_fmt_t fmt; - int r; img = O_ALLOC(sh_image_t); if(img == NULL) @@ -158,8 +156,6 @@ */ void sh_image_draw(shape_t *shape, mbe_t *cr) { sh_image_t *img = (sh_image_t *)shape; - mbe_pattern_t *saved_source; - co_aix *aggr; mbe_move_to(cr, img->poses[0][0], img->poses[0][1]); mbe_line_to(cr, img->poses[1][0], img->poses[1][1]);