[cairo] create_surface_for_cg_context behavior in Cairo 1.9 vs. 1.12

Andrea Canciani ranma42 at gmail.com
Thu Jun 7 06:48:39 PDT 2012


On Sat, Jun 2, 2012 at 2:44 PM, cu <cairouser at yahoo.com> wrote:
> Andrea,
>
> 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.
>

Sorry, you're right, I misread your code snippet.
I tried making a program out of it, but I didn't manage to reproduce the issue.
See the attachments for the code, the output on 1.9.8 and on master.

Can you please check if you can confirm the behavior in your environment?
Do you have any idea about what the initialization of the context
should be in order to reproduce your issue?

Andrea

>
> 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)
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quartz-context-1.9.8.png
Type: image/png
Size: 236 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120607/23654428/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quartz-context-master.png
Type: image/png
Size: 236 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120607/23654428/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quartz-transform.c
Type: text/x-csrc
Size: 2569 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120607/23654428/attachment.c>


More information about the cairo mailing list