summaryrefslogtreecommitdiff
path: root/src/drivers/Android/Fl_Android_Application.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-03-07 22:12:34 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-03-07 22:12:34 +0000
commit2e5b983f4b3da87bf28319fe7ab99bb6206f0411 (patch)
tree34475588f4943d9ed379b711887d873d087c79b0 /src/drivers/Android/Fl_Android_Application.cxx
parentf058d3a99c396f21d6e17f201682462da1d305cc (diff)
Android: moved all Android code from the main app into the driver system. All non-driver-FLTK code and main app are now Android-free.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12719 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Android/Fl_Android_Application.cxx')
-rw-r--r--src/drivers/Android/Fl_Android_Application.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/drivers/Android/Fl_Android_Application.cxx b/src/drivers/Android/Fl_Android_Application.cxx
index 890d175a4..8794ea2b1 100644
--- a/src/drivers/Android/Fl_Android_Application.cxx
+++ b/src/drivers/Android/Fl_Android_Application.cxx
@@ -235,10 +235,18 @@ void Fl_Android_Application::pre_exec_cmd(int8_t cmd)
case APP_CMD_INIT_WINDOW:
LOGV("APP_CMD_INIT_WINDOW\n");
+ // tell the main thread that we received the window handle
pthread_mutex_lock(&pMutex);
pNativeWindow = pPendingWindow;
pthread_cond_broadcast(&pCond);
pthread_mutex_unlock(&pMutex);
+ // change the format of the buffers to match our needs
+ // FIXME: current default screen size and format is 600x800xRGB565
+ ANativeWindow_setBuffersGeometry(pNativeWindow,
+ 600,
+ 800,
+ WINDOW_FORMAT_RGB_565);
+ // tell FLTK that the buffer is available now
Fl_Android_Window_Driver::expose_all();
break;
@@ -394,13 +402,17 @@ bool Fl_Android_Application::copy_screen()
bool ret = false;
if (lock_screen()) {
+#if 0
+ // screen activity viewer
static int i = 0;
fl_color( (i&1) ? FL_RED : FL_GREEN);
fl_rectf(i*10, 600+i*10, 50, 50);
i++;
if (i>10) i = 0;
+#endif
// TODO: there are endless possibilities to optimize the following code
+ // We are wasting time by copying the entire screen contents at every dirty frame
// We can identify previously written buffers and copy only those pixels
// that actually changed.
const uint16_t *src = (uint16_t*)pApplicationWindowBuffer.bits;