8000 Merge pull request #3683 from jbmohler/nix_orig_color · matplotlib/matplotlib@5ffada3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ffada3

Browse files
committed
Merge pull request #3683 from jbmohler/nix_orig_color
MNT : remove GraphicsContextBase._orig_color which is duplicate of _rgb This is a hold over from the old alpha handling code that is now redundant as we carry rgba values through out.
2 parents 0efdf2f + c22584e commit 5ffada3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ def __init__(self):
784784
self._linestyle = 'solid'
785785
self._linewidth = 1
786786
self._rgb = (0.0, 0.0, 0.0, 1.0)
787-
self._orig_color = (0.0, 0.0, 0.0, 1.0)
788787
self._hatch = None
789788
self._url = None
790789
self._gid = None
@@ -804,7 +803,6 @@ def copy_properties(self, gc):
804803
self._linestyle = gc._linestyle
805804
self._linewidth = gc._linewidth
806805
self._rgb = gc._rgb
807-
self._orig_color = gc._orig_color
808806
self._hatch = gc._hatch
809807
self._url = gc._url
810808
self._gid = gc._gid
@@ -938,7 +936,7 @@ def set_alpha(self, alpha):
938936
else:
939937
self._alpha = 1.0
940938
self._forced_alpha = False
941-
self.set_foreground(self._orig_color)
939+
self.set_foreground(self._rgb, isRGBA=True)
942940

943941
def set_antialiased(self, b):
944942
"""
@@ -1000,8 +998,9 @@ def set_foreground(self, fg, isRGBA=False):
1000998
1001999
If you know fg is rgba, set ``isRGBA=True`` for efficiency.
10021000
"""
1003-
self._orig_color = fg
1004-
if self._forced_alpha:
1001+
if self._forced_alpha and isRGBA:
1002+
self._rgb = fg[:3] + (self._alpha,)
1003+
elif self._forced_alpha:
10051004
self._rgb = colors.colorConverter.to_rgba(fg, self._alpha)
10061005
elif isRGBA:
10071006
self._rgb = fg
@@ -1012,7 +1011,6 @@ def set_graylevel(self, frac):
10121011
"""
10131012
Set the foreground color to be a gray level with *frac*
10141013
"""
1015-
self._orig_color = frac
10161014
self._rgb = (frac, frac, frac, self._alpha)
10171015

10181016
def set_joinstyle(self, js):

0 commit comments

Comments
 (0)
0