@@ -78,7 +78,7 @@ def __init__(
7878 self ._initialized = False
7979 self ._texture = texture
8080 self ._custom_atlas = atlas
81- self ._geometry_cache : tuple [int , int , int , int , Rect ] | None = None
81+ self ._geometry_cache : tuple [int , int , int , int , int , Rect ] | None = None
8282
8383 # pixel texture co-ordinate start and end of central box.
8484 self ._left = left
@@ -325,16 +325,20 @@ def _init_deferred(self):
325325 # References for the texture
326326 self ._atlas = self ._custom_atlas or self ._ctx .default_atlas
327327 self ._add_to_atlas (self .texture )
328-
329- # NOTE: Important to create geometry after the texture is added to the atlas
330- # self._create_geometry(LBWH(0, 0, self.width, self.height))
331328 self ._initialized = True
332329
333330 def _create_geometry (self , rect : Rect ):
334331 """Create vertices for the 9-patch texture."""
335332 # NOTE: This was ported from glsl geometry shader to python
336333 # Simulate old uniforms
337- cache_key = (self ._left , self ._right , self ._bottom , self ._top , rect )
334+ cache_key = (
335+ self ._atlas .version ,
336+ self ._left ,
337+ self ._right ,
338+ self ._bottom ,
339+ self ._top ,
340+ rect ,
341+ )
338342 if cache_key == self ._geometry_cache :
339343 return
340344 self ._geometry_cache = cache_key
0 commit comments