From 12726de921a621b8147d12d7e0788076bc4cc80d Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 13 May 2009 04:04:36 -0400 Subject: [PATCH] Add beginning of general implementation --- pixman/Makefile.am | 1 + pixman/pixman-general.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ pixman/pixman-private.h | 6 ++++ 3 files changed, 88 insertions(+) create mode 100644 pixman/pixman-general.c diff --git a/pixman/Makefile.am b/pixman/Makefile.am index 21503b6..c1faac3 100644 --- a/pixman/Makefile.am +++ b/pixman/Makefile.am @@ -18,6 +18,7 @@ libpixman_1_la_SOURCES = \ pixman-combine64.c \ pixman-combine64.h \ pixman-compose.c \ + pixman-general.c \ pixman-pict.c \ pixman-fast-path.c \ pixman-solid-fill.c \ diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c new file mode 100644 index 0000000..cc95eab --- /dev/null +++ b/pixman/pixman-general.c @@ -0,0 +1,81 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#include +#include "pixman-private.h" + +static void +combine_32 (pixman_implementation_t *imp, pixman_op_t op, + uint32_t *dest, const uint32_t *src, const uint32_t *mask, + int width) +{ + CombineFunc32 f = pixman_composeFunctions.combineU[op]; + + f (dest, src, mask, width); +} + +static void +combine_64 (pixman_implementation_t *imp, pixman_op_t op, + uint64_t *dest, const uint64_t *src, const uint64_t *mask, + int width) +{ + CombineFunc64 f = pixman_composeFunctions64.combineU[op]; + + f (dest, src, mask, width); +} + +static void +combine_32_ca (pixman_implementation_t *imp, pixman_op_t op, + uint32_t *dest, const uint32_t *src, const uint32_t *mask, + int width) +{ + CombineFunc32 f = pixman_composeFunctions.combineC[op]; + + f (dest, src, mask, width); +} + +static void +combine_64_ca (pixman_implementation_t *imp, pixman_op_t op, + uint64_t *dest, const uint64_t *src, const uint64_t *mask, + int width) +{ + CombineFunc64 f = pixman_composeFunctions64.combineC[op]; + + f (dest, src, mask, width); +} + +pixman_implementation_t * +_pixman_implementation_create_general (pixman_implementation_t *toplevel) +{ + pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL); + int i; + + for (i = 0; i < PIXMAN_OP_LAST; ++i) + { + imp->combine_32[i] = combine_32; + imp->combine_64[i] = combine_64; + imp->combine_32_ca[i] = combine_32_ca; + imp->combine_64_ca[i] = combine_64_ca; + } + + return imp; +} diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 7cf8e12..eae9027 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -932,9 +932,15 @@ struct pixman_implementation_t pixman_composite_func_t composite; pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST]; + pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST]; pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST]; + pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST]; }; +pixman_implementation_t * +_pixman_implementation_create (pixman_implementation_t *toplevel, + pixman_implementation_t *delegate); + void _pixman_implementation_combine_32 (pixman_implementation_t * imp, pixman_op_t op, -- 2.7.4