#define BOUND(v) (int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
static inline pixman_bool_t
-miClipPictureReg (pixman_region16_t * pRegion,
- pixman_region16_t * pClip,
+miClipPictureReg (pixman_region32_t * pRegion,
+ pixman_region32_t * pClip,
int dx,
int dy)
{
- if (pixman_region_n_rects(pRegion) == 1 &&
- pixman_region_n_rects(pClip) == 1)
+ if (pixman_region32_n_rects(pRegion) == 1 &&
+ pixman_region32_n_rects(pClip) == 1)
{
- pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
- pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
+ pixman_box32_t * pRbox = pixman_region32_rectangles(pRegion, NULL);
+ pixman_box32_t * pCbox = pixman_region32_rectangles(pClip, NULL);
int v;
if (pRbox->x1 < (v = pCbox->x1 + dx))
if (pRbox->x1 >= pRbox->x2 ||
pRbox->y1 >= pRbox->y2)
{
- pixman_region_init (pRegion);
+ pixman_region32_init (pRegion);
}
}
- else if (!pixman_region_not_empty (pClip))
+ else if (!pixman_region32_not_empty (pClip))
return FALSE;
else
{
if (dx || dy)
- pixman_region_translate (pRegion, -dx, -dy);
- if (!pixman_region_intersect (pRegion, pRegion, pClip))
+ pixman_region32_translate (pRegion, -dx, -dy);
+ if (!pixman_region32_intersect (pRegion, pRegion, pClip))
return FALSE;
if (dx || dy)
- pixman_region_translate(pRegion, dx, dy);
+ pixman_region32_translate(pRegion, dx, dy);
}
- return pixman_region_not_empty(pRegion);
+ return pixman_region32_not_empty(pRegion);
}
static inline pixman_bool_t
-miClipPictureSrc (pixman_region16_t * pRegion,
+miClipPictureSrc (pixman_region32_t * pRegion,
pixman_image_t * pPicture,
int dx,
int dy)
*/
if (pPicture->common.has_client_clip)
{
- pixman_region_translate ( pRegion, dx, dy);
+ pixman_region32_translate ( pRegion, dx, dy);
- if (!pixman_region_intersect (pRegion, pRegion,
- (pixman_region16_t *) pPicture->common.src_clip))
+ if (!pixman_region32_intersect (pRegion, pRegion,
+ pPicture->common.src_clip))
return FALSE;
- pixman_region_translate ( pRegion, -dx, -dy);
+ pixman_region32_translate ( pRegion, -dx, -dy);
}
return TRUE;
* an allocation failure, but rendering ignores those anyways.
*/
-PIXMAN_EXPORT pixman_bool_t
-pixman_compute_composite_region (pixman_region16_t * pRegion,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- int16_t xSrc,
- int16_t ySrc,
- int16_t xMask,
- int16_t yMask,
- int16_t xDst,
- int16_t yDst,
- uint16_t width,
- uint16_t height)
+static pixman_bool_t
+pixman_compute_composite_region32 (pixman_region32_t * pRegion,
+ pixman_image_t * pSrc,
+ pixman_image_t * pMask,
+ pixman_image_t * pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height)
{
int v;
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
pRegion->extents.y1 >= pRegion->extents.y2)
{
- pixman_region_init (pRegion);
+ pixman_region32_init (pRegion);
return FALSE;
}
/* clip against dst */
if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pDst->common.alpha_map)
-pDst->common.alpha_origin.x,
-pDst->common.alpha_origin.y))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
/* clip against src */
if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pSrc->common.alpha_map)
xDst - (xSrc + pSrc->common.alpha_origin.x),
yDst - (ySrc + pSrc->common.alpha_origin.y)))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
{
if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pMask->common.alpha_map)
xDst - (xMask + pMask->common.alpha_origin.x),
yDst - (yMask + pMask->common.alpha_origin.y)))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
return TRUE;
}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_compute_composite_region (pixman_region16_t * pRegion,
+ pixman_image_t * pSrc,
+ pixman_image_t * pMask,
+ pixman_image_t * pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height)
+{
+ pixman_region32_t r32;
+ pixman_bool_t retval;
+
+ pixman_region32_init (&r32);
+
+ if (!pixman_region32_copy_from_region16 (&r32, pRegion))
+ return FALSE;
+
+ retval = pixman_compute_composite_region32 (&r32, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+
+ pixman_region32_fini (&r32);
+ return retval;
+}
{
image_common_t *common = &image->common;
- pixman_region_init (&common->full_region);
- pixman_region_init (&common->clip_region);
+ pixman_region32_init (&common->full_region);
+ pixman_region32_init (&common->clip_region);
common->src_clip = &common->full_region;
common->has_client_clip = FALSE;
common->transform = NULL;
if (common->ref_count == 0)
{
- pixman_region_fini (&common->clip_region);
- pixman_region_fini (&common->full_region);
+ pixman_region32_fini (&common->clip_region);
+ pixman_region32_fini (&common->full_region);
if (common->transform)
free (common->transform);
static void
reset_clip_region (pixman_image_t *image)
{
- pixman_region_fini (&image->common.clip_region);
+ pixman_region32_fini (&image->common.clip_region);
if (image->type == BITS)
{
- pixman_region_init_rect (&image->common.clip_region, 0, 0,
- image->bits.width, image->bits.height);
+ pixman_region32_init_rect (&image->common.clip_region, 0, 0,
+ image->bits.width, image->bits.height);
}
else
{
- pixman_region_init (&image->common.clip_region);
+ pixman_region32_init (&image->common.clip_region);
}
}
*/
image->bits.indexed = NULL;
- pixman_region_fini (&image->common.full_region);
- pixman_region_init_rect (&image->common.full_region, 0, 0,
- image->bits.width, image->bits.height);
+ pixman_region32_fini (&image->common.full_region);
+ pixman_region32_init_rect (&image->common.full_region, 0, 0,
+ image->bits.width, image->bits.height);
reset_clip_region (image);
return image;
if (region)
{
- return pixman_region_copy (&common->clip_region, region);
+ return pixman_region32_copy_from_region16 (&common->clip_region, region);
}
else
{
{
for (i = 0; i < n_rects; ++i)
{
- pixman_region16_t fill_region;
+ pixman_region32_t fill_region;
int n_boxes, j;
- pixman_box16_t *boxes;
+ pixman_box32_t *boxes;
- pixman_region_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
- pixman_region_intersect (&fill_region, &fill_region, &dest->common.clip_region);
+ pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
+ pixman_region32_intersect (&fill_region, &fill_region, &dest->common.clip_region);
- boxes = pixman_region_rectangles (&fill_region, &n_boxes);
+ boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
for (j = 0; j < n_boxes; ++j)
{
- const pixman_box16_t *box = &(boxes[j]);
+ const pixman_box32_t *box = &(boxes[j]);
pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
pixel);
}
- pixman_region_fini (&fill_region);
+ pixman_region32_fini (&fill_region);
}
return TRUE;
}
{
image_type_t type;
int32_t ref_count;
- pixman_region16_t full_region;
- pixman_region16_t clip_region;
- pixman_region16_t *src_clip;
+ pixman_region32_t full_region;
+ pixman_region32_t clip_region;
+ pixman_region32_t *src_clip;
pixman_bool_t has_client_clip;
pixman_transform_t *transform;
pixman_repeat_t repeat;
PIXMAN_EXPORT void
PREFIX(_init_rect) (region_type_t *region,
- int x, int y, unsigned int width, unsigned int height)
+ int x, int y, unsigned int width, unsigned int height)
{
region->extents.x1 = x;
region->extents.y1 = y;
return PIXREGION_NUM_RECTS (region);
}
-PIXMAN_EXPORT box_type_t *
-PREFIX(_rects) (region_type_t *region)
-{
- return PIXREGION_RECTS (region);
-}
-
PIXMAN_EXPORT box_type_t *
PREFIX(_rectangles) (region_type_t *region,
int *n_rects)
PIXMAN_EXPORT pixman_bool_t
PREFIX(_init_rects) (region_type_t *region,
- box_type_t *boxes, int count)
+ box_type_t *boxes, int count)
{
int overlap;
/*
* Fetch from region strategies
*/
-typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box);
+typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box);
static inline uint32_t
-fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
return fetch (pict, x, y);
}
static uint32_t
-fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
- pixman_box16_t box2;
- if (pixman_region_contains_point (pict->common.src_clip, x, y, &box2))
+ pixman_box32_t box2;
+ if (pixman_region32_contains_point (pict->common.src_clip, x, y, &box2))
return fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
else
return 0;
}
static uint32_t
-fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
- pixman_box16_t box2 = *box;
+ pixman_box32_t box2 = *box;
return ((x < box2.x1) | (x >= box2.x2) | (y < box2.y1) | (y >= box2.y2)) ?
0 : fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
}
static void
fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t* box = NULL;
+ pixman_box32_t* box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
static void
fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
static void
fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
{
box = &(pict->common.src_clip->extents);
fetchFromRegion = fbFetchFromOneRectangle;
static void
fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
static void
fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
static void
fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
{
box = &(pict->common.src_clip->extents);
fetchFromRegion = fbFetchFromOneRectangle;
static void
fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t dummy;
+ pixman_box32_t dummy;
fetchPixelProc32 fetch;
int i;
default:
tx = x;
}
- if (pixman_region_contains_point (pict->common.src_clip, tx, ty, &dummy)) {
+ if (pixman_region32_contains_point (pict->common.src_clip, tx, ty, &dummy)) {
uint32_t c = fetch(pict, tx, ty);
srtot += Red(c) * *p;
}
PIXMAN_EXPORT void
-pixman_add_trapezoids (pixman_image_t *image,
- int16_t x_off,
- int y_off,
- int ntraps,
- const pixman_trapezoid_t *traps)
+pixman_add_trapezoids (pixman_image_t *image,
+ int16_t x_off,
+ int y_off,
+ int ntraps,
+ const pixman_trapezoid_t *traps)
{
int i;
int y,
unsigned int width,
unsigned int height);
+pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
+ pixman_box16_t *boxes,
+ int count);
void pixman_region_init_with_extents (pixman_region16_t *region,
pixman_box16_t *extents);
void pixman_region_fini (pixman_region16_t *region);
pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
void pixman_region_reset (pixman_region16_t *region,
pixman_box16_t *box);
-pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
- pixman_box16_t *boxes,
- int count);
/*
* 32 bit regions
int y,
unsigned int width,
unsigned int height);
+pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
+ pixman_box32_t *boxes,
+ int count);
void pixman_region32_init_with_extents (pixman_region32_t *region,
pixman_box32_t *extents);
void pixman_region32_fini (pixman_region32_t *region);
pixman_bool_t pixman_region32_selfcheck (pixman_region32_t *region);
void pixman_region32_reset (pixman_region32_t *region,
pixman_box32_t *box);
-pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
- pixman_box32_t *boxes,
- int count);
/* Copy / Fill / Misc */