Add patch that contain Mali fixes.
[deb_xorg-server.git] / mi / miwideline.h
1 /*
2
3 Copyright 1988, 1998 The Open Group
4
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
25 from 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 * Polygon edge description for integer wide-line routines
36 */
37
38 typedef struct _PolyEdge {
39 int height; /* number of scanlines to process */
40 int x; /* starting x coordinate */
41 int stepx; /* fixed integral dx */
42 int signdx; /* variable dx sign */
43 int e; /* initial error term */
44 int dy;
45 int dx;
46 } PolyEdgeRec, *PolyEdgePtr;
47
48 #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
49
50 /*
51 * types for general polygon routines
52 */
53
54 typedef struct _PolyVertex {
55 double x, y;
56 } PolyVertexRec, *PolyVertexPtr;
57
58 typedef struct _PolySlope {
59 int dx, dy;
60 double k; /* x0 * dy - y0 * dx */
61 } PolySlopeRec, *PolySlopePtr;
62
63 /*
64 * Line face description for caps/joins
65 */
66
67 typedef struct _LineFace {
68 double xa, ya;
69 int dx, dy;
70 int x, y;
71 double k;
72 } LineFaceRec, *LineFacePtr;
73
74 /*
75 * macros for polygon fillers
76 */
77
78 #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
79 oldPixel = pGC->fgPixel; \
80 if (pixel != oldPixel) { \
81 ChangeGCVal gcval; \
82 gcval.val = pixel; \
83 ChangeGC (NullClient, pGC, GCForeground, &gcval); \
84 ValidateGC (pDrawable, pGC); \
85 } \
86 }
87 #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
88 if (pixel != oldPixel) { \
89 ChangeGCVal gcval; \
90 gcval.val = oldPixel; \
91 ChangeGC (NullClient, pGC, GCForeground, &gcval); \
92 ValidateGC (pDrawable, pGC); \
93 } \
94 }
95
96 extern _X_EXPORT void miRoundJoinClip(LineFacePtr /*pLeft */ ,
97 LineFacePtr /*pRight */ ,
98 PolyEdgePtr /*edge1 */ ,
99 PolyEdgePtr /*edge2 */ ,
100 int * /*y1 */ ,
101 int * /*y2 */ ,
102 Bool * /*left1 */ ,
103 Bool * /*left2 */
104 );
105
106 extern _X_EXPORT int miRoundCapClip(LineFacePtr /*face */ ,
107 Bool /*isInt */ ,
108 PolyEdgePtr /*edge */ ,
109 Bool * /*leftEdge */
110 );
111
112 extern _X_EXPORT int miPolyBuildEdge(double x0, double y0, double k, int dx,
113 int dy, int xi, int yi, int left,
114 PolyEdgePtr edge);
115 extern _X_EXPORT int miPolyBuildPoly(PolyVertexPtr vertices,
116 PolySlopePtr slopes, int count, int xi,
117 int yi, PolyEdgePtr left,
118 PolyEdgePtr right, int *pnleft,
119 int *pnright, int *h);