Skip to content

Commit

Permalink
Use the requested config, not the previous config in SizeConfigStrategy.
Browse files Browse the repository at this point in the history
Previously we'd use the config of the Bitmap that we happened to pull
from the pool instead of the config we'd requested. This isn't
frequently an issue because we only allow cross config re-use in a few
cases and we also need a size match. However, it's clearly incorrect to
ignore the requested config and can cause crashes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217896479
  • Loading branch information
sjudd committed Dec 19, 2018
1 parent a03ca14 commit be51b4e
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public Bitmap get(int width, int height, Bitmap.Config config) {
if (result != null) {
// Decrement must be called before reconfigure.
decrementBitmapOfSize(bestKey.size, result);
result.reconfigure(width, height,
result.getConfig() != null ? result.getConfig() : Bitmap.Config.ARGB_8888);
result.reconfigure(width, height, config);
}
return result;
}
Expand Down

0 comments on commit be51b4e

Please sign in to comment.