[Scummvm-devel] Bitdepth/pixel format API concerns

Marcus Comstedt marcus at mc.pp.se
Sun Jun 14 19:29:38 CEST 2009


RafaƂ Rzepecki <divided.mind at gmail.com> writes:

> Thinking about it, maybe another way would be to provide a
> Surface::convertToScreenFormat() method; then the engine has a choice
> of either converting just before putting on screen, or using this same
> method to convert beforehand, eg. when loading sprites, and then do
> drawing in native format. There could even be a wrapper around
> copySurfaceToScreen which automatically calls the conversion.

Providing a standard method to do conversion is fine, but I don't
think an engine should use it to convert when putting things on
screen.  As we've already mentioned, a backend can have platform
specific tricks to make the conversion more efficiently (and
possibly without writing the converted version back to regular
memory), so the engine should only do conversion in the cases where
the number of conversions can be kept down by putting the conversion
in the engine, i.e. when doing beforehand conversion.  (Ok, there
is one other case where the engine should do conversion:  When the
source format is not one which can be described by PixelFormat.
YUV data has already been mentioned.  Of course, in the case of the
Dreamcast, doing YUV conversion in the backend would be preferred,
since there is hardware support for that... :)


  // Marcus






More information about the Scummvm-devel mailing list