[cairo] Screen* must be known in Xlib backend

Owen Taylor otaylor at redhat.com
Tue Jul 19 17:35:49 PDT 2005


On Tue, 2005-07-19 at 17:55 -0400, Keith Packard wrote:
> On Tue, 2005-07-19 at 14:38 -0400, Owen Taylor wrote:
> 
> > An obvious question is whether we should be using a Screen * here or a
> > screen number.
> 
> I used Screen * because it can be statically typechecked.
> 
> > So a using a screen number (just like Xft) would have been my expectation.
> 
> I can change this if you're really adamant, but I do like to encourage
> type-safe interfaces where possible...

Since my instinct to order the arguments

 display, screen, drawable

Instead of:

 display, drawable, screen

The static type check is probably good :-). I'll trust your judgment in
terms of Xlib-related API taste ... you've been doing it longer than I
have.

> > So the right check is:
> > 
> > -               if (src->dpy == dst->dpy && !_surfaces_compatible (src, dst))
> > +               /* If the source and destination are for the same screen,
> > +                * then we can go ahead and check for compatibility now. Otherwise,
> > +                * we have to wait until _cairo_xlib_surface_clone_similar() does
> > +                * its work */
> > +               if (src->dpy == dst->dpy && src->screen == dst->screen &&
> > +                   !_surfaces_compatible (src, dst))
> 
> I've changed this to use:

>                 /* If these are on the same screen but otherwise incompatible,
>                  * make a copy as core drawing can't cross depths and doesn't
>                  * work rightacross visuals of the same depth
>                  */
>                 if (_cairo_xlib_surface_same_screen (dst, src) &&
>                     !_surfaces_compatible (dst, src))
>                     return DO_UNSUPPORTED;

Hmm, the comment there doesn't strike me as accurate ... we aren't
making a copy ... we are doing a GetImage/PutImage fallback. I might
also prefer a comment that hints as to why surfaces on different screens
are (possibly) OK. But I can certainly go in and improve comments
afterwords if so inspired...

> With _cairo_xlib_surface_same_screen implemented as:
> 
> /*
>  * Return whether two xlib surfaces share the same
>  * screen.  Both core and Render drawing require this
>  * when using multiple drawables in an operation.
>  */
> static cairo_bool_t
> _cairo_xlib_surface_same_screen (cairo_xlib_surface_t *dst,
>                                  cairo_xlib_surface_t *src)
> {
>     return dst->dpy == src->dpy && dst->screen == src->screen;
> }

Otherwise looks OK.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050719/157ab6f4/attachment.pgp


More information about the cairo mailing list