adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/gfx drawing_area.cc,1.2,1.3


From: Alexandre Courbot <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/gfx drawing_area.cc,1.2,1.3
Date: Fri, 25 Jul 2003 07:27:01 -0400

Update of /cvsroot/adonthell/adonthell/src/gfx
In directory subversions:/tmp/cvs-serv2187/src/gfx

Modified Files:
        drawing_area.cc 
Log Message:
Fabien's patch that improves drawing_area.


Index: drawing_area.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gfx/drawing_area.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** drawing_area.cc     24 Jul 2003 12:57:58 -0000      1.2
--- drawing_area.cc     25 Jul 2003 11:26:57 -0000      1.3
***************
*** 23,26 ****
--- 23,27 ----
  
  #include "drawing_area.h"
+ #include <algorithm>
  
  namespace gfx
***************
*** 43,77 ****
      drawing_area drawing_area::setup_rects () const
      {
!         drawing_area ret;
!         if (draw_to)
!         {
!             drawing_area temp = draw_to->setup_rects ();
              
!             ret.move(temp.x() > x ()? temp.x() : x (),
!                      temp.y() > y ()? temp.y() : y ());
!             
!             // Precalculated for faster operation.
!             s_int32 xpl = x () + length (); 
!             s_int32 txw = temp.x() + temp.length();
!             s_int32 txwmrx = txw - ret.x();
!             s_int32 xplmrx = xpl - ret.x();  
!             s_int32 yph = y () + height (); 
!             s_int32 tyh = temp.y() + temp.height();
!             s_int32 tyhmry = tyh - ret.y();
!             s_int32 yphmry = yph - ret.y(); 
!             
!             
!             ret.resize(txw < xpl ? txwmrx > 0 ? txwmrx : 0 : xplmrx > 0 ? 
xplmrx : 0,
!                        tyh < yph ? tyhmry > 0 ? tyhmry : 0 : yphmry > 0 ? 
yphmry : 0);
!             
!         }
!         else 
!         {
!             ret = *this;
!             ret.assign_drawing_area(NULL);
          }
-         
          return ret;
-         
      }
      
--- 44,61 ----
      drawing_area drawing_area::setup_rects () const
      {
!         drawing_area ret = *this;
!         ret.assign_drawing_area(NULL);
!         for(drawing_area* it = this->assigned_drawing_area(); it; it = 
it->assigned_drawing_area())
!       {
!             s_int32 x = std::max(ret.x(), it->x());
!             s_int32 y = std::max(ret.y(), it->y());
!             s_int32 w = std::min(it->x() + it->length(), ret.x() + 
ret.length()) - x;
!             s_int32 h = std::min(it->y() + it->length(), ret.y() + 
ret.length()) - y;
              
!             ret.move(x, y);
!             ret.resize(w > 0 ? w : 0, 
!                        h > 0 ? h : 0);
          }
          return ret;
      }
      
***************
*** 81,84 ****
                  py >= y () && py <= y () + height ()); 
      }
-     
  }
--- 65,67 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]