X-Windows draws very slowly

Jon Ryshpan jon at hitachi.uucp
Tue Jun 18 08:13:30 AEST 1991


I'm trying to port some code to do "animation" to X-Windows under ISC
Unix, and I find that the following code is *rather* slow.  It draws an
image of a cat.  The function takes about 300 msec (that's 1/3-second)
to execute.  The time seems to actually be taken up by the X server and
to show up in executing XFlush().

Any ideas how to speed this up?  Please reply BY MAIL.
					      ^^ ^^^^
		======= Code Starts Here =========

#define	BITMAP_WIDTH		32
#define	BITMAP_HEIGHT		32

/* Draw a cat */

void
DrawNeko( x, y, DrawGC )
    int		x;
    int		y;
    GC		DrawGC;
{
    XSetTSOrigin( theDisplay, DrawGC, x, y );

    XFillRectangle( theDisplay, theWindow, DrawGC,
		    x, y, BITMAP_WIDTH, BITMAP_HEIGHT );

    XFlush( theDisplay );
}

/* Image of a cat asleep */

#define sleep1_width 32
#define sleep1_height 32
static char sleep1_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xc0, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
   0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x1f, 0x00, 0x80, 0x00, 0x08, 0x00,
   0xc0, 0x1f, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x41, 0x02,
   0x00, 0x80, 0x22, 0x02, 0x00, 0x40, 0x3e, 0x06, 0x00, 0x38, 0x14, 0x0a,
   0x00, 0x26, 0x18, 0x14, 0x00, 0x11, 0x00, 0x18, 0x00, 0x11, 0x00, 0x18,
   0x80, 0x10, 0x00, 0x38, 0x40, 0x10, 0x00, 0x2c, 0x40, 0xa0, 0x01, 0x2b,
   0x40, 0x20, 0x8e, 0x68, 0x40, 0x20, 0x10, 0x54, 0x40, 0x40, 0x40, 0x5b,
   0x80, 0x80, 0xff, 0x4c, 0x00, 0x3f, 0xf0, 0x64, 0x00, 0xe0, 0x9f, 0x3f,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Many Thanks:	

Jonathan Ryshpan	<...!uunet!hitachi!jon>		(415) 244-7369  	



More information about the Comp.unix.sysv386 mailing list