Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] [Qt] Avoid NaNs in TransformState unit conversions #5074

Merged
merged 1 commit into from
May 20, 2016

Conversation

brunoabinader
Copy link
Member

@brunoabinader brunoabinader commented May 19, 2016

Fix cases where e.g. state has either zero width or height, causing the unit conversion functions to return NaNs.

👀 @kkaefer @jfirebaugh @ansis

@brunoabinader brunoabinader added bug Core The cross-platform C++ core, aka mbgl Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL labels May 19, 2016
@brunoabinader brunoabinader force-pushed the brunoabinader-transformstate-zero-size branch from 3dece87 to 228238b Compare May 19, 2016 16:16
@@ -84,7 +84,7 @@ class TransformState {
NorthOrientation orientation = NorthOrientation::Upwards;

// logical dimensions
uint16_t width = 0, height = 0;
uint16_t width = 1, height = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any unsigned number != 0. Either this or we could go the other way and use std::numeric_limits::max.

Copy link
Contributor

@1ec5 1ec5 May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fixes #1572 (unless we go the std::numeric_limits::max route).

@brunoabinader brunoabinader force-pushed the brunoabinader-transformstate-zero-size branch 3 times, most recently from 3ebe157 to 5431c2d Compare May 20, 2016 07:37
@brunoabinader brunoabinader changed the title [core] [Qt] Prevent TransformState size from being (0, 0) [core] [Qt] Avoid NaNs in TransformState unit conversions May 20, 2016
@brunoabinader brunoabinader force-pushed the brunoabinader-transformstate-zero-size branch from 5431c2d to 00dd3ab Compare May 20, 2016 12:31
Fix cases where e.g. state has either zero width or height, causing the
unit convertion functions would return NaNs.
@brunoabinader brunoabinader force-pushed the brunoabinader-transformstate-zero-size branch from 00dd3ab to f751d2c Compare May 20, 2016 13:18
@brunoabinader brunoabinader merged commit f751d2c into master May 20, 2016
@brunoabinader brunoabinader deleted the brunoabinader-transformstate-zero-size branch May 20, 2016 13:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants