1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XMakeTiles.c,v 10.3 86/02/01 15:36:49 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: 
   8: int XMakeTiles(defs, ndefs)
   9:     TileFrame defs[];
  10:     register int ndefs;
  11: {
  12:     register int i;
  13:     register int req_count = 0;
  14:     register int res_count = 0;
  15:     register Display *dpy = _XlibCurrentDisplay;
  16:     register TileFrame *frame = defs;
  17: 
  18: 
  19:     /*
  20:      * Issue requests.
  21:      */
  22:     for (i = 0; i < ndefs; i++) {
  23:     register XReq *req;
  24:     switch (frame->pixel) {
  25:         case WhitePixel:
  26:         frame->pixmap = dpy->white;
  27:         break;
  28:         case BlackPixel:
  29:         frame->pixmap = dpy->black;
  30:         break;
  31:         default:
  32:         GetReq(X_MakePixmap, 0);
  33:         frame->pixmap = 0;
  34:         req->param.l[0] = 0;
  35:         req->param.s[2] = frame->pixel;
  36:         req_count++;
  37:         break;
  38:     }
  39:     /*
  40: 	 * Increment the frame pointer.
  41: 	 */
  42:     frame++;
  43:     }
  44: 
  45:     /*
  46:      * Reset request number to its old value, so that
  47:      * error packets are processed correctly.
  48:      */
  49:     dpy->request -= req_count;
  50: 
  51:     /*
  52:      * Retrieve replies.
  53:      */
  54:     frame = defs;
  55:     for (i = 0; i < ndefs; i++) {
  56:     XRep rep;
  57: 
  58:     /*
  59: 	 * If the pixel was a degenerate case (white or black)
  60: 	 * then we already have the pixmap id, increment the
  61: 	 * result frame pointer and result count and continue.
  62: 	 */
  63:     if (frame->pixmap != 0) {
  64:         res_count++;
  65:     }
  66:     else {
  67:         /*
  68: 	     * Increment request number so error packets
  69: 	     * are processed correctly.
  70: 	     */
  71:         dpy->request++;
  72: 
  73:         /*
  74: 	     * Retrieve the reply.
  75: 	     */
  76:         if (!_XReply(dpy, &rep)) frame->pixmap = 0;
  77:         else {
  78:         frame->pixmap = rep.param.l[0];
  79:         res_count++;
  80:         }
  81:     }
  82:     /*
  83: 	 * Increment the frame pointer.
  84: 	 */
  85:     frame++;
  86:     }
  87: 
  88:     /*
  89:      * Return the number of successful pixmaps.
  90:      */
  91:     return (res_count);
  92: }

Defined functions

XMakeTiles defined in line 8; used 1 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 778
Valid CSS Valid XHTML 1.0 Strict