Refactor core APIs, fix bugs, and improve safety

- Make image result/info structs readonly; improve error handling and memory safety in image library
- Introduce IJobScheduler interface; move job scheduling docs to interface
- Remove "index 0 invalid" convention from slot/sparse maps; fix Count logic
- Add Owner<T> for disposable value types in low-level utilities
- Improve ObjectPool<T> thread safety and logic
- Change List<T>.RemoveAndSwapBack to return bool
- Remove unsafe methods from generated math types; add debug range checks
- Update benchmarks and enable collection checks in tests
- Improve documentation, comments, and error messages
- Bump assembly versions across all projects
This commit is contained in:
2025-12-21 16:08:10 +09:00
parent a1ad0bd2da
commit 1fee890329
38 changed files with 1967 additions and 350 deletions

View File

@@ -1,4 +1,4 @@
using Misaki.HighPerformance.Image.Runtime;
using Misaki.HighPerformance.Image.Runtime;
using System;
using System.IO;
using System.Runtime.InteropServices;
@@ -31,7 +31,9 @@ public static unsafe partial class StbImage
public stbi__context(Stream stream)
{
if (stream == null)
{
throw new ArgumentNullException("stream");
}
_stream = stream;
}
@@ -55,7 +57,9 @@ public static unsafe partial class StbImage
{
var b = s.Stream.ReadByte();
if (b == -1)
{
return 0;
}
return (byte)b;
}
@@ -79,7 +83,9 @@ public static unsafe partial class StbImage
{
if (s._tempBuffer == null ||
s._tempBuffer.Length < size)
{
s._tempBuffer = new byte[size * 2];
}
var result = s.Stream.Read(s._tempBuffer, 0, size);
Marshal.Copy(s._tempBuffer, 0, new IntPtr(buf), result);