goffice r2084 - in trunk: . goffice/graph plugins/plot_barcol
- From: jbrefort svn gnome org
- To: svn-commits-list gnome org
- Subject: goffice r2084 - in trunk: . goffice/graph plugins/plot_barcol
- Date: Mon, 12 May 2008 09:03:47 +0100 (BST)
Author: jbrefort
Date: Mon May 12 08:03:47 2008
New Revision: 2084
URL: http://svn.gnome.org/viewvc/goffice?rev=2084&view=rev
Log:
2008-05-12 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-series-lines.c: use GOPath instead of ArtVpath.
* goffice/graph/gog-series-lines.h: ditto.
* plugins/plot_barcol/gog-barcol.c: (gog_barcol_view_render):
* plugins/plot_barcol/gog-dropbar.c: (barcol_draw_rect),
(gog_dropbar_view_render): ditto.
* plugins/plot_barcol/gog-line.c: (gog_line_view_render): ditto.
* plugins/plot_barcol/gog-minmax.c: (path_move_to),
(path_curve_to), (path_close_path), (gog_minmax_view_render): ditto.
Modified:
trunk/ChangeLog
trunk/goffice/graph/gog-error-bar.c
trunk/goffice/graph/gog-series-lines.c
trunk/goffice/graph/gog-series-lines.h
trunk/plugins/plot_barcol/gog-barcol.c
trunk/plugins/plot_barcol/gog-dropbar.c
trunk/plugins/plot_barcol/gog-line.c
trunk/plugins/plot_barcol/gog-minmax.c
Modified: trunk/goffice/graph/gog-error-bar.c
==============================================================================
--- trunk/goffice/graph/gog-error-bar.c (original)
+++ trunk/goffice/graph/gog-error-bar.c Mon May 12 08:03:47 2008
@@ -700,7 +700,7 @@
path[3].code = ART_LINETO;
n = 4;
} else
- n = 2;
+ n = 2;
path[n].code = ART_MOVETO;
path[n + 1].code = ART_LINETO;
path[n + 2].code = ART_END;
Modified: trunk/goffice/graph/gog-series-lines.c
==============================================================================
--- trunk/goffice/graph/gog-series-lines.c (original)
+++ trunk/goffice/graph/gog-series-lines.c Mon May 12 08:03:47 2008
@@ -74,11 +74,30 @@
gog_series_lines_class_init, NULL,
GOG_STYLED_OBJECT_TYPE)
-void
-gog_series_lines_render (GogSeriesLines *lines, GogRenderer *rend, GogViewAllocation const *bbox, ArtVpath *path, gboolean invert)
+static void
+path_move_to (void *closure, GOPathPoint const *point)
+{
+ gog_renderer_draw_marker (GOG_RENDERER (closure), point->x, point->y);
+}
+
+static void
+path_curve_to (void *closure,
+ GOPathPoint const *point0,
+ GOPathPoint const *point1,
+ GOPathPoint const *point2)
+{
+ gog_renderer_draw_marker (GOG_RENDERER (closure), point2->x, point2->y);
+}
+
+static void
+path_close_path (void *closure)
+{
+}
+
+void gog_series_lines_stroke (GogSeriesLines *lines, GogRenderer *rend,
+ GogViewAllocation const *bbox, GOPath *path, gboolean invert)
{
GogStyle *style = gog_styled_object_get_style (GOG_STYLED_OBJECT (lines));
- int i = 0;
if (invert) {
GOMarker *marker;
@@ -93,12 +112,14 @@
go_marker_set_fill_color (marker, color ^ 0xffffff00);
}
gog_renderer_push_style (rend, style);
- gog_renderer_draw_sharp_path (rend, path);
+ gog_renderer_stroke_serie (rend, path);
if ((style->interesting_fields & GOG_STYLE_MARKER) != 0)
- while (path[i].code != ART_END) {
- gog_renderer_draw_marker (rend, path[i].x, path[i].y);
- i++;
- }
+ go_path_interpret (path, GO_PATH_DIRECTION_FORWARD,
+ path_move_to,
+ path_move_to,
+ path_curve_to,
+ path_close_path,
+ rend);
gog_renderer_pop_style (rend);
if (invert)
g_object_unref (style);
Modified: trunk/goffice/graph/gog-series-lines.h
==============================================================================
--- trunk/goffice/graph/gog-series-lines.h (original)
+++ trunk/goffice/graph/gog-series-lines.h Mon May 12 08:03:47 2008
@@ -24,6 +24,7 @@
#include <goffice/graph/goffice-graph.h>
#include <goffice/graph/gog-styled-object.h>
+#include <goffice/utils/go-path.h>
#include <libart_lgpl/libart.h>
G_BEGIN_DECLS
@@ -33,8 +34,8 @@
#define IS_GOG_SERIES_LINES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_SERIES_LINES_TYPE))
GType gog_series_lines_get_type (void);
-void gog_series_lines_render (GogSeriesLines *lines, GogRenderer *rend,
- GogViewAllocation const *bbox, ArtVpath *path, gboolean invert);
+void gog_series_lines_stroke (GogSeriesLines *lines, GogRenderer *rend,
+ GogViewAllocation const *bbox, GOPath *path, gboolean invert);
void gog_series_lines_use_markers (GogSeriesLines *lines, gboolean use_markers);
G_END_DECLS
Modified: trunk/plugins/plot_barcol/gog-barcol.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-barcol.c (original)
+++ trunk/plugins/plot_barcol/gog-barcol.c Mon May 12 08:03:47 2008
@@ -338,7 +338,7 @@
ErrorBarData **error_data;
GogErrorBar **errors;
GogSeriesLines **lines;
- ArtVpath **paths;
+ GOPath **paths;
GSList *ptr;
unsigned *lengths;
double plus, minus;
@@ -368,7 +368,7 @@
errors = g_alloca (num_series * sizeof (GogErrorBar *));
error_data = g_alloca (num_series * sizeof (ErrorBarData *));
lines = g_alloca (num_series * sizeof (GogSeriesLines *));
- paths = g_alloca (num_series * sizeof (ArtVpath *));
+ paths = g_alloca (num_series * sizeof (GOPath *));
i = 0;
for (ptr = gog_1_5d_model->base.series ; ptr != NULL ; ptr = ptr->next) {
@@ -391,12 +391,7 @@
GOG_OBJECT (series), "Series lines");
lines[i] = GOG_SERIES_LINES (
gog_object_get_child_by_role (GOG_OBJECT (series), role));
- paths[i] = g_new (ArtVpath, lengths[i] * 2 - 1);
- for (j = 0; j < lengths[i] - 1; j++) {
- paths[i][j * 2].code = ART_MOVETO;
- paths[i][j * 2 + 1].code = ART_LINETO;
- }
- paths[i][j * 2].code = ART_END;
+ paths[i] = go_path_new ();
} else
lines[i] = NULL;
i++;
@@ -476,18 +471,22 @@
x = tmp > 0 ? work.x + work.w: work.x;
if (is_vertical) {
if (i > 0) {
- paths[j][i * 2 - 1].x = gog_axis_map_to_view (x_map, work.y);
- paths[j][i * 2 - 1].y = gog_axis_map_to_view (y_map, x);
+ go_path_line_to (paths[j],
+ gog_axis_map_to_view (x_map, work.y),
+ gog_axis_map_to_view (y_map, x));
}
- paths[j][i * 2].x = gog_axis_map_to_view (x_map, work.y + work.h);
- paths[j][i * 2].y = gog_axis_map_to_view (y_map, x);
+ go_path_move_to (paths[j],
+ gog_axis_map_to_view (x_map, work.y + work.h),
+ gog_axis_map_to_view (y_map, x));
} else {
if (i > 0) {
- paths[j][i * 2 - 1].x = gog_axis_map_to_view (x_map, x);
- paths[j][i * 2 - 1].y = gog_axis_map_to_view (y_map, work.y);
+ go_path_line_to (paths[j],
+ gog_axis_map_to_view (x_map, x),
+ gog_axis_map_to_view (y_map, work.y));
}
- paths[j][i * 2].x = gog_axis_map_to_view (x_map, x);
- paths[j][i * 2].y = gog_axis_map_to_view (y_map, work.y + work.h);
+ go_path_move_to (paths[j],
+ gog_axis_map_to_view (x_map, x),
+ gog_axis_map_to_view (y_map, work.y + work.h));
}
}
}
@@ -507,8 +506,8 @@
/* Draw series lines if any */
for (i = 0; i < num_series; i++)
if (lines[i] != NULL) {
- gog_series_lines_render (lines[i], view->renderer, bbox, paths[i], FALSE);
- g_free (paths[i]);
+ gog_series_lines_stroke (lines[i], view->renderer, bbox, paths[i], FALSE);
+ go_path_free (paths[i]);
}
gog_chart_map_free (chart_map);
Modified: trunk/plugins/plot_barcol/gog-dropbar.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-dropbar.c (original)
+++ trunk/plugins/plot_barcol/gog-dropbar.c Mon May 12 08:03:47 2008
@@ -104,50 +104,37 @@
GogAxisMap *y_map,
GogViewAllocation const *rect)
{
- ArtVpath path[6];
- double x0, x1, y0, y1;
+ GogViewAllocation r;
if (flip) {
- x0 = gog_axis_map_to_view (x_map, rect->y);
- x1 = gog_axis_map_to_view (x_map, rect->y + rect->h);
- y0 = gog_axis_map_to_view (y_map, rect->x);
- y1 = gog_axis_map_to_view (y_map, rect->x + rect->w);
- if (fabs (x1 - x0) < .5) {
- x1 += .25;
- x0 -= .25;
- }
- if (fabs (y1 - y0) < .5) {
- y1 += .25;
- y0 -= .25;
+ r.x = gog_axis_map_to_view (x_map, rect->y);
+ r.w = gog_axis_map_to_view (x_map, rect->y + rect->h) - r.x;
+ r.y = gog_axis_map_to_view (y_map, rect->x);
+ r.h = gog_axis_map_to_view (y_map, rect->x + rect->w) - r.y;
+ if (fabs (r.w) < 1.) {
+ r.w += 1.;
+ r.x -= .5;
+ }
+ if (fabs (r.h) < 1.) {
+ r.h += 1.;
+ r.y -= .5;
}
} else {
- x0 = gog_axis_map_to_view (x_map, rect->x);
- x1 = gog_axis_map_to_view (x_map, rect->x + rect->w);
- y0 = gog_axis_map_to_view (y_map, rect->y);
- y1 = gog_axis_map_to_view (y_map, rect->y + rect->h);
- if (fabs (x1 - x0) < .5) {
- x1 += .25;
- x0 -= .25;
- }
- if (fabs (y1 - y0) < .5) {
- y1 += .25;
- y0 -= .25;
+ r.x = gog_axis_map_to_view (x_map, rect->x);
+ r.w = gog_axis_map_to_view (x_map, rect->x + rect->w) - r.x;
+ r.y = gog_axis_map_to_view (y_map, rect->y);
+ r.h = gog_axis_map_to_view (y_map, rect->y + rect->h) - r.y;
+ if (fabs (r.w) < 1.) {
+ r.w += 1.;
+ r.x -= .5;
+ }
+ if (fabs (r.h) < 1.) {
+ r.h += 1.;
+ r.y -= .5;
}
}
- path[0].x = path[3].x = path[4].x = x0;
- path[1].x = path[2].x = x1;
- path[0].y = path[1].y = path[4].y = y0;
- path[2].y = path[3].y = y1;
- path[0].code = ART_MOVETO;
- path[1].code = ART_LINETO;
- path[2].code = ART_LINETO;
- path[3].code = ART_LINETO;
- path[4].code = ART_LINETO;
- path[5].code = ART_END;
-
- gog_renderer_draw_sharp_polygon (rend, path,
- fabs (x1 - x0) < 3. || fabs (y1 - y0) < 3.);
+ gog_renderer_draw_rectangle (rend, &r);
}
static void
@@ -159,7 +146,7 @@
GogAxisMap *x_map, *y_map, *val_map;
GogViewAllocation work;
double *start_vals, *end_vals;
- double x;
+ double x, xmapped;
double step, offset, group_step;
unsigned i, j, k;
unsigned num_elements = gog_1_5d_model->num_elements;
@@ -167,9 +154,10 @@
GSList *ptr;
unsigned n, tmp;
GogStyle *neg_style;
- ArtVpath **path1, **path2;
+ GOPath **path1, **path2;
GogObjectRole const *role = NULL;
GogSeriesLines **lines;
+ gboolean prec_valid;
if (num_elements <= 0 || num_series <= 0)
return;
@@ -188,8 +176,8 @@
/* lines, if any will be rendered after the bars, so we build the paths
and render them at the end */
- path1 = g_alloca (num_series * sizeof (ArtVpath *));
- path2 = g_alloca (num_series * sizeof (ArtVpath *));
+ path1 = g_alloca (num_series * sizeof (GOPath *));
+ path2 = g_alloca (num_series * sizeof (GOPath *));
lines = g_alloca (num_series * sizeof (GogSeriesLines *));
j = 0;
step = 1. - model->overlap_percentage / 100.;
@@ -203,6 +191,7 @@
series = ptr->data;
if (!gog_series_is_valid (GOG_SERIES (series)))
continue;
+ prec_valid = FALSE;
neg_style = gog_style_dup ((GOG_STYLED_OBJECT (series))->style);
neg_style->outline.color ^= 0xffffff00;
neg_style->fill.pattern.back ^= 0xffffff00;
@@ -225,12 +214,10 @@
GOG_OBJECT (series), "Lines");
lines[j] = GOG_SERIES_LINES (
gog_object_get_child_by_role (GOG_OBJECT (series), role));
- path1[j] = g_new (ArtVpath, n + 1);
- path2[j] = g_new (ArtVpath, n + 1);
- path1[j][0].code = path2[j][0].code = ART_MOVETO;
- for (i = 1; i < n; i++)
- path1[j][i].code =path2[j][i].code = ART_LINETO;
- path1[j][n].code = path2[j][n].code = ART_END;
+ path1[j] = go_path_new ();
+ path2[j] = go_path_new ();
+ go_path_set_options (path1[j], GO_PATH_OPTIONS_SHARP);
+ go_path_set_options (path2[j], GO_PATH_OPTIONS_SHARP);
} else
path1[j] = NULL;
k = 0;
@@ -241,34 +228,46 @@
work.h = end_vals[i] - work.y;
val_map = (model->horizontal)? x_map: y_map;
if (!gog_axis_map_finite (val_map, start_vals[i]) ||
- !gog_axis_map_finite (val_map, end_vals[i]))
+ !gog_axis_map_finite (val_map, end_vals[i])) { prec_valid = FALSE;
+ prec_valid = FALSE;
continue;
+ }
if (series->has_lines) {
if (model->horizontal) {
- if (!gog_axis_map_finite (y_map, work.x + work.w / 2.))
+ xmapped = gog_axis_map_to_view (y_map, work.x + work.w / 2.);
+ if (!gog_axis_map_finite (y_map, work.x + work.w / 2.)) {
+ prec_valid = FALSE;
continue;
- path1[j][k].y = path2[j][k].y =
- gog_axis_map_to_view (y_map, work.x + work.w / 2.);
- path1[j][k].x = gog_axis_map_to_view (val_map, start_vals[i]);
- path2[j][k].x = gog_axis_map_to_view (val_map, end_vals[i]);
+ }
+ if (prec_valid) {
+ go_path_line_to (path1[j], gog_axis_map_to_view (val_map, start_vals[i]), xmapped);
+ go_path_line_to (path2[j], gog_axis_map_to_view (val_map, end_vals[i]), xmapped);
+ } else {
+ go_path_move_to (path1[j], gog_axis_map_to_view (val_map, start_vals[i]), xmapped);
+ go_path_move_to (path2[j], gog_axis_map_to_view (val_map, end_vals[i]), xmapped);
+ }
} else {
- if (!gog_axis_map_finite (x_map, work.x + work.w / 2.))
+ xmapped = gog_axis_map_to_view (x_map, work.x + work.w / 2.);
+ if (!gog_axis_map_finite (x_map, work.x + work.w / 2.)) {
+ prec_valid = FALSE;
continue;
- path1[j][k].x = path2[j][k].x =
- gog_axis_map_to_view (x_map, work.x + work.w / 2.);
- path1[j][k].y = gog_axis_map_to_view (val_map, start_vals[i]);
- path2[j][k].y = gog_axis_map_to_view (val_map, end_vals[i]);
+ }
+ if (prec_valid) {
+ go_path_line_to (path1[j], xmapped, gog_axis_map_to_view (val_map, start_vals[i]));
+ go_path_line_to (path2[j], xmapped, gog_axis_map_to_view (val_map, end_vals[i]));
+ } else {
+ go_path_move_to (path1[j], xmapped, gog_axis_map_to_view (val_map, start_vals[i]));
+ go_path_move_to (path2[j], xmapped, gog_axis_map_to_view (val_map, end_vals[i]));
+ }
}
+ prec_valid = TRUE;
}
gog_renderer_push_style (view->renderer, (start_vals[i] <= end_vals[i])?
GOG_STYLED_OBJECT (series)->style: neg_style);
barcol_draw_rect (view->renderer, model->horizontal, x_map, y_map, &work);
barcol_draw_rect (view->renderer, model->horizontal, x_map, y_map, &work);
gog_renderer_pop_style (view->renderer);
- k++;
}
- if (series->has_lines)
- path1[j][k].code = path2[j][k].code = ART_END;
offset += step;
g_object_unref (neg_style);
j++;
@@ -277,11 +276,11 @@
if (path1[j] != NULL) {
gog_renderer_push_style (view->renderer,
gog_styled_object_get_style (GOG_STYLED_OBJECT (lines[j])));
- gog_series_lines_render (lines[j], view->renderer, bbox, path1[j], TRUE);
- gog_series_lines_render (lines[j], view->renderer, bbox, path2[j], FALSE);
+ gog_series_lines_stroke (lines[j], view->renderer, bbox, path1[j], TRUE);
+ gog_series_lines_stroke (lines[j], view->renderer, bbox, path2[j], FALSE);
gog_renderer_pop_style (view->renderer);
- g_free (path2[j]);
- g_free (path1[j]);
+ go_path_free (path2[j]);
+ go_path_free (path1[j]);
}
gog_axis_map_free (x_map);
Modified: trunk/plugins/plot_barcol/gog-line.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-line.c (original)
+++ trunk/plugins/plot_barcol/gog-line.c Mon May 12 08:03:47 2008
@@ -379,7 +379,8 @@
ErrorBarData **error_data;
GogStyle **styles;
unsigned *lengths;
- ArtVpath **path, **drop_paths;
+ ArtVpath **path;
+ GOPath **drop_paths;
GogErrorBar **errors;
GogObjectRole const *role = NULL;
GogSeriesLines **lines;
@@ -457,13 +458,7 @@
GOG_OBJECT (series), "Drop lines");
lines[i] = GOG_SERIES_LINES (
gog_object_get_child_by_role (GOG_OBJECT (series), role));
- drop_paths [i] = g_malloc (sizeof (ArtVpath) * (num_elements * 2 + 1));
- for (j = 0; j < num_elements; j++) {
- drop_paths[i][2 * j].code = ART_MOVETO;
- drop_paths[i][2 * j + 1].code = ART_LINETO;
- drop_paths[i][2 * j + 1].y = drop_lines_y_zero;
- }
- drop_paths[i][2 * j].code = ART_END;
+ drop_paths [i] = go_path_new ();
} else
lines[i] = NULL;
i++;
@@ -565,8 +560,8 @@
break;
}
if (lines[i]) {
- drop_paths[i][2 * j - 2].x = drop_paths[i][2 * j - 1].x = path[i][j].x;
- drop_paths[i][2 * j - 2].y = path[i][j].y;
+ go_path_move_to (drop_paths[i], path[i][j].x, path[i][j].y);
+ go_path_line_to (drop_paths[i], path[i][j].x, drop_lines_y_zero);
}
}
@@ -628,9 +623,9 @@
if (lines[i] != NULL) {
gog_renderer_push_style (view->renderer,
gog_styled_object_get_style (GOG_STYLED_OBJECT (lines[i])));
- gog_series_lines_render (lines[i], view->renderer, bbox, drop_paths[i], FALSE);
+ gog_series_lines_stroke (lines[i], view->renderer, bbox, drop_paths[i], FALSE);
gog_renderer_pop_style (view->renderer);
- g_free (drop_paths[i]);
+ go_path_free (drop_paths[i]);
}
/*Now draw error bars */
Modified: trunk/plugins/plot_barcol/gog-minmax.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-minmax.c (original)
+++ trunk/plugins/plot_barcol/gog-minmax.c Mon May 12 08:03:47 2008
@@ -26,6 +26,7 @@
#include <goffice/graph/gog-view.h>
#include <goffice/graph/gog-renderer.h>
#include <goffice/utils/go-marker.h>
+#include <goffice/utils/go-path.h>
#include <goffice/app/go-plugin.h>
#include <glib/gi18n-lib.h>
@@ -275,6 +276,27 @@
typedef GogPlotView GogMinMaxView;
typedef GogPlotViewClass GogMinMaxViewClass;
+
+static void
+path_move_to (void *closure, GOPathPoint const *point)
+{
+ gog_renderer_draw_marker (GOG_RENDERER (closure), point->x, point->y);
+}
+
+static void
+path_curve_to (void *closure,
+ GOPathPoint const *point0,
+ GOPathPoint const *point1,
+ GOPathPoint const *point2)
+{
+ gog_renderer_draw_marker (GOG_RENDERER (closure), point2->x, point2->y);
+}
+
+static void
+path_close_path (void *closure)
+{
+}
+
static void
gog_minmax_view_render (GogView *view, GogViewAllocation const *bbox)
{
@@ -284,17 +306,18 @@
GogAxisMap *x_map, *y_map;
gboolean is_vertical = ! (model->horizontal);
double *max_vals, *min_vals;
- double x;
+ double x, xmapped, minmapped, maxmapped;
double step, offset;
unsigned i, j;
unsigned num_elements = gog_1_5d_model->num_elements;
unsigned num_series = gog_1_5d_model->num_series;
GSList *ptr;
unsigned n, tmp;
- ArtVpath path[3], *Mpath, *mpath;
+ GOPath *path, *Mpath, *mpath;
GogObjectRole const *role = NULL;
GogSeriesLines *lines;
GogStyle * style;
+ gboolean prec_valid;
if (num_elements <= 0 || num_series <= 0)
return;
@@ -313,9 +336,9 @@
step = 1. / (num_series + model->gap_percentage / 100.);
offset = - step * (num_series - 1) / 2.;
- path[0].code = ART_MOVETO;
- path[1].code = ART_LINETO;
- path[2].code = ART_END;
+
+ path = go_path_new ();
+ go_path_set_options (path, GO_PATH_OPTIONS_SHARP);
for (ptr = gog_1_5d_model->base.series ; ptr != NULL ; ptr = ptr->next) {
series = ptr->data;
@@ -333,31 +356,58 @@
GO_DATA_VECTOR (series->base.values[2].data));
if (n > tmp)
n = tmp;
- Mpath = g_new (ArtVpath, n + 1);
- mpath = g_new (ArtVpath, n + 1);
+ mpath = go_path_new ();
+ Mpath = go_path_new ();
+ go_path_set_options (mpath, GO_PATH_OPTIONS_SHARP);
+ go_path_set_options (Mpath, GO_PATH_OPTIONS_SHARP);
gog_renderer_push_style (view->renderer, style);
j = 0;
+ prec_valid = FALSE;
for (i = 0; i < n; i++) {
x++;
if (is_vertical) {
if (!gog_axis_map_finite (x_map, x) ||
!gog_axis_map_finite (y_map, min_vals[i]) ||
- !gog_axis_map_finite (y_map, max_vals[i]))
+ !gog_axis_map_finite (y_map, max_vals[i])) {
+ prec_valid = FALSE;
continue;
- mpath[j].x = Mpath[j].x = path[0].x = path[1].x = gog_axis_map_to_view (x_map, x);
- mpath[j].y = path[0].y = gog_axis_map_to_view (y_map, min_vals[i]);
- Mpath[j].y = path[1].y = gog_axis_map_to_view (y_map, max_vals[i]);
+ }
+ xmapped = gog_axis_map_to_view (x_map, x);
+ minmapped = gog_axis_map_to_view (y_map, min_vals[i]);
+ maxmapped = gog_axis_map_to_view (y_map, max_vals[i]);
+ go_path_move_to (path, xmapped, minmapped);
+ go_path_line_to (path, xmapped, maxmapped);
+ if (prec_valid) {
+ go_path_line_to (mpath, xmapped, minmapped);
+ go_path_line_to (Mpath, xmapped, maxmapped);
+ } else {
+ go_path_move_to (mpath, xmapped, minmapped);
+ go_path_move_to (Mpath, xmapped, maxmapped);
+ }
} else {
if (!gog_axis_map_finite (y_map, x) ||
!gog_axis_map_finite (x_map, min_vals[i]) ||
- !gog_axis_map_finite (x_map, max_vals[i]))
+ !gog_axis_map_finite (x_map, max_vals[i])) {
+ prec_valid = FALSE;
continue;
- mpath[j].y = Mpath[j].y = path[0].y = path[1].y = gog_axis_map_to_view (y_map, x);
- mpath[j].x = path[0].x = gog_axis_map_to_view (x_map, min_vals[i]);
- Mpath[j].x =path[1].x = gog_axis_map_to_view (x_map, max_vals[i]);
+ }
+ xmapped = gog_axis_map_to_view (y_map, x);
+ minmapped = gog_axis_map_to_view (x_map, min_vals[i]);
+ maxmapped = gog_axis_map_to_view (x_map, max_vals[i]);
+ go_path_move_to (path, minmapped, xmapped);
+ go_path_line_to (path, maxmapped, xmapped);
+ if (prec_valid) {
+ go_path_line_to (mpath, minmapped, xmapped);
+ go_path_line_to (Mpath, maxmapped, xmapped);
+ } else {
+ go_path_move_to (mpath, minmapped, xmapped);
+ go_path_move_to (Mpath, maxmapped, xmapped);
+ }
}
- gog_renderer_draw_sharp_path (view->renderer, path);
+ gog_renderer_stroke_serie (view->renderer, path);
+ go_path_clear (path);
+ prec_valid = TRUE;
j++;
}
if (series->has_lines) {
@@ -366,27 +416,34 @@
GOG_OBJECT (series), "Lines");
lines = GOG_SERIES_LINES (
gog_object_get_child_by_role (GOG_OBJECT (series), role));
- mpath[0].code = Mpath[0].code = ART_MOVETO;
- for (i = 1; i < j; i++)
- mpath[i].code = Mpath[i].code = ART_LINETO;
- mpath[n].code = Mpath[n].code = ART_END;
gog_renderer_push_style (view->renderer,
gog_styled_object_get_style (GOG_STYLED_OBJECT (lines)));
- gog_series_lines_render (lines, view->renderer, bbox, mpath, TRUE);
- gog_series_lines_render (lines, view->renderer, bbox, Mpath, FALSE);
+ gog_series_lines_stroke (lines, view->renderer, bbox, mpath, TRUE);
+ gog_series_lines_stroke (lines, view->renderer, bbox, Mpath, FALSE);
gog_renderer_pop_style (view->renderer);
}
if (gog_style_is_marker_visible (style))
for (i = 0; i < j; i++) {
- gog_renderer_draw_marker (view->renderer, mpath[i].x, mpath[i].y);
- gog_renderer_draw_marker (view->renderer, Mpath[i].x, Mpath[i].y);
+ go_path_interpret (mpath, GO_PATH_DIRECTION_FORWARD,
+ path_move_to,
+ path_move_to,
+ path_curve_to,
+ path_close_path,
+ view->renderer);
+ go_path_interpret (Mpath, GO_PATH_DIRECTION_FORWARD,
+ path_move_to,
+ path_move_to,
+ path_curve_to,
+ path_close_path,
+ view->renderer);
}
gog_renderer_pop_style (view->renderer);
- g_free (Mpath);
- g_free (mpath);
+ go_path_free (Mpath);
+ go_path_free (mpath);
offset += step;
}
+ go_path_free (path);
gog_axis_map_free (x_map);
gog_axis_map_free (y_map);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]