示例#1
0
void
rfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
{
    int i;
    int first = -1;
    int n = 0;

    SCREEN_PROLOGUE (pmap->pScreen, StoreColors);

    (*pScreen->StoreColors) (pmap, ndef, pdefs);

    SCREEN_EPILOGUE (StoreColors, rfbStoreColors);

    if (pmap == rfbInstalledColormap) {
        for (i = 0; i < ndef; i++) {
            if ((first != -1) && (first + n == pdefs[i].pixel)) {
                n++;
            } else {
                if (first != -1) {
                    rfbSetClientColourMaps(first, n);
                }
                first = pdefs[i].pixel;
                n = 1;
            }
        }
        rfbSetClientColourMaps(first, n);
    }
}
示例#2
0
static void
cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, PaintWindowBorder);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->PaintWindowBorder)(pWin, pRegion,  what);
    } else {
	DrawablePtr pBackingDrawable;
	int x_off, y_off, x_screen, y_screen;

	pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
						&y_off);

	x_screen = x_off - pWin->drawable.x;
	y_screen = y_off - pWin->drawable.y;

	REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);

	if (pWin->borderIsPixel) {
	    cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel);
	} else {
	    cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap,
			      x_off, y_off);
	}

	REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
    }

    SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
}
示例#3
0
文件: xvmain.c 项目: narenas/nx-libs
static Bool
XvDestroyWindow(WindowPtr pWin)
{
  Bool status;
  ScreenPtr pScreen;
  XvScreenPtr pxvs;
  XvAdaptorPtr pa;
  int na;
  XvPortPtr pp;
  int np;

  pScreen = pWin->drawable.pScreen;

  SCREEN_PROLOGUE(pScreen, DestroyWindow);

  pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;

  /* CHECK TO SEE IF THIS PORT IS IN USE */

  pa = pxvs->pAdaptors;
  na = pxvs->nAdaptors;
  while (na--)
    {
      np = pa->nPorts;
      pp = pa->pPorts;

      while (np--)
	{
	  if (pp->pDraw == (DrawablePtr)pWin)
	    {
	      XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);

	      (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, 
						  pp->pDraw);

	      pp->pDraw = (DrawablePtr)NULL;
	      pp->client = (ClientPtr)NULL;
	      pp->time = currentTime;
	    }
	  pp++;
	}
      pa++;
    }

  
  status = (* pScreen->DestroyWindow)(pWin);

  SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);

  return status;

}
示例#4
0
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
  Bool status;
  ScreenPtr pScreen;
  XvScreenPtr pxvs;
  XvAdaptorPtr pa;
  int na;
  XvPortPtr pp;
  int np;

  pScreen = pPix->drawable.pScreen;

  SCREEN_PROLOGUE(pScreen, DestroyPixmap);

  pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);

  /* CHECK TO SEE IF THIS PORT IS IN USE */

  pa = pxvs->pAdaptors;
  na = pxvs->nAdaptors;
  while (na--)
    {
      np = pa->nPorts;
      pp = pa->pPorts;

      while (np--)
	{
	  if (pp->pDraw == (DrawablePtr)pPix)
	    {
	      XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);

	      (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw);

	      pp->pDraw = NULL;
	      pp->client = NULL;
	      pp->time = currentTime;
	    }
	  pp++;
	}
      pa++;
    }
  
  status = (* pScreen->DestroyPixmap)(pPix);

  SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);

  return status;

}
示例#5
0
文件: cw.c 项目: 4eremuxa/xserver
static PixmapPtr
cwGetWindowPixmap (WindowPtr pWin)
{
    PixmapPtr	pPixmap = getCwPixmap (pWin);

    if (!pPixmap)
    {
	ScreenPtr   pScreen = pWin->drawable.pScreen;
	SCREEN_PROLOGUE(pScreen, GetWindowPixmap);
	if (pScreen->GetWindowPixmap)
	    pPixmap = (*pScreen->GetWindowPixmap) (pWin);
	SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
    }
    return pPixmap;
}
示例#6
0
文件: cw.c 项目: 4eremuxa/xserver
static Bool
cwCreateGC(GCPtr pGC)
{
    cwGCPtr	pPriv = getCwGC(pGC);
    ScreenPtr	pScreen = pGC->pScreen;
    Bool	ret;

    SCREEN_PROLOGUE(pScreen, CreateGC);

    if ( (ret = (*pScreen->CreateGC)(pGC)) )
	FUNC_EPILOGUE(pGC, pPriv);

    SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);

    return ret;
}
示例#7
0
文件: cw.c 项目: 4eremuxa/xserver
static void
cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format,
	   unsigned long planemask, char *pdstLine)
{
    ScreenPtr pScreen = pSrc->pScreen;
    DrawablePtr pBackingDrawable;
    int src_off_x, src_off_y;
    
    SCREEN_PROLOGUE(pScreen, GetImage);

    pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);

    CW_OFFSET_XY_SRC(x, y);

    (*pScreen->GetImage)(pBackingDrawable, x, y, w, h, format, planemask,
			 pdstLine);

    SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
}
示例#8
0
static void
cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, PaintWindowBackground);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->PaintWindowBackground)(pWin, pRegion, what);
    } else {
	DrawablePtr pBackingDrawable;
	int x_off, y_off, x_screen, y_screen;

	while (pWin->backgroundState == ParentRelative)
	    pWin = pWin->parent;

	pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
						&y_off);

	x_screen = x_off - pWin->drawable.x;
	y_screen = y_off - pWin->drawable.y;

	if (pWin && (pWin->backgroundState == BackgroundPixel ||
		pWin->backgroundState == BackgroundPixmap))
	{
	    REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);

	    if (pWin->backgroundState == BackgroundPixel) {
		cwFillRegionSolid(pBackingDrawable, pRegion,
				  pWin->background.pixel);
	    } else {
		cwFillRegionTiled(pBackingDrawable, pRegion,
				  pWin->background.pixmap, x_off, y_off);
	    }

	    REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
	}
    }

    SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground);
}
示例#9
0
void
rfbInstallColormap(ColormapPtr pmap)
{
    ColormapPtr oldpmap = rfbInstalledColormap;

    SCREEN_PROLOGUE (pmap->pScreen, InstallColormap);

    (*pScreen->InstallColormap) (pmap);

    SCREEN_EPILOGUE (InstallColormap, rfbInstallColormap);

    if (pmap != oldpmap) {
        if (oldpmap != (ColormapPtr)None)
            WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
        /* Install pmap */
        rfbInstalledColormap = pmap;
        WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);

        rfbSetClientColourMaps(0, 0);
    }
}
示例#10
0
文件: cw.c 项目: 4eremuxa/xserver
static void
cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth,
	   int nspans, char *pdstStart)
{
    ScreenPtr pScreen = pSrc->pScreen;
    DrawablePtr pBackingDrawable;
    int i;
    int src_off_x, src_off_y;
    
    SCREEN_PROLOGUE(pScreen, GetSpans);

    pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);

    for (i = 0; i < nspans; i++)
	CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y);

    (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans,
			 pdstStart);

    SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
}
示例#11
0
文件: cw.c 项目: 4eremuxa/xserver
static void
cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, CopyWindow);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
    } else {
	GCPtr	    pGC;
	BoxPtr	    pExtents;
	int	    x_off, y_off;
	int	    dx, dy;
	PixmapPtr   pBackingPixmap;
	RegionPtr   pClip;
	int	    src_x, src_y, dst_x, dst_y, w, h;

	dx = ptOldOrg.x - pWin->drawable.x;
	dy = ptOldOrg.y - pWin->drawable.y;

	pExtents = RegionExtents(prgnSrc);

	pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin,
							  &x_off, &y_off);

	src_x = pExtents->x1 - pBackingPixmap->screen_x;
	src_y = pExtents->y1 - pBackingPixmap->screen_y;
	w = pExtents->x2 - pExtents->x1;
	h = pExtents->y2 - pExtents->y1;
	dst_x = src_x - dx;
	dst_y = src_y - dy;
			       
	/* Translate region (as required by API) */
	RegionTranslate(prgnSrc, -dx, -dy);
	
	pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
	/*
	 * Copy region to GC as clip, aligning as dest clip
	 */
	pClip = RegionCreate(NULL, 0);
	RegionIntersect(pClip, &pWin->borderClip, prgnSrc);
	RegionTranslate(pClip,
			 -pBackingPixmap->screen_x,
			 -pBackingPixmap->screen_y);
	
	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);

	ValidateGC(&pBackingPixmap->drawable, pGC);

	(*pGC->ops->CopyArea) (&pBackingPixmap->drawable,
			       &pBackingPixmap->drawable, pGC,
			       src_x, src_y, w, h, dst_x, dst_y);

	(*pGC->funcs->DestroyClip) (pGC);

	FreeScratchGC(pGC);
    }
	
    SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
}