[cairo] performance difference between image and win32 surface?

Owen Taylor otaylor at redhat.com
Fri Oct 19 13:23:21 PDT 2007


On Fri, 2007-10-19 at 12:40 -0700, Vladimir Vukicevic wrote:
> 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.

Nitpick: the default OPERATOR_OVER is optimized to go through the same
code path as OPERATOR_SOURCE when both the source and the destination
are only COLOR and not COLOR_ALPHA. So you shouldn't need any special
handling.

- Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20071019/6e25b51a/attachment.pgp 


More information about the cairo mailing list