mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Mir: Do not use opengl to find the valid pixel format if we dont use opengl
This commit is contained in:
parent
966aa3721b
commit
90ef601d8c
@ -46,6 +46,32 @@ IsSurfaceValid(MIR_Window* mir_window)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MirPixelFormat
|
||||||
|
FindValidPixelFormat(MIR_Data* mir_data)
|
||||||
|
{
|
||||||
|
unsigned int pf_size = 32;
|
||||||
|
unsigned int valid_formats;
|
||||||
|
unsigned int f;
|
||||||
|
|
||||||
|
MirPixelFormat formats[pf_size];
|
||||||
|
MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
|
||||||
|
pf_size, &valid_formats);
|
||||||
|
|
||||||
|
for (f = 0; f < valid_formats; f++) {
|
||||||
|
MirPixelFormat cur_pf = formats[f];
|
||||||
|
|
||||||
|
if (cur_pf == mir_pixel_format_abgr_8888 ||
|
||||||
|
cur_pf == mir_pixel_format_xbgr_8888 ||
|
||||||
|
cur_pf == mir_pixel_format_argb_8888 ||
|
||||||
|
cur_pf == mir_pixel_format_xrgb_8888) {
|
||||||
|
|
||||||
|
return cur_pf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mir_pixel_format_invalid;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MIR_CreateWindow(_THIS, SDL_Window* window)
|
MIR_CreateWindow(_THIS, SDL_Window* window)
|
||||||
{
|
{
|
||||||
@ -72,9 +98,14 @@ MIR_CreateWindow(_THIS, SDL_Window* window)
|
|||||||
mir_window->mir_data = mir_data;
|
mir_window->mir_data = mir_data;
|
||||||
mir_window->sdl_window = window;
|
mir_window->sdl_window = window;
|
||||||
|
|
||||||
|
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||||
pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection,
|
pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection,
|
||||||
_this->egl_data->egl_display,
|
_this->egl_data->egl_display,
|
||||||
_this->egl_data->egl_config);
|
_this->egl_data->egl_config);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pixel_format = FindValidPixelFormat(mir_data);
|
||||||
|
}
|
||||||
|
|
||||||
mir_data->pixel_format = pixel_format;
|
mir_data->pixel_format = pixel_format;
|
||||||
if (pixel_format == mir_pixel_format_invalid) {
|
if (pixel_format == mir_pixel_format_invalid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user