changeset 1941:f2f755594cf9

merge
author Jorge Arellano Cid <jcid@dillo.org>
date Wed, 09 Mar 2011 18:08:16 -0300
parents a5176865375c (current diff) e920355164cf (diff)
children 67184dcd61d8
files
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewbase.cc	Wed Mar 09 18:07:25 2011 -0300
+++ b/dw/fltkviewbase.cc	Wed Mar 09 18:08:16 2011 -0300
@@ -134,13 +134,18 @@
 void FltkViewBase::draw (const core::Rectangle *rect,
                          DrawType type)
 {
-   int X, Y, W, H;
+   int X = translateCanvasXToViewX (rect->x);
+   int Y = translateCanvasYToViewY (rect->y);
+   int W, H;
+
+   // fl_clip_box() can't handle values greater than SHRT_MAX!
+   if (X > x () + w () || Y > y () + h ())
+      return;
    
-   fl_clip_box(translateCanvasXToViewX (rect->x),
-               translateCanvasYToViewY (rect->y),
-               rect->width,
-               rect->height,
-               X, Y, W, H);
+   W = X + rect->width > x () + w () ? x () + w () - X : rect->width;
+   H = Y + rect->height > y () + h () ? y () + h () - Y : rect->height;
+
+   fl_clip_box(X, Y, W, H, X, Y, W, H);
 
    core::Rectangle r (translateViewXToCanvasX (X),
                       translateViewYToCanvasY (Y), W, H);