Add beginning of general implementation
[profile/ivi/pixman.git] / pixman / pixman-general.c
1 /*
2  * Copyright © 2009 Red Hat, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of Red Hat not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  Red Hat makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as is"
12  * without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
19  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
20  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21  * SOFTWARE.
22  */
23 #include <config.h>
24 #include "pixman-private.h"
25
26 static void
27 combine_32 (pixman_implementation_t *imp, pixman_op_t op,
28             uint32_t *dest, const uint32_t *src, const uint32_t *mask,
29             int width)
30 {
31     CombineFunc32 f = pixman_composeFunctions.combineU[op];
32
33     f (dest, src, mask, width);
34 }
35
36 static void
37 combine_64 (pixman_implementation_t *imp, pixman_op_t op,
38             uint64_t *dest, const uint64_t *src, const uint64_t *mask,
39             int width)
40 {
41     CombineFunc64 f = pixman_composeFunctions64.combineU[op];
42
43     f (dest, src, mask, width);
44 }
45
46 static void
47 combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
48                uint32_t *dest, const uint32_t *src, const uint32_t *mask,
49                int width)
50 {
51     CombineFunc32 f = pixman_composeFunctions.combineC[op];
52
53     f (dest, src, mask, width);
54 }
55
56 static void
57 combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
58             uint64_t *dest, const uint64_t *src, const uint64_t *mask,
59             int width)
60 {
61     CombineFunc64 f = pixman_composeFunctions64.combineC[op];
62
63     f (dest, src, mask, width);
64 }
65
66 pixman_implementation_t *
67 _pixman_implementation_create_general (pixman_implementation_t *toplevel)
68 {
69     pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
70     int i;
71
72     for (i = 0; i < PIXMAN_OP_LAST; ++i)
73     {
74         imp->combine_32[i] = combine_32;
75         imp->combine_64[i] = combine_64;
76         imp->combine_32_ca[i] = combine_32_ca;
77         imp->combine_64_ca[i] = combine_64_ca;
78     }
79
80     return imp;
81 }