diff options
author | Jamie Pate <jpate@fortinet.com> | 2022-08-15 21:12:19 -0700 |
---|---|---|
committer | Jamie Pate <jpate@fortinet.com> | 2022-08-15 21:12:19 -0700 |
commit | c2e3971013b49c68bfa590b3b491d606b4f3adfb (patch) | |
tree | 0287e5448b3c8b6c523b6125c4fd3980fc2bf956 /scene/resources | |
parent | d5d22ab035a611a567f73a2ee2d61a81c99c61b5 (diff) |
Improve performance of screen_get_dpi() in Javascript
Replace a bisect with a single multiplication when calling
screen_get_dpi() in Javascript
Tested the value of
window.matchMedia(`(resolution:${(window.devicePixelRatio*96).toFixed(100)}dpi)`).matches
which is true except for values that cause a lot of rounding errors
(e.g. dpr : 0.3 => resolution: 28.799999999999997dpi)
Even in these cases the value matches the result of the previous
`findDPI()` method.
See also:
https://github.com/godotengine/godot/commit/6cff589b5bd483b563fe465bde74ca94902aab41#r81273660
Diffstat (limited to 'scene/resources')
0 files changed, 0 insertions, 0 deletions