eriktorbjorn at telia.com
Tue Oct 24 01:18:37 CEST 2006
Max Horn wrote:
> Games then could simply lock the screen surface, modify its display
> contents (blacking the screen, making a copy, applying effects,
> scrolling, etc.), then unlock it.
Well, that would simplify things in Broken Sword 2, at least. That game
renders the entire screen for each frame, but I added some bookkeeping
to keep track of which areas of the screen maybe - but not necessarily -
changed. (I've forgotten how much that improved performance, but I
remember being pleasantly surprised.)
> Namely, you keep a copy of the previous screen state. Then you modify
> your scaler to compare old and new state pixel-by-pixel, and only
> rescale those parts where the screen content actually changed.
There are some subtle details to consider, of course. With aspect ratio
correction, the area to be scaled has to be "aligned" - see
makeRectStretchable() - to ensure that the scaler is applied consistently.
I guess the easiest way to solve that would be to imagine a coarser grid
of rectangles (e.g. 16x16 pixels) and say that "if any pixel has changed
within this rectangle, scale and update the entire rectangle". That way
we know in advance that the rectangle is well-aligned. Maybe we could
also finally fix that long-standing bug in the "dotmatrix" scaler - try
moving the cursor slowly, and see how the background gets slightly
distored - but I wouldn't consider that a high priority.
More information about the Scummvm-devel