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_ogl.cpp


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp
Date: Fri, 30 Nov 2007 05:58:49 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/11/30 05:58:49

Modified files:
        .              : ChangeLog 
        backend        : render_handler_ogl.cpp 

Log message:
        Draw rounded outlines. Fixes bug #20085.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5022&r2=1.5023
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.96&r2=1.97

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5022
retrieving revision 1.5023
diff -u -b -r1.5022 -r1.5023
--- ChangeLog   30 Nov 2007 00:13:00 -0000      1.5022
+++ ChangeLog   30 Nov 2007 05:58:48 -0000      1.5023
@@ -1,3 +1,8 @@
+2007-11-29 Bastiaan Jacques <address@hidden>
+
+       * backend/render_handler_ogl.cpp: Draw rounded outlines. Fixes bug
+       #20085.
+
 2007-11-29 Tomas Groth Christensen <address@hidden>
 
        * libmedia/Makefile.am: Added new files.

Index: backend/render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- backend/render_handler_ogl.cpp      29 Nov 2007 23:48:33 -0000      1.96
+++ backend/render_handler_ogl.cpp      30 Nov 2007 05:58:48 -0000      1.97
@@ -1240,7 +1240,7 @@
   
   
   
-  void apply_line_style(const line_style& style, const cxform& cx, const 
matrix& mat)
+  bool apply_line_style(const line_style& style, const cxform& cx, const 
matrix& mat)
   {
   //  GNASH_REPORT_FUNCTION;
      
@@ -1249,6 +1249,8 @@
     glDisable(GL_TEXTURE_2D);
     
     
+    bool rv = true;
+    
     float width = style.get_width();
     
     if (width <= 1.0f) {
@@ -1270,13 +1272,25 @@
                   " requested. Lines will be drawn with reduced width.");
       }
       
+      
       glLineWidth(width);
-      glPointSize(width);
+      
+      if (width >= 1.5) {
+        
+        glPointSize(width-1);
+      } else {
+        // Don't draw rounded lines.
+        rv = false;
+      }
+      
+      
     }
 
     rgba c = cx.transform(style.get_color());
 
     glColor4ub(c.m_r, c.m_g, c.m_b, c.m_a);
+    
+    return rv;
   }
  
   PathPointMap getPathPoints(const PathVec& path_vec)
@@ -1302,6 +1316,11 @@
   
   typedef std::vector<const path*> PathPtrVec;
   
+  static void
+  draw_point(const edge& point_edge)
+  {  
+    glVertex2d(point_edge.ap.x, point_edge.ap.y);  
+  }
     
   void
   draw_outlines(const PathVec& path_vec, const PathPointMap& pathpoints, const 
matrix& mat,
@@ -1317,31 +1336,33 @@
         continue;
       }
       
-      apply_line_style(line_styles[cur_path.m_line-1], cx, mat);
+      bool draw_points = apply_line_style(line_styles[cur_path.m_line-1], cx, 
mat);
       
       assert(pathpoints.find(&cur_path) != pathpoints.end());
       
       const std::vector<oglVertex>& shape_points = 
(*pathpoints.find(&cur_path)).second;
       
-      //glDisable(GL_TEXTURE_1D);
-      //glDisable(GL_TEXTURE_2D);
       // Draw outlines.
       glEnableClientState(GL_VERTEX_ARRAY);
       glVertexPointer(3, GL_DOUBLE, 0 /* tight packing */, 
&shape_points.front());
       glDrawArrays(GL_LINE_STRIP, 0, shape_points.size());
+      glDisableClientState(GL_VERTEX_ARRAY);
       
-      // Draw a dot on the beginning and end coordinates to round lines.
-      //   glVertexPointer: skip all but the first and last coordinates in the 
line.
-      glVertexPointer(3, GL_DOUBLE, (sizeof(GLdouble) * 3) * 
(shape_points.size() - 1), &shape_points.front());
-      glEnable(GL_POINT_SMOOTH); // Draw a round (antialiased) point.
-      glDrawArrays(GL_POINTS, 0, 2);
-      glDisable(GL_POINT_SMOOTH);
-      glPointSize(1); // return to default
-        
+      if (!draw_points) {
+        continue;
+      }
       
-      glDisableClientState(GL_VERTEX_ARRAY);
+      // Drawing points on the edges will allow us to simulate rounded lines.
       
+      glEnable(GL_POINT_SMOOTH); // Draw round points.      
       
+      glBegin(GL_POINTS);
+      {
+        glVertex2d(cur_path.ap.x, cur_path.ap.y);
+        std::for_each(cur_path.m_edges.begin(), cur_path.m_edges.end(),
+                      draw_point);
+      }
+      glEnd();
     }
   }
 




reply via email to

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