From 94e7b44ebc1710eed0f870428ddb5bfcd85858fa Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Feb 2011 22:05:39 +0000 Subject: Pass clip rect to clip plotters as struct. Simplify clip rect handling in debug window code. Pass clip rect to select menu as struct. svn path=/trunk/netsurf/; revision=11683 --- atari/browser.c | 20 +++++++++++++------- atari/plot.c | 4 ++-- atari/plot.h | 4 +++- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'atari') diff --git a/atari/browser.c b/atari/browser.c index 2c667a5d7..8d2f79ca5 100755 --- a/atari/browser.c +++ b/atari/browser.c @@ -873,9 +873,7 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff ) clip.x1 = b->redraw.area.x1 + b->scroll.current.x; clip.y1 = b->redraw.area.y1 + b->scroll.current.y; /* must clear the surface: */ - plot.clip( b->redraw.area.x0, b->redraw.area.y0, - b->redraw.area.x1, b->redraw.area.y1 - ); + plot.clip(&clip); plot.rectangle( b->redraw.area.x0, b->redraw.area.y0, b->redraw.area.x1, @@ -911,16 +909,24 @@ void browser_redraw_caret( struct gui_window * gw, GRECT * area ) caret.g_x -= gw->browser->scroll.current.x; caret.g_y -= gw->browser->scroll.current.y; struct s_clipping oldclip; + struct rect old_clip; + struct rect clip; + clip.x0 = caret.g_x - 1; + clip.y0 = caret.g_y - 1; + clip.x1 = caret.g_x + caret.g_w + 1; + clip.y1 = caret.g_y + caret.g_h + 1; plot_get_clip( &oldclip ); /* clip to cursor: */ - plot_clip( caret.g_x-1, caret.g_y -1, - caret.g_x + caret.g_w + 1, caret.g_y + caret.g_h + 1 - ); + plot_clip( &clip ); plot_rectangle( caret.g_x, caret.g_y, caret.g_x+caret.g_w, caret.g_y+caret.g_h, plot_style_caret ); /* restore clip area: */ - plot_clip( oldclip.x0, oldclip.y0, oldclip.x1,oldclip.y1); + old_clip.x0 = old_clip.x0; + old_clip.y0 = old_clip.y0; + old_clip.x1 = old_clip.x1; + old_clip.y1 = old_clip.y1; + plot_clip( &old_clip ); b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x; b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y; b->caret.current.g_w = caret.g_w; diff --git a/atari/plot.c b/atari/plot.c index 2bfe37923..2d45f1f63 100755 --- a/atari/plot.c +++ b/atari/plot.c @@ -110,9 +110,9 @@ static bool plot_polygon(const int *p, unsigned int n, return ( true ); } -bool plot_clip(int x0, int y0, int x1, int y1) +bool plot_clip(const struct rect *clip) { - plotter->clip( plotter, x0, y0, x1, y1 ); + plotter->clip( plotter, clip->x0, clip->y0, clip->x1, clip->y1 ); return ( true ); } diff --git a/atari/plot.h b/atari/plot.h index ed86041e5..a11b6d576 100755 --- a/atari/plot.h +++ b/atari/plot.h @@ -22,11 +22,13 @@ #include "desktop/plotters.h" #include "atari/plot/plotter.h" +struct rect; + int atari_plotter_init( char*, char * ); int atari_plotter_finalise( void ); bool plot_get_clip(struct s_clipping * out); -bool plot_clip(int x0, int y0, int x1, int y1); +bool plot_clip(const struct rect *clip); bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t *style ); #endif -- cgit v1.2.3