gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libgeometry/Range2d.h server/re...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog libgeometry/Range2d.h server/re...
Date: Tue, 24 Apr 2007 12:01:55 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/04/24 12:01:55

Modified files:
        .              : ChangeLog 
        libgeometry    : Range2d.h 
        server         : rect.h 
        server/parser  : shape_character_def.cpp 

Log message:
        new expandToCircle() and correct calculate_bounds()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2982&r2=1.2983
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/Range2d.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.h?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.2982
retrieving revision 1.2983
diff -u -b -r1.2982 -r1.2983
--- ChangeLog   24 Apr 2007 11:55:32 -0000      1.2982
+++ ChangeLog   24 Apr 2007 12:01:54 -0000      1.2983
@@ -1,3 +1,10 @@
+2007-04-24 Udo Giacomozzi <address@hidden>
+
+       * libgeometry/Range2d.h: added expandToCircle()
+       * server/rect.h: added expand_to_circle()
+       * server/parser/shape_character_def.cpp: corrected compute_bound()
+         to respect outline widths
+               
 2007-04-24 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/: DrawingApiTest.as,

Index: libgeometry/Range2d.h
===================================================================
RCS file: /cvsroot/gnash/gnash/libgeometry/Range2d.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- libgeometry/Range2d.h       28 Feb 2007 22:53:24 -0000      1.13
+++ libgeometry/Range2d.h       24 Apr 2007 12:01:54 -0000      1.14
@@ -19,7 +19,7 @@
 //
 
 
-/* $Id: Range2d.h,v 1.13 2007/02/28 22:53:24 strk Exp $ */
+/* $Id: Range2d.h,v 1.14 2007/04/24 12:01:54 udog Exp $ */
 
 #ifndef GNASH_RANGE2D_H
 #define GNASH_RANGE2D_H
@@ -333,6 +333,24 @@
                return *this;
        }
 
+       /// Expand this Range2d to enclose the given circle.
+       //
+       /// @return a reference to this instance
+       ///
+       Range2d<T>& expandToCircle(T x, T y, T radius)
+       {
+               // A WORLD range already enclose every point
+               if ( isWorld() ) return *this;
+
+        expandTo(x-radius, y);
+        expandTo(x+radius, y);
+
+        expandTo(x, y-radius);
+        expandTo(x, y+radius);
+
+               return *this;
+       }
+
        /// Set ourself to bound the given point
        //
        /// @return a reference to this instance

Index: server/rect.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/rect.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/rect.h       6 Dec 2006 12:48:51 -0000       1.16
+++ server/rect.h       24 Apr 2007 12:01:55 -0000      1.17
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: rect.h,v 1.16 2006/12/06 12:48:51 strk Exp $ */
+/* $Id: rect.h,v 1.17 2007/04/24 12:01:55 udog Exp $ */
 
 #ifndef GNASH_RECT_H
 #define GNASH_RECT_H
@@ -114,6 +114,12 @@
                _range.expandTo(x, y);
        }
 
+       /// Expand this rectangle to enclose the given circle.
+       void    expand_to_circle(float x, float y, float radius)
+       {
+               _range.expandToCircle(x, y, radius);
+       }
+
        /// Set ourself to bound the given point
        void    enclose_point(float x, float y)
        {

Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/parser/shape_character_def.cpp       24 Apr 2007 10:05:55 -0000      
1.19
+++ server/parser/shape_character_def.cpp       24 Apr 2007 12:01:55 -0000      
1.20
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: shape_character_def.cpp,v 1.19 2007/04/24 10:05:55 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.20 2007/04/24 12:01:55 udog Exp $ */
 
 // Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden> 
2003
 
@@ -668,15 +668,35 @@
 
     for (unsigned int i = 0; i < m_paths.size(); i++)
     {
+    
        const path&     p = m_paths[i];
+
        size_t nedges = p.m_edges.size();
        if ( ! nedges ) continue;
+        
+        if (p.m_line==0) {
+
        r->expand_to_point(p.m_ax, p.m_ay);
        for (unsigned int j = 0; j<nedges; j++)
        {
                r->expand_to_point(p.m_edges[j].m_ax, p.m_edges[j].m_ay);
                r->expand_to_point(p.m_edges[j].m_cx, p.m_edges[j].m_cy);
        }
+            
+        } else {        
+            
+            // NOTE: Half of get_width() would be enough (and correct) for
+            // radius, but that would not match how Flash calculates the
+            // bounds using the drawing API.                        
+            float radius = m_line_styles[p.m_line-1].get_width();
+            
+            r->expand_to_circle(p.m_ax, p.m_ay, radius);
+            for (unsigned int j = 0; j<nedges; j++)
+            {
+                r->expand_to_circle(p.m_edges[j].m_ax, p.m_edges[j].m_ay, 
radius);
+                r->expand_to_circle(p.m_edges[j].m_cx, p.m_edges[j].m_cy, 
radius);
+            }
+        }
     }
 }
 




reply via email to

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