1: /* $Header: put.c,v 10.3 86/02/01 15:47:24 tony Rel $ */
   2: /* put.c	Perform a raster operation with a source bitmap
   3:  *
   4:  *	PixmapPut	Puts a pixmap up on the screen
   5:  *	PixmapBitsPut	Puts a pixmap up on the screen
   6:  *	BitmapBitsPut	Puts a pixmap up on the screen
   7:  *
   8:  */
   9: 
  10: /****************************************************************************
  11:  *									    *
  12:  *  Copyright (c) 1983, 1984 by						    *
  13:  *  DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts.		    *
  14:  *  All rights reserved.						    *
  15:  * 									    *
  16:  *  This software is furnished on an as-is basis and may be used and copied *
  17:  *  only with inclusion of the above copyright notice. This software or any *
  18:  *  other copies thereof may be provided or otherwise made available to     *
  19:  *  others only for non-commercial purposes.  No title to or ownership of   *
  20:  *  the software is hereby transferred.					    *
  21:  * 									    *
  22:  *  The information in this software is  subject to change without notice   *
  23:  *  and  should  not  be  construed as  a commitment by DIGITAL EQUIPMENT   *
  24:  *  CORPORATION.							    *
  25:  * 									    *
  26:  *  DIGITAL assumes no responsibility for the use  or  reliability of its   *
  27:  *  software on equipment which is not supplied by DIGITAL.		    *
  28:  * 									    *
  29:  *									    *
  30:  ****************************************************************************/
  31: 
  32: #include "vs100.h"
  33: 
  34: extern BitMap screen;
  35: extern int VSReloc;
  36: extern char FBMap[];
  37: extern char SSMap[];
  38: 
  39: char *AllocateSpace(), *AllocateCopy(), *Xalloc();
  40: 
  41: PixmapPut (src, srcx, srcy, width, height, dstx, dsty, clips, clipcount,
  42:        func, zmask)
  43:     PIXMAP *src;
  44:     int srcx, srcy, width, height, dstx, dsty, clipcount, zmask;
  45:     register int func;
  46:     CLIP *clips;
  47: {
  48:     register CopyAreaPacket *cap;
  49: #define h ((PacketHeader *) cap->cap_head)
  50: #define img ((SubBitmap *) cap->cap_source.image)
  51: #define pat ((Halftone *) cap->cap_source.pattern)
  52: #define size ((Extent *) cap->cap_maskSize)
  53: #define destOff ((Point *) cap->cap_destOffset)
  54: #define clip ((RectangleList *) cap->cap_clipping.rectList)
  55: 
  56:     if (!(zmask & 1)) {
  57:         DeallocateSpace ();
  58:         return;
  59:     }
  60:     cap = (CopyAreaPacket *) AllocateSpace (sizeof (CopyAreaPacket));
  61:     if (cap == NULL) return;
  62: 
  63:     func = SSMap[func | (src->kind & 0x10)];
  64:     h->ph_copyMod.m_mask = 0;
  65:     h->ph_copyMod.m_map = MAPTYPE(func);
  66:     h->ph_opcode = COPY_AREA;
  67:     *(long *) h->ph_next = NULL;
  68: 
  69:     if (src->kind == 0) {
  70:         h->ph_copyMod.m_source = 0;
  71:         cap->cap_source.const = (int) src->data;
  72:     } else {
  73:         h->ph_copyMod.m_source = 1;
  74: #ifdef HTCROCK
  75:         if (src->kind & 2)
  76:         *(caddr_t *) img->sb_address = BDATA(TDATA(src)->bitmap)->vsPtr;
  77:         else
  78: #endif
  79:         *(caddr_t *) img->sb_address = BDATA(PDATA(src))->vsPtr;
  80:         img->sb_height = src->height;
  81:         img->sb_width = src->width;
  82:         img->sb_bitsPerPixel = 1;
  83:         img->sb_x = srcx;
  84:         img->sb_y = srcy;
  85:     }
  86: 
  87:     size->e_height = height;
  88:     size->e_width = width;
  89: 
  90:     *(BitMap *) cap->cap_destImage = screen;
  91:     destOff->p_x = dstx;
  92:     destOff->p_y = dsty;
  93: 
  94:     *(long *) cap->cap_map.literal = MAPLIT(func);
  95: 
  96:     if (clipcount == 1) {
  97:         h->ph_copyMod.m_clipping = 1;
  98:         *(CLIP *) cap->cap_clipping.litRect = *clips;
  99:     } else {
 100:         h->ph_copyMod.m_clipping = 2;
 101:         *(caddr_t *) clip->r_first = (caddr_t) clips + VSReloc;
 102:         clip->r_count = clipcount;
 103:     }
 104: 
 105:     WritePacket ((caddr_t) cap);
 106: #undef h
 107: #undef img
 108: #undef pat
 109: #undef size
 110: #undef destOff
 111: #undef clip
 112: }
 113: 
 114: 
 115: /*ARGSUSED*/
 116: PixmapBitsPut (width, height, format, data, xymask, dstx, dsty,
 117:            clips, clipcount, func, zmask)
 118:     char *data;
 119:     int width, height, format, dstx, dsty, clipcount, zmask;
 120:     BITMAP *xymask;
 121:     CLIP *clips;
 122:     int func;
 123: {
 124:     BitmapBitsPut (width, height, data, 1, 0, xymask, dstx, dsty,
 125:                clips, clipcount, func, zmask);
 126: }
 127: 
 128: 
 129: BitmapBitsPut (width, height, data, fore, back, xymask, dstx, dsty,
 130:            clips, clipcount, func, zmask)
 131:     char *data;
 132:     int width, height, fore, back, dstx, dsty, clipcount, zmask;
 133:     register BITMAP *xymask;
 134:     CLIP *clips;
 135:     register int func;
 136: {
 137:     register CopyAreaPacket *cap;
 138: #define h ((PacketHeader *) cap->cap_head)
 139: #define src ((SubBitmap *) cap->cap_source.image)
 140: #define pat ((Halftone *) cap->cap_source.pattern)
 141: #define size ((Extent *) cap->cap_maskSize)
 142: #define mask ((SubBitmap *) cap->cap_sourceMask)
 143: #define destOff ((Point *) cap->cap_destOffset)
 144: #define clip ((RectangleList *) cap->cap_clipping.rectList)
 145:     caddr_t bits;
 146:     char *boxes = NULL;
 147:     CLIP clip1;
 148:     int width1, num, boxbytes, bytes;
 149: 
 150:     if (!(zmask & 1)) {
 151:         DeallocateSpace ();
 152:         return;
 153:     }
 154:     if (fore & 1)
 155:         func += 0x20;
 156:     if (back & 1)
 157:         func += 0x10;
 158:     func = FBMap[func];
 159: 
 160:     width1 = BitmapSize(width, 1);
 161:     num = VBUFSIZE / width1;
 162:     if (height > num) {
 163:         if (clipcount == 1) {
 164:         clip1 = *clips;
 165:         clips = &clip1;
 166:         } else {
 167:         boxbytes = sizeof (CLIP) * clipcount;
 168:         boxes = Xalloc (boxbytes);
 169:         bcopy ((caddr_t) clips, boxes, boxbytes);
 170:         DeallocateSpace ();
 171:         }
 172:     }
 173: 
 174:     while (height) {
 175:         if (height < num)
 176:         num = height;
 177:         bytes = num * width1;
 178:         if ((bits = (caddr_t) AllocateCopy (data, bytes)) == NULL ||
 179:         (boxes && (clips = (CLIP *) AllocateCopy (boxes, boxbytes)) == NULL) ||
 180:         (cap = (CopyAreaPacket *) AllocateSpace (sizeof (CopyAreaPacket))) == NULL)
 181:         break;
 182: 
 183:         h->ph_copyMod.m_source = 1;
 184:         h->ph_copyMod.m_mask = xymask ? 1 : 0;
 185:         h->ph_copyMod.m_map = MAPTYPE(func);
 186:         h->ph_opcode = COPY_AREA;
 187:         *(long *) h->ph_next = NULL;
 188: 
 189:         *(caddr_t *) src->sb_address = bits + VSReloc;
 190:         src->sb_height = num;
 191:         src->sb_width = width;
 192:         src->sb_bitsPerPixel = 1;
 193:         src->sb_x = src->sb_y = 0;
 194: 
 195:         if (xymask) {
 196:             *(caddr_t *) mask->sb_address = BDATA(xymask)->vsPtr;
 197:             mask->sb_height = xymask->height;
 198:             mask->sb_width = xymask->width;
 199:             mask->sb_bitsPerPixel = 1;
 200:             mask->sb_x = mask->sb_y = 0;
 201:         }
 202:         size->e_height = num;
 203:         size->e_width = width;
 204: 
 205:         *(BitMap *) cap->cap_destImage = screen;
 206:         destOff->p_x = dstx;
 207:         destOff->p_y = dsty;
 208: 
 209:         *(long *) cap->cap_map.literal = MAPLIT(func);
 210: 
 211:         if (clipcount == 1) {
 212:         h->ph_copyMod.m_clipping = 1;
 213:         *(CLIP *) cap->cap_clipping.litRect = *clips;
 214:         } else {
 215:         h->ph_copyMod.m_clipping = 2;
 216:         *(caddr_t *) clip->r_first = (caddr_t) clips + VSReloc;
 217:         clip->r_count = clipcount;
 218:         }
 219: 
 220:         WritePacket ((caddr_t) cap);
 221:         height -= num;
 222:         dsty += num;
 223:         data += bytes;
 224:     }
 225:     if (boxes)
 226:         free (boxes);
 227: #undef h
 228: #undef src
 229: #undef pat
 230: #undef size
 231: #undef mask
 232: #undef destOff
 233: #undef clip
 234: }

Defined functions

BitmapBitsPut defined in line 129; used 1 times
PixmapBitsPut defined in line 116; never used
PixmapPut defined in line 41; never used

Defined macros

clip defined in line 144; used 6 times
destOff defined in line 143; used 6 times
h defined in line 138; used 17 times
img defined in line 50; used 8 times
mask defined in line 142; used 7 times
pat defined in line 140; used 2 times
size defined in line 141; used 6 times
src defined in line 139; used 17 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1253
Valid CSS Valid XHTML 1.0 Strict