Skip to content

Commit

Permalink
Fix base64 image asset not fit container's size (#2501)
Browse files Browse the repository at this point in the history
Currently, I am encountering a similar issue to [#1200](#1200), but in the case where the asset is a base64 image, it has not been fixed yet.
  • Loading branch information
hblab-nghianh committed May 14, 2024
1 parent aebf9bc commit 13bed12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,9 @@ private static LottieResult<LottieComposition> fromZipStreamSyncInternal(Context
Logger.warning("data URL did not have correct base64 format.", e);
return null;
}
asset.setBitmap(BitmapFactory.decodeByteArray(data, 0, data.length, opts));
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opts);
bitmap = Utils.resizeBitmapIfNeeded(bitmap, asset.getWidth(), asset.getHeight());
asset.setBitmap(bitmap);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public void setDelegate(@Nullable ImageAssetDelegate assetDelegate) {
return null;
}
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opts);
return putBitmap(id, bitmap);
Bitmap resizedBitmap = Utils.resizeBitmapIfNeeded(bitmap, asset.getWidth(), asset.getHeight());
return putBitmap(id, resizedBitmap);
}

InputStream is;
Expand Down

0 comments on commit 13bed12

Please sign in to comment.