[Scummvm-devel] ATTN PORTERS: OSystem::grabPalette requirement change

Max Horn max at quendi.de
Tue Dec 21 12:48:55 CET 2010


Am 20.12.2010 um 23:06 schrieb Marcus Comstedt:
[...]
> This kind of makes me wonder:  If the only function of the method is
> to return the exact same data as was passed to setPalette, why does it
> need to be in the backend at all?  If the engines really need help
> remembering what palettes they set, couldn't a function somewhere in
> graphics/ provide that service?

Excellent point.  Ising a unified implementation would make life  easier for porters and ensures consistency across all platforms.
One option would be to introduce a PaletteManager class which is to be used instead of setPalette / grabPalette. We provide a DefaultPaletteManager, which keeps a copy of the palette when its setPalette method is called, and then calls the OSystem setPalette method. 
And backend which keep a verbatim copy of the palette anyway could easily implement a custom PaletteManager (e.g. by subclassing their OSystem class from PaletteManager, and provide a "getPaletteManager() { return this; }" method.


Cheers,
Max



More information about the Scummvm-devel mailing list