VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.4.2/miwideline.h@ 78293

Last change on this file since 78293 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 5.0 KB
Line 
1/*
2
3Copyright 1988, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28
29/* Author: Keith Packard, MIT X Consortium */
30
31#include "mispans.h"
32#include "mifpoly.h" /* for ICEIL */
33
34/*
35 * interface data to span-merging polygon filler
36 */
37
38typedef struct _SpanData {
39 SpanGroup fgGroup, bgGroup;
40} SpanDataRec, *SpanDataPtr;
41
42#define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \
43 SpanGroup *group, *othergroup = NULL; \
44 if (pixel == pGC->fgPixel) \
45 { \
46 group = &spanData->fgGroup; \
47 if (pGC->lineStyle == LineDoubleDash) \
48 othergroup = &spanData->bgGroup; \
49 } \
50 else \
51 { \
52 group = &spanData->bgGroup; \
53 othergroup = &spanData->fgGroup; \
54 } \
55 miAppendSpans (group, othergroup, spanPtr); \
56}
57
58/*
59 * Polygon edge description for integer wide-line routines
60 */
61
62typedef struct _PolyEdge {
63 int height; /* number of scanlines to process */
64 int x; /* starting x coordinate */
65 int stepx; /* fixed integral dx */
66 int signdx; /* variable dx sign */
67 int e; /* initial error term */
68 int dy;
69 int dx;
70} PolyEdgeRec, *PolyEdgePtr;
71
72#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
73
74/*
75 * types for general polygon routines
76 */
77
78typedef struct _PolyVertex {
79 double x, y;
80} PolyVertexRec, *PolyVertexPtr;
81
82typedef struct _PolySlope {
83 int dx, dy;
84 double k; /* x0 * dy - y0 * dx */
85} PolySlopeRec, *PolySlopePtr;
86
87/*
88 * Line face description for caps/joins
89 */
90
91typedef struct _LineFace {
92 double xa, ya;
93 int dx, dy;
94 int x, y;
95 double k;
96} LineFaceRec, *LineFacePtr;
97
98/*
99 * macros for polygon fillers
100 */
101
102#define MIPOLYRELOADLEFT if (!left_height && left_count) { \
103 left_height = left->height; \
104 left_x = left->x; \
105 left_stepx = left->stepx; \
106 left_signdx = left->signdx; \
107 left_e = left->e; \
108 left_dy = left->dy; \
109 left_dx = left->dx; \
110 --left_count; \
111 ++left; \
112 }
113
114#define MIPOLYRELOADRIGHT if (!right_height && right_count) { \
115 right_height = right->height; \
116 right_x = right->x; \
117 right_stepx = right->stepx; \
118 right_signdx = right->signdx; \
119 right_e = right->e; \
120 right_dy = right->dy; \
121 right_dx = right->dx; \
122 --right_count; \
123 ++right; \
124 }
125
126#define MIPOLYSTEPLEFT left_x += left_stepx; \
127 left_e += left_dx; \
128 if (left_e > 0) \
129 { \
130 left_x += left_signdx; \
131 left_e -= left_dy; \
132 }
133
134#define MIPOLYSTEPRIGHT right_x += right_stepx; \
135 right_e += right_dx; \
136 if (right_e > 0) \
137 { \
138 right_x += right_signdx; \
139 right_e -= right_dy; \
140 }
141
142#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
143 oldPixel = pGC->fgPixel; \
144 if (pixel != oldPixel) { \
145 DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \
146 ValidateGC (pDrawable, pGC); \
147 } \
148}
149#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
150 if (pixel != oldPixel) { \
151 DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \
152 ValidateGC (pDrawable, pGC); \
153 } \
154}
155
156extern void miRoundJoinClip(
157 LineFacePtr /*pLeft*/,
158 LineFacePtr /*pRight*/,
159 PolyEdgePtr /*edge1*/,
160 PolyEdgePtr /*edge2*/,
161 int * /*y1*/,
162 int * /*y2*/,
163 Bool * /*left1*/,
164 Bool * /*left2*/
165);
166
167extern int miRoundCapClip(
168 LineFacePtr /*face*/,
169 Bool /*isInt*/,
170 PolyEdgePtr /*edge*/,
171 Bool * /*leftEdge*/
172);
173
174extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
175 int xi, int yi, int left, PolyEdgePtr edge);
176extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
177 int count, int xi, int yi, PolyEdgePtr left,
178 PolyEdgePtr right, int *pnleft, int *pnright,
179 int *h);
180
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette