Record that an actor cannot be scaled per axis
Some checks failed
libakgl CI Build / cmake_build (push) Failing after 20s
libakgl CI Build / performance (push) Failing after 21s
libakgl CI Build / memory_check (push) Failing after 15s
libakgl CI Build / mutation_test (push) Failing after 16s

akgl_Actor::scale is one float32_t applied to both dest.w and dest.h, so
"twice as wide, the same height" cannot be expressed. The VIC-II has had
separate x- and y-expand bits since 1982 and Commodore BASIC 7.0's SPRITE
verb exposes both, so a BASIC interpreter drawing through this library
cannot implement its own documented verb.

Reached from akbasic, whose sprites are 24x21. It works around this and
defect 26 together by installing its own renderfunc on each actor rather
than patching around the library.

Two other defects were filed alongside this one before the rebase and
both are gone: the drawn-height-from-width bug is already defect 26, and
the akgl_path_relative context leak was fixed in c622754.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-31 16:51:34 -04:00
parent 5dfa49482c
commit 93e8e4afa4

16
TODO.md
View File

@@ -1748,3 +1748,19 @@ this library and told it is compatible.
`akgl_character_state_sprites_iterate` is still uncovered and is the natural
place to start; `tests/actor.c` now covers `akgl_character_sprite_get` and the
composite-state binding behavior it depends on.
2. **An actor cannot be scaled per axis.** `akgl_Actor::scale` is one `float32_t` applied
to both `dest.w` and `dest.h`, so there is no way to express "twice as wide, the same
height". The VIC-II has had separate x- and y-expand bits since 1982 and Commodore
BASIC 7.0's `SPRITE` verb exposes both, so a BASIC interpreter drawing through libakgl
cannot implement its own documented verb.
Two shapes are plausible and the choice is a design decision rather than an obvious
fix: add `scale_x` / `scale_y` and keep `scale` as a convenience that writes both, or
replace `scale` outright and take the ABI break while the major version is still 0.
The second is cleaner and the soname already carries `MAJOR.MINOR`.
Related to defect 26, and reached the same way: `akbasic`'s sprites are Commodore
sprites, 24 wide and 21 high, and `SPRITE n,,,,1` expands one axis. It works around
both by installing its own `renderfunc` on each actor rather than patching around the
library.