[fpc-devel] TFPCustomCanvas Expanded Clipping

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Dec 7 11:54:57 CET 2011

On Wed, Dec 7, 2011 at 11:27 AM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> IMO the fastest implementation paints everything to a bitmap, then masks the
> painting with the region. This should be faster than clipping every single
> drawing primitve.

Please prove with test cases which take into account both speed and
memory usage and are executed against my implementation and also
against whatever else proposed =)

Things in practice are much more complex then one might initially
imagine. My regions implementation is reused for several things:
1> Drawing clipping
2> Drawing complex objects like poligons, polybeziers, arbitrary regions
3> To clip mouse/touch events

Would your suggestion work in all of them? Will it be faster in all of
them? Costing how much more memory?

Also you propose to first draw to a temporary bitmap then mask it ...
ummm, not sure if this is really faster because you need to move
memory 2 times. Currently I draw everything directly into the single
double buffer of the surface which has the same format as the
underlying backend requires... so there are many things to take into
account and I think that only profiling could show the advantages of
each implementation.

Not to mention that improving invalidate rect to detect which controls
need to be repainted might be a lot more useful in reducing the paint
time then changing the regions implementation.

Felipe Monteiro de Carvalho

More information about the fpc-devel mailing list