Revision: 8949 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8949&view=rev Author: efiring Date: 2011-02-06 01:55:50 +0000 (Sun, 06 Feb 2011)
Log Message: ----------- PcolorImage: use local cache instead of the ScalarMappable.update_dict Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/cm.py trunk/matplotlib/lib/matplotlib/image.py Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2011-02-06 00:43:54 UTC (rev 8948) +++ trunk/matplotlib/lib/matplotlib/cm.py 2011-02-06 01:55:50 UTC (rev 8949) @@ -43,7 +43,7 @@ def _reverse_cmap_spec(spec): """Reverses cmap specification *spec*, can handle both dict and tuple type specs.""" - + if 'red' in spec: return revcmap(spec) else: @@ -53,9 +53,9 @@ return revspec def _generate_cmap(name, lutsize): - """Generates the requested cmap from it's name *name*. The lut size is + """Generates the requested cmap from it's name *name*. The lut size is *lutsize*.""" - + spec = datad[name] # Generate the colormap object. Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2011-02-06 00:43:54 UTC (rev 8948) +++ trunk/matplotlib/lib/matplotlib/image.py 2011-02-06 01:55:50 UTC (rev 8949) @@ -97,7 +97,7 @@ self._imcache = None - # this is an expetimental attribute, if True, unsampled image + # this is an experimental attribute, if True, unsampled image # will be drawn using the affine transform that are # appropriately skewed so that the given postition # corresponds to the actual position in the coordinate. -JJL @@ -797,6 +797,9 @@ cm.ScalarMappable.__init__(self, norm, cmap) self.axes = ax self._rgbacache = None + # There is little point in caching the image itself because + # it needs to be remade if the bbox or viewlim change, + # so caching does help with zoom/pan/resize. self.update(kwargs) self.set_data(x, y, A) @@ -811,7 +814,7 @@ height = (round(t) + 0.5) - (round(b) - 0.5) width = width * magnification height = height * magnification - if self.check_update('array'): + if self._rgbacache is None: A = self.to_rgba(self._A, alpha=self._alpha, bytes=True) self._rgbacache = A if self._A.ndim == 2: @@ -827,9 +830,14 @@ im.is_grayscale = self.is_grayscale return im + def changed(self): + self._rgbacache = None + cm.ScalarMappable.changed(self) + @allow_rasterization def draw(self, renderer, *args, **kwargs): - if not self.get_visible(): return + if not self.get_visible(): + return im = self.make_image(renderer.get_image_magnification()) gc = renderer.new_gc() gc.set_clip_rectangle(self.axes.bbox.frozen()) @@ -871,7 +879,7 @@ self._A = A self._Ax = x self._Ay = y - self.update_dict['array'] = True + self._rgbacache = None def set_array(self, *args): raise NotImplementedError('Method not supported') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins