[Scummvm-devel] 'gob' engine & 8bpp

Sven Hesse drmccoy at drmccoy.de
Thu Apr 2 04:39:16 CEST 2015


On 2015-04-01 22:59:51 +0200, Miro Kropáček wrote:
> but how it
> can generate rectangles like {x = 1, y = 10, w = 320, h = 159} ?

That's because gob is relatively aggressive in merging dirty
rectangles (*), essentially merging them on vertical overlap alone:
<https://github.com/scummvm/scummvm/blob/master/engines/gob/draw.cpp#L194>
That's actually how the original does it too.

(*) Well, "invalidated" rectangles, since the merging is happening for
    the dirty rectangles between the engine's internal back and front
    buffers. Those become dirty rectangles for the blitting between
    the front buffer and ScummVM's game surface then.

And yes, even though there's only a few animations going on, there's a
lot of invalidated rectangles going on even on the first level. You
have keep in mind that there's objects in front of other objects in
front of other objects.

I cooked up a patch that rewrites the invalidated rectangles a bit;
I'll attach that to this mail.

They're then merged less aggressively. Before moving the invalidated
rectangles over to the system's dirty rectangles in
Draw::blitInvalidated(), there's then a call to a collapseDirtied()
function, further merging them down (*). You may want to experiment
with removing that call, to see whether the CPU time spent for that
quite costly operation is worth it.

(*) Because the combined area of two overlapping rectangles can
    suddenly overlap a third, previously separate, rectangle.
    If you know of a better way to handle this case than my crude
    solution here, let me know. :)


Cheers,
Sven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-GOB-Rewrite-the-invalidated-rectangles.patch
Type: text/x-diff
Size: 6468 bytes
Desc: not available
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20150402/d9de3f22/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20150402/d9de3f22/attachment.sig>


More information about the Scummvm-devel mailing list