- allow allocating constructor of TArray to also reserve the allocated data and use this to properly handle the precalc arrays for the texture resizer.

This commit is contained in:
Christoph Oelckers 2017-11-03 17:27:32 +01:00
parent 8104ef5189
commit fafc636476
2 changed files with 4 additions and 4 deletions

View File

@ -93,8 +93,8 @@ void FHardwareTexture::Resize(int width, int height, unsigned char *src_data, un
// down we will need to gather a grid of pixels of the size of the scale // down we will need to gather a grid of pixels of the size of the scale
// factor in each direction and then do an averaging of the pixels. // factor in each direction and then do an averaging of the pixels.
TArray<BoxPrecalc> vPrecalcs(height); TArray<BoxPrecalc> vPrecalcs(height, true);
TArray<BoxPrecalc> hPrecalcs(width); TArray<BoxPrecalc> hPrecalcs(width, true);
ResampleBoxPrecalc(vPrecalcs, texheight); ResampleBoxPrecalc(vPrecalcs, texheight);
ResampleBoxPrecalc(hPrecalcs, texwidth); ResampleBoxPrecalc(hPrecalcs, texwidth);

View File

@ -132,10 +132,10 @@ public:
Count = 0; Count = 0;
Array = NULL; Array = NULL;
} }
TArray (int max) TArray (int max, bool reserve = false)
{ {
Most = max; Most = max;
Count = 0; Count = reserve? max : 0;
Array = (T *)M_Malloc (sizeof(T)*max); Array = (T *)M_Malloc (sizeof(T)*max);
} }
TArray (const TArray<T,TT> &other) TArray (const TArray<T,TT> &other)