xf86XVFillKeyHelper assumed root clip never changed.
When the root window changed size, xf86XVFillKeyHelper would not revalidate the GC, leaving the clip at the old size causing lossage (and possibly memory corruption if the screen and frame buffer shrank). Fixed by just using a scratch GC; saving memory, eliminating bugs and shrinking the code.
This commit is contained in:
parent
3c982bc1a4
commit
6a870992d8
|
@ -1875,42 +1875,35 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
|
|||
_X_EXPORT void
|
||||
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
|
||||
{
|
||||
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
||||
DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
|
||||
XID pval[2];
|
||||
BoxPtr pbox = REGION_RECTS(clipboxes);
|
||||
int i, nbox = REGION_NUM_RECTS(clipboxes);
|
||||
xRectangle *rects;
|
||||
GCPtr gc;
|
||||
|
||||
if(!xf86Screens[pScreen->myNum]->vtSema) return;
|
||||
|
||||
if(!ScreenPriv->videoGC) {
|
||||
int status;
|
||||
pval[0] = key;
|
||||
pval[1] = IncludeInferiors;
|
||||
ScreenPriv->videoGC = CreateGC(root, GCForeground | GCSubwindowMode,
|
||||
pval, &status);
|
||||
if(!ScreenPriv->videoGC) return;
|
||||
ValidateGC(root, ScreenPriv->videoGC);
|
||||
} else if (key != ScreenPriv->videoGC->fgPixel){
|
||||
pval[0] = key;
|
||||
ChangeGC(ScreenPriv->videoGC, GCForeground, pval);
|
||||
ValidateGC(root, ScreenPriv->videoGC);
|
||||
}
|
||||
gc = GetScratchGC(root->depth, pScreen);
|
||||
pval[0] = key;
|
||||
pval[1] = IncludeInferiors;
|
||||
(void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
|
||||
ValidateGC(root, gc);
|
||||
|
||||
rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
|
||||
rects = xalloc (nbox * sizeof(xRectangle));
|
||||
|
||||
for(i = 0; i < nbox; i++, pbox++) {
|
||||
for(i = 0; i < nbox; i++, pbox++)
|
||||
{
|
||||
rects[i].x = pbox->x1;
|
||||
rects[i].y = pbox->y1;
|
||||
rects[i].width = pbox->x2 - pbox->x1;
|
||||
rects[i].height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
|
||||
(*ScreenPriv->videoGC->ops->PolyFillRect)(
|
||||
root, ScreenPriv->videoGC, nbox, rects);
|
||||
|
||||
DEALLOCATE_LOCAL(rects);
|
||||
|
||||
(*gc->ops->PolyFillRect)(root, gc, nbox, rects);
|
||||
|
||||
xfree (rects);
|
||||
FreeScratchGC (gc);
|
||||
}
|
||||
|
||||
/* xf86XVClipVideoHelper -
|
||||
|
|
Loading…
Reference in New Issue