[gegl/npd-squashed: 5/11] npd: Make NPDMatrix a direct typedef for GeglMatrix3
- From: Marek Dvoroznak <dvoromar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/npd-squashed: 5/11] npd: Make NPDMatrix a direct typedef for GeglMatrix3
- Date: Fri, 6 Dec 2013 05:03:09 +0000 (UTC)
commit 72a1e243662c0c9c8f10af1a060702d9bd65ff8e
Author: Michael Henning <drawoc darkrefraction com>
Date: Tue Nov 19 19:20:51 2013 -0500
npd: Make NPDMatrix a direct typedef for GeglMatrix3
libs/npd/Makefile.am | 1 -
libs/npd/graphics.c | 13 +++++--------
libs/npd/npd_common.h | 4 +++-
libs/npd/npd_gegl.c | 18 +++---------------
libs/npd/npd_gegl.h | 33 ---------------------------------
libs/npd/npd_math.h | 2 --
operations/external/npd.c | 3 +--
7 files changed, 12 insertions(+), 62 deletions(-)
---
diff --git a/libs/npd/Makefile.am b/libs/npd/Makefile.am
index 080bb9d..be99db0 100644
--- a/libs/npd/Makefile.am
+++ b/libs/npd/Makefile.am
@@ -12,7 +12,6 @@ GEGL_NPD_public_HEADERS = \
npd_math.h \
graphics.h \
lattice_cut.h \
- npd_gegl.h \
npd.h
GEGL_NPD_SOURCES = \
diff --git a/libs/npd/graphics.c b/libs/npd/graphics.c
index e5c5e5f..4d855a8 100644
--- a/libs/npd/graphics.c
+++ b/libs/npd/graphics.c
@@ -458,26 +458,23 @@ npd_texture_quadrilateral (NPDBone *reference_bone,
NPDPoint *p1 = current_bone->points;
NPDPoint *p2 = reference_bone->points;
- NPDMatrix *A = NULL;
- npd_new_matrix (&A);
+ NPDMatrix A;
npd_compute_affinity (&p1[0], &p1[1], &p1[2],
- &p2[0], &p2[1], &p2[2], A);
+ &p2[0], &p2[1], &p2[2], &A);
npd_texture_fill_triangle ((gint) p1[0].x, (gint) p1[0].y,
(gint) p1[1].x, (gint) p1[1].y,
(gint) p1[2].x, (gint) p1[2].y,
- A, input_image, output_image,
+ &A, input_image, output_image,
settings);
npd_compute_affinity (&p1[0], &p1[2], &p1[3],
- &p2[0], &p2[2], &p2[3], A);
+ &p2[0], &p2[2], &p2[3], &A);
npd_texture_fill_triangle ((gint) p1[0].x, (gint) p1[0].y,
(gint) p1[2].x, (gint) p1[2].y,
(gint) p1[3].x, (gint) p1[3].y,
- A, input_image, output_image,
+ &A, input_image, output_image,
settings);
-
- npd_destroy_matrix (&A);
}
void
diff --git a/libs/npd/npd_common.h b/libs/npd/npd_common.h
index 5714df5..e890e38 100644
--- a/libs/npd/npd_common.h
+++ b/libs/npd/npd_common.h
@@ -24,11 +24,13 @@
#include <glib.h>
+#include <gegl-matrix.h>
+typedef GeglMatrix3 NPDMatrix;
+
/* opaque types for independency on used display library */
typedef struct _NPDImage NPDImage;
typedef struct _NPDColor NPDColor;
typedef struct _NPDDisplay NPDDisplay;
-typedef struct _NPDMatrix NPDMatrix;
typedef struct _NPDPoint NPDPoint;
typedef struct _NPDBone NPDBone;
diff --git a/libs/npd/npd_gegl.c b/libs/npd/npd_gegl.c
index 1a8abaf..af5237d 100644
--- a/libs/npd/npd_gegl.c
+++ b/libs/npd/npd_gegl.c
@@ -19,22 +19,10 @@
* Copyright (C) 2013 Marek Dvoroznak <dvoromar gmail com>
*/
-#include "npd_gegl.h"
+#include "npd_math.h"
#include <glib.h>
void
-npd_new_matrix (NPDMatrix **matrix)
-{
- *matrix = g_new (NPDMatrix, 1);
-}
-
-void
-npd_destroy_matrix (NPDMatrix **matrix)
-{
- g_free (*matrix);
-}
-
-void
npd_compute_affinity (NPDPoint *p11,
NPDPoint *p21,
NPDPoint *p31,
@@ -54,7 +42,7 @@ npd_compute_affinity (NPDPoint *p11,
X.coeff[0][2] = p31->x; X.coeff[1][2] = p31->y; X.coeff[2][2] = 1;
gegl_matrix3_invert (&X);
- gegl_matrix3_multiply (&Y, &X, &T->matrix);
+ gegl_matrix3_multiply (&Y, &X, T);
}
void
@@ -63,6 +51,6 @@ npd_apply_transformation (NPDMatrix *T,
NPDPoint *dest)
{
gdouble x = src->x, y = src->y;
- gegl_matrix3_transform_point (&T->matrix, &x, &y);
+ gegl_matrix3_transform_point (T, &x, &y);
dest->x = x; dest->y = y;
}
diff --git a/libs/npd/npd_math.h b/libs/npd/npd_math.h
index 411f4e9..39d4de0 100644
--- a/libs/npd/npd_math.h
+++ b/libs/npd/npd_math.h
@@ -52,7 +52,5 @@ gboolean npd_equal_floats (gfloat a,
gfloat b);
gfloat npd_SED (NPDPoint *p1,
NPDPoint *p2);
-void npd_new_matrix (NPDMatrix **matrix);
-void npd_destroy_matrix (NPDMatrix **matrix);
#endif /* __NPD_MATH_H__ */
diff --git a/operations/external/npd.c b/operations/external/npd.c
index 63bfc37..c68ddcc 100644
--- a/operations/external/npd.c
+++ b/operations/external/npd.c
@@ -55,7 +55,6 @@ gegl_chant_boolean (mesh_visible, _("mesh visible"),
#include <stdio.h>
#include <math.h>
#include <npd/npd.h>
-#include <npd/npd_gegl.h>
#include <cairo.h>
struct _NPDImage
@@ -326,4 +325,4 @@ gegl_chant_class_init (GeglChantClass *klass)
NULL);
}
-#endif
\ No newline at end of file
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]