Skip to content
Techniques & Technology

Dirty Rectangles

Efficient screen updates

Dirty rectangle rendering optimised screen updates by tracking and redrawing only the areas that changed, saving CPU cycles when most of the display remained static.

AmigapcC64 graphicsoptimisationrendering 1985–1999

Overview

Why redraw the entire screen when only a small part changed? Dirty rectangle rendering tracked which screen regions needed updates and redrawed only those areas. For games with mostly static backgrounds and moving sprites, this dramatically reduced rendering work compared to redrawing every pixel every frame.

Fast facts

  • Purpose: Reduce unnecessary redrawing.
  • Method: Track changed screen regions.
  • Benefit: Lower CPU usage.
  • Best for: Static backgrounds with moving elements.

How it works

StepAction
1Mark changed areas as “dirty”
2Store old sprite positions
3Erase sprites at old positions
4Draw sprites at new positions
5Only refresh dirty regions

Tracking changes

Change typeDirty region
Sprite movedOld + new position
Animation frameSprite bounds
Score changeScore display area
Background changeAffected tiles

Rectangle operations

OperationPurpose
UnionCombine overlapping
IntersectionFind overlap
ClippingScreen bounds
CoalescingMerge nearby rects

Advantages

BenefitImpact
CPU savingsMore processing for gameplay
Reduced flickerSmaller updates
BandwidthLess memory movement

Limitations

DrawbackSituation
OverheadTracking adds complexity
Full-screen changesWorse than redraw
Many objectsDiminishing returns
ScrollingUsually not applicable

Platform use

PlatformApplication
AmigaAdventure games
PC (early)Before accelerators
Point-and-clickIdeal use case

See also