mirror of https://github.com/GNOME/gimp.git
gimpoperationcagepreview: transform only pixel inside the cage
This commit is contained in:
parent
b7c2b26def
commit
02a14315f4
|
@ -207,35 +207,37 @@ gimp_operation_cage_preview_process (GeglOperation *operation,
|
||||||
|
|
||||||
while(n_pixels--)
|
while(n_pixels--)
|
||||||
{
|
{
|
||||||
/* computing of the final position of the source pixel */
|
if (gimp_cage_config_point_inside(config, x, y))
|
||||||
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;
|
/* computing of the final position of the source pixel */
|
||||||
pos_y += coef[i] * config->cage_vertices_d[i].y;
|
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;
|
source += 4;
|
||||||
coef += 2 * cvn;
|
coef += 2 * cvn;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue