[cairo] Operator optimization based on source or dest opacity

Antoine Azar cairo at antoineazar.com
Fri Feb 29 16:40:18 PST 2008


Hi Soeren,

>- I really don't think it's necessary to have a separate 
>pixman_transformed_image_is_opaque(). For destination images, the
>   transform and filter are always going to be NULL, so the 
> additional check is very quick.

I'll trust you on this one, but where is this specified?

>- The if statement in pixman_transformed_image_is_opaque() is 
>difficult to follow for me. It's also broken in at least one case:
>   convolution filters can introduce translucency even when there 
> weren't any to begin with.

How can a convolution filter introduce translucency in an opaque 
image that extends?

>   Also, I'm not confident that the pi/2 rotation transformation 
> check is correct. Doesn't it need the rotation to be around the center of
>   the image?

Any affine transform other than non pi/2-multiple rotations (and 
shears) are allowed, as long as we use a nearest filter. Whether the 
rotation is around the center of the image or not is irrelevant.

>   Can we just add something like this to the end of
>   pixman_image_is_opaque():
>
>          /* Convolution filters can always introduce translucency */
>          if (convolution filter)
>                     return FALSE;
>
>          if (repeat_none && (filter || transformation))
>                     return FALSE;
>
>          return TRUE;
>
>   then get rid of pixman_transformed_image_is_opaque()?
>
>   I *think* that would be correct, though I would appreciate an
>   additional review from someone else.

You'd be missing some optimization cases as I explained above.


Thanks for the careful review Soeren!
Antoine 



More information about the cairo mailing list