本文整理汇总了C++中refimport_t::Free方法的典型用法代码示例。如果您正苦于以下问题:C++ refimport_t::Free方法的具体用法?C++ refimport_t::Free怎么用?C++ refimport_t::Free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类refimport_t
的用法示例。
在下文中一共展示了refimport_t::Free方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: R_LoadPCX
void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
{
union {
byte *b;
void *v;
} raw;
byte *end;
pcx_t *pcx;
int len;
unsigned char dataByte = 0, runLength = 0;
byte *out, *pix;
unsigned short w, h;
byte *pic8;
byte *palette;
int i;
unsigned size = 0;
if (width)
*width = 0;
if (height)
*height = 0;
*pic = NULL;
//
// load the file
//
len = ri.FS_ReadFile( ( char * ) filename, &raw.v);
if (!raw.b || len < 0) {
return;
}
if((unsigned)len < sizeof(pcx_t))
{
ri.Printf (PRINT_ALL, "PCX truncated: %s\n", filename);
ri.FS_FreeFile (raw.v);
return;
}
//
// parse the PCX file
//
pcx = (pcx_t *)raw.b;
end = raw.b+len;
w = LittleShort(pcx->xmax)+1;
h = LittleShort(pcx->ymax)+1;
size = w*h;
if (pcx->manufacturer != 0x0a
|| pcx->version != 5
|| pcx->encoding != 1
|| pcx->color_planes != 1
|| pcx->bits_per_pixel != 8
|| w >= 1024
|| h >= 1024)
{
ri.Printf (PRINT_ALL, "Bad or unsupported pcx file %s (%dx%[email protected]%d)\n", filename, w, h, pcx->bits_per_pixel);
return;
}
pix = pic8 = ri.Malloc ( size );
raw.b = pcx->data;
// FIXME: should use bytes_per_line but original q3 didn't do that either
while(pix < pic8+size)
{
if(runLength > 0) {
*pix++ = dataByte;
--runLength;
continue;
}
if(raw.b+1 > end)
break;
dataByte = *raw.b++;
if((dataByte & 0xC0) == 0xC0)
{
if(raw.b+1 > end)
break;
runLength = dataByte & 0x3F;
dataByte = *raw.b++;
}
else
runLength = 1;
}
if(pix < pic8+size)
{
ri.Printf (PRINT_ALL, "PCX file truncated: %s\n", filename);
ri.FS_FreeFile (pcx);
ri.Free (pic8);
}
if (raw.b-(byte*)pcx >= end - (byte*)769 || end[-769] != 0x0c)
{
ri.Printf (PRINT_ALL, "PCX missing palette: %s\n", filename);
ri.FS_FreeFile (pcx);
ri.Free (pic8);
return;
//.........这里部分代码省略.........