Annotation of 43BSDTahoe/new/X/libapollo/prim.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char *rcsid_prim_c = "$Header: prim.c,v 10.1 86/11/29 13:52:30 jg Rel $";
        !             3: #endif lint
        !             4:     /*
        !             5: 
        !             6:     Copyright 1986 by the University of Utah
        !             7: 
        !             8:     Permission to use, copy, modify, and distribute this
        !             9:     software and its documentation for any purpose and without
        !            10:     fee is hereby granted, provided that the above copyright
        !            11:     notice appear in all copies and that both that copyright
        !            12:     notice and this permission notice appear in supporting
        !            13:     documentation, and that the name of the University of Utah
        !            14:     not be used in advertising or publicity pertaining to 
        !            15:     distribution of the software without specific, written 
        !            16:     prior permission. The University of Utah makes no
        !            17:     representations about the suitability of this software for
        !            18:     any purpose.  It is provided "as is" without express or
        !            19:     implied warranty.
        !            20: 
        !            21:     */
        !            22: 
        !            23: #include "Xapollo.h"
        !            24: #include "/sys/ins/smdu.ins.c"
        !            25: 
        !            26: extern boolean borrow_flag;
        !            27: extern gpr_$plane_t plane;
        !            28: extern int old_op;
        !            29: status_$t status;
        !            30: 
        !            31: BITMAP *
        !            32: make_bitmap( area, width, height, invert )
        !            33:      short * area;     /* the bits of the image or NULL */
        !            34:      int width;
        !            35:      int height;
        !            36:      boolean invert;   /* true->the image bits need to inverted */
        !            37: {
        !            38:   
        !            39:     BITMAP * bm; 
        !            40:     gpr_$bitmap_desc_t bitmap;
        !            41:     static gpr_$attribute_desc_t attr;
        !            42:     gpr_$offset_t size;
        !            43: 
        !            44:     short * pointer;   /* pointer to Apollo bitmap */
        !            45:     short bwid;                /* Apollo bitmap line width */
        !            46:     int rowwid;                /* image bits row width */
        !            47:     int i;
        !            48: 
        !            49:     if( (bm = (BITMAP *)Xalloc(sizeof(BITMAP))) == NULL )
        !            50:         return( NULL );
        !            51:     
        !            52:     bm->refcnt = 1;
        !            53:     bm->kind = (int)apollo_bitmap;
        !            54: 
        !            55:     size.x_size = bm->width = width;
        !            56:     size.y_size = bm->height = height;
        !            57:     
        !            58:     gpr_$allocate_attribute_block( attr, status );
        !            59:     if (check_status(status, "make_bitmap:"))
        !            60:         return( NULL );             
        !            61:     gpr_$allocate_bitmap_nc( size, (gpr_$plane_t)(Screen.depth-1), attr, bitmap, status );
        !            62:     if (check_status(status, "make_bitmap:"))
        !            63:         return( NULL );             
        !            64: 
        !            65:     bm->data = (caddr_t)bitmap;
        !            66:     if (!(area == NULL)) {
        !            67:         gpr_$inq_bitmap_pointer( bitmap, pointer, bwid,  status );
        !            68:         rowwid = ((width+15)>>4);
        !            69:         for( i=0; i<height; i++ ) {
        !            70:             bcopy( area, pointer, rowwid*2 );
        !            71:             if (invert)
        !            72:                    InvertPixelOrder((short *) pointer, rowwid);
        !            73:             pointer += bwid;
        !            74:             area += rowwid;
        !            75:             }
        !            76:         }
        !            77:     return( bm );
        !            78:     }
        !            79: 
        !            80: FONT *
        !            81: make_fontmap( fd )
        !            82: FONT *fd;
        !            83:     {
        !            84: 
        !            85:     int width;
        !            86:     int height;
        !            87:     BITMAP * bm; 
        !            88:     gpr_$bitmap_desc_t bitmap;
        !            89:     static gpr_$attribute_desc_t attr = -1;
        !            90:     gpr_$window_t window;
        !            91:     gpr_$position_t dest;
        !            92:     static int got_attr = 0;
        !            93:     gpr_$offset_t size;
        !            94:     FontPriv *fpriv;
        !            95: 
        !            96:     short col, row;
        !            97:     short left, oldleft, wid, oldwid;
        !            98:     int start, stop;
        !            99: 
        !           100:     int i;
        !           101: 
        !           102:     fpriv = (FontPriv *)fd->data;
        !           103:     bm = fpriv->strike;
        !           104:     width = fd->last * fd->avg_width;
        !           105:     height = (width / 224) + 1;
        !           106:     height = height * fd->height;
        !           107: /* should check for height > 224 */
        !           108:     size.x_size = 224;
        !           109:     size.y_size = height;
        !           110:     
        !           111:     if( !got_attr )                
        !           112:         {
        !           113:         gpr_$allocate_attribute_block( attr, status );
        !           114:        if (check_status( status, "make_fontmap:"))
        !           115:             return( NULL );             
        !           116:         got_attr = 1;
        !           117:         }
        !           118:     gpr_$allocate_bitmap( size, (gpr_$plane_t)0, attr, bitmap, status );
        !           119:     if (check_status( status, "make_fontmap:"))
        !           120:         return( NULL );             
        !           121: 
        !           122:     row = start = 0;
        !           123:     gpr_$set_bitmap( bitmap, status);
        !           124:     for (i=0; i<=fd->last; i++) {
        !           125:         left = fpriv->leftarray[i];
        !           126:        wid = fpriv->widths[i];
        !           127:        if ((left + wid) > (start + 224)) {
        !           128:            stop = oldleft + oldwid;
        !           129:            window.x_coord = start;
        !           130:            window.y_coord = 0;
        !           131:            window.x_size = stop - start;
        !           132:            window.y_size = fd->height;
        !           133:            dest.x_coord = 0;
        !           134:            dest.y_coord = row * fd->height;
        !           135:            gpr_$bit_blt(bm->data, window, (short)0, dest, (short)0, status);
        !           136:            start = stop;
        !           137:            row++;
        !           138:            col = 0;
        !           139:          }
        !           140:        oldleft = left;
        !           141:        oldwid = wid;
        !           142:        fpriv->leftarray[i] = col + (row << 10);
        !           143:        col += fpriv->widths[i];
        !           144:       }
        !           145:     if (start != (oldleft + oldwid)) {
        !           146:         window.x_coord = start;
        !           147:        window.x_size = (left + wid) - start;
        !           148:        window.y_size = fd->height;
        !           149:        dest.y_coord = row * fd->height;
        !           150:        gpr_$bit_blt(bm->data, window, (short)0, dest, (short)0, status);
        !           151:       }
        !           152:     bm->width = 224;
        !           153:     bm->height = height;
        !           154:     bm->refcnt = 1;
        !           155:     bm->kind = (int)apollo_bitmap;
        !           156: 
        !           157:     bm->data = (caddr_t)bitmap;
        !           158:     gpr_$set_bitmap( Screen.bm, status);
        !           159:     return( fd );
        !           160: 
        !           161:     }
        !           162: 

unix.superglobalmegacorp.com

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