crtimg.m

Geoff Clare,,,, gwc at kemper.freedesktop.org
Mon May 14 08:29:48 PDT 2007


Update of /cvs/xtest/xts5/tset/Xlib17/crtimg
In directory kemper:/tmp/cvs-serv4023

Modified Files:
	crtimg.m 
Log Message:
In test 1 calculate a valid bytes_per_line value for each visual

Index: crtimg.m
===================================================================
RCS file: /cvs/xtest/xts5/tset/Xlib17/crtimg/crtimg.m,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- crtimg.m	3 Nov 2005 08:43:03 -0000	1.2
+++ crtimg.m	14 May 2007 15:29:46 -0000	1.3
@@ -31,6 +31,9 @@
 >># 
 >># Modifications:
 >># $Log$
+>># Revision 1.3  2007/05/14 15:29:46  gwc
+>># In test 1 calculate a valid bytes_per_line value for each visual
+>>#
 >># Revision 1.2  2005/11/03 08:43:03  jmichael
 >># clean up all vsw5 paths to use xts5 instead.
 >>#
@@ -235,6 +238,7 @@
 		return 1;
 	return 0;
 }
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad) - 1)) / (pad)) * (pad)) /* Courtesy of Xlib */
 >>ASSERTION Good A
 A call to xname allocates and returns an
 .S XImage
@@ -277,8 +281,6 @@
 	width = 10;
 	height = 20;
 	bitmap_pad = bmpad;
-	bytes_per_line = 11;
-
 
 	for(resetvinf(VI_WIN_PIX); nextvinf(&vi);) {
 		
@@ -288,6 +290,22 @@
 		gm = vi->green_mask;
 		bm = vi->blue_mask;
 
+		bpp = -1;
+		for(i=npv, f=pv; i>0; i--,f++)
+			if(f->depth == depth) {
+				bpp = f->bits_per_pixel;
+				break;
+			}
+
+		if(bpp == -1) {
+			delete("Could not determine the bits_per_pixel component for depth %d.", depth);
+			fail++; /* Avoid path checking in CHECKPASS */
+			continue;
+		} else
+			CHECK;
+
+		bytes_per_line = ROUNDUP((bpp * (width+1)), bmpad) >> 3;
+
 		trace("ZPixmap.");
 		format = ZPixmap;
 		im = XCALL;
@@ -298,28 +316,15 @@
 		} else {
 			CHECK;
 
-			bpp = -1;
-			for(i=npv, f=pv; i>0; i--,f++)
-				if(f->depth == depth) {
-					bpp = f->bits_per_pixel;
-					break;
-				}
-
-			if(bpp == -1) {
-				delete("Could not determine the bits_per_pixel component for depth %d.", depth);
-				fail++; /* Avoid path checking in CHECKPASS */
-				bpp = depth;
-			} else
-				CHECK;
 
 			if(checkstruct(im, width, height, offset, format, data, byteord, bmunit, bmbitord, bitmap_pad, depth, bytes_per_line, bpp, rm, gm, bm) == 0)
 				FAIL;
 			else
 				CHECK;
-		}
 
-		im->data = (char *) NULL;
-		XDestroyImage(im);
+			im->data = (char *) NULL;
+			XDestroyImage(im);
+		}
 
 		trace("XYPixmap.");
 		format = XYPixmap;
@@ -336,10 +341,9 @@
 			else
 				CHECK;
 
+			im->data = (char *) NULL;
+			XDestroyImage(im);
 		}
-
-		im->data = (char *) NULL;
-		XDestroyImage(im);
 	}
 
 
@@ -359,7 +363,6 @@
    Verify that the call did not return NULL.
    Verify that the bytes_per_line component of the structure is correct.
 >>CODE
-#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad) - 1)) / (pad)) * (pad)) /* Courtesy of Xlib */
 XVisualInfo	*vi;
 XImage		*im;
 int		bmpad;



More information about the xorg-test-commit mailing list