From fe7921a387c5a71c8ecba7bb605679b7dab4b86f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 13 Feb 2011 22:25:11 +0000 Subject: Pass clip rect as struct through content_redraw api. Update the front ends to use this. Note only RO build tested. svn path=/trunk/netsurf/; revision=11670 --- render/favicon.c | 14 +++++++++++--- render/html.h | 3 +-- render/html_redraw.c | 33 ++++++++++----------------------- render/textplain.c | 23 +++++++---------------- render/textplain.h | 4 ++-- 5 files changed, 31 insertions(+), 46 deletions(-) (limited to 'render') diff --git a/render/favicon.c b/render/favicon.c index 097c0c8cc..6bc654e29 100644 --- a/render/favicon.c +++ b/render/favicon.c @@ -20,6 +20,7 @@ #include #include "content/content_protected.h" #include "content/hlcache.h" +#include "desktop/shape.h" #include "render/favicon.h" #include "render/html.h" #include "utils/log.h" @@ -247,10 +248,17 @@ nserror favicon_callback(hlcache_handle *icon, } #ifdef WITH_GIF - if (consider_redraw && (c->data.html.favicon != NULL) && (content_get_type(c->data.html.favicon) == CONTENT_GIF)) { + if (consider_redraw && (c->data.html.favicon != NULL) && + (content_get_type(c->data.html.favicon) == + CONTENT_GIF)) { union content_msg_data msg_data; - /* This is needed in order to cause animated GIFs to update their bitmap */ - content_redraw(c->data.html.favicon, 0, 0, -1, -1, 0, 0, 0, 0, 1.0, 0); + struct rect clip; + /* This is needed in order to cause animated GIFs to update + * their bitmap */ + clip.x0 = clip.y0 = 0; + clip.x1 = clip.y1 = 0; + content_redraw(c->data.html.favicon, 0, 0, -1, -1, &clip, + 1.0, 0); content_broadcast(c, CONTENT_MSG_FAVICON_REFRESH, msg_data); } #endif diff --git a/render/html.h b/render/html.h index 9a82b3a03..324e795f0 100644 --- a/render/html.h +++ b/render/html.h @@ -209,8 +209,7 @@ void html_redraw_a_box(struct hlcache_handle *h, struct box *box); /* in render/html_redraw.c */ bool html_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); /* in render/html_interaction.c */ diff --git a/render/html_redraw.c b/render/html_redraw.c index 9e7e6fc6a..d36eb8d91 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -101,10 +101,7 @@ bool html_redraw_debug = false; * \param y coordinate for top-left of redraw * \param width available width (not used for HTML redraw) * \param height available height (not used for HTML redraw) - * \param clip_x0 clip rectangle - * \param clip_y0 clip rectangle - * \param clip_x1 clip rectangle - * \param clip_y1 clip rectangle + * \param clip clip rectangle * \param scale scale for redraw * \param background_colour the background colour * \return true if successful, false otherwise @@ -113,8 +110,7 @@ bool html_redraw_debug = false; */ bool html_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { struct box *box; @@ -145,26 +141,21 @@ bool html_redraw(struct content *c, int x, int y, /* check if the redraw rectangle is completely inside of the select menu */ select_only = form_clip_inside_select_menu(control, scale, - clip_x0, clip_y0, clip_x1, clip_y1); + clip->x0, clip->y0, clip->x1, clip->y1); } if (!select_only) { - struct rect clip; - clip.x0 = clip_x0; - clip.y0 = clip_y0; - clip.x1 = clip_x1; - clip.y1 = clip_y1; /* clear to background colour */ - result = plot.clip(clip_x0, clip_y0, clip_x1, clip_y1); + result = plot.clip(clip->x0, clip->y0, clip->x1, clip->y1); if (c->data.html.background_colour != NS_TRANSPARENT) pstyle_fill_bg.fill_colour = c->data.html.background_colour; - result &= plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, + result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1, &pstyle_fill_bg); - result &= html_redraw_box(box, x, y, clip, + result &= html_redraw_box(box, x, y, *clip, scale, pstyle_fill_bg.fill_colour); } @@ -180,7 +171,7 @@ bool html_redraw(struct content *c, int x, int y, current_redraw_browser->visible_select_menu, x + menu_x, y + menu_y, current_redraw_browser->scale, - clip_x0, clip_y0, clip_x1, clip_y1); + clip->x0, clip->y0, clip->x1, clip->y1); } if (want_knockout) @@ -667,7 +658,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent, if (!content_redraw(box->object, x_scrolled + padding_left, y_scrolled + padding_top, - width, height, r.x0, r.y0, r.x1, r.y1, scale, + width, height, &r, scale, current_background_color)) return false; @@ -2191,9 +2182,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale, if (!content_redraw_tiled( background->background, x, y, ceilf(width * scale), - ceilf(height * scale), - clip.x0, clip.y0, - clip.x1, clip.y1, + ceilf(height * scale), &clip, scale, *background_colour, repeat_x, repeat_y)) return false; @@ -2334,9 +2323,7 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale, return false; if (!content_redraw_tiled(box->background, x, y, ceilf(width * scale), - ceilf(height * scale), - clip.x0, clip.y0, - clip.x1, clip.y1, + ceilf(height * scale), &clip, scale, *background_colour, repeat_x, repeat_y)) return false; diff --git a/render/textplain.c b/render/textplain.c index 547d6a82c..ada008f35 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -537,10 +537,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, * \param y coordinate for top-left of redraw * \param width available width * \param height available height - * \param clip_x0 clip rectangle - * \param clip_y0 clip rectangle - * \param clip_x1 clip rectangle - * \param clip_y1 clip rectangle + * \param clip clip rectangle * \param scale scale for redraw * \param background_colour the background colour * \return true if successful, false otherwise @@ -549,8 +546,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, */ bool textplain_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { struct browser_window *bw = current_redraw_browser; @@ -559,18 +555,12 @@ bool textplain_redraw(struct content *c, int x, int y, unsigned long line_count = c->data.textplain.physical_line_count; float line_height = textplain_line_height(); float scaled_line_height = line_height * scale; - long line0 = clip_y0 / scaled_line_height - 1; - long line1 = clip_y1 / scaled_line_height + 1; + long line0 = clip->y0 / scaled_line_height - 1; + long line1 = clip->y1 / scaled_line_height + 1; struct textplain_line *line = c->data.textplain.physical_line; - struct rect clip; size_t length; plot_style_t *plot_style_highlight; - clip.x0 = clip_x0; - clip.y0 = clip_y0; - clip.x1 = clip_x1; - clip.y1 = clip_y1; - if (line0 < 0) line0 = 0; if (line1 < 0) @@ -582,7 +572,8 @@ bool textplain_redraw(struct content *c, int x, int y, if (line1 < line0) line1 = line0; - if (!plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white)) + if (!plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1, + plot_style_fill_white)) return false; if (!line) @@ -623,7 +614,7 @@ bool textplain_redraw(struct content *c, int x, int y, line[lineno].start + offset, false, &textplain_style, tx, y + (lineno * scaled_line_height), - &clip, line_height, scale, false)) + clip, line_height, scale, false)) return false; if (next_offset >= length) diff --git a/render/textplain.h b/render/textplain.h index c94b18074..284585e35 100644 --- a/render/textplain.h +++ b/render/textplain.h @@ -30,6 +30,7 @@ struct content; struct hlcache_handle; struct http_parameter; +struct rect; struct textplain_line { size_t start; @@ -58,8 +59,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, void textplain_reformat(struct content *c, int width, int height); void textplain_destroy(struct content *c); bool textplain_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); bool textplain_clone(const struct content *old, struct content *new_content); -- cgit v1.2.3