summaryrefslogtreecommitdiff
path: root/framebuffer/gui.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-07-26 18:37:51 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-07-26 18:37:51 +0100
commitd9d7dcb758761e3123fa0fb2d9c6ebc626041662 (patch)
tree404c16e7c6ef668e1bbeaf26771b5d8cc56f9bf1 /framebuffer/gui.c
parent59ba5dd43cceeeef02732ef1d9f4200120017630 (diff)
downloadnetsurf-d9d7dcb758761e3123fa0fb2d9c6ebc626041662.tar.gz
netsurf-d9d7dcb758761e3123fa0fb2d9c6ebc626041662.tar.bz2
Avoid redrawing the whole screen when scrolling by zero pixels.
Diffstat (limited to 'framebuffer/gui.c')
-rw-r--r--framebuffer/gui.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 4822a9e28..d6a340d8f 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -119,7 +119,6 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
} else {
bwidget->pany += y;
}
- bwidget->pan_required = true;
content_height = content_get_height(gw->bw->current_content) * scale;
@@ -133,6 +132,11 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
if ((bwidget->scrolly + bwidget->pany) > (content_height - height))
bwidget->pany = (content_height - height) - bwidget->scrolly;
+ if (bwidget->pany == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->vscroll, bwidget->scrolly + bwidget->pany);
@@ -152,13 +156,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
} else {
bwidget->panx += x;
}
- bwidget->pan_required = true;
content_width = content_get_width(gw->bw->current_content) * scale;
width = fbtk_get_width(gw->browser);
-
/* dont pan off the left */
if ((bwidget->scrollx + bwidget->panx) < 0)
bwidget->panx = - bwidget->scrollx;
@@ -167,6 +169,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
if ((bwidget->scrollx + bwidget->panx) > (content_width - width))
bwidget->panx = (content_width - width) - bwidget->scrollx;
+ if (bwidget->panx == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->hscroll, bwidget->scrollx + bwidget->panx);