[Scummvm-devel] Re: 16 bit graphics: Thoughts on how to implement it

Ruediger Hanke tomjoad at muenster.de
Wed Jul 24 07:53:04 CEST 2002


Hi Max,

ok, I see 16 bit graphics are quite needed for stuff like GUI. I agree
it won't be worth to change _everything_ to draw in 16 bit from the
start.

*But* ... in one point you're wrong ... it will definitely be slower, at
least for my port.

As for color cycling and LUT mapping stuff ... on systems like MorphOS
or AmigaOS it doesn't matter if the desktop is running in 16 bit, you
can still open an 8 bit screen and voilá I've got a palette environment.
And this is much faster than than any 16 bit stuff as I don't have to
map color indices to RGB values (esp. for color cycling). It can't use any
scaling then, but at least it's full-screen sized and not a tiny window.
I sometimes play in 8 bit myself :)

Same with scaling, I do the scaling myself and not with the functions
from scale.cpp, and with some minor modifications I can speed it up
quite a bit. Ok, still room to optimize things that the SDL driver does
better ATM but I'd lose some speed by not scaling myself.

This is just an idea thrown in and not a really thought-over plan, but
I could imagine something like a 16 bit "overlay" that may be
drawn on top of the game screen which is used for GUI stuff. So as
for the game screen itself "business as usual", but add a function
copy_overlay_rect or so which supplies data in 16 bit. (Just a quick
thought)

As for dropping 8 bit entirely ... as I mentioned above, 8 bit may be
available on some systems for great speed improvements, and it
may be argued that "just" a new GUI may be worth it ... maybe the
old GUI remains and is still used for 8 bit screens, and the new GUI
is used for 16/32 bit screens. Or it's just ignored or the driver tries
to map the overlay to the colors on screen as good as possible ...

As for reading back pixels, again I think this should be left to the
system driver. At least I could read back pixels easier using the OS
without the need for yet another full-size 16 bit buffer.

One last note, even if I can't keep you from doing everything as
you planned :), I hope that you won't just simply supply the data
in 16 bit but in the actual pixel format used by the hardware ...
otherwise you've got two conversions: one ScummVM-internal
8 -> 16 bit, and one by the system driver or SDL or the OS from
16->24 bit or 565 16 bit -> 565 byteswapped 16 bit etc etc.

Rüdiger
-- 
"...wherever there's somebody fightin' for a place to stand
Or a decent job or a helping hand
Wherever somebody's struggling to be free
Look in their eyes Mom you'll see me."
- Bruce Springsteen, "The Ghost of Tom Joad"





More information about the Scummvm-devel mailing list