Re: [PATCH] xcb: make use of _cairo_surface_is_xcb to check for surface type
RAVI NANJUNDAPPA <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Hi, I've tested with the basic build check and the build works fine without any issues. Please help me in reviewing this patch. Thanks and Best Regards, N Ravi > -----Original Message----- > From: Ravi Nanjundappa [mailto:[email protected]] > Sent: Monday, June 30, 2014 5:34 PM > To: [email protected] > Cc: Ravi Nanjundappa > Subject: [PATCH] xcb: make use of _cairo_surface_is_xcb to check for > surface type > > Introduced a new inline function _cairo_surface_is_xcb() as similar to > _cairo_surface_is_image() and used the same to check for xcb surface type > > Signed-off-by: Ravi Nanjundappa <[email protected]> > --- > src/cairo-xcb-surface.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index > c900edc..e3230c7 100644 > --- a/src/cairo-xcb-surface.c > +++ b/src/cairo-xcb-surface.c > @@ -78,6 +78,22 @@ slim_hidden_proto > (cairo_xcb_surface_create_with_xrender_format); > * Since: 1.12 > **/ > > + > +/** > + * _cairo_surface_is_xcb: > + * @surface: a #cairo_surface_t > + * > + * Checks if a surface is an #cairo_xcb_surface_t > + * > + * Return value: %TRUE if the surface is an xcb surface **/ static > +inline cairo_bool_t _cairo_surface_is_xcb (const cairo_surface_t > +*surface) { > + /* _cairo_surface_nil sets a NULL backend so be safe */ > + return surface->backend && surface->backend->type == > +CAIRO_SURFACE_TYPE_XCB; } > + > cairo_surface_t * > _cairo_xcb_surface_create_similar (void > *abstract_other, > cairo_content_t content, > @@ -1432,7 +1448,7 @@ cairo_xcb_surface_set_size (cairo_surface_t > *abstract_surface, > } > > > - if (abstract_surface->type != CAIRO_SURFACE_TYPE_XCB) { > + if (! _cairo_surface_is_xcb (abstract_surface)) { > _cairo_surface_set_error (abstract_surface, > _cairo_error > (CAIRO_STATUS_SURFACE_TYPE_MISMATCH)); > return; > @@ -1486,7 +1502,7 @@ cairo_xcb_surface_set_drawable (cairo_surface_t > *abstract_surface, > } > > > - if (abstract_surface->type != CAIRO_SURFACE_TYPE_XCB) { > + if (! _cairo_surface_is_xcb (abstract_surface)) { > _cairo_surface_set_error (abstract_surface, > _cairo_error > (CAIRO_STATUS_SURFACE_TYPE_MISMATCH)); > return; > -- > 1.7.9.5 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo