summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authordas <das>2007-06-23 00:25:38 (GMT)
committerdas <das>2007-06-23 00:25:38 (GMT)
commit4e2bd974f22a0d3872a1939e38a365d9a62e14e3 (patch)
tree148eb739926f285c24f4ff371245704b03fb7eed /xlib
parent9d7962e08c7e8fead868040687c9508363a26da4 (diff)
downloadtk-4e2bd974f22a0d3872a1939e38a365d9a62e14e3.zip
tk-4e2bd974f22a0d3872a1939e38a365d9a62e14e3.tar.gz
tk-4e2bd974f22a0d3872a1939e38a365d9a62e14e3.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.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/xlib/ximage.c b/xlib/ximage.c
index 6f0c7ee..e6e4866 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.6 2007/01/02 23:39:40 dkf Exp $
+ * RCS: @(#) $Id: ximage.c,v 1.7 2007/06/23 00:25:38 das Exp $
*/
#include "tkInt.h"
@@ -42,7 +42,7 @@ XCreateBitmapFromData(
unsigned int width,
unsigned int height)
{
- XImage ximage;
+ XImage *ximage;
GC gc;
Pixmap pix;
@@ -51,23 +51,11 @@ XCreateBitmapFromData(
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;
}