MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / GetVideoModes

Method GetVideoModes

PanzerChasm/system_window.cpp:709–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709void SystemWindow::GetVideoModes()
710{
711 const int display_count= SDL_GetNumVideoDisplays();
712 if( display_count <= 0 )
713 return;
714
715 displays_video_modes_.reserve( static_cast<unsigned int>(display_count) );
716
717 for( int d= 0; d < display_count; d++ )
718 {
719 const int display_mode_count= SDL_GetNumDisplayModes( d );
720 if( display_mode_count <= 0 )
721 continue;
722
723 displays_video_modes_.emplace_back();
724 VideoModes& video_modes= displays_video_modes_.back();
725
726 for( int m= 0; m < display_mode_count; m++ )
727 {
728 SDL_DisplayMode mode;
729 const int result= SDL_GetDisplayMode( d, m, &mode );
730 if( result < 0 )
731 continue;
732 if( !( SDL_BITSPERPIXEL( mode.format ) == 24 || SDL_BITSPERPIXEL( mode.format ) == 32 ) ||
733 mode.refresh_rate <= 0 )
734 continue;
735
736 // SDL sorts modes by width, height, bpp, freq.
737 // use it and join modes with same resolution.
738 const Size2 size( mode.w, mode.h );
739 if( video_modes.empty() ||
740 size != video_modes.back().size )
741 {
742 video_modes.emplace_back();
743 video_modes.back().size= size;
744 }
745
746 video_modes.back().supported_frequencies.emplace_back( mode.refresh_rate );
747 }
748 }
749}
750
751void SystemWindow::UpdateBrightness()
752{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected