Add patch that contain Mali fixes.
[deb_xorg-server.git] / render / mitri.c
1 /*
2 *
3 * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
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, 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.
14 *
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.
22 */
23
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
26 #endif
27
28 #include "scrnintstr.h"
29 #include "gcstruct.h"
30 #include "pixmapstr.h"
31 #include "windowstr.h"
32 #include "mi.h"
33 #include "picturestr.h"
34 #include "mipict.h"
35
36 void
37 miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds)
38 {
39 bounds->x1 = xFixedToInt(points->x);
40 bounds->x2 = xFixedToInt(xFixedCeil(points->x));
41 bounds->y1 = xFixedToInt(points->y);
42 bounds->y2 = xFixedToInt(xFixedCeil(points->y));
43 points++;
44 npoint--;
45 while (npoint-- > 0) {
46 INT16 x1 = xFixedToInt(points->x);
47 INT16 x2 = xFixedToInt(xFixedCeil(points->x));
48 INT16 y1 = xFixedToInt(points->y);
49 INT16 y2 = xFixedToInt(xFixedCeil(points->y));
50
51 if (x1 < bounds->x1)
52 bounds->x1 = x1;
53 else if (x2 > bounds->x2)
54 bounds->x2 = x2;
55 if (y1 < bounds->y1)
56 bounds->y1 = y1;
57 else if (y2 > bounds->y2)
58 bounds->y2 = y2;
59 points++;
60 }
61 }
62
63 void
64 miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
65 {
66 miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
67 }