[Scummvm-devel] ATTN porters: updateScreen() OSystem method

Eugene Sandulenko sev at scummvm.org
Mon Apr 17 17:32:02 CEST 2006

On Thu, 16 Mar 2006 00:19:55 +0100
Marcus Comstedt <marcus at mc.pp.se> wrote:

> Simply updating the screen at the end of pollEvent is probably _not_ a
> good idea.
To bring this topic back to life.

It seems that at least several backends do not follow what is described
in common/system.h, namely this:

        /** Update the dirty areas of the screen. */
        virtual void updateScreen() = 0;

I.e. any call to updateScreen() condition-less updates the screen. What
would be proper is to update it only when any of following OSystem
calls were invoked:

  - setPalette()
  - clearScreen()
  - copyRectToScreen()
  - setShakePos()
  - copyRectToOverlay()
  - showMouse()
  - warpMouse()
  - setMouseCursor()
  - setCursorPalette()
  - disableCursorPalette()
  - displayMessageOnOSD()

All these calls actually make screen dirty.

And for those ports which need it, when required number of milliseconds
have passed, i.e. something like:

  newTime = _system->getMillis();
  if (newTime - oldTime > 1000 / 60) { // 60 fps
    oldTime = newTime;
    screenIsDirty = true;

This will let engine writers not to think about any delays and just
make sure that updateScreen() is called when they finish drawing.

So, port maintainers, please, make sure you do it correctly. I saw this
behaviour at least in PS2, DC, PSP and GP32. Didn't check other ports.

Probably we should describe this behaviour in more details in doxygen
comments, but I am not sure about proper wording.


More information about the Scummvm-devel mailing list