[cairo] CAIRO_STATUS_NO_MEMORY when passing incorrect scaling
Behdad Esfahbod
behdad at behdad.org
Thu Jan 1 07:21:20 PST 2009
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.
> Is this the expected error status for this kind of problem with the
> surface transformation matrix? Should this error be recoverable?
Cairo errors are for programmer and irrecoverable errors. Degenerate matrices
simply should not cause any error.
behdad
> In my case, the cairo context became basically useless after that one
> mistaken operation, in spite the fact that I reset the CTM afterwards
> with a cairo_identity_matrix() call, all further drawing operations
> failed.
>
> I've since fixed my code, but wondered whether the behaviour I saw
> constituted a bug which needed reporting.
>
> Best regards,
>
More information about the cairo
mailing list