summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-04-12 17:50:52 +0200
committerJan Holesovsky <kendy@collabora.com>2019-04-13 08:13:06 +0200
commit34d012a128dfa959aa345672ebf4f9de80253b63 (patch)
treefba30b0efc768e01948b53bf44c97ae6ae411c78
parentad4c8fed1b1b95fb502a011bb5fce5b8cb9d840d (diff)
android: Make the tiled rendering from the loolwsd actually work.
Not to break the 'old' Android app, introduce a bool that can indicate if we are using the LOK from the 'old' (LOK-via-JNI-based) or from the 'new' (loolwsd-based) app. Change-Id: I38bd665cc1d5bc88018574171443ecabc46763df Reviewed-on: https://gerrit.libreoffice.org/70678 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx18
-rw-r--r--sal/android/libreofficekit-jni.c6
2 files changed, 21 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6830aa698e79..d82a44dd09f5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2349,6 +2349,13 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
}
}
+#if defined(ANDROID)
+/// For the distinction if the LOK is used for the 'old' (JNI-based) or the
+/// 'new' (loolwsd-based) app. Default to the 'new', ie. not used from JNI as
+/// implemented in sal/android/libreofficekit-jni.c.
+bool android_lok_from_jni = false;
+#endif
+
static void doc_paintTile(LibreOfficeKitDocument* pThis,
unsigned char* pBuffer,
const int nCanvasWidth, const int nCanvasHeight,
@@ -2403,10 +2410,15 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
#else
ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
-#if !defined(ANDROID)
- // Set background to transparent by default.
- pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+#if defined(ANDROID)
+ if (!android_lok_from_jni)
#endif
+ {
+ // Set background to transparent by default.
+ // [Unless it is the 'old' (JNI-based) Android app - no idea why it
+ // needs avoiding this.]
+ pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+ }
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index edd56a2fec37..0f66fdc44fe0 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -37,6 +37,7 @@ extern const char* data_dir;
extern const char* cache_dir;
extern void* apk_file;
extern int apk_file_size;
+extern bool android_lok_from_jni; ///< for the distinction if the LOK is used for the 'old' (JNI-based) or the 'new' (loolwsd-based) app
AAssetManager* native_asset_manager;
extern void Java_org_libreoffice_android_Bootstrap_putenv(JNIEnv* env, jobject clazz, jstring string);
@@ -157,6 +158,11 @@ jboolean Java_org_libreoffice_kit_LibreOfficeKit_initializeNative
size_t data_dir_len;
(void) clazz;
+
+ // the 'old' app needs to avoid setting the virtual device to transparent
+ // in paintTile(), so indicate we are using the 'old' app
+ android_lok_from_jni = true;
+
libreofficekit_initialize(env, dataDir, cacheDir, apkFile, assetManager);
// LibreOfficeKit expects a path to the program/ directory