From 02a14315f49530558914e385cdacfdbc7b315a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sat, 14 Aug 2010 23:53:23 +0200 Subject: [PATCH] gimpoperationcagepreview: transform only pixel inside the cage --- app/gegl/gimpoperationcagepreview.c | 54 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/app/gegl/gimpoperationcagepreview.c b/app/gegl/gimpoperationcagepreview.c index 5aa4c313ed..f6c5b275ff 100644 --- a/app/gegl/gimpoperationcagepreview.c +++ b/app/gegl/gimpoperationcagepreview.c @@ -207,35 +207,37 @@ gimp_operation_cage_preview_process (GeglOperation *operation, while(n_pixels--) { - /* computing of the final position of the source pixel */ - gdouble pos_x, pos_y; - - pos_x = 0; - pos_y = 0; - - - for(i = 0; i < cvn; i++) + if (gimp_cage_config_point_inside(config, x, y)) { - pos_x += coef[i] * config->cage_vertices_d[i].x; - pos_y += coef[i] * config->cage_vertices_d[i].y; + /* computing of the final position of the source pixel */ + gdouble pos_x, pos_y; + + pos_x = 0; + pos_y = 0; + + for(i = 0; i < cvn; i++) + { + pos_x += coef[i] * config->cage_vertices_d[i].x; + pos_y += coef[i] * config->cage_vertices_d[i].y; + } + + for(i = 0; i < cvn; i++) + { + pos_x += coef[i + cvn] * config->scaling_factor[i] * config->normal_d[i].x; + pos_y += coef[i + cvn] * config->scaling_factor[i] * config->normal_d[i].y; + } + + rect.x = (gint) rint(pos_x) - 1; + rect.y = (gint) rint(pos_y) - 1; + + /* copy the source pixel in the out buffer */ + gegl_buffer_set(out_buf, + &rect, + format_io, + source, + GEGL_AUTO_ROWSTRIDE); } - for(i = 0; i < cvn; i++) - { - pos_x += coef[i + cvn] * config->scaling_factor[i] * config->normal_d[i].x; - pos_y += coef[i + cvn] * config->scaling_factor[i] * config->normal_d[i].y; - } - - rect.x = (gint) rint(pos_x) - 1; - rect.y = (gint) rint(pos_y) - 1; - - /* copy the source pixel in the out buffer */ - gegl_buffer_set(out_buf, - &rect, - format_io, - source, - GEGL_AUTO_ROWSTRIDE); - source += 4; coef += 2 * cvn;