Fixed memory leaks

This commit is contained in:
Simon Lübeß
2021-10-11 12:41:56 +02:00
parent 5a82b89622
commit 2cd9ab3e69
+4 -3
View File
@@ -444,13 +444,13 @@ namespace GlitchyEngine.Renderer.Text
int bufferX = desc.Width; int bufferX = desc.Width;
int bufferY = desc.Height; int bufferY = desc.Height;
Bitmap<ColorRGB, const 1> bitmap = .((.)bufferX, (.)bufferY); using(Bitmap<ColorRGB, const 1> bitmap = .((.)bufferX, (.)bufferY))
{
MSDFGeneratorConfig config = .(); MSDFGeneratorConfig config = .();
msdfgen.GenerateMSDF(*(Bitmap<float, const 3>*)&bitmap, shape, projection, _range, config); msdfgen.GenerateMSDF(*(Bitmap<float, const 3>*)&bitmap, shape, projection, _range, config);
int8[] pixels = new int8[desc.Width * desc.Height * 4]; int8[] pixels = new:ScopedAlloc! int8[desc.Width * desc.Height * 4];
int8 ToInt8(float f) => (.)Math.Clamp(127f * f, int8.MinValue, int8.MaxValue); int8 ToInt8(float f) => (.)Math.Clamp(127f * f, int8.MinValue, int8.MaxValue);
@@ -472,4 +472,5 @@ namespace GlitchyEngine.Renderer.Text
(.)desc.Width, (.)desc.Height, (.)desc.MapCoord.Z); (.)desc.Width, (.)desc.Height, (.)desc.MapCoord.Z);
} }
} }
}
} }