Skip to content

Commit

Permalink
Merge pull request square#1417 from hzsweers/z/reconfigure
Browse files Browse the repository at this point in the history
Use getAllocationByteCount() for API 19+
  • Loading branch information
JakeWharton authored Jun 10, 2016
2 parents 1426257 + 3790697 commit 3f379e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion picasso/src/main/java/com/squareup/picasso/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import static android.os.Build.VERSION_CODES.HONEYCOMB_MR1;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
import static android.os.Build.VERSION_CODES.KITKAT;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static com.squareup.picasso.Picasso.TAG;
import static java.lang.String.format;
Expand Down Expand Up @@ -109,7 +110,9 @@ private Utils() {

static int getBitmapBytes(Bitmap bitmap) {
int result;
if (SDK_INT >= HONEYCOMB_MR1) {
if (SDK_INT >= KITKAT) {
result = bitmap.getAllocationByteCount();
} else if (SDK_INT >= HONEYCOMB_MR1) {
result = BitmapHoneycombMR1.getByteCount(bitmap);
} else {
result = bitmap.getRowBytes() * bitmap.getHeight();
Expand Down

0 comments on commit 3f379e0

Please sign in to comment.