summaryrefslogtreecommitdiff
path: root/hw/xfree86/common/xf86xv.c
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2011-01-13 20:19:18 +0200
committerPauli Nieminen <ext-pauli.nieminen@nokia.com>2011-02-03 14:36:00 +0200
commite012f2312b4bcdf31bb5d622ddd34571f3c12429 (patch)
tree346eabeba88b5a9fb5d0d8df4eddaad6b4b7cbef /hw/xfree86/common/xf86xv.c
parentea1ffd3e60bdcedbec5a6f28929f8677bf45d450 (diff)
xf86/xv: Remove copy paste code.
xf86XVFillKeyHelperDrawable can be used to implement xf86XVFillKeyHelper. V2: * Remove RegionTranslate that clobbered parameter region. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
Diffstat (limited to 'hw/xfree86/common/xf86xv.c')
-rw-r--r--hw/xfree86/common/xf86xv.c68
1 files changed, 11 insertions, 57 deletions
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 016db1f04..f1a87f120 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1869,62 +1869,10 @@ xf86XVQueryImageAttributes(
format->id, width, height, pitches, offsets);
}
-
void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
{
ScreenPtr pScreen = pDraw->pScreen;
- WindowPtr pWin = (WindowPtr)pDraw;
- XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
- GCPtr pGC = NULL;
- BoxPtr pbox = RegionRects(clipboxes);
- int i, nbox = RegionNumRects(clipboxes);
- xRectangle *rects;
-
- if(!xf86Screens[pScreen->myNum]->vtSema) return;
-
- if(pPriv)
- pGC = pPriv->pGC;
-
- if(!pGC) {
- int status;
- XID pval[2];
- pval[0] = key;
- pval[1] = IncludeInferiors;
- pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
- (XID)0, serverClient);
- if(!pGC) return;
- ValidateGC(pDraw, pGC);
- if (pPriv) pPriv->pGC = pGC;
- } else if (key != pGC->fgPixel){
- ChangeGCVal val;
- val.val = key;
- ChangeGC(NullClient, pGC, GCForeground, &val);
- ValidateGC(pDraw, pGC);
- }
-
- RegionTranslate(clipboxes, -pDraw->x, -pDraw->y);
-
- rects = malloc(nbox * sizeof(xRectangle));
-
- 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;
- }
-
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects);
-
- if (!pPriv) FreeGC(pGC, 0);
-
- free(rects);
-}
-
-void
-xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
-{
- DrawablePtr root = &pScreen->root->drawable;
ChangeGCVal pval[2];
BoxPtr pbox = RegionRects(clipboxes);
int i, nbox = RegionNumRects(clipboxes);
@@ -1933,28 +1881,34 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
if(!xf86Screens[pScreen->myNum]->vtSema) return;
- gc = GetScratchGC(root->depth, pScreen);
+ gc = GetScratchGC(pDraw->depth, pScreen);
pval[0].val = key;
pval[1].val = IncludeInferiors;
(void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval);
- ValidateGC(root, gc);
+ ValidateGC(pDraw, gc);
rects = malloc(nbox * sizeof(xRectangle));
for(i = 0; i < nbox; i++, pbox++)
{
- rects[i].x = pbox->x1;
- rects[i].y = pbox->y1;
+ 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)(root, gc, nbox, rects);
+ (*gc->ops->PolyFillRect)(pDraw, gc, nbox, rects);
free(rects);
FreeScratchGC (gc);
}
+void
+xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
+{
+ xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, clipboxes);
+}
+
/* xf86XVClipVideoHelper -
Takes the dst box in standard X BoxRec form (top and left