[Spice-devel] [PATCH 11/30] Convert cairo canvas draw_opaque() to using pixman

Alexander Larsson alexl at redhat.com
Mon Feb 22 04:29:16 PST 2010


On Sun, 2010-02-21 at 10:37 +0100, Soeren Sandmann wrote:
> 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).

Source clipping is not needed, i've removed it here now.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's an otherworldly albino Green Beret with a mysterious suitcase handcuffed 
to his arm. She's a mentally unstable antique-collecting barmaid with an evil 
twin sister. They fight crime! 



More information about the Spice-devel mailing list