Skip to content

Commit f226488

Browse files
committed
Limit full-invalidation of CompositeGenericTransforms.
The extension of AFFINE_ONLY invalidations into FULL invalidations in CompositeGenericTransform._invalidate_internal was too generous; it is only needed in case (b) , not in case (a). This is actually the argument made by Phil Elson (in https://discourse.matplotlib.org/t/16538/2, starting at "If the invalid part is a1...") when he first introduced the _invalidate_internal API, but for some reason his implementation further added case (a). Remove that case.
1 parent 934951f commit f226488

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/matplotlib/transforms.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,14 +2368,9 @@ def frozen(self):
23682368
return frozen
23692369

23702370
def _invalidate_internal(self, level, invalidating_node):
2371-
# In some cases for a composite transform, an invalidating call to
2372-
# AFFINE_ONLY needs to be extended to invalidate the NON_AFFINE part
2373-
# too. These cases are when the right hand transform is non-affine and
2374-
# either:
2375-
# (a) the left hand transform is non affine
2376-
# (b) it is the left hand node which has triggered the invalidation
2377-
if (not self._b.is_affine and
2378-
(not self._a.is_affine or invalidating_node is self._a)):
2371+
# When the left child is invalidated at AFFINE_ONLY level and the right child is
2372+
# non-affine, the composite transform is FULLY invalidated.
2373+
if invalidating_node is self._a and not self._b.is_affine:
23792374
level = Transform._INVALID_FULL
23802375
super()._invalidate_internal(level, invalidating_node)
23812376

0 commit comments

Comments
 (0)