From: <md...@us...> - 2009-09-01 14:06:43
|
Revision: 7625 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7625&view=rev Author: mdehoon Date: 2009-09-01 14:06:35 +0000 (Tue, 01 Sep 2009) Log Message: ----------- Adding calls to gc.restore() whenever new_gc is called. This is necessary for the Mac OS X and the Cairo backend to work correctly. Also, updating the Mac OS X backend to be consistent with recent changes in SVN. See issue 2844845 on sourceforge. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/figure.py trunk/matplotlib/lib/matplotlib/image.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-09-01 13:03:20 UTC (rev 7624) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-09-01 14:06:35 UTC (rev 7625) @@ -1749,6 +1749,7 @@ self.patch.get_transform())) renderer.draw_image(gc, round(l), round(b), im) + gc.restore() if dsu_rasterized: for zorder, i, a in dsu_rasterized: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-09-01 13:03:20 UTC (rev 7624) +++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-09-01 14:06:35 UTC (rev 7625) @@ -58,21 +58,42 @@ rgbFace = tuple(rgbFace) gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace) - def draw_path_collection(self, *args): - # TODO: We should change this in the C code eventually, but this - # re-ordering of arguments should work for now - gc = args[0] - args = tuple([gc, args[1], gc.get_clip_rectangle()] + \ - list(gc.get_clip_path()) + list(args[2:])) - gc.draw_path_collection(*args) + def draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls): + cliprect = gc.get_clip_rectangle() + clippath, clippath_transform = gc.get_clip_path() + gc.draw_path_collection(master_transform, + cliprect, + clippath, + clippath_transform, + paths, + all_transforms, + offsets, + offsetTrans, + facecolors, + edgecolors, + linewidths, + linestyles, + antialiaseds) - def draw_quad_mesh(self, *args): - # TODO: We should change this in the C code eventually, but this - # re-ordering of arguments should work for now - gc = args[0] - args = [gc, args[1], gc.get_clip_rectangle()] + \ - list(gc.get_clip_path()) + list(args[2:]) - gc.draw_quad_mesh(*args) + def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, + coordinates, offsets, offsetTrans, facecolors, + antialiased, showedges): + cliprect = gc.get_clip_rectangle() + clippath, clippath_transform = gc.get_clip_path() + gc.draw_quad_mesh(master_transform, + cliprect, + clippath, + clippath_transform, + meshWidth, + meshHeight, + coordinates, + offsets, + offsetTrans, + facecolors, + antialiased, + showedges) def new_gc(self): self.gc.save() @@ -80,8 +101,6 @@ return self.gc def draw_image(self, gc, x, y, im): - # TODO: We should change this in the C code eventually, but this - # re-ordering of arguments should work for now im.flipud_out() nrows, ncols, data = im.as_rgba_str() gc.draw_image(x, y, nrows, ncols, data, gc.get_clip_rectangle(), Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009-09-01 13:03:20 UTC (rev 7624) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009-09-01 14:06:35 UTC (rev 7625) @@ -214,6 +214,8 @@ gc, transform.frozen(), paths, self.get_transforms(), offsets, transOffset, self.get_facecolor(), self.get_edgecolor(), self._linewidths, self._linestyles, self._antialiaseds, self._urls) + + gc.restore() renderer.close_group(self.__class__.__name__) def contains(self, mouseevent): @@ -1223,6 +1225,7 @@ gc, transform.frozen(), self._meshWidth, self._meshHeight, coordinates, offsets, transOffset, self.get_facecolor(), self._antialiased, self._showedges) + gc.restore() renderer.close_group(self.__class__.__name__) Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-09-01 13:03:20 UTC (rev 7624) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-09-01 14:06:35 UTC (rev 7625) @@ -766,6 +766,7 @@ gc.set_clip_rectangle(self.bbox) gc.set_clip_path(self.get_clip_path()) renderer.draw_image(gc, l, b, im) + gc.restore() # render the axes for a in self.axes: a.draw(renderer) Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2009-09-01 13:03:20 UTC (rev 7624) +++ trunk/matplotlib/lib/matplotlib/image.py 2009-09-01 14:06:35 UTC (rev 7625) @@ -142,6 +142,7 @@ gc.set_clip_rectangle(self.axes.bbox.frozen()) gc.set_clip_path(self.get_clip_path()) renderer.draw_image(gc, l, b, im) + gc.restore() def contains(self, mouseevent): """ @@ -637,6 +638,7 @@ round(self.axes.bbox.xmin), round(self.axes.bbox.ymin), im) + gc.restore() def set_data(self, x, y, A): @@ -790,6 +792,7 @@ gc.set_clip_rectangle(self.figure.bbox) gc.set_clip_path(self.get_clip_path()) renderer.draw_image(gc, round(self.ox), round(self.oy), im) + gc.restore() def write_png(self, fname): """Write the image to png file with fname""" @@ -931,6 +934,7 @@ self._set_gc_clip(gc) #gc.set_clip_path(self.get_clip_path()) renderer.draw_image(gc, round(l), round(b), im) + gc.restore() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |