Don't pass regions to pixman_image_composite() anymore.
This commit is contained in:
parent
5cbec267b6
commit
54e023cec0
|
@ -626,7 +626,7 @@ XEXT_INC='-I$(top_srcdir)/Xext'
|
|||
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
|
||||
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
|
||||
|
||||
PIXMAN="[pixman >= 0.9.0]"
|
||||
PIXMAN="[pixman >= 0.9.1]"
|
||||
|
||||
dnl Core modules for most extensions, et al.
|
||||
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
|
||||
|
|
280
fb/fbpict.c
280
fb/fbpict.c
|
@ -38,122 +38,6 @@
|
|||
#include "fbpict.h"
|
||||
#include "fbmmx.h"
|
||||
|
||||
static pixman_image_t *
|
||||
create_solid_fill_image (PicturePtr pict)
|
||||
{
|
||||
PictSolidFill *solid = &pict->pSourcePict->solidFill;
|
||||
pixman_color_t color;
|
||||
CARD32 a, r, g, b;
|
||||
|
||||
a = (solid->color & 0xff000000) >> 24;
|
||||
r = (solid->color & 0x00ff0000) >> 16;
|
||||
g = (solid->color & 0x0000ff00) >> 8;
|
||||
b = (solid->color & 0x000000ff) >> 0;
|
||||
|
||||
color.alpha = (a << 8) | a;
|
||||
color.red = (r << 8) | r;
|
||||
color.green = (g << 8) | g;
|
||||
color.blue = (b << 8) | b;
|
||||
|
||||
return pixman_image_create_solid_fill (&color);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_linear_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictLinearGradient *linear = (PictLinearGradient *)gradient;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
|
||||
p1.x = linear->p1.x;
|
||||
p1.y = linear->p1.y;
|
||||
p2.x = linear->p2.x;
|
||||
p2.y = linear->p2.y;
|
||||
|
||||
return pixman_image_create_linear_gradient (
|
||||
&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_radial_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictRadialGradient *radial = (PictRadialGradient *)gradient;
|
||||
pixman_point_fixed_t c1;
|
||||
pixman_point_fixed_t c2;
|
||||
|
||||
c1.x = radial->c1.x;
|
||||
c1.y = radial->c1.y;
|
||||
c2.x = radial->c2.x;
|
||||
c2.y = radial->c2.y;
|
||||
|
||||
return pixman_image_create_radial_gradient (
|
||||
&c1, &c2, radial->c1.radius,
|
||||
radial->c2.radius,
|
||||
(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_conical_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictConicalGradient *conical = (PictConicalGradient *)gradient;
|
||||
pixman_point_fixed_t center;
|
||||
|
||||
center.x = conical->center.x;
|
||||
center.y = conical->center.y;
|
||||
|
||||
return pixman_image_create_conical_gradient (
|
||||
¢er, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
|
||||
gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_bits_picture (PicturePtr pict,
|
||||
Bool has_clip)
|
||||
{
|
||||
FbBits *bits;
|
||||
FbStride stride;
|
||||
int bpp, xoff, yoff;
|
||||
pixman_image_t *image;
|
||||
|
||||
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||
|
||||
bits += yoff * stride + xoff;
|
||||
|
||||
image = pixman_image_create_bits (
|
||||
pict->format,
|
||||
pict->pDrawable->width, pict->pDrawable->height,
|
||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||
|
||||
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
#if FB_SHIFT==5
|
||||
|
||||
pixman_image_set_accessors (image,
|
||||
(pixman_read_memory_func_t)wfbReadMemory,
|
||||
(pixman_write_memory_func_t)wfbWriteMemory);
|
||||
|
||||
#else
|
||||
|
||||
#error The pixman library only works when FbBits is 32 bits wide
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* pCompositeClip is undefined for source pictures, so
|
||||
* only set the clip region for pictures with drawables
|
||||
*/
|
||||
if (has_clip)
|
||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||
|
||||
/* Indexed table */
|
||||
if (pict->pFormat->index.devPrivate)
|
||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||
|
||||
fbFinishAccess (pict->pDrawable);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
|
||||
|
||||
void
|
||||
|
@ -274,7 +158,6 @@ fbComposite (CARD8 op,
|
|||
CARD16 width,
|
||||
CARD16 height)
|
||||
{
|
||||
pixman_region16_t region;
|
||||
pixman_image_t *src, *mask, *dest;
|
||||
|
||||
xDst += pDst->pDrawable->x;
|
||||
|
@ -290,10 +173,10 @@ fbComposite (CARD8 op,
|
|||
yMask += pMask->pDrawable->y;
|
||||
}
|
||||
|
||||
if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc,
|
||||
xMask, yMask, xDst, yDst, width, height))
|
||||
return;
|
||||
|
||||
miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
|
||||
if (pMask)
|
||||
miCompositeSourceValidate (pMask, xMask, yMask, width, height);
|
||||
|
||||
src = image_from_pict (pSrc, TRUE);
|
||||
mask = image_from_pict (pMask, TRUE);
|
||||
dest = image_from_pict (pDst, TRUE);
|
||||
|
@ -302,11 +185,10 @@ fbComposite (CARD8 op,
|
|||
{
|
||||
pixman_image_composite (op, src, mask, dest,
|
||||
xSrc, ySrc, xMask, yMask, xDst, yDst,
|
||||
width, height, ®ion);
|
||||
width, height);
|
||||
|
||||
}
|
||||
|
||||
pixman_region_fini (®ion);
|
||||
|
||||
if (src)
|
||||
pixman_image_unref (src);
|
||||
if (mask)
|
||||
|
@ -336,27 +218,125 @@ fbCompositeGeneral (CARD8 op,
|
|||
|
||||
#endif /* RENDER */
|
||||
|
||||
Bool
|
||||
fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
static pixman_image_t *
|
||||
create_solid_fill_image (PicturePtr pict)
|
||||
{
|
||||
PictSolidFill *solid = &pict->pSourcePict->solidFill;
|
||||
pixman_color_t color;
|
||||
CARD32 a, r, g, b;
|
||||
|
||||
a = (solid->color & 0xff000000) >> 24;
|
||||
r = (solid->color & 0x00ff0000) >> 16;
|
||||
g = (solid->color & 0x0000ff00) >> 8;
|
||||
b = (solid->color & 0x000000ff) >> 0;
|
||||
|
||||
color.alpha = (a << 8) | a;
|
||||
color.red = (r << 8) | r;
|
||||
color.green = (g << 8) | g;
|
||||
color.blue = (b << 8) | b;
|
||||
|
||||
return pixman_image_create_solid_fill (&color);
|
||||
}
|
||||
|
||||
#ifdef RENDER
|
||||
static pixman_image_t *
|
||||
create_linear_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictLinearGradient *linear = (PictLinearGradient *)gradient;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
|
||||
p1.x = linear->p1.x;
|
||||
p1.y = linear->p1.y;
|
||||
p2.x = linear->p2.x;
|
||||
p2.y = linear->p2.y;
|
||||
|
||||
return pixman_image_create_linear_gradient (
|
||||
&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
PictureScreenPtr ps;
|
||||
static pixman_image_t *
|
||||
create_radial_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictRadialGradient *radial = (PictRadialGradient *)gradient;
|
||||
pixman_point_fixed_t c1;
|
||||
pixman_point_fixed_t c2;
|
||||
|
||||
c1.x = radial->c1.x;
|
||||
c1.y = radial->c1.y;
|
||||
c2.x = radial->c2.x;
|
||||
c2.y = radial->c2.y;
|
||||
|
||||
return pixman_image_create_radial_gradient (
|
||||
&c1, &c2, radial->c1.radius,
|
||||
radial->c2.radius,
|
||||
(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
if (!miPictureInit (pScreen, formats, nformats))
|
||||
return FALSE;
|
||||
ps = GetPictureScreen(pScreen);
|
||||
ps->Composite = fbComposite;
|
||||
ps->Glyphs = miGlyphs;
|
||||
ps->CompositeRects = miCompositeRects;
|
||||
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
|
||||
ps->AddTraps = fbAddTraps;
|
||||
ps->AddTriangles = fbAddTriangles;
|
||||
static pixman_image_t *
|
||||
create_conical_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictConicalGradient *conical = (PictConicalGradient *)gradient;
|
||||
pixman_point_fixed_t center;
|
||||
|
||||
center.x = conical->center.x;
|
||||
center.y = conical->center.y;
|
||||
|
||||
return pixman_image_create_conical_gradient (
|
||||
¢er, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
|
||||
gradient->nstops);
|
||||
}
|
||||
|
||||
#endif /* RENDER */
|
||||
static pixman_image_t *
|
||||
create_bits_picture (PicturePtr pict,
|
||||
Bool has_clip)
|
||||
{
|
||||
FbBits *bits;
|
||||
FbStride stride;
|
||||
int bpp, xoff, yoff;
|
||||
pixman_image_t *image;
|
||||
|
||||
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||
|
||||
bits += yoff * stride + xoff;
|
||||
|
||||
image = pixman_image_create_bits (
|
||||
pict->format,
|
||||
pict->pDrawable->width, pict->pDrawable->height,
|
||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||
|
||||
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
#if FB_SHIFT==5
|
||||
|
||||
pixman_image_set_accessors (image,
|
||||
(pixman_read_memory_func_t)wfbReadMemory,
|
||||
(pixman_write_memory_func_t)wfbWriteMemory);
|
||||
|
||||
#else
|
||||
|
||||
#error The pixman library only works when FbBits is 32 bits wide
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* pCompositeClip is undefined for source pictures, so
|
||||
* only set the clip region for pictures with drawables
|
||||
*/
|
||||
if (has_clip)
|
||||
{
|
||||
if (pict->clientClipType != CT_NONE)
|
||||
pixman_image_set_has_client_clip (image, TRUE);
|
||||
|
||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||
}
|
||||
|
||||
/* Indexed table */
|
||||
if (pict->pFormat->index.devPrivate)
|
||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||
|
||||
fbFinishAccess (pict->pDrawable);
|
||||
|
||||
return TRUE;
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -428,7 +408,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
|
|||
|
||||
pixman_image_t *
|
||||
image_from_pict (PicturePtr pict,
|
||||
Bool has_clip)
|
||||
Bool has_clip)
|
||||
{
|
||||
pixman_image_t *image = NULL;
|
||||
|
||||
|
@ -466,8 +446,28 @@ image_from_pict (PicturePtr pict,
|
|||
return image;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
{
|
||||
|
||||
#ifdef RENDER
|
||||
|
||||
PictureScreenPtr ps;
|
||||
|
||||
if (!miPictureInit (pScreen, formats, nformats))
|
||||
return FALSE;
|
||||
ps = GetPictureScreen(pScreen);
|
||||
ps->Composite = fbComposite;
|
||||
ps->Glyphs = miGlyphs;
|
||||
ps->CompositeRects = miCompositeRects;
|
||||
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
|
||||
ps->AddTraps = fbAddTraps;
|
||||
ps->AddTriangles = fbAddTriangles;
|
||||
|
||||
#endif /* RENDER */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef USE_MMX
|
||||
/* The CPU detection code needs to be in a file not compiled with
|
||||
|
|
|
@ -266,19 +266,19 @@ miChangePictureFilter (PicturePtr pPicture,
|
|||
|
||||
#define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v))
|
||||
|
||||
static __inline Bool
|
||||
miClipPictureReg (RegionPtr pRegion,
|
||||
RegionPtr pClip,
|
||||
static inline pixman_bool_t
|
||||
miClipPictureReg (pixman_region16_t * pRegion,
|
||||
pixman_region16_t * pClip,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
if (REGION_NUM_RECTS(pRegion) == 1 &&
|
||||
REGION_NUM_RECTS(pClip) == 1)
|
||||
if (pixman_region_n_rects(pRegion) == 1 &&
|
||||
pixman_region_n_rects(pClip) == 1)
|
||||
{
|
||||
BoxPtr pRbox = REGION_RECTS(pRegion);
|
||||
BoxPtr pCbox = REGION_RECTS(pClip);
|
||||
pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
|
||||
pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
|
||||
int v;
|
||||
|
||||
|
||||
if (pRbox->x1 < (v = pCbox->x1 + dx))
|
||||
pRbox->x1 = BOUND(v);
|
||||
if (pRbox->x2 > (v = pCbox->x2 + dx))
|
||||
|
@ -290,23 +290,23 @@ miClipPictureReg (RegionPtr pRegion,
|
|||
if (pRbox->x1 >= pRbox->x2 ||
|
||||
pRbox->y1 >= pRbox->y2)
|
||||
{
|
||||
REGION_EMPTY(pScreen, pRegion);
|
||||
pixman_region_init (pRegion);
|
||||
}
|
||||
}
|
||||
else if (!REGION_NOTEMPTY (pScreen, pClip))
|
||||
else if (!pixman_region_not_empty (pClip))
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
if (dx || dy)
|
||||
REGION_TRANSLATE(pScreen, pRegion, -dx, -dy);
|
||||
if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip))
|
||||
pixman_region_translate (pRegion, -dx, -dy);
|
||||
if (!pixman_region_intersect (pRegion, pRegion, pClip))
|
||||
return FALSE;
|
||||
if (dx || dy)
|
||||
REGION_TRANSLATE(pScreen, pRegion, dx, dy);
|
||||
pixman_region_translate(pRegion, dx, dy);
|
||||
}
|
||||
return REGION_NOTEMPTY(pScreen, pRegion);
|
||||
return pixman_region_not_empty(pRegion);
|
||||
}
|
||||
|
||||
|
||||
static __inline Bool
|
||||
miClipPictureSrc (RegionPtr pRegion,
|
||||
PicturePtr pPicture,
|
||||
|
@ -320,13 +320,13 @@ miClipPictureSrc (RegionPtr pRegion,
|
|||
{
|
||||
if (pPicture->clientClipType != CT_NONE)
|
||||
{
|
||||
REGION_TRANSLATE(pScreen, pRegion,
|
||||
pixman_region_translate ( pRegion,
|
||||
dx - pPicture->clipOrigin.x,
|
||||
dy - pPicture->clipOrigin.y);
|
||||
if (!REGION_INTERSECT (pScreen, pRegion, pRegion,
|
||||
(RegionPtr) pPicture->clientClip))
|
||||
(RegionPtr) pPicture->pCompositeClip)) // clientClip))
|
||||
return FALSE;
|
||||
REGION_TRANSLATE(pScreen, pRegion,
|
||||
pixman_region_translate ( pRegion,
|
||||
- (dx - pPicture->clipOrigin.x),
|
||||
- (dy - pPicture->clipOrigin.y));
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ miClipPictureSrc (RegionPtr pRegion,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
miCompositeSourceValidate (PicturePtr pPicture,
|
||||
INT16 x,
|
||||
INT16 y,
|
||||
|
@ -417,6 +417,7 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
CARD16 width,
|
||||
CARD16 height)
|
||||
{
|
||||
|
||||
int v;
|
||||
|
||||
pRegion->extents.x1 = xDst;
|
||||
|
@ -430,13 +431,13 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
|
||||
pRegion->extents.y1 >= pRegion->extents.y2)
|
||||
{
|
||||
REGION_EMPTY (pDst->pDrawable->pScreen, pRegion);
|
||||
pixman_region_init (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
/* clip against dst */
|
||||
if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pDst->alphaMap)
|
||||
|
@ -445,14 +446,14 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
-pDst->alphaOrigin.x,
|
||||
-pDst->alphaOrigin.y))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* clip against src */
|
||||
if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pSrc->alphaMap)
|
||||
|
@ -461,7 +462,7 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
xDst - (xSrc + pSrc->alphaOrigin.x),
|
||||
yDst - (ySrc + pSrc->alphaOrigin.y)))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +471,7 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
{
|
||||
if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pMask->alphaMap)
|
||||
|
@ -479,14 +480,17 @@ miComputeCompositeRegion (RegionPtr pRegion,
|
|||
xDst - (xMask + pMask->alphaOrigin.x),
|
||||
yDst - (yMask + pMask->alphaOrigin.y)))
|
||||
{
|
||||
REGION_UNINIT (pScreen, pRegion);
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
|
||||
if (pMask)
|
||||
miCompositeSourceValidate (pMask, xMask, yMask, width, height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@ miClipPicture (RegionPtr pRegion,
|
|||
INT16 xPict,
|
||||
INT16 yPict);
|
||||
|
||||
void
|
||||
miCompositeSourceValidate (PicturePtr pPicture,
|
||||
INT16 x,
|
||||
INT16 y,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
Bool
|
||||
miComputeCompositeRegion (RegionPtr pRegion,
|
||||
PicturePtr pSrc,
|
||||
|
|
|
@ -661,6 +661,10 @@ AddTraps (PicturePtr pPicture,
|
|||
int ntraps,
|
||||
xTrap *traps);
|
||||
|
||||
pixman_image_t *
|
||||
PixmanImageFromPicture (PicturePtr pPict,
|
||||
Bool hasClip);
|
||||
|
||||
PicturePtr
|
||||
CreateSolidPicture (Picture pid,
|
||||
xRenderColor *color,
|
||||
|
|
Loading…
Reference in New Issue
Block a user