diff options
author | das <das> | 2007-06-23 00:26:42 (GMT) |
---|---|---|
committer | das <das> | 2007-06-23 00:26:42 (GMT) |
commit | 38d17f35a89f5fafcba83303e7e244fe0f23967c (patch) | |
tree | a997e0607741d3d227de55048900359058c1fa3b /xlib | |
parent | ceaab853c21c70ff37a506c244e5f4210438f16a (diff) | |
download | tk-38d17f35a89f5fafcba83303e7e244fe0f23967c.zip tk-38d17f35a89f5fafcba83303e7e244fe0f23967c.tar.gz tk-38d17f35a89f5fafcba83303e7e244fe0f23967c.tar.bz2 |
* generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
use XDestroyImage instead of XFree to destroy XImage; replace runtime
endianness determination by compile-time check for WORDS_BIGENDIAN.
* xlib/ximage.c (XCreateBitmapFromData): use XCreateImage and
XDestroyImage instead of creating XImage structure manually.
Diffstat (limited to 'xlib')
-rw-r--r-- | xlib/ximage.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/xlib/ximage.c b/xlib/ximage.c index 8519597..c869332 100644 --- a/xlib/ximage.c +++ b/xlib/ximage.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: ximage.c,v 1.4.8.1 2004/02/23 10:49:29 das Exp $ + * RCS: @(#) $Id: ximage.c,v 1.4.8.2 2007/06/23 00:26:42 das Exp $ */ #include "tkInt.h" @@ -43,7 +43,7 @@ XCreateBitmapFromData(display, d, data, width, height) unsigned int width; unsigned int height; { - XImage ximage; + XImage *ximage; GC gc; Pixmap pix; @@ -52,23 +52,11 @@ XCreateBitmapFromData(display, d, data, width, height) if (gc == NULL) { return None; } - ximage.height = height; - ximage.width = width; - ximage.depth = 1; - ximage.bits_per_pixel = 1; - ximage.xoffset = 0; - ximage.format = XYBitmap; - ximage.data = (char *)data; - ximage.byte_order = LSBFirst; - ximage.bitmap_unit = 8; - ximage.bitmap_bit_order = LSBFirst; - ximage.bitmap_pad = 8; - ximage.bytes_per_line = (width+7)/8; -#ifdef MAC_OSX_TK - ximage.obdata = NULL; -#endif - - TkPutImage(NULL, 0, display, pix, gc, &ximage, 0, 0, 0, 0, width, height); + ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, + height, 8, (width + 7) / 8); + TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height); + ximage->data = NULL; + XDestroyImage(ximage); XFreeGC(display, gc); return pix; } |