[Cairo] Suggestion for replacing cairo_copy with set_gstate.

Carl Worth cworth at east.isi.edu
Fri Sep 26 16:20:12 PDT 2003


On Sep 26, Bill Spitzak wrote:
 > Yes I read that, seems like a good idea. Otherwise people may never notice 
 > that they are producing errors. One thing though: if errors stop push/pop 
 > from working, it will be difficult to get back to a known state.

That's correct. Once there is an error the cairo_t is shutdown and
there is nothing that can be done to recover it at all. In the current
implementation calling cairo_destroy will actually free some memory,
but I suppose it would be an improvement to make that unnecessary.
(Since we're never using the data again we can just destroy everything
at the time the error occurs.)
 
 > Then again doing a mismatched set of push/pop would also be an
 > error and cannot be recovered from. Perhaps the "clear errors"
 > function should also clear out the stack and only keep the stat the
 > cairo_t was created with. Alternatively there can be no way to
 > clear errors except to destroy the cairo_t, though I can see that
 > being a pain and force some libraries to have to wrap the cairo_t
 > pointer in another object.

Right. There can't be a function that just "clears errors" and leaves
some previously created data in place.

Right now, one must start over with a new cairo_create. We could
certainly add a new cairo_reset or some such to let the user continue
to use the same cairo_t pointer.

 > PS: I finally have a RedHat 9 machine so I will be able to compile and work 
 > on this stuff, instead of just blathering on about it here on the mailing 
 > list.

Great. I look forward to more contributions from you.

-Carl




More information about the cairo mailing list