-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Floating-point logical sprite image dimensions #3008
Conversation
Awesome that you tracked this down, fix works. Adding some decimals in iosapp's marker image code is enough to confirm: diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm
index 6380406..61d39b8 100644
--- a/ios/app/MBXViewController.mm
+++ b/ios/app/MBXViewController.mm
@@ -368,7 +368,7 @@ static UIColor *const kTintColor = [UIColor colorWithRed:0.120 green:0.550 blue:
if ( ! image)
{
- CGRect rect = CGRectMake(0, 0, 20, 15);
+ CGRect rect = CGRectMake(0, 0, 20.5, 15.5);
UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]); |
I'm suspicious of the float ⇢ integer conversions that will be happening after this change here and here. We should probably review our handling of physical/logical dimensions at a higher level. Always using integer pixel dimensions plus float pixel ratio makes the most sense to me, but I haven't thought about it a lot. |
The upshot is that without floating point logical dimensions (expressed in "points" in iOS), you can't have an odd width or height after multiplying by the pixel ratio. |
On HiDPI screens, the logical dimensions of a sprite image can be non-integral. Fixes #2198.
ec2796a
to
281f366
Compare
The padding in |
Also related to Android via #3031 |
I'm working on a different fix along the lines of #3008 (comment), and build on the new |
@jfirebaugh Sounds good! Do you have a ticket or branch that we can link to so that we make sure this gets addressed / tickets closed in the iOS and Android bindings when it's ready? |
On HiDPI screens, the logical dimensions of a sprite image can be non-integral.
Fixes #2198.
/cc @incanus @friedbunny