ado@elsie.UUCP (Arthur David Olson) (02/14/89)
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? 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;
}