Commit bfbb40c2 authored by Eric Anholt's avatar Eric Anholt
Browse files

Major improvements to Composite wrapper. Several issues remain, but it now

    appears stable in limited testing.
- Allocate the picture private, avoiding segfault.
- Wrap PaintWindow to draw the background/border to the backing pixmap
    (based on Deron Johnson's comptran.c).
- Set the x_off/y_off returns to translate coordinates properly.
- Don't bother allocating temporary areas for the modified coordinates.
    Layers above are responsible for handling lower layers changing the
    arguments, so cw doesn't have to worry about it. mibstore.c has to do
    the allocation because it calls down twice (front buffer and backing
    store). (Suggested by keithp)
- Handle the mode argument to PolyPoint, Polylines, and FillPolygon.
- Remove some dead elements in the cw privates.
- Kill a prototype warning in compinit.c by adding the cw.h header.
parent b7ba272d
......@@ -26,6 +26,7 @@
#include <config.h>
#endif
#include "compint.h"
#include "cw.h"
int CompScreenPrivateIndex;
int CompWindowPrivateIndex;
......
......@@ -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) {
......
......@@ -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 */
......
......@@ -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);