gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...
Date: Fri, 02 May 2008 17:11:57 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/05/02 17:11:57

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp 
        server         : DynamicShape.cpp DynamicShape.h 
                         sprite_instance.cpp sprite_instance.h 
                         styles.cpp styles.h 

Log message:
                * server/DynamicShape.{cpp,h}, server/sprite_instance.{cpp,h},
                  server/styles.{cpp,h}: Add support for all known parameters
                  in the lineStyle call for swf8 up.
                * backend/render_handler_agg.cpp: log_unimpl about pixel
                  hinting in line styles.
        
        NOTE: miter limit factor is in the range 1..255 (and used so by AGG).
              why are we using a float in line_style then ?

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6477&r2=1.6478
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.139&r2=1.140
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.526&r2=1.527
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.190&r2=1.191
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.h?cvsroot=gnash&r1=1.29&r2=1.30

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6477
retrieving revision 1.6478
diff -u -b -r1.6477 -r1.6478
--- ChangeLog   2 May 2008 15:19:09 -0000       1.6477
+++ ChangeLog   2 May 2008 17:11:54 -0000       1.6478
@@ -1,3 +1,11 @@
+2008-05-02 Sandro Santilli <address@hidden>
+
+       * server/DynamicShape.{cpp,h}, server/sprite_instance.{cpp,h},
+         server/styles.{cpp,h}: Add support for all known parameters
+         in the lineStyle call for swf8 up.
+       * backend/render_handler_agg.cpp: log_unimpl about pixel
+         hinting in line styles.
+
 2008-05-02 Udo Giacomozzi <address@hidden>
 
        * server/style.{cpp,h}: fixed default constructor

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -b -r1.139 -r1.140
--- backend/render_handler_agg.cpp      2 May 2008 15:19:12 -0000       1.139
+++ backend/render_handler_agg.cpp      2 May 2008 17:11:55 -0000       1.140
@@ -1318,6 +1318,11 @@
         this_stroke->width(thickness*stroke_scale);
       }
        
+      if ( lstyle.doPixelHinting() )
+      {
+           LOG_ONCE( log_unimpl(_("Strokes pixel-hinting in AGG renderer")) );
+      }
+       
       this_stroke->attach(curve);
       this_stroke->line_cap(agg::round_cap);
       this_stroke->line_join(agg::round_join);
@@ -1780,6 +1785,11 @@
           stroke.width(std::max(1.0f, thickness*stroke_scale));
         }
         
+        if ( lstyle.doPixelHinting() )
+        {
+           LOG_ONCE( log_unimpl(_("Strokes pixel-hinting in AGG renderer")) );
+        }
+
         // TODO: support endCapStyle
         
         // TODO: When lstyle.noClose==0 and the start and end point matches,

Index: server/DynamicShape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/DynamicShape.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/DynamicShape.cpp     29 Apr 2008 11:29:02 -0000      1.19
+++ server/DynamicShape.cpp     2 May 2008 17:11:55 -0000       1.20
@@ -159,9 +159,15 @@
 }
 
 void
-DynamicShape::lineStyle(boost::uint16_t thickness, const rgba& color, bool 
vScale, bool hScale)
-{
-       line_style style(thickness, color, vScale, hScale);
+DynamicShape::lineStyle(boost::uint16_t thickness, const rgba& color,
+       bool vScale, bool hScale, bool pixelHinting, bool noClose,
+       cap_style_e startCapStyle, cap_style_e endCapStyle,
+       join_style_e joinStyle, float miterLimitFactor)
+{
+       line_style style(thickness, color, vScale, hScale, pixelHinting,
+               noClose, startCapStyle, endCapStyle, joinStyle,
+               miterLimitFactor);
+
        _currline = add_line_style(style);
        startNewPath(false); // don't make this the start of a new subshape (to 
verify)
 }

Index: server/DynamicShape.h
===================================================================
RCS file: /sources/gnash/gnash/server/DynamicShape.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/DynamicShape.h       29 Apr 2008 11:29:02 -0000      1.13
+++ server/DynamicShape.h       2 May 2008 17:11:55 -0000       1.14
@@ -21,6 +21,7 @@
 #define GNASH_DYNAMIC_SHAPE_H
 
 #include "shape_character_def.h"  // for inheritance
+#include "styles.h" // for cap_style_e and join_style_e enums
 
 namespace gnash {
 
@@ -62,7 +63,33 @@
        void endFill();
 
        /// Set current line style and start a new path.
-       void lineStyle(boost::uint16_t thickness, const rgba& color, bool 
vScale=true, bool hScale=true);
+       //
+       /// @param thickness
+       ///
+       /// @param color
+       ///
+       /// @param vScale
+       ///
+       /// @param hScale
+       ///
+       /// @param noClose
+       ///
+       /// @param startCapStyle
+       ///
+       /// @param endCapStyle
+       ///
+       /// @param joinStyle
+       ///
+       /// @param miterLimitFactor
+       ///
+       void lineStyle(boost::uint16_t thickness, const rgba& color,
+               bool vScale=true, bool hScale=true,
+               bool pixelHinting=false,
+               bool noClose=false,
+               cap_style_e startCapStyle=CAP_ROUND,
+               cap_style_e endCapStyle=CAP_ROUND,
+               join_style_e joinStyle=JOIN_ROUND,
+               float miterLimitFactor=1.0f);
 
        /// Reset line style to no style and start a new path.
        void resetLineStyle();

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.526
retrieving revision 1.527
diff -u -b -r1.526 -r1.527
--- server/sprite_instance.cpp  30 Apr 2008 09:22:30 -0000      1.526
+++ server/sprite_instance.cpp  2 May 2008 17:11:56 -0000       1.527
@@ -54,6 +54,7 @@
 #include "DynamicShape.h" // for composition
 #include "namedStrings.h"
 #include "fill_style.h" // for beginGradientFill
+#include "styles.h" // for cap_style_e and join_style_e enums
 #include "PlaceObject2Tag.h" 
 
 #ifdef USE_SWFTREE
@@ -1358,6 +1359,11 @@
   thickness = 
boost::uint16_t(PIXELS_TO_TWIPS(boost::uint16_t(fclamp(fn.arg(0).to_number(), 
0, 255))));
   bool scaleThicknessVertically = true;
   bool scaleThicknessHorizontally = true;
+  bool pixelHinting = false;
+  bool noClose = false;
+  cap_style_e capStyle = CAP_ROUND;
+  join_style_e joinStyle = JOIN_ROUND;
+  float miterLimitFactor = 1.0f;
 
   if ( fn.nargs > 1 )
   {
@@ -1384,8 +1390,7 @@
         }
         else
         {
-          bool pixelHinting = fn.arg(3).to_bool();
-          if ( pixelHinting) LOG_ONCE( log_unimpl(_("pixelHinting in 
MovieClip.lineStyle")) );
+          pixelHinting = fn.arg(3).to_bool();
           if ( fn.nargs > 4 )
           {
             std::string noScaleString = fn.arg(4).to_string();
@@ -1412,13 +1417,64 @@
             {
               IF_VERBOSE_ASCODING_ERRORS(
               std::stringstream ss; fn.dump_args(ss);
-              log_aserror(_("MovieClip.lineStyle(%s): invalid noScale value 
'%s'"), ss.str(), noScaleString);
+              log_aserror(_("MovieClip.lineStyle(%s): invalid noScale value 
'%s' (valid values: %s|%s|%s|%s"),
+                ss.str(), noScaleString, "none", "vertical", "horizontal", 
"normal");
               );
             }
           }
-          if ( fn.nargs > 5 ) LOG_ONCE( log_unimpl(_("capsStyle arg to 
MovieClip.lineStyle")) );
-          if ( fn.nargs > 6 ) LOG_ONCE( log_unimpl(_("jointStyle arg to 
MovieClip.lineStyle")) );
-          if ( fn.nargs > 7 ) LOG_ONCE( log_unimpl(_("miterLimit arg to 
MovieClip.lineStyle")) );
+          if ( fn.nargs > 5 )
+          {
+            std::string capStyleStr = fn.arg(5).to_string();
+            if ( capStyleStr == "none" )
+            {
+              capStyle = CAP_NONE;
+            }
+            else if ( capStyleStr == "round" )
+            {
+              capStyle = CAP_ROUND;
+            }
+            else if ( capStyleStr == "square" )
+            {
+              capStyle = CAP_SQUARE;
+            }
+            else
+            {
+              IF_VERBOSE_ASCODING_ERRORS(
+              std::stringstream ss; fn.dump_args(ss);
+              log_aserror(_("MovieClip.lineStyle(%s): invalid calStyle value 
'%s' (valid values: %s|%s|%s)"), ss.str(),
+                capStyleStr, "none", "round", "square");
+              );
+            }
+          }
+          if ( fn.nargs > 6 )
+          {
+            std::string joinStyleStr = fn.arg(6).to_string();
+            if ( joinStyleStr == "miter" )
+            {
+              joinStyle = JOIN_MITER;
+            }
+            else if ( joinStyleStr == "round" )
+            {
+              joinStyle = JOIN_ROUND;
+            }
+            else if ( joinStyleStr == "bevel" )
+            {
+              joinStyle = JOIN_BEVEL;
+            }
+            else
+            {
+              IF_VERBOSE_ASCODING_ERRORS(
+              std::stringstream ss; fn.dump_args(ss);
+              log_aserror(_("MovieClip.lineStyle(%s): invalid jointStyle value 
'%s' (valid values: %s|%s|%s)"), ss.str(),
+                joinStyleStr, "miter", "round", "bevel");
+              );
+            }
+          }
+          if ( fn.nargs > 7 )
+          {
+            miterLimitFactor = iclamp(fn.arg(7).to_int(), 1, 255);
+          }
+
           IF_VERBOSE_ASCODING_ERRORS(
           if ( fn.nargs > 8 ) 
           {
@@ -1426,6 +1482,7 @@
             log_aserror(_("MovieClip.lineStyle(%s): args after the first eight 
will be discarded"), ss.str());
           }
           )
+
         }
       }
     }
@@ -1438,7 +1495,9 @@
 #ifdef DEBUG_DRAWING_API
   log_debug("%s.lineStyle(%d,%d,%d,%d);", sprite->getTarget(), thickness, r, 
g, b);
 #endif
-  sprite->lineStyle(thickness, color, scaleThicknessVertically, 
scaleThicknessHorizontally);
+  sprite->lineStyle(thickness, color,
+       scaleThicknessVertically, scaleThicknessHorizontally,
+       pixelHinting, noClose, capStyle, capStyle, joinStyle, miterLimitFactor);
 
   return as_value();
 }

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -b -r1.190 -r1.191
--- server/sprite_instance.h    30 Apr 2008 09:15:02 -0000      1.190
+++ server/sprite_instance.h    2 May 2008 17:11:56 -0000       1.191
@@ -667,9 +667,19 @@
 
        /// @{ Drawing API
        
-       void lineStyle(boost::uint16_t thickness, const rgba& color, bool 
vScale=true, bool hScale=true)
-       {
-               _drawable->lineStyle(thickness, color, vScale, hScale);
+       void lineStyle(boost::uint16_t thickness, const rgba& color,
+               bool vScale=true, bool hScale=true,
+               bool pixelHinting=false,
+               bool noClose=false,
+               cap_style_e startCapStyle=CAP_ROUND,
+               cap_style_e endCapStyle=CAP_ROUND,
+               join_style_e joinStyle=JOIN_ROUND,
+               float miterLimitFactor=1.0f)
+       {
+               _drawable->lineStyle(thickness, color, vScale, hScale,
+                       pixelHinting, noClose,
+                       startCapStyle, endCapStyle, joinStyle,
+                       miterLimitFactor);
        }
 
        void resetLineStyle()

Index: server/styles.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/styles.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/styles.cpp   2 May 2008 15:19:11 -0000       1.41
+++ server/styles.cpp   2 May 2008 17:11:56 -0000       1.42
@@ -29,6 +29,7 @@
     m_color(),
     _scaleVertically(true),
     _scaleHorizontally(true),
+    _pixelHinting(false),
                _noClose(false),
                _startCapStyle(CAP_ROUND),
                _endCapStyle(CAP_ROUND),

Index: server/styles.h
===================================================================
RCS file: /sources/gnash/gnash/server/styles.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/styles.h     2 May 2008 15:25:42 -0000       1.29
+++ server/styles.h     2 May 2008 17:11:56 -0000       1.30
@@ -37,17 +37,41 @@
        /// @param color
        ///     Line color
        ///
-       line_style(boost::uint16_t width, const rgba& color, bool 
scaleThicknessVertically, bool scaleThicknessHorizontally)
+       /// @param scaleThicknessVertically
+       ///
+       /// @param scaleThicknessHorizontally
+       ///
+       /// @param noClose
+       ///
+       /// @param startCapStyle
+       ///
+       /// @param endCapStyle
+       ///
+       /// @param joinStyle
+       ///
+       /// @param miterLimitFactor
+       ///
+       line_style(boost::uint16_t width, const rgba& color,
+                       bool scaleThicknessVertically=true,
+                       bool scaleThicknessHorizontally=true,
+                       bool pixelHinting=false,
+                       bool noClose=false,
+                       cap_style_e startCapStyle=CAP_ROUND,
+                       cap_style_e endCapStyle=CAP_ROUND,
+                       join_style_e joinStyle=JOIN_ROUND,
+                       float miterLimitFactor=1.0f
+               )
                :
                m_width(width),
                m_color(color),
                _scaleVertically(scaleThicknessVertically),
                _scaleHorizontally(scaleThicknessHorizontally),
-               _noClose(false),  // TODO: make these constructor arguments?
-               _startCapStyle(CAP_ROUND),
-               _endCapStyle(CAP_ROUND),
-               _joinStyle(JOIN_ROUND),
-               _miterLimitFactor(1.0f)
+               _pixelHinting(pixelHinting),
+               _noClose(noClose),
+               _startCapStyle(startCapStyle),
+               _endCapStyle(endCapStyle),
+               _joinStyle(joinStyle),
+               _miterLimitFactor(miterLimitFactor)
                
        {
        }
@@ -116,6 +140,12 @@
     return _noClose;
   }
 
+       /// Return true if pixel hinting should be activated
+       bool doPixelHinting() const
+       {
+               return _pixelHinting;
+       }
+
        /// Return line color and alpha
        const rgba&     get_color() const { return m_color; }
 
@@ -140,6 +170,7 @@
        rgba    m_color;
        bool _scaleVertically;
        bool _scaleHorizontally;
+       bool _pixelHinting;
        bool _noClose;
        cap_style_e _startCapStyle;
        cap_style_e _endCapStyle;




reply via email to

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