-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Fix crash when user updates icons with images of different sizes #2989
base: main
Are you sure you want to change the base?
Conversation
9bb7d8a
to
f78b887
Compare
Bloaty Results (iOS) 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2989-compared-to-main.txt |
Bloaty Results 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2989-compared-to-main.txtCompared to d387090 (legacy)
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2989-compared-to-legacy.txt |
Benchmark Results ⚡
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-2989-compared-to-main.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a regression tests? Perhaps to the Android Instrumentation tests?
We run into several crashes related to users calling
MapLibreMap.getStyle.addImage(imageId, imageBitmap)
with the sameimageId
butimageBitmap
with different sizes. In response to this call, MapLibre finds the texture atlas rectangle corresponding toimageId
and updates the rectangle withimageBitmap
without checking ifimageBitmap
fits the rectangle. This PR is a quick workaround to avoid the crash and unblock users. IfimageBitmap
is lager than the atlas rectangle forimageId
thenimageBitmap
gets resized to fit the rectangle.A probably better approach is to detect these cases and repack the atlas such as the rectangle allocated to
imageId
is the maximum size for all previously updated images.