fseek (f, sizeof(pcxbuf) - 4, SEEK_SET);
count = (pcx->xmax+1) * (pcx->ymax+1);
- image_rgba = malloc( count * 4);
+ image_rgba = qmalloc( count * 4);
for (y=0 ; y<=pcx->ymax ; y++)
{
rows = targa_header.height;
numPixels = columns * rows;
- image_rgba = malloc (numPixels*4);
+ image_rgba = qmalloc(numPixels*4);
if (targa_header.id_length != 0)
fseek(fin, targa_header.id_length, SEEK_CUR); // skip TARGA image comment
if (matchheight && height != matchheight)
return NULL;
- image_rgba = malloc(width*height*4);
+ image_rgba = qmalloc(width*height*4);
fread(image_rgba + width*height*3, 1, width*height, f);
fclose(f);
return data; // some transparency
else
{
- free(data);
+ qfree(data);
return NULL; // all opaque
}
}
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
return 0;
texnum = GL_LoadTexture (filename, image_width, image_height, data, mipmap, true, 4);
- free(data);
+ qfree(data);
return texnum;
}
if (!(data = loadimagepixelsmask (filename, complain, matchwidth, matchheight)))
return 0;
texnum = GL_LoadTexture (filename, image_width, image_height, data, mipmap, true, 4);
- free(data);
+ qfree(data);
return texnum;
}
count = image_makemask(data, data, image_width * image_height);
if (count)
{
- filename2 = malloc(strlen(filename) + 6);
+ filename2 = qmalloc(strlen(filename) + 6);
sprintf(filename2, "%s_mask", filename);
image_masktexnum = GL_LoadTexture (filename2, image_width, image_height, data, mipmap, true, 4);
- free(filename2);
+ qfree(filename2);
}
- free(data);
+ qfree(data);
return texnum;
}
{
byte *buffer, *in, *out, *end;
- buffer = malloc(width*height*3 + 18);
+ buffer = qmalloc(width*height*3 + 18);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
}
COM_WriteFile (filename, buffer, width*height*3 + 18 );
- free(buffer);
+ qfree(buffer);
}
void Image_WriteTGARGB (char *filename, int width, int height, byte *data)
int y;
byte *buffer, *in, *out, *end;
- buffer = malloc(width*height*3 + 18);
+ buffer = qmalloc(width*height*3 + 18);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
}
COM_WriteFile (filename, buffer, width*height*3 + 18 );
- free(buffer);
+ qfree(buffer);
}
void Image_WriteTGARGBA (char *filename, int width, int height, byte *data)
int y;
byte *buffer, *in, *out, *end;
- buffer = malloc(width*height*4 + 18);
+ buffer = qmalloc(width*height*4 + 18);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
}
COM_WriteFile (filename, buffer, width*height*4 + 18 );
- free(buffer);
+ qfree(buffer);
}