diff src/glyphs-x.c @ 392:1f50e6fe4f3f r21-2-11

Import from CVS: tag r21-2-11
author cvs
date Mon, 13 Aug 2007 11:10:50 +0200
parents aabb7f5b1c81
children 74fd4e045ea6
line wrap: on
line diff
--- a/src/glyphs-x.c	Mon Aug 13 11:10:04 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 11:10:50 2007 +0200
@@ -124,7 +124,7 @@
   Colormap cmap;
   Visual *vis;
   XImage *outimg;
-  int depth, bitmap_pad, byte_cnt, i, j;
+  int depth, bitmap_pad, bits_per_pixel, byte_cnt, i, j;
   int rd,gr,bl,q;
   unsigned char *data, *ip, *dp;
   quant_table *qtable = 0;
@@ -149,13 +149,15 @@
   bitmap_pad = ((depth > 16) ? 32 :
 		(depth >  8) ? 16 :
 		8);
-  byte_cnt = bitmap_pad >> 3;
 
   outimg = XCreateImage (dpy, vis,
 			 depth, ZPixmap, 0, 0, width, height,
 			 bitmap_pad, 0);
   if (!outimg) return NULL;
 
+  bits_per_pixel = outimg->bits_per_pixel;
+  byte_cnt = bits_per_pixel >> 3;
+
   data = (unsigned char *) xmalloc (outimg->bytes_per_line * height);
   if (!data)
     {