From: Soren Sandmann Pedersen Date: Sat, 5 May 2007 03:45:19 +0000 (-0400) Subject: Add fixed point macros, add declarations for image init functions X-Git-Tag: pixman-0.9.4~138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2602792aa8d5d4a376beb9557f544b78735c210;p=platform%2Fupstream%2Fpixman.git Add fixed point macros, add declarations for image init functions --- diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index dca04cd..7a723fe 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -1,4 +1,6 @@ /* + * + * Copyright © 2000 SuSE, Inc. * Copyright © 2007 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -11,14 +13,12 @@ * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * 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: Soren Sandmann, Red Hat, Inc. */ #include @@ -26,31 +26,6 @@ #include "pixman.h" #include "pixman-private.h" -void -pixman_image_init_bits (pixman_image_t *image, - pixman_format_code_t format, - int width, - int height, - uint8_t *bits, - int rowstride) -{ - image_t *img = (image_t *)image; - - img->type = BITS; - img->bits.format = format; - img->bits.width = width; - img->bits.height = height; - img->bits.bits = bits; - img->bits.rowstride = rowstride; -} - -void -pixman_set_clip_region (pixman_image_t *image, - pixman_region16_t *region) -{ - -} - enum { PIXMAN_BAD_VALUE, @@ -68,7 +43,7 @@ init_gradient (gradient_t *gradient, int stop_count, pixman_fixed_t *stop_points, pixman_color_t *stop_colors, - int *error) + int *error) { int i; pixman_fixed_t dpos; @@ -222,6 +197,31 @@ pixman_image_init_conical_gradient (pixman_image_t *image, conical->angle = angle; } +void +pixman_image_init_bits (pixman_image_t *image, + pixman_format_code_t format, + int width, + int height, + uint8_t *bits, + int rowstride) +{ + image_t *img = (image_t *)image; + + img->type = BITS; + img->bits.format = format; + img->bits.width = width; + img->bits.height = height; + img->bits.bits = bits; + img->bits.rowstride = rowstride; +} + +void +pixman_image_set_clip_region (pixman_image_t *image, + pixman_region16_t *region) +{ + +} + #define SCANLINE_BUFFER_LENGTH 1024 void diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 695342c..e290e51 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -1,3 +1,13 @@ +#include "pixman.h" + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + typedef union image image_t; typedef struct source_image source_image_t; typedef struct solid_fill solid_fill_t; diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c index e7a2844..23a0397 100644 --- a/pixman/pixman-region.c +++ b/pixman/pixman-region.c @@ -48,6 +48,8 @@ SOFTWARE. #include #include #include + +#include "pixman-private.h" #include "pixman.h" struct pixman_region16_data { diff --git a/pixman/pixman.h b/pixman/pixman.h index 09f3625..78d9b4c 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -71,6 +71,9 @@ SOFTWARE. #include +/* + * Standard integers + */ #if HAVE_STDINT_H # include #elif HAVE_INTTYPES_H @@ -78,7 +81,6 @@ SOFTWARE. #elif HAVE_SYS_INT_TYPES_H # include #elif defined(_MSC_VER) - typedef __int8 int8_t; typedef unsigned __int8 uint8_t; typedef __int16 int16_t; @@ -87,25 +89,44 @@ typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; - #else # error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) #endif +/* + * Boolean + */ typedef int pixman_bool_t; -typedef uint32_t pixman_fixed_t; + +/* + * Fixpoint numbers + */ +typedef uint64_t pixman_fixed_32_32_t; +typedef pixman_fixed_32_32_t pixman_fixed_48_16_t; +typedef uint32_t pixman_fixed_1_31_t; +typedef uint32_t pixman_fixed_1_16_t; +typedef int32_t pixman_fixed_16_16_t; +typedef pixman_fixed_16_16_t pixman_fixed_t; + +#define pixman_fixed_e ((pixman_fixed) 1) +#define pixman_fixed_1 (pixman_int_to_fixed(1)) +#define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e) +#define pixman_fixed_to_int(f) ((int) ((f) >> 16)) +#define pixman_int_to_fixed(i) ((pixman_fixed) ((i) << 16)) +#define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1) +#define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e) +#define pixman_fixed_floor(f) ((f) & ~pixman_fixed_1_minus_e) +#define pixman_fixed_ceil(f) pixman_fixed_floor ((f) + pixman_fixed_1_minus_e) +#define pixman_fixed_fraction(f) ((f) & pixman_fixed_1_minus_e) +#define pixman_fixed_mod_2(f) ((f) & (pixman_fixed1 | pixman_fixed_1_minus_e)) + +/* + * Misc structs + */ typedef struct pixman_color pixman_color_t; typedef struct pixman_point_fixed pixman_point_fixed_t; typedef struct pixman_line_fixed pixman_line_fixed_t; -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - struct pixman_color { uint16_t red; @@ -278,17 +299,43 @@ typedef enum { typedef struct { /* All of this struct is considered private to libcomp */ - unsigned char reserved [64]; + unsigned char reserved [128]; } pixman_image_t; -void pixman_image_init (pixman_image_t *image, - pixman_format_code_t format, - int width, - int height, - uint8_t *bits, - int rowstride); /* in bytes */ -void pixman_set_clip_region (pixman_image_t *image, - pixman_region16_t *region); +void pixman_image_init_solid_fill (pixman_image_t *image, + pixman_color_t *color, + int *error); +void pixman_image_init_linear_gradient (pixman_image_t *image, + pixman_point_fixed_t *p1, + pixman_point_fixed_t *p2, + int n_stops, + pixman_fixed_t *stops, + pixman_color_t *colors, + int *error); +void pixman_image_init_radial_gradient (pixman_image_t *image, + pixman_point_fixed_t *inner, + pixman_point_fixed_t *outer, + pixman_fixed_t inner_radius, + pixman_fixed_t outer_radius, + int n_stops, + pixman_fixed_t *stops, + pixman_color_t *colors, + int *error); +void pixman_image_init_conical_gradient (pixman_image_t *image, + pixman_point_fixed_t *center, + pixman_fixed_t angle, + int n_stops, + pixman_fixed_t *stops, + pixman_color_t *colors, + int *error); +void pixman_image_init_bits (pixman_image_t *image, + pixman_format_code_t format, + int width, + int height, + uint8_t *bits, + int rowstride); +void pixman_image_set_clip_region (pixman_image_t *image, + pixman_region16_t *region); #endif /* PIXMAN_H__ */