Browse Source

engine: platform: sdl: try to enable ICO icons for 64-bit Windows, ignore TGA flip attribute for icons

pull/2/head
Alibek Omarov 2 years ago
parent
commit
2182ba9630
  1. 10
      engine/platform/sdl/vid_sdl.c

10
engine/platform/sdl/vid_sdl.c

@ -598,7 +598,7 @@ void VID_RestoreScreenResolution( void )
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) #endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
} }
#if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32 #if XASH_WIN32 // ICO support only for Win32
#include "SDL_syswm.h" #include "SDL_syswm.h"
static void WIN_SetWindowIcon( HICON ico ) static void WIN_SetWindowIcon( HICON ico )
{ {
@ -686,7 +686,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
VID_RestoreScreenResolution(); VID_RestoreScreenResolution();
} }
#if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32 #if XASH_WIN32 // ICO support only for Win32
if( FS_FileExists( GI->iconpath, true ) ) if( FS_FileExists( GI->iconpath, true ) )
{ {
HICON ico; HICON ico;
@ -701,7 +701,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
WIN_SetWindowIcon( ico ); WIN_SetWindowIcon( ico );
} }
} }
#endif // _WIN32 && !XASH_64BIT #endif // _WIN32
if( !iconLoaded ) if( !iconLoaded )
{ {
@ -709,13 +709,15 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
COM_StripExtension( iconpath ); COM_StripExtension( iconpath );
COM_DefaultExtension( iconpath, ".tga" ); COM_DefaultExtension( iconpath, ".tga" );
Image_SetForceFlags( IL_DONTFLIP_TGA );
icon = FS_LoadImage( iconpath, NULL, 0 ); icon = FS_LoadImage( iconpath, NULL, 0 );
Image_ClearForceFlags();
if( icon ) if( icon )
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( icon->buffer, SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( icon->buffer,
icon->width, icon->height, 32, 4 * icon->width, icon->width, icon->height, 32, 4 * icon->width,
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 ); 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 );
if( surface ) if( surface )
{ {

Loading…
Cancel
Save