[cairo] create_surface_for_cg_context behavior in Cairo 1.9 vs. 1.12

cu cairouser at yahoo.com
Sat Jun 2 05:44:59 PDT 2012


Please take a careful look at sample code.  Source surface is an *image
surface* created previously (not shown in the sample) with
cairo_surface_create. CGContext surface is the *destination*. 
Note that source pattern "qpat" is created from "source_surf".
Note that destination context "qcr" is created from "qsurf" which is the
CGContext surface.

Andrea Canciani wrote:
> On Sat, Jun 2, 2012 at 2:01 PM, cu <cairouser at yahoo.com> wrote:
>> The test case is quite simple:
>> // .. set up source_surf as an image surface of the same size as the
>> UIView, draw into it...
>> CGContextRef cgref = UIGraphicsGetCurrentContext();
>> qsurf = cairo_quartz_surface_create_for_cg_context(cgref,
>> source_surf_width, source_surf_height);
>> qpat = cairo_pattern_create_for_surface(source_surf);
>> qcr = cairo_create(qsurf);
>> cairo_set_source(qcr, qpat);
>> cairo_paint(qcr);

> It looks like you're using a surface created with
> cairo_quartz_surface_create_for_cg_context() as source.
> That is quite a bad idea (see the "bad things" I warned you about).
> Would it be possible to draw on a surface created with
> cairo_quartz_surface_create(), instead?
> (I guess it might involve performing an additional blit)

More information about the cairo mailing list