Annotation of researchv9/X11/src/X.V11R1/server/ddx/mi/mifillrct.c, revision 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: mifillrct.c,v 1.18 87/09/11 07:19:08 toddb Exp $ */
        !            25: 
        !            26: #include "X.h"
        !            27: #include "Xprotostr.h"
        !            28: #include "gcstruct.h"
        !            29: #include "windowstr.h"
        !            30: #include "pixmap.h"
        !            31: 
        !            32: #include "misc.h"
        !            33: 
        !            34: /* mi rectangles
        !            35:    written by newman, with debts to all and sundry
        !            36: */
        !            37: 
        !            38: /* MIPOLYFILLRECT -- public entry for PolyFillRect request
        !            39:  * very straight forward: translate rectangles if necessary
        !            40:  * then call FillSpans to fill each rectangle.  We let FillSpans worry about
        !            41:  * clipping to the destination
        !            42:  */
        !            43: void
        !            44: miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
        !            45:     DrawablePtr        pDrawable;
        !            46:     GCPtr      pGC;
        !            47:     int                nrectFill;      /* number of rectangles to fill */
        !            48:     xRectangle *prectInit;     /* Pointer to first rectangle to fill */
        !            49: {
        !            50:     int i;
        !            51:     register int       height;
        !            52:     register int       width;
        !            53:     register xRectangle *prect; 
        !            54:     int                        xorg;
        !            55:     register int       yorg;
        !            56:     int                        maxheight;
        !            57:     DDXPointPtr                pptFirst;
        !            58:     register DDXPointPtr ppt;
        !            59:     int                        *pwFirst;
        !            60:     register int       *pw;
        !            61: 
        !            62:     if ((pDrawable->type == DRAWABLE_WINDOW) && (pGC->miTranslate))
        !            63:     {
        !            64:        xorg = ((WindowPtr)pDrawable)->absCorner.x;
        !            65:        yorg = ((WindowPtr)pDrawable)->absCorner.y;
        !            66:         prect = prectInit;
        !            67:         maxheight = 0;
        !            68:         for (i = 0; i<nrectFill; i++, prect++)
        !            69:         {
        !            70:            prect->x += xorg;
        !            71:            prect->y += yorg;
        !            72:            maxheight = max(maxheight, prect->height);
        !            73:         }
        !            74:     }
        !            75:     else
        !            76:     {
        !            77:         prect = prectInit;
        !            78:         maxheight = 0;
        !            79:         for (i = 0; i<nrectFill; i++, prect++)
        !            80:            maxheight = max(maxheight, prect->height);
        !            81:     }
        !            82: 
        !            83:     pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec));
        !            84:     pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int));
        !            85:     if(!pptFirst || !pwFirst)
        !            86:     {
        !            87:        DEALLOCATE_LOCAL(pwFirst);
        !            88:        DEALLOCATE_LOCAL(pptFirst);
        !            89:        return;
        !            90:     }
        !            91: 
        !            92:     prect = prectInit;
        !            93:     while(nrectFill--)
        !            94:     {
        !            95:        ppt = pptFirst;
        !            96:        pw = pwFirst;
        !            97:        height = prect->height;
        !            98:        width = prect->width;
        !            99:        xorg = prect->x;
        !           100:        yorg = prect->y;
        !           101:        while(height--)
        !           102:        {
        !           103:            *pw++ = width;
        !           104:            ppt->x = xorg;
        !           105:            ppt->y = yorg;
        !           106:            ppt++;
        !           107:            yorg++;
        !           108:        }
        !           109:        (* pGC->FillSpans)(pDrawable, pGC, 
        !           110:                           prect->height, pptFirst, pwFirst,
        !           111:                           1);
        !           112:        prect++;
        !           113:     }
        !           114:     DEALLOCATE_LOCAL(pwFirst);
        !           115:     DEALLOCATE_LOCAL(pptFirst);
        !           116: }

unix.superglobalmegacorp.com

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