Painting outside a Component, is it optimized?


#1

Simple question, if I paint outside a component bounds, does Juce perform the paint operation for these external pixels (which would use some CPU time)?

I ask it to know if I need to optimize my code in component::paint() (or it's a waste of time)


#2

It depends.

Some operations are very easy to clip, others are not. Drawing a rectangle that's too big will take no extra time at all, but other things, e.g. a complex text layout, may be slow.

It also depends on the rendering engine - the CoreGraphics engine will behave differently to the software/GL engines.

So, the only correct advice is the same answer as for any performance-related question: Measure it, don't make any assumptions!


#3

Thank you. It did worth doing, since I saved around 70 times the CPU time.