Avoid redrawing the whole screen when scrolling by zero pixels.

This commit is contained in:
Michael Drake 2012-07-26 18:37:51 +01:00
parent 59ba5dd43c
commit d9d7dcb758

View File

@ -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);