From 5365d9f716a9fac24df8a69ef70e11ace3e16649 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 2 Mar 2018 20:57:02 +0000 Subject: Android: minor simplifications git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- Android/HelloAndroid/README.md | 2 +- Android/HelloAndroid/app/app.iml | 16 ++-- .../HelloAndroid/app/src/main/cpp/HelloAndroid.cxx | 89 ---------------------- README.Android.txt | 6 +- 4 files changed, 11 insertions(+), 102 deletions(-) diff --git a/Android/HelloAndroid/README.md b/Android/HelloAndroid/README.md index 0a1231969..fdd6cf930 100644 --- a/Android/HelloAndroid/README.md +++ b/Android/HelloAndroid/README.md @@ -12,7 +12,7 @@ Getting Started 1. [Download Android Studio](http://developer.android.com/sdk/index.html) 1. Launch Android Studio. 1. Open the Android directory inside the FLTK directory. -1. Load the Android Studio project in the HelloAndroid directory. +1. Open the AndroidStudio project by loading the HelloAndroid directory. 1. Click *Run/Run 'app'*. Support diff --git a/Android/HelloAndroid/app/app.iml b/Android/HelloAndroid/app/app.iml index ffb02d88c..a83784e31 100644 --- a/Android/HelloAndroid/app/app.iml +++ b/Android/HelloAndroid/app/app.iml @@ -56,14 +56,6 @@ - - - - - - - - @@ -72,6 +64,14 @@ + + + + + + + + diff --git a/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx b/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx index ce233546c..ce09e9eed 100644 --- a/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx +++ b/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx @@ -198,90 +198,6 @@ static void init_tables(void) init_angles(); } -static void fill_plasma(ANativeWindow_Buffer* buffer, double t) -{ - Fixed yt1 = FIXED_FROM_FLOAT(t/1230.); - Fixed yt2 = yt1; - Fixed xt10 = FIXED_FROM_FLOAT(t/3000.); - Fixed xt20 = xt10; - -#define YT1_INCR FIXED_FROM_FLOAT(1/100.) -#define YT2_INCR FIXED_FROM_FLOAT(1/163.) - - void* pixels = buffer->bits; - //LOGI("width=%d height=%d stride=%d format=%d", buffer->width, buffer->height, - // buffer->stride, buffer->format); - - int yy; - for (yy = 0; yy < buffer->height; yy++) { - uint16_t* line = (uint16_t*)pixels; - Fixed base = fixed_sin(yt1) + fixed_sin(yt2); - Fixed xt1 = xt10; - Fixed xt2 = xt20; - - yt1 += YT1_INCR; - yt2 += YT2_INCR; - -#define XT1_INCR FIXED_FROM_FLOAT(1/173.) -#define XT2_INCR FIXED_FROM_FLOAT(1/242.) - -#if OPTIMIZE_WRITES - /* optimize memory writes by generating one aligned 32-bit store - * for every pair of pixels. - */ - uint16_t* line_end = line + buffer->width; - - if (line < line_end) { - if (((uint32_t)(uintptr_t)line & 3) != 0) { - Fixed ii = base + fixed_sin(xt1) + fixed_sin(xt2); - - xt1 += XT1_INCR; - xt2 += XT2_INCR; - - line[0] = palette_from_fixed(ii >> 2); - line++; - } - - while (line + 2 <= line_end) { - Fixed i1 = base + fixed_sin(xt1) + fixed_sin(xt2); - xt1 += XT1_INCR; - xt2 += XT2_INCR; - - Fixed i2 = base + fixed_sin(xt1) + fixed_sin(xt2); - xt1 += XT1_INCR; - xt2 += XT2_INCR; - - uint32_t pixel = ((uint32_t)palette_from_fixed(i1 >> 2) << 16) | - (uint32_t)palette_from_fixed(i2 >> 2); - - ((uint32_t*)line)[0] = pixel; - line += 2; - } - - if (line < line_end) { - Fixed ii = base + fixed_sin(xt1) + fixed_sin(xt2); - line[0] = palette_from_fixed(ii >> 2); - line++; - } - } -#else /* !OPTIMIZE_WRITES */ - int xx; - for (xx = 0; xx < buffer->width; xx++) { - - Fixed ii = base + fixed_sin(xt1) + fixed_sin(xt2); - - xt1 += XT1_INCR; - xt2 += XT2_INCR; - - line[xx] = palette_from_fixed(ii / 4); - } -#endif /* !OPTIMIZE_WRITES */ - - // go to next line - pixels = (uint16_t*)pixels + buffer->stride; - } -} - /* simple stats management */ typedef struct { double renderTime; @@ -410,15 +326,10 @@ static void engine_draw_frame(struct engine* engine) { time_ms -= start_ms; /* Now fill the values with a nice little plasma */ -#if 0 - fill_plasma(&buffer, time_ms); -#else -// LOGE("Fl::flush()"); gAGraphicsBuffer = &buffer; Fl::damage(FL_DAMAGE_ALL); win->redraw(); Fl::flush(); -#endif ANativeWindow_unlockAndPost(engine->app->window); diff --git a/README.Android.txt b/README.Android.txt index 87b7524af..d4f418531 100644 --- a/README.Android.txt +++ b/README.Android.txt @@ -15,9 +15,6 @@ WARNING: FLTK FOR ANDROID IS WORK IN PROGRESS IN A PRETTY EARLY STAGE. BUILDING FLTK SAMPLE WITH ANDROID STUDIO 3 ============================================ -March 2nd, 2018: This is a first commit to SVN to have a file structure in -place. None of this compiles or runs at this point. - There is no need to ever write a single line of Java. Download and install AndroidStudio on your developer machine. If you use @@ -26,7 +23,8 @@ AndroidStudio for the first time, use the IDE to download and build the FLTK will be installed. Once Native Plasm runs on your emulator or physical device, you are ready to install FLTK. -TODO: there will be an Android Studio project in the Android/ directory soon. +Open the Android/HelloAndroid directory in AndroidStudio. The project should compile and run out of the box. + DOCUMENT HISTORY ================== -- cgit v1.2.3