pixman-region16.c revision 1176bdada62cabc6ec4b0308a930e83b679d5d36
1ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao/*
2ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * Copyright © 2008 Red Hat, Inc.
3ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao *
4ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * Permission to use, copy, modify, distribute, and sell this software
5ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * and its documentation for any purpose is hereby granted without
6ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * fee, provided that the above copyright notice appear in all copies
7ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * and that both that copyright notice and this permission notice
8ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * appear in supporting documentation, and that the name of
9ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * Red Hat, Inc. not be used in advertising or publicity pertaining to
10ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * distribution of the software without specific, written prior
11ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * permission. Red Hat, Inc. makes no representations about the
12ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * suitability of this software for any purpose.  It is provided "as
13ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * is" without express or implied warranty.
14ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao *
15ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
18ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
21ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao *
23ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao * Author: Soren Sandmann <sandmann@redhat.com>
24ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao */
25ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#ifdef HAVE_CONFIG_H
26ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#include <config.h>
27ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#endif
28ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
29ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#undef PIXMAN_DISABLE_DEPRECATED
30ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
31ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#include "pixman-private.h"
32ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
33ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#include <stdlib.h>
34ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
35ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaotypedef pixman_box16_t		box_type_t;
36ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaotypedef pixman_region16_data_t	region_data_type_t;
37ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaotypedef pixman_region16_t	region_type_t;
38ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaotypedef int32_t                 overflow_int_t;
39ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
40ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaotypedef struct {
41ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao    int x, y;
42ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao} point_type_t;
43ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
44ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao#define PREFIX(x) pixman_region##x
45
46#define PIXMAN_REGION_MAX INT16_MAX
47#define PIXMAN_REGION_MIN INT16_MIN
48
49#include "pixman-region.c"
50
51/* This function exists only to make it possible to preserve the X ABI -
52 * it should go away at first opportunity.
53 *
54 * The problem is that the X ABI exports the three structs and has used
55 * them through macros. So the X server calls this function with
56 * the addresses of those structs which makes the existing code continue to
57 * work.
58 */
59PIXMAN_EXPORT void
60pixman_region_set_static_pointers (pixman_box16_t *empty_box,
61				   pixman_region16_data_t *empty_data,
62				   pixman_region16_data_t *broken_data)
63{
64    pixman_region_empty_box = empty_box;
65    pixman_region_empty_data = empty_data;
66    pixman_broken_data = broken_data;
67}
68