1
/* $Xorg: miwideline.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */
4
Copyright 1988, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included
13
in all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall
24
not be used in advertising or otherwise to promote the sale, use or
25
other dealings in this Software without prior written authorization
29
/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.11 2001/10/25 12:03:47 alanh Exp $ */
31
/* Author: Keith Packard, MIT X Consortium */
34
#include "mifpoly.h" /* for ICEIL */
37
* interface data to span-merging polygon filler
40
typedef struct _SpanData {
41
SpanGroup fgGroup, bgGroup;
42
} SpanDataRec, *SpanDataPtr;
44
#define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \
45
SpanGroup *group, *othergroup = NULL; \
46
if (pixel == pGC->fgPixel) \
48
group = &spanData->fgGroup; \
49
if (pGC->lineStyle == LineDoubleDash) \
50
othergroup = &spanData->bgGroup; \
54
group = &spanData->bgGroup; \
55
othergroup = &spanData->fgGroup; \
57
miAppendSpans (group, othergroup, spanPtr); \
61
* Polygon edge description for integer wide-line routines
64
typedef struct _PolyEdge {
65
int height; /* number of scanlines to process */
66
int x; /* starting x coordinate */
67
int stepx; /* fixed integral dx */
68
int signdx; /* variable dx sign */
69
int e; /* initial error term */
72
} PolyEdgeRec, *PolyEdgePtr;
74
#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
77
* types for general polygon routines
80
typedef struct _PolyVertex {
82
} PolyVertexRec, *PolyVertexPtr;
84
typedef struct _PolySlope {
86
double k; /* x0 * dy - y0 * dx */
87
} PolySlopeRec, *PolySlopePtr;
90
* Line face description for caps/joins
93
typedef struct _LineFace {
98
} LineFaceRec, *LineFacePtr;
101
* macros for polygon fillers
104
#define MIPOLYRELOADLEFT if (!left_height && left_count) { \
105
left_height = left->height; \
107
left_stepx = left->stepx; \
108
left_signdx = left->signdx; \
110
left_dy = left->dy; \
111
left_dx = left->dx; \
116
#define MIPOLYRELOADRIGHT if (!right_height && right_count) { \
117
right_height = right->height; \
118
right_x = right->x; \
119
right_stepx = right->stepx; \
120
right_signdx = right->signdx; \
121
right_e = right->e; \
122
right_dy = right->dy; \
123
right_dx = right->dx; \
128
#define MIPOLYSTEPLEFT left_x += left_stepx; \
132
left_x += left_signdx; \
136
#define MIPOLYSTEPRIGHT right_x += right_stepx; \
137
right_e += right_dx; \
140
right_x += right_signdx; \
141
right_e -= right_dy; \
144
#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
145
oldPixel = pGC->fgPixel; \
146
if (pixel != oldPixel) { \
147
DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \
148
ValidateGC (pDrawable, pGC); \
151
#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
152
if (pixel != oldPixel) { \
153
DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \
154
ValidateGC (pDrawable, pGC); \
158
extern void miFillPolyHelper(
159
DrawablePtr /*pDrawable*/,
161
unsigned long /*pixel*/,
162
SpanDataPtr /*spanData*/,
164
int /*overall_height*/,
165
PolyEdgePtr /*left*/,
166
PolyEdgePtr /*right*/,
170
extern int miRoundJoinFace(
171
LineFacePtr /*face*/,
172
PolyEdgePtr /*edge*/,
176
extern void miRoundJoinClip(
177
LineFacePtr /*pLeft*/,
178
LineFacePtr /*pRight*/,
179
PolyEdgePtr /*edge1*/,
180
PolyEdgePtr /*edge2*/,
187
extern int miRoundCapClip(
188
LineFacePtr /*face*/,
190
PolyEdgePtr /*edge*/,
194
extern void miLineProjectingCap(
195
DrawablePtr /*pDrawable*/,
197
unsigned long /*pixel*/,
198
SpanDataPtr /*spanData*/,
199
LineFacePtr /*face*/,
206
extern SpanDataPtr miSetupSpanData(
208
SpanDataPtr /*spanData*/,
212
extern void miCleanupSpanData(
213
DrawablePtr /*pDrawable*/,
215
SpanDataPtr /*spanData*/
218
extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
219
int xi, int yi, int left, PolyEdgePtr edge);
220
extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
221
int count, int xi, int yi, PolyEdgePtr left,
222
PolyEdgePtr right, int *pnleft, int *pnright,