Fix win-specific code too.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5316 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-09-30 04:17:32 +00:00
parent 427afd5828
commit 8662827af0
2 changed files with 9 additions and 7 deletions

View file

@ -3601,7 +3601,7 @@ static void Sys_MakeInstaller(const char *name)
qbyte *rgbadata; qbyte *rgbadata;
int imgwidth, imgheight; int imgwidth, imgheight;
int iconid = 1; int iconid = 1;
qboolean hasalpha; uploadfmt_t format;
memset(&icondata, 0, sizeof(icondata)); memset(&icondata, 0, sizeof(icondata));
icondata.idType = 1; icondata.idType = 1;
filelen = VFS_GETLEN(filehandle); filelen = VFS_GETLEN(filehandle);
@ -3614,7 +3614,7 @@ static void Sys_MakeInstaller(const char *name)
UpdateResource(bin, RT_GROUP_ICON, MAKEINTRESOURCE(2), RESLANG, NULL, 0); UpdateResource(bin, RT_GROUP_ICON, MAKEINTRESOURCE(2), RESLANG, NULL, 0);
// UpdateResource(bin, RT_GROUP_ICON, MAKEINTRESOURCE(3), RESLANG, NULL, 0); // UpdateResource(bin, RT_GROUP_ICON, MAKEINTRESOURCE(3), RESLANG, NULL, 0);
rgbadata = Read32BitImageFile(filedata, filelen, &imgwidth, &imgheight, &hasalpha, va("%s.png", name)); rgbadata = ReadRawImageFile(filedata, filelen, &imgwidth, &imgheight, &format, true, va("%s.png", name));
if (!rgbadata) if (!rgbadata)
error = "unable to read icon image"; error = "unable to read icon image";
else else
@ -4255,7 +4255,7 @@ void *WIN_CreateCursor(const char *filename, float hotx, float hoty, float scale
HDC maindc; HDC maindc;
qbyte *rgbadata, *rgbadata_start, *bgradata, *bgradata_start; qbyte *rgbadata, *rgbadata_start, *bgradata, *bgradata_start;
qboolean hasalpha; uploadfmt_t format;
void *filedata; void *filedata;
int filelen; int filelen;
if (!filename || !*filename) if (!filename || !*filename)
@ -4264,13 +4264,12 @@ void *WIN_CreateCursor(const char *filename, float hotx, float hoty, float scale
if (!filedata) if (!filedata)
return NULL; return NULL;
hasalpha = false; rgbadata_start = ReadRawImageFile(filedata, filelen, &width, &height, &format, true, "cursor");
rgbadata_start = Read32BitImageFile(filedata, filelen, &width, &height, &hasalpha, "cursor");
FS_FreeFile(filedata); FS_FreeFile(filedata);
if (!rgbadata_start) if (!rgbadata_start)
return NULL; return NULL;
if (!hasalpha && !strchr(filename, ':')) if ((format==PTI_RGBX8 || format==PTI_LLLX8) && !strchr(filename, ':'))
{ //people seem to insist on using jpgs, which don't have alpha. { //people seem to insist on using jpgs, which don't have alpha.
//screw over the alpha channel if needed. //screw over the alpha channel if needed.
unsigned int alpha_width, alpha_height, p; unsigned int alpha_width, alpha_height, p;
@ -4279,6 +4278,7 @@ void *WIN_CreateCursor(const char *filename, float hotx, float hoty, float scale
char *alph; char *alph;
size_t alphsize; size_t alphsize;
char ext[8]; char ext[8];
uploadfmt_t alphaformat;
COM_StripExtension(filename, aname, sizeof(aname)); COM_StripExtension(filename, aname, sizeof(aname));
COM_FileExtension(filename, ext, sizeof(ext)); COM_FileExtension(filename, ext, sizeof(ext));
Q_strncatz(aname, "_alpha.", sizeof(aname)); Q_strncatz(aname, "_alpha.", sizeof(aname));
@ -4286,7 +4286,7 @@ void *WIN_CreateCursor(const char *filename, float hotx, float hoty, float scale
alphsize = FS_LoadFile(filename, (void**)&alph); alphsize = FS_LoadFile(filename, (void**)&alph);
if (alph) if (alph)
{ {
if ((alphadata = Read32BitImageFile(alph, alphsize, &alpha_width, &alpha_height, &hasalpha, aname))) if ((alphadata = ReadRawImageFile(alph, alphsize, &alpha_width, &alpha_height, &alphaformat, true, aname)))
{ {
if (alpha_width == width && alpha_height == height) if (alpha_width == width && alpha_height == height)
for (p = 0; p < alpha_width*alpha_height; p++) for (p = 0; p < alpha_width*alpha_height; p++)

View file

@ -295,6 +295,8 @@ qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mi
tdesc.Format = DXGI_FORMAT_R8G8_SNORM; tdesc.Format = DXGI_FORMAT_R8G8_SNORM;
break; break;
case PTI_L8_SRGB: //no swizzles / single-channel srgb
case PTI_L8A8_SRGB: //no swizzles / single-channel srgb
case PTI_ETC1_RGB8: //not invented here... case PTI_ETC1_RGB8: //not invented here...
case PTI_ETC2_RGB8: case PTI_ETC2_RGB8:
case PTI_ETC2_RGB8A1: case PTI_ETC2_RGB8A1: