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

Do not allow setting too small or big scale factors #109

Merged
merged 2 commits into from
Jun 1, 2022

Conversation

aperezdc
Copy link
Contributor

@aperezdc aperezdc commented Jun 1, 2022

Add a check to constraint the allowed device scale factors to the [0.05, 5.0] range, ignoring values outside the interval. For debug builds, an assertion will also make it easier for developers to fix bugs in code that calls the function with invalid values.

Setting the device scale factor to unreasonably low values can result in divisions by zero, wrong rendering, and/or odd behaviour in general; while for too big values graphics buffers will consume unreasonably big amounts of memory or the maximum usable size for them will result in failure to allocate buffers and content being partially rendered (if at all).

While at it, document the wpe_view_backend_dispatch_set_device_scale_factor() function.

Fixes #89

Add a check to constraint the allowed device scale factors to the
[0.05, 5.0] range, ignoring values outside the interval. For debug
builds, an assertion will also make it easier for developers to fix
bugs in code that calls the function with invalid values.

Setting the device scale factor to unreasonably low values can result in
divisions by zero, wrong rendering, and/or odd behaviour in general;
while for too big values graphics buffers will consume unreasonably big
amounts of memory or the maximum usable size for them will result in
failure to allocate buffers and content being partially rendered (if at
all).

Fixes #89
@aperezdc aperezdc added this to the 1.14 milestone Jun 1, 2022
@aperezdc aperezdc self-assigned this Jun 1, 2022
@aperezdc aperezdc merged commit 8a7603e into master Jun 1, 2022
@aperezdc aperezdc deleted the aperezdc/device-scale-limits branch June 1, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Setting zero as device scale factor wrecks havoc
2 participants