From a15d9876caa4a0b3a31f1c7fafb724be984d95fb Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 1 Feb 2009 23:56:38 +0000 Subject: Document setting up of clip rectangle for NetSurf's core. svn path=/trunk/netsurf/; revision=6348 --- riscos/window.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/riscos/window.c b/riscos/window.c index 46892ad50..9835b5fcc 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -1446,12 +1446,21 @@ void ro_gui_window_redraw(wimp_draw *redraw) while (more) { int clip_x0, clip_y0, clip_x1, clip_y1; + /* OS's redraw request coordinates are in screen coordinates, + * with an origin at the bottom left of the screen. + * Find the coordinate of the top left of the document in terms + * of OS screen coordinates. + * NOTE: OS units are 2 per px. */ ro_plot_origin_x = redraw->box.x0 - redraw->xscroll; ro_plot_origin_y = redraw->box.y1 - redraw->yscroll; - clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; - clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; - clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; - clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; + + /* Convert OS redraw rectangle request coordinates into NetSurf + * coordinates. NetSurf coordinates have origin at top left of + * document and units are in px. */ + clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */ + clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */ + clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */ + clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */ if (ro_gui_current_redraw_gui->option.buffer_everything) ro_gui_buffer_open(redraw); -- cgit v1.2.3