diff options
author | rsc <devnull@localhost> | 2003-10-11 02:47:43 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-10-11 02:47:43 +0000 |
commit | 161060a46346fa0beeb48b55ed28b2cd330bc4e8 (patch) | |
tree | ddcba6ab6af148fefd7667f494485ebc3675fa3f /src/libdraw/x11-alloc.c | |
parent | 4af386f434d5ca3de733951d4f73dd134e879cc2 (diff) | |
download | plan9port-161060a46346fa0beeb48b55ed28b2cd330bc4e8.tar.gz plan9port-161060a46346fa0beeb48b55ed28b2cd330bc4e8.tar.bz2 plan9port-161060a46346fa0beeb48b55ed28b2cd330bc4e8.zip |
Lots of X fixes.
Diffstat (limited to 'src/libdraw/x11-alloc.c')
-rw-r--r-- | src/libdraw/x11-alloc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libdraw/x11-alloc.c b/src/libdraw/x11-alloc.c index 19475c74..458efc61 100644 --- a/src/libdraw/x11-alloc.c +++ b/src/libdraw/x11-alloc.c @@ -37,20 +37,21 @@ xallocmemimage(Rectangle r, u32int chan, int pixmap) } /* - * Allocate backing store. What we call a 32-bit image - * the X server calls a 24-bit image. + * Allocate backing store. */ - d = m->depth; + if(chan == GREY1) + d = 1; + else + d = _x.depth; if(pixmap != PMundef) xm->pixmap = pixmap; else - xm->pixmap = XCreatePixmap(_x.display, _x.drawable, - Dx(r), Dy(r), d==32 ? 24 : d); + xm->pixmap = XCreatePixmap(_x.display, _x.drawable, Dx(r), Dy(r), d); /* * We want to align pixels on word boundaries. */ - if(d == 24) + if(m->depth == 24) offset = r.min.x&3; else offset = r.min.x&(31/m->depth); @@ -60,7 +61,7 @@ xallocmemimage(Rectangle r, u32int chan, int pixmap) /* * Wrap our data in an XImage structure. */ - xi = XCreateImage(_x.display, _x.vis, d==32 ? 24 : d, + xi = XCreateImage(_x.display, _x.vis, d, ZPixmap, 0, (char*)m->data->bdata, Dx(r), Dy(r), 32, m->width*sizeof(u32int)); if(xi == nil){ |