[cairo] performance difference between image and win32 surface?
vladimir at pobox.com
Fri Oct 19 12:40:31 PDT 2007
Danilo Gulamhussene wrote:
> Vladimir Vukicevic schrieb:
>> Could you give some examples of the kinds of operations that you're
>> finding slower?
>> - Vlad
> Owens advise to use cairo_push_group() on win32 surface fixed the
> performance difference for this test completely.
> The costs of cairo_push_group(), which implicitly creates a new surface
> (as far as I understood), on what do they depend? Do they depend on the
> size of the original surface, the current clip region, or the space used
> by the objects, i draw inside the group?
Ah, yeah, if you're drawing straight to a window's DC, you're paying a
lot of overhead because that window is being immediately updated.
Drawing to an offscreen DC, which is effectively what push_group will do
for you, is much faster.
The size of the temporary surface created by push_group is the
intersection of the current clip region and the bounds of the original
surface. It's independent of the size of any drawing you do afterwards.
For maximum speed, I would suggest using push_group with a COLOR-only
content (not COLOR_ALPHA), and using OPERATOR_SOURCE to update the
resulting window. This should result in a fast BitBlt for the final
update to the screen.
More information about the cairo