2 * Copyright © 2009 Red Hat, Inc.
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.
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
28 #include "pixman-private.h"
31 delegate_combine_32 (pixman_implementation_t * imp,
35 const uint32_t * mask,
38 _pixman_implementation_combine_32 (imp->delegate,
39 op, dest, src, mask, width);
43 delegate_combine_64 (pixman_implementation_t * imp,
47 const uint64_t * mask,
50 _pixman_implementation_combine_64 (imp->delegate,
51 op, dest, src, mask, width);
55 delegate_combine_32_ca (pixman_implementation_t * imp,
59 const uint32_t * mask,
62 _pixman_implementation_combine_32_ca (imp->delegate,
63 op, dest, src, mask, width);
67 delegate_combine_64_ca (pixman_implementation_t * imp,
71 const uint64_t * mask,
74 _pixman_implementation_combine_64_ca (imp->delegate,
75 op, dest, src, mask, width);
79 delegate_blt (pixman_implementation_t * imp,
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, dest_x, dest_y,
100 delegate_fill (pixman_implementation_t *imp,
110 return _pixman_implementation_fill (
111 imp->delegate, bits, stride, bpp, x, y, width, height, xor);
115 delegate_src_iter_init (pixman_implementation_t *imp,
116 pixman_iter_t * iter)
118 imp->delegate->src_iter_init (imp->delegate, iter);
122 delegate_dest_iter_init (pixman_implementation_t *imp,
123 pixman_iter_t * iter)
125 imp->delegate->dest_iter_init (imp->delegate, iter);
128 pixman_implementation_t *
129 _pixman_implementation_create (pixman_implementation_t *delegate,
130 const pixman_fast_path_t *fast_paths)
132 pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t));
133 pixman_implementation_t *d;
141 /* Make sure the whole delegate chain has the right toplevel */
142 imp->delegate = delegate;
143 for (d = imp; d != NULL; d = d->delegate)
146 /* Fill out function pointers with ones that just delegate
148 imp->blt = delegate_blt;
149 imp->fill = delegate_fill;
150 imp->src_iter_init = delegate_src_iter_init;
151 imp->dest_iter_init = delegate_dest_iter_init;
153 for (i = 0; i < PIXMAN_N_OPERATORS; ++i)
155 imp->combine_32[i] = delegate_combine_32;
156 imp->combine_64[i] = delegate_combine_64;
157 imp->combine_32_ca[i] = delegate_combine_32_ca;
158 imp->combine_64_ca[i] = delegate_combine_64_ca;
161 imp->fast_paths = fast_paths;
167 _pixman_implementation_combine_32 (pixman_implementation_t * imp,
170 const uint32_t * src,
171 const uint32_t * mask,
174 (*imp->combine_32[op]) (imp, op, dest, src, mask, width);
178 _pixman_implementation_combine_64 (pixman_implementation_t * imp,
181 const uint64_t * src,
182 const uint64_t * mask,
185 (*imp->combine_64[op]) (imp, op, dest, src, mask, width);
189 _pixman_implementation_combine_32_ca (pixman_implementation_t * imp,
192 const uint32_t * src,
193 const uint32_t * mask,
196 (*imp->combine_32_ca[op]) (imp, op, dest, src, mask, width);
200 _pixman_implementation_combine_64_ca (pixman_implementation_t * imp,
203 const uint64_t * src,
204 const uint64_t * mask,
207 (*imp->combine_64_ca[op]) (imp, op, dest, src, mask, width);
211 _pixman_implementation_blt (pixman_implementation_t * imp,
225 return (*imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride,
226 src_bpp, dst_bpp, src_x, src_y, dest_x, dest_y,
231 _pixman_implementation_fill (pixman_implementation_t *imp,
241 return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
245 _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
247 pixman_image_t *image,
256 iter->buffer = (uint32_t *)buffer;
260 iter->height = height;
263 (*imp->src_iter_init) (imp, iter);
267 _pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
269 pixman_image_t *image,
278 iter->buffer = (uint32_t *)buffer;
282 iter->height = height;
285 (*imp->dest_iter_init) (imp, iter);