[cairo] Optimize horizontal/vertical gradients

Owen Taylor otaylor at redhat.com
Sun Mar 6 12:24:45 PST 2005


David Reveman wrote:

>>It probably would make sense to rename various variables to match
>>the comment and the current logic, but I haven't yet done so
>>so as to keep the patch more reviewable.
> 
> 
> Yes, do that before committing it.

Done.

>>I couldn't figure out a good way to share the gradient computation
>>logic between _cairo_linear_pattern_classify _and 
>>cairo_image_data_set_linear so it's just duplicated.
> 
> 
> That's OK for now. We probably like to restructure some of these
> gradient functions a bit when we change so that the pattern filter is no longer
> used for interpolation between color stops. We might be able to make these
> gradient computations shareable at the same time but I think we should
> wait until after the upcoming snapshot release before we do any of
> this. 

Shouldn't we just always be doing linear interpolation? The guassian
interpolation you have (is that for highlights
with radial gradients?) seems like it should just be handled by
adding more stops to the gradient. And nearest neighbour interpolation
is going to look pretty horrible.

If we only do linear interpolation, it's pretty simple to
exploit scan-line-coherance for computing linear gradients which would
cause larger code changes and divergence between the two copies.

> +       if (is_horizontal) {
> +           height = 1;
> +           repeat = TRUE;
> +       }
> +       if (is_vertical) {
> +           width = 1;
> +           repeat = TRUE;
> +       }
> +    }
> +    
> +#undef THRESHOLD
> 
> '#undef THRESHOLD', that's just something you accidentally forgot to
> remove, right?

Yeah, fixed.

> The patch looks good and it seems to be working fine. Unless someone
> else objects, I think it's OK to commit it.

I've committed now. If someone else objects, we can fix it in CVS.

Regards,
					Owen



More information about the cairo mailing list