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
| Step | Action |
|---|
| 1 | Mark changed areas as “dirty” |
| 2 | Store old sprite positions |
| 3 | Erase sprites at old positions |
| 4 | Draw sprites at new positions |
| 5 | Only refresh dirty regions |
Tracking changes
| Change type | Dirty region |
|---|
| Sprite moved | Old + new position |
| Animation frame | Sprite bounds |
| Score change | Score display area |
| Background change | Affected tiles |
Rectangle operations
| Operation | Purpose |
|---|
| Union | Combine overlapping |
| Intersection | Find overlap |
| Clipping | Screen bounds |
| Coalescing | Merge nearby rects |
Advantages
| Benefit | Impact |
|---|
| CPU savings | More processing for gameplay |
| Reduced flicker | Smaller updates |
| Bandwidth | Less memory movement |
Limitations
| Drawback | Situation |
|---|
| Overhead | Tracking adds complexity |
| Full-screen changes | Worse than redraw |
| Many objects | Diminishing returns |
| Scrolling | Usually not applicable |
| Platform | Application |
|---|
| Amiga | Adventure games |
| PC (early) | Before accelerators |
| Point-and-click | Ideal use case |
See also