- replaced several explicit allocations with TArrays.
This commit is contained in:
parent
d68cd3aa80
commit
a73c065811
10 changed files with 66 additions and 115 deletions
|
|
@ -303,8 +303,8 @@ FVoxel *R_LoadKVX(int lumpnum)
|
|||
}
|
||||
|
||||
voxel->LumpNum = lumpnum;
|
||||
voxel->Palette = new uint8_t[768];
|
||||
memcpy(voxel->Palette, rawvoxel + voxelsize - 768, 768);
|
||||
voxel->Palette.Resize(768);
|
||||
memcpy(voxel->Palette.Data(), rawvoxel + voxelsize - 768, 768);
|
||||
|
||||
return voxel;
|
||||
}
|
||||
|
|
@ -382,22 +382,6 @@ uint8_t *FVoxelMipLevel::GetSlabData(bool wantremapped) const
|
|||
return SlabData;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FVoxel Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FVoxel::FVoxel()
|
||||
{
|
||||
Palette = NULL;
|
||||
}
|
||||
|
||||
FVoxel::~FVoxel()
|
||||
{
|
||||
if (Palette != NULL) delete [] Palette;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Create true color version of the slab data
|
||||
|
|
@ -430,7 +414,7 @@ void FVoxel::CreateBgraSlabData()
|
|||
int colorIndex = src->col[j];
|
||||
|
||||
uint32_t red, green, blue;
|
||||
if (Palette)
|
||||
if (Palette.Size())
|
||||
{
|
||||
red = (Palette[colorIndex * 3 + 0] << 2) | (Palette[colorIndex * 3 + 0] >> 4);
|
||||
green = (Palette[colorIndex * 3 + 1] << 2) | (Palette[colorIndex * 3 + 1] >> 4);
|
||||
|
|
@ -464,9 +448,9 @@ void FVoxel::Remap()
|
|||
{
|
||||
if (Remapped) return;
|
||||
Remapped = true;
|
||||
if (Palette != NULL)
|
||||
if (Palette.Size())
|
||||
{
|
||||
uint8_t *remap = GetVoxelRemap(Palette);
|
||||
uint8_t *remap = GetVoxelRemap(Palette.Data());
|
||||
for (int i = 0; i < NumMips; ++i)
|
||||
{
|
||||
int size = Mips[i].OffsetX[Mips[i].SizeX];
|
||||
|
|
@ -487,11 +471,7 @@ void FVoxel::Remap()
|
|||
|
||||
void FVoxel::RemovePalette()
|
||||
{
|
||||
if (Palette != NULL)
|
||||
{
|
||||
delete [] Palette;
|
||||
Palette = NULL;
|
||||
}
|
||||
Palette.Reset();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue