feat: Implement texture caching system with dirty flag optimization (closes #144)
- Add cache_subtree property on Frame for opt-in RenderTexture caching - Add PyTexture::from_rendered() factory for runtime texture creation - Add snapshot= parameter to Sprite for creating sprites from Frame content - Implement content_dirty vs composite_dirty distinction: - markContentDirty(): content changed, invalidate self and ancestors - markCompositeDirty(): position changed, ancestors need recomposite only - Update all UIDrawable position setters to use markCompositeDirty() - Add quick exit workaround for cleanup segfaults Benchmark: deep_nesting_cached is 3.7x faster (0.09ms vs 0.35ms) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8583db7225
commit
68f8349fe8
13 changed files with 220 additions and 56 deletions
|
|
@ -228,14 +228,14 @@ bool UIArc::setProperty(const std::string& name, float value) {
|
|||
center.x = value;
|
||||
position = center;
|
||||
vertices_dirty = true;
|
||||
markDirty(); // #144 - Propagate to parent for texture caching
|
||||
markCompositeDirty(); // #144 - Position change, texture still valid
|
||||
return true;
|
||||
}
|
||||
else if (name == "y") {
|
||||
center.y = value;
|
||||
position = center;
|
||||
vertices_dirty = true;
|
||||
markDirty(); // #144 - Propagate to parent for texture caching
|
||||
markCompositeDirty(); // #144 - Position change, texture still valid
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -253,7 +253,7 @@ bool UIArc::setProperty(const std::string& name, const sf::Color& value) {
|
|||
bool UIArc::setProperty(const std::string& name, const sf::Vector2f& value) {
|
||||
if (name == "center") {
|
||||
setCenter(value);
|
||||
markDirty(); // #144 - Propagate to parent for texture caching
|
||||
markCompositeDirty(); // #144 - Position change, texture still valid
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue