Better (?) memory allocation in NUT font renderer
|Reported by:||eriktorbjorn||Owned by:||eriktorbjorn|
|Cc:||Game:||Monkey Island 3|
Recently, Fingolfin wrote a mail to scummvm-devel about ScummVM's memory footprint. One of the areas he speculated would be a good place to save memory was the NUT font renderer used by The Curse of Monkey Island, since it pre-decodes the entire font.
One possibility (suggested in the mail) would be to store the undecoded font file in memory and decode it on the fly when the font is actually rendered. Unfortunately, the total size of the decoded glyphs is, as far as I can tell, actually smaller than the entire undecoded font file.
Of course, the font file also contains the dimensions for each glyph (which we also read in advance), tags, etc.
So all this patch does is to change the memory allocation so that we'll allocate five larger memory chunks (one for each font) instead of 1280 smaller ones (one for each glyph). Surely that should save the memory allocator some bookkeeping information?
Another possible, and trivial, saving which I didn't want to mix up in this patch might be to 16-bit integers instead of plain int in NutRenderer's _chars array.
Ticket imported from: #1635584. Ticket imported from: patches/703.