mirror of
https://github.com/nothings/stb
synced 2024-12-14 12:07:13 +03:00
TGA loader fix to new optimized path by Jerry Jansson
This commit is contained in:
parent
2fb6df190b
commit
d0c33a77f9
@ -3272,7 +3272,7 @@ static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int
|
||||
*y = tga_height;
|
||||
if (comp) *comp = tga_comp;
|
||||
|
||||
tga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp );
|
||||
tga_data = (unsigned char*)malloc( tga_width * tga_height * tga_comp );
|
||||
if (!tga_data) return stbi__errpuc("outofmem", "Out of memory");
|
||||
|
||||
// skip to the data's starting position (offset usually = 0)
|
||||
@ -3365,9 +3365,9 @@ static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int
|
||||
{
|
||||
for (j = 0; j*2 < tga_height; ++j)
|
||||
{
|
||||
int index1 = j * tga_width * req_comp;
|
||||
int index2 = (tga_height - 1 - j) * tga_width * req_comp;
|
||||
for (i = tga_width * req_comp; i > 0; --i)
|
||||
int index1 = j * tga_width * tga_comp;
|
||||
int index2 = (tga_height - 1 - j) * tga_width * tga_comp;
|
||||
for (i = tga_width * tga_comp; i > 0; --i)
|
||||
{
|
||||
unsigned char temp = tga_data[index1];
|
||||
tga_data[index1] = tga_data[index2];
|
||||
|
Loading…
Reference in New Issue
Block a user