Annotation of 43BSD/contrib/X/uwm/StoreGridBox.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char *rcsid_StoreGridBox_c = "$Header: StoreGridBox.c,v 10.3 86/02/01 16:24:00 tony Rel $";
                      3: #endif lint
                      4: 
                      5: /************************************************************************
                      6:  *                                                                     *
                      7:  *                     Copyright (c) 1986 by                           *
                      8:  *             Digital Equipment Corporation, Maynard, MA              *
                      9:  *                      All Rights Reserved.                           *
                     10:  *                                                                     *
                     11:  *     Permission to use, copy, modify, and distribute this software   *
                     12:  *     and its documentation is hereby granted only to licensees of    *
                     13:  *     The Regents of the University of California pursuant to their   *
                     14:  *     license agreement for the Berkeley Software Distribution        *
                     15:  *     provided that the following appears on all copies.              *
                     16:  *                                                                     *
                     17:  *            "LICENSED FROM DIGITAL EQUIPMENT CORPORATION             *
                     18:  *                      COPYRIGHT (C) 1986                             *       
                     19:  *                 DIGITAL EQUIPMENT CORPORATION                       *
                     20:  *                         MAYNARD, MA                                 *
                     21:  *                     ALL RIGHTS RESERVED.                            *
                     22:  *                                                                     *
                     23:  *      THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  * 
                     24:  *     NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL   *
                     25:  *     EQUIPMENT CORPORATION.  DIGITAL MAKES NO REPRESENTATIONS        *
                     26:  *     ABOUT SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS       *
                     27:  *     SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.           *
                     28:  *                                                                     *       
                     29:  *     IF THE UNIVERSITY OF CALIFORNIA OR ITS LICENSEES MODIFY         *       
                     30:  *     THE SOFTWARE IN A MANNER CREATING DERIVATIVE COPYRIGHT          *       
                     31:  *     RIGHTS APPROPRIATE COPYRIGHT LEGENDS MAY BE PLACED ON THE       *
                     32:  *     DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE."           *       
                     33:  *                                                                     *
                     34:  ************************************************************************/
                     35:  
                     36: 
                     37: /*
                     38:  * MODIFICATION HISTORY
                     39:  *
                     40:  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
                     41:  */
                     42: 
                     43: #ifndef lint
                     44: static char *sccsid = "@(#)StoreGridBox.c      3.8     1/24/86";
                     45: #endif
                     46: /*
                     47:  *     StoreGridBox - This subroutine is used by the X Window Manager (xwm)
                     48:  *     to store the vertices for the movement resize grid and box in a
                     49:  *     vertex list.
                     50:  */
                     51: 
                     52: #include "uwm.h"
                     53: 
                     54: /*
                     55:  * Store the vertices for the movement resize grid and box in a vertex list.
                     56:  */
                     57: int StoreGridBox(box, ulx, uly, lrx, lry)
                     58: register Vertex box[];
                     59: int ulx;                       /* Upper left X coordinate. */
                     60: int uly;                       /* Upper left Y coordinate. */
                     61: int lrx;                       /* Lower right X coordinate. */
                     62: int lry;                       /* Lower right Y coordinate. */
                     63: {
                     64:     register int xthird, ythird;
                     65:     int x1third, y1third;
                     66:     int x2third, y2third;
                     67: 
                     68:     /*
                     69:      * Xor in.
                     70:      */
                     71:     box[0].x = box[3].x = box[4].x = box[5].x = box[7].x = ulx;
                     72:     box[1].x = box[2].x = box[6].x = box[8].x = lrx;
                     73: 
                     74:     box[0].y = box[1].y = box[4].y = box[9].y = box[11].y = uly;
                     75:     box[2].y = box[3].y = box[10].y = box[12].y = lry;
                     76: 
                     77:     box[0].flags = box[5].flags = box[7].flags = box[9].flags =
                     78:         box[11].flags = VertexDontDraw;
                     79: 
                     80:     /*
                     81:      * These are the X and Y calculations for the parts of the grid that
                     82:      * are dependent on the division by 3 calculations.
                     83:      */
                     84: 
                     85:     /*
                     86:      * Y dimension third.
                     87:      */
                     88:     ythird = (lry - uly) / 3;
                     89:     y1third = uly + ythird;
                     90:     y2third = y1third + ythird;
                     91:    
                     92:     /*
                     93:      * X dimension third.
                     94:      */
                     95:     xthird = (lrx - ulx) / 3;
                     96:     x1third = ulx + xthird;
                     97:     x2third = x1third + xthird;
                     98: 
                     99:     /*
                    100:      * Stash first set of vertices.
                    101:      */
                    102:     box[5].y = box[6].y = y1third;
                    103:     box[7].y = box[8].y = y2third;
                    104: 
                    105:     box[9].x = box[10].x = x1third;
                    106:     box[11].x = box[12].x = x2third; 
                    107: 
                    108:     /*
                    109:      * Do not erase if we're freezing the screen.
                    110:      */
                    111:     if (Freeze)
                    112:         return(13);
                    113: 
                    114:     /*
                    115:      * From here on we're retracing the vertices to clear the
                    116:      * grid using GXxor.
                    117:      */
                    118:     box[18].y = box[19].y = y1third;
                    119:     box[20].y = box[21].y = y2third;
                    120: 
                    121:     box[22].x = box[23].x = x1third;
                    122:     box[24].x = box[25].x = x2third;
                    123: 
                    124:     box[13].x = box[16].x = box[17].x = box[18].x = box[20].x = ulx;
                    125:     box[13].y = box[14].y = box[17].y = box[22].y = box[24].y = uly;
                    126: 
                    127:     box[14].x = box[15].x = box[19].x = box[21].x = lrx;
                    128:     box[15].y = box[16].y = box[23].y = box[25].y = lry;
                    129: 
                    130:     box[13].flags = box[18].flags = box[20].flags = box[22].flags =
                    131:         box[24].flags = VertexDontDraw;
                    132: 
                    133: 
                    134:     /*
                    135:      * Total number of vertices is 26.
                    136:      */
                    137:     return(26);
                    138: }

unix.superglobalmegacorp.com

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