remove MAX_PATH_CHARACTERS in Define_icon()
This commit is contained in:
parent
81bf106865
commit
923da28d9d
@ -39,6 +39,8 @@
|
|||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "gfx2log.h"
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
// Update method that does a large number of small rectangles, aiming
|
// Update method that does a large number of small rectangles, aiming
|
||||||
// for a minimum number of total pixels updated.
|
// for a minimum number of total pixels updated.
|
||||||
@ -731,22 +733,26 @@ void Define_icon(void)
|
|||||||
|
|
||||||
// General version: Load icon from file
|
// General version: Load icon from file
|
||||||
{
|
{
|
||||||
char icon_path[MAX_PATH_CHARACTERS];
|
|
||||||
#if defined(USE_SDL)
|
#if defined(USE_SDL)
|
||||||
SDL_Surface * icon;
|
SDL_Surface * icon;
|
||||||
#endif
|
#endif
|
||||||
//sprintf(icon_path, "%s%s", Data_directory, "gfx2.gif"); // 32x32
|
char * icon_path;
|
||||||
sprintf(icon_path, "%s%s", Data_directory, "gfx2.png"); // 48x48
|
|
||||||
|
// gfx2.gif : 32x32
|
||||||
|
// gfx2.png : 48x48
|
||||||
|
icon_path = Filepath_append_to_dir(Data_directory, "gfx2.png");
|
||||||
icon = IMG_Load(icon_path);
|
icon = IMG_Load(icon_path);
|
||||||
if (icon != NULL)
|
if (icon == NULL)
|
||||||
|
GFX2_Log(GFX2_WARNING, "Failed to load icon %s\n", icon_path);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Uint32 pink;
|
Uint32 pink;
|
||||||
pink = SDL_MapRGB(icon->format, 255, 0, 255);
|
pink = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||||
|
|
||||||
if (icon->format->BitsPerPixel == 8)
|
if (icon->format->BitsPerPixel == 8)
|
||||||
{
|
{
|
||||||
// NOTE : disable use of color key because of SDL/SDL2
|
// NOTE : disable use of color key because SDL/SDL2
|
||||||
// get the transparency information from the .gif and .png
|
// gets the transparency information from the .gif and .png
|
||||||
// files by itself.
|
// files by itself.
|
||||||
// 8bit image: use color key
|
// 8bit image: use color key
|
||||||
#if defined(USE_SDL)
|
#if defined(USE_SDL)
|
||||||
@ -778,6 +784,7 @@ void Define_icon(void)
|
|||||||
SDL_FreeSurface(icon);
|
SDL_FreeSurface(icon);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
free(icon_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user