[gegl] transform: make it transform pixel centers, not corners
- From: Nicolas Robidoux <nrobidoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] transform: make it transform pixel centers, not corners
- Date: Mon, 19 Nov 2012 00:26:37 +0000 (UTC)
commit 573c7642ad05f578218e518f122b3d2ff8047d8b
Author: Massimo Valentini <mvalentini src gnome org>
Date: Sun Nov 18 17:27:14 2012 +0100
transform: make it transform pixel centers, not corners
https://bugzilla.gnome.org/show_bug.cgi?id=433436
operations/transform/transform-core.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 5918cc3..1713339 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -691,14 +691,9 @@ transform_affine (GeglBuffer *dest,
inverse_jacobian.coeff[1][0] = inverse.coeff[1][0];
inverse_jacobian.coeff[1][1] = inverse.coeff[1][1];
- u_start = inverse.coeff[0][0] * roi->x + inverse.coeff[0][1] * roi->y + inverse.coeff[0][2];
- v_start = inverse.coeff[1][0] * roi->x + inverse.coeff[1][1] * roi->y + inverse.coeff[1][2];
- w_start = inverse.coeff[2][0] * roi->x + inverse.coeff[2][1] * roi->y + inverse.coeff[2][2];
-
- /* correct rounding on e.g. negative scaling (is this sound?) */
- if (inverse.coeff [0][0] < 0.) u_start -= .001;
- if (inverse.coeff [1][1] < 0.) v_start -= .001;
- if (inverse.coeff [2][2] < 0.) w_start -= .001;
+ u_start = inverse.coeff[0][0] * (roi->x + 0.5) + inverse.coeff[0][1] * (roi->y + 0.5) + inverse.coeff[0][2];
+ v_start = inverse.coeff[1][0] * (roi->x + 0.5) + inverse.coeff[1][1] * (roi->y + 0.5) + inverse.coeff[1][2];
+ w_start = inverse.coeff[2][0] * (roi->x + 0.5) + inverse.coeff[2][1] * (roi->y + 0.5) + inverse.coeff[2][2];
for (dest_ptr = dest_buf, y = roi->height; y--;)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]