- /* Copy the argument pixmap into the new pixmap.
- */
- XCopyArea( display, pixmap, ipixmap,
- gc, 0, 0, width, height, 0, 0 );
-
- /* Refill the new pixmap using the stipple algorithm/pixmap.
- */
- XSetStipple( display, gc, stipple );
- XSetFillStyle( display, gc, FillStippled );
- XFillRectangle( display, ipixmap, gc, 0, 0, width, height );
+ /* Create an identical copy of the argument pixmap.
+ */
+ ipixmap = XCreatePixmap( display, pixmap, width, height, depth );
+ if ( 0 != ipixmap )
+ {
+ /* Copy the argument pixmap into the new pixmap.
+ */
+ XCopyArea( display, pixmap, ipixmap,
+ gc, 0, 0, width, height, 0, 0 );
+
+ /* Refill the new pixmap using the stipple algorithm/pixmap.
+ */
+ XSetStipple( display, gc, stipple );
+ XSetFillStyle( display, gc, FillStippled );
+ XFillRectangle( display, ipixmap, gc, 0, 0, width, height );
+ }
+ XFreeGC( display, gc );