[cairo-commit] cairo/src cairo.h, 1.47, 1.48 cairo_surface.c, 1.22, 1.23 cairo_xcb_surface.c, 1.1, 1.2

Jamey Sharp commit at pdx.freedesktop.org
Wed Mar 17 09:44:29 PST 2004


Committed by: jamey

Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv4872/cairo/src

Modified Files:
	cairo.h cairo_surface.c cairo_xcb_surface.c 
Log Message:
Fixed for latest XCB API. XCB headers can co-exist with Xlib headers now,
so Cairo may be compiled with both backends in the same library.
http://freedesktop.org/Software/XCBCompletedTasks#17_Mar_2004


Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** a/cairo.h	24 Feb 2004 20:28:49 -0000	1.47
--- b/cairo.h	17 Mar 2004 17:44:26 -0000	1.48
***************
*** 136,141 ****
  cairo_set_target_xcb (cairo_t		*cr,
  		      XCBConnection	*dpy,
! 		      DRAWABLE		drawable,
! 		      VISUALTYPE	*visual,
  		      cairo_format_t	format);
  #endif /* CAIRO_HAS_XCB_SURFACE */
--- 136,141 ----
  cairo_set_target_xcb (cairo_t		*cr,
  		      XCBConnection	*dpy,
! 		      XCBDRAWABLE	drawable,
! 		      XCBVISUALTYPE	*visual,
  		      cairo_format_t	format);
  #endif /* CAIRO_HAS_XCB_SURFACE */

Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** a/cairo_surface.c	30 Jan 2004 22:44:18 -0000	1.22
--- b/cairo_surface.c	17 Mar 2004 17:44:26 -0000	1.23
***************
*** 39,42 ****
--- 39,43 ----
  
      _cairo_matrix_init (&surface->matrix);
+     surface->filter = CAIRO_FILTER_NEAREST;
      surface->repeat = 0;
  }

Index: cairo_xcb_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xcb_surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/cairo_xcb_surface.c	3 Feb 2004 07:24:14 -0000	1.1
--- b/cairo_xcb_surface.c	17 Mar 2004 17:44:26 -0000	1.2
***************
*** 30,47 ****
  cairo_surface_t *
  cairo_xcb_surface_create (XCBConnection		*dpy,
! 			   DRAWABLE		drawable,
! 			   VISUALTYPE		*visual,
  			   cairo_format_t	format);
  
  #define AllPlanes               ((unsigned long)~0L)
  
! static PICTFORMAT
! format_from_visual(XCBConnection *c, VISUALID visual)
  {
!     static const PICTFORMAT nil = { 0 };
      XCBRenderQueryPictFormatsRep *r;
!     PICTSCREENIter si;
!     PICTDEPTHIter di;
!     PICTVISUALIter vi;
  
      r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
--- 30,47 ----
  cairo_surface_t *
  cairo_xcb_surface_create (XCBConnection		*dpy,
! 			   XCBDRAWABLE		drawable,
! 			   XCBVISUALTYPE		*visual,
  			   cairo_format_t	format);
  
  #define AllPlanes               ((unsigned long)~0L)
  
! static XCBRenderPICTFORMAT
! format_from_visual(XCBConnection *c, XCBVISUALID visual)
  {
!     static const XCBRenderPICTFORMAT nil = { 0 };
      XCBRenderQueryPictFormatsRep *r;
!     XCBRenderPICTSCREENIter si;
!     XCBRenderPICTDEPTHIter di;
!     XCBRenderPICTVISUALIter vi;
  
      r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
***************
*** 49,67 ****
  	return nil;
  
!     for(si = XCBRenderQueryPictFormatsScreens(r); si.rem; PICTSCREENNext(&si))
! 	for(di = PICTSCREENDepths(si.data); di.rem; PICTDEPTHNext(&di))
! 	    for(vi = PICTDEPTHVisuals(di.data); vi.rem; PICTVISUALNext(&vi))
  		if(vi.data->visual.id == visual.id)
! 		    return vi.data->format;
  
      return nil;
  }
  
! static PICTFORMAT
  format_from_cairo(XCBConnection *c, cairo_format_t fmt)
  {
!     static const PICTFORMAT nil = { 0 };
      struct tmpl_t {
! 	DIRECTFORMAT direct;
  	CARD8 depth;
      };
--- 49,71 ----
  	return nil;
  
!     for(si = XCBRenderQueryPictFormatsScreens(r); si.rem; XCBRenderPICTSCREENNext(&si))
! 	for(di = XCBRenderPICTSCREENDepths(si.data); di.rem; XCBRenderPICTDEPTHNext(&di))
! 	    for(vi = XCBRenderPICTDEPTHVisuals(di.data); vi.rem; XCBRenderPICTVISUALNext(&vi))
  		if(vi.data->visual.id == visual.id)
! 		{
! 		    XCBRenderPICTFORMAT ret = vi.data->format;
! 		    free(r);
! 		    return ret;
! 		}
  
      return nil;
  }
  
! static XCBRenderPICTFORMAT
  format_from_cairo(XCBConnection *c, cairo_format_t fmt)
  {
!     XCBRenderPICTFORMAT ret = { 0 };
      struct tmpl_t {
! 	XCBRenderDIRECTFORMAT direct;
  	CARD8 depth;
      };
***************
*** 110,127 ****
      const struct tmpl_t *tmpl;
      XCBRenderQueryPictFormatsRep *r;
!     PICTFORMINFOIter fi;
  
      if(fmt < 0 || fmt >= (sizeof(templates) / sizeof(*templates)))
! 	return nil;
      tmpl = templates + fmt;
  
      r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
      if(!r)
! 	return nil;
  
!     for(fi = XCBRenderQueryPictFormatsFormats(r); fi.rem; PICTFORMINFONext(&fi))
      {
! 	const DIRECTFORMAT *t, *f;
! 	if(fi.data->type != PictTypeDirect)
  	    continue;
  	if(fi.data->depth != tmpl->depth)
--- 114,131 ----
      const struct tmpl_t *tmpl;
      XCBRenderQueryPictFormatsRep *r;
!     XCBRenderPICTFORMINFOIter fi;
  
      if(fmt < 0 || fmt >= (sizeof(templates) / sizeof(*templates)))
! 	return ret;
      tmpl = templates + fmt;
  
      r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
      if(!r)
! 	return ret;
  
!     for(fi = XCBRenderQueryPictFormatsFormats(r); fi.rem; XCBRenderPICTFORMINFONext(&fi))
      {
! 	const XCBRenderDIRECTFORMAT *t, *f;
! 	if(fi.data->type != XCBRenderPictTypeDirect)
  	    continue;
  	if(fi.data->depth != tmpl->depth)
***************
*** 138,145 ****
  	    continue;
  
! 	return fi.data->id;
      }
  
!     return nil;
  }
  
--- 142,150 ----
  	    continue;
  
! 	ret = fi.data->id;
      }
  
!     free(r);
!     return ret;
  }
  
***************
*** 147,152 ****
  cairo_set_target_xcb (cairo_t		*cr,
  		      XCBConnection	*dpy,
! 		      DRAWABLE		drawable,
! 		      VISUALTYPE	*visual,
  		      cairo_format_t	format)
  {
--- 152,157 ----
  cairo_set_target_xcb (cairo_t		*cr,
  		      XCBConnection	*dpy,
! 		      XCBDRAWABLE		drawable,
! 		      XCBVISUALTYPE	*visual,
  		      cairo_format_t	format)
  {
***************
*** 172,179 ****
  
      XCBConnection *dpy;
!     GCONTEXT gc;
!     DRAWABLE drawable;
      int owns_pixmap;
!     VISUALTYPE *visual;
      cairo_format_t format;
  
--- 177,184 ----
  
      XCBConnection *dpy;
!     XCBGCONTEXT gc;
!     XCBDRAWABLE drawable;
      int owns_pixmap;
!     XCBVISUALTYPE *visual;
      cairo_format_t format;
  
***************
*** 184,188 ****
      int height;
  
!     PICTURE picture;
  } cairo_xcb_surface_t;
  
--- 189,193 ----
      int height;
  
!     XCBRenderPICTURE picture;
  } cairo_xcb_surface_t;
  
***************
*** 232,236 ****
      cairo_xcb_surface_t *src = abstract_src;
      XCBConnection *dpy = src->dpy;
!     DRAWABLE d;
      cairo_xcb_surface_t *surface;
  
--- 237,241 ----
      cairo_xcb_surface_t *src = abstract_src;
      XCBConnection *dpy = src->dpy;
!     XCBDRAWABLE d;
      cairo_xcb_surface_t *surface;
  
***************
*** 290,295 ****
  bits_per_pixel(XCBConnection *c, int depth)
  {
!     FORMAT *fmt = XCBConnSetupSuccessRepPixmapFormats(XCBGetSetup(c));
!     FORMAT *fmtend = fmt + XCBConnSetupSuccessRepPixmapFormatsLength(XCBGetSetup(c));
  
      for(; fmt != fmtend; ++fmt)
--- 295,300 ----
  bits_per_pixel(XCBConnection *c, int depth)
  {
!     XCBFORMAT *fmt = XCBConnSetupSuccessRepPixmapFormats(XCBGetSetup(c));
!     XCBFORMAT *fmtend = fmt + XCBConnSetupSuccessRepPixmapFormatsLength(XCBGetSetup(c));
  
      for(; fmt != fmtend; ++fmt)
***************
*** 411,415 ****
  {
      cairo_xcb_surface_t *surface = abstract_surface;
!     TRANSFORM xtransform;
  
      if (!surface->picture.xid)
--- 416,420 ----
  {
      cairo_xcb_surface_t *surface = abstract_surface;
!     XCBRenderTRANSFORM xtransform;
  
      if (!surface->picture.xid)
***************
*** 481,485 ****
      cairo_xcb_surface_t *surface = abstract_surface;
  
!     CARD32 mask = CreatePictureRepeat;
      CARD32 pa[] = { repeat };
  
--- 486,490 ----
      cairo_xcb_surface_t *surface = abstract_surface;
  
!     CARD32 mask = XCBRenderCPRepeat;
      CARD32 pa[] = { repeat };
  
***************
*** 526,558 ****
      switch (operator) {
      case CAIRO_OPERATOR_CLEAR:
! 	return PictOpClear;
      case CAIRO_OPERATOR_SRC:
! 	return PictOpSrc;
      case CAIRO_OPERATOR_DST:
! 	return PictOpDst;
      case CAIRO_OPERATOR_OVER:
! 	return PictOpOver;
      case CAIRO_OPERATOR_OVER_REVERSE:
! 	return PictOpOverReverse;
      case CAIRO_OPERATOR_IN:
! 	return PictOpIn;
      case CAIRO_OPERATOR_IN_REVERSE:
! 	return PictOpInReverse;
      case CAIRO_OPERATOR_OUT:
! 	return PictOpOut;
      case CAIRO_OPERATOR_OUT_REVERSE:
! 	return PictOpOutReverse;
      case CAIRO_OPERATOR_ATOP:
! 	return PictOpAtop;
      case CAIRO_OPERATOR_ATOP_REVERSE:
! 	return PictOpAtopReverse;
      case CAIRO_OPERATOR_XOR:
! 	return PictOpXor;
      case CAIRO_OPERATOR_ADD:
! 	return PictOpAdd;
      case CAIRO_OPERATOR_SATURATE:
! 	return PictOpSaturate;
      default:
! 	return PictOpOver;
      }
  }
--- 531,563 ----
      switch (operator) {
      case CAIRO_OPERATOR_CLEAR:
! 	return XCBRenderPictOpClear;
      case CAIRO_OPERATOR_SRC:
! 	return XCBRenderPictOpSrc;
      case CAIRO_OPERATOR_DST:
! 	return XCBRenderPictOpDst;
      case CAIRO_OPERATOR_OVER:
! 	return XCBRenderPictOpOver;
      case CAIRO_OPERATOR_OVER_REVERSE:
! 	return XCBRenderPictOpOverReverse;
      case CAIRO_OPERATOR_IN:
! 	return XCBRenderPictOpIn;
      case CAIRO_OPERATOR_IN_REVERSE:
! 	return XCBRenderPictOpInReverse;
      case CAIRO_OPERATOR_OUT:
! 	return XCBRenderPictOpOut;
      case CAIRO_OPERATOR_OUT_REVERSE:
! 	return XCBRenderPictOpOutReverse;
      case CAIRO_OPERATOR_ATOP:
! 	return XCBRenderPictOpAtop;
      case CAIRO_OPERATOR_ATOP_REVERSE:
! 	return XCBRenderPictOpAtopReverse;
      case CAIRO_OPERATOR_XOR:
! 	return XCBRenderPictOpXor;
      case CAIRO_OPERATOR_ADD:
! 	return XCBRenderPictOpAdd;
      case CAIRO_OPERATOR_SATURATE:
! 	return XCBRenderPictOpSaturate;
      default:
! 	return XCBRenderPictOpOver;
      }
  }
***************
*** 577,581 ****
      cairo_xcb_surface_t *src_clone = NULL;
      cairo_xcb_surface_t *mask_clone = NULL;
!     PICTURE maskpict = { 0 };
      
  
--- 582,586 ----
      cairo_xcb_surface_t *src_clone = NULL;
      cairo_xcb_surface_t *mask_clone = NULL;
!     XCBRenderPICTURE maskpict = { 0 };
      
  
***************
*** 629,633 ****
  {
      cairo_xcb_surface_t *surface = abstract_surface;
!     COLOR render_color;
  
      if (!CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE (surface))
--- 634,638 ----
  {
      cairo_xcb_surface_t *surface = abstract_surface;
!     XCBRenderCOLOR render_color;
  
      if (!CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE (surface))
***************
*** 639,647 ****
      render_color.alpha = color->alpha_short;
  
!     /* XXX: This RECTANGLE cast is evil... it needs to go away somehow. */
      XCBRenderFillRectangles (surface->dpy,
  			   _render_operator (operator),
  			   surface->picture,
! 			   render_color, num_rects, (RECTANGLE *) rects);
  
      return CAIRO_STATUS_SUCCESS;
--- 644,652 ----
      render_color.alpha = color->alpha_short;
  
!     /* XXX: This XCBRECTANGLE cast is evil... it needs to go away somehow. */
      XCBRenderFillRectangles (surface->dpy,
  			   _render_operator (operator),
  			   surface->picture,
! 			   render_color, num_rects, (XCBRECTANGLE *) rects);
  
      return CAIRO_STATUS_SUCCESS;
***************
*** 672,676 ****
      }
  
!     /* XXX: The TRAP cast is evil and needs to go away somehow. */
      /* XXX: format_from_cairo is slow. should cache something. */
      XCBRenderTrapezoids (dst->dpy,
--- 677,681 ----
      }
  
!     /* XXX: The XCBRenderTRAP cast is evil and needs to go away somehow. */
      /* XXX: format_from_cairo is slow. should cache something. */
      XCBRenderTrapezoids (dst->dpy,
***************
*** 678,682 ****
  				src->picture, dst->picture,
  				format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
! 				xSrc, ySrc, num_traps, (TRAP *) traps);
  
      /* XXX: This is messed up. If I can xcb_surface_create, then I
--- 683,687 ----
  				src->picture, dst->picture,
  				format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
! 				xSrc, ySrc, num_traps, (XCBRenderTRAP *) traps);
  
      /* XXX: This is messed up. If I can xcb_surface_create, then I
***************
*** 738,743 ****
  cairo_surface_t *
  cairo_xcb_surface_create (XCBConnection		*dpy,
! 			   DRAWABLE		drawable,
! 			   VISUALTYPE		*visual,
  			   cairo_format_t	format)
  {
--- 743,748 ----
  cairo_surface_t *
  cairo_xcb_surface_create (XCBConnection		*dpy,
! 			   XCBDRAWABLE		drawable,
! 			   XCBVISUALTYPE	*visual,
  			   cairo_format_t	format)
  {
***************
*** 761,770 ****
      if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface))
      {
! 	PICTFORMAT fmt;
  	if(visual)
  	    fmt = format_from_visual (dpy, visual->visual_id);
  	else
  	    fmt = format_from_cairo (dpy, format);
! 	surface->picture = XCBPICTURENew(dpy);
  	XCBRenderCreatePicture (dpy, surface->picture, drawable,
  				fmt, 0, NULL);
--- 766,775 ----
      if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface))
      {
! 	XCBRenderPICTFORMAT fmt;
  	if(visual)
  	    fmt = format_from_visual (dpy, visual->visual_id);
  	else
  	    fmt = format_from_cairo (dpy, format);
! 	surface->picture = XCBRenderPICTURENew(dpy);
  	XCBRenderCreatePicture (dpy, surface->picture, drawable,
  				fmt, 0, NULL);





More information about the cairo-commit mailing list