simplify the vector buffer stuff

honestly doesent make that much sense in most cases to grow capacity * 2 (slightly misunderstood some stuff on implementation)
and in other cases dont need to manually check for resize
This commit is contained in:
Alug committed 2025-11-19 02:26:08 +01:00
1 parent 3519e4277d
commit f5c19fd3f3
3 files changed
+7 -18

No files matched your search

+1 -5
View File
@@ -215,11 +215,7 @@ static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspan
const float planelightfloat = PLANELIGHTFLOAT;
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
if (tiltlighting.size() != (size_t)viewwidth)
{
tiltlighting.resize(viewwidth);
}
tiltlighting.resize((size_t)viewwidth);
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, lightstart, lightend);
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", FixedToFloat(lightstart), FixedToFloat(lightend), focallengthf);
+4 -8
View File
@@ -487,10 +487,8 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
while (imgbuf.size() < maxoutsize)
{
imgbuf.resize(imgbuf.size() * 2);
}
imgbuf.assign(maxoutsize, 0);
imgptr = imgbuf.data();
@@ -621,10 +619,8 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
while (imgbuf.size() < maxoutsize)
{
imgbuf.resize(imgbuf.size() * 2);
}
imgbuf.assign(maxoutsize, 0);
imgptr = imgbuf.data();
+2 -5
View File
@@ -128,7 +128,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
UINT32 i;
patch_t *rotated;
static std::vector<UINT16> rawdst(1024 * 1024), rawconv(1024 * 1024); // 1 MB should be enough for most cases
static std::vector<UINT16> rawdst(512 * 1024), rawconv(512 * 1024); // 1 MB should be enough for most cases
UINT16 *rawout;
size_t size;
@@ -185,10 +185,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
if (!size)
size = (width * height);
while (rawdst.size() < size)
{
rawdst.resize(rawdst.size() * 2);
}
rawdst.resize(size);
for (i = 0; i < size; i++)
rawdst[i] = 0xFF00;