@@ -108,7 +108,7 @@ void Component::setVisible (bool shouldBeVisible)
108108 if (bailOutChecker.shouldBailOut ())
109109 return ;
110110
111- repaint ();
111+ internalRepaint ();
112112}
113113
114114bool Component::isShowing () const
@@ -515,11 +515,10 @@ void Component::repaint (const Rectangle<float>& rect)
515515{
516516 jassert (! options.isRepainting ); // You are likely repainting from paint !
517517
518- if (rect.isEmpty () || ! isShowing ())
518+ if (rect.isEmpty () || ! isShowing ())
519519 return ;
520520
521- if (auto nativeComponent = getNativeComponent ())
522- nativeComponent->repaint (rect.translated (getBoundsRelativeToTopLevelComponent ().getTopLeft ()));
521+ internalRepaint (rect);
523522}
524523
525524// ==============================================================================
@@ -756,6 +755,10 @@ void Component::removeChildComponent (int index)
756755 return ;
757756
758757 auto component = children.removeAndReturn (index);
758+
759+ if (component->isShowing ())
760+ repaint (component->getBounds ());
761+
759762 component->parentComponent = nullptr ;
760763
761764 auto bailOutChecker = BailOutChecker (this );
@@ -1085,7 +1088,7 @@ bool Component::hasOpaqueChildCoveringArea (const Rectangle<float>& area)
10851088 for (int childIndex = children.size (); --childIndex >= 0 ;)
10861089 {
10871090 auto child = children.getUnchecked (childIndex);
1088- if (! child->isVisible () || ! child->isOpaque () || child->options .unclippedRendering || child->isTransformed ())
1091+ if (! child->isVisible () || ! child->isOpaque () || child->options .unclippedRendering || child->isTransformed ())
10891092 continue ;
10901093
10911094 auto childBounds = child->getBoundsRelativeToTopLevelComponent ();
@@ -1108,6 +1111,22 @@ void Component::internalRefreshDisplay (double lastFrameTimeSeconds)
11081111
11091112// ==============================================================================
11101113
1114+ void Component::internalRepaint ()
1115+ {
1116+ internalRepaint (getLocalBounds ());
1117+ }
1118+
1119+ void Component::internalRepaint (const Rectangle<float >& rect)
1120+ {
1121+ if (rect.isEmpty ())
1122+ return ;
1123+
1124+ if (auto nativeComponent = getNativeComponent ())
1125+ nativeComponent->repaint (rect.translated (getBoundsRelativeToTopLevelComponent ().getTopLeft ()));
1126+ }
1127+
1128+ // ==============================================================================
1129+
11111130void Component::internalPaint (Graphics& g, const Rectangle<float >& repaintArea, bool renderContinuous)
11121131{
11131132 if (! isVisible () || (getWidth () == 0 || getHeight () == 0 ))
0 commit comments