[cairo] Re: 1.4.2 release planned for today, 1.4.4 in a few weeks

Hugo Vincent hugo.vincent at gmail.com
Mon Mar 26 17:09:54 PDT 2007

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 >  

System Info:
Mac OS X 10.4.9 (on Intel Core 2 Duo), Xcode 2.4.1, Cairo 1.4.2  

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.



#import <Cocoa/Cocoa.h>

@interface TestView : NSView
	// nothing needed here


#include <cairomm/cairomm.h>
#include <cairomm/quartz_surface.h>

#error Need to build Cairo and Cairomm with Quartz support (version  
1.4.0 or higher)

@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]  
	// 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  
	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);
	cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2 * M_PI);
	cr->fill(); //  CRASHES!


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

More information about the cairo mailing list