Skip to content
  • tbaederr's avatar
    snapshot: Add gtk_snapshot_from_parent · cf1526cc
    tbaederr authored and Timm Bäder's avatar Timm Bäder committed
    Most of the time, the GtkSnapshot objects we create while snapshotting
    widgets don't end up containing all that many nodes or states in their
    respective node or state stack. This undermines the amortized allocation
    behavior of the G(Ptr)Array we use for the stacks. So instead, use the
    (until now unused) parent_snapshot GtkSnapshot* passed to
    gtk_widget_create_render_node and reuse its node and state stack.
    
    We do not avoid allocating a new GtkSnapshot object, but we do avoid
    allocating a ton of G(Ptr)Array objects and we also avoid realloc'ing
    their storage.
    cf1526cc