gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10551: Implement _quality and _high


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10551: Implement _quality and _highquality for TextField and Button.
Date: Thu, 22 Jan 2009 16:28:34 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10551
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-01-22 16:28:34 +0100
message:
  Implement _quality and _highquality for TextField and Button.
  
  Clean up AGG renderer and rendering interface; agg now passes all
  the DrawingApi tests.
  
  Revert cxform commit 10545.1.13, which broke things.
modified:
  backend/render_handler.h
  backend/render_handler_agg.cpp
  backend/render_handler_cairo.cpp
  backend/render_handler_ogl.cpp
  libcore/Button.cpp
  libcore/TextField.cpp
  libcore/asobj/TextFormat_as.cpp
  libcore/cxform.cpp
  libcore/parser/shape_character_def.cpp
  libcore/parser/shape_character_def.h
  libcore/swf/TextRecord.cpp
  testsuite/actionscript.all/TextField.as
  testsuite/misc-ming.all/DrawingApiTestRunner.cpp
    ------------------------------------------------------------
    revno: 10550.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 08:08:28 +0100
    message:
      Minor cleanups.
    modified:
      backend/render_handler_agg.cpp
    ------------------------------------------------------------
    revno: 10550.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 15:35:44 +0100
    message:
      Implement _quality and _highquality for TextField and Button. 
      Passes in actionscript.all. Expect one failure, as it was only passing
      because unimplemented; now it fails for the same reason as other
      prototype (non-)properties.
    modified:
      libcore/Button.cpp
      libcore/TextField.cpp
      testsuite/actionscript.all/TextField.as
    ------------------------------------------------------------
    revno: 10550.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 15:36:37 +0100
    message:
      Drop display() function with custom matrix and styles from 
shape_character_def.
            
      Drop unused dummy line and fill styles from TextRecord.
    modified:
      libcore/parser/shape_character_def.cpp
      libcore/parser/shape_character_def.h
      libcore/swf/TextRecord.cpp
    ------------------------------------------------------------
    revno: 10550.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 15:36:58 +0100
    message:
      Correct unimpl messages.
    modified:
      libcore/asobj/TextFormat_as.cpp
    ------------------------------------------------------------
    revno: 10550.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 15:37:28 +0100
    message:
      Remove styles from draw_shape_character() in renderer interface, as these
      should be obtained from the character definition.
      
      Other AGG cleanups.
    modified:
      backend/render_handler.h
      backend/render_handler_agg.cpp
      backend/render_handler_cairo.cpp
      backend/render_handler_ogl.cpp
      testsuite/misc-ming.all/DrawingApiTestRunner.cpp
    ------------------------------------------------------------
    revno: 10550.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-22 15:52:53 +0100
    message:
      Revert cxform changes.
    modified:
      libcore/cxform.cpp
=== modified file 'backend/render_handler.h'
--- a/backend/render_handler.h  2009-01-19 16:35:55 +0000
+++ b/backend/render_handler.h  2009-01-22 14:37:28 +0000
@@ -307,25 +307,16 @@
                 return; // no need to draw
         }        
 
-        // TODO: I don't like that there is a draw_shape_character() version
-        // with arbitrary fill and line styles as this may break caching...
-
         // render the character
-        draw_shape_character(def, 
-                inst->getWorldMatrix(), 
-                inst->get_world_cxform(),
-                def->get_fill_styles(),
-                def->get_line_styles());
+        draw_shape_character(def, inst->getWorldMatrix(),
+                inst->get_world_cxform());
     }
     
     /// \brief
     /// Draws the given character definition with the given transformations and
     /// styles. 
     virtual void draw_shape_character(shape_character_def *def, 
-        const SWFMatrix& mat,
-        const cxform& cx,
-        const std::vector<fill_style>& fill_styles,
-        const std::vector<line_style>& line_styles) = 0;
+        const SWFMatrix& mat, const cxform& cx) = 0;
         
     /// \brief
     /// Draws a glyph (font character).

=== modified file 'backend/render_handler_agg.cpp'
--- a/backend/render_handler_agg.cpp    2009-01-21 08:58:44 +0000
+++ b/backend/render_handler_agg.cpp    2009-01-22 14:37:28 +0000
@@ -172,7 +172,6 @@
        #define round(x) rint(x)
 #endif
 
-#define TWIPS_TO_SHIFTED_PIXELS(x) (x*0.05f + 0.5f) 
 
 #include <boost/numeric/conversion/converter.hpp>
 
@@ -182,6 +181,8 @@
 
 class AlphaMask;
 
+
+typedef std::vector<agg::path_storage> AggPaths;
 typedef std::vector<geometry::Range2d<int> > ClipBounds;
 typedef std::vector<AlphaMask*> AlphaMasks;
 typedef std::vector<path> GnashPaths;
@@ -193,7 +194,7 @@
     ras.clip_box(static_cast<double>(bounds.getMinX()),
             static_cast<double>(bounds.getMinY()),
             static_cast<double>(bounds.getMaxX() + 1), 
-            static_cast<double>(bounds.getMaxY()+1)
+            static_cast<double>(bounds.getMaxY() + 1)
             );  
 }
 
@@ -226,61 +227,64 @@
     }
 }
 
+class EdgeToPath
+{
+
+public:
+    EdgeToPath(AggPaths::value_type& path, double shift = 0)
+        :
+        _path(path),
+        _shift(shift)
+    {}
+
+    void operator()(const edge& edge)
+    {
+        if (edge.is_straight()) {
+            _path.line_to(TWIPS_TO_PIXELS(edge.ap.x) + _shift, 
+                          TWIPS_TO_PIXELS(edge.ap.y) + _shift);
+        }
+        else {
+            _path.curve3(TWIPS_TO_PIXELS(edge.cp.x) + _shift, 
+                     TWIPS_TO_PIXELS(edge.cp.y) + _shift,
+                     TWIPS_TO_PIXELS(edge.ap.x) + _shift, 
+                     TWIPS_TO_PIXELS(edge.ap.y) + _shift);             
+        }
+    }
+
+private:
+    agg::path_storage& _path;
+    const double _shift;
+};
+
 /// In-place transformation of Gnash paths to AGG paths.
 class GnashToAggPath
 {
 public:
 
-    typedef std::vector<agg::path_storage> AggPaths;
-
-    GnashToAggPath(AggPaths& dest)
+    GnashToAggPath(AggPaths& dest, double shift = 0)
         :
         _dest(dest),
-        _it(_dest.begin())
+        _it(_dest.begin()),
+        _shift(shift)
     {
     }
 
-    class EdgeToPath
-    {
-
-    public:
-        EdgeToPath(AggPaths::value_type& path)
-            :
-            _path(path)
-        {}
-
-        void operator()(const edge& edge)
-        {
-            if (edge.is_straight()) {
-                _path.line_to(TWIPS_TO_SHIFTED_PIXELS(edge.ap.x), 
-                                    TWIPS_TO_SHIFTED_PIXELS(edge.ap.y));
-            }
-            else {
-                _path.curve3(TWIPS_TO_SHIFTED_PIXELS(edge.cp.x), 
-                         TWIPS_TO_SHIFTED_PIXELS(edge.cp.y),
-                         TWIPS_TO_SHIFTED_PIXELS(edge.ap.x), 
-                         TWIPS_TO_SHIFTED_PIXELS(edge.ap.y));             
-            }
-        }
-
-    private:
-        agg::path_storage& _path;
-    };
-
     void operator()(const path& in)
     {
         agg::path_storage& p = *_it;
 
-        p.move_to(TWIPS_TO_SHIFTED_PIXELS(in.ap.x), 
-                            TWIPS_TO_SHIFTED_PIXELS(in.ap.y));
+        p.move_to(TWIPS_TO_PIXELS(in.ap.x) + _shift, 
+                  TWIPS_TO_PIXELS(in.ap.y) + _shift);
 
-        std::for_each(in.m_edges.begin(), in.m_edges.end(), EdgeToPath(p));
+        std::for_each(in.m_edges.begin(), in.m_edges.end(),
+                EdgeToPath(p, _shift));
         ++_it;
     }
 
 private:
-    std::vector<agg::path_storage>& _dest;
+    AggPaths& _dest;
     AggPaths::iterator _it;
+    const double _shift;
 
 };
 
@@ -289,10 +293,10 @@
 /// and shapes. Subshapes are ignored (ie. all paths are converted). Converts 
 /// TWIPS to pixels on the fly.
 inline void
-buildPaths(std::vector<agg::path_storage>& dest, const GnashPaths& paths) 
+buildPaths(AggPaths& dest, const GnashPaths& paths) 
 {
     dest.resize(paths.size());
-    std::for_each(paths.begin(), paths.end(), GnashToAggPath(dest));
+    std::for_each(paths.begin(), paths.end(), GnashToAggPath(dest, 0.05));
 } 
 
 // --- ALPHA MASK BUFFER CONTAINER 
---------------------------------------------
@@ -886,7 +890,7 @@
     }
 
     // convert gnash paths to agg paths.
-    std::vector<agg::path_storage> agg_paths;    
+    AggPaths agg_paths;    
     buildPaths(agg_paths, paths);
  
     // make sure m_single_fill_styles contains the required color 
@@ -967,11 +971,11 @@
   }
 
     void draw_shape_character(shape_character_def *def, 
-    const SWFMatrix& mat, const cxform& cx,
-    const std::vector<fill_style>& fill_styles,
-    const std::vector<line_style>& line_styles)
+    const SWFMatrix& mat, const cxform& cx)
     {
     
+        const std::vector<fill_style>& fill_styles = def->get_fill_styles();
+        const std::vector<line_style>& line_styles = def->get_line_styles();
         bool have_shape, have_outline;
 
         analyzePaths(def->get_paths(), have_shape, have_outline);
@@ -994,8 +998,8 @@
             return;
         }
 
-        std::vector<agg::path_storage> agg_paths;  
-        std::vector<agg::path_storage> agg_paths_rounded;  
+        AggPaths agg_paths;  
+        AggPaths agg_paths_rounded;  
 
         // Flash only aligns outlines. Probably this is done at rendering
         // level.
@@ -1097,7 +1101,7 @@
   //
   // TODO: Flash never aligns lines that are wider than 1 pixel on *screen*,
   // but we currently don't check the width.  
-  void buildPaths_rounded(std::vector<agg::path_storage>& dest, 
+  void buildPaths_rounded(AggPaths& dest, 
     const GnashPaths& paths, const std::vector<line_style>& line_styles)
   {
 
@@ -1346,8 +1350,8 @@
   ///    Defines which subshape to draw. -1 means all subshapes.
   ///
   void draw_shape(int subshape_id, const GnashPaths &paths,
-    const std::vector<agg::path_storage>& agg_paths,  
-    agg_style_handler& sh, int even_odd) {
+    const AggPaths& agg_paths,  
+    agg_style_handler& sh, bool even_odd) {
     
     if (_alphaMasks.empty()) {
     
@@ -1380,8 +1384,8 @@
   /// much faster.  
   template <class scanline_type>
   void draw_shape_impl(int subshape_id, const GnashPaths &paths,
-    const std::vector<agg::path_storage>& agg_paths,
-    agg_style_handler& sh, int even_odd, scanline_type& sl) {
+    const AggPaths& agg_paths,
+    agg_style_handler& sh, bool even_odd, scanline_type& sl) {
     /*
     Fortunately, AGG provides a rasterizer that fits perfectly to the flash
     data model. So we just have to feed AGG with all data and we're done. :-)
@@ -1397,7 +1401,7 @@
     
     if ( _clipbounds.empty() ) return;
 
-    // AGG stuff
+    // Target renderer
     renderer_base& rbase = *m_rbase;
 
     typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl> ras_type;
@@ -1431,12 +1435,12 @@
         const path &this_path_gnash = paths[pno];
         agg::path_storage &this_path_agg = 
           const_cast<agg::path_storage&>(agg_paths[pno]);
-        agg::conv_curve< agg::path_storage > curve(this_path_agg);        
-        
-        if (this_path_gnash.m_new_shape)
-          ++current_subshape;
+        
+        agg::conv_curve<agg::path_storage> curve(this_path_agg);        
+        
+        if (this_path_gnash.m_new_shape) ++current_subshape;
           
-        if ((subshape_id>=0) && (current_subshape!=subshape_id)) {
+        if ((subshape_id >= 0) && (current_subshape!=subshape_id)) {
           // Skip this path as it is not part of the requested sub-shape.
           continue;
         }
@@ -1468,10 +1472,10 @@
 
   // very similar to draw_shape but used for generating masks. There are no
   // fill styles nor subshapes and such. Just render plain solid shapes.
-  void draw_mask_shape(const GnashPaths &paths, int even_odd)
+  void draw_mask_shape(const GnashPaths &paths, bool even_odd)
   {
 
-    unsigned int mask_count = _alphaMasks.size();
+    const AlphaMasks::size_type mask_count = _alphaMasks.size();
     
     if (mask_count < 2) {
     
@@ -1481,9 +1485,10 @@
       
       scanline_type sl;
       
-      draw_mask_shape_impl<scanline_type> (paths, even_odd, sl);
+      draw_mask_shape_impl(paths, even_odd, sl);
         
-    } else {
+    }
+    else {
     
       // Woohoo! We're drawing a nested mask! Use the previous mask while 
       // drawing the new one, the result will be the intersection.
@@ -1492,7 +1497,7 @@
       
       scanline_type sl(_alphaMasks[mask_count-2]->getMask());
       
-      draw_mask_shape_impl<scanline_type> (paths, even_odd, sl);
+      draw_mask_shape_impl(paths, even_odd, sl);
         
     }
     
@@ -1500,7 +1505,7 @@
   
   
   template <class scanline_type>
-  void draw_mask_shape_impl(const GnashPaths &paths, int even_odd,
+  void draw_mask_shape_impl(const GnashPaths &paths, bool even_odd,
     scanline_type& sl) {
     
     typedef agg::pixfmt_gray8 pixfmt;
@@ -1529,15 +1534,12 @@
       
 
     // activate even-odd filling rule
-    if (even_odd)
-      rasc.filling_rule(agg::fill_even_odd);
-    else
-      rasc.filling_rule(agg::fill_non_zero);
+    if (even_odd) rasc.filling_rule(agg::fill_even_odd);
+    else rasc.filling_rule(agg::fill_non_zero);
       
-    
     // push paths to AGG
-    agg::path_storage path; // be careful about this name 
-    agg::conv_curve< agg::path_storage > curve(path);
+    agg::path_storage path; 
+    agg::conv_curve<agg::path_storage> curve(path);
 
     for (size_t pno=0, pcount=paths.size(); pno < pcount; ++pno) {
 
@@ -1553,28 +1555,15 @@
       path.move_to(TWIPS_TO_PIXELS(this_path.ap.x), 
                    TWIPS_TO_PIXELS(this_path.ap.y));
     
-      const unsigned int ecount = this_path.m_edges.size();
-      for (unsigned int eno=0; eno<ecount; ++eno) {
-
-        const edge &this_edge = this_path.m_edges[eno];
-
-        if (this_edge.is_straight())
-          path.line_to(TWIPS_TO_PIXELS(this_edge.ap.x), 
-                       TWIPS_TO_PIXELS(this_edge.ap.y));
-        else
-          path.curve3(TWIPS_TO_PIXELS(this_edge.cp.x), 
-                      TWIPS_TO_PIXELS(this_edge.cp.y),
-                      TWIPS_TO_PIXELS(this_edge.ap.x), 
-                      TWIPS_TO_PIXELS(this_edge.ap.y));
-        
-      } // for edge
+      // Add all edges to the path.
+      std::for_each(this_path.m_edges.begin(), this_path.m_edges.end(),
+              EdgeToPath(path));
       
       // add to rasterizer
       rasc.add_path(curve);
     
     } // for path
     
-    
     // now render that thing!
     agg::render_scanlines_compound_layered (rasc, sl, rbase, alloc, sh);
         
@@ -1584,7 +1573,7 @@
 
   /// Just like draw_shapes() except that it draws an outline.
   void draw_outlines(int subshape_id, const GnashPaths &paths,
-    const std::vector<agg::path_storage>& agg_paths,
+    const AggPaths& agg_paths,
     const std::vector<line_style> &line_styles, const cxform& cx,
     const SWFMatrix& linestyle_matrix) {
     
@@ -1618,14 +1607,14 @@
   /// Template for draw_outlines(), see draw_shapes_impl().
   template <class scanline_type>
   void draw_outlines_impl(int subshape_id, const GnashPaths &paths,
-    const std::vector<agg::path_storage>& agg_paths,
+    const AggPaths& agg_paths,
     const std::vector<line_style> &line_styles, const cxform& cx, 
     const SWFMatrix& linestyle_matrix, scanline_type& sl) {
     
     assert(m_pixf.get());
-    
-    if (m_drawing_mask)    // Flash ignores lines in mask /definitions/
-      return;    
+
+    // Flash ignores lines in mask /definitions/ 
+    if (m_drawing_mask) return;    
     
     if ( _clipbounds.empty() ) return;
 
@@ -1690,9 +1679,12 @@
         }
         else
         {
-          if ( (!lstyle.scaleThicknessVertically()) || 
(!lstyle.scaleThicknessHorizontally()) )
+          if ((!lstyle.scaleThicknessVertically()) ||
+                  (!lstyle.scaleThicknessHorizontally()))
           {
-             LOG_ONCE( log_unimpl(_("Unidirectionally scaled strokes in AGG 
renderer (we'll scale by the scalable one)")) );
+             LOG_ONCE( log_unimpl(_("Unidirectionally scaled strokes in "
+                             "AGG renderer (we'll scale by the "
+                             "scalable one)")) );
           }
           stroke.width(std::max(1.0f, thickness*stroke_scale));
         }

=== modified file 'backend/render_handler_cairo.cpp'
--- a/backend/render_handler_cairo.cpp  2009-01-21 08:45:36 +0000
+++ b/backend/render_handler_cairo.cpp  2009-01-22 14:37:28 +0000
@@ -934,9 +934,7 @@
                   
   virtual void draw_shape_character(shape_character_def *def, 
     const SWFMatrix& mat,
-    const cxform& cx,
-    const std::vector<fill_style>& fill_styles,
-    const std::vector<line_style>& line_styles)
+    const cxform& cx)
   {
         
     const PathVec& path_vec = def->get_paths();
@@ -959,6 +957,9 @@
 
     std::vector<PathVec::const_iterator> subshapes = find_subshapes(path_vec);
     
+    const std::vector<fill_style>& fill_styles = def->get_fill_styles();
+    const std::vector<line_style>& line_styles = def->get_line_styles();
+
     for (size_t i = 0; i < subshapes.size()-1; ++i) {
       PathVec subshape_paths;
       

=== modified file 'backend/render_handler_ogl.cpp'
--- a/backend/render_handler_ogl.cpp    2009-01-21 11:37:15 +0000
+++ b/backend/render_handler_ogl.cpp    2009-01-22 14:37:28 +0000
@@ -1608,11 +1608,8 @@
 // 5. Profit!
 
   virtual void
-  draw_shape_character(shape_character_def *def, 
-    const SWFMatrix& mat,
-    const cxform& cx,
-    const std::vector<fill_style>& fill_styles,
-    const std::vector<line_style>& line_styles)
+  draw_shape_character(shape_character_def *def, const SWFMatrix& mat,
+    const cxform& cx)
   {
   
     const PathVec& path_vec = def->get_paths();
@@ -1642,6 +1639,9 @@
 
     std::vector<PathVec::const_iterator> subshapes = find_subshapes(path_vec);
     
+    const std::vector<fill_style>& fill_styles = def->get_fill_styles();
+    const std::vector<line_style>& line_styles = def->get_line_styles();
+    
     for (size_t i = 0; i < subshapes.size()-1; ++i) {
       PathVec subshape_paths;
       

=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2008-12-28 10:01:13 +0000
+++ b/libcore/Button.cpp        2009-01-22 14:35:44 +0000
@@ -241,9 +241,11 @@
 
     as_c_function_ptr gettersetter;
 
-    //
-    // Properties (TODO: move to appropriate SWF version section)
-    //
+    o.init_property(NSV::PROP_uQUALITY, character::quality,
+            character::quality);
+    
+    o.init_property(NSV::PROP_uHIGHQUALITY, character::highquality,
+            character::highquality);
 
     gettersetter = &character::x_getset;
     o.init_property(NSV::PROP_uX, *gettersetter, *gettersetter);

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-01-19 16:35:55 +0000
+++ b/libcore/TextField.cpp     2009-01-22 14:35:44 +0000
@@ -2765,10 +2765,15 @@
             character::xmouse_get, character::xmouse_get, propFlags);
     o.init_property(NSV::PROP_uYMOUSE,
             character::ymouse_get, character::ymouse_get, propFlags);
+    o.init_property(NSV::PROP_uHIGHQUALITY,
+            character::highquality, character::highquality);
+    o.init_property(NSV::PROP_uQUALITY,
+            character::quality, character::quality);
     o.init_property(NSV::PROP_uXSCALE,
             character::xscale_getset, character::xscale_getset);
     o.init_property(NSV::PROP_uYSCALE,
             character::yscale_getset, character::yscale_getset);
+ 
     // Standard flags.
     const int flags = as_prop_flags::dontDelete
         |as_prop_flags::dontEnum;

=== modified file 'libcore/asobj/TextFormat_as.cpp'
--- a/libcore/asobj/TextFormat_as.cpp   2008-12-19 20:47:50 +0000
+++ b/libcore/asobj/TextFormat_as.cpp   2009-01-22 14:36:58 +0000
@@ -209,7 +209,7 @@
 as_value
 textformat_display(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl("TextField.display") );
+       LOG_ONCE( log_unimpl("TextFormat.display") );
        return as_value();
 }
 
@@ -240,7 +240,7 @@
 as_value
 textformat_tabStops(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl("TextField.tabStops") );
+       LOG_ONCE( log_unimpl("TextFormat.tabStops") );
        return as_value();
 }
 
@@ -436,14 +436,14 @@
 as_value
 textformat_target(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl("TextField.target") );
+       LOG_ONCE( log_unimpl("TextFormat.target") );
        return as_value();
 }
 
 as_value
 textformat_url(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl("TextField.url") );
+       LOG_ONCE( log_unimpl("TextFormat.url") );
        return as_value();
 }
 
@@ -516,7 +516,7 @@
 as_value
 textformat_getTextExtent(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl("TextField.getTextExtent") );
+       LOG_ONCE( log_unimpl("TextFormat.getTextExtent") );
        return as_value();
 }
 

=== modified file 'libcore/cxform.cpp'
--- a/libcore/cxform.cpp        2009-01-20 08:11:19 +0000
+++ b/libcore/cxform.cpp        2009-01-22 14:52:53 +0000
@@ -68,20 +68,22 @@
 void    cxform::transform(boost::uint8_t& r, boost::uint8_t& g, 
boost::uint8_t& b, boost::uint8_t& a) const
 {
     // force conversion to int16 first, kind of optimization.
-    boost::uint16_t rt = r;
-    boost::uint16_t gt = g;
-    boost::uint16_t bt = b;
-    boost::uint16_t at = a;
+    int16_t rt = (int16_t)r;
+    int16_t gt = (int16_t)g;
+    int16_t bt = (int16_t)b;
+    int16_t at = (int16_t)a;
     
     rt = (rt * ra >> 8) + rb;
     gt = (gt * ga >> 8) + gb;
     bt = (bt * ba >> 8) + bb;
     at = (at * aa >> 8) + ab;
 
-    r = std::min<boost::uint16_t>(rt, 255);
-    g = std::min<boost::uint16_t>(gt, 255);
-    b = std::min<boost::uint16_t>(bt, 255);
-    a = std::min<boost::uint16_t>(at, 255);
+    using utility::clamp;
+    
+    r = (uint8_t)(clamp<int16_t>(rt, 0, 255));
+    g = (uint8_t)(clamp<int16_t>(gt, 0, 255));
+    b = (uint8_t)(clamp<int16_t>(bt, 0, 255));
+    a = (uint8_t)(clamp<int16_t>(at, 0, 255));
 }
 
 void    cxform::read_rgb(SWFStream& in)

=== modified file 'libcore/parser/shape_character_def.cpp'
--- a/libcore/parser/shape_character_def.cpp    2009-01-05 09:32:03 +0000
+++ b/libcore/parser/shape_character_def.cpp    2009-01-22 14:36:37 +0000
@@ -544,18 +544,6 @@
     gnash::render::draw_shape_character(this, inst);
 }
 
-void  shape_character_def::display(const SWFMatrix& mat, const cxform& cx,
-    const std::vector<fill_style>& fill_styles,
-    const std::vector<line_style>& line_styles) const
-{
-    shape_character_def* this_non_const =
-        const_cast<shape_character_def*>(this);
-
-    render_handler* renderer = get_render_handler();
-
-    renderer->draw_shape_character(this_non_const, mat, cx, fill_styles,
-                                   line_styles);
-}
 
 // TODO: this should be moved to libgeometry or something
 // Finds the quadratic bezier curve crossings with the line Y.

=== modified file 'libcore/parser/shape_character_def.h'
--- a/libcore/parser/shape_character_def.h      2009-01-05 09:32:03 +0000
+++ b/libcore/parser/shape_character_def.h      2009-01-22 14:36:37 +0000
@@ -78,10 +78,6 @@
     void read(SWFStream& in, SWF::TagType tag, bool with_style,
             movie_definition& m);
 
-    void display(const SWFMatrix& mat, const cxform& cx,
-        const std::vector<fill_style>& fill_styles,
-        const std::vector<line_style>& line_styles) const;
-
     /// Get cached bounds of this shape.
     const rect&        get_bound() const { return m_bound; }
 

=== modified file 'libcore/swf/TextRecord.cpp'
--- a/libcore/swf/TextRecord.cpp        2009-01-19 16:35:55 +0000
+++ b/libcore/swf/TextRecord.cpp        2009-01-22 14:36:37 +0000
@@ -165,11 +165,6 @@
         // chars that share a particular style.
         const TextRecord& rec = *i;
 
-        // Used to pass a color on to shape_character::display()
-        // FIXME: this isn't very good, especially the line style.
-        static std::vector<fill_style> s_dummy_style(1, fill_style());    
-        static std::vector<line_style> s_dummy_line_style;
-
         const Font* fnt = rec.getFont();
         if (!fnt) {
             IF_VERBOSE_MALFORMED_SWF(
@@ -192,8 +187,6 @@
 
         boost::int16_t startX = x; // for the underline, if any
 
-        s_dummy_style[0].set_color(rec.color());
-
         rgba textColor = cx.transform(rec.color());
 
         for (Glyphs::const_iterator j = rec.glyphs().begin(),

=== modified file 'testsuite/actionscript.all/TextField.as'
--- a/testsuite/actionscript.all/TextField.as   2008-11-06 13:56:00 +0000
+++ b/testsuite/actionscript.all/TextField.as   2009-01-22 14:35:44 +0000
@@ -297,10 +297,10 @@
 
 // Check TextField._highquality
 
-xcheck_equals(typeof(tf._highquality), 'number');
+check_equals(typeof(tf._highquality), 'number');
 check(!tf.hasOwnProperty('_highquality'));
-check(!tf.__proto__.hasOwnProperty('_highquality'));
-xcheck_equals(tf._highquality, 1);
+xcheck(!tf.__proto__.hasOwnProperty('_highquality'));
+check_equals(tf._highquality, 1);
 tf._highquality = 0;
 check_equals(tf._highquality, 0);
 tf._highquality = 1;
@@ -486,14 +486,14 @@
 // Check TextField.quality
 
 // TODO: check this, might be a string
-xcheck_equals(typeof(tf._quality), 'string');
-check(!tf.hasOwnProperty('quality'));
-check(!tf.__proto__.hasOwnProperty('quality'));
-check(!tf.__proto__.__proto__.hasOwnProperty('quality'));
-check(!tf.__proto__.__proto__.__proto__.hasOwnProperty('quality'));
-xcheck_equals(tf._quality, "HIGH");
+check_equals(typeof(tf._quality), 'string');
+check(!tf.hasOwnProperty('_quality'));
+xcheck(!tf.__proto__.hasOwnProperty('_quality'));
+check(!tf.__proto__.__proto__.hasOwnProperty('_quality'));
+check(!tf.__proto__.__proto__.__proto__.hasOwnProperty('_quality'));
+check_equals(tf._quality, "HIGH");
 tf._quality = "FAKE VALUE";
-xcheck_equals(tf._quality, "HIGH");
+check_equals(tf._quality, "HIGH");
 tf._quality = "LOW";
 check_equals(tf._quality, "LOW");
 tf._quality = "HIGH";

=== modified file 'testsuite/misc-ming.all/DrawingApiTestRunner.cpp'
--- a/testsuite/misc-ming.all/DrawingApiTestRunner.cpp  2008-10-25 10:38:32 
+0000
+++ b/testsuite/misc-ming.all/DrawingApiTestRunner.cpp  2009-01-22 15:28:34 
+0000
@@ -369,7 +369,14 @@
        // Check hitdetector bounds and reactions on mouse movement 
        //--------------------------------------------------------------
 
-       typedef struct IntPoint { int x; int y; IntPoint(int nx, int ny) : 
x(nx), y(ny) {} };
+       struct IntPoint {
+        int x;
+        int y;
+        IntPoint(int nx, int ny)
+            :
+            x(nx), y(ny)
+        {}
+    };
 
        IntPoint c1s(6, 346); // top-right of first yellow circle (in when 
small)
        IntPoint c1b(16, 329); // top-right of first yellow circle (in when 
big, out when small)
@@ -728,7 +735,7 @@
        // Upper-On_09_stroke
        // AGG fails rendering a white stroke on the red background.
        // Cairo succeeds.
-       xcheck_pixel(xo + (20*scale), yo + (15*scale), 2, red, 2);
+       check_pixel(xo + (20*scale), yo + (15*scale), 2, red, 2);
        // Upper-Right
        check_pixel(xo + (35*scale), yo + (15*scale), 2, red, 2);
 
@@ -749,7 +756,7 @@
        // On the 0-9 stroke, out of fill 
        // AGG fails rendering a white stroke on the red background.
        // Cairo succeeds.
-       xcheck_pixel(xo + (20*scale), yo + (25*scale), 3, white, 2);
+       check_pixel(xo + (20*scale), yo + (25*scale), 3, white, 2);
 
        //----------------------------------------------------------
        // TODO: check startDrag/stopDrag on the hit detector


reply via email to

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