Mercurial > MadButterfly
changeset 1433:7bd6c0e88ec8
Fix issue of showing image incorrectly.
- It is discussed in ticket #23 that objects are refreshed partially.
- It is actually only for image since multiple image share a image
paint, it will modify sampling matrix when they transforming.
Values of later ones would over-write eariler ones.
- It is fixed by move matrix setting until drawing.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 11 Apr 2011 12:45:20 +0800 |
parents | 8e8c9ab3818f |
children | ee3e4c996a51 |
files | src/paint.c src/shape_image.c |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/paint.c Mon Apr 11 00:28:45 2011 +0800 +++ b/src/paint.c Mon Apr 11 12:45:20 2011 +0800 @@ -282,9 +282,7 @@ static void paint_image_prepare(paint_t *paint, mbe_t *cr, shape_t *sh) { paint_image_t *paint_img = (paint_image_t *)paint; - mb_img_data_t *img_data; - - img_data = paint_img->img; + mbe_set_source(cr, paint_img->ptn); } @@ -296,6 +294,7 @@ img_data = paint_img->img; MB_IMG_DATA_FREE(img_data); paint_destroy(&paint_img->paint); + mbe_pattern_destroy(paint_img->ptn); elmpool_elm_free(rdman->paint_image_pool, paint_img); }
--- a/src/shape_image.c Mon Apr 11 00:28:45 2011 +0800 +++ b/src/shape_image.c Mon Apr 11 12:45:20 2011 +0800 @@ -59,6 +59,7 @@ co_aix x, y; co_aix w, h; co_aix poses[4][2]; + co_aix sample_matrix[6]; redraw_man_t *rdman; } sh_image_t; @@ -120,7 +121,6 @@ paint_t *paint; co_aix (*poses)[2]; co_aix img_matrix[6]; - co_aix rev_matrix[6]; co_aix x_factor, y_factor; int img_w, img_h; int i; @@ -164,8 +164,7 @@ img_matrix[3] *= y_factor; img_matrix[4] *= y_factor; } - compute_reverse(img_matrix, rev_matrix); - paint_image_set_matrix(sh_get_fill(shape), rev_matrix); + compute_reverse(img_matrix, img->sample_matrix); } /*! \brief Draw image for an image shape. @@ -175,6 +174,8 @@ void sh_image_draw(shape_t *shape, mbe_t *cr) { sh_image_t *img = (sh_image_t *)shape; + paint_image_set_matrix(sh_get_fill(shape), img->sample_matrix); + mbe_move_to(cr, img->poses[0][0], img->poses[0][1]); mbe_line_to(cr, img->poses[1][0], img->poses[1][1]); mbe_line_to(cr, img->poses[2][0], img->poses[2][1]);