[cairo] misc. cairo_t questions
rbd at soest.hawaii.edu
Thu Apr 12 13:00:38 PDT 2012
Thanks for your help! One followup question:
>> (3) It seems like almost all of the cairo_set...(), etc., functions
>>return void. Is there a standard behavior in place to handle bad
>>arguments to these calls, or other error conditions?
>Yes. If some object gets in an error condition, this error condition is
>sticky. You can not un-error something afterwards. To get this error
>flag, there are cairo_status(), cairo_surface_status(),
I like to be reasonably rigorous in error checking (and am extremely
averse to allowing situations that could result in a core dump), but it
does seem like overkill to do a cairo_status() after every single change
to a context or after every drawing operation. Are there certain
operations to contexts or surfaces in particular which are unusually prone
to error generation, especially errors which might ultimately lead to a
core dump, which it would be useful to check via cairo_???_status()? By
the way, checking status after cairo_select_font_face(cr,
"NonexistentFont" ...) doesn't yield any abnormal error code, so I'm
wondering when these functions might actually return useful information.
Perhaps this particular case is non-representative since it is, as you
say, from the toy API.
More information about the cairo