summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-09-23 14:16:41 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-09-24 20:43:01 +0200
commitb85c779595d679a3d24de37751b27fe70e878149 (patch)
tree2eb68566f760e54c10701383ec0594d1fd0d442e /desktop
parentb4de0bd548399593ad2627afde443a569e7b8ea1 (diff)
android: use JNI direct memory allocator from Fennec
Change-Id: I95a9ab54222150a1f9cde30df820f3cd6915f641
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/lokandroid.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index bc9a8b0b1274..6a0ba2a41648 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -80,6 +80,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Office_document
}
/* Document */
+
extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_destroy
(JNIEnv* pEnv, jobject aObject)
{
@@ -164,7 +165,8 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDoc
return nWidth;
}
-extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs(JNIEnv* pEnv, jobject aObject, jstring sUrl, jstring sFormat, jstring sOptions)
+extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs
+ (JNIEnv* pEnv, jobject aObject, jstring sUrl, jstring sFormat, jstring sOptions)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
@@ -181,4 +183,28 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs(JN
return result;
}
+/* DirectBufferAllocator */
+
+extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative
+ (JNIEnv* pEnv, jclass /*aClass*/, jlong nSize)
+{
+ jobject aBuffer = NULL;
+ void* pMemory = malloc(nSize);
+ if (pMemory != NULL)
+ {
+ aBuffer = pEnv->NewDirectByteBuffer(pMemory, nSize);
+ if (!aBuffer)
+ {
+ free(pMemory);
+ }
+ }
+ return aBuffer;
+}
+
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_freeDirectBufferNative
+ (JNIEnv* pEnv, jclass, jobject aBuffer)
+{
+ free(pEnv->GetDirectBufferAddress(aBuffer));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */