Esempio n. 1
0
static void
XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    register int x, y, e;
    int yk, xk, ym, xm, dx, dy, xorg, yorg;
    int slw;
    miFillArcRec info;

    (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
		pGC->planemask);

    miFillArcSetup(arc, &info);
    MIFILLARCSETUP();
    if (pGC->miTranslate)
    {
	xorg += pDraw->x;
	yorg += pDraw->y;
    }
    while (y > 0)
    {
	MIFILLARCSTEP(slw);
	if (slw > 0) {
	    (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn, xorg - x,
		    yorg - y, slw, 1);
            if (miFillArcLower(slw))
		(*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
			xorg - x, yorg + y + dy, slw, 1);
	}
    }

    SET_SYNC_FLAG(infoRec);
}
Esempio n. 2
0
static RegionPtr
XAACopyPlanePixmap(
    DrawablePtr	pSrc,
    DrawablePtr	pDst,
    GCPtr pGC,
    int	srcx, int srcy,
    int	width, int height,
    int	dstx, int dsty,
    unsigned long bitPlane 
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    RegionPtr ret;

    XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);

    if(infoRec->pScrn->vtSema && 
	((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
	if(infoRec->NeedToSync) {
	   (*infoRec->Sync)(infoRec->pScrn);
	    infoRec->NeedToSync = FALSE;
	}
    }    

    ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
	       pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
    XAA_PIXMAP_OP_EPILOGUE(pGC);
    return ret;
}
Esempio n. 3
0
static void
XAARenderPixmapCopySpans(
    GCPtr pGC,
    int	n,
    DDXPointPtr ppt,
    int *pwidth,
    int fSorted,
    int xorg, int yorg 
){
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
   XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);

   pCache->x = pPriv->offscreenArea->box.x1;
   pCache->y = pPriv->offscreenArea->box.y1;
   pCache->w = pCache->orig_w = 
		pPriv->offscreenArea->box.x2 - pCache->x;
   pCache->h = pCache->orig_h = 
		pPriv->offscreenArea->box.y2 - pCache->y;
   pCache->trans_color = -1;

   (*infoRec->FillCacheBltSpans) (infoRec->pScrn, 
                pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache, 
                (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
}
Esempio n. 4
0
static void
XAARenderCacheBltSpans(
    GCPtr pGC,
    int	n,
    DDXPointPtr ppt,
    int *pwidth,
    int fSorted,
    int xorg, int yorg 
){
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   XAACacheInfoPtr pCache;

   switch(pGC->fillStyle) {
   case FillStippled:
      pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple, 
					pGC->fgPixel, -1);
      break;
   case FillOpaqueStippled:
      pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple, 
					pGC->fgPixel, pGC->bgPixel);
      break;
   case FillTiled:
      pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
      break;
   default:	/* Muffle compiler */
      pCache = NULL;
      break;
   }

   (*infoRec->FillCacheBltSpans) (infoRec->pScrn, 
                pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache, 
                (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));

}
Esempio n. 5
0
static void
XAARenderCacheExpandSpans(
    GCPtr pGC,
    int	n,
    DDXPointPtr ppt,
    int *pwidth,
    int fSorted,
    int xorg, int yorg 
){
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   int fg, bg;

   switch(pGC->fillStyle) {
   case FillStippled:
      fg = pGC->fgPixel;  bg = -1;
      break;
   case FillOpaqueStippled:
      fg = pGC->fgPixel;  bg = pGC->bgPixel;
      break;
   default:	/* Muffle compiler */
      fg = -1;  bg = -1;
      break;
   }

   (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg,
                pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted,
                (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
                pGC->stipple); 
}
Esempio n. 6
0
static void
XAARenderCacheExpandRects(GCPtr pGC,
                          int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    int fg, bg;

    switch (pGC->fillStyle) {
    case FillStippled:
        fg = pGC->fgPixel;
        bg = -1;
        break;
    case FillOpaqueStippled:
        fg = pGC->fgPixel;
        bg = pGC->bgPixel;
        break;
    default:                   /* Muffle compiler */
        fg = -1;
        bg = -1;
        break;
    }

    (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg,
                                      pGC->alu, pGC->planemask, nboxes,
                                      pClipBoxes, (xorg + pGC->patOrg.x),
                                      (yorg + pGC->patOrg.y), pGC->stipple);
}
Esempio n. 7
0
static void
XAARenderMono8x8Rects(
   GCPtr pGC,
   int nboxes,
   BoxPtr pClipBoxes,
   int xorg, int yorg
){
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   XAAPixmapPtr pPriv;
   int fg, bg;

   switch(pGC->fillStyle) {
   case FillStippled:
      pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
      fg = pGC->fgPixel;  bg = -1;
      break;
   case FillOpaqueStippled:
      pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
      fg = pGC->fgPixel;  bg = pGC->bgPixel;
      break;
   case FillTiled:
      pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
      fg = pPriv->fg;  bg = pPriv->bg;
      break;
   default:	/* Muffle compiler */
      pPriv = NULL;	/* Kaboom */
      fg = -1;  bg = -1;
      break;
   }

   (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn, 
                fg, bg, pGC->alu, pGC->planemask, 
                nboxes, pClipBoxes, pPriv->pattern0, pPriv->pattern1, 
                (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
}
Esempio n. 8
0
static void
XAARenderCacheBltRects(GCPtr pGC,
                       int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    XAACacheInfoPtr pCache;

    switch (pGC->fillStyle) {
    case FillStippled:
        pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
                                           pGC->fgPixel, -1);
        break;
    case FillOpaqueStippled:
        pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
                                           pGC->fgPixel, pGC->bgPixel);
        break;
    case FillTiled:
        pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
        break;
    default:                   /* Muffle compiler */
        pCache = NULL;
        break;
    }

    (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
                                   pGC->planemask, nboxes, pClipBoxes,
                                   (xorg + pGC->patOrg.x),
                                   (yorg + pGC->patOrg.y), pCache);
}
Esempio n. 9
0
File: xaaGCmisc.c Progetto: aosm/X11
void
XAAValidateImageGlyphBlt(
   GCPtr         pGC,
   unsigned long changes,
   DrawablePtr   pDraw )
{
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   Bool BigFont = FALSE;

   pGC->ops->ImageText8 = XAAFallbackOps.ImageText8;
   pGC->ops->ImageText16 = XAAFallbackOps.ImageText16;
   pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt;

   if(!pGC->font) return;

   if((FONTMAXBOUNDS(pGC->font, rightSideBearing) - 
	FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
	BigFont = TRUE;

   /* no funny business */
   if((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
	((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
	return;


   /* Check for TE Fonts */
   if(!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) {
	if(infoRec->ImageGlyphBltNonTE &&
		CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
		CHECK_FG(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
	   infoRec->SetupForSolidFill &&
		CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
		CHECK_BG(pGC,infoRec->SolidFillFlags))
	{
		pGC->ops->ImageText8 = infoRec->ImageText8NonTE;
		pGC->ops->ImageText16 = infoRec->ImageText16NonTE;
		pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE;
	}
   } else if(infoRec->ImageGlyphBltTE &&
	     CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltTEFlags)){
	if(!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) &&  
		CHECK_COLORS(pGC,infoRec->ImageGlyphBltTEFlags))
	{
		pGC->ops->ImageText8 = infoRec->ImageText8TE;
		pGC->ops->ImageText16 = infoRec->ImageText16TE;
		pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
	} else {
	   if(CHECK_FG(pGC,infoRec->ImageGlyphBltTEFlags) &&
	      infoRec->SetupForSolidFill &&
	      CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
	      CHECK_BG(pGC,infoRec->SolidFillFlags)) 
	   {
		pGC->ops->ImageText8 = infoRec->ImageText8TE;
		pGC->ops->ImageText16 = infoRec->ImageText16TE;
		pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
	   }
	}
    }
}
Esempio n. 10
0
static void
XAARenderSolidRects(GCPtr pGC,
                    int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    (*infoRec->FillSolidRects) (infoRec->pScrn,
                                pGC->fgPixel, pGC->alu, pGC->planemask, nboxes,
                                pClipBoxes);
}
Esempio n. 11
0
static void
XAARenderImageWriteRects(GCPtr pGC,
                         int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu,
                                     pGC->planemask, nboxes, pClipBoxes,
                                     (xorg + pGC->patOrg.x),
                                     (yorg + pGC->patOrg.y), pGC->tile.pixmap);
}
Esempio n. 12
0
void
XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    Bool BigFont = FALSE;

    pGC->ops->PolyText8 = XAAFallbackOps.PolyText8;
    pGC->ops->PolyText16 = XAAFallbackOps.PolyText16;
    pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt;

    if (!pGC->font)
        return;
    if (pGC->fillStyle != FillSolid)
        return;

    if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
         FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
        BigFont = TRUE;

    /* no funny business */
    if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
        ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
        return;

    /* Check for TE Fonts */
    if (!TERMINALFONT(pGC->font) || BigFont) {
        if (infoRec->PolyGlyphBltNonTE &&
            CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
            CHECK_ROP(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
            CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
            CHECK_FG(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
            (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
             (pGC->alu == GXcopy))
            ) {
            pGC->ops->PolyText8 = infoRec->PolyText8NonTE;
            pGC->ops->PolyText16 = infoRec->PolyText16NonTE;
            pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE;
        }
    }
    else {
        if (infoRec->PolyGlyphBltTE &&
            CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltTEFlags) &&
            CHECK_ROP(pGC, infoRec->PolyGlyphBltTEFlags) &&
            CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
            CHECK_FG(pGC, infoRec->PolyGlyphBltTEFlags) &&
            (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
             (pGC->alu == GXcopy))
            ) {
            pGC->ops->PolyText8 = infoRec->PolyText8TE;
            pGC->ops->PolyText16 = infoRec->PolyText16TE;
            pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE;
        }
    }
}
Esempio n. 13
0
static void
XAARenderSolidSpans(
    GCPtr pGC,
    int	n,
    DDXPointPtr ppt,
    int *pwidth,
    int fSorted,
    int xorg, int yorg 
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel, 
		pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted);    
}
Esempio n. 14
0
void
XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    if (infoRec->CopyArea &&
        CHECK_PLANEMASK(pGC, infoRec->CopyAreaFlags) &&
        CHECK_ROP(pGC, infoRec->CopyAreaFlags) &&
        CHECK_ROPSRC(pGC, infoRec->CopyAreaFlags)
        )
        pGC->ops->CopyArea = infoRec->CopyArea;
    else
        pGC->ops->CopyArea = XAAFallbackOps.CopyArea;
}
static void 
Permedia2PolySegmentThinSolidWrapper(
   DrawablePtr     pDraw,
   GCPtr           pGC,
   int             nseg,
   xSegment        *pSeg
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    GLINTPtr pGlint = GLINTPTR(infoRec->pScrn);
    TRACE("Permedia2PolySegmentThinSolidWrapper");
    pGlint->CurrentGC = pGC;
    pGlint->CurrentDrawable = pDraw;
    if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn);
    XAAPolySegment(pDraw, pGC, nseg, pSeg);
}
Esempio n. 16
0
void
XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    if (infoRec->PutImage &&
        CHECK_PLANEMASK(pGC, infoRec->PutImageFlags) &&
        CHECK_ROP(pGC, infoRec->PutImageFlags) &&
        CHECK_ROPSRC(pGC, infoRec->PutImageFlags) &&
        CHECK_COLORS(pGC, infoRec->PutImageFlags)
        )
        pGC->ops->PutImage = infoRec->PutImage;
    else
        pGC->ops->PutImage = XAAFallbackOps.PutImage;
}
Esempio n. 17
0
static void
XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
{ 
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
    register int x, y, e;
    miFillArcRec info;
    miArcSliceRec slice;
    int ya, xl, xr, xc;

    (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
        pGC->planemask);

    miFillArcSetup(arc, &info);
    miFillArcSliceSetup(arc, &slice, pGC);
    MIFILLARCSETUP();
    slw = arc->height;
    if (slice.flip_top || slice.flip_bot)
	slw += (arc->height >> 1) + 1;
    if (pGC->miTranslate)
    {
	xorg += pDraw->x;
	yorg += pDraw->y;
	slice.edge1.x += pDraw->x;
	slice.edge2.x += pDraw->x;
    }
    while (y > 0)
    {
	MIFILLARCSTEP(slw);
	MIARCSLICESTEP(slice.edge1);
	MIARCSLICESTEP(slice.edge2);
	if (miFillSliceUpper(slice))
	{
	    ya = yorg - y;
	    MIARCSLICEUPPER(xl, xr, slice, slw);
	    
	    ADDSLICESPANS(slice.flip_top);
	}
	if (miFillSliceLower(slice))
	{
	    ya = yorg + y + dy;
	    MIARCSLICELOWER(xl, xr, slice, slw);
	    ADDSLICESPANS(slice.flip_bot);
	}
    }

    SET_SYNC_FLAG(infoRec);
}
static void 
Permedia2PolylinesThinSolidWrapper(
   DrawablePtr     pDraw,
   GCPtr           pGC,
   int             mode,
   int             npt,
   DDXPointPtr     pPts
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    GLINTPtr pGlint = GLINTPTR(infoRec->pScrn);
    TRACE("Permedia2PolylinesThinSolidWrapper");
    pGlint->CurrentGC = pGC;
    pGlint->CurrentDrawable = pDraw;
    if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn);
    XAAPolyLines(pDraw, pGC, mode, npt, pPts);
}
Esempio n. 19
0
static void
SMI_ValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
	XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
	SMIPtr pSmi = SMIPTR(infoRec->pScrn);

	ENTER_PROC("SMI_ValidatePolylines");

	pSmi->ValidatePolylines(pGC, changes, pDraw);
	if (pGC->ops->Polylines == XAAFallbackOps.Polylines)
	{
		/* Override the Polylines function with our own Polylines function. */
		pGC->ops->Polylines = SMI_Polylines;
	}

	LEAVE_PROC("SMI_ValidatePolylines");
}
Esempio n. 20
0
void
XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    if (infoRec->PushPixelsSolid &&
        (pGC->fillStyle == FillSolid) &&
        CHECK_PLANEMASK(pGC, infoRec->PushPixelsFlags) &&
        CHECK_ROP(pGC, infoRec->PushPixelsFlags) &&
        CHECK_ROPSRC(pGC, infoRec->PushPixelsFlags) &&
        CHECK_FG(pGC, infoRec->PushPixelsFlags) &&
        (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) ||
         (pGC->alu == GXcopy))
        )
        pGC->ops->PushPixels = infoRec->PushPixelsSolid;
    else
        pGC->ops->PushPixels = XAAFallbackOps.PushPixels;

}
Esempio n. 21
0
static void
XAARenderPixmapCopyRects(GCPtr pGC,
                         int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
    XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);

    pCache->x = pPriv->offscreenArea->box.x1;
    pCache->y = pPriv->offscreenArea->box.y1;
    pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
    pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
    pCache->trans_color = -1;

    (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
                                   pGC->planemask, nboxes, pClipBoxes,
                                   (xorg + pGC->patOrg.x),
                                   (yorg + pGC->patOrg.y), pCache);
}
Esempio n. 22
0
static RegionPtr
XAACopyAreaPixmap(
    DrawablePtr pSrc,
    DrawablePtr pDst,
    GC *pGC,
    int srcx, int srcy,
    int width, int height,
    int dstx, int dsty 
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    RegionPtr ret;

    if(infoRec->pScrn->vtSema && 
	((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) 
    {
	if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
           (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
          ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
              == infoRec->FullPlanemasks[pSrc->depth - 1]))
        {
            XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
	    pixPriv->flags |= DIRTY; 

            return (XAABitBlt( pSrc, pDst, pGC,
                srcx, srcy, width, height, dstx, dsty,
                XAADoImageRead, 0L));
        } else
	if(infoRec->NeedToSync) {
	   (*infoRec->Sync)(infoRec->pScrn);
	    infoRec->NeedToSync = FALSE;
	}
    }    

    {
	XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
	ret = (*pGC->ops->CopyArea)(pSrc, pDst,
            pGC, srcx, srcy, width, height, dstx, dsty);
	XAA_PIXMAP_OP_EPILOGUE(pGC);
    }
    return ret;
}
Esempio n. 23
0
static void
XAARenderColor8x8Spans(
    GCPtr pGC,
    int	n,
    DDXPointPtr ppt,
    int *pwidth,
    int fSorted,
    int xorg, int yorg 
){
   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
   XAACacheInfoPtr pCache;
   PixmapPtr pPix;
   int fg, bg;

   switch(pGC->fillStyle) {
   case FillStippled:
      pPix = pGC->stipple;
      fg = pGC->fgPixel;  bg = -1;
      break;
   case FillOpaqueStippled:
      pPix = pGC->stipple;
      fg = pGC->fgPixel;  bg = pGC->bgPixel;
      break;
   case FillTiled:
      pPix = pGC->tile.pixmap;
      fg = -1;  bg = -1;
      break;
   default:	/* Muffle compiler */
      pPix = NULL;
      fg = -1;  bg = -1;
      break;
   }

   pCache = (*infoRec->CacheColor8x8Pattern)(infoRec->pScrn, pPix, fg, bg);

   (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn, 
                pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
                (yorg + pGC->patOrg.x), (xorg + pGC->patOrg.y));
}
Esempio n. 24
0
void
XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);

    if (pGC->fillStyle != FillTiled)
        changes &= ~GCTile;
    if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid))
        changes &= ~GCStipple;
    if (!changes)
        return;

    pGC->ops->FillSpans = XAAFallbackOps.FillSpans;
    pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect;
    pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon;
    pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc;

    switch (pGC->fillStyle) {
    case FillSolid:
        if (infoRec->FillSpansSolid &&
            CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) &&
            CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) &&
            CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) &&
            CHECK_FG(pGC, infoRec->FillSpansSolidFlags)
            ) {
            pGC->ops->FillSpans = infoRec->FillSpansSolid;
            pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid;
            pGC->ops->FillPolygon = infoRec->FillPolygonSolid;
            pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid;
        }
        break;
        /* The [Stippled/OpaqueStippled/Tiled]FillChooser 
           functions do the validating */
    case FillStippled:
        if (infoRec->FillSpansStippled) {
            pGC->ops->FillSpans = infoRec->FillSpansStippled;
            pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled;
            if (infoRec->FillPolygonStippled)
                pGC->ops->FillPolygon = infoRec->FillPolygonStippled;
            else
                pGC->ops->FillPolygon = miFillPolygon;
            pGC->ops->PolyFillArc = miPolyFillArc;
        }
        break;
    case FillOpaqueStippled:
        if (infoRec->FillSpansOpaqueStippled) {
            pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled;
            pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled;
            if (infoRec->FillPolygonOpaqueStippled)
                pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled;
            else
                pGC->ops->FillPolygon = miFillPolygon;
            pGC->ops->PolyFillArc = miPolyFillArc;
        }
        break;
    case FillTiled:
        if (infoRec->FillSpansTiled) {
            pGC->ops->FillSpans = infoRec->FillSpansTiled;
            pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled;
            if (infoRec->FillPolygonTiled)
                pGC->ops->FillPolygon = infoRec->FillPolygonTiled;
            else
                pGC->ops->FillPolygon = miFillPolygon;
            pGC->ops->PolyFillArc = miPolyFillArc;
        }
        break;
    default:
        return;
    }
}
Esempio n. 25
0
void
XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
                                                   XAAGetGCKey());

    if (pGC->lineStyle == LineSolid)
        changes &= ~GCDashList;
    if (!changes)
        return;

    pGC->ops->PolySegment = XAAFallbackOps.PolySegment;
    pGC->ops->Polylines = XAAFallbackOps.Polylines;
    pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle;
    pGC->ops->PolyArc = XAAFallbackOps.PolyArc;

    if ((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) &&
        (pGC->lineWidth > 0)) {

        pGC->ops->PolyArc = miPolyArc;
        pGC->ops->PolySegment = miPolySegment;
        pGC->ops->PolyRectangle = miPolyRectangle;
        if (pGC->lineStyle == LineSolid)
            pGC->ops->Polylines = miWideLine;
        else
            pGC->ops->Polylines = miWideDash;
    }

    if ((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) {

        if (pGC->lineStyle == LineSolid) {

            if (infoRec->PolyRectangleThinSolid &&
                CHECK_PLANEMASK(pGC, infoRec->PolyRectangleThinSolidFlags) &&
                CHECK_ROP(pGC, infoRec->PolyRectangleThinSolidFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolyRectangleThinSolidFlags) &&
                CHECK_FG(pGC, infoRec->PolyRectangleThinSolidFlags)) {

                pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid;
            }

            if (infoRec->PolySegmentThinSolid &&
                CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinSolidFlags) &&
                CHECK_ROP(pGC, infoRec->PolySegmentThinSolidFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolySegmentThinSolidFlags) &&
                CHECK_FG(pGC, infoRec->PolySegmentThinSolidFlags)) {

                pGC->ops->PolySegment = infoRec->PolySegmentThinSolid;
            }

            if (infoRec->PolylinesThinSolid &&
                CHECK_PLANEMASK(pGC, infoRec->PolylinesThinSolidFlags) &&
                CHECK_ROP(pGC, infoRec->PolylinesThinSolidFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolylinesThinSolidFlags) &&
                CHECK_FG(pGC, infoRec->PolylinesThinSolidFlags)) {

                pGC->ops->Polylines = infoRec->PolylinesThinSolid;
            }
        }
        else if ((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern) {

            if (infoRec->PolySegmentThinDashed &&
                !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) &&
                ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags &
                                           TRANSPARENCY_GXCOPY_ONLY)) &&
                CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_FG(pGC, infoRec->PolySegmentThinDashedFlags)) {

                pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
            }

            if (infoRec->PolylinesThinDashed &&
                !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) &&
                ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags &
                                           TRANSPARENCY_GXCOPY_ONLY)) &&
                CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_FG(pGC, infoRec->PolylinesThinDashedFlags)) {

                pGC->ops->Polylines = infoRec->PolylinesThinDashed;
            }

            if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
                pGC->ops->PolyRectangle = miPolyRectangle;

        }
        else if (pGCPriv->DashPattern && (pGC->depth != 32)) {
            /* LineDoubleDash */
            if (infoRec->PolySegmentThinDashed &&
                !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) &&
                CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
                CHECK_COLORS(pGC, infoRec->PolySegmentThinDashedFlags)) {

                pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
            }

            if (infoRec->PolylinesThinDashed &&
                !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) &&
                CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
                CHECK_COLORS(pGC, infoRec->PolylinesThinDashedFlags)) {

                pGC->ops->Polylines = infoRec->PolylinesThinDashed;
            }

            if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
                pGC->ops->PolyRectangle = miPolyRectangle;

        }
    }

    if (infoRec->PolylinesWideSolid &&
        (pGC->lineWidth > 0) &&
        (pGC->fillStyle == FillSolid) &&
        (pGC->lineStyle == LineSolid) &&
        CHECK_PLANEMASK(pGC, infoRec->PolylinesWideSolidFlags) &&
        CHECK_ROP(pGC, infoRec->PolylinesWideSolidFlags) &&
        CHECK_ROPSRC(pGC, infoRec->PolylinesWideSolidFlags) &&
        CHECK_FG(pGC, infoRec->PolylinesWideSolidFlags)) {

        pGC->ops->Polylines = infoRec->PolylinesWideSolid;
    }
}
Esempio n. 26
0
static void
XAAValidateGC(
   GCPtr         pGC,
   unsigned long changes,
   DrawablePtr   pDraw 
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    XAA_GC_FUNC_PROLOGUE(pGC);

    (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);

    if((changes & GCPlaneMask) &&
       ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == 
	 infoRec->FullPlanemasks[pGC->depth - 1]))
    {	
	pGC->planemask = ~0;
    }

    if(pGC->depth != 32) {
	/* 0xffffffff is reserved for transparency */
	if(pGC->bgPixel == 0xffffffff)
	    pGC->bgPixel = 0x7fffffff;
	if(pGC->fgPixel == 0xffffffff)
	    pGC->fgPixel = 0x7fffffff;
    }

    if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){
	pGCPriv->flags = OPS_ARE_PIXMAP;
        pGCPriv->changes |= changes;

	/* make sure we're not using videomemory pixmaps to render
	   onto system memory drawables */

	if((pGC->fillStyle == FillTiled) && 
	    IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
	    !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {

	    XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
	    FBAreaPtr area = pPriv->offscreenArea;

	    XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
	    xf86FreeOffscreenArea(area);
	}
    } 
    else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
	pGCPriv->flags = 0;
        pGCPriv->changes |= changes;
    }
    else {
	if(!(pGCPriv->flags & OPS_ARE_ACCEL)) {	
	    changes |= pGCPriv->changes;
	    pGCPriv->changes = 0;
	}
	pGCPriv->flags = OPS_ARE_ACCEL;

#if 1
	/* Ugh.  If we can't use the blitter on offscreen pixmaps used
	   as tiles, then we need to move them out as cfb can't handle
	   tiles with non-zero origins */

	if((pGC->fillStyle == FillTiled) && 
	    IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
	    (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) {

	    XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
	    FBAreaPtr area = pPriv->offscreenArea;

	    XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
	    xf86FreeOffscreenArea(area);
	}
#endif
    }

    XAA_GC_FUNC_EPILOGUE(pGC);

    if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return;

    if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){
	XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
		
	if(pixPriv->flags & DIRTY) {
	    pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
	    pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
	}
    }
    if((changes & GCStipple) && pGC->stipple){
	XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
		
	if(pixPriv->flags & DIRTY) {
	    pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
	    pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
	}
    }

    /* If our Ops are still the default ones we need to allocate new ones */
    if(pGC->ops == &XAAFallbackOps) {
	if(!(pGCPriv->XAAOps = xalloc(sizeof(GCOps)))) {	
	    pGCPriv->XAAOps = &XAAFallbackOps;
	    return;
	}
	/* make a modifiable copy of the default ops */
	memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
	pGC->ops = pGCPriv->XAAOps;
	changes = ~0;
    }

    if(!changes) return;

    if((changes & GCDashList) && infoRec->ComputeDash)
	infoRec->ComputeDash(pGC);

    if(changes & infoRec->FillSpansMask)
	(*infoRec->ValidateFillSpans)(pGC, changes, pDraw); 	

    if(changes & infoRec->SetSpansMask)
	(*infoRec->ValidateSetSpans)(pGC, changes, pDraw); 	

    if(changes & infoRec->PutImageMask)
	(*infoRec->ValidatePutImage)(pGC, changes, pDraw); 	

    if(changes & infoRec->CopyAreaMask)
	(*infoRec->ValidateCopyArea)(pGC, changes, pDraw); 	

    if(changes & infoRec->CopyPlaneMask)
	(*infoRec->ValidateCopyPlane)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolyPointMask)
	(*infoRec->ValidatePolyPoint)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolylinesMask)
	(*infoRec->ValidatePolylines)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolySegmentMask)
	(*infoRec->ValidatePolySegment)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolyRectangleMask)
	(*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolyArcMask)
	(*infoRec->ValidatePolyArc)(pGC, changes, pDraw); 	

    if(changes & infoRec->FillPolygonMask)
	(*infoRec->ValidateFillPolygon)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolyFillRectMask)
	(*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw); 	
 
    if(changes & infoRec->PolyFillArcMask)
	(*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw); 	

    if(changes & infoRec->PolyGlyphBltMask)
	(*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw);

    if(changes & infoRec->ImageGlyphBltMask)
	(*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw);

    if(changes & infoRec->PolyText8Mask)
	(*infoRec->ValidatePolyText8)(pGC, changes, pDraw);
    
    if(changes & infoRec->PolyText16Mask)
	(*infoRec->ValidatePolyText16)(pGC, changes, pDraw);

    if(changes & infoRec->ImageText8Mask)
	(*infoRec->ValidateImageText8)(pGC, changes, pDraw);
    
    if(changes & infoRec->ImageText16Mask)
	(*infoRec->ValidateImageText16)(pGC, changes, pDraw);
 
    if(changes & infoRec->PushPixelsMask) 
	(*infoRec->ValidatePushPixels)(pGC, changes, pDraw); 	
}
Esempio n. 27
0
void
XAAFillSpans(
    DrawablePtr pDraw,
    GC		*pGC,
    int		nInit,		/* number of spans to fill */
    DDXPointPtr pptInit,	/* pointer to list of start points */
    int *pwidthInit,		/* pointer to list of n widths */
    int fSorted 
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    int type = 0;
    ClipAndRenderSpansFunc function;
    Bool fastClip = FALSE;

    if((nInit <= 0) || !pGC->planemask)
        return;

    if(!REGION_NUM_RECTS(pGC->pCompositeClip))
	return;

    switch(pGC->fillStyle) {
    case FillSolid:
	type = DO_SOLID;
	break;
    case FillStippled:
	type = (*infoRec->StippledFillChooser)(pGC);
	break;
    case FillOpaqueStippled:
	if((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid &&
                CHECK_PLANEMASK(pGC,infoRec->FillSpansSolidFlags) &&
                CHECK_ROP(pGC,infoRec->FillSpansSolidFlags) &&
                CHECK_ROPSRC(pGC,infoRec->FillSpansSolidFlags) &&
                CHECK_FG(pGC,infoRec->FillSpansSolidFlags))
	    type = DO_SOLID;
	else
	    type = (*infoRec->OpaqueStippledFillChooser)(pGC);
	break;
    case FillTiled:
	type = (*infoRec->TiledFillChooser)(pGC);
	break;
    }

    switch(type) {
    case DO_SOLID:
	function = XAARenderSolidSpans;	
	if(infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) 
		fastClip = TRUE; 
	break;	
    case DO_COLOR_8x8:
	function = XAARenderColor8x8Spans;	
	if(infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL) 
		fastClip = TRUE; 
	break;	
    case DO_MONO_8x8:
	function = XAARenderMono8x8Spans;	
	if(infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL) 
		fastClip = TRUE; 
	break;	
    case DO_CACHE_BLT:
	function = XAARenderCacheBltSpans;	
	if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
		fastClip = TRUE; 
	break;	
    case DO_COLOR_EXPAND:
	function = XAARenderColorExpandSpans;	
	break;	
    case DO_CACHE_EXPAND:
	function = XAARenderCacheExpandSpans;	
	if(infoRec->ClippingFlags & 
			HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND) 
		fastClip = TRUE; 
	break;	
    case DO_PIXMAP_COPY:
	function = XAARenderPixmapCopySpans;	
	if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
		fastClip = TRUE; 
	break;	
    case DO_IMAGE_WRITE:
    default:
	(*XAAFallbackOps.FillSpans)(pDraw, pGC, nInit, pptInit,
				pwidthInit, fSorted);
	return;
    }


    if((nInit < 10) || (REGION_NUM_RECTS(pGC->pCompositeClip) != 1))
	fastClip = FALSE;

    if(fastClip) {
	infoRec->ClipBox = &pGC->pCompositeClip->extents;
	(*function)(pGC, nInit, pptInit, pwidthInit, fSorted, 
					pDraw->x, pDraw->y);
	infoRec->ClipBox = NULL;
    } else
	XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted,
					function, pDraw->x, pDraw->y);
}
Esempio n. 28
0
void
XAAClipAndRenderRects(GCPtr pGC,
                      ClipAndRenderRectsFunc BoxFunc,
                      int nrectFill, xRectangle *prect, int xorg, int yorg)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    int Right, Bottom, MaxBoxes;
    BoxPtr pextent, pboxClipped, pboxClippedBase;

    MaxBoxes = infoRec->PreAllocSize / sizeof(BoxRec);
    pboxClippedBase = (BoxPtr) infoRec->PreAllocMem;
    pboxClipped = pboxClippedBase;

    if (RegionNumRects(pGC->pCompositeClip) == 1) {
        pextent = RegionRects(pGC->pCompositeClip);
        while (nrectFill--) {
            pboxClipped->x1 = max(pextent->x1, prect->x);
            pboxClipped->y1 = max(pextent->y1, prect->y);

            Right = (int) prect->x + (int) prect->width;
            pboxClipped->x2 = min(pextent->x2, Right);

            Bottom = (int) prect->y + (int) prect->height;
            pboxClipped->y2 = min(pextent->y2, Bottom);

            prect++;
            if ((pboxClipped->x1 < pboxClipped->x2) &&
                (pboxClipped->y1 < pboxClipped->y2)) {
                pboxClipped++;
                if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
                    (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
                    pboxClipped = pboxClippedBase;
                }
            }
        }
    }
    else {
        pextent = RegionExtents(pGC->pCompositeClip);
        while (nrectFill--) {
            int n;
            BoxRec box, *pbox;

            box.x1 = max(pextent->x1, prect->x);
            box.y1 = max(pextent->y1, prect->y);

            Right = (int) prect->x + (int) prect->width;
            box.x2 = min(pextent->x2, Right);

            Bottom = (int) prect->y + (int) prect->height;
            box.y2 = min(pextent->y2, Bottom);

            prect++;

            if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
                continue;

            n = RegionNumRects(pGC->pCompositeClip);
            pbox = RegionRects(pGC->pCompositeClip);

            /* clip the rectangle to each box in the clip region
               this is logically equivalent to calling Intersect()
             */
            while (n--) {
                pboxClipped->x1 = max(box.x1, pbox->x1);
                pboxClipped->y1 = max(box.y1, pbox->y1);
                pboxClipped->x2 = min(box.x2, pbox->x2);
                pboxClipped->y2 = min(box.y2, pbox->y2);
                pbox++;

                /* see if clipping left anything */
                if (pboxClipped->x1 < pboxClipped->x2 &&
                    pboxClipped->y1 < pboxClipped->y2) {
                    pboxClipped++;
                    if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
                        (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
                        pboxClipped = pboxClippedBase;
                    }
                }
            }
        }
    }

    if (pboxClipped != pboxClippedBase)
        (*BoxFunc) (pGC, pboxClipped - pboxClippedBase, pboxClippedBase,
                    xorg, yorg);
}
Esempio n. 29
0
void
XAAClipAndRenderSpans(
    GCPtr pGC, 
    DDXPointPtr	ppt,
    int		*pwidth,
    int		nspans,
    int		fSorted,
    ClipAndRenderSpansFunc func,
    int 	xorg,
    int		yorg
){
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    DDXPointPtr pptNew, pptBase;
    int	*pwidthBase, *pwidthNew;
    int	Right, numRects, MaxBoxes;

    MaxBoxes = infoRec->PreAllocSize/(sizeof(DDXPointRec) + sizeof(int));
    pptBase = (DDXPointRec*)infoRec->PreAllocMem;
    pwidthBase = (int*)(&pptBase[MaxBoxes]);

    pptNew = pptBase;
    pwidthNew = pwidthBase;

    numRects = REGION_NUM_RECTS(pGC->pCompositeClip);

    if(numRects == 1) {
        BoxPtr pextent = REGION_RECTS(pGC->pCompositeClip);
	    
	while(nspans--) {
	    if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) {
		pptNew->x = max(pextent->x1, ppt->x);
		Right = ppt->x + *pwidth; 
		*pwidthNew = min(pextent->x2, Right) - pptNew->x;

		if (*pwidthNew > 0) {
		    pptNew->y = ppt->y;
		    pptNew++;
		    pwidthNew++;

		    if(pptNew >= (pptBase + MaxBoxes)) {
			(*func)(pGC, MaxBoxes, pptBase, pwidthBase, fSorted, 	
								xorg, yorg);
			pptNew = pptBase;
			pwidthNew = pwidthBase;
		    }
		}
	    }
	    ppt++;
	    pwidth++;
	}
    } else if (numRects) {
	BoxPtr	pbox;
	int nbox;

	while(nspans--) {
	    nbox = numRects;
	    pbox = REGION_RECTS(pGC->pCompositeClip);

	    /* find the first band */
	    while(nbox && (pbox->y2 <= ppt->y)) {
		pbox++;
		nbox--;
	    }

	    if(nbox && (pbox->y1 <= ppt->y)) {
		int orig_y = pbox->y1;
		Right = ppt->x + *pwidth;
		while(nbox && (orig_y == pbox->y1)) {
		    if(pbox->x2 <= ppt->x) {
			nbox--;
			pbox++;
			continue;
		    }

		    if(pbox->x1 >= Right) {
			nbox = 0;
			break;
		    }

		    pptNew->x = max(pbox->x1, ppt->x);
		    *pwidthNew = min(pbox->x2, Right) - pptNew->x;
		    if(*pwidthNew > 0) {
			pptNew->y = ppt->y;
			pptNew++;
			pwidthNew++;

			if(pptNew >= (pptBase + MaxBoxes)) {
			    (*func)(pGC, MaxBoxes, pptBase, pwidthBase, 
							fSorted, xorg, yorg);
			    pptNew = pptBase;
			    pwidthNew = pwidthBase;
			}
		    }
		    pbox++;
		    nbox--;
		}
	    }
	    ppt++;
	    pwidth++;
	}
    }

    if(pptNew != pptBase)
	(*func)(pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted, 
						xorg, yorg);
}
Esempio n. 30
0
void
XAAPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill,    /* number of rectangles to fill */
                xRectangle *prectInit   /* Pointer to first rectangle to fill */
    )
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
    int xorg = pDraw->x;
    int yorg = pDraw->y;
    int type = 0;
    ClipAndRenderRectsFunc function;

    if ((nrectFill <= 0) || !pGC->planemask)
        return;

    if (!RegionNumRects(pGC->pCompositeClip))
        return;

    switch (pGC->fillStyle) {
    case FillSolid:
        type = DO_SOLID;
        break;
    case FillStippled:
        type = (*infoRec->StippledFillChooser) (pGC);
        break;
    case FillOpaqueStippled:
        if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects &&
            CHECK_PLANEMASK(pGC, infoRec->FillSolidRectsFlags) &&
            CHECK_ROP(pGC, infoRec->FillSolidRectsFlags) &&
            CHECK_ROPSRC(pGC, infoRec->FillSolidRectsFlags) &&
            CHECK_FG(pGC, infoRec->FillSolidRectsFlags))
            type = DO_SOLID;
        else
            type = (*infoRec->OpaqueStippledFillChooser) (pGC);
        break;
    case FillTiled:
        type = (*infoRec->TiledFillChooser) (pGC);
        break;
    }

    switch (type) {
    case DO_SOLID:
        function = XAARenderSolidRects;
        break;
    case DO_COLOR_8x8:
        function = XAARenderColor8x8Rects;
        break;
    case DO_MONO_8x8:
        function = XAARenderMono8x8Rects;
        break;
    case DO_CACHE_BLT:
        function = XAARenderCacheBltRects;
        break;
    case DO_COLOR_EXPAND:
        function = XAARenderColorExpandRects;
        break;
    case DO_CACHE_EXPAND:
        function = XAARenderCacheExpandRects;
        break;
    case DO_IMAGE_WRITE:
        function = XAARenderImageWriteRects;
        break;
    case DO_PIXMAP_COPY:
        function = XAARenderPixmapCopyRects;
        break;
    default:
        (*XAAFallbackOps.PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
        return;
    }

    if (xorg | yorg) {
        int n = nrectFill;
        xRectangle *prect = prectInit;

        while (n--) {
            prect->x += xorg;
            prect->y += yorg;
            prect++;
        }
    }

    XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg);
}