diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-09-19 07:25:55 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-09-19 07:25:55 -0400 |
commit | 97c150b61bbe436453b05d3c07cd2173870aac40 (patch) | |
tree | 5335d0df93703e7ca8617cfae57315709d032a29 /mi | |
parent | 57907e0943da0c3fd3bf6c128d210b544629ce72 (diff) | |
parent | 547ad2125ece93bbe01f6d09a3baf176ebd16bb3 (diff) |
Merge branch 'master' into XACE-SELINUX
Conflicts:
afb/afbpntwin.c
afb/afbscrinit.c
afb/afbwindow.c
cfb/cfb.h
cfb/cfballpriv.c
cfb/cfbscrinit.c
cfb/cfbwindow.c
configure.ac
fb/wfbrename.h
hw/xfree86/xf4bpp/ppcIO.c
hw/xfree86/xf4bpp/ppcPntWin.c
hw/xfree86/xf4bpp/ppcWindow.c
hw/xfree86/xf8_32bpp/cfbscrinit.c
mfb/mfb.h
mfb/mfbpntwin.c
mfb/mfbscrinit.c
mfb/mfbwindow.c
mi/miexpose.c
Note: conflicts caused by devPrivates rework vs. paintwindow changes.
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mibank.c | 71 | ||||
-rw-r--r-- | mi/miexpose.c | 341 | ||||
-rw-r--r-- | mi/mioverlay.c | 20 | ||||
-rw-r--r-- | mi/miscrinit.c | 2 | ||||
-rw-r--r-- | mi/miwindow.c | 6 |
5 files changed, 96 insertions, 344 deletions
diff --git a/mi/mibank.c b/mi/mibank.c index b52399cfe..05813e561 100644 --- a/mi/mibank.c +++ b/mi/mibank.c @@ -121,8 +121,6 @@ typedef struct _miBankScreen GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; CreateGCProcPtr CreateGC; - PaintWindowBackgroundProcPtr PaintWindowBackground; - PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; } miBankScreenRec, *miBankScreenPtr; @@ -1712,8 +1710,6 @@ miBankCloseScreen( SCREEN_UNWRAP(GetImage); SCREEN_UNWRAP(GetSpans); SCREEN_UNWRAP(CreateGC); - SCREEN_UNWRAP(PaintWindowBackground); - SCREEN_UNWRAP(PaintWindowBorder); SCREEN_UNWRAP(CopyWindow); Xfree(pScreenPriv); @@ -1878,71 +1874,6 @@ miBankCreateGC( } static void -miBankPaintWindow( - WindowPtr pWin, - RegionPtr pRegion, - int what -) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RegionRec tmpReg; - int i; - PaintWindowProcPtr PaintWindow; - - SCREEN_INIT; - SCREEN_SAVE; - - if (what == PW_BORDER) - { - SCREEN_UNWRAP(PaintWindowBorder); - PaintWindow = pScreen->PaintWindowBorder; - } - else - { - SCREEN_UNWRAP(PaintWindowBackground); - PaintWindow = pScreen->PaintWindowBackground; - } - - if (!IS_BANKED(pWin)) - { - (*PaintWindow)(pWin, pRegion, what); - } - else - { - REGION_NULL(pScreen, &tmpReg); - - for (i = 0; i < pScreenPriv->nBanks; i++) - { - if (!pScreenPriv->pBanks[i]) - continue; - - REGION_INTERSECT(pScreen, &tmpReg, pRegion, - pScreenPriv->pBanks[i]); - - if (REGION_NIL(&tmpReg)) - continue; - - SET_SINGLE_BANK(pScreenPriv->pScreenPixmap, -1, -1, i); - - (*PaintWindow)(pWin, &tmpReg, what); - } - - REGION_UNINIT(pScreen, &tmpReg); - } - - if (what == PW_BORDER) - { - SCREEN_WRAP(PaintWindowBorder, miBankPaintWindow); - } - else - { - SCREEN_WRAP(PaintWindowBackground, miBankPaintWindow); - } - - SCREEN_RESTORE; -} - -static void miBankCopyWindow( WindowPtr pWindow, DDXPointRec ptOldOrg, @@ -2263,8 +2194,6 @@ miInitializeBanking( SCREEN_WRAP(GetImage, miBankGetImage); SCREEN_WRAP(GetSpans, miBankGetSpans); SCREEN_WRAP(CreateGC, miBankCreateGC); - SCREEN_WRAP(PaintWindowBackground, miBankPaintWindow); - SCREEN_WRAP(PaintWindowBorder, miBankPaintWindow); SCREEN_WRAP(CopyWindow, miBankCopyWindow); dixSetPrivate(&pScreen->devPrivates, miBankScreenKey, pScreenPriv); diff --git a/mi/miexpose.c b/mi/miexpose.c index 352a160c6..6ace9f589 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -307,8 +307,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable, /* PaintWindowBackground doesn't clip, so we have to */ REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList); } - (*pWin->drawable.pScreen->PaintWindowBackground)( - (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); + miPaintWindow((WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { @@ -517,7 +516,7 @@ miWindowExposures(pWin, prgn, other_exposed) REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList); } if (prgn && !REGION_NIL(prgn)) - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); + miPaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested && exposures && !REGION_NIL(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); @@ -534,126 +533,91 @@ miWindowExposures(pWin, prgn, other_exposed) REGION_DESTROY( pWin->drawable.pScreen, exposures); } - -/* - this code is highly unlikely. it is not haile selassie. - - there is some hair here. we can't just use the window's -clip region as it is, because if we are painting the border, -the border is not in the client area and so we will be excluded -when we validate the GC, and if we are painting a parent-relative -background, the area we want to paint is in some other window. -since we trust the code calling us to tell us to paint only areas -that are really ours, we will temporarily give the window a -clipList the size of the whole screen and an origin at (0,0). -this more or less assumes that ddX code will do translation -based on the window's absolute position, and that ValidateGC will -look at clipList, and that no other fields from the -window will be used. it's not possible to just draw -in the root because it may be a different depth. - -to get the tile to align correctly we set the GC's tile origin to -be the (x,y) of the window's upper left corner, after which we -get the right bits when drawing into the root. - -because the clip_mask is being set to None, we may call DoChangeGC with -fPointer set true, thus we no longer need to install the background or -border tile in the resource table. -*/ - -static RESTYPE ResType = 0; -static int numGCs = 0; -static GCPtr screenContext[MAXSCREENS]; - -/*ARGSUSED*/ -static int -tossGC ( - pointer value, - XID id) -{ - GCPtr pGC = (GCPtr)value; - screenContext[pGC->pScreen->myNum] = (GCPtr)NULL; - FreeGC (pGC, id); - numGCs--; - if (!numGCs) - ResType = 0; - - return 0; -} - - _X_EXPORT void -miPaintWindow(pWin, prgn, what) -WindowPtr pWin; -RegionPtr prgn; -int what; +miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { - int status; - - Bool usingScratchGC = FALSE; - WindowPtr pRoot; - -#define FUNCTION 0 -#define FOREGROUND 1 -#define TILE 2 -#define FILLSTYLE 3 -#define ABSX 4 -#define ABSY 5 -#define CLIPMASK 6 -#define SUBWINDOW 7 -#define COUNT_BITS 8 - - ChangeGCVal gcval[7]; - ChangeGCVal newValues [COUNT_BITS]; - - BITS32 gcmask, index, mask; - RegionRec prgnWin; - DDXPointRec oldCorner; - BoxRec box; - WindowPtr pBgWin; - GCPtr pGC; - int i; - BoxPtr pbox; - ScreenPtr pScreen = pWin->drawable.pScreen; - xRectangle *prect; - int numRects; - - gcmask = 0; + ScreenPtr pScreen = pWin->drawable.pScreen; + ChangeGCVal gcval[5]; + BITS32 gcmask; + GCPtr pGC; + int i; + BoxPtr pbox; + xRectangle *prect; + int numRects; + /* + * Distance from screen to destination drawable, use this + * to adjust rendering coordinates which come in in screen space + */ + int draw_x_off, draw_y_off; + /* + * Tile offset for drawing; these need to align the tile + * to the appropriate window origin + */ + int tile_x_off, tile_y_off; + PixUnion fill; + Bool solid = TRUE; + DrawablePtr drawable = &pWin->drawable; if (what == PW_BACKGROUND) { + while (pWin->backgroundState == ParentRelative) + pWin = pWin->parent; + + draw_x_off = drawable->x; + draw_y_off = drawable->y; + + tile_x_off = 0; + tile_y_off = 0; + fill = pWin->background; switch (pWin->backgroundState) { case None: return; - case ParentRelative: - (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what); - return; - case BackgroundPixel: - newValues[FOREGROUND].val = pWin->background.pixel; - newValues[FILLSTYLE].val = FillSolid; - gcmask |= GCForeground | GCFillStyle; - break; case BackgroundPixmap: - newValues[TILE].ptr = (pointer)pWin->background.pixmap; - newValues[FILLSTYLE].val = FillTiled; - gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; + solid = FALSE; break; } } else { - if (pWin->borderIsPixel) - { - newValues[FOREGROUND].val = pWin->border.pixel; - newValues[FILLSTYLE].val = FillSolid; - gcmask |= GCForeground | GCFillStyle; - } - else - { - newValues[TILE].ptr = (pointer)pWin->border.pixmap; - newValues[FILLSTYLE].val = FillTiled; - gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; - } + PixmapPtr pixmap; + + tile_x_off = drawable->x; + tile_y_off = drawable->y; + + /* servers without pixmaps draw their own borders */ + if (!pScreen->GetWindowPixmap) + return; + pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable); + drawable = &pixmap->drawable; +#ifdef COMPOSITE + draw_x_off = pixmap->screen_x; + draw_y_off = pixmap->screen_y; + tile_x_off -= draw_x_off; + tile_y_off -= draw_y_off; +#else + draw_x_off = 0; + draw_y_off = 0; +#endif + fill = pWin->border; + solid = pWin->borderIsPixel; + } + + gcval[0].val = GXcopy; + gcmask = GCFunction; + + if (solid) + { + gcval[1].val = fill.pixel; + gcval[2].val = FillSolid; + gcmask |= GCForeground | GCFillStyle; + } + else + { + gcval[1].val = FillTiled; + gcval[2].ptr = (pointer)fill.pixmap; + gcval[3].val = tile_x_off; + gcval[4].val = tile_y_off; + gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; } prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * @@ -661,169 +625,30 @@ int what; if (!prect) return; - newValues[FUNCTION].val = GXcopy; - gcmask |= GCFunction | GCClipMask; - - i = pScreen->myNum; - pRoot = WindowTable[i]; - - pBgWin = pWin; - if (what == PW_BORDER) + pGC = GetScratchGC(drawable->depth, drawable->pScreen); + if (!pGC) { - while (pBgWin->backgroundState == ParentRelative) - pBgWin = pBgWin->parent; - } - - if ((pWin->drawable.depth != pRoot->drawable.depth) || - (pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel)) - { - usingScratchGC = TRUE; - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - if (!pGC) - { - DEALLOCATE_LOCAL(prect); - return; - } - /* - * mash the clip list so we can paint the border by - * mangling the window in place, pretending it - * spans the entire screen - */ - if (what == PW_BORDER) - { - prgnWin = pWin->clipList; - oldCorner.x = pWin->drawable.x; - oldCorner.y = pWin->drawable.y; - pWin->drawable.x = pWin->drawable.y = 0; - box.x1 = 0; - box.y1 = 0; - box.x2 = pScreen->width; - box.y2 = pScreen->height; - REGION_INIT(pScreen, &pWin->clipList, &box, 1); - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - newValues[ABSX].val = pBgWin->drawable.x; - newValues[ABSY].val = pBgWin->drawable.y; - } - else - { - newValues[ABSX].val = 0; - newValues[ABSY].val = 0; - } - } else { - /* - * draw the background to the root window - */ - if (screenContext[i] == (GCPtr)NULL) - { - if (!ResType && !(ResType = CreateNewResourceType(tossGC))) - return; - screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, - (XID *)NULL, &status, 0, serverClient); - if (!screenContext[i]) - return; - numGCs++; - if (!AddResource(FakeClientID(0), ResType, - (pointer)screenContext[i])) - return; - } - pGC = screenContext[i]; - newValues[SUBWINDOW].val = IncludeInferiors; - newValues[ABSX].val = pBgWin->drawable.x; - newValues[ABSY].val = pBgWin->drawable.y; - gcmask |= GCSubwindowMode; - pWin = pRoot; + DEALLOCATE_LOCAL(prect); + return; } - mask = gcmask; - gcmask = 0; - i = 0; - while (mask) { - index = lowbit (mask); - mask &= ~index; - switch (index) { - case GCFunction: - if (pGC->alu != newValues[FUNCTION].val) { - gcmask |= index; - gcval[i++].val = newValues[FUNCTION].val; - } - break; - case GCTileStipXOrigin: - if ( pGC->patOrg.x != newValues[ABSX].val) { - gcmask |= index; - gcval[i++].val = newValues[ABSX].val; - } - break; - case GCTileStipYOrigin: - if ( pGC->patOrg.y != newValues[ABSY].val) { - gcmask |= index; - gcval[i++].val = newValues[ABSY].val; - } - break; - case GCClipMask: - if ( pGC->clientClipType != CT_NONE) { - gcmask |= index; - gcval[i++].val = CT_NONE; - } - break; - case GCSubwindowMode: - if ( pGC->subWindowMode != newValues[SUBWINDOW].val) { - gcmask |= index; - gcval[i++].val = newValues[SUBWINDOW].val; - } - break; - case GCTile: - if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) - { - gcmask |= index; - gcval[i++].ptr = newValues[TILE].ptr; - } - break; - case GCFillStyle: - if ( pGC->fillStyle != newValues[FILLSTYLE].val) { - gcmask |= index; - gcval[i++].val = newValues[FILLSTYLE].val; - } - break; - case GCForeground: - if ( pGC->fgPixel != newValues[FOREGROUND].val) { - gcmask |= index; - gcval[i++].val = newValues[FOREGROUND].val; - } - break; - } - } - - if (gcmask) - dixChangeGC(NullClient, pGC, gcmask, NULL, gcval); - - if (pWin->drawable.serialNumber != pGC->serialNumber) - ValidateGC((DrawablePtr)pWin, pGC); + dixChangeGC (NullClient, pGC, gcmask, NULL, gcval); + ValidateGC (drawable, pGC); numRects = REGION_NUM_RECTS(prgn); pbox = REGION_RECTS(prgn); for (i= numRects; --i >= 0; pbox++, prect++) { - prect->x = pbox->x1 - pWin->drawable.x; - prect->y = pbox->y1 - pWin->drawable.y; + prect->x = pbox->x1 - draw_x_off; + prect->y = pbox->y1 - draw_y_off; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; - (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); + (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect); DEALLOCATE_LOCAL(prect); - if (usingScratchGC) - { - if (what == PW_BORDER) - { - REGION_UNINIT(pScreen, &pWin->clipList); - pWin->clipList = prgnWin; - pWin->drawable.x = oldCorner.x; - pWin->drawable.y = oldCorner.y; - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - FreeScratchGC(pGC); - } + FreeScratchGC(pGC); } diff --git a/mi/mioverlay.c b/mi/mioverlay.c index a1f32ad60..a0adac54d 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -856,9 +856,10 @@ miOverlayHandleExposures(WindowPtr pWin) while (1) { if((mival = pTree->valdata)) { if(!((*pPriv->InOverlay)(pTree->pWin))) { - if (REGION_NOTEMPTY(pScreen, &mival->borderExposed)) - (*pWin->drawable.pScreen->PaintWindowBorder)( - pTree->pWin, &mival->borderExposed, PW_BORDER); + if (REGION_NOTEMPTY(pScreen, &mival->borderExposed)) { + miPaintWindow(pTree->pWin, &mival->borderExposed, + PW_BORDER); + } REGION_UNINIT(pScreen, &mival->borderExposed); (*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion); @@ -894,10 +895,10 @@ miOverlayHandleExposures(WindowPtr pWin) REGION_RECTS(&val->after.exposed)); } } else { - if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) - (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, - &val->after.borderExposed, - PW_BORDER); + if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) { + miPaintWindow(pChild, &val->after.borderExposed, + PW_BORDER); + } (*WindowExposures)(pChild, &val->after.exposed, NullRegion); } REGION_UNINIT(pScreen, &val->after.borderExposed); @@ -1057,8 +1058,7 @@ miOverlayWindowExposures( REGION_INTERSECT(pScreen, prgn, prgn, &pWin->clipList); } if (prgn && !REGION_NIL(prgn)) - (*pScreen->PaintWindowBackground)( - pWin, prgn, PW_BACKGROUND); + miPaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested && exposures && !REGION_NIL(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); @@ -1729,7 +1729,7 @@ miOverlayClearToBackground( if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) - (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); + miPaintWindow(pWin, ®, PW_BACKGROUND); REGION_UNINIT(pScreen, ®); if (pBSReg) REGION_DESTROY(pScreen, pBSReg); diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 2dd8cd955..0dc6a437a 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -251,7 +251,7 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, pScreen->ValidateTree = miValidateTree; pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; pScreen->WindowExposures = miWindowExposures; - /* PaintWindowBackground, PaintWindowBorder, CopyWindow */ + /* CopyWindow */ pScreen->ClearToBackground = miClearToBackground; pScreen->ClipNotify = (ClipNotifyProcPtr) 0; pScreen->RestackWindow = (RestackWindowProcPtr) 0; diff --git a/mi/miwindow.c b/mi/miwindow.c index cab67ea07..77cb75009 100644 --- a/mi/miwindow.c +++ b/mi/miwindow.c @@ -118,7 +118,7 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) - (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); + miPaintWindow(pWin, ®, PW_BACKGROUND); REGION_UNINIT(pScreen, ®); if (pBSReg) REGION_DESTROY(pScreen, pBSReg); @@ -451,9 +451,7 @@ miHandleValidateExposures(pWin) if ( (val = pChild->valdata) ) { if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) - (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, - &val->after.borderExposed, - PW_BORDER); + miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER); REGION_UNINIT(pScreen, &val->after.borderExposed); (*WindowExposures)(pChild, &val->after.exposed, NullRegion); REGION_UNINIT(pScreen, &val->after.exposed); |