|
|
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: mipoly.c,v 1.11 87/09/11 07:18:58 toddb Exp $ */ ! 25: /* ! 26: * mipoly.c ! 27: * ! 28: * Written by Brian Kelleher; June 1986 ! 29: * ! 30: * Draw polygons. This routine translates the point by the ! 31: * origin if pGC->miTranslate is non-zero, and calls ! 32: * to the appropriate routine to actually scan convert the ! 33: * polygon. ! 34: */ ! 35: #include "X.h" ! 36: #include "windowstr.h" ! 37: #include "gcstruct.h" ! 38: #include "pixmapstr.h" ! 39: #include "mi.h" ! 40: #include "miscstruct.h" ! 41: ! 42: ! 43: void ! 44: miFillPolygon(dst, pgc, shape, mode, count, pPts) ! 45: DrawablePtr dst; ! 46: register GCPtr pgc; ! 47: int shape, mode; ! 48: register int count; ! 49: DDXPointPtr pPts; ! 50: { ! 51: int i; ! 52: register int xorg, yorg; ! 53: register DDXPointPtr ppt; ! 54: ! 55: if (count == 0) ! 56: return; ! 57: ! 58: ppt = pPts; ! 59: if (pgc->miTranslate) ! 60: { ! 61: if (dst->type == DRAWABLE_WINDOW) ! 62: { ! 63: xorg = ((WindowPtr)dst)->absCorner.x; ! 64: yorg = ((WindowPtr)dst)->absCorner.y; ! 65: } ! 66: else ! 67: { ! 68: xorg = 0; ! 69: yorg = 0; ! 70: } ! 71: ! 72: if (mode == CoordModeOrigin) ! 73: { ! 74: for (i = 0; i<count; i++) ! 75: { ! 76: ppt->x += xorg; ! 77: ppt++->y += yorg; ! 78: } ! 79: } ! 80: else ! 81: { ! 82: ppt->x += xorg; ! 83: ppt++->y += yorg; ! 84: for (i = 1; i<count; i++) ! 85: { ! 86: ppt->x += (ppt-1)->x; ! 87: ppt->y += (ppt-1)->y; ! 88: ppt++; ! 89: } ! 90: } ! 91: } ! 92: else ! 93: { ! 94: if (mode == CoordModePrevious) ! 95: { ! 96: ppt++; ! 97: for (i = 1; i<count; i++) ! 98: { ! 99: ppt->x += (ppt-1)->x; ! 100: ppt->y += (ppt-1)->y; ! 101: ppt++; ! 102: } ! 103: } ! 104: } ! 105: if (shape == Convex) ! 106: miFillConvexPoly(dst, pgc, count, pPts); ! 107: else ! 108: miFillGeneralPoly(dst, pgc, count, pPts); ! 109: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.