android: finally starting and rendering at least something again.
Only renders on very-first-start after install (oddly). We initialize vcl in it's own thread to avoid problems. Thanks to tml for fixing a linking issue. Change-Id: I960d11c6098681356fea0634970545aa9af9bacb
This commit is contained in:
parent
52a8744afe
commit
4d25878755
11 changed files with 211 additions and 33 deletions
|
@ -88,11 +88,13 @@ WHOLELIBS = \
|
|||
|
||||
$(OBJLOCAL)/liblo-native-code.so : $(wildcard $(OUTDIR)/lib/lib*.a) native-code.cxx
|
||||
mkdir -p $(OBJLOCAL)
|
||||
$(CXX) -Wl,-Map,liblo-native-code.map -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(OUTDIR)/inc native-code.cxx -L$(OUTDIR)/lib $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -llog -lz
|
||||
$(CXX) -Wl,-Map,liblo-native-code.map -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(OUTDIR)/inc native-code.cxx -L$(OUTDIR)/lib $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -ljnigraphics -llog -lz
|
||||
|
||||
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
|
||||
mkdir -p $(SODEST)
|
||||
$(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
|
||||
cp -a $(OBJLOCAL)/liblo-native-code.so $(SODEST)/liblo-native-code.so
|
||||
|
||||
# shrinkme $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
|
||||
|
||||
link-so: $(SODEST)/liblo-native-code.so
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
dummy {
|
||||
global:
|
||||
global:
|
||||
Java_*;
|
||||
JNI_OnLoad;
|
||||
local:
|
||||
|
|
|
@ -128,6 +128,18 @@ copy-stuff:
|
|||
mkdir -p assets/presets/$$D ; \
|
||||
echo "content" > assets/presets/$$D/stamp; \
|
||||
done
|
||||
# lofficerc
|
||||
mkdir -p assets/program/
|
||||
echo "[Bootstrap]" > assets/program/lofficerc
|
||||
echo "Logo=1" >> assets/program/lofficerc
|
||||
echo "NativeProgress=1" >> assets/program/lofficerc
|
||||
echo "URE_BOOTSTRAP=file:///assets/program/fundamentalrc" >> assets/program/lofficerc
|
||||
# echo "RTL_LOGFILE=file:///dev/log/main" >> assets/program/lofficerc
|
||||
echo "HOME=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
|
||||
echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
|
||||
# - this looks useful but breaks more than it fixes ...
|
||||
# echo "DISABLE_EXTENSION_SYNCHRONIZATION=1" >> assets/program/lofficerc
|
||||
|
||||
|
||||
setup-jars:
|
||||
#
|
||||
|
|
|
@ -13,6 +13,7 @@ extern "C"
|
|||
{
|
||||
extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * cui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * dba_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * dbaxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * evtatt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
|
@ -27,6 +28,7 @@ extern "C"
|
|||
extern void * lng_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * lnth_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * lotuswordpro_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * protocolhandler_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * oox_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * sb_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * sc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
|
@ -36,14 +38,17 @@ extern "C"
|
|||
extern void * sdd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * sm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * smd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * spl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * spell_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * svgfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * sw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * svx_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * wpftdraw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * wpftwriter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
|
||||
|
@ -62,6 +67,7 @@ lo_get_libmap(void)
|
|||
{ "libavmedialo.a", avmedia_component_getFactory },
|
||||
{ "libdbalo.a", dba_component_getFactory },
|
||||
{ "libdbaxmllo.a", dbaxml_component_getFactory },
|
||||
{ "libcuilo.a", cui_component_getFactory },
|
||||
{ "libevtattlo.a", evtatt_component_getFactory },
|
||||
{ "libfileacc.a", fileacc_component_getFactory },
|
||||
{ "libfrmlo.a", frm_component_getFactory },
|
||||
|
@ -75,6 +81,7 @@ lo_get_libmap(void)
|
|||
{ "liblnthlo.a", lnth_component_getFactory },
|
||||
{ "liblwpftlo.a", lotuswordpro_component_getFactory },
|
||||
{ "libooxlo.a", oox_component_getFactory },
|
||||
{ "libprotocolhandlerlo.a", protocolhandler_component_getFactory },
|
||||
{ "libscdlo.a", scd_component_getFactory },
|
||||
{ "libscfiltlo.a", scfilt_component_getFactory },
|
||||
{ "libsblo.a", sb_component_getFactory },
|
||||
|
@ -83,13 +90,16 @@ lo_get_libmap(void)
|
|||
{ "libsdlo.a", sd_component_getFactory },
|
||||
{ "libsmdlo.a", smd_component_getFactory },
|
||||
{ "libsmlo.a", sm_component_getFactory },
|
||||
{ "libspllo.a", spl_component_getFactory },
|
||||
{ "libsvgfilterlo.a", svgfilter_component_getFactory },
|
||||
{ "libsvxlo.a", svx_component_getFactory },
|
||||
{ "libswdlo.a", swd_component_getFactory },
|
||||
{ "libswlo.a", sw_component_getFactory },
|
||||
{ "libt602filterlo.a", t602filter_component_getFactory },
|
||||
{ "libtextfdlo.a", textfd_component_getFactory },
|
||||
{ "libunordflo.a", unordf_component_getFactory },
|
||||
{ "libunoxmllo.a", unoxml_component_getFactory },
|
||||
{ "libuuilo.a", uui_component_getFactory },
|
||||
{ "libwpftdrawlo.a", wpftdraw_component_getFactory },
|
||||
{ "libwpftwriterlo.a", wpftwriter_component_getFactory },
|
||||
{ "libxmlfdlo.a", xmlfd_component_getFactory },
|
||||
|
@ -99,6 +109,14 @@ lo_get_libmap(void)
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
// We need to pull this in, too, as it isn't in any of the libs we
|
||||
// link with -Wl,--whole-archive.
|
||||
extern void Java_org_libreoffice_android_examples_LODesktop_spawnMain();
|
||||
volatile void *p = (void *) Java_org_libreoffice_android_examples_LODesktop_spawnMain;
|
||||
|
||||
extern void Java_org_libreoffice_android_examples_LODesktop_renderVCL();
|
||||
volatile void *q = (void *) Java_org_libreoffice_android_examples_LODesktop_renderVCL;
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ package org.libreoffice.android.examples;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -121,6 +122,12 @@ public class LODesktop
|
|||
{
|
||||
private static final String TAG = "LODesktop";
|
||||
|
||||
/* implementend by desktop */
|
||||
private static native void spawnMain();
|
||||
|
||||
/* implementend by vcl */
|
||||
public static native void renderVCL(Bitmap bitmap);
|
||||
|
||||
/**
|
||||
* This class contains the state that is initialized once and never changes
|
||||
* (not specific to a document or a view).
|
||||
|
@ -233,17 +240,6 @@ public class LODesktop
|
|||
bootstrapContext.mcf = bootstrapContext.componentContext.getServiceManager();
|
||||
|
||||
Log.i(TAG, "mcf is" + (bootstrapContext.mcf!=null ? " not" : "") + " null");
|
||||
|
||||
Bootstrap.initVCL();
|
||||
|
||||
Object desktop = bootstrapContext.mcf.createInstanceWithContext
|
||||
("com.sun.star.frame.Desktop", bootstrapContext.componentContext);
|
||||
|
||||
Log.i(TAG, "desktop is" + (desktop!=null ? " not" : "") + " null");
|
||||
|
||||
bootstrapContext.componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop);
|
||||
|
||||
Log.i(TAG, "componentLoader is" + (bootstrapContext.componentLoader!=null ? " not" : "") + " null");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -260,9 +256,11 @@ public class LODesktop
|
|||
Log.i(TAG, "onCreate - added here\n");
|
||||
|
||||
try {
|
||||
String input = getIntent().getStringExtra("input");
|
||||
if (input == null)
|
||||
input = "/assets/test1.odt";
|
||||
String input;
|
||||
// input = getIntent().getStringExtra("input");
|
||||
// if (input == null)
|
||||
// input = "/assets/test1.odt";
|
||||
input = "-writer";
|
||||
|
||||
// We need to fake up an argv, and the argv[0] even needs to
|
||||
// point to some file name that we can pretend is the "program".
|
||||
|
@ -276,12 +274,39 @@ public class LODesktop
|
|||
if (bootstrapContext == null)
|
||||
initBootstrapContext();
|
||||
|
||||
spawnMain();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
finish();
|
||||
}
|
||||
|
||||
Log.i(TAG, "onCreate - set content view\n");
|
||||
setContentView(new BitmapView(this, this));
|
||||
}
|
||||
}
|
||||
|
||||
class BitmapView extends android.view.View
|
||||
{
|
||||
LODesktop mDesktop;
|
||||
Bitmap mBitmap;
|
||||
|
||||
public BitmapView(Context context, LODesktop desktop)
|
||||
{
|
||||
super(context);
|
||||
mDesktop = desktop;
|
||||
mBitmap = Bitmap.createBitmap(1000, 600, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
// canvas.drawColor(0xFF1ABCDD);
|
||||
|
||||
mDesktop.renderVCL(mBitmap);
|
||||
canvas.drawBitmap(mBitmap, 0, 0, null);
|
||||
|
||||
// re-call ourselves a bit later ...
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// vim:set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
|
|
@ -562,6 +562,8 @@ Desktop::~Desktop()
|
|||
|
||||
void Desktop::Init()
|
||||
{
|
||||
fprintf (stderr, "Desktop::Init()\n");
|
||||
|
||||
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" );
|
||||
SetBootstrapStatus(BS_OK);
|
||||
|
||||
|
@ -593,9 +595,12 @@ void Desktop::Init()
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_aBootstrapError == BE_OK )
|
||||
fprintf( stderr, "OfficeIPCThread %d ...\n", m_aBootstrapError == BE_OK );
|
||||
|
||||
if ( 1 )
|
||||
{
|
||||
const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
|
||||
|
||||
// start ipc thread only for non-remote offices
|
||||
RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) ::OfficeIPCThread::EnableOfficeIPCThread" );
|
||||
OfficeIPCThread::Status aStatus = OfficeIPCThread::EnableOfficeIPCThread();
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#include <rtl/bootstrap.hxx>
|
||||
#include <tools/extendapplicationenvironment.hxx>
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <jni.h>
|
||||
# include <salhelper/thread.hxx>
|
||||
#endif
|
||||
|
||||
int SVMain();
|
||||
|
||||
// -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
@ -70,6 +76,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
fprintf (stderr, "enter svmain()\n");
|
||||
return SVMain();
|
||||
#if defined ANDROID
|
||||
} catch (const ::com::sun::star::uno::Exception &e) {
|
||||
|
@ -80,4 +87,29 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
class MainThread : public salhelper::Thread
|
||||
{
|
||||
public:
|
||||
MainThread() : salhelper::Thread("vcl-mainloop") { launch(); }
|
||||
virtual void execute()
|
||||
{
|
||||
int nRet;
|
||||
do {
|
||||
nRet = soffice_main();
|
||||
fprintf( stderr, "nRet %d\n", nRet );
|
||||
} while (nRet == 81 || nRet == 79); // pretend to re-start.
|
||||
exit (nRet);
|
||||
}
|
||||
};
|
||||
|
||||
extern "C" SAL_JNI_EXPORT void JNICALL
|
||||
Java_org_libreoffice_android_examples_LODesktop_spawnMain(JNIEnv* /* env */,
|
||||
jobject /* dummy */)
|
||||
{
|
||||
fprintf(stderr, "Spawn main!\n");
|
||||
new MainThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -440,6 +440,7 @@ static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue)
|
|||
__attribute__ ((visibility("default"))) void ANativeActivity_onCreate(ANativeActivity* activity,
|
||||
void* savedState, size_t savedStateSize) {
|
||||
LOGI("Creating: %p\n", activity);
|
||||
fprintf (stderr, "ANativeActivity_onCreate - Meeks !\n");
|
||||
activity->callbacks->onDestroy = onDestroy;
|
||||
activity->callbacks->onStart = onStart;
|
||||
activity->callbacks->onResume = onResume;
|
||||
|
|
|
@ -32,11 +32,14 @@
|
|||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <android/looper.h>
|
||||
#include <android/bitmap.h>
|
||||
#include <osl/detail/android-bootstrap.h>
|
||||
#include <osl/detail/android_native_app_glue.h>
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <basebmp/scanlineformats.hxx>
|
||||
|
||||
static bool bHitIdle = false;
|
||||
|
||||
class AndroidSalData : public SalGenericData
|
||||
{
|
||||
public:
|
||||
|
@ -260,26 +263,35 @@ void AndroidSalInstance::BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer,
|
|||
BlitFrameRegionToWindow(pOutBuffer, aDev, aWhole, 0, 0);
|
||||
}
|
||||
|
||||
void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow)
|
||||
void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buffer *pBuffer)
|
||||
{
|
||||
if (!pWindow)
|
||||
return;
|
||||
|
||||
ANativeWindow_Buffer aOutBuffer;
|
||||
memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer));
|
||||
|
||||
// ARect aRect;
|
||||
fprintf (stderr, "pre lock #3\n");
|
||||
int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, NULL);
|
||||
fprintf (stderr, "locked window %d returned " // rect: %d,%d->%d,%d "
|
||||
fprintf (stderr, "RedrawWindows\n");
|
||||
|
||||
int32_t nRet = 0;
|
||||
if (pBuffer != NULL)
|
||||
aOutBuffer = *pBuffer;
|
||||
else
|
||||
{
|
||||
if (!pWindow)
|
||||
return;
|
||||
|
||||
// ARect aRect;
|
||||
fprintf (stderr, "pre lock #3\n");
|
||||
nRet = ANativeWindow_lock(pWindow, &aOutBuffer, NULL);
|
||||
}
|
||||
fprintf (stderr, "Frame count: %d locked window %d returned " // rect: %d,%d->%d,%d "
|
||||
"buffer: %dx%d stride %d, format %d, bits %p\n",
|
||||
(int)getFrames().size(),
|
||||
nRet, // aRect.left, aRect.top, aRect.right, aRect.bottom,
|
||||
aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride,
|
||||
aOutBuffer.format, aOutBuffer.bits);
|
||||
if (aOutBuffer.bits != NULL)
|
||||
{
|
||||
|
||||
#if 0 // pre-'clean' the buffer with cruft:
|
||||
#if 1 // pre-'clean' the buffer with cruft:
|
||||
// hard-code / guess at a format ...
|
||||
int32_t *p = (int32_t *)aOutBuffer.bits;
|
||||
for (int32_t y = 0; y < aOutBuffer.height; y++)
|
||||
|
@ -287,7 +299,6 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow)
|
|||
for (int32_t x = 0; x < aOutBuffer.stride; x++)
|
||||
*p++ = (y << 24) + (x << 10) + 0xff ;
|
||||
}
|
||||
|
||||
#endif
|
||||
int i = 0;
|
||||
std::list< SalFrame* >::const_iterator it;
|
||||
|
@ -328,7 +339,9 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow)
|
|||
}
|
||||
else
|
||||
fprintf (stderr, "no buffer for locked window\n");
|
||||
ANativeWindow_unlockAndPost(pWindow);
|
||||
|
||||
if (pBuffer && pWindow)
|
||||
ANativeWindow_unlockAndPost(pWindow);
|
||||
|
||||
fprintf (stderr, "done render!\n");
|
||||
maRedrawRegion.SetEmpty();
|
||||
|
@ -372,7 +385,7 @@ void AndroidSalInstance::GetWorkArea( Rectangle& rRect )
|
|||
{
|
||||
if (!mpApp || !mpApp->window)
|
||||
rRect = Rectangle( Point( 0, 0 ),
|
||||
Size( 800, 600 ) );
|
||||
Size( 1280, 750 ) );
|
||||
else
|
||||
rRect = Rectangle( Point( 0, 0 ),
|
||||
Size( ANativeWindow_getWidth( mpApp->window ),
|
||||
|
@ -627,6 +640,10 @@ void AndroidSalInstance::Wakeup()
|
|||
|
||||
void AndroidSalInstance::DoReleaseYield (int nTimeoutMS)
|
||||
{
|
||||
if (!bHitIdle)
|
||||
fprintf( stderr, "hit idle !\n" );
|
||||
bHitIdle = true;
|
||||
|
||||
// Presumably this should never be called at all except in
|
||||
// NativeActivity-based apps with a GUI, like android/qa/desktop, where
|
||||
// the message pump is run here in vcl?
|
||||
|
@ -825,13 +842,14 @@ SalInstance *CreateSalInstance()
|
|||
fprintf (stderr, "Android: CreateSalInstance!\n");
|
||||
AndroidSalInstance* pInstance = new AndroidSalInstance( new SalYieldMutex() );
|
||||
new AndroidSalData( pInstance );
|
||||
pInstance->AcquireYieldMutex(1);
|
||||
// FIXME: we init VCL in a different thread from where we run the mainloop [!] ...
|
||||
// pInstance->AcquireYieldMutex(1);
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void DestroySalInstance( SalInstance *pInst )
|
||||
{
|
||||
pInst->ReleaseYieldMutex();
|
||||
// pInst->ReleaseYieldMutex();
|
||||
delete pInst;
|
||||
}
|
||||
|
||||
|
@ -869,5 +887,67 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle,
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Render everything
|
||||
extern "C" SAL_JNI_EXPORT void JNICALL
|
||||
Java_org_libreoffice_android_examples_LODesktop_renderVCL(JNIEnv *env,
|
||||
jobject /* dummy */,
|
||||
jobject bitmap)
|
||||
{
|
||||
if (!bHitIdle)
|
||||
return;
|
||||
|
||||
AndroidBitmapInfo info;
|
||||
void* pixels;
|
||||
int ret;
|
||||
|
||||
if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
|
||||
fprintf(stderr, "AndroidBitmap_getInfo() failed ! error=%d", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
|
||||
fprintf(stderr, "Bitmap format is not RGB_565 !");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
|
||||
fprintf(stderr, "AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct ANativeWindow_Buffer {
|
||||
// The number of pixels that are show horizontally.
|
||||
int32_t width;
|
||||
|
||||
// The number of pixels that are shown vertically.
|
||||
int32_t height;
|
||||
|
||||
// The number of *pixels* that a line in the buffer takes in
|
||||
// memory. This may be >= width.
|
||||
int32_t stride;
|
||||
|
||||
// The format of the buffer. One of WINDOW_FORMAT_*
|
||||
int32_t format;
|
||||
|
||||
// The actual bits.
|
||||
void* bits;
|
||||
|
||||
// Do not touch.
|
||||
uint32_t reserved[6];
|
||||
} ANativeWindow_Buffer;
|
||||
*/
|
||||
|
||||
ANativeWindow_Buffer dummyOut; // look like a window for now ...
|
||||
dummyOut.width = info.width;
|
||||
dummyOut.height = info.height;
|
||||
dummyOut.stride = info.stride / 4; // sigh !
|
||||
dummyOut.format = info.format;
|
||||
dummyOut.bits = pixels;
|
||||
AndroidSalInstance::getInstance()->RedrawWindows (NULL, &dummyOut);
|
||||
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
// incoming android event handlers:
|
||||
void onAppCmd (struct android_app* app, int32_t cmd);
|
||||
int32_t onInputEvent (struct android_app* app, AInputEvent* event);
|
||||
void RedrawWindows(ANativeWindow *pWindow);
|
||||
void RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buffer *pBuffer = NULL);
|
||||
SalFrame *getFocusFrame() const;
|
||||
|
||||
void damaged(AndroidSalFrame *frame, const Rectangle &rRect);
|
||||
|
|
|
@ -156,10 +156,13 @@ int ImplSVMain()
|
|||
|
||||
sal_Bool bInit = InitVCL();
|
||||
|
||||
fprintf (stderr, "init vcl %d\n", bInit);
|
||||
|
||||
if( bInit )
|
||||
{
|
||||
// call application main
|
||||
pSVData->maAppData.mbInAppMain = sal_True;
|
||||
fprintf(stderr, "call app main from vcl!\n");
|
||||
nReturn = pSVData->mpApp->Main();
|
||||
pSVData->maAppData.mbInAppMain = sal_False;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue