JUCE paint - only redraw parts that need updates?

I’m just implementing a timeline view which basically is a very wide child view wrapped in a viewport. The child view can be several 10.000 pix wide.

I did this in OS X using an NSScrollView and I noticed that the scrollview will only request e.g. the next 256 pixels to the right if the user scrolls to the right.

In JUCE though, the paint method doesn’t pass in a parameter to determine the area that needs to be redrawn so I’m wondering what the intended behavior is to redraw your component in the paint method.

Thanks for the help!

Your drawing will be clipped to only the part that needs redrawing. Use the Graphics::getClipBounds and/or Graphics:: clipRegionIntersects methods if you need to know what exactly needs to be redrawn.

1 Like

Perfect! Thanks for your quick reply!