From 50289aace6a8699c08593a8cb93bf8dfc30ed818 Mon Sep 17 00:00:00 2001 From: Soren Sandmann Pedersen Date: Tue, 8 May 2007 10:32:54 -0400 Subject: [PATCH] Implement pixman_image_composite() in terms of fbCompositeRect(). --- pixman/pixman-compose.c | 15 -------------- pixman/pixman-image.c | 55 ++++++++++++++++++++++++++++++------------------- pixman/pixman-private.h | 46 +++++++++++++++++++++++++++-------------- 3 files changed, 64 insertions(+), 52 deletions(-) diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c index 68f5865..9de1c92 100644 --- a/pixman/pixman-compose.c +++ b/pixman/pixman-compose.c @@ -344,21 +344,6 @@ int PictureTransformPoint3d (pixman_transform_t *trans, pixman_vector_t *vector) #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) -typedef struct _FbComposeData { - uint8_t op; - image_t *src; - image_t *mask; - image_t *dest; - int16_t xSrc; - int16_t ySrc; - int16_t xMask; - int16_t yMask; - int16_t xDest; - int16_t yDest; - uint16_t width; - uint16_t height; -} FbComposeData; - /* End of stuff added to get it to compile */ diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index ceed94a..3197efb 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -247,36 +247,49 @@ pixman_image_set_clip_region (pixman_image_t *image, } -#define SCANLINE_BUFFER_LENGTH 1024 - +#define SCANLINE_BUFFER_LENGTH 2048 + void -pixman_composite (pixman_image_t *src_img, - pixman_image_t *mask_img, - pixman_image_t *dest_img, - int src_x, - int src_y, - int mask_x, - int mask_y, - int dest_x, - int dset_y, - int width, - int height) +pixman_image_composite (pixman_op_t op, + pixman_image_t *src_img, + pixman_image_t *mask_img, + pixman_image_t *dest_img, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dest_x, + int dest_y, + int width, + int height) { - image_t *src = (image_t *) src; - image_t *mask = (image_t *) mask; - image_t *dest = (image_t *) dest; - + FbComposeData compose_data; uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3]; uint32_t *scanline_buffer = _scanline_buffer; if (width > SCANLINE_BUFFER_LENGTH) + { scanline_buffer = (uint32_t *)malloc (width * 3 * sizeof (uint32_t)); - if (!scanline_buffer) - return; - - + if (!scanline_buffer) + return; + } + compose_data.op = op; + compose_data.src = (image_t *)src_img; + compose_data.mask = (image_t *)mask_img; + compose_data.dest = (image_t *)dest_img; + compose_data.xSrc = src_x; + compose_data.ySrc = src_y; + compose_data.xMask = mask_x; + compose_data.yMask = mask_y; + compose_data.xDest = dest_x; + compose_data.yDest = dest_y; + compose_data.width = width; + compose_data.height = height; + + fbCompositeRect (&compose_data, scanline_buffer); + if (scanline_buffer != _scanline_buffer) free (scanline_buffer); } diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 74a95c7..fa6fd79 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -8,6 +8,21 @@ #define TRUE 1 #endif +typedef union image image_t; +typedef struct image_common image_common_t; +typedef struct source_image source_image_t; +typedef struct solid_fill solid_fill_t; +typedef struct gradient gradient_t; +typedef struct linear_gradient linear_gradient_t; +typedef struct horizontal_gradient horizontal_gradient_t; +typedef struct vertical_gradient vertical_gradient_t; +typedef struct conical_gradient conical_gradient_t; +typedef struct radial_gradient radial_gradient_t; +typedef struct bits_image bits_image_t; +typedef struct gradient_stop gradient_stop_t; +typedef struct circle circle_t; +typedef struct point point_t; + /* FIXME - the types and structures below should be give proper names */ @@ -22,28 +37,26 @@ typedef struct _FbComposeFunctions { CombineMaskU combineMaskU; } FbComposeFunctions; +typedef struct _FbComposeData { + uint8_t op; + image_t *src; + image_t *mask; + image_t *dest; + int16_t xSrc; + int16_t ySrc; + int16_t xMask; + int16_t yMask; + int16_t xDest; + int16_t yDest; + uint16_t width; + uint16_t height; +} FbComposeData; #define fbGetDrawable /* end */ - -typedef union image image_t; -typedef struct image_common image_common_t; -typedef struct source_image source_image_t; -typedef struct solid_fill solid_fill_t; -typedef struct gradient gradient_t; -typedef struct linear_gradient linear_gradient_t; -typedef struct horizontal_gradient horizontal_gradient_t; -typedef struct vertical_gradient vertical_gradient_t; -typedef struct conical_gradient conical_gradient_t; -typedef struct radial_gradient radial_gradient_t; -typedef struct bits_image bits_image_t; -typedef struct gradient_stop gradient_stop_t; -typedef struct circle circle_t; -typedef struct point point_t; - typedef enum { BITS, @@ -164,6 +177,7 @@ union image solid_fill_t solid; }; +void fbCompositeRect (const FbComposeData *data, uint32_t *scanline_buffer); -- 2.7.4