1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun *
3*4882a593Smuzhiyun * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its
6*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that
7*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that
8*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting
9*4882a593Smuzhiyun * documentation, and that the name of Keith Packard not be used in
10*4882a593Smuzhiyun * advertising or publicity pertaining to distribution of the software without
11*4882a593Smuzhiyun * specific, written prior permission. Keith Packard makes no
12*4882a593Smuzhiyun * representations about the suitability of this software for any purpose. It
13*4882a593Smuzhiyun * is provided "as is" without express or implied warranty.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16*4882a593Smuzhiyun * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17*4882a593Smuzhiyun * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18*4882a593Smuzhiyun * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19*4882a593Smuzhiyun * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20*4882a593Smuzhiyun * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21*4882a593Smuzhiyun * PERFORMANCE OF THIS SOFTWARE.
22*4882a593Smuzhiyun */
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
25*4882a593Smuzhiyun #include <dix-config.h>
26*4882a593Smuzhiyun #endif
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun #include "scrnintstr.h"
29*4882a593Smuzhiyun #include "gcstruct.h"
30*4882a593Smuzhiyun #include "pixmapstr.h"
31*4882a593Smuzhiyun #include "windowstr.h"
32*4882a593Smuzhiyun #include "mi.h"
33*4882a593Smuzhiyun #include "picturestr.h"
34*4882a593Smuzhiyun #include "mipict.h"
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun void
miPointFixedBounds(int npoint,xPointFixed * points,BoxPtr bounds)37*4882a593Smuzhiyun miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds)
38*4882a593Smuzhiyun {
39*4882a593Smuzhiyun bounds->x1 = xFixedToInt(points->x);
40*4882a593Smuzhiyun bounds->x2 = xFixedToInt(xFixedCeil(points->x));
41*4882a593Smuzhiyun bounds->y1 = xFixedToInt(points->y);
42*4882a593Smuzhiyun bounds->y2 = xFixedToInt(xFixedCeil(points->y));
43*4882a593Smuzhiyun points++;
44*4882a593Smuzhiyun npoint--;
45*4882a593Smuzhiyun while (npoint-- > 0) {
46*4882a593Smuzhiyun INT16 x1 = xFixedToInt(points->x);
47*4882a593Smuzhiyun INT16 x2 = xFixedToInt(xFixedCeil(points->x));
48*4882a593Smuzhiyun INT16 y1 = xFixedToInt(points->y);
49*4882a593Smuzhiyun INT16 y2 = xFixedToInt(xFixedCeil(points->y));
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun if (x1 < bounds->x1)
52*4882a593Smuzhiyun bounds->x1 = x1;
53*4882a593Smuzhiyun else if (x2 > bounds->x2)
54*4882a593Smuzhiyun bounds->x2 = x2;
55*4882a593Smuzhiyun if (y1 < bounds->y1)
56*4882a593Smuzhiyun bounds->y1 = y1;
57*4882a593Smuzhiyun else if (y2 > bounds->y2)
58*4882a593Smuzhiyun bounds->y2 = y2;
59*4882a593Smuzhiyun points++;
60*4882a593Smuzhiyun }
61*4882a593Smuzhiyun }
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun void
miTriangleBounds(int ntri,xTriangle * tris,BoxPtr bounds)64*4882a593Smuzhiyun miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
65*4882a593Smuzhiyun {
66*4882a593Smuzhiyun miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
67*4882a593Smuzhiyun }
68