diff options
-rw-r--r-- | dw/fltkviewbase.cc | 5 | ||||
-rw-r--r-- | dw/fltkviewbase.hh | 19 |
2 files changed, 16 insertions, 8 deletions
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index 1d82a661..89253179 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -48,6 +48,7 @@ FltkViewBase::FltkViewBase (int x, int y, int w, int h, const char *label): canvasHeight = 1; bgColor = WHITE; mouse_x = mouse_y = 0; + exposeArea = NULL; if (backBuffer == NULL) { backBuffer = new Image (); } @@ -129,6 +130,8 @@ void FltkViewBase::draw (const core::Rectangle *rect, viewRect.w (), viewRect.h ()); + exposeArea = &viewRect; + if (type == DRAW_BUFFERED && backBuffer && !backBufferInUse) { backBufferInUse = true; { @@ -160,6 +163,8 @@ void FltkViewBase::draw (const core::Rectangle *rect, fillrect (viewRect); theLayout->expose (this, &r); } + + exposeArea = NULL; } } diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index c502d2f7..fb3f2fe1 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -20,20 +20,23 @@ private: int bgColor; core::Region drawRegion; + ::fltk::Rectangle *exposeArea; static ::fltk::Image *backBuffer; static bool backBufferInUse; void draw (const core::Rectangle *rect, DrawType type); void drawChildWidgets (); inline void clipPoint (int *x, int *y) { - if (*x < 0) - *x = 0; - if (*x > w ()) - *x = w (); - if (*y < 0) - *y = 0; - if (*y > h ()) - *y = h (); + if (exposeArea) { + if (*x < exposeArea->x ()) + *x = exposeArea->x (); + if (*x > exposeArea->r ()) + *x = exposeArea->r (); + if (*y < exposeArea->y ()) + *y = exposeArea->y (); + if (*y > exposeArea->b ()) + *y = exposeArea->b (); + } } protected: |