[cairo] zero size textures?

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


Hello,
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:

cairo_push_group(gc->cr);

/* 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_fill(gc->cr);                                                    
                                                                               

cairo_pop_group_to_source(gc->cr);        
                            
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:
x11-libs/cairo-1.14.8
x11-libs/libxcb-1.12-r2
OS is Gentoo linux

Thanks in advance!




More information about the cairo mailing list