3 * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
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, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
28 #include "scrnintstr.h"
30 #include "pixmapstr.h"
31 #include "windowstr.h"
34 #include "picturestr.h"
38 miLineFixedX(xLineFixed
* l
, xFixed y
, Bool ceil
)
40 xFixed dx
= l
->p2
.x
- l
->p1
.x
;
41 xFixed_32_32 ex
= (xFixed_32_32
) (y
- l
->p1
.y
) * dx
;
42 xFixed dy
= l
->p2
.y
- l
->p1
.y
;
46 return l
->p1
.x
+ (xFixed
) (ex
/ dy
);
50 miTrapezoidBounds(int ntrap
, xTrapezoid
* traps
, BoxPtr box
)
56 for (; ntrap
; ntrap
--, traps
++) {
59 if (!xTrapezoidValid(traps
))
61 y1
= xFixedToInt(traps
->top
);
65 y2
= xFixedToInt(xFixedCeil(traps
->bottom
));
69 x1
= xFixedToInt(min(miLineFixedX(&traps
->left
, traps
->top
, FALSE
),
70 miLineFixedX(&traps
->left
, traps
->bottom
, FALSE
)));
74 x2
= xFixedToInt(xFixedCeil
76 (miLineFixedX(&traps
->right
, traps
->top
, TRUE
),
77 miLineFixedX(&traps
->right
, traps
->bottom
, TRUE
))));