1: /* $Header: draw.c,v 10.3 86/02/01 15:46:46 tony Rel $ */
   2: /* draw.c	Draw lines, curves, and polygons on the screen
   3:  *
   4:  *	DrawCurve	Draw a generalized line/polygon/combination
   5:  *
   6:  */
   7: 
   8: /****************************************************************************
   9:  *									    *
  10:  *  Copyright (c) 1983, 1984 by						    *
  11:  *  DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts.		    *
  12:  *  All rights reserved.						    *
  13:  * 									    *
  14:  *  This software is furnished on an as-is basis and may be used and copied *
  15:  *  only with inclusion of the above copyright notice. This software or any *
  16:  *  other copies thereof may be provided or otherwise made available to     *
  17:  *  others only for non-commercial purposes.  No title to or ownership of   *
  18:  *  the software is hereby transferred.					    *
  19:  * 									    *
  20:  *  The information in this software is  subject to change without notice   *
  21:  *  and  should  not  be  construed as  a commitment by DIGITAL EQUIPMENT   *
  22:  *  CORPORATION.							    *
  23:  * 									    *
  24:  *  DIGITAL assumes no responsibility for the use  or  reliability of its   *
  25:  *  software on equipment which is not supplied by DIGITAL.		    *
  26:  * 									    *
  27:  *									    *
  28:  ****************************************************************************/
  29: 
  30: #include "vs100.h"
  31: 
  32: extern BitMap screen;
  33: extern int VSReloc;
  34: extern char SSMap[];
  35: 
  36: char *AllocateCopy(), *AllocateSpace();
  37: 
  38: DrawCurve (verts, vertcount, xbase, ybase, srcpix, altpix, mode,
  39:        bwidth, bheight, pat, patlen, patmul, clips, clipcount, func, zmask)
  40:     Vertex *verts;
  41:     int vertcount, xbase, ybase, srcpix, altpix, mode, bwidth, bheight;
  42:     int pat, patlen, patmul, clipcount, zmask;
  43:     register int func;
  44:     CLIP *clips;
  45: {
  46:     register DrawCurvePacket *dcp;
  47: #define h ((PacketHeader *) dcp->dcp_head)
  48: #define size ((Extent *) dcp->dcp_maskSize)
  49: #define destOff ((Point *) dcp->dcp_destOffset)
  50: #define path ((SegmentList *) dcp->dcp_path)
  51: #define clip ((RectangleList *) dcp->dcp_clipping.rectList)
  52: #define pstr ((PatternString *) dcp->dcp_pattern)
  53: #define pstate ((PatternState *) dcp->dcp_patState.literal)
  54: 
  55:     if (!(zmask & 1)) {
  56:         DeallocateSpace ();
  57:         return;
  58:     }
  59:     if ((verts = (Vertex *) AllocateCopy ((caddr_t) verts, vertcount * sizeof (Vertex))) == NULL ||
  60:         (dcp = (DrawCurvePacket *) AllocateSpace (sizeof (DrawCurvePacket))) == NULL)
  61:         return;
  62: 
  63:     func = SSMap[func];
  64:     h->ph_drawMod.m_source = 0; /* Always constant here */
  65:     h->ph_drawMod.m_mask = 0;
  66:     h->ph_drawMod.m_map = MAPTYPE(func);
  67:     if (mode == 0) {
  68:         h->ph_drawMod.m_drawMode = 0;
  69:         h->ph_drawMod.m_patMode = 0;
  70:     } else {
  71:         h->ph_drawMod.m_drawMode = 1;
  72:         h->ph_drawMod.m_patMode = mode - 1;
  73:     }
  74:     h->ph_drawMod.m_patState = 0;
  75:     h->ph_opcode = DRAW_CURVE;
  76:     *(long *) h->ph_next = NULL;
  77: 
  78:     dcp->dcp_source.const = srcpix & 1;
  79:     dcp->dcp_secondSource.const = altpix & 1;
  80: 
  81:     size->e_height = bheight;
  82:     size->e_width = bwidth;
  83: 
  84:     *(BitMap *) dcp->dcp_destImage = screen;
  85:     destOff->p_x = xbase;
  86:     destOff->p_y = ybase;
  87: 
  88:     *(short *) dcp->dcp_map.literal = MAPLIT(func);
  89: 
  90:     pstr->p_pattern = pat;
  91:     pstr->p_length = patlen;
  92:     pstr->p_multiplier = patmul;
  93:     pstate->p_position = 0;
  94:     pstate->p_count = 0;
  95: 
  96:     if (clipcount == 1) {
  97:         h->ph_drawMod.m_clipping = 1;
  98:         *(CLIP *) dcp->dcp_clipping.litRect = *clips;
  99:     } else {
 100:         h->ph_drawMod.m_clipping = 2;
 101:         *(caddr_t *) clip->r_first = (caddr_t) clips + VSReloc;
 102:         clip->r_count = clipcount;
 103:     }
 104: 
 105:     *(caddr_t *) path->seg_first = (caddr_t) verts + VSReloc;
 106:     path->seg_count = vertcount;
 107: 
 108:     WritePacket ((caddr_t) dcp);
 109: #undef h
 110: #undef size
 111: #undef destOff
 112: #undef path
 113: #undef clip
 114: #undef pstr
 115: #undef pstate
 116: }

Defined functions

DrawCurve defined in line 38; never used

Defined macros

clip defined in line 51; used 3 times
destOff defined in line 49; used 3 times
h defined in line 47; used 13 times
path defined in line 50; used 3 times
pstate defined in line 53; used 3 times
pstr defined in line 52; used 4 times
size defined in line 48; used 3 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 882
Valid CSS Valid XHTML 1.0 Strict