e:/XFree86 for RH 8.0/XFree86-4.2.0/xc/programs/Xserver/mi/miexpose.c File Reference

Go to the source code of this file.

Functions

RegionPtr miHandleExposures (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long plane)
void miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, int major, int minor)
void miSendExposures (WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
void miWindowExposures (WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
int tossGC (pointer value, XID id)
void miPaintWindow (WindowPtr pWin, RegionPtr prgn, int what)
void miClearDrawable (DrawablePtr pDraw, GCPtr pGC)

Variables

RESTYPE ResType = 0
int numGCs = 0
GCPtr screenContext [MAXSCREENS]


Function Documentation

RegionPtr miHandleExposures DrawablePtr  pSrcDrawable,
DrawablePtr  pDstDrawable,
GCPtr  pGC,
int  srcx,
int  srcy,
int  width,
int  height,
int  dstx,
int  dsty,
unsigned long  plane
 

Definition at line 102 of file miexpose.c.

References _Window::backStorage, Bool, box, _Screen::ClearBackingStore, _Window::clipList, _Window::drawable, _Screen::ExposeCopy, _GC::graphicsExposures, height, _Screen::PaintWindowBackground, _Drawable::pScreen, _GC::pScreen, pWin, _GC::subWindowMode, width, _Box::x1, _Box::x2, _Box::y1, and _Box::y2.

Referenced by afbBitBlt(), afbCopyPlane(), cfbBitBlt(), cfbCopyPlane(), CreatorCopyPlane(), fbCopyPlane(), fbDoCopy(), ilbmBitBlt(), ilbmCopyPlane(), iplBitBlt(), iplCopyPlane(), mfbCopyArea(), miBankCopy(), miCopyArea(), miCopyPlane(), sunGXCopyPlane(), XAABitBlt(), and xf4bppCopyArea().

00111 { 00112 register ScreenPtr pscr; 00113 RegionPtr prgnSrcClip; /* drawable-relative source clip */ 00114 RegionRec rgnSrcRec; 00115 RegionPtr prgnDstClip; /* drawable-relative dest clip */ 00116 RegionRec rgnDstRec; 00117 BoxRec srcBox; /* unclipped source */ 00118 RegionRec rgnExposed; /* exposed region, calculated source- 00119 relative, made dst relative to 00120 intersect with visible parts of 00121 dest and send events to client, 00122 and then screen relative to paint 00123 the window background 00124 */ 00125 WindowPtr pSrcWin; 00126 BoxRec expBox; 00127 Bool extents; 00128 00129 /* This prevents warning about pscr not being used. */ 00130 pGC->pScreen = pscr = pGC->pScreen; 00131 00132 /* avoid work if we can */ 00133 if (!pGC->graphicsExposures && 00134 (pDstDrawable->type == DRAWABLE_PIXMAP) && 00135 ((pSrcDrawable->type == DRAWABLE_PIXMAP) || 00136 (((WindowPtr)pSrcDrawable)->backStorage == NULL))) 00137 return NULL; 00138 00139 srcBox.x1 = srcx; 00140 srcBox.y1 = srcy; 00141 srcBox.x2 = srcx+width; 00142 srcBox.y2 = srcy+height; 00143 00144 if (pSrcDrawable->type != DRAWABLE_PIXMAP) 00145 { 00146 BoxRec TsrcBox; 00147 00148 TsrcBox.x1 = srcx + pSrcDrawable->x; 00149 TsrcBox.y1 = srcy + pSrcDrawable->y; 00150 TsrcBox.x2 = TsrcBox.x1 + width; 00151 TsrcBox.y2 = TsrcBox.y1 + height; 00152 pSrcWin = (WindowPtr) pSrcDrawable; 00153 if (pGC->subWindowMode == IncludeInferiors) 00154 { 00155 prgnSrcClip = NotClippedByChildren (pSrcWin); 00156 if ((RECT_IN_REGION(pscr, prgnSrcClip, &TsrcBox)) == rgnIN) 00157 { 00158 REGION_DESTROY(pscr, prgnSrcClip); 00159 return NULL; 00160 } 00161 } 00162 else 00163 { 00164 if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN) 00165 return NULL; 00166 prgnSrcClip = &rgnSrcRec; 00167 REGION_INIT(pscr, prgnSrcClip, NullBox, 0); 00168 REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList); 00169 } 00170 REGION_TRANSLATE(pscr, prgnSrcClip, 00171 -pSrcDrawable->x, -pSrcDrawable->y); 00172 } 00173 else 00174 { 00175 BoxRec box; 00176 00177 if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && 00178 (srcBox.x2 <= pSrcDrawable->width) && 00179 (srcBox.y2 <= pSrcDrawable->height)) 00180 return NULL; 00181 00182 box.x1 = 0; 00183 box.y1 = 0; 00184 box.x2 = pSrcDrawable->width; 00185 box.y2 = pSrcDrawable->height; 00186 prgnSrcClip = &rgnSrcRec; 00187 REGION_INIT(pscr, prgnSrcClip, &box, 1); 00188 pSrcWin = (WindowPtr)NULL; 00189 } 00190 00191 if (pDstDrawable == pSrcDrawable) 00192 { 00193 prgnDstClip = prgnSrcClip; 00194 } 00195 else if (pDstDrawable->type != DRAWABLE_PIXMAP) 00196 { 00197 if (pGC->subWindowMode == IncludeInferiors) 00198 { 00199 prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable); 00200 } 00201 else 00202 { 00203 prgnDstClip = &rgnDstRec; 00204 REGION_INIT(pscr, prgnDstClip, NullBox, 0); 00205 REGION_COPY(pscr, prgnDstClip, 00206 &((WindowPtr)pDstDrawable)->clipList); 00207 } 00208 REGION_TRANSLATE(pscr, prgnDstClip, 00209 -pDstDrawable->x, -pDstDrawable->y); 00210 } 00211 else 00212 { 00213 BoxRec box; 00214 00215 box.x1 = 0; 00216 box.y1 = 0; 00217 box.x2 = pDstDrawable->width; 00218 box.y2 = pDstDrawable->height; 00219 prgnDstClip = &rgnDstRec; 00220 REGION_INIT(pscr, prgnDstClip, &box, 1); 00221 } 00222 00223 /* drawable-relative source region */ 00224 REGION_INIT(pscr, &rgnExposed, &srcBox, 1); 00225 00226 /* now get the hidden parts of the source box*/ 00227 REGION_SUBTRACT(pscr, &rgnExposed, &rgnExposed, prgnSrcClip); 00228 00229 if (pSrcWin && pSrcWin->backStorage) 00230 { 00231 /* 00232 * Copy any areas from the source backing store. Modifies 00233 * rgnExposed. 00234 */ 00235 (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, 00236 pDstDrawable, 00237 pGC, 00238 &rgnExposed, 00239 srcx, srcy, 00240 dstx, dsty, 00241 plane); 00242 } 00243 00244 /* move them over the destination */ 00245 REGION_TRANSLATE(pscr, &rgnExposed, dstx-srcx, dsty-srcy); 00246 00247 /* intersect with visible areas of dest */ 00248 REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, prgnDstClip); 00249 00250 /* 00251 * If we have LOTS of rectangles, we decide to take the extents 00252 * and force an exposure on that. This should require much less 00253 * work overall, on both client and server. This is cheating, but 00254 * isn't prohibited by the protocol ("spontaneous combustion" :-) 00255 * for windows. 00256 */ 00257 extents = pGC->graphicsExposures && 00258 (REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) && 00259 (pDstDrawable->type != DRAWABLE_PIXMAP); 00260 #ifdef SHAPE 00261 if (pSrcWin) 00262 { 00263 RegionPtr region; 00264 if (!(region = wClipShape (pSrcWin))) 00265 region = wBoundingShape (pSrcWin); 00266 /* 00267 * If you try to CopyArea the extents of a shaped window, compacting the 00268 * exposed region will undo all our work! 00269 */ 00270 if (extents && pSrcWin && region && 00271 (RECT_IN_REGION(pscr, region, &srcBox) != rgnIN)) 00272 extents = FALSE; 00273 } 00274 #endif 00275 if (extents) 00276 { 00277 WindowPtr pWin = (WindowPtr)pDstDrawable; 00278 00279 expBox = *REGION_EXTENTS(pscr, &rgnExposed); 00280 REGION_RESET(pscr, &rgnExposed, &expBox); 00281 /* need to clear out new areas of backing store */ 00282 if (pWin->backStorage) 00283 (void) (* pWin->drawable.pScreen->ClearBackingStore)( 00284 pWin, 00285 expBox.x1, 00286 expBox.y1, 00287 expBox.x2 - expBox.x1, 00288 expBox.y2 - expBox.y1, 00289 FALSE); 00290 } 00291 if ((pDstDrawable->type != DRAWABLE_PIXMAP) && 00292 (((WindowPtr)pDstDrawable)->backgroundState != None)) 00293 { 00294 WindowPtr pWin = (WindowPtr)pDstDrawable; 00295 00296 /* make the exposed area screen-relative */ 00297 REGION_TRANSLATE(pscr, &rgnExposed, 00298 pDstDrawable->x, pDstDrawable->y); 00299 00300 if (extents) 00301 { 00302 /* PaintWindowBackground doesn't clip, so we have to */ 00303 REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList); 00304 } 00305 (*pWin->drawable.pScreen->PaintWindowBackground)( 00306 (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); 00307 00308 if (extents) 00309 { 00310 REGION_RESET(pscr, &rgnExposed, &expBox); 00311 } 00312 else 00313 REGION_TRANSLATE(pscr, &rgnExposed, 00314 -pDstDrawable->x, -pDstDrawable->y); 00315 } 00316 if (prgnDstClip == &rgnDstRec) 00317 { 00318 REGION_UNINIT(pscr, prgnDstClip); 00319 } 00320 else if (prgnDstClip != prgnSrcClip) 00321 { 00322 REGION_DESTROY(pscr, prgnDstClip); 00323 } 00324 00325 if (prgnSrcClip == &rgnSrcRec) 00326 { 00327 REGION_UNINIT(pscr, prgnSrcClip); 00328 } 00329 else 00330 { 00331 REGION_DESTROY(pscr, prgnSrcClip); 00332 } 00333 00334 if (pGC->graphicsExposures) 00335 { 00336 /* don't look */ 00337 RegionPtr exposed = REGION_CREATE(pscr, NullBox, 0); 00338 *exposed = rgnExposed; 00339 return exposed; 00340 } 00341 else 00342 { 00343 REGION_UNINIT(pscr, &rgnExposed); 00344 return NULL; 00345 } 00346 }

void miSendGraphicsExpose ClientPtr  client,
RegionPtr  pRgn,
XID  drawable,
int  major,
int  minor
 

Definition at line 351 of file miexpose.c.

References client, drawable, event, i, major, minor, pBox, TryClientEvents(), _Box::x1, _Box::x2, _Box::y1, and _Box::y2.

Referenced by miScreenInit().

00357 { 00358 if (pRgn && !REGION_NIL(pRgn)) 00359 { 00360 xEvent *pEvent; 00361 register xEvent *pe; 00362 register BoxPtr pBox; 00363 register int i; 00364 int numRects; 00365 00366 numRects = REGION_NUM_RECTS(pRgn); 00367 pBox = REGION_RECTS(pRgn); 00368 if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) 00369 return; 00370 pe = pEvent; 00371 00372 for (i=1; i<=numRects; i++, pe++, pBox++) 00373 { 00374 pe->u.u.type = GraphicsExpose; 00375 pe->u.graphicsExposure.drawable = drawable; 00376 pe->u.graphicsExposure.x = pBox->x1; 00377 pe->u.graphicsExposure.y = pBox->y1; 00378 pe->u.graphicsExposure.width = pBox->x2 - pBox->x1; 00379 pe->u.graphicsExposure.height = pBox->y2 - pBox->y1; 00380 pe->u.graphicsExposure.count = numRects - i; 00381 pe->u.graphicsExposure.majorEvent = major; 00382 pe->u.graphicsExposure.minorEvent = minor; 00383 } 00384 TryClientEvents(client, pEvent, numRects, 00385 (Mask)0, NoEventMask, NullGrab); 00386 DEALLOCATE_LOCAL(pEvent); 00387 } 00388 else 00389 { 00390 xEvent event; 00391 event.u.u.type = NoExpose; 00392 event.u.noExposure.drawable = drawable; 00393 event.u.noExposure.majorEvent = major; 00394 event.u.noExposure.minorEvent = minor; 00395 TryClientEvents(client, &event, 1, 00396 (Mask)0, NoEventMask, NullGrab); 00397 } 00398 }

void miSendExposures WindowPtr  pWin,
RegionPtr  pRgn,
int  dx,
int  dy
 

Definition at line 402 of file miexpose.c.

References DeliverEvents(), _Window::drawable, dx, dy, i, _Drawable::id, LookupIDByType(), _Screen::myNum, noPanoramiXExtension, panoramiXdataPtr, PanoramiXFindIDByScrnum(), _Window::parent, pBox, _Drawable::pScreen, pWin, win, WindowTable, _PanoramiXData::x, x, _Box::x1, _Box::x2, XRT_WINDOW, _PanoramiXData::y, y, _Box::y1, and _Box::y2.

Referenced by miBSAllocate(), miCreateBSPixmap(), miOverlayWindowExposures(), and miWindowExposures().

00406 { 00407 register BoxPtr pBox; 00408 int numRects; 00409 register xEvent *pEvent, *pe; 00410 register int i; 00411 00412 pBox = REGION_RECTS(pRgn); 00413 numRects = REGION_NUM_RECTS(pRgn); 00414 if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) 00415 return; 00416 00417 for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) 00418 { 00419 pe->u.u.type = Expose; 00420 pe->u.expose.window = pWin->drawable.id; 00421 pe->u.expose.x = pBox->x1 - dx; 00422 pe->u.expose.y = pBox->y1 - dy; 00423 pe->u.expose.width = pBox->x2 - pBox->x1; 00424 pe->u.expose.height = pBox->y2 - pBox->y1; 00425 pe->u.expose.count = i; 00426 } 00427 00428 #ifdef PANORAMIX 00429 if(!noPanoramiXExtension) { 00430 int scrnum = pWin->drawable.pScreen->myNum; 00431 int x = 0, y = 0; 00432 XID realWin = 0; 00433 00434 if(!pWin->parent) { 00435 x = panoramiXdataPtr[scrnum].x; 00436 y = panoramiXdataPtr[scrnum].y; 00437 pWin = WindowTable[0]; 00438 realWin = pWin->drawable.id; 00439 } else if (scrnum) { 00440 PanoramiXRes *win; 00441 win = PanoramiXFindIDByScrnum(XRT_WINDOW, 00442 pWin->drawable.id, scrnum); 00443 if(!win) { 00444 DEALLOCATE_LOCAL(pEvent); 00445 return; 00446 } 00447 realWin = win->info[0].id; 00448 pWin = LookupIDByType(realWin, RT_WINDOW); 00449 } 00450 if(x || y || scrnum) 00451 for (i = 0; i < numRects; i++) { 00452 pEvent[i].u.expose.window = realWin; 00453 pEvent[i].u.expose.x += x; 00454 pEvent[i].u.expose.y += y; 00455 } 00456 } 00457 #endif 00458 00459 DeliverEvents(pWin, pEvent, numRects, NullWindow); 00460 00461 DEALLOCATE_LOCAL(pEvent); 00462 }

void miWindowExposures WindowPtr  pWin,
RegionPtr  prgn,
RegionPtr  other_exposed
 

Definition at line 465 of file miexpose.c.

References _Window::backStorage, box, _Screen::ClearBackingStore, _Window::clipList, _Window::drawable, _Window::eventMask, miSendExposures(), _Screen::PaintWindowBackground, _Drawable::pScreen, pWin, _Screen::RestoreAreas, _Drawable::x, _Box::x1, _Box::x2, _Drawable::y, _Box::y1, and _Box::y2.

Referenced by cfb8_16WindowExposures(), cfb8_32WidWindowExposures(), fbOverlayWindowExposures(), FFBAccelInit(), miScreenInit(), XAAOverWindowExposures(), xnestCollectExposures(), and xnestWindowExposures().

00468 { 00469 RegionPtr exposures = prgn; 00470 if (pWin->backStorage && prgn) 00471 /* 00472 * in some cases, backing store will cause a different 00473 * region to be exposed than needs to be repainted 00474 * (like when a window is mapped). RestoreAreas is 00475 * allowed to return a region other than prgn, 00476 * in which case this routine will free the resultant 00477 * region. If exposures is null, then no events will 00478 * be sent to the client; if prgn is empty 00479 * no areas will be repainted. 00480 */ 00481 exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); 00482 if ((prgn && !REGION_NIL(prgn)) || 00483 (exposures && !REGION_NIL(exposures)) || other_exposed) 00484 { 00485 RegionRec expRec; 00486 int clientInterested; 00487 00488 /* 00489 * Restore from backing-store FIRST. 00490 */ 00491 clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; 00492 if (other_exposed) 00493 { 00494 if (exposures) 00495 { 00496 REGION_UNION(pWin->drawable.pScreen, other_exposed, 00497 exposures, 00498 other_exposed); 00499 if (exposures != prgn) 00500 REGION_DESTROY(pWin->drawable.pScreen, exposures); 00501 } 00502 exposures = other_exposed; 00503 } 00504 if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT)) 00505 { 00506 /* 00507 * If we have LOTS of rectangles, we decide to take the extents 00508 * and force an exposure on that. This should require much less 00509 * work overall, on both client and server. This is cheating, but 00510 * isn't prohibited by the protocol ("spontaneous combustion" :-). 00511 */ 00512 BoxRec box; 00513 00514 box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures); 00515 if (exposures == prgn) { 00516 exposures = &expRec; 00517 REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1); 00518 REGION_RESET( pWin->drawable.pScreen, prgn, &box); 00519 } else { 00520 REGION_RESET( pWin->drawable.pScreen, exposures, &box); 00521 REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures); 00522 } 00523 /* PaintWindowBackground doesn't clip, so we have to */ 00524 REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList); 00525 /* need to clear out new areas of backing store, too */ 00526 if (pWin->backStorage) 00527 (void) (* pWin->drawable.pScreen->ClearBackingStore)( 00528 pWin, 00529 box.x1 - pWin->drawable.x, 00530 box.y1 - pWin->drawable.y, 00531 box.x2 - box.x1, 00532 box.y2 - box.y1, 00533 FALSE); 00534 } 00535 if (prgn && !REGION_NIL(prgn)) 00536 (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); 00537 if (clientInterested && exposures && !REGION_NIL(exposures)) 00538 miSendExposures(pWin, exposures, 00539 pWin->drawable.x, pWin->drawable.y); 00540 if (exposures == &expRec) 00541 { 00542 REGION_UNINIT( pWin->drawable.pScreen, exposures); 00543 } 00544 else if (exposures && exposures != prgn && exposures != other_exposed) 00545 REGION_DESTROY( pWin->drawable.pScreen, exposures); 00546 if (prgn) 00547 REGION_EMPTY( pWin->drawable.pScreen, prgn); 00548 } 00549 else if (exposures && exposures != prgn) 00550 REGION_DESTROY( pWin->drawable.pScreen, exposures); 00551 }

int tossGC pointer  value,
XID  id
[static]
 

Definition at line 586 of file miexpose.c.

References FreeGC(), _Screen::myNum, numGCs, _GC::pScreen, ResType, screenContext, and value.

Referenced by miDCCloseScreen(), and miPaintWindow().

00589 { 00590 GCPtr pGC = (GCPtr)value; 00591 screenContext[pGC->pScreen->myNum] = (GCPtr)NULL; 00592 FreeGC (pGC, id); 00593 numGCs--; 00594 if (!numGCs) 00595 ResType = 0; 00596 00597 return 0; 00598 }

void miPaintWindow WindowPtr  pWin,
RegionPtr  prgn,
int  what
 

Definition at line 602 of file miexpose.c.

References AddResource(), _Window::background, _Window::backgroundState, _Window::backStorage, _Drawable::bitsPerPixel, Bool, _Window::border, _Window::borderIsPixel, box, _Window::clipList, CreateGC(), CreateNewResourceType(), DDXPointRec, _Drawable::depth, dixChangeGC(), _Window::drawable, _Screen::DrawGuarantee, FakeClientID(), FreeScratchGC(), GetScratchGC(), _Screen::height, i, index, mask, _Screen::myNum, newValues, numGCs, _Screen::PaintWindowBackground, _Window::parent, _PixUnion::pixel, _PixUnion::pixmap, pointer, _Drawable::pScreen, pScreen, ChangeGCVal::ptr, pWin, ResType, screenContext, _Drawable::serialNumber, status, tossGC(), ChangeGCVal::val, ValidateGC(), what, _Screen::width, WindowTable, _Drawable::x, _Box::x1, _Box::x2, _Drawable::y, _Box::y1, and _Box::y2.

Referenced by afbPaintWindow(), ilbmPaintWindow(), mfbPaintWindow(), winFinishScreenInitNativeGDI(), and xf4bppPaintWindow().

00606 { 00607 int status; 00608 00609 Bool usingScratchGC = FALSE; 00610 WindowPtr pRoot; 00611 00612 #define FUNCTION 0 00613 #define FOREGROUND 1 00614 #define TILE 2 00615 #define FILLSTYLE 3 00616 #define ABSX 4 00617 #define ABSY 5 00618 #define CLIPMASK 6 00619 #define SUBWINDOW 7 00620 #define COUNT_BITS 8 00621 00622 ChangeGCVal gcval[7]; 00623 ChangeGCVal newValues [COUNT_BITS]; 00624 00625 BITS32 gcmask, index, mask; 00626 RegionRec prgnWin; 00627 DDXPointRec oldCorner; 00628 BoxRec box; 00629 WindowPtr pBgWin; 00630 GCPtr pGC; 00631 register int i; 00632 register BoxPtr pbox; 00633 register ScreenPtr pScreen = pWin->drawable.pScreen; 00634 register xRectangle *prect; 00635 int numRects; 00636 00637 gcmask = 0; 00638 00639 if (what == PW_BACKGROUND) 00640 { 00641 switch (pWin->backgroundState) { 00642 case None: 00643 return; 00644 case ParentRelative: 00645 (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what); 00646 return; 00647 case BackgroundPixel: 00648 newValues[FOREGROUND].val = pWin->background.pixel; 00649 newValues[FILLSTYLE].val = FillSolid; 00650 gcmask |= GCForeground | GCFillStyle; 00651 break; 00652 case BackgroundPixmap: 00653 newValues[TILE].ptr = (pointer)pWin->background.pixmap; 00654 newValues[FILLSTYLE].val = FillTiled; 00655 gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; 00656 break; 00657 } 00658 } 00659 else 00660 { 00661 if (pWin->borderIsPixel) 00662 { 00663 newValues[FOREGROUND].val = pWin->border.pixel; 00664 newValues[FILLSTYLE].val = FillSolid; 00665 gcmask |= GCForeground | GCFillStyle; 00666 } 00667 else 00668 { 00669 newValues[TILE].ptr = (pointer)pWin->border.pixmap; 00670 newValues[FILLSTYLE].val = FillTiled; 00671 gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; 00672 } 00673 } 00674 00675 prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * 00676 sizeof(xRectangle)); 00677 if (!prect) 00678 return; 00679 00680 newValues[FUNCTION].val = GXcopy; 00681 gcmask |= GCFunction | GCClipMask; 00682 00683 i = pScreen->myNum; 00684 pRoot = WindowTable[i]; 00685 00686 pBgWin = pWin; 00687 if (what == PW_BORDER) 00688 { 00689 while (pBgWin->backgroundState == ParentRelative) 00690 pBgWin = pBgWin->parent; 00691 } 00692 00693 if ((pWin->drawable.depth != pRoot->drawable.depth) || 00694 (pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel)) 00695 { 00696 usingScratchGC = TRUE; 00697 pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); 00698 if (!pGC) 00699 { 00700 DEALLOCATE_LOCAL(prect); 00701 return; 00702 } 00703 /* 00704 * mash the clip list so we can paint the border by 00705 * mangling the window in place, pretending it 00706 * spans the entire screen 00707 */ 00708 if (what == PW_BORDER) 00709 { 00710 prgnWin = pWin->clipList; 00711 oldCorner.x = pWin->drawable.x; 00712 oldCorner.y = pWin->drawable.y; 00713 pWin->drawable.x = pWin->drawable.y = 0; 00714 box.x1 = 0; 00715 box.y1 = 0; 00716 box.x2 = pScreen->width; 00717 box.y2 = pScreen->height; 00718 REGION_INIT(pScreen, &pWin->clipList, &box, 1); 00719 pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; 00720 newValues[ABSX].val = pBgWin->drawable.x; 00721 newValues[ABSY].val = pBgWin->drawable.y; 00722 } 00723 else 00724 { 00725 newValues[ABSX].val = 0; 00726 newValues[ABSY].val = 0; 00727 } 00728 } else { 00729 /* 00730 * draw the background to the root window 00731 */ 00732 if (screenContext[i] == (GCPtr)NULL) 00733 { 00734 if (!ResType && !(ResType = CreateNewResourceType(tossGC))) 00735 return; 00736 screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, 00737 (XID *)NULL, &status); 00738 if (!screenContext[i]) 00739 return; 00740 numGCs++; 00741 if (!AddResource(FakeClientID(0), ResType, 00742 (pointer)screenContext[i])) 00743 return; 00744 } 00745 pGC = screenContext[i]; 00746 newValues[SUBWINDOW].val = IncludeInferiors; 00747 newValues[ABSX].val = pBgWin->drawable.x; 00748 newValues[ABSY].val = pBgWin->drawable.y; 00749 gcmask |= GCSubwindowMode; 00750 pWin = pRoot; 00751 } 00752 00753 if (pWin->backStorage) 00754 (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); 00755 00756 mask = gcmask; 00757 gcmask = 0; 00758 i = 0; 00759 while (mask) { 00760 index = lowbit (mask); 00761 mask &= ~index; 00762 switch (index) { 00763 case GCFunction: 00764 if (pGC->alu != newValues[FUNCTION].val) { 00765 gcmask |= index; 00766 gcval[i++].val = newValues[FUNCTION].val; 00767 } 00768 break; 00769 case GCTileStipXOrigin: 00770 if ( pGC->patOrg.x != newValues[ABSX].val) { 00771 gcmask |= index; 00772 gcval[i++].val = newValues[ABSX].val; 00773 } 00774 break; 00775 case GCTileStipYOrigin: 00776 if ( pGC->patOrg.y != newValues[ABSY].val) { 00777 gcmask |= index; 00778 gcval[i++].val = newValues[ABSY].val; 00779 } 00780 break; 00781 case GCClipMask: 00782 if ( pGC->clientClipType != CT_NONE) { 00783 gcmask |= index; 00784 gcval[i++].val = CT_NONE; 00785 } 00786 break; 00787 case GCSubwindowMode: 00788 if ( pGC->subWindowMode != newValues[SUBWINDOW].val) { 00789 gcmask |= index; 00790 gcval[i++].val = newValues[SUBWINDOW].val; 00791 } 00792 break; 00793 case GCTile: 00794 if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) 00795 { 00796 gcmask |= index; 00797 gcval[i++].ptr = newValues[TILE].ptr; 00798 } 00799 break; 00800 case GCFillStyle: 00801 if ( pGC->fillStyle != newValues[FILLSTYLE].val) { 00802 gcmask |= index; 00803 gcval[i++].val = newValues[FILLSTYLE].val; 00804 } 00805 break; 00806 case GCForeground: 00807 if ( pGC->fgPixel != newValues[FOREGROUND].val) { 00808 gcmask |= index; 00809 gcval[i++].val = newValues[FOREGROUND].val; 00810 } 00811 break; 00812 } 00813 } 00814 00815 if (gcmask) 00816 dixChangeGC(NullClient, pGC, gcmask, NULL, gcval); 00817 00818 if (pWin->drawable.serialNumber != pGC->serialNumber) 00819 ValidateGC((DrawablePtr)pWin, pGC); 00820 00821 numRects = REGION_NUM_RECTS(prgn); 00822 pbox = REGION_RECTS(prgn); 00823 for (i= numRects; --i >= 0; pbox++, prect++) 00824 { 00825 prect->x = pbox->x1 - pWin->drawable.x; 00826 prect->y = pbox->y1 - pWin->drawable.y; 00827 prect->width = pbox->x2 - pbox->x1; 00828 prect->height = pbox->y2 - pbox->y1; 00829 } 00830 prect -= numRects; 00831 (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); 00832 DEALLOCATE_LOCAL(prect); 00833 00834 if (pWin->backStorage) 00835 (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); 00836 00837 if (usingScratchGC) 00838 { 00839 if (what == PW_BORDER) 00840 { 00841 REGION_UNINIT(pScreen, &pWin->clipList); 00842 pWin->clipList = prgnWin; 00843 pWin->drawable.x = oldCorner.x; 00844 pWin->drawable.y = oldCorner.y; 00845 pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; 00846 } 00847 FreeScratchGC(pGC); 00848 } 00849 }

void miClearDrawable DrawablePtr  pDraw,
GCPtr  pGC
 

Definition at line 856 of file miexpose.c.

References _GC::bgPixel, DoChangeGC(), _GC::fgPixel, _GC::ops, _GCOps::PolyFillRect, and ValidateGC().

Referenced by miOpqStipDrawable(), and miPolyArc().

00859 { 00860 XID fg = pGC->fgPixel; 00861 XID bg = pGC->bgPixel; 00862 xRectangle rect; 00863 00864 rect.x = 0; 00865 rect.y = 0; 00866 rect.width = pDraw->width; 00867 rect.height = pDraw->height; 00868 DoChangeGC(pGC, GCForeground, &bg, 0); 00869 ValidateGC(pDraw, pGC); 00870 (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); 00871 DoChangeGC(pGC, GCForeground, &fg, 0); 00872 ValidateGC(pDraw, pGC); 00873 }


Variable Documentation

RESTYPE ResType = 0 [static]
 

Definition at line 580 of file miexpose.c.

Referenced by miPaintWindow(), and tossGC().

int numGCs = 0 [static]
 

Definition at line 581 of file miexpose.c.

Referenced by miPaintWindow(), and tossGC().

GCPtr screenContext[MAXSCREENS] [static]
 

Definition at line 582 of file miexpose.c.

Referenced by miPaintWindow(), and tossGC().


Generated on Tue May 11 09:59:05 2004 for XFree86 by doxygen 1.3.7