diff --git a/content/content.c b/content/content.c index df8c6dd78..417f05561 100644 --- a/content/content.c +++ b/content/content.c @@ -57,7 +57,8 @@ struct handler_entry { void (*reformat)(struct content *c, unsigned int width, unsigned int height); void (*destroy)(struct content *c); void (*redraw)(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); void (*add_instance)(struct content *c, struct browser_window *bw, struct content *page, struct box *box, struct object_params *params, void **state); @@ -288,11 +289,13 @@ void content_destroy(struct content *c) */ void content_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { assert(c != 0); if (handler_map[c->type].redraw != 0) - handler_map[c->type].redraw(c, x, y, width, height); + handler_map[c->type].redraw(c, x, y, width, height, + clip_x0, clip_y0, clip_x1, clip_y1); } diff --git a/content/content.h b/content/content.h index a73fff1ef..c8f5cb099 100644 --- a/content/content.h +++ b/content/content.h @@ -138,7 +138,8 @@ void content_revive(struct content *c, unsigned long width, unsigned long height void content_reformat(struct content *c, unsigned long width, unsigned long height); void content_destroy(struct content *c); void content_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); void content_add_user(struct content *c, void (*callback)(content_msg msg, struct content *c, void *p1, void *p2, const char *error), diff --git a/debug/netsurfd.c b/debug/netsurfd.c index d9f14d026..cdc1ee873 100644 --- a/debug/netsurfd.c +++ b/debug/netsurfd.c @@ -81,6 +81,7 @@ void plugin_decode(void *a, void *b, void *c, void *d) } void html_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long x0, long y0, long x1, long y1) { } diff --git a/render/html.h b/render/html.h index cea2a7de8..b4d72f417 100644 --- a/render/html.h +++ b/render/html.h @@ -67,6 +67,7 @@ void html_remove_instance(struct content *c, struct browser_window *bw, struct content *page, struct box *box, struct object_params *params, void **state); void html_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); #endif diff --git a/riscos/gif.c b/riscos/gif.c index 7378abcc0..c44f99f08 100644 --- a/riscos/gif.c +++ b/riscos/gif.c @@ -119,7 +119,8 @@ void nsgif_reformat(struct content *c, unsigned int width, unsigned int height) } void nsgif_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { unsigned int size; osspriteop_trans_tab *table; diff --git a/riscos/gif.h b/riscos/gif.h index b0c516b36..4b59e533e 100644 --- a/riscos/gif.h +++ b/riscos/gif.h @@ -28,5 +28,6 @@ void nsgif_revive(struct content *c, unsigned int width, unsigned int height); void nsgif_reformat(struct content *c, unsigned int width, unsigned int height); void nsgif_destroy(struct content *c); void nsgif_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); #endif diff --git a/riscos/gui.c b/riscos/gui.c index 40113dc0e..6753e3d57 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -39,7 +39,6 @@ static char password_v[] = "D*"; char *NETSURF_DIR; gui_window *window_list = 0; -os_box *clip; int gadget_subtract_x; int gadget_subtract_y; @@ -71,11 +70,6 @@ void gui_remove_gadget(struct gui_gadget* g); static int window_x_units(int scr_units, wimp_window_state* win); static int window_y_units(int scr_units, wimp_window_state* win); -static void ro_gui_window_redraw_box(struct content *content, struct box * box, - signed long x, signed long y, os_box* clip, - unsigned long current_background_color, - signed long gadget_subtract_x, signed long gadget_subtract_y, - bool *select_on); static void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw); static void gui_disable_icon(wimp_w w, wimp_i i); static void gui_enable_icon(wimp_w w, wimp_i i); @@ -357,11 +351,12 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw) while (more) { - clip = &redraw->clip; content_redraw(c, (int) redraw->box.x0 - (int) redraw->xscroll, (int) redraw->box.y1 - (int) redraw->yscroll, - c->width * 2, c->height * 2); + c->width * 2, c->height * 2, + redraw->clip.x0, redraw->clip.y0, + redraw->clip.x1 - 1, redraw->clip.y1 - 1); more = wimp_get_rectangle(redraw); } } diff --git a/riscos/gui.h b/riscos/gui.h index 94b24f84d..9f1f60e39 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -8,7 +8,6 @@ #ifndef _NETSURF_RISCOS_GUI_H_ #define _NETSURF_RISCOS_GUI_H_ -#include "oslib/os.h" #include "oslib/wimp.h" #include "netsurf/desktop/browser.h" #include "netsurf/desktop/netsurf.h" @@ -25,7 +24,6 @@ extern int current_menu_x, current_menu_y, iconbar_menu_height; extern struct gui_gadget *current_gadget; extern const char *HOME_URL; extern gui_window *window_list; -extern os_box *clip; struct gui_window diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c index bd13f0ac4..e2a1a2839 100644 --- a/riscos/htmlredraw.c +++ b/riscos/htmlredraw.c @@ -17,13 +17,15 @@ #include "netsurf/utils/log.h" static void html_redraw_box(struct content *content, struct box * box, - signed long x, signed long y, os_box* clip, + signed long x, signed long y, unsigned long current_background_color, signed long gadget_subtract_x, signed long gadget_subtract_y, - bool *select_on); + bool *select_on, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); void html_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { bool select_on = false; unsigned long background_colour = 0xffffff; @@ -42,8 +44,8 @@ void html_redraw(struct content *c, long x, long y, background_colour = c->data.html.background_colour; } - html_redraw_box(c, box, x, y, clip, background_colour, x, y, - &select_on); + html_redraw_box(c, box, x, y, background_colour, x, y, + &select_on, clip_x0, clip_y0, clip_x1, clip_y1); } @@ -65,19 +67,20 @@ static char select_text_none[] = ""; static char empty_text[] = ""; void html_redraw_box(struct content *content, struct box * box, - signed long x, signed long y, os_box* clip, + signed long x, signed long y, unsigned long current_background_color, signed long gadget_subtract_x, signed long gadget_subtract_y, - bool *select_on) + bool *select_on, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { struct box *c; char *select_text; struct formoption *opt; - if (x + (signed long) (box->x * 2 + box->width * 2) /* right edge */ < clip->x0 || - x + (signed long) (box->x * 2) /* left edge */ > clip->x1 || - y - (signed long) (box->y * 2 + box->height * 2 + 8) /* bottom edge */ > clip->y1 || - y - (signed long) (box->y * 2) /* top edge */ < clip->y0) + if (x + (signed long) (box->x * 2 + box->width * 2) /* right edge */ < clip_x0 || + x + (signed long) (box->x * 2) /* left edge */ > clip_x1 || + y - (signed long) (box->y * 2 + box->height * 2 + 8) /* bottom edge */ > clip_y1 || + y - (signed long) (box->y * 2) /* top edge */ < clip_y0) return; if (box->style != 0 && box->style->background_color != TRANSPARENT) { @@ -88,10 +91,35 @@ void html_redraw_box(struct content *content, struct box * box, } if (box->object) { + long x0 = x + box->x * 2; + long y1 = y - box->y * 2 - 1; + long x1 = x0 + box->width * 2 - 1; + long y0 = y1 - box->height * 2 + 1; + + LOG(("%s %li %li %li %li", box->object->url, x0, y0, x1, y1)); + + if (x0 < clip_x0) x0 = clip_x0; + if (y0 < clip_y0) y0 = clip_y0; + if (clip_x1 < x1) x1 = clip_x1; + if (clip_y1 < y1) y1 = clip_y1; + + os_set_graphics_window(); + os_writec((char) (x0 & 0xff)); os_writec((char) (x0 >> 8)); + os_writec((char) (y0 & 0xff)); os_writec((char) (y0 >> 8)); + os_writec((char) (x1 & 0xff)); os_writec((char) (x1 >> 8)); + os_writec((char) (y1 & 0xff)); os_writec((char) (y1 >> 8)); + content_redraw(box->object, (int) x + (int) box->x * 2, (int) y - (int) box->y * 2, - box->width * 2, box->height * 2); + box->width * 2, box->height * 2, + x0, y0, x1, y1); + + os_set_graphics_window(); + os_writec((char) (clip_x0 & 0xff)); os_writec((char) (clip_x0 >> 8)); + os_writec((char) (clip_y0 & 0xff)); os_writec((char) (clip_y0 >> 8)); + os_writec((char) (clip_x1 & 0xff)); os_writec((char) (clip_x1 >> 8)); + os_writec((char) (clip_y1 & 0xff)); os_writec((char) (clip_y1 >> 8)); } else if (box->gadget) { wimp_icon icon; @@ -312,13 +340,15 @@ void html_redraw_box(struct content *content, struct box * box, for (c = box->children; c != 0; c = c->next) if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT) html_redraw_box(content, c, (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2, clip, current_background_color, - gadget_subtract_x, gadget_subtract_y, select_on); + (int) y - (int) box->y * 2, current_background_color, + gadget_subtract_x, gadget_subtract_y, select_on, + clip_x0, clip_y0, clip_x1, clip_y1); for (c = box->float_children; c != 0; c = c->next_float) html_redraw_box(content, c, (int) x + (int) box->x * 2, - (int) y - (int) box->y * 2, clip, current_background_color, - gadget_subtract_x, gadget_subtract_y, select_on); + (int) y - (int) box->y * 2, current_background_color, + gadget_subtract_x, gadget_subtract_y, select_on, + clip_x0, clip_y0, clip_x1, clip_y1); } /* } else { diff --git a/riscos/jpeg.c b/riscos/jpeg.c index 9a36b4593..842480878 100644 --- a/riscos/jpeg.c +++ b/riscos/jpeg.c @@ -70,7 +70,8 @@ void jpeg_destroy(struct content *c) void jpeg_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { os_factors factors; factors.xmul = width; diff --git a/riscos/jpeg.h b/riscos/jpeg.h index c81cff6b6..092840e73 100644 --- a/riscos/jpeg.h +++ b/riscos/jpeg.h @@ -22,6 +22,7 @@ void jpeg_revive(struct content *c, unsigned int width, unsigned int height); void jpeg_reformat(struct content *c, unsigned int width, unsigned int height); void jpeg_destroy(struct content *c); void jpeg_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); #endif diff --git a/riscos/png.c b/riscos/png.c index dd268ddf5..cd76931c1 100644 --- a/riscos/png.c +++ b/riscos/png.c @@ -301,7 +301,8 @@ void nspng_destroy(struct content *c) void nspng_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height) + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1) { int size; osspriteop_trans_tab *table; diff --git a/riscos/png.h b/riscos/png.h index 2521630b8..b186a3a4b 100644 --- a/riscos/png.h +++ b/riscos/png.h @@ -31,5 +31,6 @@ void nspng_revive(struct content *c, unsigned int width, unsigned int height); void nspng_reformat(struct content *c, unsigned int width, unsigned int height); void nspng_destroy(struct content *c); void nspng_redraw(struct content *c, long x, long y, - unsigned long width, unsigned long height); + unsigned long width, unsigned long height, + long clip_x0, long clip_y0, long clip_x1, long clip_y1); #endif