📄 mibstore.c
字号:
x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); return result;}/*- *----------------------------------------------------------------------- * miBSImageText8 -- * Perform a ImageText8, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */static voidmiBSImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars;{ SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText8)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC);}/*- *----------------------------------------------------------------------- * miBSImageText16 -- * Perform a ImageText16, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */static voidmiBSImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars;{ SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText16)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC);}/*- *----------------------------------------------------------------------- * miBSImageGlyphBlt -- * Perform a ImageGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */static voidmiBSImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */{ SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->ImageGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC);}/*- *----------------------------------------------------------------------- * miBSPolyGlyphBlt -- * Perform a PolyGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */static voidmiBSPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */{ SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->PolyGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC);}/*- *----------------------------------------------------------------------- * miBSPushPixels -- * Perform a PushPixels, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */static voidmiBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDst; int w, h, x, y;{ SETUP_BACKING (pDst, pGC); PROLOGUE(pGC); (* pGC->ops->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); if (pGC->miTranslate) { x -= pDst->x; y -= pDst->y; } (* pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDrawable, w, h, x - pBackingStore->x, y - pBackingStore->y); EPILOGUE (pGC);}#ifdef NEED_LINEHELPER/*- *----------------------------------------------------------------------- * miBSLineHelper -- * * Results: should never be called * * Side Effects: server dies * *----------------------------------------------------------------------- */static voidmiBSLineHelper(){ FatalError("miBSLineHelper called\n");}#endif/*- *----------------------------------------------------------------------- * miBSClearBackingStore -- * Clear the given area of the backing pixmap with the background of * the window, whatever it is. If generateExposures is TRUE, generate * exposure events for the area. Note that if the area has any * part outside the saved portions of the window, we do not allow the * count in the expose events to be 0, since there will be more * expose events to come. * * Results: * None. * * Side Effects: * Areas of pixmap are cleared and Expose events are generated. * *----------------------------------------------------------------------- */static RegionPtrmiBSClearBackingStore(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x; int y; int w; int h; Bool generateExposures;{ RegionPtr pRgn; int i; miBSWindowPtr pBackingStore; ScreenPtr pScreen; GCPtr pGC; int ts_x_origin, ts_y_origin; pointer gcvalues[4]; unsigned long gcmask; xRectangle *rects; BoxPtr pBox; BoxRec box; PixUnion background; char backgroundState; int numRects; pBackingStore = (miBSWindowPtr)pWin->backStorage; pScreen = pWin->drawable.pScreen; if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return NullRegion; if (w == 0) w = (int) pWin->drawable.width - x; if (h == 0) h = (int) pWin->drawable.height - y; box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); if (!pRgn) return NullRegion; REGION_INTERSECT( pScreen, pRgn, pRgn, &pBackingStore->SavedRegion); if (REGION_NOTEMPTY( pScreen, pRgn)) { /* * if clearing entire window, simply make new virtual * tile. For the root window, we also destroy the pixmap * to save a pile of memory */ if (x == 0 && y == 0 && w == pWin->drawable.width && h == pWin->drawable.height) { if (!pWin->parent) miDestroyBSPixmap (pWin); if (pBackingStore->status != StatusContents) miTileVirtualBS (pWin); } ts_x_origin = ts_y_origin = 0; backgroundState = pWin->backgroundState; background = pWin->background; if (backgroundState == ParentRelative) { WindowPtr pParent; pParent = pWin; while (pParent->backgroundState == ParentRelative) { ts_x_origin -= pParent->origin.x; ts_y_origin -= pParent->origin.y; pParent = pParent->parent; } backgroundState = pParent->backgroundState; background = pParent->background; } if ((backgroundState != None) && ((pBackingStore->status == StatusContents) || !SameBackground (pBackingStore->backgroundState, pBackingStore->background, backgroundState, background))) { if (!pBackingStore->pBackingPixmap) miCreateBSPixmap(pWin, NullBox); pGC = GetScratchGC(pWin->drawable.depth, pScreen); if (pGC && pBackingStore->pBackingPixmap) { /* * First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ if (backgroundState == BackgroundPixel) { gcvalues[0] = (pointer) background.pixel; gcvalues[1] = (pointer)FillSolid; gcmask = GCForeground|GCFillStyle; } else { gcvalues[0] = (pointer)FillTiled; gcvalues[1] = (pointer) background.pixmap; gcmask = GCFillStyle|GCTile; } gcvalues[2] = (pointer)(ts_x_origin - pBackingStore->x); gcvalues[3] = (pointer)(ts_y_origin - pBackingStore->y); gcmask |= GCTileStipXOrigin|GCTileStipYOrigin; DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE); ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC); /* * Figure out the array of rectangles to fill and fill them with * PolyFillRect in the proper mode, as set in the GC above. */ numRects = REGION_NUM_RECTS(pRgn); rects = (xRectangle *)ALLOCATE_LOCAL(numRects*sizeof(xRectangle)); if (rects) { for (i = 0, pBox = REGION_RECTS(pRgn); i < numRects; i++, pBox++) { rects[i].x = pBox->x1 - pBackingStore->x; rects[i].y = pBox->y1 - pBackingStore->y; rects[i].width = pBox->x2 - pBox->x1; rects[i].height = pBox->y2 - pBox->y1; } (* pGC->ops->PolyFillRect) ( (DrawablePtr)pBackingStore->pBackingPixmap, pGC, numRects, rects); DEALLOCATE_LOCAL(rects); } FreeScratchGC(pGC); } } if (!generateExposures) { REGION_DESTROY(pScreen, pRgn); pRgn = NULL; } else { /* * result must be screen relative, but is currently * drawable relative. */ REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y); } } else { REGION_DESTROY( pScreen, pRgn); pRgn = NULL; } return pRgn;}static voidmiBSClearBackingRegion (pWin, pRgn) WindowPtr pWin; RegionPtr pRgn;{ BoxPtr pBox; int i; i = REGION_NUM_RECTS(pRgn); pBox = REGION_RECTS(pRgn); while (i--) { (void) miBSClearBackingStore(pWin, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, FALSE); pBox++; }}/* * fill a region of the destination with virtual bits * * pRgn is to be translated by (x,y) */static voidmiBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) DrawablePtr pDrawable; GCPtr pGC; RegionPtr pRgn; int x, y; int state; PixUnion pixunion; unsigned long planeMask;{ int i; BITS32 gcmask; pointer gcval[5]; xRectangle *pRect; BoxPtr pBox; WindowPtr pWin; int numRects; if (state == None) return; numRects = REGION_NUM_RECTS(pRgn); pRect = (xRectangle *)ALLOCATE_LOCAL(numRects * sizeof(xRectangle)); if (!pRect) return; pWin = 0; if (pDrawable->type != DRAWABLE_PIXMAP) { pWin = (WindowPtr) pDrawable; if (!pWin->backStorage) pWin = 0; } i = 0; gcmask = 0; gcval[i++] = (pointer)planeMask; gcmask |= GCPlaneMask; if (state == BackgroundPixel) { if (pGC->fgPixel != pixunion.pixel) { gcval[i++] = (pointer)pixunion.pixel; gcmask |= GCForeground; } if (pGC->fillStyle != FillSolid) { gcval[i++] = (pointer)FillSolid; gcmask |= GCFillStyle; } } else { if (pGC->fillStyle != FillTiled) { gcval[i++] = (pointer)FillTiled; gcmask |= GCFillStyle; } if (pGC->tileIsPixel || pGC->tile.pixmap != pixunion.pixmap) { gcval[i++] = (pointer)pixunion.pixmap; gcmask |= GCTile; } if (pGC->patOrg.x != x) { gcval[i++] = (pointer)x; gcmask |= GCTileStipXOrigin; } if (pGC->patOrg.y != y) { gcval[i++] = (pointer)y; gcmask |= GCTileStipYOrigin; } } if (gcmask) DoChangeGC (pGC, gcmask, (XID *)gcval, 1); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); if (pDrawable->serialNumber != pGC->serialNumber) ValidateGC (pDrawable, pGC); pBox = REGION_RECTS(pRgn); for (i = numRects; --i >= 0; pBox++, pRect++) { pRect->x = pBox->x1 + x; pRect->y = pBox->y1 + y; pRect->width = pBox->x2 - pBox->x1; pRect->height = pBox->y2 - pBox->y1; } pRect -= numRects; (*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); DEALLOCATE_LOCAL (pRect);}/*- *----------------------------------------------------------------------- * miBSAllocate -- * Create and install backing store info for a window * *-------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -