Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1891 | serge | 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 | |||
24 | #ifdef HAVE_CONFIG_H |
||
25 | #include |
||
26 | #endif |
||
27 | #include |
||
28 | #include "pixman-private.h" |
||
29 | |||
30 | static void |
||
31 | delegate_combine_32 (pixman_implementation_t * imp, |
||
32 | pixman_op_t op, |
||
33 | uint32_t * dest, |
||
34 | const uint32_t * src, |
||
35 | const uint32_t * mask, |
||
36 | int width) |
||
37 | { |
||
38 | _pixman_implementation_combine_32 (imp->delegate, |
||
39 | op, dest, src, mask, width); |
||
40 | } |
||
41 | |||
42 | static void |
||
43 | delegate_combine_64 (pixman_implementation_t * imp, |
||
44 | pixman_op_t op, |
||
45 | uint64_t * dest, |
||
46 | const uint64_t * src, |
||
47 | const uint64_t * mask, |
||
48 | int width) |
||
49 | { |
||
50 | _pixman_implementation_combine_64 (imp->delegate, |
||
51 | op, dest, src, mask, width); |
||
52 | } |
||
53 | |||
54 | static void |
||
55 | delegate_combine_32_ca (pixman_implementation_t * imp, |
||
56 | pixman_op_t op, |
||
57 | uint32_t * dest, |
||
58 | const uint32_t * src, |
||
59 | const uint32_t * mask, |
||
60 | int width) |
||
61 | { |
||
62 | _pixman_implementation_combine_32_ca (imp->delegate, |
||
63 | op, dest, src, mask, width); |
||
64 | } |
||
65 | |||
66 | static void |
||
67 | delegate_combine_64_ca (pixman_implementation_t * imp, |
||
68 | pixman_op_t op, |
||
69 | uint64_t * dest, |
||
70 | const uint64_t * src, |
||
71 | const uint64_t * mask, |
||
72 | int width) |
||
73 | { |
||
74 | _pixman_implementation_combine_64_ca (imp->delegate, |
||
75 | op, dest, src, mask, width); |
||
76 | } |
||
77 | |||
78 | static pixman_bool_t |
||
79 | delegate_blt (pixman_implementation_t * imp, |
||
80 | uint32_t * src_bits, |
||
81 | uint32_t * dst_bits, |
||
82 | int src_stride, |
||
83 | int dst_stride, |
||
84 | int src_bpp, |
||
85 | int dst_bpp, |
||
86 | int src_x, |
||
87 | int src_y, |
||
88 | int dst_x, |
||
89 | int dst_y, |
||
90 | int width, |
||
91 | int height) |
||
92 | { |
||
93 | return _pixman_implementation_blt ( |
||
94 | imp->delegate, src_bits, dst_bits, src_stride, dst_stride, |
||
95 | src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y, |
||
96 | width, height); |
||
97 | } |
||
98 | |||
99 | static pixman_bool_t |
||
100 | delegate_fill (pixman_implementation_t *imp, |
||
101 | uint32_t * bits, |
||
102 | int stride, |
||
103 | int bpp, |
||
104 | int x, |
||
105 | int y, |
||
106 | int width, |
||
107 | int height, |
||
108 | uint32_t xor) |
||
109 | { |
||
110 | return _pixman_implementation_fill ( |
||
111 | imp->delegate, bits, stride, bpp, x, y, width, height, xor); |
||
112 | } |
||
113 | |||
114 | pixman_implementation_t * |
||
115 | _pixman_implementation_create (pixman_implementation_t *delegate, |
||
116 | const pixman_fast_path_t *fast_paths) |
||
117 | { |
||
118 | pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t)); |
||
119 | pixman_implementation_t *d; |
||
120 | int i; |
||
121 | |||
122 | if (!imp) |
||
123 | return NULL; |
||
124 | |||
125 | assert (fast_paths); |
||
126 | |||
127 | /* Make sure the whole delegate chain has the right toplevel */ |
||
128 | imp->delegate = delegate; |
||
129 | for (d = imp; d != NULL; d = d->delegate) |
||
130 | d->toplevel = imp; |
||
131 | |||
132 | /* Fill out function pointers with ones that just delegate |
||
133 | */ |
||
134 | imp->blt = delegate_blt; |
||
135 | imp->fill = delegate_fill; |
||
136 | |||
137 | for (i = 0; i < PIXMAN_N_OPERATORS; ++i) |
||
138 | { |
||
139 | imp->combine_32[i] = delegate_combine_32; |
||
140 | imp->combine_64[i] = delegate_combine_64; |
||
141 | imp->combine_32_ca[i] = delegate_combine_32_ca; |
||
142 | imp->combine_64_ca[i] = delegate_combine_64_ca; |
||
143 | } |
||
144 | |||
145 | imp->fast_paths = fast_paths; |
||
146 | |||
147 | return imp; |
||
148 | } |
||
149 | |||
150 | void |
||
151 | _pixman_implementation_combine_32 (pixman_implementation_t * imp, |
||
152 | pixman_op_t op, |
||
153 | uint32_t * dest, |
||
154 | const uint32_t * src, |
||
155 | const uint32_t * mask, |
||
156 | int width) |
||
157 | { |
||
158 | (*imp->combine_32[op]) (imp, op, dest, src, mask, width); |
||
159 | } |
||
160 | |||
161 | void |
||
162 | _pixman_implementation_combine_64 (pixman_implementation_t * imp, |
||
163 | pixman_op_t op, |
||
164 | uint64_t * dest, |
||
165 | const uint64_t * src, |
||
166 | const uint64_t * mask, |
||
167 | int width) |
||
168 | { |
||
169 | (*imp->combine_64[op]) (imp, op, dest, src, mask, width); |
||
170 | } |
||
171 | |||
172 | void |
||
173 | _pixman_implementation_combine_32_ca (pixman_implementation_t * imp, |
||
174 | pixman_op_t op, |
||
175 | uint32_t * dest, |
||
176 | const uint32_t * src, |
||
177 | const uint32_t * mask, |
||
178 | int width) |
||
179 | { |
||
180 | (*imp->combine_32_ca[op]) (imp, op, dest, src, mask, width); |
||
181 | } |
||
182 | |||
183 | void |
||
184 | _pixman_implementation_combine_64_ca (pixman_implementation_t * imp, |
||
185 | pixman_op_t op, |
||
186 | uint64_t * dest, |
||
187 | const uint64_t * src, |
||
188 | const uint64_t * mask, |
||
189 | int width) |
||
190 | { |
||
191 | (*imp->combine_64_ca[op]) (imp, op, dest, src, mask, width); |
||
192 | } |
||
193 | |||
194 | pixman_bool_t |
||
195 | _pixman_implementation_blt (pixman_implementation_t * imp, |
||
196 | uint32_t * src_bits, |
||
197 | uint32_t * dst_bits, |
||
198 | int src_stride, |
||
199 | int dst_stride, |
||
200 | int src_bpp, |
||
201 | int dst_bpp, |
||
202 | int src_x, |
||
203 | int src_y, |
||
204 | int dst_x, |
||
205 | int dst_y, |
||
206 | int width, |
||
207 | int height) |
||
208 | { |
||
209 | return (*imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride, |
||
210 | src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y, |
||
211 | width, height); |
||
212 | } |
||
213 | |||
214 | pixman_bool_t |
||
215 | _pixman_implementation_fill (pixman_implementation_t *imp, |
||
216 | uint32_t * bits, |
||
217 | int stride, |
||
218 | int bpp, |
||
219 | int x, |
||
220 | int y, |
||
221 | int width, |
||
222 | int height, |
||
223 | uint32_t xor) |
||
224 | { |
||
225 | return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor); |
||
226 | }> |
||
227 |