summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorPaul Gardiner <paul@glidos.net>2012-02-24 18:24:27 +0000
committerPaul Gardiner <paul@glidos.net>2012-03-15 11:37:48 +0000
commitf6ec243a4a629913419a739a25199ec8a28bab65 (patch)
tree47c92d7a843ee8238406c5329a2168d8165c33ce /android
parent77eed8154c782a4d3b0e38a49986c18c240ab2f2 (diff)
downloadmupdf-f6ec243a4a629913419a739a25199ec8a28bab65.tar.xz
android app: support hardware acceleration
Diffstat (limited to 'android')
-rw-r--r--android/AndroidManifest.xml5
-rw-r--r--android/project.properties2
-rw-r--r--android/src/com/artifex/mupdf/PageView.java12
3 files changed, 16 insertions, 3 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 9d4ef58c..e69aeaf5 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -7,10 +7,11 @@
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
- <uses-sdk android:minSdkVersion="8" />
+ <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11"/>
<application android:label="@string/app_name"
android:icon="@drawable/icon"
- android:debuggable="true">
+ android:debuggable="true"
+ android:hardwareAccelerated="true">
<activity android:name="ChoosePDFActivity"
android:label="@string/picker_title">
<intent-filter>
diff --git a/android/project.properties b/android/project.properties
index ea89160e..d79abae1 100644
--- a/android/project.properties
+++ b/android/project.properties
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-8
+target=android-11
diff --git a/android/src/com/artifex/mupdf/PageView.java b/android/src/com/artifex/mupdf/PageView.java
index 6fe6d43d..4dce6d23 100644
--- a/android/src/com/artifex/mupdf/PageView.java
+++ b/android/src/com/artifex/mupdf/PageView.java
@@ -9,6 +9,7 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.AsyncTask;
+import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -59,6 +60,7 @@ public abstract class PageView extends ViewGroup {
private RectF mSearchBoxes[];
private View mSearchView;
private boolean mIsBlank;
+ private boolean mUsingHardwareAcceleration;
private ProgressBar mBusyIndicator;
@@ -67,6 +69,7 @@ public abstract class PageView extends ViewGroup {
mContext = c;
mParentSize = parentSize;
setBackgroundColor(BACKGROUND_COLOR);
+ mUsingHardwareAcceleration = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
protected abstract void drawPage(Bitmap bm, int sizeX, int sizeY, int patchX, int patchY, int patchWidth, int patchHeight);
@@ -119,6 +122,15 @@ public abstract class PageView extends ViewGroup {
mSourceScale = Math.min(mParentSize.x/size.x, mParentSize.y/size.y);
Point newSize = new Point((int)(size.x*mSourceScale), (int)(size.y*mSourceScale));
mSize = newSize;
+
+ if (mUsingHardwareAcceleration) {
+ // When hardware accelerated, updates to the bitmap seem to be
+ // ignored, so we recreate it. There may be another way around this
+ // that we are yet to find.
+ mEntire.setImageBitmap(null);
+ mEntireBm = null;
+ }
+
if (mEntireBm == null || mEntireBm.getWidth() != newSize.x
|| mEntireBm.getHeight() != newSize.y) {
mEntireBm = Bitmap.createBitmap(mSize.x, mSize.y, Bitmap.Config.ARGB_8888);