[cairo] [PATCH] xcb: make use of _cairo_surface_is_xcb to check for surface type
Bryce W. Harrington
b.harrington at samsung.com
Mon Jul 7 03:53:39 PDT 2014
On Thu, Jul 03, 2014 at 05:28:49PM +0530, RAVI NANJUNDAPPA wrote:
> Thank you Uli for reviewing this patch.
> Please find attached the patch updated with the changes to take care of the
> cairo coding style.
Looks good, pushed.
> Thanks and Best Regards,
> N Ravi
>
> > -----Original Message-----
> > From: Uli Schlachter [mailto:psychon at znc.in]
> > Sent: Thursday, July 03, 2014 5:18 PM
> > To: RAVI NANJUNDAPPA; cairo at cairographics.org
> > Subject: Re: [cairo] [PATCH] xcb: make use of _cairo_surface_is_xcb to
> check
> > for surface type
> >
> > On 02.07.2014 10:46, RAVI NANJUNDAPPA wrote:
> > > Hi,
> > >
> > > Please find attached the updated patch incorporated with review
> > > comments from Uli.
> > > Thanking him for taking time to review the patch.
> > > Please help me in reviewing the attached patch.
> > >
> > > Thanks and Best Regards,
> > > N Ravi
> > >
> > [...]
> >
> > With one minor comment:
> >
> > Reviewed-by: Uli Schlachter <psychon at znc.in>
> >
> > > diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index
> > > c900edc..3b0c422 100644
> > > --- a/src/cairo-xcb-surface.c
> > > +++ b/src/cairo-xcb-surface.c
> > > @@ -1432,7 +1432,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;
> >
> > Here (and in the other change in cairo-xcb-surface.c) it should be "( !"
> instead
> > of "(!". Just to match the normal cairo coding style.
> >
> > Uli
> > --
> > Homophobia - The fear that another man will treat you the way you treat
> > women.
> [0;0m>From a8451cfc2fb2aed2a28ec11510bde0cc94f56d78 Mon Sep 17 00:00:00 2001[0;0m
> [0;0mFrom: Ravi Nanjundappa <nravi.n at samsung.com>[0;0m
> [0;0mDate: Wed, 2 Jul 2014 14:13:58 +0530[0;0m
> [0;0mSubject: [PATCH] xcb: make use of _cairo_surface_is_xcb to check for surface[0;0m
> [0;0m type[0;0m
> [0;0m[0;0m
> [0;0mIntroduced a new inline function _cairo_surface_is_xcb() as similar to[0;0m
> [0;0m_cairo_surface_is_image() and used the same to check for xcb surface[0;0m
> [0;0mtype[0;0m
> [0;0m[0;0m
> [0;0mSigned-off-by: Ravi Nanjundappa <nravi.n at samsung.com>[0;0m
> [0;32m---[0;0m
> [0;0m src/cairo-xcb-private.h | 15 +++++++++++++++[0;0m
> [0;0m src/cairo-xcb-surface-core.c | 2 +-[0;0m
> [0;0m src/cairo-xcb-surface-render.c | 2 +-[0;0m
> [0;0m src/cairo-xcb-surface.c | 4 ++--[0;0m
> [0;0m 4 files changed, 19 insertions(+), 4 deletions(-)[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h[0;0m
> [0;0mindex 5f04803..134100a 100644[0;0m
> [0;32m--- a/src/cairo-xcb-private.h[0;0m
> [1;32m+++ b/src/cairo-xcb-private.h[0;0m
> [1;34m@@ -267,6 +267,21 @@ enum {[0;0m
> [0;0m [0;0m
> [0;0m cairo_private extern const cairo_surface_backend_t _cairo_xcb_surface_backend;[0;0m
> [0;0m [0;0m
> [1;32m+/**[0;0m
> [1;32m+ * _cairo_surface_is_xcb:[0;0m
> [1;32m+ * @surface: a #cairo_surface_t[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * Checks if a surface is an #cairo_xcb_surface_t[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * Return value: %TRUE if the surface is an xcb surface[0;0m
> [1;32m+ **/[0;0m
> [1;32m+static inline cairo_bool_t[0;0m
> [1;32m+_cairo_surface_is_xcb (const cairo_surface_t *surface)[0;0m
> [1;32m+{[0;0m
> [1;32m+ /* _cairo_surface_nil sets a NULL backend so be safe */[0;0m
> [1;32m+ return surface->backend && surface->backend->type == CAIRO_SURFACE_TYPE_XCB;[0;0m
> [1;32m+}[0;0m
> [1;32m+[0;0m
> [0;0m cairo_private cairo_xcb_connection_t *[0;0m
> [0;0m _cairo_xcb_connection_get (xcb_connection_t *connection);[0;0m
> [0;0m [0;0m
> [0;34mdiff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c[0;0m
> [0;0mindex c608c9a..545fd28 100644[0;0m
> [0;32m--- a/src/cairo-xcb-surface-core.c[0;0m
> [1;32m+++ b/src/cairo-xcb-surface-core.c[0;0m
> [1;34m@@ -406,7 +406,7 @@ _cairo_xcb_surface_pixmap (cairo_xcb_surface_t *target,[0;0m
> [0;0m if (pixmap != NULL && pixmap->screen == target->screen)[0;0m
> [0;0m return (cairo_xcb_pixmap_t *) cairo_surface_reference (&pixmap->base);[0;0m
> [0;0m [0;0m
> [0;32m- if (source->type == CAIRO_SURFACE_TYPE_XCB &&[0;0m
> [1;32m+ if (_cairo_surface_is_xcb(source) &&[0;0m
> [0;0m ((cairo_xcb_surface_t *) source)->screen == target->screen)[0;0m
> [0;0m {[0;0m
> [0;0m cairo_xcb_surface_t *xcb_source = (cairo_xcb_surface_t *) source;[0;0m
> [0;34mdiff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c[0;0m
> [0;0mindex 75455e5..3f2fc43 100644[0;0m
> [0;32m--- a/src/cairo-xcb-surface-render.c[0;0m
> [1;32m+++ b/src/cairo-xcb-surface-render.c[0;0m
> [1;34m@@ -1154,7 +1154,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target,[0;0m
> [0;0m [0;0m
> [0;0m if (source->type == CAIRO_SURFACE_TYPE_XCB)[0;0m
> [0;0m {[0;0m
> [0;32m- if (source->backend->type == CAIRO_SURFACE_TYPE_XCB) {[0;0m
> [1;32m+ if (_cairo_surface_is_xcb(source)) {[0;0m
> [0;0m cairo_xcb_surface_t *xcb = (cairo_xcb_surface_t *) source;[0;0m
> [0;0m if (xcb->screen == target->screen && xcb->fallback == NULL) {[0;0m
> [0;0m picture = _copy_to_picture ((cairo_xcb_surface_t *) source);[0;0m
> [0;34mdiff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c[0;0m
> [0;0mindex c900edc..02e7a19 100644[0;0m
> [0;32m--- a/src/cairo-xcb-surface.c[0;0m
> [1;32m+++ b/src/cairo-xcb-surface.c[0;0m
> [1;34m@@ -1432,7 +1432,7 @@ cairo_xcb_surface_set_size (cairo_surface_t *abstract_surface,[0;0m
> [0;0m }[0;0m
> [0;0m [0;0m
> [0;0m [0;0m
> [0;32m- if (abstract_surface->type != CAIRO_SURFACE_TYPE_XCB) {[0;0m
> [1;32m+ if ( !_cairo_surface_is_xcb(abstract_surface)) {[0;0m
> [0;0m _cairo_surface_set_error (abstract_surface,[0;0m
> [0;0m _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));[0;0m
> [0;0m return;[0;0m
> [1;34m@@ -1486,7 +1486,7 @@ cairo_xcb_surface_set_drawable (cairo_surface_t *abstract_surface,[0;0m
> [0;0m }[0;0m
> [0;0m [0;0m
> [0;0m [0;0m
> [0;32m- if (abstract_surface->type != CAIRO_SURFACE_TYPE_XCB) {[0;0m
> [1;32m+ if ( !_cairo_surface_is_xcb(abstract_surface)) {[0;0m
> [0;0m _cairo_surface_set_error (abstract_surface,[0;0m
> [0;0m _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));[0;0m
> [0;0m return;[0;0m
> [0;32m-- [0;0m
> [0;0m1.7.9.5[0;0m
> [0;0m[0;0m
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list