[project @ 2006-03-19 23:56:52 by rjek]

Cairo area clipping, and misc fixups in GTK plotters

svn path=/import/netsurf/; revision=2141
This commit is contained in:
Rob Kendrick 2006-03-19 23:56:52 +00:00
parent 18fea23803
commit f519569474

View File

@ -71,6 +71,9 @@ 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;
cairo_set_line_width(current_cr, line_width);
cairo_rectangle(current_cr, x0, y0, width, height);
cairo_stroke(current_cr);
@ -89,6 +92,7 @@ bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
#ifdef CAIRO_VERSION
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);
@ -146,6 +150,12 @@ bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, colour c)
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);
#endif
cliprect.x = clip_x0;
cliprect.y = clip_y0;
cliprect.width = clip_x1 - clip_x0 + 1;
@ -166,10 +176,16 @@ bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled)
{
nsgtk_set_colour(c);
#ifdef CAIRO_VERSION
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);
if (filled)
cairo_fill(current_cr);
cairo_stroke(current_cr);
#else
gdk_draw_arc(current_drawable, current_gc,