From d9d7dcb758761e3123fa0fb2d9c6ebc626041662 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 26 Jul 2012 18:37:51 +0100 Subject: Avoid redrawing the whole screen when scrolling by zero pixels. --- framebuffer/gui.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'framebuffer/gui.c') 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); -- cgit v1.2.3