In article <[email protected]>,
   Michael Drake <[email protected]> wrote:

> So in riscos/window.c, ro_gui_window_redraw:

>       ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
>       ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;

> Gets the coordinates of the top left of the area of the page/canvas
> which is at the top left of the visible area.

Sorry, that's a mistake. The os_box 'box' and 'clip' are in have the
origin at the screen bottom right. So that should be:

        ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
        ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;

Gets the coordinates of the top left of the area of the page/canvas
in screen coordinates.

        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;

Gets the area of the page/canvas requested for redraw in NetSurf units,
from the origin at the top left of the page/canvas:

    left:   clip_x0
    top:    clip_y0
    right:  clip_x1
    bottom: clip_y1

(i.e. the origin for the clip values is the top left of the document.)

Michael

-- 

Michael Drake (tlsa)                  http://www.netsurf-browser.org/


Reply via email to