xv: Move xf86 XV color key helper to core.
Color key overlay implementations want to reuse this code, and XF86's had bugs (to be fixed in the next commit). Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
b01cfe5f23
commit
ea3f3b0786
|
@ -233,6 +233,8 @@ extern _X_EXPORT int XvScreenInit(ScreenPtr);
|
|||
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
|
||||
extern _X_EXPORT unsigned long XvGetRTPort(void);
|
||||
extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
|
||||
extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
|
||||
RegionPtr region);
|
||||
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
||||
|
||||
extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
|
|
|
@ -1082,3 +1082,34 @@ XvFreeAdaptor(XvAdaptorPtr pAdaptor)
|
|||
free(pAdaptor->devPriv.ptr);
|
||||
pAdaptor->devPriv.ptr = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
ChangeGCVal pval[2];
|
||||
BoxPtr pbox = RegionRects(region);
|
||||
int i, nbox = RegionNumRects(region);
|
||||
xRectangle *rects;
|
||||
GCPtr gc;
|
||||
|
||||
gc = GetScratchGC(pDraw->depth, pScreen);
|
||||
pval[0].val = key;
|
||||
pval[1].val = IncludeInferiors;
|
||||
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
|
||||
ValidateGC(pDraw, gc);
|
||||
|
||||
rects = malloc(nbox * sizeof(xRectangle));
|
||||
|
||||
for (i = 0; i < nbox; i++, pbox++) {
|
||||
rects[i].x = pbox->x1 - pDraw->x;
|
||||
rects[i].y = pbox->y1 - pDraw->y;
|
||||
rects[i].width = pbox->x2 - pbox->x1;
|
||||
rects[i].height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
|
||||
(*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
|
||||
|
||||
free(rects);
|
||||
FreeScratchGC(gc);
|
||||
}
|
||||
|
|
|
@ -1736,34 +1736,11 @@ void
|
|||
xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
ChangeGCVal pval[2];
|
||||
BoxPtr pbox = RegionRects(fillboxes);
|
||||
int i, nbox = RegionNumRects(fillboxes);
|
||||
xRectangle *rects;
|
||||
GCPtr gc;
|
||||
|
||||
if (!xf86ScreenToScrn(pScreen)->vtSema)
|
||||
return;
|
||||
|
||||
gc = GetScratchGC(pDraw->depth, pScreen);
|
||||
pval[0].val = key;
|
||||
pval[1].val = IncludeInferiors;
|
||||
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
|
||||
ValidateGC(pDraw, gc);
|
||||
|
||||
rects = malloc(nbox * sizeof(xRectangle));
|
||||
|
||||
for (i = 0; i < nbox; i++, pbox++) {
|
||||
rects[i].x = pbox->x1 - pDraw->x;
|
||||
rects[i].y = pbox->y1 - pDraw->y;
|
||||
rects[i].width = pbox->x2 - pbox->x1;
|
||||
rects[i].height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
|
||||
(*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
|
||||
|
||||
free(rects);
|
||||
FreeScratchGC(gc);
|
||||
XvFillColorKey(pDraw, key, fillboxes);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue
Block a user