Bug #5258: Restore binary compatibility with 6.8.2's PictureRec. (Aaron

Plattner)
This commit is contained in:
Adam Jackson 2005-12-09 18:35:21 +00:00
parent b99dea9dcf
commit 62f3ef930a
4 changed files with 26 additions and 19 deletions

View File

@ -2724,7 +2724,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16; inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16;
} }
while (buffer < end) { while (buffer < end) {
*buffer++ = gradientPixel(pGradient, t, pict->repeat); *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
t += inc; t += inc;
} }
} else { } else {
@ -2739,7 +2739,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2]; y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
t = ((a*x + b*y) >> 16) + off; t = ((a*x + b*y) >> 16) + off;
} }
*buffer++ = gradientPixel(pGradient, t, pict->repeat); *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
v.vector[0] += unit.vector[0]; v.vector[0] += unit.vector[0];
v.vector[1] += unit.vector[1]; v.vector[1] += unit.vector[1];
v.vector[2] += unit.vector[2]; v.vector[2] += unit.vector[2];
@ -2784,7 +2784,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
double s = (-b + sqrt(det))/(2. * pGradient->radial.a); double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
*buffer = gradientPixel(pGradient, *buffer = gradientPixel(pGradient,
(xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
pict->repeat); pict->repeatType);
++buffer; ++buffer;
rx += cx; rx += cx;
ry += cy; ry += cy;
@ -2807,7 +2807,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
s = (-b + sqrt(det))/(2. * pGradient->radial.a); s = (-b + sqrt(det))/(2. * pGradient->radial.a);
*buffer = gradientPixel(pGradient, *buffer = gradientPixel(pGradient,
(xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
pict->repeat); pict->repeatType);
++buffer; ++buffer;
rx += cx; rx += cx;
ry += cy; ry += cy;
@ -2823,7 +2823,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
while (buffer < end) { while (buffer < end) {
double angle = atan2(ry, rx) + a; double angle = atan2(ry, rx) + a;
*buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
pict->repeat); pict->repeatType);
++buffer; ++buffer;
rx += cx; rx += cx;
ry += cy; ry += cy;
@ -2842,7 +2842,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
y -= pGradient->conical.center.y/65536.; y -= pGradient->conical.center.y/65536.;
angle = atan2(y, x) + a; angle = atan2(y, x) + a;
*buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
pict->repeat); pict->repeatType);
++buffer; ++buffer;
rx += cx; rx += cx;
ry += cy; ry += cy;
@ -2895,7 +2895,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
if (pict->filter == PictFilterNearest) if (pict->filter == PictFilterNearest)
{ {
if (pict->repeat == RepeatNormal) { if (pict->repeatType == RepeatNormal) {
if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
box = pict->pCompositeClip->extents; box = pict->pCompositeClip->extents;
for (i = 0; i < width; ++i) { for (i = 0; i < width; ++i) {
@ -2982,7 +2982,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
} }
} }
} else if (pict->filter == PictFilterBilinear) { } else if (pict->filter == PictFilterBilinear) {
if (pict->repeat == RepeatNormal) { if (pict->repeatType == RepeatNormal) {
if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
box = pict->pCompositeClip->extents; box = pict->pCompositeClip->extents;
for (i = 0; i < width; ++i) { for (i = 0; i < width; ++i) {
@ -3270,10 +3270,10 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
srtot = sgtot = sbtot = satot = 0; srtot = sgtot = sbtot = satot = 0;
for (y = y1; y < y2; y++) { for (y = y1; y < y2; y++) {
int ty = (pict->repeat == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; int ty = (pict->repeatType == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y;
for (x = x1; x < x2; x++) { for (x = x1; x < x2; x++) {
if (*p) { if (*p) {
int tx = (pict->repeat == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) { if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) {
FbBits *b = bits + (ty + pict->pDrawable->y)*stride; FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed); CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
@ -3408,7 +3408,7 @@ fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer)
fetchSrc = fbFetchSourcePict; fetchSrc = fbFetchSourcePict;
} else if (data->src->alphaMap) } else if (data->src->alphaMap)
fetchSrc = fbFetchExternalAlpha; fetchSrc = fbFetchExternalAlpha;
else if (data->src->repeat == RepeatNormal && else if (data->src->repeatType == RepeatNormal &&
data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1)
fetchSrc = fbFetchSolid; fetchSrc = fbFetchSolid;
else if (!data->src->transform && data->src->filter != PictFilterConvolution) else if (!data->src->transform && data->src->filter != PictFilterConvolution)
@ -3422,7 +3422,7 @@ fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer)
fetchMask = fbFetchSourcePict; fetchMask = fbFetchSourcePict;
} else if (data->mask->alphaMap) } else if (data->mask->alphaMap)
fetchMask = fbFetchExternalAlpha; fetchMask = fbFetchExternalAlpha;
else if (data->mask->repeat == RepeatNormal else if (data->mask->repeatType == RepeatNormal
&& data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1)
fetchMask = fbFetchSolid; fetchMask = fbFetchSolid;
else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) else if (!data->mask->transform && data->mask->filter != PictFilterConvolution)
@ -3532,11 +3532,11 @@ fbCompositeGeneral (CARD8 op,
FbComposeData compose_data; FbComposeData compose_data;
if (pSrc->pDrawable) if (pSrc->pDrawable)
srcRepeat = pSrc->repeat == RepeatNormal && !pSrc->transform srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform
&& (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1);
if (pMask && pMask->pDrawable) if (pMask && pMask->pDrawable)
maskRepeat = pMask->repeat == RepeatNormal && !pMask->transform maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform
&& (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1);
if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap)

View File

@ -960,8 +960,9 @@ void dmxValidatePicture(PicturePtr pPicture, Mask mask)
if (pPictPriv->pict) { if (pPictPriv->pict) {
XRenderPictureAttributes attribs; XRenderPictureAttributes attribs;
if (mask & CPRepeat) if (mask & CPRepeat) {
attribs.repeat = pPicture->repeat; attribs.repeat = pPicture->repeatType;
}
if (mask & CPAlphaMap) { if (mask & CPAlphaMap) {
if (pPicture->alphaMap) { if (pPicture->alphaMap) {
dmxPictPrivPtr pAlphaPriv; dmxPictPrivPtr pAlphaPriv;

View File

@ -745,6 +745,7 @@ SetPictureToDefaults (PicturePtr pPicture)
pPicture->freeCompClip = FALSE; pPicture->freeCompClip = FALSE;
pPicture->clientClipType = CT_NONE; pPicture->clientClipType = CT_NONE;
pPicture->componentAlpha = FALSE; pPicture->componentAlpha = FALSE;
pPicture->repeatType = RepeatNone;
pPicture->alphaMap = 0; pPicture->alphaMap = 0;
pPicture->alphaOrigin.x = 0; pPicture->alphaOrigin.x = 0;
@ -1174,7 +1175,10 @@ ChangePicture (PicturePtr pPicture,
unsigned int newr; unsigned int newr;
newr = NEXT_VAL(unsigned int); newr = NEXT_VAL(unsigned int);
if (newr <= RepeatReflect) if (newr <= RepeatReflect)
pPicture->repeat = newr; {
pPicture->repeat = (newr != RepeatNone);
pPicture->repeatType = newr;
}
else else
{ {
client->errorValue = newr; client->errorValue = newr;
@ -1501,6 +1505,7 @@ CopyPicture (PicturePtr pSrc,
{ {
case CPRepeat: case CPRepeat:
pDst->repeat = pSrc->repeat; pDst->repeat = pSrc->repeat;
pDst->repeatType = pSrc->repeatType;
break; break;
case CPAlphaMap: case CPAlphaMap:
if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)

View File

@ -134,7 +134,7 @@ typedef struct _Picture {
CARD32 id; CARD32 id;
PicturePtr pNext; /* chain on same drawable */ PicturePtr pNext; /* chain on same drawable */
unsigned int repeat : 2; unsigned int repeat : 1;
unsigned int graphicsExposures : 1; unsigned int graphicsExposures : 1;
unsigned int subWindowMode : 1; unsigned int subWindowMode : 1;
unsigned int polyEdge : 1; unsigned int polyEdge : 1;
@ -142,7 +142,8 @@ typedef struct _Picture {
unsigned int freeCompClip : 1; unsigned int freeCompClip : 1;
unsigned int clientClipType : 2; unsigned int clientClipType : 2;
unsigned int componentAlpha : 1; unsigned int componentAlpha : 1;
unsigned int unused : 22; unsigned int repeatType : 2;
unsigned int unused : 21;
PicturePtr alphaMap; PicturePtr alphaMap;
DDXPointRec alphaOrigin; DDXPointRec alphaOrigin;