Mercurial > dillo_port1.3
changeset 1293:090cc554fefb
further reduce size of rectangles before drawing
Make currently exposed area available in FltkViewBase and use it to
clip rectangles to the required size before drawing them.
We can use the same mechanism to limit drawImage() calls instead of
doing it in dw/image.cc as currently done.
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> |
---|---|
date | Tue, 01 Sep 2009 22:02:28 +0200 |
parents | 9e72d92624e4 |
children | 019d5ca2152f a8db028b337f |
files | dw/fltkviewbase.cc dw/fltkviewbase.hh |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/dw/fltkviewbase.cc Tue Sep 01 21:19:13 2009 +0200 +++ b/dw/fltkviewbase.cc Tue Sep 01 22:02:28 2009 +0200 @@ -48,6 +48,7 @@ canvasHeight = 1; bgColor = WHITE; mouse_x = mouse_y = 0; + exposeArea = NULL; if (backBuffer == NULL) { backBuffer = new Image (); } @@ -129,6 +130,8 @@ viewRect.w (), viewRect.h ()); + exposeArea = &viewRect; + if (type == DRAW_BUFFERED && backBuffer && !backBufferInUse) { backBufferInUse = true; { @@ -160,6 +163,8 @@ fillrect (viewRect); theLayout->expose (this, &r); } + + exposeArea = NULL; } }
--- a/dw/fltkviewbase.hh Tue Sep 01 21:19:13 2009 +0200 +++ b/dw/fltkviewbase.hh Tue Sep 01 22:02:28 2009 +0200 @@ -20,20 +20,23 @@ 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: