summaryrefslogtreecommitdiff
path: root/android/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'android/src/com')
-rw-r--r--android/src/com/artifex/mupdf/BitmapHolder.java2
-rw-r--r--android/src/com/artifex/mupdf/MuPDFCore.java2
2 files changed, 4 insertions, 0 deletions
diff --git a/android/src/com/artifex/mupdf/BitmapHolder.java b/android/src/com/artifex/mupdf/BitmapHolder.java
index 244d5d61..4e1edf63 100644
--- a/android/src/com/artifex/mupdf/BitmapHolder.java
+++ b/android/src/com/artifex/mupdf/BitmapHolder.java
@@ -10,6 +10,8 @@ public class BitmapHolder {
}
public synchronized void setBm(Bitmap abm) {
+ if (bm != null && bm != abm)
+ bm.recycle();
bm = abm;
}
diff --git a/android/src/com/artifex/mupdf/MuPDFCore.java b/android/src/com/artifex/mupdf/MuPDFCore.java
index 2785664f..21a22fc2 100644
--- a/android/src/com/artifex/mupdf/MuPDFCore.java
+++ b/android/src/com/artifex/mupdf/MuPDFCore.java
@@ -124,6 +124,8 @@ public class MuPDFCore
int patchX, int patchY,
int patchW, int patchH) {
gotoPage(page);
+ // Clear the reference out before creating the new bitmap
+ h.setBm(null);
Bitmap bm = Bitmap.createBitmap(patchW, patchH, Config.ARGB_8888);
drawPage(bm, pageW, pageH, patchX, patchY, patchW, patchH);
h.setBm(bm);