summaryrefslogtreecommitdiff
path: root/frontends/windows
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-23 12:04:07 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-23 12:05:30 +0100
commitb61c21c7d03b4af13e9650348679005bc54bd0f7 (patch)
treea47e1329528d7f917140abfa195e0e960af2e8e2 /frontends/windows
parentd930da38997bb5c7ec3c077568465d2595f02693 (diff)
downloadnetsurf-b61c21c7d03b4af13e9650348679005bc54bd0f7.tar.gz
netsurf-b61c21c7d03b4af13e9650348679005bc54bd0f7.tar.bz2
Update windows frontend to use invalidate window area API
Diffstat (limited to 'frontends/windows')
-rw-r--r--frontends/windows/window.c63
1 files changed, 27 insertions, 36 deletions
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index c9022026b..c0af46f8f 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -883,17 +883,35 @@ static void nsws_window_update_forward_back(struct gui_window *w)
/**
- * redraw the whole window
+ * Invalidate an area of a win32 browser window
*
- * \param gw win32 frontends graphical window.
+ * \param gw The netsurf window being invalidated.
+ * \param rect area to redraw or NULL for entrire window area.
+ * \return NSERROR_OK or appropriate error code.
*/
-static void win32_window_redraw_window(struct gui_window *gw)
+static nserror
+win32_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
{
- /* LOG("gw:%p", gw); */
- if (gw != NULL) {
- RedrawWindow(gw->drawingarea, NULL, NULL,
- RDW_INVALIDATE | RDW_NOERASE);
+ RECT *redrawrectp = NULL;
+ RECT redrawrect;
+
+ assert(gw != NULL);
+
+ if (rect != NULL) {
+ redrawrectp = &redrawrect;
+
+ redrawrect.left = (long)rect->x0 - (gw->scrollx / gw->scale);
+ redrawrect.top = (long)rect->y0 - (gw->scrolly / gw->scale);
+ redrawrect.right =(long)rect->x1;
+ redrawrect.bottom = (long)rect->y1;
+
}
+ RedrawWindow(gw->drawingarea,
+ redrawrectp,
+ NULL,
+ RDW_INVALIDATE | RDW_NOERASE);
+
+ return NSERROR_OK;
}
@@ -922,7 +940,7 @@ static void nsws_set_scale(struct gui_window *gw, float scale)
browser_window_set_scale(gw->bw, scale, true);
}
- win32_window_redraw_window(gw);
+ win32_window_invalidate_area(gw, NULL);
win32_window_set_scroll(gw, x, y);
}
@@ -1523,32 +1541,6 @@ static void win32_window_destroy(struct gui_window *w)
/**
- * Cause redraw of part of a win32 window.
- *
- * \param gw win32 gui window
- * \param rect area to redraw
- */
-static void
-win32_window_update(struct gui_window *gw, const struct rect *rect)
-{
- if (gw == NULL)
- return;
-
- RECT redrawrect;
-
- redrawrect.left = (long)rect->x0 - (gw->scrollx / gw->scale);
- redrawrect.top = (long)rect->y0 - (gw->scrolly / gw->scale);
- redrawrect.right =(long)rect->x1;
- redrawrect.bottom = (long)rect->y1;
-
- RedrawWindow(gw->drawingarea,
- &redrawrect,
- NULL,
- RDW_INVALIDATE | RDW_NOERASE);
-}
-
-
-/**
* Find the current dimensions of a win32 browser window's content area.
*
* \param gw gui_window to measure
@@ -1776,8 +1768,7 @@ static void win32_window_stop_throbber(struct gui_window *w)
static struct gui_window_table window_table = {
.create = win32_window_create,
.destroy = win32_window_destroy,
- .redraw = win32_window_redraw_window,
- .update = win32_window_update,
+ .invalidate = win32_window_invalidate_area,
.get_scroll = win32_window_get_scroll,
.set_scroll = win32_window_set_scroll,
.get_dimensions = win32_window_get_dimensions,