Example #1
0
vfbCloseScreen(ScreenPtr pScreen)
#endif
{
#if XORG < 113
    vfbScreenInfoPtr pvfb = &vfbScreens[index];
#else
    vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
#endif
    int i;
 
    pScreen->CloseScreen = pvfb->closeScreen;

    /*
     * XXX probably lots of stuff to clean.  For now,
     * clear installed colormaps so that server reset works correctly.
     */
#if XORG < 113
    for (i = 0; i < MAXSCREENS; i++)
	InstalledMaps[i] = NULL;

    return pScreen->CloseScreen(index, pScreen);
#else
    for (i = 0; i < screenInfo.numScreens; i++)
	SetInstalledColormap(screenInfo.screens[i], NULL);

    /*
     * fb overwrites miCloseScreen, so do this here
     */
    if (pScreen->devPrivate)
        (*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate);
    pScreen->devPrivate = NULL;

    return pScreen->CloseScreen(pScreen);
#endif
}
Example #2
0
static void
vfbInstallColormap(ColormapPtr pmap)
{
    ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);

    if (pmap != oldpmap)
    {
	int entries;
	XWDFileHeader *pXWDHeader;
	XWDColor *pXWDCmap;
	VisualPtr pVisual;
	Pixel *     ppix;
	xrgb *      prgb;
	xColorItem *defs;
	int i;

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

	entries = pmap->pVisual->ColormapEntries;
	pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
	pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
	pVisual = pmap->pVisual;

	swapcopy32(pXWDHeader->visual_class, pVisual->class);
	swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
	swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
	swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
	swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
	swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);

	ppix = (Pixel *)malloc(entries * sizeof(Pixel));
	prgb = (xrgb *)malloc(entries * sizeof(xrgb));
	defs = (xColorItem *)malloc(entries * sizeof(xColorItem));

	for (i = 0; i < entries; i++)  ppix[i] = i;
	/* XXX truecolor */
	QueryColors(pmap, entries, ppix, prgb, serverClient);

	for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
	    defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
	    defs[i].red = prgb[i].red;
	    defs[i].green = prgb[i].green;
	    defs[i].blue = prgb[i].blue;
	    defs[i].flags =  DoRed|DoGreen|DoBlue;
	}
	(*pmap->pScreen->StoreColors)(pmap, entries, defs);

	free(ppix);
	free(prgb);
	free(defs);
    }
Example #3
0
static void 
vfbInstallColormap(ColormapPtr pmap)
{
#if XORG < 113
    int index = pmap->pScreen->myNum;
#endif
    ColormapPtr oldpmap;

#if XORG < 113
    oldpmap = InstalledMaps[index];
#else
    oldpmap = GetInstalledColormap(pmap->pScreen);
#endif

    if (pmap != oldpmap)
    {
	int entries;
	VisualPtr pVisual;
	Pixel *     ppix;
	xrgb *      prgb;
	xColorItem *defs;
	int i;

	if(oldpmap != (ColormapPtr)None)
	    WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
	/* Install pmap */
#if XORG < 113
	InstalledMaps[index] = pmap;
#else
	SetInstalledColormap(pmap->pScreen, pmap);
#endif
	WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);

	entries = pmap->pVisual->ColormapEntries;
	pVisual = pmap->pVisual;

	ppix = (Pixel *)calloc(entries, sizeof(Pixel));
	prgb = (xrgb *)calloc(entries, sizeof(xrgb));
	defs = (xColorItem *)calloc(entries, sizeof(xColorItem));
	if (!ppix || !prgb || !defs)
	  FatalError ("Not enough memory for color map\n");

	for (i = 0; i < entries; i++)  ppix[i] = i;
	/* XXX truecolor */
#if XORG < 19
	QueryColors(pmap, entries, ppix, prgb);
#else
	QueryColors(pmap, entries, ppix, prgb, serverClient);
#endif

	for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
	    defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
	    defs[i].red = prgb[i].red;
	    defs[i].green = prgb[i].green;
	    defs[i].blue = prgb[i].blue;
	    defs[i].flags =  DoRed|DoGreen|DoBlue;
	}
	(*pmap->pScreen->StoreColors)(pmap, entries, defs);
	
	free(ppix);
	free(prgb);
	free(defs);
    }
}