[cairo] Re: New API: cairo_surface_get_width/height
Gustavo J. A. M. Carneiro
gjc at inescporto.pt
Mon Jun 12 06:30:35 PDT 2006
On Seg, 2006-06-12 at 07:35 -0400, Owen Taylor wrote:
> On Mon, 2006-06-12 at 18:06 +1200, Robert O'Callahan wrote:
> > On Fri, 2006-06-09 at 08:41 -0700, Carl Worth wrote:
> > > On Fri, 09 Jun 2006 08:07:07 -0400, Owen Taylor wrote:
> > > > It's certainly worth pointing out that in the motivating case here,
> > > > the information about inherent clipping is available without adding
> > > > anything to Cairo; given an XID, it's straightforward to say:
> > > >
> > > > - What's the GdkDrawable for this XID
> > > > - Is that a pixmap?
> > > > - What's the size of the pixmap?
> > > >
> > > > In fact, since Robert is about to call GDK theme drawing functions,
> > > > he's already done the first step.
> > >
> > > OK. So maybe Robert is just fine as far as all this goes. Robert?
> >
> > What if there isn't a GdkDrawable for the XID, e.g. because someone
> > called push_group? Then fetching the width/height requires X server
> > roundtripping.
>
> Isn't drawing outside of Cairo to the push_group() surface going to
> kill the ability of Cairo to ever be smart about group surface size?
>
> > We originally had a very simple double-buffering implementation using
> > push_group, and had to drop it in favour of creating a GdkPixmap
> > explicitly, to avoid exactly that problem. We still get hammered when we
> > want to paint themes inside a push_group, e.g. when 'opacity' is in use.
> > To fix that we first have to get GDK to export a
> > gdk_pixmap_foreign_new_with_width_height API (I believe this is in the
> > works). Then we have to have a way to get the width and height without a
> > round trip, which brings us back to needing some kind of surface
> > width/height API in cairo. I'm find with it being cairo_xlib_surface
> > getters.
>
> One thing to be careful of is that cairo_xlib_surface_get_width/height()
> will cause naming conflicts for language bindings if
> cairo_surface_get_width/height() are ever added.
Indeed. Something similar already happened with cairo_rectangle vs
gdk_cairo_rectangle, which already caused some confusion in some of my
code :-( This is partially my fault for mapping that function as a
method instead of as a function, of course.. your warning is most
pertinent.
Regards.
--
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2289 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060612/793a9855/smime.bin
More information about the cairo
mailing list