Revert "Fix clipping when windows are used as sources"
This reverts commit e9aa61e9f0
.
Conflicts:
fb/fbpict.c
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Soeren Sandmann <sandmann@daimi.au.dk>
This commit is contained in:
parent
071b3c1810
commit
6133505297
3
fb/fb.h
3
fb/fb.h
|
@ -2080,8 +2080,7 @@ fbFillRegionSolid (DrawablePtr pDrawable,
|
||||||
|
|
||||||
extern _X_EXPORT pixman_image_t *
|
extern _X_EXPORT pixman_image_t *
|
||||||
image_from_pict (PicturePtr pict,
|
image_from_pict (PicturePtr pict,
|
||||||
Bool has_clip,
|
Bool has_clip);
|
||||||
Bool is_src);
|
|
||||||
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
|
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
|
||||||
|
|
||||||
#endif /* _FB_H_ */
|
#endif /* _FB_H_ */
|
||||||
|
|
117
fb/fbpict.c
117
fb/fbpict.c
|
@ -163,9 +163,9 @@ fbComposite (CARD8 op,
|
||||||
if (pMask)
|
if (pMask)
|
||||||
miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
|
miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
|
||||||
|
|
||||||
src = image_from_pict (pSrc, TRUE, TRUE);
|
src = image_from_pict (pSrc, TRUE);
|
||||||
mask = image_from_pict (pMask, TRUE, TRUE);
|
mask = image_from_pict (pMask, TRUE);
|
||||||
dest = image_from_pict (pDst, TRUE, FALSE);
|
dest = image_from_pict (pDst, TRUE);
|
||||||
|
|
||||||
if (src && dest && !(pMask && !mask))
|
if (src && dest && !(pMask && !mask))
|
||||||
{
|
{
|
||||||
|
@ -268,79 +268,24 @@ create_conical_gradient_image (PictGradient *gradient)
|
||||||
gradient->nstops);
|
gradient->nstops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DrawablePtr
|
|
||||||
copy_drawable (DrawablePtr pDraw)
|
|
||||||
{
|
|
||||||
ScreenPtr pScreen = pDraw->pScreen;
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
GCPtr pGC;
|
|
||||||
int width, height;
|
|
||||||
ChangeGCVal gcv[1];
|
|
||||||
|
|
||||||
width = pDraw->width;
|
|
||||||
height = pDraw->height;
|
|
||||||
|
|
||||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pDraw->depth, 0);
|
|
||||||
|
|
||||||
if (!pPixmap)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
pGC = GetScratchGC (pDraw->depth, pScreen);
|
|
||||||
|
|
||||||
if (!pGC)
|
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First fill the pixmap with zeros */
|
|
||||||
gcv[0].val = 0x00000000;
|
|
||||||
dixChangeGC (NullClient, pGC, GCBackground, NULL, gcv);
|
|
||||||
ValidateGC ((DrawablePtr)pPixmap, pGC);
|
|
||||||
miClearDrawable ((DrawablePtr)pPixmap, pGC);
|
|
||||||
|
|
||||||
/* Then copy the window there */
|
|
||||||
ValidateGC(&pPixmap->drawable, pGC);
|
|
||||||
(* pGC->ops->CopyArea) (pDraw, &pPixmap->drawable, pGC, 0, 0, width, height, 0, 0);
|
|
||||||
|
|
||||||
FreeScratchGC (pGC);
|
|
||||||
|
|
||||||
return &pPixmap->drawable;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_drawable (pixman_image_t *image, void *data)
|
|
||||||
{
|
|
||||||
DrawablePtr pDrawable = data;
|
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
|
||||||
|
|
||||||
pScreen->DestroyPixmap ((PixmapPtr)pDrawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
static pixman_image_t *
|
static pixman_image_t *
|
||||||
create_bits_picture (PicturePtr pict,
|
create_bits_picture (PicturePtr pict,
|
||||||
Bool has_clip,
|
Bool has_clip)
|
||||||
Bool is_src)
|
|
||||||
{
|
{
|
||||||
FbBits *bits;
|
FbBits *bits;
|
||||||
FbStride stride;
|
FbStride stride;
|
||||||
int bpp, xoff, yoff;
|
int bpp, xoff, yoff;
|
||||||
pixman_image_t *image;
|
pixman_image_t *image;
|
||||||
DrawablePtr drawable;
|
|
||||||
|
|
||||||
if (is_src && pict->pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
drawable = copy_drawable (pict->pDrawable);
|
|
||||||
else
|
|
||||||
drawable = pict->pDrawable;
|
|
||||||
|
|
||||||
fbGetDrawable (drawable, bits, stride, bpp, xoff, yoff);
|
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||||
|
|
||||||
bits = (FbBits*)((CARD8*)bits +
|
bits = (FbBits*)((CARD8*)bits +
|
||||||
(drawable->y + yoff) * stride * sizeof(FbBits) +
|
(pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
|
||||||
(drawable->x + xoff) * (bpp / 8));
|
(pict->pDrawable->x + xoff) * (bpp / 8));
|
||||||
|
|
||||||
image = pixman_image_create_bits (
|
image = pixman_image_create_bits (
|
||||||
pict->format, drawable->width, drawable->height,
|
pict->format,
|
||||||
|
pict->pDrawable->width, pict->pDrawable->height,
|
||||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,46 +303,25 @@ create_bits_picture (PicturePtr pict,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* pCompositeClip is undefined for source pictures, so
|
||||||
|
* only set the clip region for pictures with drawables
|
||||||
|
*/
|
||||||
if (has_clip)
|
if (has_clip)
|
||||||
{
|
{
|
||||||
if (is_src)
|
if (pict->clientClipType != CT_NONE)
|
||||||
{
|
pixman_image_set_has_client_clip (image, TRUE);
|
||||||
if (pict->clientClipType != CT_NONE)
|
|
||||||
{
|
|
||||||
pixman_image_set_has_client_clip (image, TRUE);
|
|
||||||
|
|
||||||
pixman_region_translate (pict->clientClip,
|
pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
|
||||||
pict->clipOrigin.x,
|
|
||||||
pict->clipOrigin.y);
|
|
||||||
|
|
||||||
pixman_image_set_clip_region (image, pict->clientClip);
|
|
||||||
|
|
||||||
pixman_region_translate (pict->clientClip,
|
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||||
- pict->clipOrigin.x,
|
|
||||||
- pict->clipOrigin.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pixman_region_translate (pict->pCompositeClip,
|
|
||||||
- pict->pDrawable->x,
|
|
||||||
- pict->pDrawable->y);
|
|
||||||
|
|
||||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
|
||||||
|
|
||||||
pixman_region_translate (pict->pCompositeClip,
|
|
||||||
pict->pDrawable->x,
|
|
||||||
pict->pDrawable->y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indexed table */
|
/* Indexed table */
|
||||||
if (pict->pFormat->index.devPrivate)
|
if (pict->pFormat->index.devPrivate)
|
||||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||||
|
|
||||||
if (drawable != pict->pDrawable)
|
|
||||||
pixman_image_set_destroy_function (image, destroy_drawable, drawable);
|
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +361,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||||
|
|
||||||
if (pict->alphaMap)
|
if (pict->alphaMap)
|
||||||
{
|
{
|
||||||
pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE, TRUE);
|
pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
|
||||||
|
|
||||||
pixman_image_set_alpha_map (
|
pixman_image_set_alpha_map (
|
||||||
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
||||||
|
@ -471,8 +395,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||||
|
|
||||||
pixman_image_t *
|
pixman_image_t *
|
||||||
image_from_pict (PicturePtr pict,
|
image_from_pict (PicturePtr pict,
|
||||||
Bool has_clip,
|
Bool has_clip)
|
||||||
Bool is_src)
|
|
||||||
{
|
{
|
||||||
pixman_image_t *image = NULL;
|
pixman_image_t *image = NULL;
|
||||||
|
|
||||||
|
@ -481,7 +404,7 @@ image_from_pict (PicturePtr pict,
|
||||||
|
|
||||||
if (pict->pDrawable)
|
if (pict->pDrawable)
|
||||||
{
|
{
|
||||||
image = create_bits_picture (pict, has_clip, is_src);
|
image = create_bits_picture (pict, has_clip);
|
||||||
}
|
}
|
||||||
else if (pict->pSourcePict)
|
else if (pict->pSourcePict)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ fbAddTraps (PicturePtr pPicture,
|
||||||
int ntrap,
|
int ntrap,
|
||||||
xTrap *traps)
|
xTrap *traps)
|
||||||
{
|
{
|
||||||
pixman_image_t *image = image_from_pict (pPicture, FALSE, FALSE);
|
pixman_image_t *image = image_from_pict (pPicture, FALSE);
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
|
@ -56,7 +56,7 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
|
||||||
int x_off,
|
int x_off,
|
||||||
int y_off)
|
int y_off)
|
||||||
{
|
{
|
||||||
pixman_image_t *image = image_from_pict (pPicture, FALSE, FALSE);
|
pixman_image_t *image = image_from_pict (pPicture, FALSE);
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue