[Scummvm-devel] copyRectToScreen clipping

Joost Peters joostp at 7fc1.org
Sun Nov 6 08:53:39 CET 2005


In the SDL (and most other) backend(s) the x/y/w/h parameters that are 
passed to copyRectToScreen() are clipped.
Can anyone tell me why this clipping isn't done inside the engine?  (And 
maybe additionally assert the values are sane in the backend)

I'm bringing this up as this seems to be a common pitfall for ports.
Some scenes in Full Throttle are calling copyRectToScreen with negative 
values, e.g. the gas tower cutscene calls copyRectToScreen() with x: 24, 
y: 246, w: 8, h: -46.

The OSystem documentation for copyRectToScreen() doesn't say anything 
about performing clipping.

Obviously, when no clipping is performed this will trash random memory.
It took me some time to track this down on the PSP, and now it seems the 
DC port suffers from the same problem, see: 

So I'm proposing we either do the check somewhere where all backends 
benefit from it (inside the engine?), or atleast update the OSystem 
documentation to mention that clipping of the input needs to be done.


More information about the Scummvm-devel mailing list