Skip to content

Commit

Permalink
Extract resource name to variable for ShadowBitmapFactory#decodeResource
Browse files Browse the repository at this point in the history
Signed-off-by: utzcoz <utzcoz@outlook.com>
  • Loading branch information
utzcoz committed Nov 7, 2021
1 parent 0c431fb commit 50249f2
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -75,15 +75,16 @@ protected static Bitmap decodeResource(Resources res, int id, BitmapFactory.Opti
final TypedValue value = new TypedValue();
InputStream is = res.openRawResource(id, value);

RobolectricBufferedImage image = getImageFromStream(res.getResourceName(id), is);
String resourceName = res.getResourceName(id);
RobolectricBufferedImage image = getImageFromStream(resourceName, is);
if (!allowInvalidImageData && image == null) {
if (options != null) {
options.outWidth = -1;
options.outHeight = -1;
}
return null;
}
Bitmap bitmap = create("resource:" + res.getResourceName(id), options, image);
Bitmap bitmap = create("resource:" + resourceName, options, image);
ShadowBitmap shadowBitmap = Shadow.extract(bitmap);
shadowBitmap.createdFromResId = id;
return bitmap;
Expand Down

0 comments on commit 50249f2

Please sign in to comment.