app: pass near-plane z-coordinate to gegl:transform

... so that GEGL performs the same clipping we do.
This commit is contained in:
Ell 2018-01-28 15:53:01 -05:00
parent 23f6369658
commit 5f58a7a260
4 changed files with 11 additions and 6 deletions

View File

@ -27,7 +27,6 @@
#define EPSILON 1e-6
#define NEAR_Z 0.02
void
@ -541,7 +540,7 @@ gimp_transform_polygon (const GimpMatrix3 *matrix,
matrix->coeff[2][1] * vertices[0].y +
matrix->coeff[2][2];
curr_visible = (curr.z >= NEAR_Z);
curr_visible = (curr.z >= GIMP_TRANSFORM_NEAR_Z);
for (i = 0; i < n_vertices; i++)
{
@ -567,15 +566,15 @@ gimp_transform_polygon (const GimpMatrix3 *matrix,
matrix->coeff[2][1] * vertices[j].y +
matrix->coeff[2][2];
next_visible = (next.z >= NEAR_Z);
next_visible = (next.z >= GIMP_TRANSFORM_NEAR_Z);
if (next_visible != curr_visible)
{
gdouble ratio = (curr.z - NEAR_Z) / (curr.z - next.z);
gdouble ratio = (curr.z - GIMP_TRANSFORM_NEAR_Z) / (curr.z - next.z);
t_vertices[(*n_t_vertices)++] =
(GimpVector2) { (curr.x + (next.x - curr.x) * ratio) / NEAR_Z,
(curr.y + (next.y - curr.y) * ratio) / NEAR_Z };
(GimpVector2) { (curr.x + (next.x - curr.x) * ratio) / GIMP_TRANSFORM_NEAR_Z,
(curr.y + (next.y - curr.y) * ratio) / GIMP_TRANSFORM_NEAR_Z };
}
curr = next;

View File

@ -19,6 +19,9 @@
#define __GIMP_TRANSFORM_UTILS_H__
#define GIMP_TRANSFORM_NEAR_Z 0.02
void gimp_transform_get_rotate_center (gint x,
gint y,
gint width,

View File

@ -464,6 +464,7 @@ gimp_canvas_transform_preview_sync_node (GimpCanvasItem *item)
private->transform_node =
gegl_node_new_child (private->node,
"operation", "gegl:transform",
"near-z", GIMP_TRANSFORM_NEAR_Z,
"sampler", GIMP_INTERPOLATION_NONE,
NULL);

View File

@ -28,6 +28,7 @@
#include "gimp-gegl-types.h"
#include "core/gimp-transform-utils.h"
#include "core/gimp-utils.h"
#include "core/gimpprogress.h"
@ -707,6 +708,7 @@ gimp_gegl_apply_transform (GeglBuffer *src_buffer,
node = gegl_node_new_child (NULL,
"operation", "gegl:transform",
"near-z", GIMP_TRANSFORM_NEAR_Z,
"sampler", interpolation_type,
NULL);