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_blt (pixman_implementation_t * imp,
45 return _pixman_implementation_blt (
46 imp->delegate, src_bits, dst_bits, src_stride, dst_stride,
47 src_bpp, dst_bpp, src_x, src_y, dest_x, dest_y,
52 delegate_fill (pixman_implementation_t *imp,
62 return _pixman_implementation_fill (
63 imp->delegate, bits, stride, bpp, x, y, width, height, xor);
67 delegate_src_iter_init (pixman_implementation_t *imp,
70 imp->delegate->src_iter_init (imp->delegate, iter);
74 delegate_dest_iter_init (pixman_implementation_t *imp,
77 imp->delegate->dest_iter_init (imp->delegate, iter);
80 pixman_implementation_t *
81 _pixman_implementation_create (pixman_implementation_t *delegate,
82 const pixman_fast_path_t *fast_paths)
84 pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t));
85 pixman_implementation_t *d;
93 /* Make sure the whole delegate chain has the right toplevel */
94 imp->delegate = delegate;
95 for (d = imp; d != NULL; d = d->delegate)
98 /* Fill out function pointers with ones that just delegate
100 imp->blt = delegate_blt;
101 imp->fill = delegate_fill;
102 imp->src_iter_init = delegate_src_iter_init;
103 imp->dest_iter_init = delegate_dest_iter_init;
105 imp->fast_paths = fast_paths;
107 for (i = 0; i < PIXMAN_N_OPERATORS; ++i)
109 imp->combine_32[i] = NULL;
110 imp->combine_64[i] = NULL;
111 imp->combine_32_ca[i] = NULL;
112 imp->combine_64_ca[i] = NULL;
118 pixman_combine_32_func_t
119 _pixman_implementation_lookup_combiner (pixman_implementation_t *imp,
121 pixman_bool_t component_alpha,
122 pixman_bool_t narrow)
124 pixman_combine_32_func_t f;
128 pixman_combine_32_func_t (*combiners[]) =
130 (pixman_combine_32_func_t *)imp->combine_64,
131 (pixman_combine_32_func_t *)imp->combine_64_ca,
136 f = combiners[component_alpha | (narrow << 1)][op];
146 _pixman_implementation_blt (pixman_implementation_t * imp,
160 return (*imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride,
161 src_bpp, dst_bpp, src_x, src_y, dest_x, dest_y,
166 _pixman_implementation_fill (pixman_implementation_t *imp,
176 return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
180 _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
182 pixman_image_t *image,
188 iter_flags_t iter_flags,
189 uint32_t image_flags)
192 iter->buffer = (uint32_t *)buffer;
196 iter->height = height;
197 iter->iter_flags = iter_flags;
198 iter->image_flags = image_flags;
200 (*imp->src_iter_init) (imp, iter);
204 _pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
206 pixman_image_t *image,
212 iter_flags_t iter_flags,
213 uint32_t image_flags)
216 iter->buffer = (uint32_t *)buffer;
220 iter->height = height;
221 iter->iter_flags = iter_flags;
222 iter->image_flags = image_flags;
224 (*imp->dest_iter_init) (imp, iter);