diff options
author | Michael Henning <drawoc@darkrefraction.com> | 2013-11-19 19:20:51 -0500 |
---|---|---|
committer | Mikael Magnusson <mikachu@src.gnome.org> | 2015-02-27 19:13:59 +0100 |
commit | 83e5f404ec8c42fb52e327400ce8bc2bb33cce84 (patch) | |
tree | 54a2a810a650b6ce90339f2c8015a23402e07a6a /libs | |
parent | a38e2995680cc978cf065a03b2a026ba0911b038 (diff) |
npd: Make NPDMatrix a direct typedef for GeglMatrix3
Diffstat (limited to 'libs')
-rw-r--r-- | libs/npd/Makefile.am | 1 | ||||
-rw-r--r-- | libs/npd/graphics.c | 13 | ||||
-rw-r--r-- | libs/npd/npd_common.h | 4 | ||||
-rw-r--r-- | libs/npd/npd_gegl.c | 18 | ||||
-rw-r--r-- | libs/npd/npd_gegl.h | 33 | ||||
-rw-r--r-- | libs/npd/npd_math.h | 2 |
6 files changed, 11 insertions, 60 deletions
diff --git a/libs/npd/Makefile.am b/libs/npd/Makefile.am index 080bb9d3..be99db04 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 e5c5e5fb..4d855a89 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 5714df58..e890e382 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 1a8abaff..af5237d6 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_gegl.h b/libs/npd/npd_gegl.h deleted file mode 100644 index 7ce4790a..00000000 --- a/libs/npd/npd_gegl.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of N-point image deformation library. - * - * N-point image deformation library is free software: you can - * redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, - * or (at your option) any later version. - * - * N-point image deformation library is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with N-point image deformation library. - * If not, see <http://www.gnu.org/licenses/>. - * - * Copyright (C) 2013 Marek Dvoroznak <dvoromar@gmail.com> - */ - -#ifndef __NPD_GEGL_H__ -#define __NPD_GEGL_H__ - -#include "npd_math.h" -#include <gegl-matrix.h> - -struct _NPDMatrix -{ - GeglMatrix3 matrix; -}; - -#endif /* __NPD_GEGL_H__ */ diff --git a/libs/npd/npd_math.h b/libs/npd/npd_math.h index 411f4e94..39d4de00 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__ */ |