From 62f3ef930adc7edd49b27dd1f7b0f51bc8bc0afa Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 9 Dec 2005 18:35:21 +0000 Subject: [PATCH] Bug #5258: Restore binary compatibility with 6.8.2's PictureRec. (Aaron Plattner) --- fb/fbcompose.c | 28 ++++++++++++++-------------- hw/dmx/dmxpict.c | 5 +++-- render/picture.c | 7 ++++++- render/picturestr.h | 5 +++-- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/fb/fbcompose.c b/fb/fbcompose.c index 31feea625..9c2ec4887 100644 --- a/fb/fbcompose.c +++ b/fb/fbcompose.c @@ -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; } while (buffer < end) { - *buffer++ = gradientPixel(pGradient, t, pict->repeat); + *buffer++ = gradientPixel(pGradient, t, pict->repeatType); t += inc; } } 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]; 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[1] += unit.vector[1]; 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); *buffer = gradientPixel(pGradient, (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), - pict->repeat); + pict->repeatType); ++buffer; rx += cx; 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); *buffer = gradientPixel(pGradient, (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), - pict->repeat); + pict->repeatType); ++buffer; rx += cx; ry += cy; @@ -2823,7 +2823,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 * while (buffer < end) { double angle = atan2(ry, rx) + a; *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), - pict->repeat); + pict->repeatType); ++buffer; rx += cx; ry += cy; @@ -2842,7 +2842,7 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 * y -= pGradient->conical.center.y/65536.; angle = atan2(y, x) + a; *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), - pict->repeat); + pict->repeatType); ++buffer; rx += cx; ry += cy; @@ -2895,7 +2895,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 if (pict->filter == PictFilterNearest) { - if (pict->repeat == RepeatNormal) { + if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; 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) { - if (pict->repeat == RepeatNormal) { + if (pict->repeatType == RepeatNormal) { if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; 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; 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++) { 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)) { FbBits *b = bits + (ty + pict->pDrawable->y)*stride; CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed); @@ -3408,7 +3408,7 @@ fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) fetchSrc = fbFetchSourcePict; } else if (data->src->alphaMap) fetchSrc = fbFetchExternalAlpha; - else if (data->src->repeat == RepeatNormal && + else if (data->src->repeatType == RepeatNormal && data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) fetchSrc = fbFetchSolid; else if (!data->src->transform && data->src->filter != PictFilterConvolution) @@ -3422,7 +3422,7 @@ fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) fetchMask = fbFetchSourcePict; } else if (data->mask->alphaMap) fetchMask = fbFetchExternalAlpha; - else if (data->mask->repeat == RepeatNormal + else if (data->mask->repeatType == RepeatNormal && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) fetchMask = fbFetchSolid; else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) @@ -3532,11 +3532,11 @@ fbCompositeGeneral (CARD8 op, FbComposeData compose_data; if (pSrc->pDrawable) - srcRepeat = pSrc->repeat == RepeatNormal && !pSrc->transform + srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeat == RepeatNormal && !pMask->transform + maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c index fb19d864e..9a76a6696 100644 --- a/hw/dmx/dmxpict.c +++ b/hw/dmx/dmxpict.c @@ -960,8 +960,9 @@ void dmxValidatePicture(PicturePtr pPicture, Mask mask) if (pPictPriv->pict) { XRenderPictureAttributes attribs; - if (mask & CPRepeat) - attribs.repeat = pPicture->repeat; + if (mask & CPRepeat) { + attribs.repeat = pPicture->repeatType; + } if (mask & CPAlphaMap) { if (pPicture->alphaMap) { dmxPictPrivPtr pAlphaPriv; diff --git a/render/picture.c b/render/picture.c index a598f740b..3ed60310e 100644 --- a/render/picture.c +++ b/render/picture.c @@ -745,6 +745,7 @@ SetPictureToDefaults (PicturePtr pPicture) pPicture->freeCompClip = FALSE; pPicture->clientClipType = CT_NONE; pPicture->componentAlpha = FALSE; + pPicture->repeatType = RepeatNone; pPicture->alphaMap = 0; pPicture->alphaOrigin.x = 0; @@ -1174,7 +1175,10 @@ ChangePicture (PicturePtr pPicture, unsigned int newr; newr = NEXT_VAL(unsigned int); if (newr <= RepeatReflect) - pPicture->repeat = newr; + { + pPicture->repeat = (newr != RepeatNone); + pPicture->repeatType = newr; + } else { client->errorValue = newr; @@ -1501,6 +1505,7 @@ CopyPicture (PicturePtr pSrc, { case CPRepeat: pDst->repeat = pSrc->repeat; + pDst->repeatType = pSrc->repeatType; break; case CPAlphaMap: if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) diff --git a/render/picturestr.h b/render/picturestr.h index 58b840c6d..ab6785c33 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -134,7 +134,7 @@ typedef struct _Picture { CARD32 id; PicturePtr pNext; /* chain on same drawable */ - unsigned int repeat : 2; + unsigned int repeat : 1; unsigned int graphicsExposures : 1; unsigned int subWindowMode : 1; unsigned int polyEdge : 1; @@ -142,7 +142,8 @@ typedef struct _Picture { unsigned int freeCompClip : 1; unsigned int clientClipType : 2; unsigned int componentAlpha : 1; - unsigned int unused : 22; + unsigned int repeatType : 2; + unsigned int unused : 21; PicturePtr alphaMap; DDXPointRec alphaOrigin;