[goffice] [GOData] Fix row/column mismatch.



commit f3076c8a4028827eac21a4c98b98beb2828d7ad9
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date:   Thu Apr 23 16:28:26 2009 +0200

    [GOData] Fix row/column mismatch.
    
    The matrix API use row/column order, which matches the C array indices
    order.  But for convenience, the sizes and coordinates array use the column/row
    order.
---
 goffice/data/go-data.c         |   10 +++++-----
 plugins/plot_surface/gog-xyz.c |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/goffice/data/go-data.c b/goffice/data/go-data.c
index 55b6467..c172d5c 100644
--- a/goffice/data/go-data.c
+++ b/goffice/data/go-data.c
@@ -330,7 +330,7 @@ go_data_get_vector_size (GOData *data)
 }
 
 void
-go_data_get_matrix_size (GOData *data, unsigned int *n_columns, unsigned int *n_rows)
+go_data_get_matrix_size (GOData *data, unsigned int *n_rows, unsigned int *n_columns)
 {
 	unsigned int sizes[2];
 
@@ -422,7 +422,7 @@ go_data_get_vector_value (GOData *data, unsigned int column)
 }
 
 double
-go_data_get_matrix_value (GOData *data, unsigned int column, unsigned int row)
+go_data_get_matrix_value (GOData *data, unsigned int row, unsigned int column)
 {
 	unsigned int coordinates[2];
 
@@ -466,7 +466,7 @@ go_data_get_vector_string (GOData *data, unsigned int column)
 }
 
 char *
-go_data_get_matrix_string (GOData *data, unsigned int column, unsigned int row)
+go_data_get_matrix_string (GOData *data, unsigned int row, unsigned int column)
 {
 	unsigned int coordinates[2];
 
@@ -769,13 +769,13 @@ _data_matrix_get_bounds (GOData *data, double *minimum, double *maximum)
 static double
 _data_matrix_get_value (GOData *data, unsigned int *coordinates)
 {
-	return go_data_matrix_get_value ((GODataMatrix *) data, coordinates[0], coordinates[1]);
+	return go_data_matrix_get_value ((GODataMatrix *) data, coordinates[1], coordinates[0]);
 }
 
 static char *
 _data_matrix_get_string (GOData *data, unsigned int *coordinates)
 {
-	return go_data_matrix_get_str ((GODataMatrix *) data, coordinates[0], coordinates[1]);
+	return go_data_matrix_get_str ((GODataMatrix *) data, coordinates[1], coordinates[0]);
 }
 
 static void
diff --git a/plugins/plot_surface/gog-xyz.c b/plugins/plot_surface/gog-xyz.c
index 818bd60..69cfead 100644
--- a/plugins/plot_surface/gog-xyz.c
+++ b/plugins/plot_surface/gog-xyz.c
@@ -440,7 +440,7 @@ gog_xyz_series_update (GogObject *obj)
 
 	if (GOG_XYZ_PLOT (series->base.plot)->data_xyz) {
 		const double *x_vals, *y_vals, *z_vals = NULL;
-		series->base.num_elements = gog_series_get_xyz_data (GOG_SERIES (series), 
+		series->base.num_elements = gog_series_get_xyz_data (GOG_SERIES (series),
 								     &x_vals, &y_vals, &z_vals);
 	} else {
 		if (series->base.values[2].data != NULL) {
@@ -448,7 +448,7 @@ gog_xyz_series_update (GogObject *obj)
 			old_size.columns = series->columns;
 			mat = series->base.values[2].data;
 			go_data_get_values (mat);
-			go_data_get_matrix_size (mat, &size.columns, &size.rows);
+			go_data_get_matrix_size (mat, &size.rows, &size.columns);
 		}
 		if (series->base.values[0].data != NULL) {
 			vec = series->base.values[0].data;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]