diff options
-rw-r--r-- | composite/compinit.c | 1 | ||||
-rw-r--r-- | miext/cw/cw.c | 198 | ||||
-rw-r--r-- | miext/cw/cw.h | 68 | ||||
-rw-r--r-- | miext/cw/cw_ops.c | 207 | ||||
-rw-r--r-- | miext/cw/cw_render.c | 10 |
5 files changed, 275 insertions, 209 deletions
diff --git a/composite/compinit.c b/composite/compinit.c index 5f899f60f..1f1208b86 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -26,6 +26,7 @@ #include <config.h> #endif #include "compint.h" +#include "cw.h" int CompScreenPrivateIndex; int CompWindowPrivateIndex; diff --git a/miext/cw/cw.c b/miext/cw/cw.c index 8394ca8a3..40a463fb4 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -99,14 +99,17 @@ static GCFuncs cwCheapGCFuncs = { cwCheapCopyClip, }; +/* Find the real drawable to draw to, and provide offsets that will translate + * window coordinates to backing pixmap coordinates. + */ DrawablePtr cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off) { if (cwDrawableIsRedirWindow(pDrawable)) { WindowPtr pWin = (WindowPtr)pDrawable; PixmapPtr pPixmap = (*pDrawable->pScreen->GetWindowPixmap)(pWin); - *x_off = -pPixmap->screen_x; - *y_off = -pPixmap->screen_y; + *x_off = pDrawable->x - pPixmap->screen_x; + *y_off = pDrawable->y - pPixmap->screen_y; return &pPixmap->drawable; } else { @@ -138,7 +141,6 @@ cwCreateGCPrivate(GCPtr pGC, DrawablePtr pDrawable) xfree(pPriv); return FALSE; } - pPriv->guarantee = GuaranteeNothing; pPriv->serialNumber = 0; pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; pPriv->wrapOps = pGC->ops; @@ -340,7 +342,7 @@ cwCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) * re-wrap on return. */ if (pDrawable->type == DRAWABLE_WINDOW && -cwDrawableIsRedirWindow(pDrawable) && + cwDrawableIsRedirWindow(pDrawable) && cwCreateGCPrivate(pGC, pDrawable)) { (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable); @@ -448,21 +450,21 @@ cwCreateGC(GCPtr pGC) } static void -cwGetImage(DrawablePtr pSrc, int sx, int sy, int w, int h, unsigned int format, +cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine) { ScreenPtr pScreen = pSrc->pScreen; DrawablePtr pBackingDrawable; - int x_off, y_off; + int src_off_x, src_off_y; SCREEN_PROLOGUE(pScreen, GetImage); - pBackingDrawable = cwGetBackingDrawable(pSrc, &x_off, &y_off); + pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y); - sx += x_off; - sy += y_off; + CW_OFFSET_XY_SRC(x, y); - (*pScreen->GetImage)(pBackingDrawable, sx, sy, w, h, format, planemask, pdstLine); + (*pScreen->GetImage)(pBackingDrawable, x, y, w, h, format, planemask, + pdstLine); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); } @@ -474,28 +476,172 @@ cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth, ScreenPtr pScreen = pSrc->pScreen; DrawablePtr pBackingDrawable; int i; - int x_off, y_off; - DDXPointPtr ppt_trans; + int src_off_x, src_off_y; SCREEN_PROLOGUE(pScreen, GetSpans); - pBackingDrawable = cwGetBackingDrawable(pSrc, &x_off, &y_off); + pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y); - ppt_trans = (DDXPointPtr)ALLOCATE_LOCAL(nspans * sizeof(DDXPointRec)); - if (ppt_trans) { - for (i = 0; i < nspans; i++) { - ppt_trans[i].x = ppt[i].x + x_off; - ppt_trans[i].y = ppt[i].y + y_off; - } + for (i = 0; i < nspans; i++) + CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y); - (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans, - pdstStart); - DEALLOCATE_LOCAL(ppt_trans); - } + (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans, + pdstStart); SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans); } +static void +cwFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, unsigned long pixel) +{ + ScreenPtr pScreen = pDrawable->pScreen; + GCPtr pGC; + BoxPtr pBox; + int nbox, i; + ChangeGCVal v[3]; + + pGC = GetScratchGC(pDrawable->depth, pScreen); + v[0].val = GXcopy; + v[1].val = pixel; + v[2].val = FillSolid; + DoChangeGC(pGC, (GCFunction | GCForeground | GCFillStyle), (XID*)v, 1); + ValidateGC(pDrawable, pGC); + + pBox = REGION_RECTS(pRegion); + nbox = REGION_NUM_RECTS(pRegion); + + for (i = 0; i < nbox; i++, pBox++) { + xRectangle rect; + rect.x = pBox->x1; + rect.y = pBox->y1; + rect.width = pBox->x2 - pBox->x1; + rect.height = pBox->y2 - pBox->y1; + (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &rect); + } + + FreeScratchGC(pGC); +} + +static void +cwFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile) +{ + ScreenPtr pScreen = pDrawable->pScreen; + GCPtr pGC; + BoxPtr pBox; + int nbox, i; + ChangeGCVal v[5]; + + pGC = GetScratchGC(pDrawable->depth, pScreen); + v[0].val = GXcopy; + v[1].val = FillSolid; + v[2].ptr = (pointer) pTile; + v[3].val = 0; + v[4].val = 0; + DoChangeGC(pGC, (GCFunction | GCFillStyle | GCTile | GCTileStipXOrigin | + GCTileStipYOrigin), + (XID*)v, 1); + + ValidateGC(pDrawable, pGC); + + pBox = REGION_RECTS(pRegion); + nbox = REGION_NUM_RECTS(pRegion); + + for (i = 0; i < nbox; i++, pBox++) { + xRectangle rect; + rect.x = pBox->x1; + rect.y = pBox->y1; + rect.width = pBox->x2 - pBox->x1; + rect.height = pBox->y2 - pBox->y1; + (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &rect); + } + + FreeScratchGC(pGC); +} + +static void +cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + int x_off, y_off; + + SCREEN_PROLOGUE(pScreen, PaintWindowBackground); + + if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { + (*pScreen->PaintWindowBackground)(pWin, pRegion, what); + } else { + DrawablePtr pBackingDrawable; + + pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off, + &y_off); + + /* The region is already in screen coordinates, so don't offset by the + * window's coordinates in screen space. + */ + x_off -= pWin->drawable.x; + y_off -= pWin->drawable.y; + + if (pWin->backgroundState == ParentRelative) { + do { + pWin = pWin->parent; + } while (pWin && pWin->backgroundState == ParentRelative); + } + + if (pWin && (pWin->backgroundState == BackgroundPixel || + pWin->backgroundState == BackgroundPixmap)) + { + REGION_TRANSLATE(pScreen, pRegion, x_off, y_off); + + if (pWin->backgroundState == BackgroundPixel) { + cwFillRegionSolid(pBackingDrawable, pRegion, + pWin->background.pixel); + } else { + cwFillRegionTiled(pBackingDrawable, pRegion, + pWin->background.pixmap); + } + + REGION_TRANSLATE(pScreen, pRegion, -x_off, -y_off); + } + } + + SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground); +} + +static void +cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + int x_off, y_off; + + SCREEN_PROLOGUE(pScreen, PaintWindowBorder); + + if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { + (*pScreen->PaintWindowBorder)(pWin, pRegion, what); + } else { + DrawablePtr pBackingDrawable; + + pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off, + &y_off); + + /* The region is already in screen coordinates, so don't offset by the + * window's coordinates in screen space. + */ + x_off -= pWin->drawable.x; + y_off -= pWin->drawable.y; + + REGION_TRANSLATE(pScreen, pRegion, x_off, y_off); + + if (pWin->borderIsPixel) { + cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel); + } else { + cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap); + } + + REGION_TRANSLATE(pScreen, pRegion, -x_off, -y_off); + } + + SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); +} + /* Screen initialization/teardown */ void miInitializeCompositeWrapper(ScreenPtr pScreen) @@ -523,11 +669,15 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) pScreenPriv->GetImage = pScreen->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreenPriv->CreateGC = pScreen->CreateGC; + pScreenPriv->PaintWindowBackground = pScreen->PaintWindowBackground; + pScreenPriv->PaintWindowBorder = pScreen->PaintWindowBorder; pScreen->CloseScreen = cwCloseScreen; pScreen->GetImage = cwGetImage; pScreen->GetSpans = cwGetSpans; pScreen->CreateGC = cwCreateGC; + pScreen->PaintWindowBackground = cwPaintWindowBackground; + pScreen->PaintWindowBorder = cwPaintWindowBorder; pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv; @@ -556,6 +706,8 @@ cwCloseScreen (int i, ScreenPtr pScreen) pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->CreateGC = pScreenPriv->CreateGC; + pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground; + pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder; #ifdef RENDER if (ps) { diff --git a/miext/cw/cw.h b/miext/cw/cw.h index 33e62f039..014cfd4bb 100644 --- a/miext/cw/cw.h +++ b/miext/cw/cw.h @@ -33,7 +33,6 @@ typedef struct { * set FALSE and the clientClip set to * clip output to the valid regions of the * backing pixmap. */ - int guarantee; /* GuaranteeNothing, etc. */ unsigned long serialNumber; /* clientClip computed time */ unsigned long stateChanges; /* changes in parent gc since last copy */ GCOps *wrapOps; /* wrapped ops */ @@ -48,34 +47,30 @@ extern int cwGCIndex; typedef struct { PicturePtr pBackingPicture; unsigned long serialNumber; /* clientClip computed time */ - unsigned long stateChanges; /* changes in parent gc since last copy */ + unsigned long stateChanges; /* changes in parent picture since last copy */ } cwPictureRec, *cwPicturePtr; extern int cwPictureIndex; #define getCwPicture(pPicture) ((cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr) -#define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p)) -#define cwDrawableIsRedirWindow(pDraw) ((pDraw)->type == DRAWABLE_WINDOW && \ - ((WindowPtr)(pDraw))->redirectDraw) +#define cwDrawableIsRedirWindow(pDraw) \ + ((pDraw)->type == DRAWABLE_WINDOW && \ + ((*(pDraw)->pScreen->GetWindowPixmap)((WindowPtr)(pDraw)) != \ + (*(pDraw)->pScreen->GetScreenPixmap)((pDraw)->pScreen))) typedef struct { /* * screen func wrappers */ - CloseScreenProcPtr CloseScreen; - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - CreateGCProcPtr CreateGC; - - DestroyWindowProcPtr DestroyWindow; + CloseScreenProcPtr CloseScreen; + GetImageProcPtr GetImage; + GetSpansProcPtr GetSpans; + CreateGCProcPtr CreateGC; - StoreColorsProcPtr StoreColors; + PaintWindowBackgroundProcPtr PaintWindowBackground; + PaintWindowBorderProcPtr PaintWindowBorder; - InitIndexedProcPtr InitIndexed; - CloseIndexedProcPtr CloseIndexed; - UpdateIndexedProcPtr UpdateIndexed; - #ifdef RENDER CreatePictureProcPtr CreatePicture; DestroyPictureProcPtr DestroyPicture; @@ -106,48 +101,39 @@ extern int cwScreenIndex; #define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr) #define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p)) -#define CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, npt) do { \ - short *_origpt = (short *)(ppt); \ - short *_transpt = (short *)(ppt_trans); \ +#define CW_OFFSET_XYPOINTS(ppt, npt) do { \ + DDXPointPtr _ppt = (DDXPointPtr)(ppt); \ int _i; \ for (_i = 0; _i < npt; _i++) { \ - *_transpt++ = *_origpt++ + dst_off_x; \ - *_transpt++ = *_origpt++ + dst_off_y; \ + _ppt[_i].x += dst_off_x; \ + _ppt[_i].y += dst_off_y; \ } \ } while (0) -#define CW_COPY_OFFSET_RECTS(prect_trans, prect, nrect) do { \ - short *_origpt = (short *)(prect); \ - short *_transpt = (short *)(prect_trans); \ +#define CW_OFFSET_RECTS(prect, nrect) do { \ int _i; \ for (_i = 0; _i < nrect; _i++) { \ - *_transpt++ = *_origpt++ + dst_off_x; \ - *_transpt++ = *_origpt++ + dst_off_y; \ - _transpt += 2; \ - _origpt += 2; \ + (prect)[_i].x += dst_off_x; \ + (prect)[_i].y += dst_off_y; \ } \ } while (0) -#define CW_COPY_OFFSET_ARCS(parc_trans, parc, narc) do { \ - short *_origpt = (short *)(parc); \ - short *_transpt = (short *)(parc_trans); \ +#define CW_OFFSET_ARCS(parc, narc) do { \ int _i; \ for (_i = 0; _i < narc; _i++) { \ - *_transpt++ = *_origpt++ + dst_off_x; \ - *_transpt++ = *_origpt++ + dst_off_y; \ - _transpt += 4; \ - _origpt += 4; \ + (parc)[_i].x += dst_off_x; \ + (parc)[_i].y += dst_off_y; \ } \ } while (0) -#define CW_COPY_OFFSET_XY_DST(bx, by, x, y) do { \ - bx = x + dst_off_x; \ - by = y + dst_off_y; \ +#define CW_OFFSET_XY_DST(x, y) do { \ + (x) = (x) + dst_off_x; \ + (y) = (y) + dst_off_y; \ } while (0) -#define CW_COPY_OFFSET_XY_SRC(bx, by, x, y) do { \ - bx = x + src_off_x; \ - by = y + src_off_y; \ +#define CW_OFFSET_XY_SRC(x, y) do { \ + (x) = (x) + src_off_x; \ + (y) = (y) + src_off_y; \ } while (0) /* cw.c */ diff --git a/miext/cw/cw_ops.c b/miext/cw/cw_ops.c index 879bfb04d..0b7626917 100644 --- a/miext/cw/cw_ops.c +++ b/miext/cw/cw_ops.c @@ -124,21 +124,14 @@ static void cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nspans, DDXPointPtr ppt, int *pwidth, int fSorted) { - DDXPointPtr ppt_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - ppt_trans = (DDXPointPtr)ALLOCATE_LOCAL(nspans * sizeof(DDXPointRec)); - if (ppt_trans) - { - CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, nspans); + CW_OFFSET_XYPOINTS(ppt, nspans); - (*pBackingGC->ops->FillSpans)(pBackingDst, pBackingGC, - nspans, ppt_trans, pwidth, fSorted); - - DEALLOCATE_LOCAL(ppt_trans); - } + (*pBackingGC->ops->FillSpans)(pBackingDst, pBackingGC, nspans, ppt, + pwidth, fSorted); EPILOGUE(pGC); } @@ -147,21 +140,14 @@ static void cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { - DDXPointPtr ppt_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - ppt_trans = (DDXPointPtr)ALLOCATE_LOCAL(nspans*sizeof(DDXPointRec)); - if (ppt_trans) - { - CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, nspans); - - (*pBackingGC->ops->SetSpans)(pBackingDst, pBackingGC, psrc, - ppt_trans, pwidth, nspans, fSorted); + CW_OFFSET_XYPOINTS(ppt, nspans); - DEALLOCATE_LOCAL(ppt_trans); - } + (*pBackingGC->ops->SetSpans)(pBackingDst, pBackingGC, psrc, ppt, pwidth, + nspans, fSorted); EPILOGUE(pGC); } @@ -170,16 +156,14 @@ static void cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits) { - int bx, by; - SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - (*pBackingGC->ops->PutImage)(pBackingDst, pBackingGC, depth, bx, by, - w, h, leftPad, format, pBits); + (*pBackingGC->ops->PutImage)(pBackingDst, pBackingGC, depth, x, y, w, h, + leftPad, format, pBits); EPILOGUE(pGC); } @@ -188,23 +172,24 @@ static RegionPtr cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { - int bsrcx, bsrcy, bdstx, bdsty; + int odstx, odsty; RegionPtr exposed = NULL; SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_SRC(pSrc, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bdstx, bdsty, dstx, dsty); - CW_COPY_OFFSET_XY_SRC(bsrcx, bsrcy, srcx, srcy); + odstx = dstx; + odsty = dsty; + CW_OFFSET_XY_DST(dstx, dsty); + CW_OFFSET_XY_SRC(srcx, srcy); exposed = (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst, - pBackingGC, bsrcx, bsrcy, w, h, - bdstx, bdsty); + pBackingGC, srcx, srcy, w, h, + dstx, dsty); - /* XXX: Simplify? */ if (exposed != NULL) - REGION_TRANSLATE(pDst->pScreen, exposed, dstx - bdstx, dsty - bdsty); + REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); @@ -215,22 +200,24 @@ static RegionPtr cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane) { - int bsrcx, bsrcy, bdstx, bdsty; + int odstx, odsty; RegionPtr exposed = NULL; SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_SRC(pSrc, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bdstx, bdsty, dstx, dsty); - CW_COPY_OFFSET_XY_SRC(bsrcx, bsrcy, srcx, srcy); + odstx = dstx; + odsty = dsty; + CW_OFFSET_XY_DST(dstx, dsty); + CW_OFFSET_XY_SRC(srcx, srcy); exposed = (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst, - pBackingGC, bsrcx, bsrcy, w, h, - bdstx, bdsty, plane); + pBackingGC, srcx, srcy, w, h, + dstx, dsty, plane); - /* XXX: Simplify? */ - REGION_TRANSLATE(pDst->pScreen, exposed, dstx - bdstx, dsty - bdsty); + if (exposed != NULL) + REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); @@ -240,21 +227,16 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, static void cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint *ppt) { - xPoint *ppt_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - ppt_trans = (xPoint *)ALLOCATE_LOCAL(npt * sizeof(xPoint)); - if (ppt_trans) - { - CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, npt); + if (mode == CoordModeOrigin) + CW_OFFSET_XYPOINTS(ppt, npt); + else + CW_OFFSET_XYPOINTS(ppt, 1); - (*pBackingGC->ops->PolyPoint)(pBackingDst, pBackingGC, mode, npt, - ppt_trans); - - DEALLOCATE_LOCAL(ppt_trans); - } + (*pBackingGC->ops->PolyPoint)(pBackingDst, pBackingGC, mode, npt, ppt); EPILOGUE(pGC); } @@ -262,21 +244,16 @@ cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint *ppt) static void cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { - DDXPointPtr ppt_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - ppt_trans = (DDXPointPtr)ALLOCATE_LOCAL(npt * sizeof(DDXPointRec)); - if (ppt_trans) - { - CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, npt); - - (*pBackingGC->ops->Polylines)(pBackingDst, pBackingGC, mode, npt, - ppt_trans); + if (mode == CoordModeOrigin) + CW_OFFSET_XYPOINTS(ppt, npt); + else + CW_OFFSET_XYPOINTS(ppt, 1); - DEALLOCATE_LOCAL(ppt_trans); - } + (*pBackingGC->ops->Polylines)(pBackingDst, pBackingGC, mode, npt, ppt); EPILOGUE(pGC); } @@ -284,21 +261,13 @@ cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) static void cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs) { - xSegment *psegs_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - psegs_trans = (xSegment *)ALLOCATE_LOCAL(nseg * sizeof(xSegment)); - if (psegs_trans) - { - CW_COPY_OFFSET_XYPOINTS(psegs_trans, pSegs, nseg * 2); - - (*pBackingGC->ops->PolySegment)(pBackingDst, pBackingGC, nseg, - psegs_trans); + CW_OFFSET_XYPOINTS(pSegs, nseg * 2); - DEALLOCATE_LOCAL(psegs_trans); - } + (*pBackingGC->ops->PolySegment)(pBackingDst, pBackingGC, nseg, pSegs); EPILOGUE(pGC); } @@ -306,21 +275,13 @@ cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs) static void cwPolyRectangle(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) { - xRectangle *prects_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - prects_trans = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); - if (prects_trans) - { - CW_COPY_OFFSET_RECTS(prects_trans, pRects, nrects); + CW_OFFSET_RECTS(pRects, nrects); - (*pBackingGC->ops->PolyRectangle)(pBackingDst, pBackingGC, nrects, - prects_trans); - - DEALLOCATE_LOCAL(pRectsCopy); - } + (*pBackingGC->ops->PolyRectangle)(pBackingDst, pBackingGC, nrects, pRects); EPILOGUE(pGC); } @@ -328,21 +289,13 @@ cwPolyRectangle(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) static void cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *pArcs) { - xArc *parcs_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - parcs_trans = (xArc *)ALLOCATE_LOCAL(narcs * sizeof(xArc)); - if (parcs_trans) - { - CW_COPY_OFFSET_RECTS(parcs_trans, pArcs, narcs); - - (*pBackingGC->ops->PolyArc)(pBackingDst, pBackingGC, narcs, - parcs_trans); + CW_OFFSET_RECTS(pArcs, narcs); - DEALLOCATE_LOCAL(parcs_trans); - } + (*pBackingGC->ops->PolyArc)(pBackingDst, pBackingGC, narcs, pArcs); EPILOGUE(pGC); } @@ -351,21 +304,17 @@ static void cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode, int npt, DDXPointPtr ppt) { - DDXPointPtr ppt_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - ppt_trans = (DDXPointPtr)ALLOCATE_LOCAL(npt * sizeof(DDXPointRec)); - if (ppt_trans) - { - CW_COPY_OFFSET_XYPOINTS(ppt_trans, ppt, npt); - - (*pBackingGC->ops->FillPolygon)(pBackingDst, pBackingGC, shape, mode, - npt, ppt_trans); + if (mode == CoordModeOrigin) + CW_OFFSET_XYPOINTS(ppt, npt); + else + CW_OFFSET_XYPOINTS(ppt, 1); - DEALLOCATE_LOCAL(ppt_trans); - } + (*pBackingGC->ops->FillPolygon)(pBackingDst, pBackingGC, shape, mode, npt, + ppt); EPILOGUE(pGC); } @@ -373,21 +322,13 @@ cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode, int npt, static void cwPolyFillRect(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) { - xRectangle *prects_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - prects_trans = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); - if (prects_trans) - { - CW_COPY_OFFSET_RECTS(prects_trans, pRects, nrects); + CW_OFFSET_RECTS(pRects, nrects); - (*pBackingGC->ops->PolyFillRect)(pBackingDst, pBackingGC, nrects, - prects_trans); - - DEALLOCATE_LOCAL(pRectsCopy); - } + (*pBackingGC->ops->PolyFillRect)(pBackingDst, pBackingGC, nrects, pRects); EPILOGUE(pGC); } @@ -395,21 +336,13 @@ cwPolyFillRect(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) static void cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs) { - xArc *parcs_trans; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - parcs_trans = (xArc *)ALLOCATE_LOCAL(narcs * sizeof(xArc)); - if (parcs_trans) - { - CW_COPY_OFFSET_RECTS(parcs_trans, parcs, narcs); - - (*pBackingGC->ops->PolyFillArc)(pBackingDst, pBackingGC, narcs, - parcs_trans); + CW_OFFSET_RECTS(parcs, narcs); - DEALLOCATE_LOCAL(parcs_trans); - } + (*pBackingGC->ops->PolyFillArc)(pBackingDst, pBackingGC, narcs, parcs); EPILOGUE(pGC); } @@ -418,17 +351,17 @@ static int cwPolyText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars) { int result; - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - result = (*pBackingGC->ops->PolyText8)(pBackingDst, pBackingGC, bx, by, + result = (*pBackingGC->ops->PolyText8)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); + return result; } @@ -437,14 +370,13 @@ cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars) { int result; - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - result = (*pBackingGC->ops->PolyText16)(pBackingDst, pBackingGC, bx, by, + result = (*pBackingGC->ops->PolyText16)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); @@ -454,14 +386,13 @@ cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, static void cwImageText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars) { - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - (*pBackingGC->ops->ImageText8)(pBackingDst, pBackingGC, bx, by, count, + (*pBackingGC->ops->ImageText8)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); @@ -471,14 +402,13 @@ static void cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars) { - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - (*pBackingGC->ops->ImageText16)(pBackingDst, pBackingGC, bx, by, count, + (*pBackingGC->ops->ImageText16)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); @@ -488,14 +418,13 @@ static void cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - (*pBackingGC->ops->ImageGlyphBlt)(pBackingDst, pBackingGC, bx, by, nglyph, + (*pBackingGC->ops->ImageGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph, ppci, pglyphBase); EPILOGUE(pGC); @@ -505,14 +434,13 @@ static void cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); - (*pBackingGC->ops->PolyGlyphBlt)(pBackingDst, pBackingGC, bx, by, nglyph, + (*pBackingGC->ops->PolyGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph, ppci, pglyphBase); EPILOGUE(pGC); @@ -522,15 +450,14 @@ static void cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y) { - int bx, by; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); - CW_COPY_OFFSET_XY_DST(bx, by, x, y); + CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDst, w, h, - bx, by); + x, y); EPILOGUE(pGC); } diff --git a/miext/cw/cw_render.c b/miext/cw/cw_render.c index 4f8bed8e4..7d28b7b34 100644 --- a/miext/cw/cw_render.c +++ b/miext/cw/cw_render.c @@ -123,8 +123,8 @@ cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off) WindowPtr pWin = (WindowPtr) pDrawable; PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); - *x_off = -pPixmap->screen_x; - *y_off = -pPixmap->screen_y; + *x_off = pPixmap->drawable.x - pPixmap->screen_x; + *y_off = pPixmap->drawable.y - pPixmap->screen_y; return pBackingPicture; } @@ -141,9 +141,9 @@ cwCreatePicture (PicturePtr pPicture) int ret; ScreenPtr pScreen = pPicture->pDrawable->pScreen; cwPsDecl(pScreen); - + cwPsUnwrap (CreatePicture); - setCwPicture(pPicture, 0); + bzero(getCwPicture(pPicture), sizeof(cwPictureRec)); ret = (*ps->CreatePicture) (pPicture); cwPsWrap (CreatePicture, cwCreatePicture); return ret; @@ -428,7 +428,7 @@ cwInitializeRender (ScreenPtr pScreen) { cwPsDecl (pScreen); - if (!AllocatePicturePrivate (pScreen, cwPictureIndex, 0)) + if (!AllocatePicturePrivate (pScreen, cwPictureIndex, sizeof(cwPictureRec))) return FALSE; cwPsWrap(CreatePicture, cwCreatePicture); cwPsWrap(DestroyPicture, cwDestroyPicture); |