gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/server rect.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash/server rect.cpp
Date: Tue, 05 Dec 2006 23:09:46 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/12/05 23:09:46

Modified files:
        server         : rect.cpp 

Log message:
        simplified expand_to_rect, handled ! finite rects in 
expand_to_transformed_rect

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.cpp?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: rect.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/rect.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- rect.cpp    5 Dec 2006 23:05:00 -0000       1.6
+++ rect.cpp    5 Dec 2006 23:09:46 -0000       1.7
@@ -87,25 +87,21 @@
 
 void  rect::expand_to_rect(const rect& r) 
 {
-       if ( is_world() || r.is_null() ) return; // nothing to do
-       if ( r.is_world() ) 
-       {
-               set_world();
+       _range.expandTo(r._range);
                return;
-       }
-
-       point tmp;
-       tmp = r.get_corner(0);  expand_to_point(tmp.m_x, tmp.m_y);    
-       tmp = r.get_corner(1);  expand_to_point(tmp.m_x, tmp.m_y);    
-       tmp = r.get_corner(2);  expand_to_point(tmp.m_x, tmp.m_y);    
-       tmp = r.get_corner(3);  expand_to_point(tmp.m_x, tmp.m_y);    
 }      
 
 void   rect::expand_to_transformed_rect(const matrix& m, const rect& r)
 {
-       // a null rectangle will always be null, no matter
+       // a null rectangle will add nothing, and a world
+       // rectangle will always be world, no matter
        // how you transform it.
-       if ( r.is_null() ) return;
+       if ( is_world() || r.is_null() ) return;
+       if ( r.is_world() ) 
+       {
+               set_world();
+               return;
+       }
 
        // Get the transformed bounding box.
        point   p0, p1, p2, p3;
@@ -114,10 +110,12 @@
        m.transform(&p2, r.get_corner(2));
        m.transform(&p3, r.get_corner(3));
 
-       expand_to_point(p0.m_x, p0.m_y);
-       expand_to_point(p1.m_x, p1.m_y);
-       expand_to_point(p2.m_x, p2.m_y);
-       expand_to_point(p3.m_x, p3.m_y);
+       // TODO: check for numeric overflow ?
+
+       _range.expandTo(p0.m_x, p0.m_y);
+       _range.expandTo(p1.m_x, p1.m_y);
+       _range.expandTo(p2.m_x, p2.m_y);
+       _range.expandTo(p3.m_x, p3.m_y);
 }
 
 




reply via email to

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