From e126ef091151372ed29562f3ff1a964774583b9b Mon Sep 17 00:00:00 2001 From: Soren Sandmann Pedersen Date: Thu, 10 May 2007 16:14:40 -0400 Subject: [PATCH] Make the pixman_transform_point_3d() function public --- pixman/Makefile.am | 3 ++- pixman/pixman-compose.c | 37 ++++---------------------------- pixman/pixman-private.h | 6 ------ pixman/pixman-utils.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ pixman/pixman.h | 3 +++ 5 files changed, 66 insertions(+), 40 deletions(-) create mode 100644 pixman/pixman-utils.c diff --git a/pixman/Makefile.am b/pixman/Makefile.am index 7c75397..a467d75 100644 --- a/pixman/Makefile.am +++ b/pixman/Makefile.am @@ -7,7 +7,8 @@ libpixman_la_SOURCES = \ pixman-region.c \ pixman-private.h \ pixman-image.c \ - pixman-compose.c + pixman-compose.c \ + pixman-utils.c libpixmanincludedir = $(includedir)/pixman libpixmaninclude_HEADERS = pixman.h diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c index 0aea0fb..44963a9 100644 --- a/pixman/pixman-compose.c +++ b/pixman/pixman-compose.c @@ -45,35 +45,6 @@ */ #define INLINE inline -int -pixmanTransformPoint3d (pixman_transform_t *transform, - pixman_vector_t *vector) -{ - pixman_vector_t result; - int i, j; - pixman_fixed_32_32_t partial; - pixman_fixed_48_16_t v; - - for (j = 0; j < 3; j++) - { - v = 0; - for (i = 0; i < 3; i++) - { - partial = ((pixman_fixed_48_16_t) transform->matrix[j][i] * - (pixman_fixed_48_16_t) vector->vector[i]); - v += partial >> 16; - } - if (v > pixman_max_fixed_48_16 || v < pixman_min_fixed_48_16) - return FALSE; - result.vector[j] = (pixman_fixed_48_16_t) v; - } - if (!result.vector[2]) - return FALSE; - *vector = result; - return TRUE; -} - - #ifdef FB_ACCESS_WRAPPER #include "wfbrename.h" @@ -420,7 +391,7 @@ SourcePictureClassify (source_image_t *pict, if (pict->common.transform) { - if (!pixmanTransformPoint3d (pict->common.transform, &v)) + if (!pixman_transform_point_3d (pict->common.transform, &v)) return SOURCE_IMAGE_CLASS_UNKNOWN; } @@ -3399,7 +3370,7 @@ static void pixmanFetchSourcePict(source_image_t * pict, int x, int y, int width v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2; v.vector[2] = pixman_fixed_1; if (pict->common.transform) { - if (!pixmanTransformPoint3d (pict->common.transform, &v)) + if (!pixman_transform_point_3d (pict->common.transform, &v)) return; unit.vector[0] = pict->common.transform->matrix[0][0]; unit.vector[1] = pict->common.transform->matrix[1][0]; @@ -3637,7 +3608,7 @@ static void pixmanFetchSourcePict(source_image_t * pict, int x, int y, int width v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1/2; v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2; v.vector[2] = pixman_fixed_1; - if (!pixmanTransformPoint3d (pict->common.transform, &v)) + if (!pixman_transform_point_3d (pict->common.transform, &v)) return; cx = pict->common.transform->matrix[0][0]/65536.; @@ -3816,7 +3787,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin /* when using convolution filters one might get here without a transform */ if (pict->common.transform) { - if (!pixmanTransformPoint3d (pict->common.transform, &v)) + if (!pixman_transform_point_3d (pict->common.transform, &v)) { fbFinishAccess (pict->pDrawable); return; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 8eedec0..5cdd2a6 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -203,15 +203,9 @@ union pixman_image solid_fill_t solid; }; -int pixmanTransformPoint3d (pixman_transform_t *trans, - pixman_vector_t *vector); void pixmanCompositeRect (const FbComposeData *data, uint32_t *scanline_buffer); - - - - #if 0 typedef struct _Picture { DrawablePtr pDrawable; diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c new file mode 100644 index 0000000..d3b7f4a --- /dev/null +++ b/pixman/pixman-utils.c @@ -0,0 +1,57 @@ +/* + * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * 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. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "pixman.h" +#include "pixman-private.h" + +pixman_bool_t +pixman_transform_point_3d (pixman_transform_t *transform, + pixman_vector_t *vector) +{ + pixman_vector_t result; + int i, j; + pixman_fixed_32_32_t partial; + pixman_fixed_48_16_t v; + + for (j = 0; j < 3; j++) + { + v = 0; + for (i = 0; i < 3; i++) + { + partial = ((pixman_fixed_48_16_t) transform->matrix[j][i] * + (pixman_fixed_48_16_t) vector->vector[i]); + v += partial >> 16; + } + + if (v > pixman_max_fixed_48_16 || v < pixman_min_fixed_48_16) + return FALSE; + + result.vector[j] = (pixman_fixed_48_16_t) v; + } + + if (!result.vector[2]) + return FALSE; + + *vector = result; + return TRUE; +} diff --git a/pixman/pixman.h b/pixman/pixman.h index 99f7905..e32a3dc 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -165,6 +165,9 @@ struct pixman_transform pixman_fixed_t matrix[3][3]; }; +pixman_bool_t pixman_transform_point_3d (pixman_transform_t *transform, + pixman_vector_t *vector); + /* Don't blame me, blame XRender */ typedef enum { -- 2.7.4