setPaintingIsUnclipped question


#1

Does “setPaintingIsUnclipped” on a component only affect that one component, are all its children too? I have the situation that I have a large component, that includes sixteen children, each containing dozens of components and some children as well.

I currently set “setPaintingIsUnclipped” on each and every component within the hierarchy, but I wonder if calling it on the parent component alone would suffice.


#2

It only affects the one you call it on. When each child is painted, they’ll do their own clipping unless you disable it.


#3

Thanks for the clarification.


#4

Using setPaintingIsUnclipped on a component that has children is not working well.
See that thread:


#5

I think that thread was just a misunderstanding of what they expected it to do.

As long as none of the components draw outside their own bounds (and as long as all the children are safely within the bounds of their parent) then it will work perfectly well on hierarchies of components too.


#6

I don’t think it’s working perfectly.
my point in the other thread was that if a component is setPaintingIsUnclipped(), then it will always be entirely repainted whenever its child is repainted, even if it’s unnecessary.


#7

Oh, well yes, that’s true.


#8

that seems undesirable. do you think you will change this behavior?


#9

No… not sure it’d be possible to fix that without defeating the purpose of the optimisation itself.


#10

OK, so the takeaway here is: only apply that flag to the children not having children themselves for optimal performance.


#11

I guess you are right, and therefore I suspect that adding a couple of assertions for that may be convenient:

  • one in setPaintingIsUnclipped(), which triggers if the Component it is called onto, already has children

  • another one in the methods that add children to a Component, that triggers if the unclipped flag is set at the moment of the addition