/* changed area is *dest* rect */ static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane) { RegionPtr result; BoxRec box; GCOP_UNWRAP(pGC); RL_DEBUG_MSG("copy plane start "); if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) { RootlessStartDrawing((WindowPtr) pSrc); } RootlessStartDrawing((WindowPtr) dst); result = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty, plane); box.x1 = dstx + dst->x; box.x2 = box.x1 + w; box.y1 = dsty + dst->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); if (BOX_NOT_EMPTY(box)) RootlessDamageBox((WindowPtr) dst, &box); GCOP_WRAP(pGC); RL_DEBUG_MSG("copy plane end\n"); return result; }
static void RootlessPutImage(DrawablePtr dst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits) { BoxRec box; GCOP_UNWRAP(pGC); RL_DEBUG_MSG("put image start "); RootlessStartDrawing((WindowPtr) dst); pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits); box.x1 = x + dst->x; box.x2 = box.x1 + w; box.y1 = y + dst->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); if (BOX_NOT_EMPTY(box)) RootlessDamageBox((WindowPtr) dst, &box); GCOP_WRAP(pGC); RL_DEBUG_MSG("put image end\n"); }
static void ShadowPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { BoxRec box; Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); if (IS_VISIBLE(pDraw)) { box.x1 = x + pDraw->x; box.x2 = box.x1 + w; box.y1 = y + pDraw->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); if (BOX_NOT_EMPTY(box)) { if (pPriv->preRefresh) (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); boxNotEmpty = TRUE; } } (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); if (boxNotEmpty && pPriv->postRefresh) (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); SHADOW_GC_OP_EPILOGUE(pGC); }
static void ShadowSetSpans( DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, DDXPointPtr pptInit, int *pwidthInit, int nspans, int fSorted ){ SHADOW_GC_OP_PROLOGUE(pGC); if(IS_VISIBLE(pDraw) && nspans) { DDXPointPtr ppt = pptInit; int *pwidth = pwidthInit; int i = nspans; BoxRec box; Bool boxNotEmpty = FALSE; box.x1 = ppt->x; box.x2 = box.x1 + *pwidth; box.y2 = box.y1 = ppt->y; while(--i) { ppt++; pwidth++; if(box.x1 > ppt->x) box.x1 = ppt->x; if(box.x2 < (ppt->x + *pwidth)) box.x2 = ppt->x + *pwidth; if(box.y1 > ppt->y) box.y1 = ppt->y; else if(box.y2 < ppt->y) box.y2 = ppt->y; } box.y2++; if(!pGC->miTranslate) { TRANSLATE_BOX(box, pDraw); } TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) { if(pPriv->preRefresh) (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); boxNotEmpty = TRUE; } (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); if(boxNotEmpty && pPriv->postRefresh) (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); } else (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit, pwidthInit, nspans, fSorted); SHADOW_GC_OP_EPILOGUE(pGC); }
static RegionPtr ShadowCopyPlane( DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane ){ RegionPtr ret; BoxRec box; Bool boxNotEmpty = FALSE; SHADOW_GC_OP_PROLOGUE(pGC); if(IS_VISIBLE(pDst)) { box.x1 = dstx + pDst->x; box.x2 = box.x1 + width; box.y1 = dsty + pDst->y; box.y2 = box.y1 + height; TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) { if(pPriv->preRefresh) (*pPriv->preRefresh)(pPriv->pScrn, 1, &box); boxNotEmpty = TRUE; } } ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); if(boxNotEmpty && pPriv->postRefresh) (*pPriv->postRefresh)(pPriv->pScrn, 1, &box); SHADOW_GC_OP_EPILOGUE(pGC); return ret; }
/* changed area is *dest* rect */ static RegionPtr RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { RegionPtr result; BoxRec box; GC_SAVE(pGC); GCOP_UNWRAP(pGC); RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst); if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) { /* If both source and dest are windows, and we're doing a simple copy operation, we can remove the alpha-protecting planemask (since source has opaque alpha as well) */ if (canAccelBlit(pSrc, pGC)) { GC_UNSET_PM(pGC, dst); } RootlessStartDrawing((WindowPtr) pSrc); } RootlessStartDrawing((WindowPtr) dst); result = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty); box.x1 = dstx + dst->x; box.x2 = box.x1 + w; box.y1 = dsty + dst->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); if (BOX_NOT_EMPTY(box)) RootlessDamageBox((WindowPtr) dst, &box); GC_RESTORE(pGC, dst); GCOP_WRAP(pGC); RL_DEBUG_MSG("copy area end\n"); return result; }
static void SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); ScrnInfoPtr pScrn = infoRec->pScrn; SMIPtr pSmi = SMIPTR(pScrn); ENTER_PROC("SMI_Polylines"); /* Call the original Polylines function. */ pGC->ops->Polylines = XAAFallbackOps.Polylines; (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); pGC->ops->Polylines = SMI_Polylines; if (IS_VISIBLE(pDraw) && npt) { /* Allocate a temporary buffer for all segments of the polyline. */ BoxPtr pBox = xnfcalloc(sizeof(BoxRec), npt); int extra = pGC->lineWidth >> 1, box; if (npt > 1) { /* Adjust the extra space required per polyline segment. */ if (pGC->joinStyle == JoinMiter) { extra = 6 * pGC->lineWidth; } else if (pGC->capStyle == CapProjecting) { extra = pGC->lineWidth; } } for (box = 0; --npt;) { /* Setup the bounding box for one polyline segment. */ pBox[box].x1 = pptInit->x; pBox[box].y1 = pptInit->y; pptInit++; pBox[box].x2 = pptInit->x; pBox[box].y2 = pptInit->y; if (mode == CoordModePrevious) { pBox[box].x2 += pBox[box].x1; pBox[box].y2 += pBox[box].y1; } /* Sort coordinates. */ if (pBox[box].x1 > pBox[box].x2) { int tmp = pBox[box].x1; pBox[box].x1 = pBox[box].x2; pBox[box].x2 = tmp; } if (pBox[box].y1 > pBox[box].y2) { int tmp = pBox[box].y1; pBox[box].y1 = pBox[box].y2; pBox[box].y2 = tmp; } /* Add extra space required for each polyline segment. */ pBox[box].x1 -= extra; pBox[box].y1 -= extra; pBox[box].x2 += extra + 1; pBox[box].y2 += extra + 1; /* See if we need to draw this polyline segment. */ TRANSLATE_BOX(pBox[box], pDraw); TRIM_BOX(pBox[box], pGC); if (BOX_NOT_EMPTY(pBox[box])) { box++; } } if (box) { /* Refresh all polyline segments now. */ SMI_RefreshArea(pScrn, box, pBox); } /* Free the temporary buffer. */ xfree(pBox); }