@@ -93,13 +93,15 @@ def invalidate(self):
93
93
"""
94
94
# If we are an affine transform being changed, we can set the
95
95
# flag to INVALID_AFFINE_ONLY
96
- value = ((self .is_affine or self .is_bbox )
97
- and self .INVALID_AFFINE
98
- or self .INVALID )
96
+ value = (self .is_affine ) and self .INVALID_AFFINE or self .INVALID
99
97
100
98
# Shortcut: If self is already invalid, that means its parents
101
99
# are as well, so we don't need to do anything.
102
- if self ._invalid == value or not len (self ._parents ):
100
+ if self ._invalid == value :
101
+ return
102
+
103
+ if not len (self ._parents ):
104
+ self ._invalid = value
103
105
return
104
106
105
107
# Invalidate all ancestors of self using pseudo-recursion.
@@ -108,7 +110,7 @@ def invalidate(self):
108
110
while len (stack ):
109
111
root = stack .pop ()
110
112
# Stop at subtrees that have already been invalidated
111
- if root ._invalid == 0 or root .pass_through :
113
+ if root ._invalid != value or root .pass_through :
112
114
root ._invalid = value
113
115
stack .extend (root ._parents .keys ())
114
116
@@ -198,6 +200,7 @@ class BboxBase(TransformNode):
198
200
read-only access to its data.
199
201
"""
200
202
is_bbox = True
203
+ is_affine = True
201
204
202
205
#* Redundant: Removed for performance
203
206
#
@@ -208,6 +211,7 @@ class BboxBase(TransformNode):
208
211
def _check (points ):
209
212
if ma .isMaskedArray (points ):
210
213
warnings .warn ("Bbox bounds are a masked array." )
214
+ points = npy .asarray (points )
211
215
if (points [1 ,0 ] - points [0 ,0 ] == 0 or
212
216
points [1 ,1 ] - points [0 ,1 ] == 0 ):
213
217
warnings .warn ("Singular Bbox." )
@@ -1011,6 +1015,8 @@ class TransformWrapper(Transform):
1011
1015
transform may only be replaced with another child transform of the
1012
1016
same dimensions.
1013
1017
"""
1018
+ pass_through = True
1019
+
1014
1020
def __init__ (self , child ):
1015
1021
"""
1016
1022
child: A Transform instance. This child may later be replaced
@@ -1546,7 +1552,6 @@ class BlendedAffine2D(Affine2DBase):
1546
1552
This version is an optimization for the case where both child
1547
1553
transforms are of type Affine2DBase.
1548
1554
"""
1549
-
1550
1555
is_separable = True
1551
1556
1552
1557
def __init__ (self , x_transform , y_transform ):
@@ -1917,8 +1922,8 @@ def get_transformed_path_and_affine(self):
1917
1922
the transform already applied, along with the affine part of
1918
1923
the path necessary to complete the transformation.
1919
1924
"""
1920
- if (self ._invalid & self .INVALID_NON_AFFINE or
1921
- self ._transformed_path is None ):
1925
+ if (( self ._invalid & self .INVALID_NON_AFFINE == self . INVALID_NON_AFFINE )
1926
+ or self ._transformed_path is None ):
1922
1927
self ._transformed_path = \
1923
1928
self ._transform .transform_path_non_affine (self ._path )
1924
1929
self ._invalid = 0
@@ -1928,7 +1933,7 @@ def get_fully_transformed_path(self):
1928
1933
"""
1929
1934
Return a fully-transformed copy of the child path.
1930
1935
"""
1931
- if (self ._invalid & self .INVALID_NON_AFFINE
1936
+ if (( self ._invalid & self .INVALID_NON_AFFINE == self . INVALID_NON_AFFINE )
1932
1937
or self ._transformed_path is None ):
1933
1938
self ._transformed_path = \
1934
1939
self ._transform .transform_path_non_affine (self ._path )
0 commit comments