[cairo] CAIRO_STATUS_NO_MEMORY when passing incorrect scaling

Behdad Esfahbod behdad at behdad.org
Thu Jan 1 11:40:12 PST 2009


Peter Clifton wrote:
> On Thu, 2009-01-01 at 10:21 -0500, Behdad Esfahbod wrote:
>> Peter Clifton wrote:
>>> Hi guys,
>>>
>>> I noticed, as I was debugging some drawing code, that after a certain
>>> error in my code, all further cairo output was stopped.
>>>
>>> I tracked the problem down to an incorrect scale factor I was passing to
>>> cairo_scale(), I was in fact passing the X scale factor as 0. due to a
>>> corner case being hit at a certain zoom factor.
>> Yeah, that's a bug that we need to fix.  Scaling down to zero should not be an
>> error.
>>
>>> What puzzled me in trying to track this down, is that the surface's
>>> error state was CAIRO_STATUS_NO_MEMORY (at least,
>>> cairo_status_to_string() reported no memory).
>> That sounds wrong.  You shouldn't get an error on the surface at all.
>> Should get it on the context.
> 
> Hmm, I didn't check cairo_status, I checked cairo_surface_status
> (cairo_target (cr)).

Ah ok, that explains.  When cr is in error status, cairo_get_target() returns
a dummy surface that currently happens to be in NO_MEMORY status.  We have
plans to fix that too.

behdad


> I don't have the buggy code to hand any more, but I can try to reproduce
> if you want.
> 
> 


More information about the cairo mailing list