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 --- windows/drawable.c | 6 +++++- windows/localhistory.c | 15 ++++++++++++--- windows/plot.c | 2 +- windows/plot.h | 2 ++ windows/thumbnail.c | 6 +++++- 5 files changed, 25 insertions(+), 6 deletions(-) (limited to 'windows') diff --git a/windows/drawable.c b/windows/drawable.c index 5b2dea967..cdb9cc2b4 100644 --- a/windows/drawable.c +++ b/windows/drawable.c @@ -305,6 +305,10 @@ nsws_drawable_paint(struct gui_window *gw, HWND hwnd) { struct rect clip; PAINTSTRUCT ps; + struct redraw_context ctx = { + .interactive = true, + .plot = &win_plotters + }; BeginPaint(hwnd, &ps); @@ -319,7 +323,7 @@ nsws_drawable_paint(struct gui_window *gw, HWND hwnd) browser_window_redraw(gw->bw, -gw->scrollx / gw->bw->scale, -gw->scrolly / gw->bw->scale, - &clip); + &clip, &ctx); } EndPaint(hwnd, &ps); diff --git a/windows/localhistory.c b/windows/localhistory.c index bd59f4c8a..e7b79cb8e 100644 --- a/windows/localhistory.c +++ b/windows/localhistory.c @@ -78,7 +78,11 @@ static void nsws_localhistory_scroll_check(struct nsws_localhistory *l, struct g static void nsws_localhistory_up(struct nsws_localhistory *l, struct gui_window *gw) { - HDC tmp_hdc; + HDC tmp_hdc; + struct redraw_context ctx = { + .interactive = true, + .plot = &win_plotters + }; LOG(("gui window %p", gw)); @@ -90,7 +94,7 @@ static void nsws_localhistory_up(struct nsws_localhistory *l, struct gui_window tmp_hdc = plot_hdc; plot_hdc = GetDC(l->hwnd); - history_redraw(gw->bw->history); + history_redraw(gw->bw->history, &ctx); ReleaseDC(l->hwnd, plot_hdc); @@ -268,6 +272,11 @@ nsws_localhistory_event_callback(HWND hwnd, UINT msg, case WM_PAINT: { PAINTSTRUCT ps; HDC hdc, tmp_hdc; + struct redraw_context ctx = { + .interactive = true, + .plot = &win_plotters + }; + hdc = BeginPaint(hwnd, &ps); if (gw->bw != NULL) { /* set global HDC for the plotters */ @@ -280,7 +289,7 @@ nsws_localhistory_event_callback(HWND hwnd, UINT msg, gw->localhistory->hscroll + (ps.rcPaint.right - ps.rcPaint.left), gw->localhistory->vscroll + (ps.rcPaint.bottom - ps.rcPaint.top), ps.rcPaint.left, - ps.rcPaint.top); + ps.rcPaint.top, &ctx); plot_hdc = tmp_hdc; diff --git a/windows/plot.c b/windows/plot.c index 491b89bcc..2898fae27 100644 --- a/windows/plot.c +++ b/windows/plot.c @@ -846,7 +846,7 @@ static bool path(const float *p, unsigned int n, colour fill, float width, return true; } -struct plotter_table plot = { +const struct plotter_table win_plotters = { .rectangle = rectangle, .line = line, .polygon = polygon, diff --git a/windows/plot.h b/windows/plot.h index dc0ac0386..044f4be47 100644 --- a/windows/plot.h +++ b/windows/plot.h @@ -18,6 +18,8 @@ #include #include "desktop/gui.h" + +extern const struct plotter_table win_plotters; extern HDC plot_hdc; diff --git a/windows/thumbnail.c b/windows/thumbnail.c index ec44bbb2f..565ee3de1 100644 --- a/windows/thumbnail.c +++ b/windows/thumbnail.c @@ -38,6 +38,10 @@ thumbnail_create(hlcache_handle *content, int width; int height; HDC hdc, bufferdc, minidc; + struct redraw_context ctx = { + .interactive = false, + .plot = &win_plotters + }; struct bitmap *fsbitmap; @@ -67,7 +71,7 @@ thumbnail_create(hlcache_handle *content, hdc = plot_hdc; plot_hdc = bufferdc; - thumbnail_redraw(content, width, height); + thumbnail_redraw(content, width, height, &ctx); plot_hdc = hdc; /* scale bitmap bufferbm into minibm */ -- cgit v1.2.3