[cairo] Plans for 1.6?

Baz brian.ewins at gmail.com
Sat Dec 8 16:58:56 PST 2007


On Dec 8, 2007 3:44 PM, Owen Taylor <otaylor at redhat.com> wrote:
>
> On Sat, 2007-12-08 at 00:11 +0000, Baz wrote:
> > Actually one of the problems right now is that the /fallbacks/ fail
> > the tests on quartz. I mentioned this in passing in the mail; the
> > problem is that the acquire_dest_surface returns an image surface
> > which refs the buffer used by quartz's CGBitmapContext. So fallbacks
> > that draw to this bypass clipping (and possibly other things). I tried
> > to write the fix for this last weekend - which is to make fallback
> > work the same as eg the windows surface; copy the region of interest,
> > do the fallback drawing, then paint that back onto the quartz surface.
> > I didn't get it working yet, I've messed up the coordinate flipping
> > somewhere.
>
> But the windows surface *doesn't* work that way. (Or at least all the
> time.) If the windows surface is for a DIB (an in-memory bitmap), then
> acquire_dest_surface() gives you a direct pointer to the bits.
>
> The way that clipping is handled is:
>
>     /* If we are in-memory, then we set the clip on the image surface
>      * as well as on the underlying GDI surface.
>      */
>     if (surface->image) {
>         unsigned int serial;
>
>         serial = _cairo_surface_allocate_clip_serial (surface->image);
>         status = _cairo_surface_set_clip_region (surface->image, region,
> serial);
>         if (status)
>             return status;
>     }
>
> If you demand-create the image, then you'd have to save the clip around
> before you created it.

I can't use set_clip_region, because the quartz surface uses a clip
path not a region. I can't recover the clip path from the CGContext,
but even if I tried storing the clip path in the quartz surface, its
not useful - calling _cairo_surface_set_clip_path on an image surface
generates an assertion. Similarly, I can't maintain the clip region on
an image surface as I go, inside the quartz surface, since I can only
get the path calls or the region calls, not both (I think). So, AFAIK
the only answers are to do what I described above, or to switch the
quartz surface to use the region apis instead - something I haven't
looked into.

However, I'm open to more suggestions! I'm not too keen on copying
chunks of the image either, but my thinking was that if I can get the
rendering right first I could revisit the performance issue later. It
just seemed like the path of least resistance.

>
> - Owen
>

thanks,
Baz


More information about the cairo mailing list