Stage 1: headless Image and AudioData; GPU and playback caches in the UI

- resource::Image (pixels, size, uid) replaces Texture in documents, undo and
  wizards; it lives in anm2ed_core with no GL. uid changes with the pixels.
- resource::texture::id_get uploads lazily and evicts textures not drawn in a frame
- resource::AudioData (bytes, uid) replaces Audio; resource::audio::play/stop/
  track_detach/is_playing cache decoded audio and tracks per uid
- Resources::icon_id_get shortens the icon call sites
- tests/assets.cpp covers Image png round trip, uid tracking, merge_append

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 14:52:34 -04:00
1 parent 5311c2835f
commit 26ab394fe4
37 files changed
+538 -614

No files matched your search

+7 -7
View File
@@ -26,15 +26,15 @@ namespace anm2ed::snapshots
left.references == right.references;
}
bool is_texture_equal(const resource::Texture& left, const resource::Texture& right)
bool is_texture_equal(const resource::Image& left, const resource::Image& right)
{
return left.size == right.size && left.filter == right.filter && left.channels == right.channels &&
left.pixels == right.pixels;
return left.uid == right.uid ||
(left.size == right.size && left.isLinear == right.isLinear && left.pixels == right.pixels);
}
bool is_audio_equal(const resource::Audio& left, const resource::Audio& right)
bool is_audio_equal(const resource::AudioData& left, const resource::AudioData& right)
{
return const_cast<resource::Audio&>(left).is_valid() == const_cast<resource::Audio&>(right).is_valid();
return left.is_valid() == right.is_valid();
}
template <typename T, typename Compare>
@@ -61,12 +61,12 @@ namespace anm2ed::snapshots
bool is_value_equal(const Storage& left, const Storage& right) { return is_storage_equal(left, right); }
bool is_value_equal(const std::map<int, resource::Texture>& left, const std::map<int, resource::Texture>& right)
bool is_value_equal(const std::map<int, resource::Image>& left, const std::map<int, resource::Image>& right)
{
return is_map_equal(left, right, is_texture_equal);
}
bool is_value_equal(const std::map<int, resource::Audio>& left, const std::map<int, resource::Audio>& right)
bool is_value_equal(const std::map<int, resource::AudioData>& left, const std::map<int, resource::AudioData>& right)
{
return is_map_equal(left, right, is_audio_equal);
}