diff options
Diffstat (limited to 'src/menu/drawable_control.cpp')
-rw-r--r-- | src/menu/drawable_control.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 0708599b..72c3ec77 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -39,7 +39,7 @@ namespace usdx DrawableControl::DrawableControl(Container* parent) : Control(parent), position(0, 0), size(0, 0), clipping_required(false), focusable(true), background(NULL), - parent(parent) + debug_box(NULL), parent(parent) { ContainerHelper(this).add(parent); } @@ -48,7 +48,7 @@ namespace usdx const ContainerHelper& helper) : Control(parent), position(0, 0), size(0, 0), clipping_required(false), focusable(true), background(NULL), - parent(parent) + debug_box(NULL), parent(parent) { helper.add(parent); } @@ -61,6 +61,11 @@ namespace usdx delete background; background = NULL; } + + if (debug_box) { + delete debug_box; + debug_box = NULL; + } } bool DrawableControl::is_clipping_required(void) const @@ -120,10 +125,14 @@ namespace usdx if (Application::get_config()->get_debug_boxes()) { - boost::shared_lock<boost::shared_mutex> lock(size_mutex); - StaticRectangle s(RgbColor(255, 0, 0), size); - s.set_stroke_width(2.0f); - s.repaint(); + if (debug_box == NULL) { + boost::shared_lock<boost::shared_mutex> lock(size_mutex); + + debug_box = new StaticRectangle(RgbColor(255, 0, 0), size); + debug_box->set_stroke_width(2.0f); + } + + debug_box->repaint(); } } |