#include "X.h"
#include "Xmd.h"
#include "servermd.h"
#include "gcstruct.h"
#include "window.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "ipl.h"
#include "mi.h"
#include "mispans.h"
#include "iplmskbits.h"
#include "iplmergerop.h"
#define STORE(p) INTER_MROP_PREBUILT_SOLID(srcpix, p, p)
#define Expand(left,right) {\
while (h--) { \
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix); \
INTER_MROP_PREBUILD(srcpix); \
++srcy; \
if (srcy == tileHeight) \
srcy = 0; \
left \
ngw = ngwMiddle; \
while (ngw--) \
{ \
STORE(p); \
INTER_NEXT_GROUP(p); \
} \
right \
p += ngwExtra; \
} \
}
void
INTER_MROP_NAME(iplFillRectTile32) (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox;
BoxPtr pBox;
{
INTER_DECLAREGP(srcpix);
INTER_DECLAREG(*psrc);
int tileHeight;
int ngwDst;
int w;
register int h;
INTER_DECLAREG(startmask);
INTER_DECLAREG(endmask);
int ngwMiddle;
int ngwExtra;
register int ngw;
INTER_DECLAREG(*p);
int y;
int srcy;
INTER_DECLAREG(*pbits);
PixmapPtr tile;
INTER_MROP_DECLARE_REG()
INTER_MROP_PREBUILT_DECLARE()
tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
psrc = (unsigned short *)tile->devPrivate.ptr;
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
while (nBox--)
{
w = pBox->x2 - pBox->x1;
h = pBox->y2 - pBox->y1;
y = pBox->y1;
p = pbits + (y * ngwDst) + (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
srcy = y % tileHeight;
if ( ((pBox->x1 & INTER_PIM) + w) <= INTER_PPG)
{
INTER_maskpartialbits(pBox->x1, w, startmask);
ngwExtra = ngwDst;
while (h--)
{
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix);
INTER_MROP_PREBUILD(srcpix);
++srcy;
if (srcy == tileHeight)
srcy = 0;
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
p += ngwExtra;
}
}
else
{
INTER_maskbits(pBox->x1, w, startmask, endmask, ngwMiddle);
ngwExtra = ngwDst - ngwMiddle * INTER_PLANES;
if (startmask)
{
ngwExtra -= INTER_PLANES;
if (endmask)
{
Expand(
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
INTER_NEXT_GROUP(p);,
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
}
else
{
Expand(
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
INTER_NEXT_GROUP(p);,
;)
}
}
else
{
if (endmask)
{
Expand(;,
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
}
else
{
Expand(;,
;)
}
}
}
pBox++;
}
}
void
INTER_MROP_NAME(iplTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
DrawablePtr pDrawable;
GCPtr pGC;
int nInit;
DDXPointPtr pptInit;
int *pwidthInit;
int fSorted;
{
int n;
DDXPointPtr ppt;
int *pwidth;
INTER_DECLAREG(*pbits);
int ngwDst;
INTER_DECLAREG(*p);
register int w;
register int ngw;
register int x;
INTER_DECLAREG(startmask);
INTER_DECLAREG(endmask);
INTER_DECLAREGP(srcpix);
int y;
int *pwidthFree;
DDXPointPtr pptFree;
PixmapPtr tile;
INTER_DECLAREG(*psrc);
int tileHeight;
INTER_MROP_DECLARE_REG ()
INTER_MROP_PREBUILT_DECLARE()
n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
{
if (pptFree) DEALLOCATE_LOCAL(pptFree);
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
return;
}
pwidth = pwidthFree;
ppt = pptFree;
n = miClipSpans( iplGetCompositeClip(pGC),
pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
psrc = (unsigned short *)tile->devPrivate.ptr;
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
{
while (n--)
{
x = ppt->x;
y = ppt->y;
++ppt;
w = *pwidth++;
p = pbits + (y * ngwDst) + (x >> INTER_PGSH) * INTER_PLANES;
INTER_COPY(psrc +(y % tileHeight)*INTER_PLANES,srcpix);
INTER_MROP_PREBUILD(srcpix);
if ((x & INTER_PIM) + w < INTER_PPG)
{
INTER_maskpartialbits(x, w, startmask);
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
}
else
{
INTER_maskbits(x, w, startmask, endmask, ngw);
if (startmask)
{
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
INTER_NEXT_GROUP(p);
}
while (ngw--)
{
STORE(p);
INTER_NEXT_GROUP(p);
}
if (endmask)
{
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p);
}
}
}
}
DEALLOCATE_LOCAL(pptFree);
DEALLOCATE_LOCAL(pwidthFree);
}