[cairo] create_surface_for_cg_context behavior in Cairo 1.9 vs. 1.12

Andrea Canciani ranma42 at gmail.com
Thu Jun 7 09:29:43 PDT 2012


On Thu, Jun 7, 2012 at 6:13 PM, cu <cairouser at yahoo.com> wrote:
> Will test it out in the next few days. What environment are you
> building/testing it on? I.e. iOS version/SDK/device? I am building cairo
> libraries and application against iOS/iOSSimulator SDK 5.0 with minimum
> iOS version set to 4.0 (or 4.3 - it doesn't make any difference here).

I'm building/testing on MacOS X 10.7.
Having a standalone program which does not require UI yet triggers the
issue would make it much easier to test (and especially bisect).
If the issue only happens on iOS, I should be able to set up an
environment for that (IIRC in some thread you pointed out the options
needed to build pixman and cairo for ios).

>
> I am getting the same behavior both on actual iOS device and on the iOS
> simulator, which makes it somewhat easier to test. There is nothing
> particular about the context. The context is created as shown with
> UIGraphicsGetCurrentContext(). It refers to a view, which is a subclass
> of UIView with a custom drawRect, whose only purpose is to dump cairo
> image surface contents to screen. The function is called from within
> drawRect handler.
>
> I.e.:
>
> - (void) drawRect:(CGRect)_rect
> {
>   CGContextRef cgref = UIGraphicsGetCurrentContext();
>   // the rest of the code goes here...
> }
>
>
>
>> 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)
>>>>
>>>>
>>> ------------------------------------------------------------------------
>>>
>>> --
>>> cairo mailing list
>>> cairo at cairographics.org
>>> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list