Exemplo n.º 1
0
    def draw (self, handle_dirty = True):
        """Update the display (:attr:`orig_sfc`).

:arg handle_dirty: whether to propagate changed areas to the transformation
                   pipeline implemented by
                   :class:`Graphic <engine.gfx.graphic.Graphic>`.  Pass
                   ``False`` if you don't intend to use this manager as a
                   graphic.

Returns ``True`` if the entire surface changed, or a list of rects that cover
changed parts of the surface, or ``False`` if nothing changed.

"""
        layers = self.layers
        sfc = self._orig_sfc
        if not layers or sfc is None:
            return False
        graphics = self.graphics
        dirty = self._gm_dirty
        self._gm_dirty = []
        if dirty is True:
            dirty = [sfc.get_rect()]
        elif dirty is False:
            dirty = []
        dirty = fastdraw(layers, sfc, graphics, dirty)
        if dirty and handle_dirty:
            Graphic.dirty(self, *dirty)
        if self._orig_dirty:
            dirty = combine_drawn(dirty, self._orig_dirty)
            if not handle_dirty:
                self._orig_dirty = False
        return dirty
Exemplo n.º 2
0
    def draw (self):
        """Update the display.

Returns ``True`` if the entire surface changed, or a list of rects that cover
changed parts of the surface, or ``False`` if nothing changed.

"""
        layers = self.layers
        sfc = self._surface
        if not layers or sfc is None:
            return False
        graphics = self.graphics
        dirty = self._gm_dirty
        self._gm_dirty = []
        return fastdraw(layers, sfc, graphics, dirty)