Mercurial > octave
diff libinterp/corefcn/graphics.in.h @ 26982:8d7265e353a0 stable
Improve performance when closing figures (bug #55908).
* graphics.cc (gh_manager::do_free): Don't execute remove_child when deleting
from groot.
* graphics.[cc,in.h] (delete_children, free): Add optional argument to indicate
that an object is deleted from graphics root.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 16 Mar 2019 22:21:26 +0100 |
parents | 3c7c5b7c3044 |
children | 4313b3caa483 232102b1e920 |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.in.h Mon Mar 25 22:06:23 2019 -0700 +++ b/libinterp/corefcn/graphics.in.h Sat Mar 16 22:21:26 2019 +0100 @@ -1764,6 +1764,11 @@ do_delete_children (clear); } + void delete_children (bool clear, bool from_root) + { + do_delete_children (clear, from_root); + } + void renumber (graphics_handle old_gh, graphics_handle new_gh) { for (auto& hchild : children_list) @@ -1886,6 +1891,8 @@ } void do_delete_children (bool clear); + + void do_delete_children (bool clear, bool from_root); }; // --------------------------------------------------------------------- @@ -2243,6 +2250,15 @@ } } + virtual void remove_child (const graphics_handle& h, bool) + { + if (children.remove_child (h.value ())) + { + children.run_listeners (); + mark_modified (); + } + } + virtual void adopt (const graphics_handle& h) { children.adopt (h.value ()); @@ -2311,6 +2327,11 @@ children.delete_children (clear); } + virtual void delete_children (bool clear, bool from_root) + { + children.delete_children (clear, from_root); + } + void renumber_child (graphics_handle old_gh, graphics_handle new_gh) { children.renumber (old_gh, new_gh); @@ -2546,6 +2567,14 @@ get_properties ().remove_child (h); } + virtual void remove_child (const graphics_handle& h, bool from_root) + { + if (! valid_object ()) + error ("base_graphics_object::remove_child: invalid graphics object"); + + get_properties ().remove_child (h, from_root); + } + virtual void adopt (const graphics_handle& h) { if (! valid_object ()) @@ -2894,6 +2923,8 @@ public: void remove_child (const graphics_handle& h); + void remove_child (const graphics_handle& h, bool from_root); + Matrix get_boundingbox (bool internal = false, const Matrix& parent_pix_size = Matrix ()) const; @@ -3075,6 +3106,8 @@ void remove_child (const graphics_handle& h); + void remove_child (const graphics_handle& h, bool from_root); + void set_visible (const octave_value& val); graphics_toolkit get_toolkit (void) const; @@ -3410,6 +3443,8 @@ void remove_child (const graphics_handle& h); + void remove_child (const graphics_handle& h, bool from_root); + void adopt (const graphics_handle& h); const scaler& get_x_scaler (void) const { return sx; } @@ -3608,6 +3643,8 @@ void delete_text_child (handle_property& h); + void delete_text_child (handle_property& h, bool from_root); + // See the genprops.awk script for an explanation of the // properties declarations. // Programming note: Keep property list sorted if new ones are added. @@ -5233,6 +5270,8 @@ public: void remove_child (const graphics_handle& h); + void remove_child (const graphics_handle& h, bool from_root); + void adopt (const graphics_handle& h); // See the genprops.awk script for an explanation of the @@ -5310,6 +5349,11 @@ base_properties::remove_child (h); } + void remove_child (const graphics_handle& h, bool from_root) + { + base_properties::remove_child (h, from_root); + } + void adopt (const graphics_handle& h) { base_properties::adopt (h); @@ -6214,6 +6258,12 @@ instance->do_free (h); } + static void free (const graphics_handle& h, bool from_root) + { + if (instance_ok ()) + instance->do_free (h, from_root); + } + static void renumber_figure (const graphics_handle& old_gh, const graphics_handle& new_gh) { @@ -6465,6 +6515,8 @@ void do_free (const graphics_handle& h); + void do_free (const graphics_handle& h, bool from_root); + void do_renumber_figure (const graphics_handle& old_gh, const graphics_handle& new_gh);