@@ -56,10 +56,10 @@ class NVGSurface final :
5656
5757 class InvalidationListener final : public CachedComponentImage {
5858 public:
59- InvalidationListener (NVGSurface& s, Component* origin, bool const passRepaintEvents = false )
59+ InvalidationListener (NVGSurface& s, Component* origin, std::function< bool ()> canRepaintCheck = [](){ return true ; } )
6060 : surface(s)
6161 , originComponent(origin)
62- , passEvents(passRepaintEvents )
62+ , canRepaint(canRepaintCheck )
6363 {
6464 }
6565
@@ -71,26 +71,26 @@ class NVGSurface final :
7171 auto invalidatedBounds = surface.getLocalArea (originComponent, rect.expanded (2 ).toFloat ()).getSmallestIntegerContainer ();
7272 invalidatedBounds = invalidatedBounds.getIntersection (surface.getLocalBounds ());
7373
74- if (originComponent->isVisible () && !invalidatedBounds.isEmpty ()) {
74+ if (originComponent->isVisible () && canRepaint () && !invalidatedBounds.isEmpty ()) {
7575 surface.invalidateArea (invalidatedBounds);
7676 }
7777
78- return surface.renderThroughImage || passEvents ;
78+ return surface.renderThroughImage ;
7979 }
8080
8181 bool invalidateAll () override
8282 {
83- if (originComponent->isVisible ()) {
83+ if (originComponent->isVisible () && canRepaint () ) {
8484 surface.invalidateArea (originComponent->getLocalBounds ());
8585 }
86- return surface.renderThroughImage || passEvents ;
86+ return surface.renderThroughImage ;
8787 }
8888
8989 void releaseResources () override { }
9090
9191 NVGSurface& surface;
9292 Component* originComponent;
93- bool passEvents ;
93+ std::function< bool ()> canRepaint ;
9494 };
9595
9696 void invalidateArea (Rectangle<int > area);
0 commit comments