static Bool cfb8_32WidFinishScreenInit( ScreenPtr pScreen, int xsize, int ysize, /* in pixels */ int dpix, int dpiy /* dots per inch */ ){ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; rootdepth = 0; if (!miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual,((unsigned long)1<<(32-1)), 8, -1)) return FALSE; if (!miScreenInit(pScreen, NULL, xsize, ysize, dpix, dpiy, 0, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals)) return FALSE; pScreen->BackingStoreFuncs = cfb8_32WidBSFuncRec; pScreen->CreateScreenResources = cfb8_32WidCreateScreenResources; pScreen->CloseScreen = cfb8_32WidCloseScreen; pScreen->GetWindowPixmap = cfb8_32WidGetWindowPixmap; pScreen->WindowExposures = cfb8_32WidWindowExposures; pScrn->EnableDisableFBAccess = cfb8_32WidEnableDisableFBAccess; return TRUE; }
static Bool cfb24_32FinishScreenInit( ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ int xsize, int ysize, /* in pixels */ int dpix, int dpiy, /* dots per inch */ int width /* pixel width of frame buffer */ ){ VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; rootdepth = 0; if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual,((unsigned long)1<<(24-1)), 8, -1)) return FALSE; if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals)) return FALSE; pScreen->BackingStoreFuncs = cfb24_32BSFuncRec; pScreen->CreateScreenResources = cfb24_32CreateScreenResources; pScreen->CloseScreen = cfb32CloseScreen; /* OK */ pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */ pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */ return TRUE; }
Bool winFinishScreenInitNativeGDI (int index, ScreenPtr pScreen, int argc, char **argv) { winScreenPriv(pScreen); winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; VisualPtr pVisuals = NULL; DepthPtr pDepths = NULL; VisualID rootVisual = 0; int nVisuals = 0, nDepths = 0, nRootDepth = 0; /* Ignore user input (mouse, keyboard) */ pScreenInfo->fIgnoreInput = FALSE; /* Get device contexts for the screen and shadow bitmap */ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); if (pScreenPriv->hdcScreen == NULL) FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n"); /* Init visuals */ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n"); return FALSE; } /* Initialize the mi visuals */ if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth, &rootVisual, ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8, TrueColor)) { ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n"); return FALSE; } /* Initialize the CloseScreen procedure pointer */ pScreen->CloseScreen = NULL; /* Initialize the mi code */ if (!miScreenInit (pScreen, NULL, /* No framebuffer */ pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, pScreenInfo->dwStride, nRootDepth, nDepths, pDepths, rootVisual, nVisuals, pVisuals)) { ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n"); return FALSE; } pScreen->defColormap = FakeClientID(0); /* * Register our block and wakeup handlers; these procedures * process messages in our Windows message queue; specifically, * they process mouse and keyboard input. */ pScreen->BlockHandler = winBlockHandler; pScreen->WakeupHandler = winWakeupHandler; pScreen->blockData = pScreen; pScreen->wakeupData = pScreen; /* Place our save screen function */ pScreen->SaveScreen = winSaveScreen; /* Pixmaps */ pScreen->CreatePixmap = winCreatePixmapNativeGDI; pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; /* Other Screen Routines */ pScreen->QueryBestSize = winQueryBestSizeNativeGDI; pScreen->SaveScreen = winSaveScreen; pScreen->GetImage = miGetImage; pScreen->GetSpans = winGetSpansNativeGDI; /* Window Procedures */ pScreen->CreateWindow = winCreateWindowNativeGDI; pScreen->DestroyWindow = winDestroyWindowNativeGDI; pScreen->PositionWindow = winPositionWindowNativeGDI; /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/ pScreen->RealizeWindow = winMapWindowNativeGDI; pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; /* Paint window */ pScreen->CopyWindow = winCopyWindowNativeGDI; /* Fonts */ pScreen->RealizeFont = winRealizeFontNativeGDI; pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; /* GC */ pScreen->CreateGC = winCreateGCNativeGDI; /* Colormap Routines */ pScreen->CreateColormap = miInitializeColormap; pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA; pScreen->InstallColormap = miInstallColormap; pScreen->UninstallColormap = miUninstallColormap; pScreen->ListInstalledColormaps = miListInstalledColormaps; pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA; pScreen->ResolveColor = miResolveColor; /* Bitmap */ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n"); /* Set the default white and black pixel positions */ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; /* Initialize the cursor */ if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) { ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n"); return FALSE; } /* Create a default colormap */ if (!miCreateDefColormap (pScreen)) { ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " "failed\n"); return FALSE; } ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " "returned\n"); /* mi doesn't use a CloseScreen procedure, so no need to wrap */ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; /* Tell the server that we are enabled */ pScreenPriv->fEnabled = TRUE; ErrorF ("winFinishScreenInitNativeGDI - Successful addition of " "screen %08x\n", (unsigned int) pScreen); return TRUE; }
/* dts * (inch/dot) * (25.4 mm / inch) = mm */ Bool afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, int dpix, int dpiy, int width) /* pointer to screen bitmap */ /* in pixels */ /* dots per inch */ /* pixel width of frame buffer */ { VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; pointer oldDevPrivate; rootdepth = 0; if (!afbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual, 256, 8)) { ErrorF("afbInitVisuals: FALSE\n"); return FALSE; } if (!afbAllocatePrivates(pScreen,(int *)NULL, (int *)NULL)) { ErrorF("afbAllocatePrivates: FALSE\n"); return FALSE; } pScreen->defColormap = (Colormap)FakeClientID(0); /* whitePixel, blackPixel */ pScreen->blackPixel = 0; pScreen->whitePixel = 0; pScreen->QueryBestSize = afbQueryBestSize; /* SaveScreen */ pScreen->GetImage = afbGetImage; pScreen->GetSpans = afbGetSpans; pScreen->CreateWindow = afbCreateWindow; pScreen->DestroyWindow = afbDestroyWindow; pScreen->PositionWindow = afbPositionWindow; pScreen->ChangeWindowAttributes = afbChangeWindowAttributes; pScreen->RealizeWindow = afbMapWindow; pScreen->UnrealizeWindow = afbUnmapWindow; pScreen->PaintWindowBackground = afbPaintWindow; pScreen->PaintWindowBorder = afbPaintWindow; pScreen->CopyWindow = afbCopyWindow; pScreen->CreatePixmap = afbCreatePixmap; pScreen->DestroyPixmap = afbDestroyPixmap; pScreen->RealizeFont = afbRealizeFont; pScreen->UnrealizeFont = afbUnrealizeFont; pScreen->CreateGC = afbCreateGC; pScreen->CreateColormap = afbInitializeColormap; pScreen->DestroyColormap = (DestroyColormapProcPtr)NoopDDA; pScreen->InstallColormap = afbInstallColormap; pScreen->UninstallColormap = afbUninstallColormap; pScreen->ListInstalledColormaps = afbListInstalledColormaps; pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA; pScreen->ResolveColor = afbResolveColor; pScreen->BitmapToRegion = afbPixmapToRegion; oldDevPrivate = pScreen->devPrivate; if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals)) { ErrorF("miScreenInit: FALSE\n"); return FALSE; } pScreen->CloseScreen = afbCloseScreen; pScreen->CreateScreenResources = afbCreateScreenResources; pScreen->BackingStoreFuncs = afbBSFuncRec; pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate; pScreen->devPrivate = oldDevPrivate; return TRUE; }