Skip to content

Commit

Permalink
Use the original image size from Request if available
Browse files Browse the repository at this point in the history
  • Loading branch information
Tambet Ingo committed Apr 21, 2015
1 parent 8976c51 commit e80ee40
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,20 @@ boolean supportsReplay() {
* {@link Request}, only instantiating them if needed.
*/
static BitmapFactory.Options createBitmapOptions(Request data) {
final boolean justBounds = data.hasSize();
final boolean hasOriginalSize = data.hasOriginalSize();
final boolean justBounds = !hasOriginalSize && data.hasSize();
final boolean hasConfig = data.config != null;
BitmapFactory.Options options = null;
if (justBounds || hasConfig) {
if (hasOriginalSize || justBounds || hasConfig) {
options = new BitmapFactory.Options();
options.inJustDecodeBounds = justBounds;
if (hasConfig) {
options.inPreferredConfig = data.config;
}
if (hasOriginalSize && data.hasSize()) {
calculateInSampleSize(data.targetWidth, data.targetHeight, data.width, data.height, options,
data);
}
}
return options;
}
Expand Down

0 comments on commit e80ee40

Please sign in to comment.