pygame is
Simple DirectMedia Layer is
Site Swing
Optimize Dirty Rects

Optimize Dirty Rects - 1.0

Jason Marshall (jmm0)



The script contains a function of the same name. This function will accept a list (or other iterable) of objects of the pygame.Rect type. All overlapping areas will be removed, and the function will return a list of Rect objects.

Do not pass in Rects that shouldn't be resized (e.g. Sprite.rect). Instead, pass in the Rects that are returned by a blit to the screen surface.

from optimize_dirty_rects import optimize_dirty_rects
# ...then, somewhere in the main loop...
    dirty = dirty_sprite_group.draw(screen)
    dirty = optimize_dirty_rects(dirty)

Bug reporting:

This code is free (MIT License).


Home Page:


click to view original size


Optimize Dirty Rects - 1.0 - Nov 9, 2013 account Comments

If you wish to leave a comment with your account, please sign in first.

No user comments have been submitted.

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Apr 27, 2015

Apr 26, 2015

Apr 25, 2015

Apr 17, 2015

Apr 13, 2015

Apr 12, 2015

Apr 9, 2015

Apr 3, 2015

Apr 2, 2015

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)