gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h
Date: Tue, 06 Nov 2007 16:04:08 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/11/06 16:04:07

Modified files:
        .              : ChangeLog 
        libgeometry    : snappingrange.h 

Log message:
        * libgeometry/snappingrange.h: add range count limiting functionality
          and limit to 50 ranges by default 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4783&r2=1.4784
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/snappingrange.h?cvsroot=gnash&r1=1.27&r2=1.28

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.4783
retrieving revision 1.4784
diff -u -b -r1.4783 -r1.4784
--- ChangeLog   6 Nov 2007 15:43:40 -0000       1.4783
+++ ChangeLog   6 Nov 2007 16:04:07 -0000       1.4784
@@ -1,5 +1,10 @@
 2007-11-06 Udo Giacomozzi <address@hidden>
 
+       * libgeometry/snappingrange.h: add range count limiting functionality
+         and limit to 50 ranges by default     
+
+2007-11-06 Udo Giacomozzi <address@hidden>
+
        * libgeometry/snappingrange.h: replace the distance method with a
          more efficient area before/after comparison method; make 
          snap_factor and single_mode private members and provide access

Index: libgeometry/snappingrange.h
===================================================================
RCS file: /cvsroot/gnash/gnash/libgeometry/snappingrange.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libgeometry/snappingrange.h 6 Nov 2007 15:43:41 -0000       1.27
+++ libgeometry/snappingrange.h 6 Nov 2007 16:04:07 -0000       1.28
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 // 
-// $Id: snappingrange.h,v 1.27 2007/11/06 15:43:41 udog Exp $
+// $Id: snappingrange.h,v 1.28 2007/11/06 16:04:07 udog Exp $
 
 #ifndef GNASH_SNAPPINGRANGE_H
 #define GNASH_SNAPPINGRANGE_H
@@ -84,6 +84,7 @@
     :
     snap_factor(1.3f),
     single_mode(false),
+    ranges_limit(50),
     _combine_counter(0)
   {
   }
@@ -94,6 +95,7 @@
     :
     snap_factor(T(from.snap_factor)), // does it make sense ?
     single_mode(from.single_mode),
+    ranges_limit(from.ranges_limit),
     _combine_counter(0)
   {
     if ( from.isWorld() ) {
@@ -128,6 +130,12 @@
     single_mode = mode;
   }
   
+  /// Sets the maximum number of ranges allowed (to avoid lots of small
+  /// ranges)
+  void setRangeCountLimit(unsigned limit) {
+    ranges_limit = limit;
+  }
+  
   /// Copy the snapping settings from another ranges list, without
   /// copying the ranges itself
   void inheritConfig(const SnappingRanges2d<T>& from) {
@@ -249,6 +257,20 @@
     
     } //while
   
+    
+    // limit number of ranges
+    if (_ranges.size > ranges_limit) {
+    
+      // We found way too much ranges, so reduce to just one single range.
+      // We could also double the factor and try again, but that probably
+      // won't make much difference, so we avoid the trouble...
+      
+      RangeType single = getFullArea();      
+      _ranges.resize(1);
+      _ranges[0] = single;
+    
+    }
+  
   }
   
   
@@ -589,6 +611,9 @@
   /// if set, only a single, outer range is maintained (extended). 
   bool single_mode;   
   
+  /// maximum number of ranges allowed
+  unsigned ranges_limit;   
+  
   unsigned int _combine_counter;
     
 }; //class SnappingRanges2d




reply via email to

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