fix(gfx): 0x1f7 is a registry ERASE, not a create
RE correction: op 0x1f7's worker gfx_registry_erase_range (@0x47d8b0) loops gfx_registry_erase over [handle, handle+count) — a teardown, not a create. Objects are created lazily by the geometry SET ops (gfx_object_get_or_create). GfxState.EraseRange + VM case + tests; opcodes.toml renamed gfx-elem-create -> gfx-elem-erase; Ghidra handler + workers annotated. Booted SC0000 CG geometry unchanged for the working CGs (no regression). Engine 40 green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -38,4 +38,25 @@ public class GfxStateTests
|
||||
[Fact]
|
||||
public void PackColorPacksArgb()
|
||||
=> Assert.Equal(0x80_112233L, GfxState.PackColor(0x80, 0x112233));
|
||||
|
||||
[Fact]
|
||||
public void EraseRangeRemovesHandlesInRange()
|
||||
{
|
||||
var g = new GfxState();
|
||||
g.GetOrCreate(0x10); g.GetOrCreate(0x11); g.GetOrCreate(0x12); g.GetOrCreate(0x20);
|
||||
g.EraseRange(0x10, 3); // count>1 → erase [0x10, 0x13)
|
||||
Assert.Equal(-1, g.QuerySlot(0x10));
|
||||
Assert.Equal(-1, g.QuerySlot(0x12));
|
||||
Assert.NotEqual(-1, g.QuerySlot(0x20)); // outside the range, kept
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EraseRangeCountLeOneErasesSingleHandle()
|
||||
{
|
||||
var g = new GfxState();
|
||||
g.GetOrCreate(0x10); g.GetOrCreate(0x11);
|
||||
g.EraseRange(0x10, 1); // count<=1 → single handle
|
||||
Assert.Equal(-1, g.QuerySlot(0x10));
|
||||
Assert.NotEqual(-1, g.QuerySlot(0x11));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user