[cairo] OVER / SOURCE optimization for cairo_paint
cairo at antoineazar.com
Sun Feb 17 11:00:38 PST 2008
thanks for the feedback.
>cairo.c should really be a wrapper around gstate. And gstate should
>really be a wrapper around surface and scaled-font. This particular
>optimization for example is more suitable to go in the surface
>layer, for example because we use cairo_surface_paint() internally when we
>don't have and don't need any gstate.
I see. I'll look into that, but I don't want to clutter an existing
layer of code with various optimizations. Don't you think it would be
nicer to add a "dispatching" layer somewhere below cairo.c and above
cairo-surface.c that would be responsible for such optimizations? Is
there any design doc about our current code paths?
> > + surface_rect.x = floor(surface_rect.x);
> > + surface_rect.y = floor(surface_rect.y);
> > + surface_rect.width = ceil(surface_rect.width);
> > + surface_rect.height = ceil(surface_rect.height);
>Why is the floor/ceil needed here in the first place?
That's actually a good question (which I ask in a comment just below
:) ). If you look at the filter_nearest_offset test, it checks
exactly that. It increments the source's matrix translation by 0.1 in
a for() loop, and expects a change in output only when we reach an
integer increment. I don't understand why. Without flooring and
ceiling, the test fails.
I'll fix the other issues you pointed out.
More information about the cairo