changeset 1849:a2e5201f8fe7

fix scroll performance
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Thu, 20 Jan 2011 21:48:38 +0100
parents 9cd07d8fa9c1
children dd9528825b2f
files dw/fltkviewbase.cc dw/fltkviewport.cc
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewbase.cc	Thu Jan 20 20:38:15 2011 +0100
+++ b/dw/fltkviewbase.cc	Thu Jan 20 21:48:38 2011 +0100
@@ -172,11 +172,19 @@
       exposeArea = NULL;
    }
 #endif
-   core::Rectangle r (rect->x, rect->y, rect->width, rect->height);
+   int X, Y, W, H;
+   
+   fl_clip_box(x () + translateCanvasXToViewX (rect->x),
+               y () + translateCanvasYToViewY (rect->y),
+               rect->width,
+               rect->height,
+               X, Y, W, H);
+
    fl_color(bgColor);
-   fl_rectf(x () + translateCanvasXToViewX (rect->x),
-            y () + translateCanvasYToViewY (rect->y),
-            rect->width, rect->height);
+   fl_rectf(X, Y, W, H);
+
+   core::Rectangle r (translateViewXToCanvasX (X - x ()),
+                      translateViewYToCanvasY (Y - y ()), W, H);
    theLayout->expose (this, &r);
 }
 
--- a/dw/fltkviewport.cc	Thu Jan 20 20:38:15 2011 +0100
+++ b/dw/fltkviewport.cc	Thu Jan 20 21:48:38 2011 +0100
@@ -179,10 +179,9 @@
    int d = damage();
 
    if (d & FL_DAMAGE_SCROLL) {
-      Fl::damage (FL_DAMAGE_SCROLL);
+      clear_damage (FL_DAMAGE_SCROLL);
       fl_scroll(x(), y(), w () - hdiff, h () - vdiff, -scrollDX, -scrollDY, draw_area, this);
-      d &= ~FL_DAMAGE_SCROLL;
-      Fl::damage (d);
+      clear_damage (d & ~FL_DAMAGE_SCROLL);
    }
 
    if (d) {
@@ -369,7 +368,6 @@
 
    adjustScrollbarValues ();
    damage(FL_DAMAGE_SCROLL);
-   redraw();
    theLayout->scrollPosChanged (this, scrollX, scrollY);
    positionChanged();
 }