gecko-dev/gfx/cairo/cairo-xlib-getters.patch

142 lines
4.5 KiB
Diff

Index: gfx/cairo/cairo/src/cairo-xlib-surface.c
===================================================================
RCS file: /home/rocallahan/mozilla-cvs-mirror/mozilla/gfx/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.5
diff -u -t -p -1 -2 -r1.5 cairo-xlib-surface.c
--- gfx/cairo/cairo/src/cairo-xlib-surface.c 20 Feb 2006 21:08:14 -0000 1.5
+++ gfx/cairo/cairo/src/cairo-xlib-surface.c 22 Feb 2006 03:02:23 -0000
@@ -2043,24 +2043,90 @@ cairo_xlib_surface_set_drawable (cairo_s
if (surface->src_picture)
XRenderFreePicture (surface->dpy, surface->src_picture);
surface->dst_picture = None;
surface->src_picture = None;
surface->drawable = drawable;
}
surface->width = width;
surface->height = height;
}
+static cairo_bool_t _is_valid_xlib_surface (cairo_surface_t *abstract_surface)
+{
+ return _cairo_surface_is_xlib (abstract_surface) &&
+ abstract_surface->status == CAIRO_STATUS_SUCCESS;
+}
+
+Drawable
+cairo_xlib_surface_get_drawable (cairo_surface_t *abstract_surface)
+{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *)abstract_surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _is_valid_xlib_surface (abstract_surface))
+ return 0;
+
+ return surface->drawable;
+}
+
+Display *
+cairo_xlib_surface_get_display (cairo_surface_t *abstract_surface)
+{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *)abstract_surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _is_valid_xlib_surface (abstract_surface))
+ return NULL;
+
+ return surface->dpy;
+}
+
+Screen *
+cairo_xlib_surface_get_screen (cairo_surface_t *abstract_surface)
+{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *)abstract_surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _is_valid_xlib_surface (abstract_surface))
+ return NULL;
+
+ return surface->screen;
+}
+
+Visual *
+cairo_xlib_surface_get_visual (cairo_surface_t *abstract_surface)
+{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *)abstract_surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _is_valid_xlib_surface (abstract_surface))
+ return NULL;
+
+ return surface->visual;
+}
+
+int
+cairo_xlib_surface_get_depth (cairo_surface_t *abstract_surface)
+{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *)abstract_surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _is_valid_xlib_surface (abstract_surface))
+ return -1;
+
+ return surface->depth;
+}
+
typedef struct _cairo_xlib_surface_font_private {
Display *dpy;
GlyphSet glyphset;
XRenderPictFormat *format;
} cairo_xlib_surface_font_private_t;
static cairo_status_t
_cairo_xlib_surface_font_init (Display *dpy,
cairo_scaled_font_t *scaled_font,
cairo_format_t format)
{
cairo_xlib_surface_font_private_t *font_private;
Index: gfx/cairo/cairo/src/cairo-xlib.h
===================================================================
RCS file: /home/rocallahan/mozilla-cvs-mirror/mozilla/gfx/cairo/cairo/src/cairo-xlib.h,v
retrieving revision 1.6
diff -u -t -p -1 -2 -r1.6 cairo-xlib.h
--- gfx/cairo/cairo/src/cairo-xlib.h 6 Oct 2005 04:02:06 -0000 1.6
+++ gfx/cairo/cairo/src/cairo-xlib.h 16 Feb 2006 21:12:44 -0000
@@ -61,20 +61,35 @@ cairo_xlib_surface_create_for_bitmap (Di
cairo_public void
cairo_xlib_surface_set_size (cairo_surface_t *surface,
int width,
int height);
cairo_public void
cairo_xlib_surface_set_drawable (cairo_surface_t *surface,
Drawable drawable,
int width,
int height);
+cairo_public Drawable
+cairo_xlib_surface_get_drawable (cairo_surface_t *surface);
+
+cairo_public Display *
+cairo_xlib_surface_get_display (cairo_surface_t *surface);
+
+cairo_public Screen *
+cairo_xlib_surface_get_screen (cairo_surface_t *surface);
+
+cairo_public Visual *
+cairo_xlib_surface_get_visual (cairo_surface_t *surface);
+
+cairo_public int
+cairo_xlib_surface_get_depth (cairo_surface_t *abstract_surface);
+
CAIRO_END_DECLS
#else /* CAIRO_HAS_XLIB_SURFACE */
# error Cairo was not compiled with support for the xlib backend
#endif /* CAIRO_HAS_XLIB_SURFACE */
#endif /* CAIRO_XLIB_H */