summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-06-10 11:15:20 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2017-06-10 11:15:20 +0100
commit368b03bffb8dcf2dc2a306f29756ca882b3fee51 (patch)
treed8bc4572880284297eed622c3c9bed0095191841
parent283d921f346d44bd8d78fdac6a36b5a8516ca722 (diff)
downloadnetsurf-368b03bffb8dcf2dc2a306f29756ca882b3fee51.tar.gz
netsurf-368b03bffb8dcf2dc2a306f29756ca882b3fee51.tar.bz2
Local history: Pass clip rectangle around as struct.
-rw-r--r--desktop/browser_history.c47
-rw-r--r--desktop/browser_history.h15
-rw-r--r--desktop/local_history.c2
-rwxr-xr-xfrontends/amiga/history_local.c9
-rw-r--r--frontends/framebuffer/localhistory.c12
-rw-r--r--frontends/windows/local_history.c6
6 files changed, 40 insertions, 51 deletions
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index 58c472fd2..50017bffb 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -279,27 +279,23 @@ static plot_font_style_t pfstyle_node_sel = {
* Recursively redraw a history_entry.
*
* \param history history containing the entry
- * \param entry entry to render
- * \param x0 area top left x coordinate
- * \param y0 area top left y coordinate
- * \param x1 area bottom right x coordinate
- * \param y1 area bottom right y coordinate
- * \param x window x offset
- * \param y window y offset
- * \param ctx current redraw context
+ * \param entry entry to render
+ * \param clip redraw area
+ * \param x window x offset
+ * \param y window y offset
+ * \param ctx current redraw context
*/
static bool
browser_window_history__redraw_entry(struct history *history,
- struct history_entry *entry,
- int x0, int y0, int x1, int y1,
+ struct history_entry *entry, struct rect *clip,
int x, int y, const struct redraw_context *ctx)
{
size_t char_offset;
int actual_x;
struct history_entry *child;
int tailsize = 5;
- int xoffset = x - x0;
- int yoffset = y - y0;
+ int xoffset = x - clip->x0;
+ int yoffset = y - clip->y0;
plot_style_t *pstyle;
plot_font_style_t *pfstyle;
@@ -316,10 +312,10 @@ browser_window_history__redraw_entry(struct history *history,
}
/* setup clip area */
- rect.x0 = x0 + xoffset;
- rect.y0 = y0 + yoffset;
- rect.x1 = x1 + xoffset;
- rect.y1 = y1 + yoffset;
+ rect.x0 = clip->x0 + xoffset;
+ rect.y0 = clip->y0 + yoffset;
+ rect.x1 = clip->x1 + xoffset;
+ rect.y1 = clip->y1 + yoffset;
res = ctx->plot->clip(ctx, &rect);
if (res != NSERROR_OK) {
return false;
@@ -395,7 +391,7 @@ browser_window_history__redraw_entry(struct history *history,
}
if (!browser_window_history__redraw_entry(history, child,
- x0, y0, x1, y1, x, y, ctx)) {
+ clip, x, y, ctx)) {
return false;
}
}
@@ -778,16 +774,10 @@ void browser_window_history_size(struct browser_window *bw,
/* exported interface documented in desktop/browser_history.h */
bool browser_window_history_redraw_rectangle(struct browser_window *bw,
- int x0, int y0, int x1, int y1,
- int x, int y, const struct redraw_context *ctx)
+ struct rect *clip, int x, int y,
+ const struct redraw_context *ctx)
{
struct history *history;
- struct rect rect = {
- .x0 = x0,
- .y0 = y0,
- .x1 = x1,
- .y1 = y1,
- };
assert(bw != NULL);
history = bw->history;
@@ -795,10 +785,11 @@ bool browser_window_history_redraw_rectangle(struct browser_window *bw,
if (!history->start)
return true;
- ctx->plot->rectangle(ctx, &pstyle_bg, &rect);
+ ctx->plot->rectangle(ctx, &pstyle_bg, clip);
- return browser_window_history__redraw_entry(history, history->start,
- x0, y0, x1, y1, x, y, ctx);
+ return browser_window_history__redraw_entry(
+ history, history->start,
+ clip, x, y, ctx);
}
diff --git a/desktop/browser_history.h b/desktop/browser_history.h
index 831eeeeb4..ec625df59 100644
--- a/desktop/browser_history.h
+++ b/desktop/browser_history.h
@@ -129,17 +129,14 @@ void browser_window_history_size(struct browser_window *bw,
/**
* Redraw part of a history area.
*
- * \param bw browser window with history object.
- * \param x0 left X co-ordinate of redraw area
- * \param y0 top Y co-ordinate of redraw area
- * \param x1 right X co-ordinate of redraw area
- * \param y1 lower Y co-ordinate of redraw area
- * \param x start X co-ordinate on plot canvas
- * \param y start Y co-ordinate on plot canvas
- * \param ctx current redraw context
+ * \param bw browser window with history object.
+ * \param clip redraw area
+ * \param x start X co-ordinate on plot canvas
+ * \param y start Y co-ordinate on plot canvas
+ * \param ctx current redraw context
*/
bool browser_window_history_redraw_rectangle(struct browser_window *bw,
- int x0, int y0, int x1, int y1, int x, int y,
+ struct rect *clip, int x, int y,
const struct redraw_context *ctx);
/**
diff --git a/desktop/local_history.c b/desktop/local_history.c
index 6d07c8ad7..d7022d7e0 100644
--- a/desktop/local_history.c
+++ b/desktop/local_history.c
@@ -77,7 +77,7 @@ local_history_redraw(struct local_history_session *session,
{
if (session->bw != NULL) {
browser_window_history_redraw_rectangle(session->bw,
- clip->x0, clip->y0, clip->x1, clip->y1, x, y, ctx);
+ clip, x, y, ctx);
}
return NSERROR_OK;
}
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 368557dd6..8d1f4ac4a 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -84,6 +84,7 @@ static void ami_history_redraw(struct history_window *hw)
{
struct IBox *bbox;
ULONG xs,ys;
+ struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
@@ -102,9 +103,11 @@ static void ami_history_redraw(struct history_window *hw)
SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
*/
-
- browser_window_history_redraw_rectangle(hw->gw->bw, xs, ys,
- bbox->Width + xs, bbox->Height + ys, 0, 0, &ctx);
+ clip.x0 = xs;
+ clip.y0 = ys;
+ clip.x1 = bbox->Width + xs;
+ clip.y1 = bbox->Height + ys;
+ browser_window_history_redraw_rectangle(hw->gw->bw, &clip, 0, 0, &ctx);
ami_clearclipreg(hw->gg);
ami_history_update_extent(hw);
diff --git a/frontends/framebuffer/localhistory.c b/frontends/framebuffer/localhistory.c
index 3192f0747..b91c9470b 100644
--- a/frontends/framebuffer/localhistory.c
+++ b/frontends/framebuffer/localhistory.c
@@ -36,6 +36,7 @@ localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
struct gui_localhistory *glh = cbi->context;
nsfb_bbox_t rbox;
+ struct rect clip;
struct redraw_context ctx = {
.interactive = true,
@@ -53,12 +54,13 @@ localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
nsfb_plot_rectangle_fill(fbtk_get_nsfb(widget), &rbox, 0xffffffff);
+ clip.x0 = glh->scrollx;
+ clip.y0 = glh->scrolly;
+ clip.x1 = fbtk_get_width(widget) + glh->scrollx;
+ clip.y0 = fbtk_get_height(widget) + glh->scrolly;
+
browser_window_history_redraw_rectangle(glh->bw,
- glh->scrollx,
- glh->scrolly,
- fbtk_get_width(widget) + glh->scrollx,
- fbtk_get_height(widget) + glh->scrolly,
- 0, 0, &ctx);
+ &clip, 0, 0, &ctx);
nsfb_update(fbtk_get_nsfb(widget), &rbox);
diff --git a/frontends/windows/local_history.c b/frontends/windows/local_history.c
index f4474236e..205ebfe94 100644
--- a/frontends/windows/local_history.c
+++ b/frontends/windows/local_history.c
@@ -111,11 +111,7 @@ nsw32_local_history_draw(struct nsw32_corewindow *nsw32_cw,
lhw = (struct nsw32_local_history_window *)nsw32_cw;
- local_history_redraw(lhw->session,
- r->x0 - scrollx,
- r->y0 - scrolly,
- r,
- &ctx);
+ local_history_redraw(lhw->session, -scrollx, -scrolly, r, &ctx);
return NSERROR_OK;
}