gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11987: Change InvalidatedRanges to


From: Bastiaan Jacques
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11987: Change InvalidatedRanges to using floats, because that's all we ever
Date: Sat, 06 Mar 2010 19:30:16 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 11987
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Sat 2010-03-06 19:30:16 +0100
message:
  Change InvalidatedRanges to using floats, because that's all we ever
  use it for. Update callers.
modified:
  backend/ProxyRenderer.h
  backend/Renderer.h
  backend/Renderer_agg.cpp
  backend/Renderer_cairo.cpp
  gui/gui.cpp
  libbase/snappingrange.h
  libcore/SWFMatrix.cpp
  libcore/SWFMatrix.h
  libcore/SWFRect.h
=== modified file 'backend/ProxyRenderer.h'
--- a/backend/ProxyRenderer.h   2010-01-01 17:48:26 +0000
+++ b/backend/ProxyRenderer.h   2010-03-06 18:30:16 +0000
@@ -92,7 +92,7 @@
                /// See Renderer::bounds_in_clipping_area (in 
backend/Renderer.h)
                bool bounds_in_clipping_area(const SWFRect& bounds);
                bool bounds_in_clipping_area(const InvalidatedRanges& ranges);
-               bool bounds_in_clipping_area(const geometry::Range2d<float>& 
bounds);
+               bool bounds_in_clipping_area(const 
geometry::Range2d<boost::int32_t>& bounds);
                                
                /// See Renderer::begin_submit_mask (in backend/Renderer.h)
                void    begin_submit_mask();

=== modified file 'backend/Renderer.h'
--- a/backend/Renderer.h        2010-02-03 12:23:38 +0000
+++ b/backend/Renderer.h        2010-03-06 18:30:16 +0000
@@ -401,7 +401,7 @@
     /// Converts pixel coordinates to world coordinates (TWIPS)
     virtual point pixel_to_world(int x, int y) = 0;
     
-    virtual geometry::Range2d<float> pixel_to_world(
+    virtual geometry::Range2d<int> pixel_to_world(
                     const geometry::Range2d<int>& pixelbounds)
     {
         point topleft = pixel_to_world(
@@ -409,12 +409,12 @@
         point bottomright = pixel_to_world(
                         pixelbounds.getMaxX(), pixelbounds.getMaxY());
         
-        return geometry::Range2d<float> (topleft.x, topleft.y, 
+        return geometry::Range2d<int> (topleft.x, topleft.y, 
             bottomright.x, bottomright.y);
     }
     
     virtual geometry::Range2d<int> world_to_pixel(
-                    const geometry::Range2d<float>& worldbounds)
+                    const geometry::Range2d<int>& worldbounds)
     {
         if ((worldbounds.isNull() || worldbounds.isWorld())) return 
worldbounds;
 
@@ -461,7 +461,7 @@
     }
     
     virtual bool bounds_in_clipping_area(
-            const geometry::Range2d<float>& /*bounds*/)
+            const geometry::Range2d<int>& /*bounds*/)
     {
         return true;
     }

=== modified file 'backend/Renderer_agg.cpp'
--- a/backend/Renderer_agg.cpp  2010-01-27 13:24:59 +0000
+++ b/backend/Renderer_agg.cpp  2010-03-06 18:30:16 +0000
@@ -948,17 +948,7 @@
     bounds.set_null();
     bounds.expand_to_transformed_rect(mat, objectBounds);
     
-    const geometry::Range2d<float>& range_float = bounds.getRange();
-    
-    assert(range_float.isFinite());
-    
-    geometry::Range2d<int> range_int(
-      (int) range_float.getMinX(),
-      (int) range_float.getMinY(),
-      (int) range_float.getMaxX(),
-      (int) range_float.getMaxY()
-    );
-    
+    assert(bounds.getRange().isFinite());
     
     const int count = _clipbounds.size();
     for (int cno=0; cno<count; ++cno) {
@@ -1926,7 +1916,7 @@
     return Range2d<int>(xmin, ymin, xmax, ymax);
   }
   
-  geometry::Range2d<int> world_to_pixel(const geometry::Range2d<float>& wb)
+  geometry::Range2d<int> world_to_pixel(const geometry::Range2d<int>& wb)
   {
     if (wb.isNull() || wb.isWorld()) return wb;
     
@@ -1978,7 +1968,7 @@
     
     for (size_t rno=0; rno<ranges.size(); ++rno) {
     
-      const Range2d<float>& range = ranges.getRange(rno);
+      const Range2d<int>& range = ranges.getRange(rno);
 
       Range2d<int> pixbounds = world_to_pixel(range);
       
@@ -1997,7 +1987,7 @@
   }
   
   
-  virtual bool bounds_in_clipping_area(const geometry::Range2d<float>& bounds) 
{    
+  virtual bool bounds_in_clipping_area(const geometry::Range2d<int>& bounds) { 
   
     
     using gnash::geometry::Range2d;
   

=== modified file 'backend/Renderer_cairo.cpp'
--- a/backend/Renderer_cairo.cpp        2010-03-05 17:58:43 +0000
+++ b/backend/Renderer_cairo.cpp        2010-03-06 18:30:16 +0000
@@ -266,7 +266,6 @@
       init_cairo_matrix(&mat, m);       
 
       pattern = binfo->apply(&mat, fill_type);
-      
       break;
     } 
 
@@ -314,7 +313,7 @@
     }
     
     cairo_set_source(_cr, _pattern);
-    
+
     cairo_fill(_cr);
 
     // Surfaces are owned by const bitmap_info_cairo
@@ -504,7 +503,7 @@
     cairo_save(_cr);
     cairo_set_source(_cr, pattern);
     
-    geometry::Range2d<float> range = bounds->getRange();
+    geometry::Range2d<boost::int32_t> range = bounds->getRange();
     m->transform(range);
   
     cairo_rectangle(_cr, range.getMinX(), range.getMinY(), range.width(),
@@ -577,8 +576,8 @@
 
 
     for (size_t rno=0; rno < _invalidated_ranges.size(); rno++) {
-        const geometry::Range2d<float>& range =
-                                   _invalidated_ranges.getRange(rno);
+        const geometry::Range2d<boost::int32_t>& range =
+            _invalidated_ranges.getRange(rno);
         if (range.isNull()) {
             continue;
         }

=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp       2010-02-11 19:50:37 +0000
+++ b/gui/gui.cpp       2010-03-06 18:30:16 +0000
@@ -801,7 +801,8 @@
                
                        for (size_t rno = 0; rno < changed_ranges.size(); 
rno++) {
                        
-                               geometry::Range2d<float> bounds = 
changed_ranges.getRange(rno);
+                               const geometry::Range2d<int>& bounds = 
+                                       changed_ranges.getRange(rno);
 
                                point corners[4];
                                float xmin = bounds.getMinX();
@@ -1068,7 +1069,7 @@
 Gui::setInvalidatedRegions(const InvalidatedRanges& ranges)
 {
        // fallback to single regions
-       geometry::Range2d<float> full = ranges.getFullArea();
+       const geometry::Range2d<int>& full = ranges.getFullArea();
        
        SWFRect bounds;
        

=== modified file 'libbase/snappingrange.h'
--- a/libbase/snappingrange.h   2010-01-01 17:48:26 +0000
+++ b/libbase/snappingrange.h   2010-03-06 18:30:16 +0000
@@ -27,6 +27,7 @@
 #include <iterator>
 #include <algorithm>
 #include <iostream>
+#include <boost/cstdint.hpp>
 
 namespace gnash {
 
@@ -652,7 +653,7 @@
 } // namespace geometry
 
 /// Standard snapping 2d ranges type for invalidated bounds calculation    
-typedef geometry::SnappingRanges2d<float> InvalidatedRanges;
+typedef geometry::SnappingRanges2d<boost::int32_t> InvalidatedRanges;
 
 } //namespace gnash
 

=== modified file 'libcore/SWFMatrix.cpp'
--- a/libcore/SWFMatrix.cpp     2010-01-25 18:52:20 +0000
+++ b/libcore/SWFMatrix.cpp     2010-03-06 18:30:16 +0000
@@ -244,32 +244,6 @@
     result->y = Fixed16Mul(shx, p.x) + Fixed16Mul(sy,  p.y) + ty;
 }
 
-void
-SWFMatrix::transform(geometry::Range2d<float>& r) const
-{
-    if ( ! r.isFinite() ) return;
-
-    float xmin = r.getMinX();
-    float xmax = r.getMaxX();
-    float ymin = r.getMinY();
-    float ymax = r.getMaxY();
-
-    point p0(xmin, ymin);
-    point p1(xmin, ymax);
-    point p2(xmax, ymax);
-    point p3(xmax, ymin);
-
-    transform(p0);
-    transform(p1);
-    transform(p2);
-    transform(p3);
-
-    r.setTo(p0.x, p0.y);
-    r.expandTo(p1.x, p1.y);
-    r.expandTo(p2.x, p2.y);
-    r.expandTo(p3.x, p3.y);
-}
-
 void 
 SWFMatrix::transform(SWFRect& r) const
 {

=== modified file 'libcore/SWFMatrix.h'
--- a/libcore/SWFMatrix.h       2010-01-11 06:41:38 +0000
+++ b/libcore/SWFMatrix.h       2010-03-06 18:30:16 +0000
@@ -160,7 +160,30 @@
     //
     /// NULL and WORLD ranges are untouched.
     ///
-    void    transform(geometry::Range2d<float>& r) const;
+    template <typename T>
+    void transform(geometry::Range2d<T>& r) const
+    {
+        T xmin = r.getMinX();
+        T xmax = r.getMaxX();
+        T ymin = r.getMinY();
+        T ymax = r.getMaxY();
+
+        point p0(xmin, ymin);
+        point p1(xmin, ymax);
+        point p2(xmax, ymax);
+        point p3(xmax, ymin);
+
+        transform(p0);
+        transform(p1);
+        transform(p2);
+        transform(p3);
+
+        r.setTo(p0.x, p0.y);
+        r.expandTo(p1.x, p1.y);
+        r.expandTo(p2.x, p2.y);
+        r.expandTo(p3.x, p3.y);
+    }
+
 
     void    transform(SWFRect& r) const;
     

=== modified file 'libcore/SWFRect.h'
--- a/libcore/SWFRect.h 2010-01-11 06:41:38 +0000
+++ b/libcore/SWFRect.h 2010-03-06 18:30:16 +0000
@@ -233,20 +233,20 @@
 
     /// Construct and return a Range2d object.
     // TODO: deprecate this.
-    geometry::Range2d<float> getRange() const
+    geometry::Range2d<boost::int32_t> getRange() const
     {
         if (is_null())
         {
            // Range2d has a differnt idea about what is a null SWFRect.
-           return geometry::Range2d<float>(geometry::nullRange); //null range
+           return geometry::Range2d<boost::int32_t>(geometry::nullRange); 
//null range
         }
         else if( is_world() ) 
         {
-            return geometry::Range2d<float>(geometry::worldRange); //world 
range
+            return geometry::Range2d<boost::int32_t>(geometry::worldRange); 
//world range
         }
         else
         {
-            return geometry::Range2d<float>(_xMin, _yMin, _xMax, _yMax);
+            return geometry::Range2d<boost::int32_t>(_xMin, _yMin, _xMax, 
_yMax);
         }
     }
 


reply via email to

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