Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!sharkey!mcf!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.windows.x Subject: Second try: color frame buffer tile padding--bug or feature? Message-ID: <9080@elsie.UUCP> Date: 25 Feb 89 19:47:14 GMT Organization: NIH-LEC, Bethesda, MD Lines: 84 The only response I received to an earlier posting of these questions still leaves me stumped (see below), so I'm trying again. XV11R3's "cfbPadPixmap" function (in "cfbpixmap.c") pads narrow tiling Pixmaps if 32 is an even multiple of their widths. This means that if you 1. create a "narrow" Pixmap with a call such as tile = XCreatePixmap(display, window, 1, 16, 8); 2. fill the Pixmap with some desired data 3. associate the Pixmap with a GC with a call such as XSetTile(display, tiling_gc, tile) 4. use the GC to tile a region and then try to 1. refill the Pixmap with new data 2. reassociate the Pixmap with a GC to update the tiling you're in trouble--you will presumably only rewrite the first column of a Pixmap that's been widened to 32 columns, so the tiling will be done differently from what I (at least) would expect. (I've attached sample code that, when run, shows what the situation is. If you put the code in a file named "try.c" and then cc try.c -lX11 -o try note how the correct output you get from typing the command try + differs from the output you get when you type try unadorned.) Two questions. Is this behavior documented somewhere that I missed? And should it be considered a bug? A response to my earlier posting of these questions pointed out that the X protocol specification says Storing a pixmap in a gcontext might or might not result in a copy being made. If the pixmap is later used as the destination for a graphics request, the change might or might not be reflected in the gcontext. If the pixmap is used s[i]multaneously in a graphics request as both a destination and as a tile or stipple, the results are not defined. But should the above passage serve as a clue to me that the size of the pixmap can be changed? If you have answers, I'd appreciate hearing from you by electronic mail. -- Arthur David Olson ado@ncifcrf.gov ADO is a trademark of Ampex. #include "X11/Xlib.h" int main(argc, argv) char * argv[]; { register GC default_gc; register Display * display; register int i; register Window root_window; register int screen_number; register Pixmap tile; register GC tiling_gc; register Window window; display = XOpenDisplay((char *) 0); XSynchronize(display, 1); root_window = XDefaultRootWindow(display); screen_number = XDefaultScreen(display); default_gc = XDefaultGC(display, screen_number); window = XCreateSimpleWindow(display, root_window, 0, 0, 100, 100, 0, (unsigned long) 0, (unsigned long) 0); XMapWindow(display, window); (void) getchar(); tiling_gc = XCreateGC(display, window, 0, (XGCValues *) 0); XCopyGC(display, default_gc, (unsigned long) ~0, tiling_gc); XSetFillStyle(display, tiling_gc, FillTiled); tile = XCreatePixmap(display, window, 1, 100, 8); XSetTile(display, tiling_gc, tile); XFillRectangle(display, window, tiling_gc, 0, 0, 1, 1); for (i = 0; i < 100; ++i) if (((i / 4) % 2) == 0) XDrawPoint(display, tile, default_gc, 0, i); XSetTile(display, tiling_gc, tile); XFillRectangle(display, window, tiling_gc, 0, 0, 100, 100); (void) getchar(); return 0; }