summaryrefslogtreecommitdiff
path: root/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bitmap/drawable/BasicBitmapDrawable.java')
-rw-r--r--src/com/android/bitmap/drawable/BasicBitmapDrawable.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
index ffea5c8..5de0840 100644
--- a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
@@ -203,7 +203,7 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
}
if (key == null) {
- invalidateSelf();
+ onDecodeFailed();
Trace.endSection();
return;
}
@@ -241,6 +241,7 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
*/
protected void loadFileDescriptorFactory() {
if (mCurrKey == null || mDecodeWidth == 0 || mDecodeHeight == 0) {
+ onDecodeFailed();
return;
}
@@ -258,16 +259,30 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
final FileDescriptorFactory factory) {
if (mCreateFileDescriptorFactoryTask == null) {
// Cancelled.
+ onDecodeFailed();
return;
}
mCreateFileDescriptorFactoryTask = null;
+ if (factory == null) {
+ // Failed.
+ onDecodeFailed();
+ return;
+ }
+
if (key.equals(mCurrKey)) {
decode(factory);
}
}
/**
+ * Called when the decode process is cancelled at any time.
+ */
+ protected void onDecodeFailed() {
+ invalidateSelf();
+ }
+
+ /**
* Should only be overriden, not called.
*/
protected void decode(final FileDescriptorFactory factory) {