mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 06:08:02 +02:00
Make clip regions of pixman_image_t static
This commit is contained in:
parent
0413715337
commit
82cc451148
4 changed files with 99 additions and 81 deletions
|
|
@ -3374,8 +3374,8 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
if (pict->filter == PIXMAN_FILTER_NEAREST || pict->filter == PIXMAN_FILTER_FAST)
|
||||
{
|
||||
if (pict->repeat == RepeatNormal) {
|
||||
if (PIXREGION_NUM_RECTS(pict->pSourceClip) == 1) {
|
||||
box = pict->pSourceClip->extents;
|
||||
if (PIXREGION_NUM_RECTS(&pict->sourceClip) == 1) {
|
||||
box = pict->sourceClip.extents;
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
|
|
@ -3410,7 +3410,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
y = MOD(v.vector[1]>>16, pict->pDrawable->height);
|
||||
x = MOD(v.vector[0]>>16, pict->pDrawable->width);
|
||||
}
|
||||
if (pixman_region_contains_point (pict->pSourceClip, x, y, &box))
|
||||
if (pixman_region_contains_point (&pict->sourceClip, x, y, &box))
|
||||
buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
|
||||
else
|
||||
buffer[i] = 0;
|
||||
|
|
@ -3422,8 +3422,8 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (PIXREGION_NUM_RECTS(pict->pSourceClip) == 1) {
|
||||
box = pict->pSourceClip->extents;
|
||||
if (PIXREGION_NUM_RECTS(&pict->sourceClip) == 1) {
|
||||
box = pict->sourceClip.extents;
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
|
|
@ -3457,7 +3457,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
y = v.vector[1]>>16;
|
||||
x = v.vector[0]>>16;
|
||||
}
|
||||
if (pixman_region_contains_point (pict->pSourceClip, x, y, &box))
|
||||
if (pixman_region_contains_point (&pict->sourceClip, x, y, &box))
|
||||
buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
|
||||
else
|
||||
buffer[i] = 0;
|
||||
|
|
@ -3476,8 +3476,8 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
unit.vector[1] -= unit.vector[2]/2;
|
||||
|
||||
if (pict->repeat == RepeatNormal) {
|
||||
if (PIXREGION_NUM_RECTS(pict->pSourceClip) == 1) {
|
||||
box = pict->pSourceClip->extents;
|
||||
if (PIXREGION_NUM_RECTS(&pict->sourceClip) == 1) {
|
||||
box = pict->sourceClip.extents;
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
|
|
@ -3580,14 +3580,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
|
||||
b = bits + (y1 + pict->pDrawable->y)*stride;
|
||||
|
||||
tl = pixman_region_contains_point(pict->pSourceClip, x1, y1, &box)
|
||||
tl = pixman_region_contains_point(&pict->sourceClip, x1, y1, &box)
|
||||
? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
|
||||
tr = pixman_region_contains_point(pict->pSourceClip, x2, y1, &box)
|
||||
tr = pixman_region_contains_point(&pict->sourceClip, x2, y1, &box)
|
||||
? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
|
||||
b = bits + (y2 + pict->pDrawable->y)*stride;
|
||||
bl = pixman_region_contains_point(pict->pSourceClip, x1, y2, &box)
|
||||
bl = pixman_region_contains_point(&pict->sourceClip, x1, y2, &box)
|
||||
? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
|
||||
br = pixman_region_contains_point(pict->pSourceClip, x2, y2, &box)
|
||||
br = pixman_region_contains_point(&pict->sourceClip, x2, y2, &box)
|
||||
? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
|
||||
|
||||
ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
|
||||
|
|
@ -3611,8 +3611,8 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (PIXREGION_NUM_RECTS(pict->pSourceClip) == 1) {
|
||||
box = pict->pSourceClip->extents;
|
||||
if (PIXREGION_NUM_RECTS(&pict->sourceClip) == 1) {
|
||||
box = pict->sourceClip.extents;
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
|
|
@ -3713,14 +3713,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
b = bits + (y1 + pict->pDrawable->y)*stride;
|
||||
x_off = x1 + pict->pDrawable->x;
|
||||
|
||||
tl = pixman_region_contains_point(pict->pSourceClip, x1, y1, &box)
|
||||
tl = pixman_region_contains_point(&pict->sourceClip, x1, y1, &box)
|
||||
? fetch(b, x_off, indexed) : 0;
|
||||
tr = pixman_region_contains_point(pict->pSourceClip, x2, y1, &box)
|
||||
tr = pixman_region_contains_point(&pict->sourceClip, x2, y1, &box)
|
||||
? fetch(b, x_off + 1, indexed) : 0;
|
||||
b += stride;
|
||||
bl = pixman_region_contains_point(pict->pSourceClip, x1, y2, &box)
|
||||
bl = pixman_region_contains_point(&pict->sourceClip, x1, y2, &box)
|
||||
? fetch(b, x_off, indexed) : 0;
|
||||
br = pixman_region_contains_point(pict->pSourceClip, x2, y2, &box)
|
||||
br = pixman_region_contains_point(&pict->sourceClip, x2, y2, &box)
|
||||
? fetch(b, x_off + 1, indexed) : 0;
|
||||
|
||||
ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
|
||||
|
|
@ -3782,7 +3782,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
|
|||
for (x = x1; x < x2; x++) {
|
||||
if (*p) {
|
||||
int tx = (pict->repeat == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
|
||||
if (pixman_region_contains_point (pict->pSourceClip, tx, ty, &box)) {
|
||||
if (pixman_region_contains_point (&pict->sourceClip, tx, ty, &box)) {
|
||||
FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
|
||||
CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
|
||||
|
||||
|
|
|
|||
|
|
@ -307,8 +307,8 @@ pixman_image_init (pixman_image_t *image)
|
|||
* In the server this was 0 because the composite clip list
|
||||
* can be referenced from a window (and often is)
|
||||
*/
|
||||
image->freeCompClip = 0;
|
||||
image->freeSourceClip = 0;
|
||||
image->hasCompositeClip = 0;
|
||||
image->hasSourceClip = 0;
|
||||
image->clientClipType = CT_NONE;
|
||||
image->componentAlpha = 0;
|
||||
image->compositeClipSource = 0;
|
||||
|
|
@ -328,24 +328,34 @@ pixman_image_init (pixman_image_t *image)
|
|||
image->serialNumber = GC_CHANGE_SERIAL_BIT;
|
||||
*/
|
||||
|
||||
if (image->pixels)
|
||||
{
|
||||
image->pCompositeClip = pixman_region_create();
|
||||
pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
|
||||
0, 0, image->pixels->width,
|
||||
image->pixels->height);
|
||||
image->freeCompClip = 1;
|
||||
if (image->pixels) {
|
||||
if (!image->hasCompositeClip) {
|
||||
pixman_region_init (&image->compositeClip, NULL);
|
||||
image->hasCompositeClip = 1;
|
||||
}
|
||||
|
||||
image->pSourceClip = pixman_region_create ();
|
||||
pixman_region_union_rect (image->pSourceClip, image->pSourceClip,
|
||||
pixman_region_union_rect (&image->compositeClip, &image->compositeClip,
|
||||
0, 0, image->pixels->width,
|
||||
image->pixels->height);
|
||||
image->freeSourceClip = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
image->pCompositeClip = NULL;
|
||||
image->pSourceClip = NULL;
|
||||
|
||||
if (!image->hasSourceClip) {
|
||||
pixman_region_init (&image->sourceClip, NULL);
|
||||
image->hasSourceClip = 1;
|
||||
}
|
||||
|
||||
pixman_region_union_rect (&image->sourceClip, &image->sourceClip,
|
||||
0, 0, image->pixels->width,
|
||||
image->pixels->height);
|
||||
} else {
|
||||
if (image->hasCompositeClip) {
|
||||
pixman_region_uninit (&image->compositeClip);
|
||||
image->hasCompositeClip = FALSE;
|
||||
}
|
||||
|
||||
if (image->hasSourceClip) {
|
||||
pixman_region_uninit (&image->sourceClip);
|
||||
image->hasSourceClip = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
image->transform = NULL;
|
||||
|
|
@ -473,14 +483,14 @@ pixman_image_destroy (pixman_image_t *image)
|
|||
{
|
||||
pixman_image_destroyClip (image);
|
||||
|
||||
if (image->freeCompClip) {
|
||||
pixman_region_destroy (image->pCompositeClip);
|
||||
image->pCompositeClip = NULL;
|
||||
if (image->hasCompositeClip) {
|
||||
pixman_region_uninit (&image->compositeClip);
|
||||
image->hasCompositeClip = 0;
|
||||
}
|
||||
|
||||
if (image->freeSourceClip) {
|
||||
pixman_region_destroy (image->pSourceClip);
|
||||
image->pSourceClip = NULL;
|
||||
if (image->hasSourceClip) {
|
||||
pixman_region_uninit (&image->sourceClip);
|
||||
image->hasSourceClip = 0;
|
||||
}
|
||||
|
||||
if (image->owns_pixels) {
|
||||
|
|
@ -533,20 +543,22 @@ pixman_image_set_clip_region (pixman_image_t *image,
|
|||
if (image->pSourcePict)
|
||||
return 0;
|
||||
|
||||
if (image->freeCompClip)
|
||||
pixman_region_destroy (image->pCompositeClip);
|
||||
image->pCompositeClip = pixman_region_create();
|
||||
pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
|
||||
if (image->hasCompositeClip)
|
||||
pixman_region_uninit (&image->compositeClip);
|
||||
|
||||
pixman_region_init (&image->compositeClip, NULL);
|
||||
pixman_region_union_rect (&image->compositeClip, &image->compositeClip,
|
||||
0, 0, image->pixels->width, image->pixels->height);
|
||||
image->freeCompClip = 1;
|
||||
image->hasCompositeClip = 1;
|
||||
|
||||
if (region) {
|
||||
pixman_region_translate (image->pCompositeClip,
|
||||
pixman_region_translate (&image->compositeClip,
|
||||
- image->clipOrigin.x,
|
||||
- image->clipOrigin.y);
|
||||
pixman_region_intersect (image->pCompositeClip,
|
||||
image->pCompositeClip,
|
||||
pixman_region_intersect (&image->compositeClip,
|
||||
&image->compositeClip,
|
||||
region);
|
||||
pixman_region_translate (image->pCompositeClip,
|
||||
pixman_region_translate (&image->compositeClip,
|
||||
image->clipOrigin.x,
|
||||
image->clipOrigin.y);
|
||||
}
|
||||
|
|
@ -601,13 +613,12 @@ FbClipImageSrc (pixman_region16_t *region,
|
|||
/* XXX what to do with clipping from transformed pictures? */
|
||||
if (image->transform)
|
||||
return 1;
|
||||
|
||||
/* XXX davidr hates this, wants to never use source-based clipping */
|
||||
if (image->repeat != PIXMAN_REPEAT_NONE || image->pSourcePict)
|
||||
{
|
||||
if (image->repeat != PIXMAN_REPEAT_NONE || image->pSourcePict) {
|
||||
/* XXX no source clipping */
|
||||
if (image->compositeClipSource &&
|
||||
image->clientClipType != CT_NONE)
|
||||
{
|
||||
image->clientClipType != CT_NONE) {
|
||||
pixman_region_translate (region,
|
||||
dx - image->clipOrigin.x,
|
||||
dy - image->clipOrigin.y);
|
||||
|
|
@ -616,21 +627,20 @@ FbClipImageSrc (pixman_region16_t *region,
|
|||
- (dx - image->clipOrigin.x),
|
||||
- (dy - image->clipOrigin.y));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixman_region16_t *clip;
|
||||
|
||||
if (image->compositeClipSource)
|
||||
clip = image->pCompositeClip;
|
||||
else
|
||||
clip = image->pSourceClip;
|
||||
return FbClipImageReg (region,
|
||||
clip,
|
||||
dx,
|
||||
dy);
|
||||
return 1;
|
||||
} else {
|
||||
pixman_region16_t *clip;
|
||||
|
||||
if (image->compositeClipSource) {
|
||||
clip = (image->hasCompositeClip ? &image->compositeClip : NULL);
|
||||
} else {
|
||||
clip = (image->hasSourceClip ? &image->sourceClip : NULL);
|
||||
}
|
||||
|
||||
return FbClipImageReg (region, clip, dx, dy);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -890,21 +900,26 @@ FbComputeCompositeRegion (pixman_region16_t *region,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!FbClipImageReg (region, iDst->pCompositeClip, 0, 0))
|
||||
{
|
||||
|
||||
if (!FbClipImageReg (region,
|
||||
iDst->hasCompositeClip ?
|
||||
&iDst->compositeClip : NULL,
|
||||
0, 0)) {
|
||||
pixman_region_destroy (region);
|
||||
return 0;
|
||||
}
|
||||
if (iDst->alphaMap)
|
||||
{
|
||||
if (!FbClipImageReg (region, iDst->alphaMap->pCompositeClip,
|
||||
|
||||
if (iDst->alphaMap) {
|
||||
if (!FbClipImageReg (region,
|
||||
iDst->hasCompositeClip ?
|
||||
&iDst->alphaMap->compositeClip : NULL,
|
||||
-iDst->alphaOrigin.x,
|
||||
-iDst->alphaOrigin.y))
|
||||
{
|
||||
-iDst->alphaOrigin.y)) {
|
||||
pixman_region_destroy (region);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ struct pixman_image {
|
|||
unsigned int subWindowMode : 1;
|
||||
unsigned int polyEdge : 1;
|
||||
unsigned int polyMode : 1;
|
||||
unsigned int freeCompClip : 1;
|
||||
unsigned int freeSourceClip : 1;
|
||||
unsigned int hasCompositeClip : 1;
|
||||
unsigned int hasSourceClip : 1;
|
||||
unsigned int clientClipType : 2;
|
||||
unsigned int componentAlpha : 1;
|
||||
unsigned int compositeClipSource : 1;
|
||||
|
|
@ -161,8 +161,8 @@ struct pixman_image {
|
|||
unsigned long stateChanges;
|
||||
unsigned long serialNumber;
|
||||
|
||||
pixman_region16_t *pCompositeClip;
|
||||
pixman_region16_t *pSourceClip;
|
||||
pixman_region16_t compositeClip;
|
||||
pixman_region16_t sourceClip;
|
||||
|
||||
pixman_transform_t *transform;
|
||||
|
||||
|
|
|
|||
|
|
@ -209,13 +209,16 @@ pixman_color_rects (pixman_image_t *dst,
|
|||
dst->pixels->x, dst->pixels->y,
|
||||
dst->pixels->width, dst->pixels->height);
|
||||
|
||||
pixman_region_intersect (&clip, &clip, clipPict->pCompositeClip);
|
||||
pixman_region_intersect (&clip, &clip, clipPict->hasCompositeClip ?
|
||||
&clipPict->compositeClip : NULL);
|
||||
if (clipPict->alphaMap)
|
||||
{
|
||||
pixman_region_translate (&clip,
|
||||
-clipPict->alphaOrigin.x,
|
||||
-clipPict->alphaOrigin.y);
|
||||
pixman_region_intersect (&clip, &clip, clipPict->alphaMap->pCompositeClip);
|
||||
pixman_region_intersect (&clip, &clip,
|
||||
clipPict->alphaMap->hasCompositeClip ?
|
||||
&clipPict->alphaMap->compositeClip : NULL);
|
||||
pixman_region_translate (&clip,
|
||||
clipPict->alphaOrigin.x,
|
||||
clipPict->alphaOrigin.y);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue