Annotation of researchv9/X11/src/X.V11R1/server/ddx/mfb/mfbhrzvert.c, revision 1.1.1.1

1.1       root        1: /***********************************************************
                      2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      4: 
                      5:                         All Rights Reserved
                      6: 
                      7: Permission to use, copy, modify, and distribute this software and its 
                      8: documentation for any purpose and without fee is hereby granted, 
                      9: provided that the above copyright notice appear in all copies and that
                     10: both that copyright notice and this permission notice appear in 
                     11: supporting documentation, and that the names of Digital or MIT not be
                     12: used in advertising or publicity pertaining to distribution of the
                     13: software without specific, written prior permission.  
                     14: 
                     15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     21: SOFTWARE.
                     22: 
                     23: ******************************************************************/
                     24: /* $Header: mfbhrzvert.c,v 1.8 87/09/11 07:48:42 toddb Exp $ */
                     25: #include "X.h"
                     26: 
                     27: #include "gc.h"
                     28: #include "window.h"
                     29: #include "pixmap.h"
                     30: #include "region.h"
                     31: 
                     32: #include "mfb.h"
                     33: #include "maskbits.h"
                     34: 
                     35: /* horizontal solid line
                     36:    abs(len) > 1
                     37: */
                     38: mfbHorzS(rop, addrl, nlwidth, x1, y1, len)
                     39: int rop;               /* a reduced rasterop */
                     40: register int *addrl;   /* pointer to base of bitmap */
                     41: register int nlwidth;  /* width in longwords of bitmap */
                     42: int x1;                        /* initial point */ 
                     43: int y1;
                     44: int len;               /* length of line */
                     45: {
                     46:     register int startmask;
                     47:     register int endmask;
                     48:     register int nlmiddle;
                     49: 
                     50: 
                     51:     /* force the line to go left to right
                     52:        but don't draw the last point
                     53:     */
                     54:     if (len < 0)
                     55:     {
                     56:        x1 += len;
                     57:        x1 += 1;
                     58:        len = -len;
                     59:     }
                     60: 
                     61:     addrl = addrl + (y1 * nlwidth) + (x1 >> 5);
                     62: 
                     63:     /* all bits inside same longword */
                     64:     if ( ((x1 & 0x1f) + len) < 32)
                     65:     {
                     66:        maskpartialbits(x1, len, startmask);
                     67:         if (rop == RROP_BLACK)
                     68:         {
                     69:            *addrl &= ~startmask;
                     70:         }
                     71:         else if (rop == RROP_WHITE)
                     72:         {
                     73:            *addrl |= startmask;
                     74:         }
                     75:         else if (rop == RROP_INVERT)
                     76:         {
                     77:            *addrl ^= startmask;
                     78:         }
                     79:     }
                     80:     else
                     81:     {
                     82:        maskbits(x1, len, startmask, endmask, nlmiddle);
                     83:         if (rop == RROP_BLACK)
                     84:         {
                     85:            if (startmask)
                     86:                *addrl++ &= ~startmask;
                     87:            while (nlmiddle--)
                     88:                *addrl++ = 0x0;
                     89:            if (endmask)
                     90:                *addrl &= ~endmask;
                     91:         }
                     92:         else if (rop == RROP_WHITE)
                     93:         {
                     94:            if (startmask)
                     95:                *addrl++ |= startmask;
                     96:            while (nlmiddle--)
                     97:                *addrl++ = 0xffffffff;
                     98:            if (endmask)
                     99:                *addrl |= endmask;
                    100:         }
                    101:         else if (rop == RROP_INVERT)
                    102:         {
                    103:            if (startmask)
                    104:                *addrl++ ^= startmask;
                    105:            while (nlmiddle--)
                    106:                *addrl++ ^= 0xffffffff;
                    107:            if (endmask)
                    108:                *addrl ^= endmask;
                    109:         }
                    110:     }
                    111: }
                    112: 
                    113: /* vertical solid line
                    114:    this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
                    115:    better code.  sigh.  we know that len will never be 0 or 1, so
                    116:    it's OK to use it.
                    117: */
                    118: 
                    119: mfbVertS(rop, addrl, nlwidth, x1, y1, len)
                    120: int rop;               /* a reduced rasterop */
                    121: register int *addrl;   /* pointer to base of bitmap */
                    122: register int nlwidth;  /* width in longwords of bitmap */
                    123: int x1, y1;            /* initial point */
                    124: register int len;      /* length of line */
                    125: {
                    126:     register int bitmask;
                    127: 
                    128:     addrl = addrl + (y1 * nlwidth) + (x1 >> 5);
                    129: 
                    130:     if (len < 0)
                    131:     {
                    132:        nlwidth = -nlwidth;
                    133:        len = -len;
                    134:     }
                    135:  
                    136:     if (rop == RROP_BLACK)
                    137:     {
                    138:        bitmask = rmask[x1&0x1f];
                    139:        do
                    140:        {
                    141:            *addrl &= bitmask;
                    142:            addrl += nlwidth;
                    143:        }
                    144:        while (--len);
                    145:     }
                    146:     else if (rop == RROP_WHITE)
                    147:     {
                    148:        bitmask = mask[x1&0x1f];
                    149:        do
                    150:        {
                    151:            *addrl |= bitmask;
                    152:            addrl += nlwidth;
                    153:        }
                    154:        while (--len);
                    155:     }
                    156:     else if (rop == RROP_INVERT)
                    157:     {
                    158:        bitmask = mask[x1&0x1f];
                    159:        do
                    160:        {
                    161:            *addrl ^= bitmask;
                    162:            addrl += nlwidth;
                    163:        }
                    164:        while (--len);
                    165:     }
                    166: }
                    167: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.