[gegl] Redefine GeglMatrix type to a struct.
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Redefine GeglMatrix type to a struct.
- Date: Wed, 6 Apr 2011 17:21:05 +0000 (UTC)
commit ffe0549a8c64172c28fe16b8c48d1ee967b87b99
Author: Jon Nordby <jononor gmail com>
Date: Thu Mar 31 20:13:19 2011 +0200
Redefine GeglMatrix type to a struct.
This makes GeglMatrix3/2 binary compatible with GimpMatrix2/3 and
introspectable by GObject introspection.
Note: This is an API/ABI break.
https://bugzilla.gnome.org/show_bug.cgi?id=645817
gegl/buffer/gegl-sampler-downsize.c | 8 +-
gegl/buffer/gegl-sampler-downsizefast.c | 8 +-
gegl/gegl-matrix.c | 176 ++++++++++++++++---------------
gegl/gegl-matrix.h | 55 +++++-----
gegl/property-types/gegl-path.c | 34 +++---
gegl/property-types/gegl-path.h | 4 +-
operations/affine/affine.c | 133 ++++++++++++-----------
operations/affine/affine.h | 2 +-
operations/affine/chant.h | 2 +-
operations/affine/reflect.c | 8 +-
operations/affine/rotate.c | 8 +-
operations/affine/scale.c | 6 +-
operations/affine/shear.c | 6 +-
operations/affine/transform.c | 2 +-
operations/affine/translate.c | 6 +-
operations/external/path.c | 2 +-
operations/external/vector-fill.c | 2 +-
operations/external/vector-stroke.c | 2 +-
18 files changed, 240 insertions(+), 224 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-downsize.c b/gegl/buffer/gegl-sampler-downsize.c
index 17d033d..8b5f455 100644
--- a/gegl/buffer/gegl-sampler-downsize.c
+++ b/gegl/buffer/gegl-sampler-downsize.c
@@ -276,10 +276,10 @@ gegl_sampler_downsize_get ( GeglSampler* self,
*/
GeglMatrix2* const inverse_jacobian = self->inverse_jacobian;
- const gdouble Jinv_11 = *inverse_jacobian[0][0];
- const gdouble Jinv_12 = *inverse_jacobian[0][1];
- const gdouble Jinv_21 = *inverse_jacobian[1][0];
- const gdouble Jinv_22 = *inverse_jacobian[1][1];
+ const gdouble Jinv_11 = inverse_jacobian->coeff[0][0];
+ const gdouble Jinv_12 = inverse_jacobian->coeff[0][1];
+ const gdouble Jinv_21 = inverse_jacobian->coeff[1][0];
+ const gdouble Jinv_22 = inverse_jacobian->coeff[1][1];
/*
* Preimages of (1,1) (top right corner) and (1,-1) (bottom right
diff --git a/gegl/buffer/gegl-sampler-downsizefast.c b/gegl/buffer/gegl-sampler-downsizefast.c
index 7c57b93..4b7cce4 100644
--- a/gegl/buffer/gegl-sampler-downsizefast.c
+++ b/gegl/buffer/gegl-sampler-downsizefast.c
@@ -235,10 +235,10 @@ gegl_sampler_downsizefast_get ( GeglSampler* self,
*/
GeglMatrix2* const inverse_jacobian = self->inverse_jacobian;
- const gdouble Jinv_11 = *inverse_jacobian[0][0];
- const gdouble Jinv_12 = *inverse_jacobian[0][1];
- const gdouble Jinv_21 = *inverse_jacobian[1][0];
- const gdouble Jinv_22 = *inverse_jacobian[1][1];
+ const gdouble Jinv_11 = inverse_jacobian->coeff[0][0];
+ const gdouble Jinv_12 = inverse_jacobian->coeff[0][1];
+ const gdouble Jinv_21 = inverse_jacobian->coeff[1][0];
+ const gdouble Jinv_22 = inverse_jacobian->coeff[1][1];
/*
* Preimages of (1,1) (top right corner) and (1,-1) (bottom right
diff --git a/gegl/gegl-matrix.c b/gegl/gegl-matrix.c
index 30fd3aa..19a1c69 100644
--- a/gegl/gegl-matrix.c
+++ b/gegl/gegl-matrix.c
@@ -25,7 +25,7 @@
#if 0
-static void gegl_matrix3_debug (GeglMatrix3 matrix)
+static void gegl_matrix3_debug (GeglMatrix3 *matrix)
{
if (matrix)
{
@@ -40,150 +40,158 @@ static void gegl_matrix3_debug (GeglMatrix3 matrix)
}
#endif
+GeglMatrix3 *
+gegl_matrix3_new ()
+{
+ return g_new0(GeglMatrix3, 1);
+}
+
void
-gegl_matrix3_identity (GeglMatrix3 matrix)
+gegl_matrix3_identity (GeglMatrix3 *matrix)
{
- matrix [0][0] = matrix [1][1] = matrix [2][2] = 1.;
+ matrix->coeff [0][0] = matrix->coeff [1][1] = matrix->coeff [2][2] = 1.;
- matrix [0][1] = matrix [0][2] = 0.;
- matrix [1][0] = matrix [1][2] = 0.;
- matrix [2][0] = matrix [2][1] = 0.;
+ matrix->coeff [0][1] = matrix->coeff [0][2] = 0.;
+ matrix->coeff [1][0] = matrix->coeff [1][2] = 0.;
+ matrix->coeff [2][0] = matrix->coeff [2][1] = 0.;
}
gboolean
-gegl_matrix3_equal (GeglMatrix3 matrix1,
- GeglMatrix3 matrix2)
+gegl_matrix3_equal (GeglMatrix3 *matrix1,
+ GeglMatrix3 *matrix2)
{
gint x, y;
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
- if (matrix1 [y][x] != matrix2 [y][x])
+ if (matrix1->coeff [y][x] != matrix2->coeff [y][x])
return FALSE;
return TRUE;
}
gboolean
-gegl_matrix3_is_identity (GeglMatrix3 matrix)
+gegl_matrix3_is_identity (GeglMatrix3 *matrix)
{
GeglMatrix3 identity;
-
- gegl_matrix3_identity (identity);
- return gegl_matrix3_equal (identity, matrix);
+ gegl_matrix3_identity (&identity);
+ return gegl_matrix3_equal (&identity, matrix);
}
gboolean
-gegl_matrix3_is_scale (GeglMatrix3 matrix)
+gegl_matrix3_is_scale (GeglMatrix3 *matrix)
{
GeglMatrix3 copy;
-
- gegl_matrix3_copy (copy, matrix);
- copy [0][0] = copy [1][1] = 1.;
- copy [0][2] = copy [1][2] = 0.;
- return gegl_matrix3_is_identity (copy);
+ gegl_matrix3_copy_into (©, matrix);
+ copy.coeff [0][0] = copy.coeff [1][1] = 1.;
+ copy.coeff [0][2] = copy.coeff [1][2] = 0.;
+ return gegl_matrix3_is_identity (©);
}
gboolean
-gegl_matrix3_is_translate (GeglMatrix3 matrix)
+gegl_matrix3_is_translate (GeglMatrix3 *matrix)
{
GeglMatrix3 copy;
-
- gegl_matrix3_copy (copy, matrix);
- copy [0][2] = copy [1][2] = 0.;
- return gegl_matrix3_is_identity (copy);
+ gegl_matrix3_copy_into (©, matrix);
+ copy.coeff [0][2] = copy.coeff [1][2] = 0.;
+ return gegl_matrix3_is_identity (©);
}
void
-gegl_matrix3_copy (GeglMatrix3 dst,
- GeglMatrix3 src)
+gegl_matrix3_copy_into (GeglMatrix3 *dst,
+ GeglMatrix3 *src)
{
- memcpy (dst [0], src [0], 3 * sizeof (gdouble));
- memcpy (dst [1], src [1], 3 * sizeof (gdouble));
- memcpy (dst [2], src [2], 3 * sizeof (gdouble));
+ memcpy (dst->coeff [0], src->coeff [0], 3 * sizeof (gdouble));
+ memcpy (dst->coeff [1], src->coeff [1], 3 * sizeof (gdouble));
+ memcpy (dst->coeff [2], src->coeff [2], 3 * sizeof (gdouble));
}
gdouble
-gegl_matrix3_determinant (GeglMatrix3 matrix)
+gegl_matrix3_determinant (GeglMatrix3 *matrix)
{
gdouble determinant;
- determinant = matrix [0][0] * (matrix [1][1] * matrix [2][2] -
- matrix [1][2] * matrix [2][1])
- - matrix [0][1] * (matrix [1][0] * matrix [2][2] -
- matrix [1][2] * matrix [2][0])
- + matrix [0][2] * (matrix [1][0] * matrix [2][1] -
- matrix [1][1] * matrix [2][0]);
+ determinant = matrix->coeff [0][0] * (matrix->coeff [1][1] * matrix->coeff [2][2] -
+ matrix->coeff [1][2] * matrix->coeff [2][1])
+ - matrix->coeff [0][1] * (matrix->coeff [1][0] * matrix->coeff [2][2] -
+ matrix->coeff [1][2] * matrix->coeff [2][0])
+ + matrix->coeff [0][2] * (matrix->coeff [1][0] * matrix->coeff [2][1] -
+ matrix->coeff [1][1] * matrix->coeff [2][0]);
return determinant;
}
void
-gegl_matrix3_invert (GeglMatrix3 matrix)
+gegl_matrix3_invert (GeglMatrix3 *matrix)
{
GeglMatrix3 copy;
gdouble coeff;
- gegl_matrix3_copy (copy, matrix);
+ gegl_matrix3_copy_into (©, matrix);
coeff = 1 / gegl_matrix3_determinant (matrix);
- matrix [0][0] = (copy [1][1] * copy [2][2] -
- copy [1][2] * copy [2][1]) * coeff;
- matrix [1][0] = (copy [1][2] * copy [2][0] -
- copy [1][0] * copy [2][2]) * coeff;
- matrix [2][0] = (copy [1][0] * copy [2][1] -
- copy [1][1] * copy [2][0]) * coeff;
-
- matrix [0][1] = (copy [0][2] * copy [2][1] -
- copy [0][1] * copy [2][2]) * coeff;
- matrix [1][1] = (copy [0][0] * copy [2][2] -
- copy [0][2] * copy [2][0]) * coeff;
- matrix [2][1] = (copy [0][1] * copy [2][0] -
- copy [0][0] * copy [2][1]) * coeff;
-
- matrix [0][2] = (copy [0][1] * copy [1][2] -
- copy [0][2] * copy [1][1]) * coeff;
- matrix [1][2] = (copy [0][2] * copy [1][0] -
- copy [0][0] * copy [1][2]) * coeff;
- matrix [2][2] = (copy [0][0] * copy [1][1] -
- copy [0][1] * copy [1][0]) * coeff;
+ matrix->coeff [0][0] = (copy.coeff [1][1] * copy.coeff [2][2] -
+ copy.coeff [1][2] * copy.coeff [2][1]) * coeff;
+ matrix->coeff [1][0] = (copy.coeff [1][2] * copy.coeff [2][0] -
+ copy.coeff [1][0] * copy.coeff [2][2]) * coeff;
+ matrix->coeff [2][0] = (copy.coeff [1][0] * copy.coeff [2][1] -
+ copy.coeff [1][1] * copy.coeff [2][0]) * coeff;
+
+ matrix->coeff [0][1] = (copy.coeff [0][2] * copy.coeff [2][1] -
+ copy.coeff [0][1] * copy.coeff [2][2]) * coeff;
+ matrix->coeff [1][1] = (copy.coeff [0][0] * copy.coeff [2][2] -
+ copy.coeff [0][2] * copy.coeff [2][0]) * coeff;
+ matrix->coeff [2][1] = (copy.coeff [0][1] * copy.coeff [2][0] -
+ copy.coeff [0][0] * copy.coeff [2][1]) * coeff;
+
+ matrix->coeff [0][2] = (copy.coeff [0][1] * copy.coeff [1][2] -
+ copy.coeff [0][2] * copy.coeff [1][1]) * coeff;
+ matrix->coeff [1][2] = (copy.coeff [0][2] * copy.coeff [1][0] -
+ copy.coeff [0][0] * copy.coeff [1][2]) * coeff;
+ matrix->coeff [2][2] = (copy.coeff [0][0] * copy.coeff [1][1] -
+ copy.coeff [0][1] * copy.coeff [1][0]) * coeff;
}
+
void
-gegl_matrix3_multiply (GeglMatrix3 left,
- GeglMatrix3 right,
- GeglMatrix3 product)
+gegl_matrix3_multiply (GeglMatrix3 *left,
+ GeglMatrix3 *right,
+ GeglMatrix3 *product)
{
GeglMatrix3 temp;
gint i;
for (i = 0; i < 3; i++)
{
- temp [i][0] = left [i][0] * right [0][0] + left [i][1] * right [1][0]
- + left [i][2] * right [2][0];
- temp [i][1] = left [i][0] * right [0][1] + left [i][1] * right [1][1]
- + left [i][2] * right [2][1];
- temp [i][2] = left [i][0] * right [0][2] + left [i][1] * right [1][2]
- + left [i][2] * right [2][2];
+ temp.coeff [i][0] = left->coeff [i][0] * right->coeff [0][0]
+ + left->coeff [i][1] * right->coeff [1][0]
+ + left->coeff [i][2] * right->coeff [2][0];
+ temp.coeff [i][1] = left->coeff [i][0] * right->coeff [0][1]
+ + left->coeff [i][1] * right->coeff [1][1]
+ + left->coeff [i][2] * right->coeff [2][1];
+ temp.coeff [i][2] = left->coeff [i][0] * right->coeff [0][2]
+ + left->coeff [i][1] * right->coeff [1][2]
+ + left->coeff [i][2] * right->coeff [2][2];
}
- gegl_matrix3_copy (product, temp);
+ gegl_matrix3_copy_into (product, &temp);
}
void
-gegl_matrix3_originate (GeglMatrix3 matrix,
+gegl_matrix3_originate (GeglMatrix3 *matrix,
gdouble x,
gdouble y)
{
+
/* assumes last row is [0 0 1] (true for affine transforms) */
- matrix [0][2] = matrix [0][0] * (-x) +
- matrix [0][1] * (-y) +
- matrix [0][2] + x;
- matrix [1][2] = matrix [1][0] * (-x) +
- matrix [1][1] * (-y) +
- matrix [1][2] + y;
+ matrix->coeff [0][2] = matrix->coeff [0][0] * (-x) +
+ matrix->coeff [0][1] * (-y) +
+ matrix->coeff [0][2] + x;
+ matrix->coeff [1][2] = matrix->coeff [1][0] * (-x) +
+ matrix->coeff [1][1] * (-y) +
+ matrix->coeff [1][2] + y;
}
void
-gegl_matrix3_transform_point (GeglMatrix3 matrix,
+gegl_matrix3_transform_point (GeglMatrix3 *matrix,
gdouble *x,
gdouble *y)
{
@@ -191,15 +199,15 @@ gegl_matrix3_transform_point (GeglMatrix3 matrix,
yp;
/* assumes last row is [0 0 1] (true for affine transforms) */
- xp = *x * matrix [0][0] + *y * matrix [0][1] + matrix [0][2];
- yp = *x * matrix [1][0] + *y * matrix [1][1] + matrix [1][2];
+ xp = *x * matrix->coeff [0][0] + *y * matrix->coeff [0][1] + matrix->coeff [0][2];
+ yp = *x * matrix->coeff [1][0] + *y * matrix->coeff [1][1] + matrix->coeff [1][2];
*x = xp;
*y = yp;
}
void
-gegl_matrix3_parse_string (GeglMatrix3 matrix,
+gegl_matrix3_parse_string (GeglMatrix3 *matrix,
const gchar *string)
{
gegl_matrix3_identity (matrix);
@@ -218,8 +226,8 @@ gegl_matrix3_parse_string (GeglMatrix3 matrix,
b = strtod (p, &p);
if (!p) return;
- matrix [0][2] = a;
- matrix [1][2] = b;
+ matrix->coeff [0][2] = a;
+ matrix->coeff [1][2] = b;
}
else if (strstr (string, "matrix"))
{
@@ -234,7 +242,7 @@ gegl_matrix3_parse_string (GeglMatrix3 matrix,
for (j=0;j<2;j++)
{
a = strtod(p, &p);
- matrix [j][i] = a;
+ matrix->coeff [j][i] = a;
if (!p) return;
p = strchr (p, ',');
if (!p) return;
@@ -243,7 +251,7 @@ gegl_matrix3_parse_string (GeglMatrix3 matrix,
}
}
-gchar *gegl_matrix3_to_string (GeglMatrix3 matrix)
+gchar *gegl_matrix3_to_string (GeglMatrix3 *matrix)
{
gchar *res;
GString *str = g_string_new ("matrix(");
@@ -256,7 +264,7 @@ gchar *gegl_matrix3_to_string (GeglMatrix3 matrix)
if (a!=0)
g_string_append (str, ",");
a=1;
- g_string_append_printf (str, "%f", matrix[j][i]);
+ g_string_append_printf (str, "%f", matrix->coeff[j][i]);
}
g_string_append (str, ")");
res = str->str;
diff --git a/gegl/gegl-matrix.h b/gegl/gegl-matrix.h
index 214ec9c..38ec003 100644
--- a/gegl/gegl-matrix.h
+++ b/gegl/gegl-matrix.h
@@ -13,16 +13,21 @@ G_BEGIN_DECLS
* Matrixes are currently used by #GeglPath and the affine operations,
* they might be used more centrally in the core of GEGL later.
*
- * typedef gdouble GeglMatrix3 [3][3];
*/
-/* FIXME: Multi-dimensional arrays are not introspectable, so this
- * header has to be excluded from the GI scan, and therefore not available to
- * GI-based bindings.
- * See https://bugzilla.gnome.org/show_bug.cgi?id=645817 */
+typedef struct {
+ gdouble coeff[3][3];
+} GeglMatrix3;
+typedef struct {
+ gdouble coeff [2][2];
+} GeglMatrix2;
-typedef gdouble GeglMatrix3 [3][3];
-typedef gdouble GeglMatrix2 [2][2];
+/**
+ * gegl_matrix3_new:
+ *
+ * Return: A newly allocated #GeglMatrix3
+ */
+GeglMatrix3 * gegl_matrix3_new ();
/**
* gegl_matrix3_identity:
@@ -30,7 +35,7 @@ typedef gdouble GeglMatrix2 [2][2];
*
* Set the provided @matrix to the identity matrix.
*/
-void gegl_matrix3_identity (GeglMatrix3 matrix);
+void gegl_matrix3_identity (GeglMatrix3 *matrix);
/**
* gegl_matrix3_equal:
@@ -41,8 +46,8 @@ void gegl_matrix3_identity (GeglMatrix3 matrix);
*
* Returns TRUE if the matrices are equal.
*/
-gboolean gegl_matrix3_equal (GeglMatrix3 matrix1,
- GeglMatrix3 matrix2);
+gboolean gegl_matrix3_equal (GeglMatrix3 *matrix1,
+ GeglMatrix3 *matrix2);
/**
* gegl_matrix3_is_identity:
@@ -52,7 +57,7 @@ gboolean gegl_matrix3_equal (GeglMatrix3 matrix1,
*
* Returns TRUE if the matrix is the identity matrix.
*/
-gboolean gegl_matrix3_is_identity (GeglMatrix3 matrix);
+gboolean gegl_matrix3_is_identity (GeglMatrix3 *matrix);
/**
* gegl_matrix3_is_scale:
@@ -62,7 +67,7 @@ gboolean gegl_matrix3_is_identity (GeglMatrix3 matrix);
*
* Returns TRUE if the matrix only does scaling.
*/
-gboolean gegl_matrix3_is_scale (GeglMatrix3 matrix);
+gboolean gegl_matrix3_is_scale (GeglMatrix3 *matrix);
/**
* gegl_matrix3_is_translate:
@@ -72,17 +77,17 @@ gboolean gegl_matrix3_is_scale (GeglMatrix3 matrix);
*
* Returns TRUE if the matrix only does trasnlation.
*/
-gboolean gegl_matrix3_is_translate (GeglMatrix3 matrix);
+gboolean gegl_matrix3_is_translate (GeglMatrix3 *matrix);
/**
- * gegl_matrix3_copy:
+ * gegl_matrix3_copy_into:
* @dst: a #GeglMatrix
* @src: a #GeglMatrix
*
* Copies the matrix in @src into @dst.
*/
-void gegl_matrix3_copy (GeglMatrix3 dst,
- GeglMatrix3 src);
+void gegl_matrix3_copy_into (GeglMatrix3 *dst,
+ GeglMatrix3 *src);
/**
* gegl_matrix3_determinant:
@@ -90,7 +95,7 @@ void gegl_matrix3_copy (GeglMatrix3 dst,
*
* Returns the determinant for the matrix.
*/
-gdouble gegl_matrix3_determinant (GeglMatrix3 matrix);
+gdouble gegl_matrix3_determinant (GeglMatrix3 *matrix);
/**
* gegl_matrix3_invert:
@@ -98,7 +103,7 @@ gdouble gegl_matrix3_determinant (GeglMatrix3 matrix);
*
* Inverts @matrix.
*/
-void gegl_matrix3_invert (GeglMatrix3 matrix);
+void gegl_matrix3_invert (GeglMatrix3 *matrix);
/**
* gegl_matrix3_multiply:
@@ -108,9 +113,9 @@ void gegl_matrix3_invert (GeglMatrix3 matrix);
*
* Multiples @product = @left · @right
*/
-void gegl_matrix3_multiply (GeglMatrix3 left,
- GeglMatrix3 right,
- GeglMatrix3 product);
+void gegl_matrix3_multiply (GeglMatrix3 *left,
+ GeglMatrix3 *right,
+ GeglMatrix3 *product);
/**
* gegl_matrix3_originate:
@@ -121,7 +126,7 @@ void gegl_matrix3_multiply (GeglMatrix3 left,
* Hmm not quite sure what this does.
*
*/
-void gegl_matrix3_originate (GeglMatrix3 matrix,
+void gegl_matrix3_originate (GeglMatrix3 *matrix,
gdouble x,
gdouble y);
@@ -136,7 +141,7 @@ void gegl_matrix3_originate (GeglMatrix3 matrix,
* coordinates gotten when the transformed with the matrix.
*
*/
-void gegl_matrix3_transform_point (GeglMatrix3 matrix,
+void gegl_matrix3_transform_point (GeglMatrix3 *matrix,
gdouble *x,
gdouble *y);
@@ -148,7 +153,7 @@ void gegl_matrix3_transform_point (GeglMatrix3 matrix,
*
* Parse a transofmation matrix from a string.
*/
-void gegl_matrix3_parse_string (GeglMatrix3 matrix,
+void gegl_matrix3_parse_string (GeglMatrix3 *matrix,
const gchar *string);
/**
* gegl_matrix3_to_string:
@@ -160,7 +165,7 @@ void gegl_matrix3_parse_string (GeglMatrix3 matrix,
* returned string should be g_free()'d.
*
*/
-gchar * gegl_matrix3_to_string (GeglMatrix3 matrix);
+gchar * gegl_matrix3_to_string (GeglMatrix3 *matrix);
/***
*/
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index fca53b2..eb8c91e 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -62,17 +62,17 @@ typedef struct InstructionInfo
/* a flatten function pointer is kept for all stored InstructionInfo's but are only
* used for the internal ones
*/
- GeglPathList *(*flatten) (GeglMatrix3 matrix,
+ GeglPathList *(*flatten) (GeglMatrix3 *matrix,
GeglPathList *head,
GeglPathList *prev,
GeglPathList *self);
} InstructionInfo;
-static GeglPathList *flatten_copy (GeglMatrix3 matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
-static GeglPathList *flatten_rel_copy (GeglMatrix3 matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
-static GeglPathList *flatten_nop (GeglMatrix3 matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
-static GeglPathList *flatten_curve (GeglMatrix3 matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
+static GeglPathList *flatten_copy (GeglMatrix3 *matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
+static GeglPathList *flatten_rel_copy (GeglMatrix3 *matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
+static GeglPathList *flatten_nop (GeglMatrix3 *matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
+static GeglPathList *flatten_curve (GeglMatrix3 *matrix, GeglPathList *head, GeglPathList *prev, GeglPathList *self);
/* FIXME: handling of relative commands should be moved to the flattening stage */
@@ -105,7 +105,7 @@ static InstructionInfo *lookup_instruction_info (gchar type)
}
static void transform_data (
- GeglMatrix3 matrix,
+ GeglMatrix3 *matrix,
GeglPathItem *dst
)
{
@@ -200,7 +200,7 @@ gegl_path_list_append_item (GeglPathList *head,
return head;
}
-static GeglPathList *flatten_nop (GeglMatrix3 matrix,
+static GeglPathList *flatten_nop (GeglMatrix3 *matrix,
GeglPathList *head,
GeglPathList *prev,
GeglPathList *self)
@@ -208,7 +208,7 @@ static GeglPathList *flatten_nop (GeglMatrix3 matrix,
return head;
}
-static GeglPathList *flatten_copy (GeglMatrix3 matrix,
+static GeglPathList *flatten_copy (GeglMatrix3 *matrix,
GeglPathList *head,
GeglPathList *prev,
GeglPathList *self)
@@ -221,7 +221,7 @@ static GeglPathList *flatten_copy (GeglMatrix3 matrix,
}
static GeglPathList *
-flatten_rel_copy (GeglMatrix3 matrix,
+flatten_rel_copy (GeglMatrix3 *matrix,
GeglPathList *head,
GeglPathList *prev,
GeglPathList *self)
@@ -288,7 +288,7 @@ bezier2 (GeglPathItem *prev,
-static GeglPathList *flatten_curve (GeglMatrix3 matrix,
+static GeglPathList *flatten_curve (GeglMatrix3 *matrix,
GeglPathList *head,
GeglPathList *prev,
GeglPathList *self)
@@ -317,7 +317,7 @@ static GeglPathList *flatten_curve (GeglMatrix3 matrix,
* gegl_path_list_flatten: (skip)
*/
static GeglPathList *
-gegl_path_list_flatten (GeglMatrix3 matrix,
+gegl_path_list_flatten (GeglMatrix3 *matrix,
GeglPathList *original)
{
GeglPathList *iter;
@@ -801,10 +801,10 @@ void gegl_path_thaw (GeglPath *path)
*/
void
gegl_path_get_matrix (GeglPath *path,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
- gegl_matrix3_copy (matrix, priv->matrix);
+ gegl_matrix3_copy_into (matrix, &priv->matrix);
}
/**
@@ -812,7 +812,7 @@ gegl_path_get_matrix (GeglPath *path,
*/
void
gegl_path_set_matrix (GeglPath *path,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglPathPrivate *priv;
if (!path)
@@ -821,7 +821,7 @@ gegl_path_set_matrix (GeglPath *path,
return;
}
priv = GEGL_PATH_GET_PRIVATE (path);
- gegl_matrix3_copy (priv->matrix, matrix);
+ gegl_matrix3_copy_into (&priv->matrix, matrix);
priv->flat_path_clean = FALSE;
priv->length_clean = FALSE;
}
@@ -850,7 +850,7 @@ static void ensure_flattened (GeglPath *vector)
}
}
- priv->flat_path = gegl_path_list_flatten (priv->matrix, path);
+ priv->flat_path = gegl_path_list_flatten (&priv->matrix, path);
if (path != priv->path)
gegl_path_list_destroy (path);
priv->flat_path_clean = TRUE;
@@ -869,7 +869,7 @@ gegl_path_init (GeglPath *self)
{
GeglPathPrivate *priv;
priv = GEGL_PATH_GET_PRIVATE (self);
- gegl_matrix3_identity (priv->matrix);
+ gegl_matrix3_identity (&priv->matrix);
}
static void
diff --git a/gegl/property-types/gegl-path.h b/gegl/property-types/gegl-path.h
index 2628c8c..7e5dcaf 100644
--- a/gegl/property-types/gegl-path.h
+++ b/gegl/property-types/gegl-path.h
@@ -185,7 +185,7 @@ gchar * gegl_path_to_string (GeglPath *path);
* length to be changed by the transform.
*/
void gegl_path_set_matrix (GeglPath *path,
- GeglMatrix3 matrix);
+ GeglMatrix3 *matrix);
/**
* gegl_path_get_matrix:
@@ -198,7 +198,7 @@ void gegl_path_set_matrix (GeglPath *path,
* such node.
*/
void gegl_path_get_matrix (GeglPath *path,
- GeglMatrix3 matrix);
+ GeglMatrix3 *matrix);
/**
* gegl_path_closest_point:
diff --git a/operations/affine/affine.c b/operations/affine/affine.c
index 3d5167d..271cae8 100644
--- a/operations/affine/affine.c
+++ b/operations/affine/affine.c
@@ -64,7 +64,7 @@ static void gegl_affine_bounding_box (gdouble
static gboolean gegl_affine_is_intermediate_node (OpAffine *affine);
static gboolean gegl_affine_is_composite_node (OpAffine *affine);
static void gegl_affine_get_source_matrix (OpAffine *affine,
- GeglMatrix3 output);
+ GeglMatrix3 *output);
static GeglRectangle gegl_affine_get_bounding_box (GeglOperation *op);
static GeglRectangle gegl_affine_get_invalidated_by_change (GeglOperation *operation,
const gchar *input_pad,
@@ -86,9 +86,9 @@ static GeglNode * gegl_affine_detect (GeglOperation
gint x,
gint y);
-static gboolean gegl_affine_matrix3_allow_fast_translate (GeglMatrix3 matrix);
-static gboolean gegl_affine_matrix3_allow_fast_reflect_x (GeglMatrix3 matrix);
-static gboolean gegl_affine_matrix3_allow_fast_reflect_y (GeglMatrix3 matrix);
+static gboolean gegl_affine_matrix3_allow_fast_translate (GeglMatrix3 *matrix);
+static gboolean gegl_affine_matrix3_allow_fast_reflect_x (GeglMatrix3 *matrix);
+static gboolean gegl_affine_matrix3_allow_fast_reflect_y (GeglMatrix3 *matrix);
static void gegl_affine_fast_reflect_x (GeglBuffer *dest,
GeglBuffer *src,
@@ -342,7 +342,7 @@ gegl_affine_set_property (GObject *object,
static void
gegl_affine_create_matrix (OpAffine *affine,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
gegl_matrix3_identity (matrix);
@@ -352,7 +352,7 @@ gegl_affine_create_matrix (OpAffine *affine,
static void
gegl_affine_create_composite_matrix (OpAffine *affine,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
gegl_affine_create_matrix (affine, matrix);
@@ -363,8 +363,8 @@ gegl_affine_create_composite_matrix (OpAffine *affine,
{
GeglMatrix3 source;
- gegl_affine_get_source_matrix (affine, source);
- gegl_matrix3_multiply (source, matrix, matrix);
+ gegl_affine_get_source_matrix (affine, &source);
+ gegl_matrix3_multiply (&source, matrix, matrix);
}
}
@@ -453,7 +453,7 @@ gegl_affine_is_composite_node (OpAffine *affine)
static void
gegl_affine_get_source_matrix (OpAffine *affine,
- GeglMatrix3 output)
+ GeglMatrix3 *output)
{
GSList *connections;
GeglOperation *op = GEGL_OPERATION (affine);
@@ -490,10 +490,10 @@ gegl_affine_get_bounding_box (GeglOperation *op)
if (gegl_operation_source_get_bounding_box (op, "input"))
in_rect = *gegl_operation_source_get_bounding_box (op, "input");
- gegl_affine_create_composite_matrix (affine, matrix);
+ gegl_affine_create_composite_matrix (affine, &matrix);
if (gegl_affine_is_intermediate_node (affine) ||
- gegl_matrix3_is_identity (matrix))
+ gegl_matrix3_is_identity (&matrix))
{
return in_rect;
}
@@ -516,7 +516,7 @@ gegl_affine_get_bounding_box (GeglOperation *op)
have_points [7] = in_rect.y + in_rect.height ;
for (i = 0; i < 8; i += 2)
- gegl_matrix3_transform_point (matrix,
+ gegl_matrix3_transform_point (&matrix,
have_points + i, have_points + i + 1);
gegl_affine_bounding_box (have_points, 4, &have_rect);
@@ -535,7 +535,7 @@ gegl_affine_detect (GeglOperation *operation,
gint i;
if (gegl_affine_is_intermediate_node (affine) ||
- gegl_matrix3_is_identity (inverse))
+ gegl_matrix3_is_identity (&inverse))
{
return gegl_operation_detect (source_node->operation, x, y);
}
@@ -543,11 +543,11 @@ gegl_affine_detect (GeglOperation *operation,
need_points [0] = x;
need_points [1] = y;
- gegl_affine_create_matrix (affine, inverse);
- gegl_matrix3_invert (inverse);
+ gegl_affine_create_matrix (affine, &inverse);
+ gegl_matrix3_invert (&inverse);
for (i = 0; i < 2; i += 2)
- gegl_matrix3_transform_point (inverse,
+ gegl_matrix3_transform_point (&inverse,
need_points + i, need_points + i + 1);
return gegl_operation_detect (source_node->operation,
@@ -573,11 +573,11 @@ gegl_affine_get_required_for_output (GeglOperation *op,
context_rect = sampler->context_rect;
g_object_unref (sampler);
- gegl_affine_create_composite_matrix (affine, inverse);
- gegl_matrix3_invert (inverse);
+ gegl_affine_create_composite_matrix (affine, &inverse);
+ gegl_matrix3_invert (&inverse);
if (gegl_affine_is_intermediate_node (affine) ||
- gegl_matrix3_is_identity (inverse))
+ gegl_matrix3_is_identity (&inverse))
{
return requested_rect;
}
@@ -595,7 +595,7 @@ gegl_affine_get_required_for_output (GeglOperation *op,
need_points [7] = requested_rect.y + requested_rect.height ;
for (i = 0; i < 8; i += 2)
- gegl_matrix3_transform_point (inverse,
+ gegl_matrix3_transform_point (&inverse,
need_points + i, need_points + i + 1);
gegl_affine_bounding_box (need_points, 4, &need_rect);
@@ -624,21 +624,21 @@ gegl_affine_get_invalidated_by_change (GeglOperation *op,
context_rect = sampler->context_rect;
g_object_unref (sampler);
- gegl_affine_create_matrix (affine, matrix);
+ gegl_affine_create_matrix (affine, &matrix);
if (affine->origin_x || affine->origin_y)
- gegl_matrix3_originate (matrix, affine->origin_x, affine->origin_y);
+ gegl_matrix3_originate (&matrix, affine->origin_x, affine->origin_y);
if (gegl_affine_is_composite_node (affine))
{
GeglMatrix3 source;
- gegl_affine_get_source_matrix (affine, source);
- gegl_matrix3_multiply (source, matrix, matrix);
+ gegl_affine_get_source_matrix (affine, &source);
+ gegl_matrix3_multiply (&source, &matrix, &matrix);
}
if (gegl_affine_is_intermediate_node (affine) ||
- gegl_matrix3_is_identity (matrix))
+ gegl_matrix3_is_identity (&matrix))
{
return region;
}
@@ -661,7 +661,7 @@ gegl_affine_get_invalidated_by_change (GeglOperation *op,
affected_points [7] = region.y + region.height ;
for (i = 0; i < 8; i += 2)
- gegl_matrix3_transform_point (matrix,
+ gegl_matrix3_transform_point (&matrix,
affected_points + i, affected_points + i + 1);
gegl_affine_bounding_box (affected_points, 4, &affected_rect);
@@ -672,7 +672,7 @@ gegl_affine_get_invalidated_by_change (GeglOperation *op,
static void
affine_generic (GeglBuffer *dest,
GeglBuffer *src,
- GeglMatrix3 matrix,
+ GeglMatrix3 *matrix,
GeglSampler *sampler)
{
GeglBufferIterator *i;
@@ -681,7 +681,7 @@ affine_generic (GeglBuffer *dest,
gfloat * restrict dest_buf,
*dest_ptr;
GeglMatrix3 inverse;
- GeglMatrix2 inverse_jacobian;
+ GeglMatrix2 *inverse_jacobian;
gdouble u_start,
v_start,
u_float,
@@ -692,6 +692,7 @@ affine_generic (GeglBuffer *dest,
gint dest_pixels;
format = babl_format ("RaGaBaA float");
+ inverse_jacobian = g_new(GeglMatrix2, 1);
/* XXX: fast paths as existing in files in the same dir as affine.c
* should probably be hooked in here, and bailing out before using
@@ -707,22 +708,24 @@ affine_generic (GeglBuffer *dest,
GeglRectangle *roi = &i->roi[0];
dest_buf = (gfloat *)i->data[0];
- gegl_matrix3_copy (inverse, matrix);
- gegl_matrix3_invert (inverse);
- inverse_jacobian[0][0] = inverse[0][0];
- inverse_jacobian[0][1] = inverse[0][1];
- inverse_jacobian[1][0] = inverse[1][0];
- inverse_jacobian[1][1] = inverse[1][1];
+ gegl_matrix3_copy_into (&inverse, matrix);
+ gegl_matrix3_invert (&inverse);
+ inverse_jacobian->coeff[0][0] = inverse.coeff[0][0];
+ inverse_jacobian->coeff[0][1] = inverse.coeff[0][1];
+ inverse_jacobian->coeff[1][0] = inverse.coeff[1][0];
+ inverse_jacobian->coeff[1][1] = inverse.coeff[1][1];
/* set inverse_jacobian for samplers that support it */
- sampler->inverse_jacobian = &inverse_jacobian;
+ sampler->inverse_jacobian = inverse_jacobian;
- u_start = inverse[0][0] * roi->x + inverse[0][1] * roi->y + inverse[0][2];
- v_start = inverse[1][0] * roi->x + inverse[1][1] * roi->y + inverse[1][2];
+ 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];
/* correct rounding on e.g. negative scaling (is this sound?) */
- if (inverse [0][0] < 0.) u_start -= .001;
- if (inverse [1][1] < 0.) v_start -= .001;
+ if (inverse.coeff [0][0] < 0.) u_start -= .001;
+ if (inverse.coeff [1][1] < 0.) v_start -= .001;
for (dest_ptr = dest_buf, y = roi->height; y--;)
{
@@ -733,46 +736,46 @@ affine_generic (GeglBuffer *dest,
{
gegl_sampler_get (sampler, u_float, v_float, dest_ptr);
dest_ptr+=4;
- u_float += inverse [0][0];
- v_float += inverse [1][0];
+ u_float += inverse.coeff [0][0];
+ v_float += inverse.coeff [1][0];
}
- u_start += inverse [0][1];
- v_start += inverse [1][1];
+ u_start += inverse.coeff [0][1];
+ v_start += inverse.coeff [1][1];
}
}
}
static gboolean
-gegl_affine_matrix3_allow_fast_translate (GeglMatrix3 matrix)
+gegl_affine_matrix3_allow_fast_translate (GeglMatrix3 *matrix)
{
- if (! GEGL_FLOAT_EQUAL (matrix[0][2], (gint) matrix[0][2]) ||
- ! GEGL_FLOAT_EQUAL (matrix[1][2], (gint) matrix[1][2]))
+ if (! GEGL_FLOAT_EQUAL (matrix->coeff[0][2], (gint) matrix->coeff[0][2]) ||
+ ! GEGL_FLOAT_EQUAL (matrix->coeff[1][2], (gint) matrix->coeff[1][2]))
return FALSE;
return gegl_matrix3_is_translate (matrix);
}
static gboolean
-gegl_affine_matrix3_allow_fast_reflect_x (GeglMatrix3 matrix)
+gegl_affine_matrix3_allow_fast_reflect_x (GeglMatrix3 *matrix)
{
GeglMatrix3 copy;
- if (! GEGL_FLOAT_EQUAL (matrix[1][1], -1.0))
+ if (! GEGL_FLOAT_EQUAL (matrix->coeff[1][1], -1.0))
return FALSE;
- gegl_matrix3_copy (copy, matrix);
- copy[1][1] = 1.;
- return gegl_affine_matrix3_allow_fast_translate (copy);
+ gegl_matrix3_copy_into (©, matrix);
+ copy.coeff[1][1] = 1.;
+ return gegl_affine_matrix3_allow_fast_translate (©);
}
static gboolean
-gegl_affine_matrix3_allow_fast_reflect_y (GeglMatrix3 matrix)
+gegl_affine_matrix3_allow_fast_reflect_y (GeglMatrix3 *matrix)
{
GeglMatrix3 copy;
- if (! GEGL_FLOAT_EQUAL (matrix[0][0], -1.0))
+ if (! GEGL_FLOAT_EQUAL (matrix->coeff[0][0], -1.0))
return FALSE;
- gegl_matrix3_copy (copy, matrix);
- copy[0][0] = 1.;
- return gegl_affine_matrix3_allow_fast_translate (copy);
+ gegl_matrix3_copy_into (©, matrix);
+ copy.coeff[0][0] = 1.;
+ return gegl_affine_matrix3_allow_fast_translate (©);
}
static void
@@ -872,10 +875,10 @@ gegl_affine_process (GeglOperation *operation,
GeglMatrix3 matrix;
OpAffine *affine = (OpAffine *) operation;
- gegl_affine_create_composite_matrix (affine, matrix);
+ gegl_affine_create_composite_matrix (affine, &matrix);
if (gegl_affine_is_intermediate_node (affine) ||
- gegl_matrix3_is_identity (matrix))
+ gegl_matrix3_is_identity (&matrix))
{
/* passing straight through (like gegl:nop) */
input = gegl_operation_context_get_source (context, "input");
@@ -887,8 +890,8 @@ gegl_affine_process (GeglOperation *operation,
gegl_operation_context_take_object (context, "output", G_OBJECT (input));
}
- else if (gegl_affine_matrix3_allow_fast_translate (matrix) ||
- (gegl_matrix3_is_translate (matrix) &&
+ else if (gegl_affine_matrix3_allow_fast_translate (&matrix) ||
+ (gegl_matrix3_is_translate (&matrix) &&
! strcmp (affine->filter, "nearest")))
{
/* doing a buffer shifting trick, (enhanced nop) */
@@ -896,8 +899,8 @@ gegl_affine_process (GeglOperation *operation,
output = g_object_new (GEGL_TYPE_BUFFER,
"source", input,
- "shift-x", (int)-matrix[0][2],
- "shift-y", (int)-matrix[1][2],
+ "shift-x", (int)-matrix.coeff[0][2],
+ "shift-y", (int)-matrix.coeff[1][2],
"abyss-width", -1, /* turn of abyss
(relying on abyss
of source) */
@@ -911,7 +914,7 @@ gegl_affine_process (GeglOperation *operation,
if (input != NULL)
g_object_unref (input);
}
- else if (gegl_affine_matrix3_allow_fast_reflect_x (matrix))
+ else if (gegl_affine_matrix3_allow_fast_reflect_x (&matrix))
{
GeglRectangle src_rect;
GeglSampler *sampler;
@@ -937,7 +940,7 @@ gegl_affine_process (GeglOperation *operation,
if (input != NULL)
g_object_unref (input);
}
- else if (gegl_affine_matrix3_allow_fast_reflect_y (matrix))
+ else if (gegl_affine_matrix3_allow_fast_reflect_y (&matrix))
{
GeglRectangle src_rect;
GeglSampler *sampler;
@@ -974,7 +977,7 @@ gegl_affine_process (GeglOperation *operation,
sampler = op_affine_sampler (affine);
g_object_set(sampler, "buffer", input, NULL);
gegl_sampler_prepare (sampler);
- affine_generic (output, input, matrix, sampler);
+ affine_generic (output, input, &matrix, sampler);
g_object_unref(sampler->buffer);
sampler->buffer = NULL;
g_object_unref (sampler);
diff --git a/operations/affine/affine.h b/operations/affine/affine.h
index 35654be..d69eccf 100644
--- a/operations/affine/affine.h
+++ b/operations/affine/affine.h
@@ -32,7 +32,7 @@ struct _OpAffineClass
GeglOperationFilterClass parent_class;
void (* create_matrix) (OpAffine *affine,
- GeglMatrix3 matrix);
+ GeglMatrix3 *matrix);
};
GType op_affine_get_type (void) G_GNUC_CONST;
diff --git a/operations/affine/chant.h b/operations/affine/chant.h
index b2708a8..e2357b2 100644
--- a/operations/affine/chant.h
+++ b/operations/affine/chant.h
@@ -253,7 +253,7 @@ static void class_init (GeglOperationClass *operation_class);
#endif
static void create_matrix (OpAffine *affine,
- GeglMatrix3 matrix);
+ GeglMatrix3 *matrix);
static void
gegl_chant_class_init (ChantClass * klass)
diff --git a/operations/affine/reflect.c b/operations/affine/reflect.c
index 8e2c23b..50ced8e 100644
--- a/operations/affine/reflect.c
+++ b/operations/affine/reflect.c
@@ -40,7 +40,7 @@ gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
gdouble ux=0, uy=0;
@@ -53,9 +53,9 @@ create_matrix (OpAffine *op,
ux /= l;
uy /= l;
- matrix [0][0] = 2*ux*ux - 1;
- matrix [1][1] = 2*uy*uy - 1;
- matrix [0][1] = matrix [1][0] = 2*ux*uy;
+ matrix->coeff [0][0] = 2*ux*ux - 1;
+ matrix->coeff [1][1] = 2*uy*uy - 1;
+ matrix->coeff [0][1] = matrix->coeff [1][0] = 2*ux*uy;
}
diff --git a/operations/affine/rotate.c b/operations/affine/rotate.c
index 9efc0e2..7cc80c5 100644
--- a/operations/affine/rotate.c
+++ b/operations/affine/rotate.c
@@ -36,14 +36,14 @@ gegl_chant_double (degrees, -G_MAXDOUBLE, G_MAXDOUBLE, 0.,
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
gdouble radians = chant->degrees * (2 * G_PI / 360.);
- matrix [0][0] = matrix [1][1] = cos (radians);
- matrix [0][1] = sin (radians);
- matrix [1][0] = - matrix [0][1];
+ matrix->coeff [0][0] = matrix->coeff [1][1] = cos (radians);
+ matrix->coeff [0][1] = sin (radians);
+ matrix->coeff [1][0] = - matrix->coeff [0][1];
}
#endif
diff --git a/operations/affine/scale.c b/operations/affine/scale.c
index fc7b511..b046744 100644
--- a/operations/affine/scale.c
+++ b/operations/affine/scale.c
@@ -36,12 +36,12 @@ gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 1., _("Vertical scale factor.")
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
- matrix [0][0] = chant->x;
- matrix [1][1] = chant->y;
+ matrix->coeff [0][0] = chant->x;
+ matrix->coeff [1][1] = chant->y;
}
#endif
diff --git a/operations/affine/shear.c b/operations/affine/shear.c
index ec8045d..0dd320d 100644
--- a/operations/affine/shear.c
+++ b/operations/affine/shear.c
@@ -38,12 +38,12 @@ gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 1.,
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
- matrix [0][1] = chant->x;
- matrix [1][0] = chant->y;
+ matrix->coeff [0][1] = chant->x;
+ matrix->coeff [1][0] = chant->y;
}
#endif
diff --git a/operations/affine/transform.c b/operations/affine/transform.c
index 03a2402..4e7e9c0 100644
--- a/operations/affine/transform.c
+++ b/operations/affine/transform.c
@@ -35,7 +35,7 @@ gegl_chant_string (transform, "", _("Transformation string"))
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
diff --git a/operations/affine/translate.c b/operations/affine/translate.c
index f73e3a6..e699e5e 100644
--- a/operations/affine/translate.c
+++ b/operations/affine/translate.c
@@ -38,12 +38,12 @@ gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 1.,
static void
create_matrix (OpAffine *op,
- GeglMatrix3 matrix)
+ GeglMatrix3 *matrix)
{
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
- matrix [0][2] = chant->x;
- matrix [1][2] = chant->y;
+ matrix->coeff [0][2] = chant->x;
+ matrix->coeff [1][2] = chant->y;
}
#endif
diff --git a/operations/external/path.c b/operations/external/path.c
index ae72f88..64adb32 100644
--- a/operations/external/path.c
+++ b/operations/external/path.c
@@ -100,7 +100,7 @@ prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
if (o->transform && o->transform[0] != '\0')
{
- GeglMatrix3 matrix;
+ GeglMatrix3 *matrix = gegl_matrix3_new();
gegl_matrix3_parse_string (matrix, o->transform);
gegl_path_set_matrix (o->d, matrix);
}
diff --git a/operations/external/vector-fill.c b/operations/external/vector-fill.c
index 6f4629d..695950c 100644
--- a/operations/external/vector-fill.c
+++ b/operations/external/vector-fill.c
@@ -79,7 +79,7 @@ prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
if (o->transform && o->transform[0] != '\0')
{
- GeglMatrix3 matrix;
+ GeglMatrix3 *matrix = gegl_matrix3_new ();
gegl_matrix3_parse_string (matrix, o->transform);
gegl_path_set_matrix (o->d, matrix);
}
diff --git a/operations/external/vector-stroke.c b/operations/external/vector-stroke.c
index 8d1318c..b26aeac 100644
--- a/operations/external/vector-stroke.c
+++ b/operations/external/vector-stroke.c
@@ -78,7 +78,7 @@ prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
if (o->transform && o->transform[0] != '\0')
{
- GeglMatrix3 matrix;
+ GeglMatrix3 *matrix = gegl_matrix3_new ();
gegl_matrix3_parse_string (matrix, o->transform);
gegl_path_set_matrix (o->d, matrix);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]