def test_subsurface(self):
# Blitting a surface to its subsurface is allowed.
surf = self._make_surface(32, srcalpha=True)
comp = surf.copy()
comp.blit(surf, (3, 0))
sub = surf.subsurface((3, 0, 6, 6))
sub.blit(surf, (0, 0))
del sub
self._assert_same(surf, comp)
# Blitting a subsurface to its owner is forbidden because of
# lock conficts. This limitation allows the overlap check
# in PySurface_Blit of alphablit.c to be simplified.
def do_blit(d, s):
d.blit(s, (0, 0))
sub = surf.subsurface((1, 1, 2, 2))
self.failUnlessRaises(pygame.error, do_blit, surf, sub)
评论列表
文章目录