[cairo] [cairo-commit] 2 commits - test/clip-device-offset.c test/surface-pattern-scale-down-extend.c

Chris Wilson chris at chris-wilson.co.uk
Sun Feb 13 12:35:56 PST 2011


On Sun, 13 Feb 2011 11:51:02 -0800 (PST), ranma42 at kemper.freedesktop.org (Andrea Canciani) wrote:
> +    cairo_save (cr);
> +
> +    /* When the destination surface is created by cairo-test-suite to
> +     * test device-offset, it is bigger than w x h. This test expects
> +     * the group to have a size which is exactly w x h, so it must
> +     * clip to the this rectangle to guarantee that the group will
> +     * have the correct size.
> +     */
> +    cairo_rectangle (cr, 0, 0, w, h);
> +    cairo_clip (cr);

old_clip = gstate->clip;
_cairo_clip_init_copy(&clip, &gstate->clip);

rectangle.x = rectangle.y = 0;
rectangle.width = w;
rectangle.height = h;
status = _cairo_clip_rectangle(&clip, &rectangle);
gstate->clip = clip;
...
gstate->clip = old_clip;

would be cheaper.

But having typed that one can see the immediate reason for not doing so.
;-)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list