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: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...
Date: Mon, 05 May 2008 08:47:43 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   08/05/05 08:47:43

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp 
        server         : shape.h 

Log message:
        * server/shape.h: Add isClosed() to Path class
        * backend/render_handler_agg.cpp: Respect doPixelHinting() for
          outlines
        * backend/render_handler_agg.cpp: Remove unused build_agg_strokes()
        * backend/render_handler_agg.cpp: Remove unimplemented pixel hinting 
          warning
        * backend/render_handler_agg.cpp: implement closed polygons and
          check for noClose==0

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6496&r2=1.6497
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.41&r2=1.42

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.6496
retrieving revision 1.6497
diff -u -b -r1.6496 -r1.6497
--- ChangeLog   5 May 2008 08:45:03 -0000       1.6496
+++ ChangeLog   5 May 2008 08:47:41 -0000       1.6497
@@ -1,3 +1,14 @@
+2008-05-05 Udo Giacomozzi <address@hidden>
+
+       * server/shape.h: Add isClosed() to Path class
+       * backend/render_handler_agg.cpp: Respect doPixelHinting() for
+         outlines
+       * backend/render_handler_agg.cpp: Remove unused build_agg_strokes()
+       * backend/render_handler_agg.cpp: Remove unimplemented pixel hinting 
+         warning
+       * backend/render_handler_agg.cpp: implement closed polygons and
+         check for noClose==0
+
 2008-05-05 Sandro Santilli <address@hidden>
 
        * server/asobj/gen-asclass.pl: log_unimpl if constructor

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- backend/render_handler_agg.cpp      2 May 2008 17:11:55 -0000       1.140
+++ backend/render_handler_agg.cpp      5 May 2008 08:47:42 -0000       1.141
@@ -44,7 +44,7 @@
     colors, alpha     COMPLETE
     cap styles        DONE, but end cap style is ignored
     join styles       COMPLETE
-    no-close flag     TODO / currently ignored (noClose==1 assumed)        
+    no-close flag     COMPLETE        
   
     
   fills:
@@ -968,7 +968,7 @@
     // level.
 
     if (have_outline)
-      build_agg_paths_rounded(agg_paths_rounded, paths);
+      build_agg_paths_rounded(agg_paths_rounded, paths, line_styles);
     
     if (have_shape)
       build_agg_paths(agg_paths, paths);
@@ -1143,7 +1143,8 @@
   } //build_agg_paths
   
   
-  // Version of build_agg_paths that uses rounded coordinates.
+  // Version of build_agg_paths that uses rounded coordinates (pixel hinting)
+  // for line styles that want it.  
   // This is used for outlines which are aligned to the pixel grid to avoid
   // anti-aliasing problems (a perfect horizontal line being drawn over two
   // lines and looking blurry). The proprietary player does this too.  
@@ -1154,10 +1155,14 @@
   // Also, single segments of a path may be aligned or not depending on 
   // the segment properties (this matches MM player behaviour)
   //
+  // This function - in contrast to build_agg_paths() - also checks noClose 
+  // flag and automatically closes polygons.
+  //
   // TODO: Flash never aligns lines that are wider than 1 pixel on *screen*,
   // but we currently don't check the width.  
   void build_agg_paths_rounded(std::vector<agg::path_storage>& dest, 
-    const std::vector< Path<float> >& paths) {
+    const std::vector< Path<float> >& paths, 
+    const std::vector<line_style>& line_styles) {
   
     // Shift all coordinates a half pixel for correct results (the middle of
     // a pixel is at .5 / .5, ie. it's subpixel center) 
@@ -1172,6 +1177,11 @@
       const Path<float>& this_path = paths[pno];
       agg::path_storage& new_path = dest[pno];
       
+      const line_style& lstyle = line_styles[this_path.m_line-1];
+      
+      const bool hinting = lstyle.doPixelHinting();
+      bool closed = this_path.isClosed() && !lstyle.noClose();
+      
       float prev_ax = this_path.ap.x;
       float prev_ay = this_path.ap.y;  
       bool prev_align_x = true;
@@ -1179,6 +1189,10 @@
       
       size_t ecount = this_path.m_edges.size();
       
+      // avoid extra edge when doing implicit close later
+      if (closed && ecount && 
+        this_path.m_edges.back().is_straight()) ecount--;      
+      
       for (size_t eno=0; eno<ecount; eno++) {
         
         const Edge<float>& this_edge = this_path.m_edges[eno];
@@ -1186,7 +1200,7 @@
         float this_ax = this_edge.ap.x;  
         float this_ay = this_edge.ap.y;  
         
-        if (this_edge.is_straight()) {
+        if (hinting && this_edge.is_straight()) {
         
           // candidate for alignment?
           bool align_x = prev_ax == this_ax;
@@ -1268,70 +1282,12 @@
         
       } //for
     
-    }
-        
-  } //build_agg_paths_rounded
-  
-  
-  // Builds vector strokes for paths
-  // WARNING 1 : This is not used and will probably be removed soon.
-  // WARNING 2 : Strokes vector returns pointers which are never freed.
-  void build_agg_strokes(std::vector<stroke_type*>& dest, 
-    std::vector<agg::path_storage>& agg_paths,
-    const std::vector< Path<float> > &paths,
-    const std::vector<line_style> &line_styles,
-    const matrix& linestyle_matrix) {
-    
-    abort(); // should not be used currently
-    
-    size_t pcount=paths.size(); 
-    dest.resize(pcount);
-    
-    // use avg between x and y scale
-    const float stroke_scale = 
-      (fabsf(linestyle_matrix.get_x_scale()) + 
-       fabsf(linestyle_matrix.get_y_scale()))
-       / 2.0f
-      * get_stroke_scale();   
-    
-    for (size_t pno=0; pno<pcount; pno++) {
-          
-      agg::conv_curve<agg::path_storage> curve(agg_paths[pno]);
-      stroke_type* this_stroke = new stroke_type(curve);
-      
-      const Path<float>& this_path_gnash = paths[pno];
-       
-      const line_style& lstyle = line_styles[this_path_gnash.m_line-1];
-          
-      int thickness = lstyle.getThickness();
-      if (!thickness) this_stroke->width(1); // hairline
-      else if ( (!lstyle.scaleThicknessVertically()) && 
(!lstyle.scaleThicknessHorizontally()) )
-      {
-        this_stroke->width(TWIPS_TO_PIXELS(thickness));
-      }
-      else
-      {
-        if ( (!lstyle.scaleThicknessVertically()) || 
(!lstyle.scaleThicknessHorizontally()) )
-        {
-           LOG_ONCE( log_unimpl(_("Unidirectionally scaled strokes in AGG 
renderer (we'll scale by the scalable one)")) );
-        }
-        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);
-      
-      dest[pno] = this_stroke;
+      if (closed)
+        new_path.close_polygon();
     
     }
+  } //build_agg_paths_rounded
     
-  }
   
   // Initializes the internal styles class for AGG renderer
   void build_agg_styles(agg_style_handler& sh, 
@@ -1785,11 +1741,6 @@
           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/shape.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/shape.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/shape.h      29 Apr 2008 11:29:03 -0000      1.41
+++ server/shape.h      5 May 2008 08:47:43 -0000       1.42
@@ -418,6 +418,14 @@
     /// @} Primitives for the Drawing API
 
 
+    /// Returns true if the last and the first point of the path match
+    bool
+    isClosed() const 
+    {
+      if ( m_edges.empty() ) return true;  
+      
+      return m_edges.back().ap == ap; 
+    }
 
     /// Close this path with a straight line, if not already closed
     void




reply via email to

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