[cairo] Re: 1.4.2 release planned for today, 1.4.4 in a few weeks
Hugo Vincent
hugo.vincent at gmail.com
Wed Mar 28 02:08:14 PDT 2007
Thanks Vlad, that fixed the problem. Sorry for the noise on the list
- it seemed like a genuine Cairo bug.
Hugo
On 28/03/2007, at 5:12 AM, Vladimir Vukicevic wrote:
>
> Ah, that crash. So what's happening here is that cairo doesn't
> gracefully deal with a backend's acquire_*_image returning
> CAIRO_INT_STATUS_UNSUPPORTED -- it ends up propagating that error
> all the way up to the user level, at which point the generic "make
> sure it's a public error" assert in cairo_error triggers.
>
> The reason why you're seeing CAIRO_INT_STATUS_UNSUPPORTED is
> because Cairo (that is, the Quartz surface) didn't create the CG
> context itself; when it does, it creates it as an image context and
> can then do fallback rendering as necessary. Assuming we don't
> manage to implement everything natively using Quartz (I think there
> are a few operators that simply have no equivalents in Quartz, as
> well as some operations), an easy way to get around this is to wrap
> your rendering in between cairo_push_group() and
> cairo_pop_group_to_source()/cairo_paint(); this will give you a
> temporary Quartz surface that was created by the Quartz backend, so
> fallback rendering would be possible.
>
> - Vlad
>
> Hugo Vincent wrote:
>> Hi Baz,
>> The code below seems to replicate the crash; that is to say, even
>> the simplest use of a radial gradient on Quartz crashes.
>> verbatim error: cairo.c:91: failed assertion `status >
>> CAIRO_STATUS_SUCCESS && status <= CAIRO_STATUS_LAST_STATUS'
>> System Info:
>> Mac OS X 10.4.9 (on Intel Core 2 Duo), Xcode 2.4.1, Cairo 1.4.2
>> [release]
>> Note, this code isn't exactly what I've been testing with, but I
>> am 100% confident the other stuff I have in my code, but not in
>> the included code here, is not what is causing this crash. Like I
>> said before, Rsvg renders correctly, assuming the SVG file has no
>> radial gradients. Also, because both Rsvg (which uses the Cairo C
>> api) and this code, which is using Cairomm, both crash in the same
>> way, we can assume the problem isn't with Cairomm. Finally, if you
>> render this code into a PNG file it works fine.
>> Cheers,
>> Hugo
>> -----------------------------------------------------------
>> testview.h:
>> -----------------------------------------------------------
>> #import <Cocoa/Cocoa.h>
>> @interface TestView : NSView
>> {
>> // nothing needed here
>> }
>> @end
>> -----------------------------------------------------------
>> testview.m
>> -----------------------------------------------------------
>> #include <cairomm/cairomm.h>
>> #include <cairomm/quartz_surface.h>
>> #ifndef CAIRO_HAS_QUARTZ_SURFACE
>> #error Need to build Cairo and Cairomm with Quartz support
>> (version 1.4.0 or higher)
>> #endif
>> @implementation TestView
>> - (id)initWithFrame:(NSRect)frameRect
>> {
>> if ((self = [super initWithFrame:frameRect]) != nil)
>> {
>> // nothing needed here
>> }
>> return self;
>> }
>> - (void)drawRect:(NSRect)rect
>> {
>> // Get the size of this NSView
>> NSRect bounds = [self bounds];
>> int width = bounds.size.width;
>> int height = bounds.size.height;
>> // Get CoreGraphcis context reference
>> CGContextRef ctx = (CGContextRef)[[NSGraphicsContext
>> currentContext] graphicsPort];
>> // Make the CGContext coordinate system sane, as expected
>> by Cairo
>> CGContextTranslateCTM (ctx, 0.0, height);
>> CGContextScaleCTM (ctx, 1.0, -1.0);
>> // Create the Cairo surface and context
>> Cairo::RefPtr<Cairo::QuartzSurface> surface =
>> Cairo::QuartzSurface::create(ctx, width, height);
>> Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create
>> (surface);
>> // Draw a radial gradient (copied and pasted, more or less,
>> from http://cairographics.org/samples/gradient.html)
>> cr->scale(width,height);
>> Cairo::RefPtr<Cairo::RadialGradient> grad2 =
>> Cairo::RadialGradient::create(0.45, 0.4, 0.1, 0.4, 0.4, 0.5);
>> grad2->add_color_stop_rgba(0, 1,0,0, 1);
>> grad2->add_color_stop_rgba(1, 0,1,0, 1);
>> cr->set_source(grad2);
>> cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2 * M_PI);
>> cr->fill(); // CRASHES!
>> }
>> @end
>> On 27/03/2007, at 10:22 AM, Baz wrote:
>>> On 17/03/07, Hugo Vincent <hugo.vincent at gmail.com> wrote:
>>>> Can the patch for bug 10036 (Cairo-Quartz Line-width-scaling
>>>> problem)
>>>> be accepted for into 1.4.2 (or even 1.4.4)? Please!?
>>>> https://bugs.freedesktop.org/show_bug.cgi?id=10036
>>>>
>>>> Also, I have been playing round with Rsvg on Mac OS X, rendering
>>>> into
>>>> a Cairo-Quartz context. It mostly works (except for the above
>>>> mentioned bug), however in certain cases it crashes rather
>>>> ungracefully when trying to do fallback operations for things that
>>>> aren't supported natively by Cairo-Quartz (certain radial gradients
>>>> seem to be the culprit). I'll prepare a proper test case and
>>>> submit a
>>>> bug soon after I've tried it with 1.4.2.
>>>>
>>>> Cheers,
>>>> Hugo Vincent
>>>
>>> Hugo, did you ever track down that crasher?
>>>
>>> Cheers,
>>> Baz
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
>
More information about the cairo
mailing list