📄 hpsprite.c
字号:
(*pScreen->PaintWindowBackground) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBackground, hpSpritePaintWindowBackground);}static voidhpSpritePaintWindowBorder (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what;{ ScreenPtr pScreen; hpPrivScreenPtr pScreenPriv; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, PaintWindowBorder); pScreenPriv = getPrivScreenPtr(pScreen); if (pScreenPriv->cstate == CURSOR_ON) { /* * If the cursor is on the same screen as the window, check the * region to paint for the cursor and remove it as necessary */ if ((* pScreen->RectIn) (pRegion, &pScreenPriv->saved) != rgnOUT) (*pScreenPriv->CursorOff) (pScreen); } (*pScreen->PaintWindowBorder) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBorder, hpSpritePaintWindowBorder);}static voidhpSpriteCopyWindow (pWin, ptOldOrg, pRegion) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr pRegion;{ ScreenPtr pScreen; hpPrivScreenPtr pScreenPriv; BoxRec cursorBox; int dx, dy; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, CopyWindow); pScreenPriv = getPrivScreenPtr(pScreen); if (pScreenPriv->cstate == CURSOR_ON) { /* * check both the source and the destination areas. The given * region is source relative, so offset the cursor box by * the delta position */ cursorBox = pScreenPriv->saved; dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; cursorBox.x1 -= dx; cursorBox.x2 -= dx; cursorBox.y1 -= dy; cursorBox.y2 -= dy; if ((* pScreen->RectIn) (pRegion, &pScreenPriv->saved) != rgnOUT || (* pScreen->RectIn) (pRegion, &cursorBox) != rgnOUT) (*pScreenPriv->CursorOff) (pScreen); } (*pScreen->CopyWindow) (pWin, ptOldOrg, pRegion); SCREEN_EPILOGUE (pScreen, CopyWindow, hpSpriteCopyWindow);}static voidhpSpriteClearToBackground (pWin, x, y, w, h, generateExposures) WindowPtr pWin; short x,y; unsigned short w,h; Bool generateExposures;{ ScreenPtr pScreen; hpPrivScreenPtr pScreenPriv; int realw, realh; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, ClearToBackground); pScreenPriv = getPrivScreenPtr(pScreen); if (pScreenPriv->cstate == CURSOR_ON) { if (!(realw = w)) realw = (int) pWin->drawable.width - x; if (!(realh = h)) realh = (int) pWin->drawable.height - y; if (ORG_OVERLAP(&pScreenPriv->saved, pWin->drawable.x, pWin->drawable.y, x, y, realw, realh)) { (*pScreenPriv->CursorOff) (pScreen); } } (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); SCREEN_EPILOGUE (pScreen, ClearToBackground, hpSpriteClearToBackground);}/* * GC Func wrappers */static voidhpSpriteValidateGC (pGC, changes, pDrawable) GCPtr pGC; Mask changes; DrawablePtr pDrawable;{ GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); pGCPriv->wrapOps = NULL; if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr) pDrawable)->viewable) { WindowPtr pWin; RegionPtr pRegion; pWin = (WindowPtr) pDrawable; pRegion = &pWin->clipList; if (pGC->subWindowMode == IncludeInferiors) pRegion = &pWin->borderClip; if ((*pDrawable->pScreen->RegionNotEmpty) (pRegion)) pGCPriv->wrapOps = pGC->ops; } GC_FUNC_EPILOGUE (pGC);}static voidhpSpriteChangeGC (pGC, mask) GCPtr pGC; unsigned long mask;{ GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); GC_FUNC_EPILOGUE (pGC);}static voidhpSpriteCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask;{ GC_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); GC_FUNC_EPILOGUE (pGCDst);}static voidhpSpriteDestroyGC (pGC) GCPtr pGC;{ GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC) (pGC); GC_FUNC_EPILOGUE (pGC);}static voidhpSpriteChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects;{ GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); GC_FUNC_EPILOGUE (pGC);}static voidhpSpriteCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc;{ GC_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); GC_FUNC_EPILOGUE (pgcDst);}static voidhpSpriteDestroyClip(pGC) GCPtr pGC;{ GC_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); GC_FUNC_EPILOGUE (pGC);}/* * GC Op wrappers */static voidhpSpriteFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr 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;{ GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = pptInit, widths = pwidthInit, nPts = nInit; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); GC_OP_EPILOGUE (pGC);}static voidhpSpriteSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; int *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted;{ GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); GC_OP_EPILOGUE (pGC);}static voidhpSpritePutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int leftPad; int format; char *pBits;{ GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { if (ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, x,y,w,h)) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); GC_OP_EPILOGUE (pGC);}static RegionPtrhpSpriteCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty;{ RegionPtr rgn; GC_SETUP(pDst, pGC); /* check destination/source overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { (*pScreenPriv->CursorOff) (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); GC_OP_EPILOGUE (pGC); return rgn;}static RegionPtrhpSpriteCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GC *pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane;{ RegionPtr rgn; GC_SETUP(pDst, pGC); /* * check destination/source for overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { (*pScreenPriv->CursorOff) (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); GC_OP_EPILOGUE (pGC); return rgn;}static voidhpSpritePolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit;{ xPoint t; int n; BoxRec cursor; register xPoint *pts; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor.x1 = pScreenPriv->saved.x1 - pDrawable->x; cursor.y1 = pScreenPriv->saved.y1 - pDrawable->y; cursor.x2 = pScreenPriv->saved.x2 - pDrawable->x; cursor.y2 = pScreenPriv->saved.y2 - pDrawable->y; if (mode == CoordModePrevious) { t.x = 0; t.y = 0; for (pts = pptInit, n = npt; n--; pts++) { t.x += pts->x; t.y += pts->y; if (cursor.x1 <= t.x && t.x <= cursor.x2 && cursor.y1 <= t.y && t.y <= cursor.y2) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } else { for (pts = pptInit, n = npt; n--; pts++) { if (cursor.x1 <= pts->x && pts->x <= cursor.x2 && cursor.y1 <= pts->y && pts->y <= cursor.y2) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC);}static voidhpSpritePolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit;{ BoxPtr cursor; register DDXPointPtr pts; int n; int x, y, x1, y1, x2, y2; int lw; int extra; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; lw = pGC->lineWidth; x = pptInit->x + pDrawable->x; y = pptInit->y + pDrawable->y; if (npt == 1) { extra = lw >> 1; if (LINE_OVERLAP(cursor, x, y, x, y, extra)) (*pScreenPriv->CursorOff) (pDrawable->pScreen); } else { extra = lw >> 1; /* * mitered joins can project quite a way from * the line end; the 11 degree miter limit limits * this extension to 10.43 * lw / 2, rounded up * and converted to int yields 6 * lw */ if (pGC->joinStyle == JoinMiter) extra = 6 * lw; else if (pGC->capStyle == CapProjecting) extra = lw; for (pts = pptInit + 1, n = npt - 1; n--; pts++) { x1 = x; y1 = y; if (mode == CoordModeOrigin) { x2 = pDrawable->x + pts->x; y2 = pDrawable->y + pts->y; } else { x2 = x + pts->x; y2 = y + pts->y; } x = x2; y = y2; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC);}static voidhpSpritePolySegment(pDrawable, pGC, nseg, pSegs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegs;{ int n; register xSegment *segs; BoxPtr cursor; int x1, y1, x2, y2; int extra; GC_SETUP(pDrawable, pGC); if (nseg && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; extra = pGC->lineWidth >> 1; if (pGC->capStyle == CapProjecting) extra = pGC->lineWidth; for (segs = pSegs, n = nseg; n--; segs++) { x1 = segs->x1 + pDrawable->x; y1 = segs->y1 + pDrawable->y; x2 = segs->x2 + pDrawable->x; y2 = segs->y2 + pDrawable->y; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { (*pScreenPriv->CursorOff) (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -