Commit 5f58a7a2 authored by Ell's avatar Ell

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

... so that GEGL performs the same clipping we do.
parent 23f63696
......@@ -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;
......
......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment