|
|
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: mipolypnt.c,v 1.7 87/09/11 07:20:17 toddb Exp $ */
25: #include "X.h"
26: #include "Xprotostr.h"
27: #include "pixmapstr.h"
28: #include "gcstruct.h"
29: #include "windowstr.h"
30:
31: void
32: miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
33: DrawablePtr pDrawable;
34: GCPtr pGC;
35: int mode; /* Origin or Previous */
36: int npt;
37: xPoint *pptInit;
38: {
39:
40: int xorg;
41: int yorg;
42: int nptTmp;
43: int fsOld, fsNew;
44: int *pwidthInit, *pwidth;
45: int i;
46: register xPoint *ppt;
47:
48:
49: if (pDrawable->type == DRAWABLE_WINDOW)
50: {
51: xorg = ((WindowPtr)pDrawable)->absCorner.x;
52: yorg = ((WindowPtr)pDrawable)->absCorner.y;
53: }
54: else
55: {
56: xorg = 0;
57: yorg = 0;
58: }
59:
60: /* make pointlist origin relative */
61: if (mode == CoordModePrevious)
62: {
63: ppt = pptInit;
64: nptTmp = npt;
65: nptTmp--;
66: while(nptTmp--)
67: {
68: ppt++;
69: ppt->x += (ppt-1)->x;
70: ppt->y += (ppt-1)->y;
71: }
72: }
73:
74: if(pGC->miTranslate)
75: {
76: ppt = pptInit;
77: nptTmp = npt;
78: while(nptTmp--)
79: {
80: ppt->x += xorg;
81: ppt++->y += yorg;
82: }
83: }
84:
85: fsOld = pGC->fillStyle;
86: fsNew = FillSolid;
87: if(pGC->fillStyle != FillSolid)
88: {
89: DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
90: ValidateGC(pDrawable, pGC);
91: }
92: if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int))))
93: return;
94: pwidth = pwidthInit;
95: for(i = 0; i < npt; i++)
96: *pwidth++ = 1;
97: (*pGC->FillSpans)(pDrawable, pGC, npt, pptInit, pwidthInit, FALSE);
98:
99: if(fsOld != FillSolid)
100: {
101: DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
102: ValidateGC(pDrawable, pGC);
103: }
104: DEALLOCATE_LOCAL(pwidthInit);
105: }
106:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.