diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2011-07-29 15:45:45 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2011-07-29 15:45:45 -0400 |
commit | ccd39b8804cba58206d254944c8e7c3bb8e02cdf (patch) | |
tree | 6ac6da3e820e51dfa5a7aa10eff8bd6edc099c0b | |
parent | de3a234a12734101bd35b2f64302b65a19797ed0 (diff) |
avoid double draw after scrollIdle()
After going back or forward to any page, there were two redraws: one from
the origin and another from the scroll position. This patch avoids flicker,
and makes rendering 100% faster in this case.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | dw/layout.cc | 12 | ||||
-rw-r--r-- | dw/layout.hh | 2 |
3 files changed, 13 insertions, 2 deletions
@@ -13,6 +13,7 @@ dillo-3.0 [August ??, 2011] display of the control panels otherwise. - Remove 'fullscreen' key action. - Fixed a border case in URL resolver: empty path + {query|fragment} (BUG#948) + - Avoid double draw after going Back or Forward (it takes half the time now!). Patches: Jorge Arellano Cid +- Remove --enable-ansi configure option. - Limit saved cookie size. diff --git a/dw/layout.cc b/dw/layout.cc index cf19df37..170ec20e 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -194,6 +194,7 @@ Layout::Layout (Platform *platform) canvasWidth = canvasAscent = canvasDescent = 0; usesViewport = false; + drawAfterScrollReq = false; scrollX = scrollY = 0; viewportWidth = viewportHeight = 0; hScrollbarThickness = vScrollbarThickness = 0; @@ -456,6 +457,11 @@ void Layout::scrollIdle () if (xChanged || yChanged) { adjustScrollPos (); view->scrollTo (scrollX, scrollY); + if (drawAfterScrollReq) { + drawAfterScrollReq = false; + view->queueDrawTotal (); + MSG("Layout::scrollIdle: view->queueDrawTotal()\n"); + } } scrollIdleId = -1; @@ -503,7 +509,11 @@ void Layout::draw (View *view, Rectangle *area) { Rectangle widgetArea, intersection, widgetDrawArea; - if (topLevel) { + if (scrollIdleId != -1) { + /* scroll is pending, defer draw until after scrollIdle() */ + drawAfterScrollReq = true; + + } else if (topLevel) { /* Draw the top level widget. */ widgetArea.x = topLevel->allocation.x; widgetArea.y = topLevel->allocation.y; diff --git a/dw/layout.hh b/dw/layout.hh index 98aa4fc1..d08eb363 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -138,7 +138,7 @@ private: style::Cursor cursor; int canvasWidth, canvasAscent, canvasDescent; - bool usesViewport; + bool usesViewport, drawAfterScrollReq; int scrollX, scrollY, viewportWidth, viewportHeight; bool canvasHeightGreater; int hScrollbarThickness, vScrollbarThickness; |