From dd6bb6434755d34519dc4c8341a22fc45eb7aca5 Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Mon, 20 Mar 2006 10:56:54 +0000 Subject: [project @ 2006-03-20 10:56:54 by rjek] Source cleanup and true/false to TRUE/FALSE conversion for GTK plotters svn path=/import/netsurf/; revision=2142 --- gtk/gtk_plotters.c | 92 +++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'gtk/gtk_plotters.c') diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c index 607a80e05..353b4ecc3 100644 --- a/gtk/gtk_plotters.c +++ b/gtk/gtk_plotters.c @@ -71,12 +71,12 @@ bool nsgtk_plot_rectangle(int x0, int y0, int width, int height, { nsgtk_set_colour(c); #ifdef CAIRO_VERSION - if (line_width == 0) - line_width = 1; + if (line_width == 0) + line_width = 1; - cairo_set_line_width(current_cr, line_width); - cairo_rectangle(current_cr, x0, y0, width, height); - cairo_stroke(current_cr); + cairo_set_line_width(current_cr, line_width); + cairo_rectangle(current_cr, x0, y0, width, height); + cairo_stroke(current_cr); #else gdk_draw_rectangle(current_drawable, current_gc, FALSE, x0, y0, width, height); @@ -90,18 +90,18 @@ bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width, { nsgtk_set_colour(c); #ifdef CAIRO_VERSION - if (width == 0) - width = 1; + if (width == 0) + width = 1; - cairo_set_line_width(current_cr, width); - cairo_move_to(current_cr, x0, y0); - cairo_line_to(current_cr, x1, y1); - cairo_stroke(current_cr); + cairo_set_line_width(current_cr, width); + cairo_move_to(current_cr, x0, y0); + cairo_line_to(current_cr, x1, y1); + cairo_stroke(current_cr); #else gdk_draw_line(current_drawable, current_gc, x0, y0, x1, y1); #endif - return true; + return true; } @@ -109,16 +109,16 @@ bool nsgtk_plot_polygon(int *p, unsigned int n, colour fill) { unsigned int i; #ifdef CAIRO_VERSION - nsgtk_set_colour(fill); - cairo_set_line_width(current_cr, 0); - cairo_move_to(current_cr, p[0], p[1]); - for (i = 1; i != n; i++) { - cairo_line_to(current_cr, p[i * 2], p[i * 2 + 1]); - } - cairo_fill(current_cr); - cairo_stroke(current_cr); + nsgtk_set_colour(fill); + cairo_set_line_width(current_cr, 0); + cairo_move_to(current_cr, p[0], p[1]); + for (i = 1; i != n; i++) { + cairo_line_to(current_cr, p[i * 2], p[i * 2 + 1]); + } + cairo_fill(current_cr); + cairo_stroke(current_cr); #else - GdkPoint q[n]; + GdkPoint q[n]; for (i = 0; i != n; i++) { q[i].x = p[i * 2]; q[i].y = p[i * 2 + 1]; @@ -135,15 +135,15 @@ bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, colour c) { nsgtk_set_colour(c); #ifdef CAIRO_VERSION - cairo_set_line_width(current_cr, 0); - cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0); - cairo_fill(current_cr); - cairo_stroke(current_cr); + cairo_set_line_width(current_cr, 0); + cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0); + cairo_fill(current_cr); + cairo_stroke(current_cr); #else gdk_draw_rectangle(current_drawable, current_gc, TRUE, x0, y0, x1 - x0, y1 - y0); #endif - return true; + return true; } @@ -151,12 +151,12 @@ bool nsgtk_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1) { #ifdef CAIRO_VERSION - cairo_reset_clip(current_cr); - cairo_rectangle(current_cr, clip_x0 - 1, clip_y0 - 1, - clip_x1 - clip_x0 + 1, clip_y1 - clip_y0 + 1); - cairo_clip(current_cr); + cairo_reset_clip(current_cr); + cairo_rectangle(current_cr, clip_x0 - 1, clip_y0 - 1, + clip_x1 - clip_x0 + 1, clip_y1 - clip_y0 + 1); + cairo_clip(current_cr); #endif - cliprect.x = clip_x0; + cliprect.x = clip_x0; cliprect.y = clip_y0; cliprect.width = clip_x1 - clip_x0 + 1; cliprect.height = clip_y1 - clip_y0 + 1; @@ -174,25 +174,25 @@ bool nsgtk_plot_text(int x, int y, struct css_style *style, bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled) { - nsgtk_set_colour(c); + nsgtk_set_colour(c); #ifdef CAIRO_VERSION - if (filled) - cairo_set_line_width(current_cr, 0); - else - cairo_set_line_width(current_cr, 1); + if (filled) + cairo_set_line_width(current_cr, 0); + else + cairo_set_line_width(current_cr, 1); - cairo_arc(current_cr, x, y, radius, 0, M_PI * 2); + cairo_arc(current_cr, x, y, radius, 0, M_PI * 2); - if (filled) - cairo_fill(current_cr); + if (filled) + cairo_fill(current_cr); - cairo_stroke(current_cr); + cairo_stroke(current_cr); #else - gdk_draw_arc(current_drawable, current_gc, - filled, x - (radius), y - radius, - radius * 2, radius * 2, - 0, - 360 * 64); + gdk_draw_arc(current_drawable, current_gc, + filled ? TRUE : FALSE, x - (radius), y - radius, + radius * 2, radius * 2, + 0, + 360 * 64); #endif return true; } @@ -303,6 +303,6 @@ void nsgtk_set_colour(colour c) &colour); gdk_gc_set_foreground(current_gc, &colour); #ifdef CAIRO_VERSION - gdk_cairo_set_source_color(current_cr, &colour); + gdk_cairo_set_source_color(current_cr, &colour); #endif } -- cgit v1.2.3