Here is a simple Demo-Component.
It owns two opaque components. If you repaint() both of them at the same time, the parent-component paint() method will be called too (but it will not redraw, confirmed with random colour-fill). So if there is nothing repainted, why is it called?
Maybe room for huge performance improvment?
class MainContentComponent : public Component, public Timer
{
public:
MainContentComponent()
{
addAndMakeVisible(c1);
addAndMakeVisible(c2);
setSize (600, 400);
startTimer(100);
}
~MainContentComponent()
{
}
void timerCallback() override
{
c1.repaint();
c2.repaint();
};
void paint (Graphics& g) override
{
g.fillAll(Colour(r.nextFloat(),1.f,0.5,1.f));
}
void resized() override
{
c1.setBounds(100,50,400,100);
c2.setBounds(100,250,400,100);
}
class ChildComponent : public Component
{
public:
ChildComponent() :
r(334543)
{
setOpaque(true);
};
void paint (Graphics &g) override
{
g.fillAll(Colour(r.nextFloat(),1.f,0.5,1.f));
};
Random r;
};
ChildComponent c1;
ChildComponent c2;
Random r;
private:
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};
http://i.imgur.com/9IhMB8V.png

