[cairo] zero size textures?

`VL vl.homutov at gmail.com
Tue Dec 12 21:44:06 UTC 2017

I've faced with a bug in my application, when it stopped any drawing
(using cairo/xcb)
Investigation lead me to the following code snippet,
where dx, dy, dst->x, dst->y and dst->w, dst->h occurred to be all zeroes:


/* commenting out this 3 lines avoids issues */
cairo_translate(gc->cr, dst->x, dst->y);                             
cairo_rectangle(gc->cr, 0, 0, dst->w, dst->h);                       
cairo_scale(gc->cr, dx, dy);

cairo_set_source_surface(gc->cr, CS(tspec->tx), 0, 0);


cairo_paint_with_alpha(gc->cr, tspec->alpha);        

The bad thing is that after calling this, cairo_text_extents()
starts returning zeroes instead of correct sizes, so it looks
like some memory inside library was corrupted.

So the question - is it ok to call cairo functions with zero sizes
and expect some valid result? Could it be some bug in cairo (xcb backend) ?

I'm using:
OS is Gentoo linux

Thanks in advance!

More information about the cairo mailing list