From f9bf87c4ef6bd3cdebfd54c6edee77f4185de692 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 25 Jan 2009 20:03:21 +1100 Subject: [PATCH] Put frame and ticks into its own function as well. --- acre.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/acre.c b/acre.c index 6e75ab7..5735695 100644 --- a/acre.c +++ b/acre.c @@ -152,6 +152,8 @@ _draw_title_and_labels (acre_t *acre) int y_axis_width, y_axis_height; PangoRectangle new_chart; + cairo_save (cr); + acre_font = pango_font_description_new (); pango_font_description_set_family (acre_font, ACRE_FONT_FAMILY); pango_font_description_set_absolute_size (acre_font, @@ -233,6 +235,25 @@ _draw_title_and_labels (acre_t *acre) acre->chart.y + acre->chart.height + ACRE_FONT_SIZE + ACRE_PAD); pango_cairo_show_layout (cr, x_axis_layout); + + cairo_restore (cr); +} + +static void +_draw_frame_and_ticks (acre_t *acre) +{ + cairo_t *cr = acre->cr; + + cairo_save (cr); + + cairo_rectangle (cr, + acre->chart.x - 0.5, acre->chart.y - 0.5, + acre->chart.width + 1.0, acre->chart.height + 1.0); + cairo_set_line_width (cr, 1.0); + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_stroke (cr); + + cairo_restore (cr); } /* Draw the plot to the given cairo context within a user-space @@ -255,11 +276,7 @@ acre_draw (acre_t *acre, cairo_t *cr, int width, int height) _draw_title_and_labels (acre); - cairo_rectangle (cr, - acre->chart.x - 0.5, acre->chart.y - 0.5, - acre->chart.width + 1.0, acre->chart.height + 1.0); - cairo_set_line_width (cr, 1.0); - cairo_stroke (cr); + _draw_frame_and_ticks (acre); } /* Create a new dataset---a collection of (x, y) datapoints. A single -- 2.43.0