diff src/shape_image.c @ 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 bae104d8d247
children
line wrap: on
line diff
--- 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]);