[Commit] Xc/src Xc.h,1.9,1.10 xcsurface.c,1.3,1.4

Carl Worth commit@keithp.com
Wed, 28 May 2003 19:34:43 -0700


Committed by: cworth

Update of /local/src/CVS/Xc/src
In directory home.keithp.com:/tmp/cvs-serv13269/src

Modified Files:
	Xc.h xcsurface.c 
Log Message:
Removed depth parameter from XcSurfacePutImage

Index: Xc.h
===================================================================
RCS file: /local/src/CVS/Xc/src/Xc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Xc.h	15 May 2003 01:16:16 -0000	1.9
+++ Xc.h	29 May 2003 02:34:41 -0000	1.10
@@ -99,8 +99,7 @@
 		   unsigned char	*data,
 		   unsigned int		width,
 		   unsigned int		height,
-		   unsigned int		stride,
-		   unsigned int		depth);
+		   unsigned int		stride);
 
 /* compositing */
 

Index: xcsurface.c
===================================================================
RCS file: /local/src/CVS/Xc/src/xcsurface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xcsurface.c	15 May 2003 01:16:16 -0000	1.3
+++ xcsurface.c	29 May 2003 02:34:41 -0000	1.4
@@ -238,13 +238,14 @@
 		   unsigned char	*data,
 		   unsigned int		width,
 		   unsigned int		height,
-		   unsigned int		stride,
-		   unsigned int		depth)
+		   unsigned int		stride)
 {
     if (surface->picture) {
 	XImage *image;
 	unsigned bitmap_pad;
-	Pixmap pix;
+
+	/* XXX: This is obviously bogus. depth needs to be figured out for real */
+	int depth = 32;
 
 	if (depth > 16)
 	    bitmap_pad = 32;
@@ -253,11 +254,6 @@
 	else
 	    bitmap_pad = 8;
 
-	pix = XCreatePixmap(surface->dpy,
-			    DefaultRootWindow(surface->dpy),
-			    width, height,
-			    depth);
-
 	image = XCreateImage(surface->dpy,
 			     DefaultVisual(surface->dpy, DefaultScreen(surface->dpy)),
 			     depth, ZPixmap, 0,
@@ -271,7 +267,6 @@
 	_XcSurfaceEnsureGC (surface);
 	XPutImage(surface->dpy, surface->drawable, surface->gc,
 		  image, 0, 0, 0, 0, width, height);
-	XFreePixmap(surface->dpy, pix);
 
 	/* Foolish XDestroyImage thinks it can free my data, but I won't
 	   stand for it. */
@@ -285,22 +280,57 @@
 void
 _XcSurfacePullImage (XcSurface *surface)
 {
+/* XXX: NYI
     if (surface->type == XC_SURFACE_TYPE_ICIMAGE)
 	return;
 
-/* XXX: NYI
-    if (surface->icimage == NULL) {
-	surface->icimage = IcImageCreate ( );
+    if (surface->icimage) {
+	IcImageDestroy (surface->icimage);
+	surface->icimage = NULL;
     }
+
+    _XcSurfaceEnsureGC (surface);
+    surface->ximage = XGetImage (surface->dpy,
+				 surface->drawable,
+				 surface->gc,
+				 0, 0,
+				 width, height,
+				 AllPlanes, ZPixmap);
+    
+    surface->icimage = IcImageCreateForData (image->data,
+					     IcFormat *format,
+					     int width, int height,
+					     int bpp, int stride);
 */
 
-    /* XXX: How to get external alpha from the picture? */
+    /* XXX: Add support here for pictures with external alpha. */
 
 }
 
 void
 _XcSurfacePushImage (XcSurface *surface)
 {
-    /* XXX: NYI */
+/* XXX: NYI
+    if (surface->type == XC_SURFACE_TYPE_ICIMAGE)
+	return;
+
+    if (surface->ximage == NULL)
+	return;
+
+    _XcSurfaceEnsureGC (XcSurface *surface);
+    XPutImage (surface->dpy,
+	       surface->drawable,
+	       surface->gc,
+	       surface->ximage,
+	       0, 0,
+	       0, 0,
+	       width, height);
+
+    * Foolish XDestroyImage thinks it can free my data, but I won't
+       stand for it. *
+    surface->ximage->data = NULL;
+    XDestroyImage(surface->ximage);
+    surface->ximage = NULL;
+*/
 }