Skip to content

Commit 3c5a73d

Browse files
author
Steve Chaplin
committed
SC 20/11/2004
svn path=/trunk/matplotlib/; revision=702
1 parent d934dd0 commit 3c5a73d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/matplotlib/backends/backend_gtk.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,17 +476,15 @@ def __init__(self, renderer):
476476

477477
def rgb_to_gdk_color(self, rgb):
478478
"""
479-
Take an RGB tuple (with three 0.0-1.0 values) and return an allocated
480-
gtk.gdk.Color
479+
rgb - an RGB tuple (three 0.0-1.0 values)
480+
return an allocated gtk.gdk.Color
481481
"""
482482
try:
483-
#return self._cached[tuple(rgb)] # tuple not needed?
484483
return self._cached[rgb]
485484
except KeyError:
486-
color = self._cmap.alloc_color(
487-
int(rgb[0]*65535),int(rgb[1]*65535),int(rgb[2]*65535))
488-
#self._cached[tuple(rgb)] = color
489-
self._cached[rgb] = color
485+
color = self._cached[rgb] = \
486+
self._cmap.alloc_color(
487+
int(rgb[0]*65535),int(rgb[1]*65535),int(rgb[2]*65535))
490488
return color
491489

492490

0 commit comments

Comments
 (0)