Revision: 8636
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8636&view=rev
Author:   mdboom
Date:     2010-08-16 19:56:27 +0000 (Mon, 16 Aug 2010)

Log Message:
-----------
Add explicit "CLOSEPOLY" codes to unit_rectangle, unit_polygon,
unit_star and unit_asterisk.  Not doing so causes the strokes to have
the wrong end cap at the beginning/end point.

Modified Paths:
--------------
    branches/v1_0_maint/lib/matplotlib/path.py

Modified: branches/v1_0_maint/lib/matplotlib/path.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/path.py  2010-08-16 15:06:58 UTC (rev 
8635)
+++ branches/v1_0_maint/lib/matplotlib/path.py  2010-08-16 19:56:27 UTC (rev 
8636)
@@ -384,7 +384,8 @@
         """
         if cls._unit_rectangle is None:
             cls._unit_rectangle = \
-                cls([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 
0.0]])
+                cls([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 
0.0]],
+                    [cls.MOVETO, cls.LINETO, cls.LINETO, cls.LINETO, 
cls.CLOSEPOLY])
         return cls._unit_rectangle
 
     _unit_regular_polygons = WeakValueDictionary()
@@ -407,8 +408,13 @@
             # "points-up"
             theta += np.pi / 2.0
             verts = np.concatenate((np.cos(theta), np.sin(theta)), 1)
-            path = cls(verts)
-            cls._unit_regular_polygons[numVertices] = path
+            codes = np.empty((numVertices,))
+            codes[0] = cls.MOVETO
+            codes[1:-1] = cls.LINETO
+            codes[-1] = cls.CLOSEPOLY
+            path = cls(verts, codes)
+            if numVertices <= 16:
+                cls._unit_regular_polygons[numVertices] = path
         return path
 
     _unit_regular_stars = WeakValueDictionary()
@@ -433,8 +439,13 @@
             r = np.ones(ns2 + 1)
             r[1::2] = innerCircle
             verts = np.vstack((r*np.cos(theta), r*np.sin(theta))).transpose()
+            codes = np.empty((ns2,))
+            codes[0] = cls.MOVETO
+            codes[1:-1] = cls.LINETO
+            codes[-1] = cls.CLOSEPOLY
             path = cls(verts)
-            cls._unit_regular_polygons[(numVertices, innerCircle)] = path
+            if numVertices <= 16:
+                cls._unit_regular_polygons[(numVertices, innerCircle)] = path
         return path
 
     @classmethod


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to