diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/jni/Android.mk | 4 | ||||
-rw-r--r-- | platform/android/jni/Core.mk | 17 | ||||
-rw-r--r-- | platform/android/jni/mupdf.c | 16 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 5 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 18 |
5 files changed, 57 insertions, 3 deletions
diff --git a/platform/android/jni/Android.mk b/platform/android/jni/Android.mk index 81be571a..55cf593d 100644 --- a/platform/android/jni/Android.mk +++ b/platform/android/jni/Android.mk @@ -24,7 +24,9 @@ LOCAL_STATIC_LIBRARIES := mupdfcore mupdfthirdparty ifdef NDK_PROFILER LOCAL_CFLAGS += -pg -DNDK_PROFILER LOCAL_STATIC_LIBRARIES += andprof -else +endif +ifdef SUPPORT_GPROOF +LOCAL_CFLAGS += -DSUPPORT_GPROOF endif LOCAL_LDLIBS := -lm -llog -ljnigraphics diff --git a/platform/android/jni/Core.mk b/platform/android/jni/Core.mk index 70ba5938..1dc155a2 100644 --- a/platform/android/jni/Core.mk +++ b/platform/android/jni/Core.mk @@ -1,5 +1,12 @@ LOCAL_PATH := $(call my-dir) +ifdef SUPPORT_GPROOF +include $(CLEAR_VARS) +LOCAL_MODULE := gsso +LOCAL_SRC_FILES := libgs.so +include $(PREBUILT_SHARED_LIBRARY) +endif + include $(CLEAR_VARS) MY_ROOT := ../.. @@ -10,6 +17,9 @@ ifdef NDK_PROFILER LOCAL_CFLAGS += -pg -DNDK_PROFILER endif endif +ifdef SUPPORT_GPROOF +LOCAL_CFLAGS += -DSUPPORT_GPROOF +endif LOCAL_CFLAGS += -DAA_BITS=8 ifdef MEMENTO LOCAL_CFLAGS += -DMEMENTO -DMEMENTO_LEAKONLY @@ -51,12 +61,15 @@ LOCAL_SRC_FILES := \ $(wildcard $(MY_ROOT)/source/pdf/*.c) \ $(wildcard $(MY_ROOT)/source/xps/*.c) \ $(wildcard $(MY_ROOT)/source/cbz/*.c) \ - $(wildcard $(MY_ROOT)/source/html/*.c) \ - $(wildcard $(MY_ROOT)/source/gprf/*.c) + $(wildcard $(MY_ROOT)/source/gprf/*.c) \ + $(wildcard $(MY_ROOT)/source/html/*.c) LOCAL_SRC_FILES += \ $(MY_ROOT)/source/pdf/js/pdf-js.c \ $(MY_ROOT)/source/pdf/js/pdf-jsimp-mu.c +ifdef SUPPORT_GPROOF +LOCAL_SHARED_LIBRARIES := gsso +endif LOCAL_LDLIBS := -lm -llog -ljnigraphics LOCAL_SRC_FILES := $(addprefix ../, $(LOCAL_SRC_FILES)) diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c index add5598e..c701edde 100644 --- a/platform/android/jni/mupdf.c +++ b/platform/android/jni/mupdf.c @@ -2718,6 +2718,7 @@ static char *tmp_gproof_path(char *path) JNIEXPORT jstring JNICALL JNI_FN(MuPDFCore_startProofInternal)(JNIEnv * env, jobject thiz) { +#ifdef SUPPORT_GPROOF globals *glo = get_globals(env, thiz); fz_context *ctx = glo->ctx; char *tmp; @@ -2746,11 +2747,15 @@ JNI_FN(MuPDFCore_startProofInternal)(JNIEnv * env, jobject thiz) ret = NULL; } return ret; +#else + return NULL; +#endif } JNIEXPORT void JNICALL JNI_FN(MuPDFCore_endProofInternal)(JNIEnv * env, jobject thiz, jstring jfilename) { +#ifdef SUPPORT_GPROOF globals *glo = get_globals(env, thiz); fz_context *ctx = glo->ctx; const char *tmp; @@ -2766,4 +2771,15 @@ JNI_FN(MuPDFCore_endProofInternal)(JNIEnv * env, jobject thiz, jstring jfilename unlink(tmp); (*env)->ReleaseStringUTFChars(env, jfilename, tmp); } +#endif +} + +JNIEXPORT jboolean JNICALL +JNI_FN(MuPDFCore_gprfSupportedInternal)(JNIEnv * env) +{ +#ifdef SUPPORT_GPROOF + return JNI_TRUE; +#else + return JNI_FALSE; +#endif } diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index 172c189a..30e96ecf 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -76,6 +76,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp private ImageButton mSearchFwd; private EditText mSearchText; private SearchTask mSearchTask; + private ImageButton mProofButton; private AlertDialog.Builder mAlertBuilder; private boolean mLinkHighlight = false; private final Handler mHandler = new Handler(); @@ -887,10 +888,14 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText); mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton); mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton); + mProofButton = (ImageButton)mButtonsView.findViewById(R.id.proofButton); mTopBarSwitcher.setVisibility(View.INVISIBLE); mPageNumberView.setVisibility(View.INVISIBLE); mInfoView.setVisibility(View.INVISIBLE); mPageSlider.setVisibility(View.INVISIBLE); + if (!core.gprfSupported()) { + mProofButton.setVisibility(View.INVISIBLE); + } } public void OnMoreButtonClick(View v) { diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index ffab6782..5c8697fb 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -11,8 +11,19 @@ import android.content.Intent; public class MuPDFCore { /* load our native library */ + private static boolean gs_so_available = false; static { System.loadLibrary("mupdf"); + if (gprfSupportedInternal()) + { + try { + System.loadLibrary("gs"); + gs_so_available = true; + } + catch (UnsatisfiedLinkError e) { + gs_so_available = false; + } + } } /* Readable members */ @@ -26,6 +37,7 @@ public class MuPDFCore private final boolean wasOpenedFromBuffer; /* The native functions */ + private static native boolean gprfSupportedInternal(); private native long openFile(String filename); private native long openBuffer(String magic); private native String fileFormatInternal(); @@ -357,4 +369,10 @@ public class MuPDFCore public synchronized void endProof(String filename) { endProofInternal(filename); } + + public static boolean gprfSupported() { + if (gs_so_available == false) + return false; + return gprfSupportedInternal(); + } } |