[cairo] zero size textures?

Uli Schlachter psychon at znc.in
Sat Dec 16 09:48:32 UTC 2017


Hi,

On 12.12.2017 22:44, `VL wrote:
> 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:
[...]
> /* 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);
[...]
> 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) ?

Look at cairo_status() and/or cairo_surface_status(). Once an object
ends up in an error state, all operations in it will fail.

In your case, cairo_scale(cr, 0, 0) will cause a
CAIRO_STATUS_INVALID_MATRIX error.

Note that this is not specific to cairo-xcb, but is in the "generic
part" of cairo.

Cheers,
Uli
-- 
- Captain, I think I should tell you I've never
  actually landed a starship before.
- That's all right, Lieutenant, neither have I.


More information about the cairo mailing list