[cairo] A hidden offset for the Xlib backend
Jost Boekemeier
jost2345 at yahoo.de
Mon Mar 14 04:15:59 PST 2005
On Sun, 2005-03-13 at 23:32, Owen Taylor wrote:
> >
> > I like the other approach, making the "device offset"
> > an offset which contributes to the CTM, very much. If
> > this gets implemented, I could use it, too. (I have to
> > rewrite the code anyway once the new api is there, so
> > this isn't really a problem).
>
> Can you give more details about your use case?
I can get rid of the cairo_translate when replaying the retained path
onto the surface:
/* compose context */
void
retained_compose_draw (cairo_shape_compose_context_t *_cx,
cairo_shape_drawing_context_t *_cr,
cairo_shape_viewport_t *view,
cairo_surface_t *surface)
{
struct retained* cr = (struct retained*) _cr;
struct retained_compose* cx = (struct retained_compose*) _cx;
cairo_save(cr->ct);
cairo_set_target_surface(cr->ct, surface);
cairo_translate(cr->ct, -view->bounds.x, -view->bounds.y);
path_replay(view, cr);
cairo_restore(cr->ct);
}
The x/y offset is currently maintained by the library above cairo. If
we decide to push the offset into cairo, we could call the method
"cairo_set_device_offset_internal()" for example to emphasize that this
method is expected to be called only by the toolkit or the retained mode
immediately above cairo, not by applications.
Jost
More information about the cairo
mailing list