From eddae6af0663243a2677674d501f9a87d55798f5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 30 Jun 2011 15:48:07 +0000 Subject: Remove plotter table global. Pass a redraw context around redraw functions. Knockout could be handled better. Note: untested on most front ends. svn path=/trunk/netsurf/; revision=12543 --- framebuffer/fbtk/text.c | 6 +++--- framebuffer/framebuffer.c | 3 +-- framebuffer/framebuffer.h | 6 ++++-- framebuffer/gui.c | 6 +++++- framebuffer/localhistory.c | 7 ++++++- 5 files changed, 19 insertions(+), 9 deletions(-) (limited to 'framebuffer') diff --git a/framebuffer/fbtk/text.c b/framebuffer/fbtk/text.c index 18b8e9ae5..f50a5ad59 100644 --- a/framebuffer/fbtk/text.c +++ b/framebuffer/fbtk/text.c @@ -29,10 +29,10 @@ #include "utils/log.h" #include "desktop/browser.h" -#include "desktop/plotters.h" #include "framebuffer/gui.h" #include "framebuffer/fbtk.h" +#include "framebuffer/framebuffer.h" #include "framebuffer/image_data.h" #include "widget.h" @@ -109,7 +109,7 @@ fb_redraw_text(fbtk_widget_t *widget, fbtk_callback_info *cbi ) * system for the baseline is to the "higher value * pixel co-ordinate" due to this the + 1 is neccessary. */ - plot.text(bbox.x0 + padding, + fb_plotters.text(bbox.x0 + padding, bbox.y0 + (((fh * 3) + 3)/4) + padding + 1, widget->u.text.text, strlen(widget->u.text.text), @@ -207,7 +207,7 @@ fb_redraw_text_button(fbtk_widget_t *widget, fbtk_callback_info *cbi ) * system for the baseline is to the "higher value * pixel co-ordinate" due to this the + 1 is neccessary. */ - plot.text(bbox.x0 + border, + fb_plotters.text(bbox.x0 + border, bbox.y0 + (((fh * 3) + 3)/4) + border + 1, widget->u.text.text, strlen(widget->u.text.text), diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c index 535f63c85..218a912e7 100644 --- a/framebuffer/framebuffer.c +++ b/framebuffer/framebuffer.c @@ -30,7 +30,6 @@ #include "utils/log.h" #include "desktop/browser.h" -#include "desktop/plotters.h" #include "framebuffer/gui.h" #include "framebuffer/fbtk.h" @@ -342,7 +341,7 @@ framebuffer_plot_clip(const struct rect *clip) return nsfb_plot_set_clip(nsfb, &nsfb_clip); } -struct plotter_table plot = { +const struct plotter_table fb_plotters = { .clip = framebuffer_plot_clip, .arc = framebuffer_plot_arc, .disc = framebuffer_plot_disc, diff --git a/framebuffer/framebuffer.h b/framebuffer/framebuffer.h index a61a746e7..aec6a689f 100644 --- a/framebuffer/framebuffer.h +++ b/framebuffer/framebuffer.h @@ -1,5 +1,7 @@ +#include "desktop/plotters.h" + +extern const struct plotter_table fb_plotters; + nsfb_t *framebuffer_initialise(const char *fename, int width, int height, int bpp); void framebuffer_finalise(void); bool framebuffer_set_cursor(struct bitmap *bm); - - diff --git a/framebuffer/gui.c b/framebuffer/gui.c index 7df3a9173..644a917e0 100644 --- a/framebuffer/gui.c +++ b/framebuffer/gui.c @@ -307,6 +307,10 @@ fb_redraw(fbtk_widget_t *widget, int x; int y; struct rect clip; + struct redraw_context ctx = { + .interactive = true, + .plot = &fb_plotters + }; LOG(("%d,%d to %d,%d", bwidget->redraw_box.x0, @@ -336,7 +340,7 @@ fb_redraw(fbtk_widget_t *widget, browser_window_redraw(bw, (x - bwidget->scrollx) / bw->scale, (y - bwidget->scrolly) / bw->scale, - &clip); + &clip, &ctx); current_redraw_browser = NULL; diff --git a/framebuffer/localhistory.c b/framebuffer/localhistory.c index d8f2b048d..78c1a8d90 100644 --- a/framebuffer/localhistory.c +++ b/framebuffer/localhistory.c @@ -61,6 +61,11 @@ localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) struct gui_localhistory *glh = cbi->context; nsfb_bbox_t rbox; + struct redraw_context ctx = { + .interactive = true, + .plot = &fb_plotters + }; + rbox.x0 = fbtk_get_absx(widget); rbox.y0 = fbtk_get_absy(widget); @@ -76,7 +81,7 @@ localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) glh->scrolly, fbtk_get_width(widget) + glh->scrollx, fbtk_get_height(widget) + glh->scrolly, - 0, 0); + 0, 0, &ctx); nsfb_update(fbtk_get_nsfb(widget), &rbox); -- cgit v1.2.3