[9082] in Athena Bugs

home help back first fref pref prev next nref lref last post

decmips 7.3P: XFillRectangle fails on bitmaps wider than 32 bits

daemon@ATHENA.MIT.EDU (Barr3y Jaspan)
Thu Mar 12 21:54:57 1992

To: bugs@Athena.MIT.EDU
Date: Thu, 12 Mar 92 21:54:38 EST
From: "Barr3y Jaspan" <bjaspan@Athena.MIT.EDU>

System name:		hodge
Type and version:	KN01 7.3P (1 update(s) to same version)
Display type:		PMAX-MFB

What were you trying to do?

Use XFillRectangle to fill a region with copies of a bitmap that is
wider than 32 bits.

What's wrong:

It's failing.  Portions of the rectangle to be filled in are drawn as
solid.  This happens *only* on a DECstation.

What should have happened:

The bitmap should have been drawn correctly.

The following program demonstrates the problem.  It does an XCopyArea
to show a normal copy of the bitmap (which works fine), and then an
XFillRectanngle to demonstrate the failure.

--- snip snip ---

#include <stdio.h>
#include <X11/Xlib.h>

#define t_wall_width 52
#define t_wall_height 26
static char t_wall_bits[] = {
 0xff,0x3f,0x08,0x21,0xf8,0xff,0x0f,0xff,0xdf,0x66,0xcc,0xf6,0xff,0x0f,0x00,
 0xa0,0x67,0xcc,0x0b,0x00,0x00,0xff,0x4f,0x67,0xcc,0xe5,0xff,0x0f,0xaa,0xaa,
 0x67,0xcc,0xab,0xaa,0x0a,0x55,0xc5,0x66,0xcc,0x46,0x55,0x05,0xaa,0xaa,0x67,
 0xcc,0xab,0xaa,0x0a,0x55,0x45,0x67,0xcc,0x45,0x55,0x05,0xbb,0xab,0x67,0xcc,
 0xab,0xbb,0x0b,0xee,0xce,0x66,0xcc,0xe6,0xee,0x0e,0xbb,0xab,0x67,0xcc,0xab,
 0xbb,0x0b,0xff,0x4f,0x67,0xcc,0xe5,0xff,0x0f,0xff,0xaf,0x67,0xcc,0xeb,0xff,
 0x0f,0xff,0xcf,0x66,0xcc,0xe6,0xff,0x0f,0xff,0xaf,0x67,0xcc,0xeb,0xff,0x0f,
 0xbb,0x4b,0x67,0xcc,0xa5,0xbb,0x0b,0xee,0xae,0x67,0xcc,0xeb,0xee,0x0e,0xbb,
 0xcb,0x66,0xcc,0xa6,0xbb,0x0b,0x55,0xa5,0x67,0xcc,0x4b,0x55,0x05,0xaa,0x4a,
 0x67,0xcc,0xa5,0xaa,0x0a,0x44,0xa4,0x67,0xcc,0x4b,0x44,0x04,0x00,0xc0,0x66,
 0xcc,0x06,0x00,0x00,0x00,0xa0,0x67,0xcc,0x0b,0x00,0x00,0xff,0x4f,0x67,0xcc,
 0xe5,0xff,0x0f,0xff,0x9f,0x67,0xcc,0xf3,0xff,0x0f,0xff,0x3f,0x08,0x21,0xf8,
 0xff,0x0f};

void Fail(s)
   char *s;
{
     fprintf(stderr, "%s\n", s);
     exit(1);
}

main()
{
     Display *dpy;
     XEvent event;
     Window w;
     Pixmap p;
     XGCValues GCValues;
     GC aGC;
     int ret;

     dpy = XOpenDisplay(NULL);
     if (! dpy) Fail("Cannot open display.");
     
     w = XCreateSimpleWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)),
			     0, 0,
			     500, 100,
			     2,
			     WhitePixel(dpy, DefaultScreen(dpy)),
			     BlackPixel(dpy, DefaultScreen(dpy)));
     if (! w) Fail("Cannot open window.");

     XSelectInput(dpy, w, ExposureMask);
     XMapWindow(dpy, w);

     GCValues.foreground = WhitePixel(dpy, DefaultScreen(dpy));
     GCValues.background = BlackPixel(dpy, DefaultScreen(dpy));
     GCValues.graphics_exposures = False;
     GCValues.function = GXcopy;
     GCValues.fill_style = FillStippled;
     
     aGC = XCreateGC(dpy, w,
		     (GCFunction | GCForeground | GCBackground |
		      GCGraphicsExposures | GCLineWidth | GCFillStyle),
		     &GCValues);
     if (! aGC) Fail("Can't create graphics context");

     p = XCreatePixmapFromBitmapData(dpy, w, t_wall_bits,
				     t_wall_width, t_wall_height,
				     WhitePixel(dpy, DefaultScreen(dpy)),
				     BlackPixel(dpy, DefaultScreen(dpy)),
				     1);
     if (! p) Fail("Can't create pixmap!");
     
     XSetStipple(dpy, aGC, p);
     XSetTSOrigin(dpy, aGC, 10, 46);

     while (1) {
	  XNextEvent(dpy, &event);
	  if (event.xany.type == Expose) {
	       XCopyArea(dpy, p, w, aGC, 0, 0, t_wall_width,
			 t_wall_height, 10, 10);
	       XFillRectangle(dpy, w, aGC, 10, 46, 480, 26);
	  }
     }
}

     
	  
     

home help back first fref pref prev next nref lref last post