[Spice-devel] [PATCH 11/30] Convert cairo canvas draw_opaque() to using pixman
Soeren Sandmann
sandmann at daimi.au.dk
Sun Feb 21 01:37:08 PST 2010
Alexander Larsson <alexl at redhat.com> writes:
> +static void scale_image (CairoCanvas *canvas,
> + pixman_region32_t *region,
> + SPICE_ADDRESS src_bitmap,
> + int src_x, int src_y,
> + int src_width, int src_height,
> + int dest_x, int dest_y,
> + int dest_width, int dest_height,
> + int scale_mode)
> +{
> + pixman_transform_t transform;
> + pixman_image_t *src;
> + double sx, sy;
> +
> + sx = (double)(src_width) / (dest_width);
> + sy = (double)(src_height) / (dest_height);
> +
> + src = canvas_get_image(&canvas->base, src_bitmap);
> +
> + pixman_image_set_clip_region32 (canvas->image, region);
> +
> + pixman_transform_init_scale(&transform,
> + pixman_double_to_fixed(sx),
> + pixman_double_to_fixed(sy));
> +
> + pixman_image_set_transform (src, &transform);
> + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
> + pixman_image_set_source_clipping(src, TRUE);
Are you sure you want source clipping? Basically source clipping means
that the source image's clip region is translated into destination
coordinates and then clipped against. This is almost completely
useless for transformed images, and rather dubious for untransformed
ones. (Unfortunately, the useful interpretation of it is really slow
in software, and unimplementable with a texture sampler. But there are
client that use it through Render, so we can't drop it).
Also, does canvas_get_image() even set a clip region? If it doesn't,
then set_source_clipping() has no effect. The composite operation is
always clipped against the destination clip, regardless of that
setting.
Soren
More information about the Spice-devel
mailing list