int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) { #ifndef NO_CHANGEDISPLAYSETTINGS int i; DEVMODE settings; #endif for ( i=0; i<NUM_MODELISTS; ++i ) //maks { SDL_modelist[i] = NULL; } /* Create the window */ if ( DIB_CreateWindow(this) < 0 ) { return(-1); } #ifndef DISABLE_AUDIO DX5_SoundFocus(SDL_Window); #endif /* Determine the screen depth */ vformat->BitsPerPixel = DIB_SussScreenDepth(); switch (vformat->BitsPerPixel) { case 15: vformat->Rmask = 0x00007c00; vformat->Gmask = 0x000003e0; vformat->Bmask = 0x0000001f; vformat->BitsPerPixel = 16; break; case 16: vformat->Rmask = 0x0000f800; vformat->Gmask = 0x000007e0; vformat->Bmask = 0x0000001f; break; case 24: case 32: /* GDI defined as 8-8-8 */ vformat->Rmask = 0x00ff0000; vformat->Gmask = 0x0000ff00; vformat->Bmask = 0x000000ff; break; default: break; } /* See if gamma is supported on this screen */ DIB_CheckGamma(this); #ifndef NO_CHANGEDISPLAYSETTINGS /* Query for the list of available video modes */ for ( i=0; EnumDisplaySettings(NULL, i, &settings); ++i ) { DIB_AddMode(this, settings.dmBitsPerPel, settings.dmPelsWidth, settings.dmPelsHeight); } /* Sort the mode lists */ for ( i=0; i<NUM_MODELISTS; ++i ) { if ( SDL_nummodes[i] > 0 ) { qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes); } } #endif /* !NO_CHANGEDISPLAYSETTINGS */ /* Grab an identity palette if we are in a palettized mode */ if ( vformat->BitsPerPixel <= 8 ) { /* RJR: March 28, 2000 moved palette creation to "DIB_CreatePalette" */ screen_pal = DIB_CreatePalette(vformat->BitsPerPixel); } /* Fill in some window manager capabilities */ this->info.wm_available = 1; /* We're done! */ return(0); }
int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) { const char *env = NULL; #ifndef NO_CHANGEDISPLAYSETTINGS int i; DEVMODE settings; #endif /* Create the window */ if ( DIB_CreateWindow(this) < 0 ) { return(-1); } #if !SDL_AUDIO_DISABLED DX5_SoundFocus(SDL_Window); #endif /* Determine the screen depth */ vformat->BitsPerPixel = DIB_SussScreenDepth(); switch (vformat->BitsPerPixel) { case 15: vformat->Rmask = 0x00007c00; vformat->Gmask = 0x000003e0; vformat->Bmask = 0x0000001f; vformat->BitsPerPixel = 16; break; case 16: vformat->Rmask = 0x0000f800; vformat->Gmask = 0x000007e0; vformat->Bmask = 0x0000001f; break; case 24: case 32: /* GDI defined as 8-8-8 */ vformat->Rmask = 0x00ff0000; vformat->Gmask = 0x0000ff00; vformat->Bmask = 0x000000ff; break; default: break; } /* See if gamma is supported on this screen */ DIB_CheckGamma(this); #ifndef NO_CHANGEDISPLAYSETTINGS settings.dmSize = sizeof(DEVMODE); settings.dmDriverExtra = 0; #ifdef _WIN32_WCE settings.dmFields = DM_DISPLAYQUERYORIENTATION; this->hidden->supportRotation = ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL; #endif /* Query for the desktop resolution */ EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode); this->info.current_w = SDL_desktop_mode.dmPelsWidth; this->info.current_h = SDL_desktop_mode.dmPelsHeight; /* Query for the list of available video modes */ for ( i=0; EnumDisplaySettings(NULL, i, &settings); ++i ) { DIB_AddMode(this, settings.dmBitsPerPel, settings.dmPelsWidth, settings.dmPelsHeight); #ifdef _WIN32_WCE if( this->hidden->supportRotation ) DIB_AddMode(this, settings.dmBitsPerPel, settings.dmPelsHeight, settings.dmPelsWidth); #endif } /* Sort the mode lists */ for ( i=0; i<NUM_MODELISTS; ++i ) { if ( SDL_nummodes[i] > 0 ) { SDL_qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes); } } #else // WinCE and fullscreen mode: // We use only vformat->BitsPerPixel that allow SDL to // emulate other bpp (8, 32) and use triple buffer, // because SDL surface conversion is much faster than the WinCE one. // Although it should be tested on devices with graphics accelerator. DIB_AddMode(this, vformat->BitsPerPixel, GetDeviceCaps(GetDC(NULL), HORZRES), GetDeviceCaps(GetDC(NULL), VERTRES)); #endif /* !NO_CHANGEDISPLAYSETTINGS */ /* Grab an identity palette if we are in a palettized mode */ if ( vformat->BitsPerPixel <= 8 ) { /* RJR: March 28, 2000 moved palette creation to "DIB_CreatePalette" */ DIB_CreatePalette(this, vformat->BitsPerPixel); } /* Fill in some window manager capabilities */ this->info.wm_available = 1; #ifdef _WIN32_WCE this->hidden->origRotation = -1; #endif /* Allow environment override of screensaver disable. */ env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER"); this->hidden->allow_screensaver = ( (env && SDL_atoi(env)) ? 1 : 0 ); /* We're done! */ return(0); }