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
Jan 19, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 21, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

Nov 24, 2016

Nov 20, 2016

Nov 14, 2016

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