Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/ce23f500d13d6f32ed702386caaef7db19c112a2
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/ce23f500d13d6f32ed702386caaef7db19c112a2
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/ce23f500d13d6f32ed702386caaef7db19c112a2

The branch, master has been updated
       via  ce23f500d13d6f32ed702386caaef7db19c112a2 (commit)
       via  6f659da675917f6cfa651631ff49a244973f02df (commit)
      from  93b68a9a4869cac3ec4927b35f29cac32e106832 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=ce23f500d13d6f32ed702386caaef7db19c112a2
commit ce23f500d13d6f32ed702386caaef7db19c112a2
Author: Michael Drake <t...@netsurf-browser.org>
Commit: Michael Drake <t...@netsurf-browser.org>

    RISC OS: Unify both browser window redraw call paths.

diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 2466236..28ef06f 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -1639,6 +1639,57 @@ static void ro_gui_window_close(wimp_w w)
        }
 }
 
+/**
+ * Wrapper for calls to browser_window_redraw for a wimp_draw rectangle.
+ *
+ * \param[in] gui_win     Window to render.
+ * \param[in] wimp_rect   The area of gui_win to render into.
+ * \param[in] use_buffer  Whether to use buffered rendering.
+ */
+static inline void ro_gui_window__redraw_rect(
+               const struct gui_window *gui_win,
+               const wimp_draw *wimp_rect,
+               bool use_buffer)
+{
+       struct redraw_context ctx = {
+               .interactive = true,
+               .background_images = true,
+               .plot = &ro_plotters
+       };
+       struct rect clip;
+
+       /* 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 = wimp_rect->box.x0 - wimp_rect->xscroll;
+       ro_plot_origin_y = wimp_rect->box.y1 - wimp_rect->yscroll;
+
+       /* Adjust clip rect for origin. */
+       ro_plot_clip_rect.x0 = wimp_rect->clip.x0 - ro_plot_origin_x;
+       ro_plot_clip_rect.y0 = ro_plot_origin_y - wimp_rect->clip.y0;
+       ro_plot_clip_rect.x1 = wimp_rect->clip.x1 - ro_plot_origin_x;
+       ro_plot_clip_rect.y1 = ro_plot_origin_y - wimp_rect->clip.y1;
+
+       /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
+       clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
+       clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
+       clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
+
+       if (use_buffer) {
+               ro_gui_buffer_open(wimp_rect);
+       }
+
+       browser_window_redraw(gui_win->bw, 0, 0, &clip, &ctx);
+
+       if (use_buffer) {
+               ro_gui_buffer_close();
+       }
+}
 
 /**
  * Handle a Redraw_Window_Request for a browser window.
@@ -1650,11 +1701,6 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
        osbool more;
        struct gui_window *g;
        os_error *error;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &ro_plotters
-       };
 
        g = (struct gui_window *)ro_gui_wimp_event_get_user_data(redraw->w);
 
@@ -1675,37 +1721,8 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
                return;
        }
        while (more) {
-               struct rect clip;
-
-               /* 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;
-
-               /* Adjust clip rect for origin. */
-               ro_plot_clip_rect.x0 = redraw->clip.x0 - ro_plot_origin_x;
-               ro_plot_clip_rect.y0 = ro_plot_origin_y - redraw->clip.y0;
-               ro_plot_clip_rect.x1 = redraw->clip.x1 - ro_plot_origin_x;
-               ro_plot_clip_rect.y1 = ro_plot_origin_y - redraw->clip.y1;
-
-               /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
-               clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
-               clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
-               clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
-
-               if (ro_gui_current_redraw_gui->option.buffer_everything)
-                       ro_gui_buffer_open(redraw);
-
-               browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
-
-               if (ro_gui_current_redraw_gui->option.buffer_everything)
-                       ro_gui_buffer_close();
+               ro_gui_window__redraw_rect(g, redraw,
+                       ro_gui_current_redraw_gui->option.buffer_everything);
 
                /* Check to see if there are more rectangles to draw and
                 * get next one */
@@ -4676,22 +4693,15 @@ void ro_gui_window_redraw_all(void)
        }
 }
 
-
 /* exported interface documented in riscos/window.h */
 void ro_gui_window_update_boxes(void)
 {
        osbool more;
        bool use_buffer;
        wimp_draw update;
-       struct rect clip;
        os_error *error;
        struct update_box *cur;
        struct gui_window *g;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &ro_plotters
-       };
 
        for (cur = pending_updates; cur != NULL; cur = cur->next) {
                g = cur->g;
@@ -4717,31 +4727,8 @@ void ro_gui_window_update_boxes(void)
                /* Set the current redraw gui_window to get options from */
                ro_gui_current_redraw_gui = g;
 
-               ro_plot_origin_x = update.box.x0 - update.xscroll;
-               ro_plot_origin_y = update.box.y1 - update.yscroll;
-
                while (more) {
-                       /* Adjust clip rect for origin. */
-                       ro_plot_clip_rect.x0 = update.clip.x0 - 
ro_plot_origin_x;
-                       ro_plot_clip_rect.y0 = ro_plot_origin_y - 
update.clip.y0;
-                       ro_plot_clip_rect.x1 = update.clip.x1 - 
ro_plot_origin_x;
-                       ro_plot_clip_rect.y1 = ro_plot_origin_y - 
update.clip.y1;
-
-                       /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
-                       clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
-                       clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
-                       clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
-
-                       if (use_buffer)
-                               ro_gui_buffer_open(&update);
-
-                       browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
-
-                       if (use_buffer)
-                               ro_gui_buffer_close();
+                       ro_gui_window__redraw_rect(g, &update, use_buffer);
 
                        error = xwimp_get_rectangle(&update, &more);
                        /* RISC OS 3.7 returns an error here if enough buffer


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=6f659da675917f6cfa651631ff49a244973f02df
commit 6f659da675917f6cfa651631ff49a244973f02df
Author: Michael Drake <t...@netsurf-browser.org>
Commit: Michael Drake <t...@netsurf-browser.org>

    RISC OS: Constify redraw region through buffer API.

diff --git a/frontends/riscos/buffer.c b/frontends/riscos/buffer.c
index c63a270..9c8f8fe 100644
--- a/frontends/riscos/buffer.c
+++ b/frontends/riscos/buffer.c
@@ -81,7 +81,7 @@ static os_mode mode;
  *
  * \param redraw the current WIMP redraw area to buffer
  */
-void ro_gui_buffer_open(wimp_draw *redraw)
+void ro_gui_buffer_open(const wimp_draw *redraw)
 {
        int size;
        int total_size;
diff --git a/frontends/riscos/buffer.h b/frontends/riscos/buffer.h
index a683c32..7de0ecd 100644
--- a/frontends/riscos/buffer.h
+++ b/frontends/riscos/buffer.h
@@ -25,7 +25,7 @@
 
 #include "oslib/wimp.h"
 
-void ro_gui_buffer_open(wimp_draw *redraw);
+void ro_gui_buffer_open(const wimp_draw *redraw);
 void ro_gui_buffer_close(void);
 
 #endif


-----------------------------------------------------------------------

Summary of changes:
 frontends/riscos/buffer.c |    2 +-
 frontends/riscos/buffer.h |    2 +-
 frontends/riscos/window.c |  121 ++++++++++++++++++++-------------------------
 3 files changed, 56 insertions(+), 69 deletions(-)

diff --git a/frontends/riscos/buffer.c b/frontends/riscos/buffer.c
index c63a270..9c8f8fe 100644
--- a/frontends/riscos/buffer.c
+++ b/frontends/riscos/buffer.c
@@ -81,7 +81,7 @@ static os_mode mode;
  *
  * \param redraw the current WIMP redraw area to buffer
  */
-void ro_gui_buffer_open(wimp_draw *redraw)
+void ro_gui_buffer_open(const wimp_draw *redraw)
 {
        int size;
        int total_size;
diff --git a/frontends/riscos/buffer.h b/frontends/riscos/buffer.h
index a683c32..7de0ecd 100644
--- a/frontends/riscos/buffer.h
+++ b/frontends/riscos/buffer.h
@@ -25,7 +25,7 @@
 
 #include "oslib/wimp.h"
 
-void ro_gui_buffer_open(wimp_draw *redraw);
+void ro_gui_buffer_open(const wimp_draw *redraw);
 void ro_gui_buffer_close(void);
 
 #endif
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 2466236..28ef06f 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -1639,6 +1639,57 @@ static void ro_gui_window_close(wimp_w w)
        }
 }
 
+/**
+ * Wrapper for calls to browser_window_redraw for a wimp_draw rectangle.
+ *
+ * \param[in] gui_win     Window to render.
+ * \param[in] wimp_rect   The area of gui_win to render into.
+ * \param[in] use_buffer  Whether to use buffered rendering.
+ */
+static inline void ro_gui_window__redraw_rect(
+               const struct gui_window *gui_win,
+               const wimp_draw *wimp_rect,
+               bool use_buffer)
+{
+       struct redraw_context ctx = {
+               .interactive = true,
+               .background_images = true,
+               .plot = &ro_plotters
+       };
+       struct rect clip;
+
+       /* 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 = wimp_rect->box.x0 - wimp_rect->xscroll;
+       ro_plot_origin_y = wimp_rect->box.y1 - wimp_rect->yscroll;
+
+       /* Adjust clip rect for origin. */
+       ro_plot_clip_rect.x0 = wimp_rect->clip.x0 - ro_plot_origin_x;
+       ro_plot_clip_rect.y0 = ro_plot_origin_y - wimp_rect->clip.y0;
+       ro_plot_clip_rect.x1 = wimp_rect->clip.x1 - ro_plot_origin_x;
+       ro_plot_clip_rect.y1 = ro_plot_origin_y - wimp_rect->clip.y1;
+
+       /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
+       clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
+       clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
+       clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
+
+       if (use_buffer) {
+               ro_gui_buffer_open(wimp_rect);
+       }
+
+       browser_window_redraw(gui_win->bw, 0, 0, &clip, &ctx);
+
+       if (use_buffer) {
+               ro_gui_buffer_close();
+       }
+}
 
 /**
  * Handle a Redraw_Window_Request for a browser window.
@@ -1650,11 +1701,6 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
        osbool more;
        struct gui_window *g;
        os_error *error;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &ro_plotters
-       };
 
        g = (struct gui_window *)ro_gui_wimp_event_get_user_data(redraw->w);
 
@@ -1675,37 +1721,8 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
                return;
        }
        while (more) {
-               struct rect clip;
-
-               /* 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;
-
-               /* Adjust clip rect for origin. */
-               ro_plot_clip_rect.x0 = redraw->clip.x0 - ro_plot_origin_x;
-               ro_plot_clip_rect.y0 = ro_plot_origin_y - redraw->clip.y0;
-               ro_plot_clip_rect.x1 = redraw->clip.x1 - ro_plot_origin_x;
-               ro_plot_clip_rect.y1 = ro_plot_origin_y - redraw->clip.y1;
-
-               /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
-               clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
-               clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
-               clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
-
-               if (ro_gui_current_redraw_gui->option.buffer_everything)
-                       ro_gui_buffer_open(redraw);
-
-               browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
-
-               if (ro_gui_current_redraw_gui->option.buffer_everything)
-                       ro_gui_buffer_close();
+               ro_gui_window__redraw_rect(g, redraw,
+                       ro_gui_current_redraw_gui->option.buffer_everything);
 
                /* Check to see if there are more rectangles to draw and
                 * get next one */
@@ -4676,22 +4693,15 @@ void ro_gui_window_redraw_all(void)
        }
 }
 
-
 /* exported interface documented in riscos/window.h */
 void ro_gui_window_update_boxes(void)
 {
        osbool more;
        bool use_buffer;
        wimp_draw update;
-       struct rect clip;
        os_error *error;
        struct update_box *cur;
        struct gui_window *g;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &ro_plotters
-       };
 
        for (cur = pending_updates; cur != NULL; cur = cur->next) {
                g = cur->g;
@@ -4717,31 +4727,8 @@ void ro_gui_window_update_boxes(void)
                /* Set the current redraw gui_window to get options from */
                ro_gui_current_redraw_gui = g;
 
-               ro_plot_origin_x = update.box.x0 - update.xscroll;
-               ro_plot_origin_y = update.box.y1 - update.yscroll;
-
                while (more) {
-                       /* Adjust clip rect for origin. */
-                       ro_plot_clip_rect.x0 = update.clip.x0 - 
ro_plot_origin_x;
-                       ro_plot_clip_rect.y0 = ro_plot_origin_y - 
update.clip.y0;
-                       ro_plot_clip_rect.x1 = update.clip.x1 - 
ro_plot_origin_x;
-                       ro_plot_clip_rect.y1 = ro_plot_origin_y - 
update.clip.y1;
-
-                       /* 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 = (ro_plot_clip_rect.x0    ) / 2; /* left   */
-                       clip.y0 = (ro_plot_clip_rect.y1    ) / 2; /* top    */
-                       clip.x1 = (ro_plot_clip_rect.x1 + 1) / 2; /* right  */
-                       clip.y1 = (ro_plot_clip_rect.y0 + 1) / 2; /* bottom */
-
-                       if (use_buffer)
-                               ro_gui_buffer_open(&update);
-
-                       browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
-
-                       if (use_buffer)
-                               ro_gui_buffer_close();
+                       ro_gui_window__redraw_rect(g, &update, use_buffer);
 
                        error = xwimp_get_rectangle(&update, &more);
                        /* RISC OS 3.7 returns an error here if enough buffer


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to