From 1562dd03cbfe225670820e11c6d85f90b670dc52 Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Sun, 19 Mar 2006 19:03:07 +0000 Subject: [project @ 2006-03-19 19:03:07 by rjek] Implemented unfilled disc plotting and GTK disc plotting svn path=/import/netsurf/; revision=2136 --- desktop/plotters.h | 2 +- gtk/gtk_plotters.c | 10 ++++++++-- render/html_redraw.c | 10 +++++----- riscos/plotters.c | 11 ++++++++--- riscos/print.c | 5 +++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/desktop/plotters.h b/desktop/plotters.h index 1f0e0f375..f191654e5 100644 --- a/desktop/plotters.h +++ b/desktop/plotters.h @@ -31,7 +31,7 @@ struct plotter_table { bool (*clip)(int x0, int y0, int x1, int y1); bool (*text)(int x, int y, struct css_style *style, const char *text, size_t length, colour bg, colour c); - bool (*disc)(int x, int y, int radius, colour c); + bool (*disc)(int x, int y, int radius, colour c, bool filled); bool (*bitmap)(int x, int y, int width, int height, struct bitmap *bitmap, colour bg); bool (*bitmap_tile)(int x, int y, int width, int height, diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c index dd0add940..bfe3bfdc8 100644 --- a/gtk/gtk_plotters.c +++ b/gtk/gtk_plotters.c @@ -30,7 +30,7 @@ static bool nsgtk_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1); static bool nsgtk_plot_text(int x, int y, struct css_style *style, const char *text, size_t length, colour bg, colour c); -static bool nsgtk_plot_disc(int x, int y, int radius, colour colour); +static bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled); static bool nsgtk_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg); static bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height, @@ -129,8 +129,14 @@ bool nsgtk_plot_text(int x, int y, struct css_style *style, } -bool nsgtk_plot_disc(int x, int y, int radius, colour colour) +bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled) { + nsgtk_set_colour(c); + gdk_draw_arc(current_drawable, current_gc, + filled, x - (radius), y - radius, + radius * 2, radius * 2, + 0, + 360 * 64); return true; } diff --git a/render/html_redraw.c b/render/html_redraw.c index fe0c456a6..8468d645d 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -927,15 +927,15 @@ bool html_redraw_checkbox(int x, int y, int width, int height, bool html_redraw_radio(int x, int y, int width, int height, bool selected) { + if (!plot.disc(x + width * 0.5, y + height * 0.5, + width * 0.5 - 1, 0xffffff, TRUE)) + return false; if (!plot.disc(x + width * 0.5, y + height * 0.5, - width * 0.5 - 1, 0x000000)) - return false; - if (!plot.disc(x + width * 0.5, y + height * 0.5, - width * 0.4 - 1, 0xffffff)) + width * 0.5 - 1, 0x000000, FALSE)) return false; if (selected) if (!plot.disc(x + width * 0.5, y + height * 0.5, - width * 0.3 - 1, 0x0000ff)) + width * 0.4 - 1, 0x0000ff, TRUE)) return false; return true; diff --git a/riscos/plotters.c b/riscos/plotters.c index dcce28c38..4f3decb37 100644 --- a/riscos/plotters.c +++ b/riscos/plotters.c @@ -33,7 +33,7 @@ static bool ro_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1); static bool ro_plot_text(int x, int y, struct css_style *style, const char *text, size_t length, colour bg, colour c); -static bool ro_plot_disc(int x, int y, int radius, colour colour); +static bool ro_plot_disc(int x, int y, int radius, colour colour, bool filled); static bool ro_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg); static bool ro_plot_bitmap_tile(int x, int y, int width, int height, @@ -286,7 +286,7 @@ bool ro_plot_text(int x, int y, struct css_style *style, } -bool ro_plot_disc(int x, int y, int radius, colour colour) +bool ro_plot_disc(int x, int y, int radius, colour colour, bool filled) { os_error *error; @@ -304,7 +304,12 @@ bool ro_plot_disc(int x, int y, int radius, colour colour) LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess)); return false; } - error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0); + if (filled) { + error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0); + } else { + error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY, + radius * 2, 0); + } if (error) { LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess)); return false; diff --git a/riscos/print.c b/riscos/print.c index f06a43a46..21b3a511b 100644 --- a/riscos/print.c +++ b/riscos/print.c @@ -97,7 +97,8 @@ static bool print_fonts_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1); static bool print_fonts_plot_text(int x, int y, struct css_style *style, const char *text, size_t length, colour bg, colour c); -static bool print_fonts_plot_disc(int x, int y, int radius, colour colour); +static bool print_fonts_plot_disc(int x, int y, int radius, colour c, + bool filled); static bool print_fonts_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg); static bool print_fonts_plot_bitmap_tile(int x, int y, int width, int height, @@ -808,7 +809,7 @@ bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, colour c) { return true; } bool print_fonts_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1) { return true; } -bool print_fonts_plot_disc(int x, int y, int radius, colour colour) +bool print_fonts_plot_disc(int x, int y, int radius, colour colour, bool filled) { return true; } bool print_fonts_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg) { return true; } -- cgit v1.2.3