Summary: | RFE - named savepoints | ||
---|---|---|---|
Product: | cairo | Reporter: | Robert Staudinger <robert.staudinger> |
Component: | general | Assignee: | Carl Worth <cworth> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | enhancement | ||
Priority: | high | ||
Version: | 1.0.2 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Robert Staudinger
2006-01-23 03:53:38 UTC
Can you should us an snippet of how this will be used? /* widget initialisation code, realize() or somesuch */ /* set up cairo */ ... self->savepoint = cairo_save_named (self->cr); /* drawing code, e.g. expose () */ for (r = 0; r < rows; r++) { for (c = 0; c < cols; c++) { x = c * self->tile_width; y = r * self->tile_height; /* no longer needed cairo_save (self->cr); */ cairo_translate (self->cr, x, y); rsvg_cairo_render (self->cr, self->svgh); cairo_restore_named (self->cr, self->savepoint); } } I think what you need is a cairo_copy that clones cairo_t objects. cairo_save: malloc + copy cairo_restore: free cairo_restore_named: copy cairo_copy: copy it seems that cairo_copy() is deprecated in HEAD Basically I take that as a sign that your proposal will be rejected either. cairo_copy is a cleaner API than savepoints afterall... Actually, cairo_copy had some huge problems and that's why we removed it. I've always known we needed a real solution for the use case and I had often imagined adding: cairo_gstate_t * cairo_get_gstate (cairo_t *cr); void cairo_set_gstate (cairo_t *cr, cairo_gstate_t *gstate); but I've never been satisfied enough with that interface to actually implement. But, now, Robert, you've made a fantastic suggestion. I really like the insight that the desired action here is a variant of save/restore. Here's the API I think I would like: cairo_state_t * cairo_save_state (cairo_t *cr); void cairo_restore_state (cairo_t *cr, cairo_state_t *state); We should talk about this on the cairo@cairographics.org mailing list. I like this enough that I'll draft a message there if nobody beats me to it. -Carl Moved to todo. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.