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
Oct 9, 2015

Oct 1, 2015

Sep 11, 2015

Sep 6, 2015

Aug 26, 2015

Aug 25, 2015

Aug 21, 2015

Aug 16, 2015

Jul 30, 2015

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