diff --git a/src/r_draw_span.cpp b/src/r_draw_span.cpp index ca41b17c8..806cee954 100644 --- a/src/r_draw_span.cpp +++ b/src/r_draw_span.cpp @@ -215,11 +215,7 @@ static void R_GetTiltedLighting(std::vector& 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); diff --git a/src/r_patch.cpp b/src/r_patch.cpp index 515f5ea38..0f9937ee9 100644 --- a/src/r_patch.cpp +++ b/src/r_patch.cpp @@ -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(); diff --git a/src/r_patchrotation.cpp b/src/r_patchrotation.cpp index 485a8b9f1..9fdda001b 100644 --- a/src/r_patchrotation.cpp +++ b/src/r_patchrotation.cpp @@ -128,7 +128,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle UINT32 i; patch_t *rotated; - static std::vector rawdst(1024 * 1024), rawconv(1024 * 1024); // 1 MB should be enough for most cases + static std::vector 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;