Previously, we were simply not drawing line segments where one
endpoint of the segment was outside the bounds of the chart. This had
the problem of omitting a (potentially large) portion of the line
segment that should be visible.
We get the correct result, and more easily, by simply calling
cairo_clip.
cairo_t *cr = acre->cr;
unsigned int d, i;
acre_data_t *data;
cairo_t *cr = acre->cr;
unsigned int d, i;
acre_data_t *data;
+ cairo_rectangle (cr,
+ acre->chart.x, acre->chart.y,
+ acre->chart.width, acre->chart.height);
+ cairo_clip (cr);
+
cairo_set_source_rgb (cr, 0, 0, 0);
_set_transform_to_data_space (acre);
cairo_set_source_rgb (cr, 0, 0, 0);
_set_transform_to_data_space (acre);
acre->colors[color].blue);
data = acre->data[d];
acre->colors[color].blue);
data = acre->data[d];
cairo_new_path (cr);
for (i = 0; i < data->num_points; i++) {
cairo_new_path (cr);
for (i = 0; i < data->num_points; i++) {
- if (data->points[i].x >= acre->x_axis.view_min &&
- data->points[i].x <= acre->x_axis.view_max &&
- data->points[i].y >= acre->y_axis.view_min &&
- data->points[i].y <= acre->y_axis.view_max)
- {
- if (pen_up)
- cairo_move_to (cr,
- data->points[i].x,
- data->points[i].y);
- else
- cairo_line_to (cr,
- data->points[i].x,
- data->points[i].y);
-
- pen_up = false;
- } else {
- pen_up = true;
- }
+ cairo_line_to (cr,
+ data->points[i].x,
+ data->points[i].y);