- if( i++ >= cycles )
- {
- i = 0;
- XClearWindow( pDisplay, Win );
- memset( pImage->data, 0, pImage->bytes_per_line * pImage->height );
- for( iShadeBob=0; iShadeBob<nShadeBobCount; iShadeBob++ )
- ResetShadeBob( &aShadeBobs[ iShadeBob ] );
- free( aiColorVals );
- aiColorVals = SetPalette( pDisplay, Win, sColor, &iColorCount );
- }
+static unsigned long
+shadebobs_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+
+ if( st->draw_i++ >= st->cycles )
+ {
+ XWindowAttributes XWinAttribs;
+ XGetWindowAttributes( st->dpy, st->window, &XWinAttribs );
+
+ st->draw_i = 0;
+#if 0
+ memset( st->pImage->data, 0, st->pImage->bytes_per_line * st->pImage->height );
+#else
+ {
+ /* fill the image with the actual value of the black pixel, not 0. */
+ unsigned long black = BlackPixelOfScreen (XWinAttribs.screen);
+ int x, y;
+ for (y = 0; y < XWinAttribs.height; y++)
+ for (x = 0; x < XWinAttribs.width; x++)
+ XPutPixel (st->pImage, x, y, black);
+ }
+#endif