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

[ScrollableControl] DisplayRectangle should be unscaled values. #67

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

jpobst
Copy link
Collaborator

@jpobst jpobst commented Jul 26, 2023

Fixes #51

ScrollableControl overrides Control.DisplayRectangle to remove additional space for scrollbars and padding. However by using ClientRectangle it was calculating a scaled size instead of an unscaled size. This meant on a 200% DPI system the total area was 4X the expected size.

Because DisplayRectangle is the size measurement used by the layout system, controls that were docked in this control were sized at 4X. If they themselves were ScrollableControls then they would be 4X also, resulting in 16X, etc.

This causes enormous Skia buffers to be allocated, resulting in absurd memory usage on HiDPI machines.

Fix to be an unscaled size.

@jpobst jpobst marked this pull request as ready for review July 26, 2023 14:57
@jpobst jpobst merged commit f757584 into main Jul 26, 2023
3 checks passed
@jpobst jpobst deleted the scrollable-memory-fix branch July 26, 2023 14:57
@dax-leo
Copy link

dax-leo commented Jul 26, 2023

Great job solving this one.
This was really a critical bug.

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.

Memory Leak ?
2 participants