Skip to content

Commit

Permalink
fix(ios): report width/height of Blob as pixels, not points
Browse files Browse the repository at this point in the history
With some sizes and scales, it is impossible to reconstruct the true number of pixels
in JS just with screen density/scale. We need to multiple image scale vs pts natively.
i.e. 10px square iumage on a 3x device reported width/height of 3, device scale of 3.
Multiplying in JS naively we'd get image size of 9px x 9px, which was incorrect.

Fixes TIMOB-27997
  • Loading branch information
sgtcoolguy committed Jul 13, 2020
1 parent aceba09 commit 51b6237
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ - (NSUInteger)width
{
[self ensureImageLoaded];
if (image != nil) {
return image.size.width;
return image.size.width * image.scale;
}
return 0;
}
Expand All @@ -78,7 +78,7 @@ - (NSUInteger)height
{
[self ensureImageLoaded];
if (image != nil) {
return image.size.height;
return image.size.height * image.scale;
}
return 0;
}
Expand All @@ -88,7 +88,7 @@ - (NSUInteger)size
{
[self ensureImageLoaded];
if (image != nil) {
return image.size.width * image.size.height;
return image.size.width * image.size.height * image.scale * image.scale;
}
switch (type) {
case TiBlobTypeData: {
Expand Down

0 comments on commit 51b6237

Please sign in to comment.