diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-08-05 18:24:58 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-08-05 18:24:58 +0000 |
commit | ae1580c494fde2b56f9faa40f7ebcf637728efc8 (patch) | |
tree | 0798058dcd39a70c33663f38f140eeafcb6c8ff6 /render | |
parent | 73e14bd611fa7eac649a2b4c7964959d9eae887b (diff) |
- Add a new Render function, CopyPicture, which will update a picture with
the flagged bits from a source picture. Approved in principle by
keithp.
- Use CopyPicture and SetTransform to update most of the backing picture's
state in the composite wrapper. Filters are still missing.
- Don't allocate a picture private, now that we calculate clipping properly
and don't need the serialNumber or stateChanges.
- Use the format of the source pixmap rather than generating the format
from the window's visual.
- Wrap the rest of the Render primitives that were stubbed out before.
Diffstat (limited to 'render')
-rw-r--r-- | render/picture.c | 79 | ||||
-rw-r--r-- | render/picturestr.h | 7 |
2 files changed, 85 insertions, 1 deletions
diff --git a/render/picture.c b/render/picture.c index 6ab0d943c..77593db52 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1180,6 +1180,85 @@ SetPictureTransform (PicturePtr pPicture, return Success; } +void +CopyPicture (PicturePtr pSrc, + Mask mask, + PicturePtr pDst) +{ + PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen); + + pDst->stateChanges |= mask; + + while (mask) { + Mask bit = lowbit(mask); + + switch (bit) + { + case CPRepeat: + pDst->repeat = pSrc->repeat; + break; + case CPAlphaMap: + if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) + pSrc->alphaMap->refcnt++; + if (pDst->alphaMap) + FreePicture ((pointer) pDst->alphaMap, (XID) 0); + pDst->alphaMap = pSrc->alphaMap; + break; + case CPAlphaXOrigin: + pDst->alphaOrigin.x = pSrc->alphaOrigin.y; + break; + case CPAlphaYOrigin: + pDst->alphaOrigin.y = pSrc->alphaOrigin.y; + break; + case CPClipXOrigin: + pDst->clipOrigin.x = pSrc->clipOrigin.y; + break; + case CPClipYOrigin: + pDst->clipOrigin.y = pSrc->clipOrigin.y; + break; + case CPClipMask: + switch (pSrc->clientClipType) { + case CT_NONE: + (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0); + break; + case CT_REGION: + if (!pSrc->clientClip) { + (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0); + } else { + RegionPtr clientClip; + RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip; + + clientClip = REGION_CREATE(pSrc->pDrawable->pScreen, + REGION_EXTENTS(pSrc->pDrawable->pScreen, srcClientClip), + REGION_NUM_RECTS(srcClientClip)); + (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0); + } + break; + default: + /* XXX: CT_PIXMAP unimplemented */ + break; + } + break; + case CPGraphicsExposure: + pDst->graphicsExposures = pSrc->graphicsExposures; + break; + case CPPolyEdge: + pDst->polyEdge = pSrc->polyEdge; + break; + case CPPolyMode: + pDst->polyMode = pSrc->polyMode; + break; + case CPDither: + pDst->dither = pSrc->dither; + break; + case CPComponentAlpha: + pDst->componentAlpha = pSrc->componentAlpha; + break; + } + mask &= ~bit; + } +} + static void ValidateOnePicture (PicturePtr pPicture) { diff --git a/render/picturestr.h b/render/picturestr.h index 23bab63dc..70881fc78 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -415,7 +415,12 @@ SetPictureClipRegion (PicturePtr pPicture, int SetPictureTransform (PicturePtr pPicture, PictTransform *transform); - + +void +CopyPicture (PicturePtr pSrc, + Mask mask, + PicturePtr pDst); + void ValidatePicture(PicturePtr pPicture); |