[Scummvm-devel] RFC: overlays extension to OSystem

Eugene Sandulenko sev at scummvm.org
Tue Jun 29 05:58:02 CEST 2004


Hi dev'ers,

here I would like to present my request for comments of one quite
noticeable extension to OSystem.

Problem description:

 o Recently we started support of windows versions of HE games. They
   have their cursor format changed, basically now it is Win32 .dll
   with resources, and it used standard Win32 calls to display them.

   From the other hand, game screen was scaled by factor of 2, making
   it 640x400 or something. We still display it in 320x200, which lead
   to the problem I address. Cursors look too big, as they're designed
   for bigger resolution.

 o For a while we have support for japanese versions of FM-TOWNS games
   which used same technique, i.e. picture was stretched and on top of
   it was rendered hyeroglyphs with finer details.

 o There were numerous requests of less blocky fonts for scaled
   modes.

 o In-game dialog in COMI looks too tiny.


Proposed solution:

All these problems exist because we always render on same virtual
screen buffer, then scale it blindly and throw to renderer. 

So I propose to implement how I call it, overlayed rendering.

Basically we will have two buffers instead of current one, and have
possibility to draw on either of them. Their resolution will be
independent, but usually this second buffer will be 2x scaled
comparable to main buffer.

Then rendering pipe will look like this:

  0. MAIN is main buffer with gameplay picture
     OVERLAY is additional buffer with bigger resolution. It has alpha
     mask. Usually it will contain cursor, text or whatever.
     RATIO is ratio between MAIN and OVERLAY resoltion, i.e. 2 for
     320x200 and 640x400 respectively.
     SCALE is current requested picture scale. It never can be less
     than RATIO, i.e. you can't switch to 1x for such games.
  1. Scale MAIN buffer to requested SCALE with any requested scaler.
  2. Scale OVERLAY by (SCALE/RATIO) with simple linear scaler. I.e. if
     there is requested 3x SCALE, it will be scaled by 1.5x. I am not
     sure either this is essential, but will be nice to have.
  3. Overdraw MAIN with OVERLAY using alpha mask.
  4. Feed it to renderer.

Basically it will let us address all above problems, well, maybe
problem #3 with finer fonts will never be implemented, but at least
will be possible to do it easily. To implement it, all text-drawing
calls should be directed to OVERLAY with coordinates transformed to
match its resolution.

Also OVERLAY may have feature of dynamic resizing, so when user
switches to bigger resolution, it will use finer fonts for rendering.

So what do you think about it?


Eugene




More information about the Scummvm-devel mailing list