13
0

allow runtime control over cairo save/restore around item rendering

This is to allow easier debugging of whether a given item's render method fails to leave a cairo
context in the same state it received it in
This commit is contained in:
Paul Davis 2024-03-22 13:39:03 -06:00
parent d57ce0eba1
commit adfba3d39d
3 changed files with 16 additions and 1 deletions

View File

@ -68,6 +68,13 @@ Canvas::Canvas ()
#else
_use_intermediate_surface = NULL != g_getenv("ARDOUR_INTERMEDIATE_SURFACE");
#endif
if (g_getenv ("ARDOUR_ITEM_CAIRO_SAVE_RESTORE")) {
item_save_restore = true;
} else {
item_save_restore = false;
}
set_epoch ();
}

View File

@ -188,6 +188,9 @@ public:
void set_debug_render (bool yn) { _debug_render = yn; }
bool debug_render() const { return _debug_render; }
bool item_save_restore;
protected:
Root _root;
uint32_t _queue_draw_frozen;

View File

@ -941,8 +941,13 @@ Item::render_children (Rect const & area, Cairo::RefPtr<Cairo::Context> context)
}
}
#endif
if (_canvas->item_save_restore) {
context->save();
}
(*i)->render (area, context);
if (_canvas->item_save_restore) {
context->restore();
}
++render_count;
}