Fix the detection of alpha-channel in textures as created by IMG_Load
This fixes the textures loading under Mac OS Xdev-ui
parent
19a7196b61
commit
9e439d88bf
|
@ -606,7 +606,7 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
|
||||||
}
|
}
|
||||||
else if (params.format == TEX_IMG_AUTO)
|
else if (params.format == TEX_IMG_AUTO)
|
||||||
{
|
{
|
||||||
if (data->surface->format->Amask != 0)
|
if (data->surface->format->BytesPerPixel == 4)
|
||||||
{
|
{
|
||||||
if ((data->surface->format->Amask == 0xFF000000) &&
|
if ((data->surface->format->Amask == 0xFF000000) &&
|
||||||
(data->surface->format->Rmask == 0x00FF0000) &&
|
(data->surface->format->Rmask == 0x00FF0000) &&
|
||||||
|
@ -630,7 +630,7 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
|
||||||
convert = true;
|
convert = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (data->surface->format->BytesPerPixel == 3)
|
||||||
{
|
{
|
||||||
if ((data->surface->format->Rmask == 0xFF0000) &&
|
if ((data->surface->format->Rmask == 0xFF0000) &&
|
||||||
(data->surface->format->Gmask == 0x00FF00) &&
|
(data->surface->format->Gmask == 0x00FF00) &&
|
||||||
|
@ -652,6 +652,10 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
|
||||||
convert = true;
|
convert = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
GetLogger()->Error("Unknown data surface format");
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
Loading…
Reference in New Issue