Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clip the invalidation example. #929

Closed
wants to merge 1 commit into from
Closed

Clip the invalidation example. #929

wants to merge 1 commit into from

Conversation

jneem
Copy link
Collaborator

@jneem jneem commented May 15, 2020

Fixes #872.

This makes the invalidation example act the same on all platforms, and it also explains what's going on in a comment.

@luleyleo
Copy link
Collaborator

Totally forgot that issue 😝
I'm not sure this is the solution we want however.

One of druids goals is to abstract platform wonkiness away where possible and having clipping on some platforms but not on others actually adds custom druid wokiness.

IMO anything that is not explicitly platform specific should behave exactly the same on all platforms we support. Thus we should either have clipping on all platforms (seems preferable) or on none.

@jneem
Copy link
Collaborator Author

jneem commented May 15, 2020

It should be easy enough to enable clipping on all platforms. I think the other one isn't possible, though. For example, the windows docs explicitly say that on the paint callback you aren't allowed to paint outside the invalidated rect, so I think we have to do clipping there.

@luleyleo
Copy link
Collaborator

Gotta Clip 'em All seems like the best choice then 👍

@jneem
Copy link
Collaborator Author

jneem commented May 15, 2020

Cool, I've opened #941

@jneem jneem closed this May 15, 2020
@jneem jneem deleted the invalidation branch May 15, 2020 13:57
@cmyr
Copy link
Member

cmyr commented May 17, 2020

yea this is... tricky, and feels like policy. We haven't really codified what we should do when a widget draws outside of its bounds; my hunch is that we should clip by default, but allow for opting in to overflow?

@xStrom
Copy link
Member

xStrom commented May 17, 2020

I don't think there's a way to opt-in to overflow with GTK for what it's worth.

@luleyleo
Copy link
Collaborator

Due to what @jneem said I think clipping always is the best choice:

For example, the windows docs explicitly say that on the paint callback you aren't allowed to paint outside the invalidated rect, so I think we have to do clipping there.

@cmyr
Copy link
Member

cmyr commented May 17, 2020

this is explicitly about the partial invalidation case? clipping makes more sense there, I agree.

@xStrom
Copy link
Member

xStrom commented May 17, 2020

Yeah it's about partial invalidation. Widgets can still overpaint as much as they want inside the window's invalidation rect union.

@luleyleo
Copy link
Collaborator

So if one wants a widget to draw outside of its bounds, it can just invalidated that area as well.

@jneem
Copy link
Collaborator Author

jneem commented May 17, 2020

Ignoring partial invalidation and just talking about widgets painting outside their bounds: isn't this what paint_insets is for? Since a widget can use that to gain complete control over their own bounds, I feel like it isn't restrictive to enforce paint bounds via clipping. On the other hand, I'm not sure if there's a performance cost for saving and restoring the clip state so frequently...

@xStrom
Copy link
Member

xStrom commented May 17, 2020

I think there's a performance impact for doing so much clipping, but I haven't measured it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The invalidation example behaves differently with wasm
4 participants