diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-08 22:04:40 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-08 22:04:40 +0000 |
commit | f9ecd56f62f833f21b3475f0d1b59bc8e053a03e (patch) | |
tree | 9874485045ec0fc52fccab99ad545bdefb672203 /framebuffer/framebuffer.c | |
parent | 651228e64d688e1a565ac88e60b736995ba84012 (diff) | |
download | netsurf-f9ecd56f62f833f21b3475f0d1b59bc8e053a03e.tar.gz netsurf-f9ecd56f62f833f21b3475f0d1b59bc8e053a03e.tar.bz2 |
ploter refactor of rectangle handling
svn path=/trunk/netsurf/; revision=8399
Diffstat (limited to 'framebuffer/framebuffer.c')
-rw-r--r-- | framebuffer/framebuffer.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c index e901d545b..41ede39c6 100644 --- a/framebuffer/framebuffer.c +++ b/framebuffer/framebuffer.c @@ -198,16 +198,32 @@ framebuffer_plot_bitmap(int x, int y, } static bool -framebuffer_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style) +framebuffer_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style) { - nsfb_bbox_t rect; - rect.x0 = x0; - rect.y0 = y0; - rect.x1 = x1; - rect.y1 = y1; + nsfb_bbox_t rect; + bool dotted = false; + bool dashed = false; - return nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour); + rect.x0 = x0; + rect.y0 = y0; + rect.x1 = x1; + rect.y1 = y1; + if (style->fill_type != PLOT_OP_TYPE_NONE) { + nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour); + } + + if (style->stroke_type != PLOT_OP_TYPE_NONE) { + if (style->stroke_type == PLOT_OP_TYPE_DOT) + dotted = true; + + if (style->stroke_type == PLOT_OP_TYPE_DASH) + dashed = true; + + nsfb_plot_rectangle(nsfb, &rect, style->stroke_width, style->stroke_colour, dotted, dashed); + } + + return true; } static bool framebuffer_plot_flush(void) @@ -229,10 +245,9 @@ framebuffer_plot_path(const float *p, } struct plotter_table plot = { - .rectangle = nsfb_lplot_rectangle, + .rectangle = framebuffer_plot_rectangle, .line = nsfb_lplot_line, .polygon = nsfb_lplot_polygon, - .fill = framebuffer_plot_fill, .clip = nsfb_lplot_clip, .text = framebuffer_plot_text, .disc = nsfb_lplot_disc, |