aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/apps
diff options
context:
space:
mode:
Diffstat (limited to 'platform_tools/android/apps')
-rw-r--r--platform_tools/android/apps/build.gradle86
-rw-r--r--platform_tools/android/apps/sample_app/build.gradle46
-rw-r--r--platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml22
-rw-r--r--platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java279
-rw-r--r--platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java113
-rw-r--r--platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java306
-rw-r--r--platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h35
-rw-r--r--platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp384
-rw-r--r--platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h164
-rw-r--r--platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.pngbin1099 -> 0 bytes
-rw-r--r--platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.pngbin912 -> 0 bytes
-rw-r--r--platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml17
-rw-r--r--platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml75
-rw-r--r--platform_tools/android/apps/sample_app/src/main/res/values/strings.xml18
-rw-r--r--platform_tools/android/apps/settings.gradle2
-rw-r--r--platform_tools/android/apps/visualbench/build.gradle46
-rw-r--r--platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml29
-rw-r--r--platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java49
-rw-r--r--platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp187
-rw-r--r--platform_tools/android/apps/visualbench/src/main/jni/main.cpp134
20 files changed, 0 insertions, 1992 deletions
diff --git a/platform_tools/android/apps/build.gradle b/platform_tools/android/apps/build.gradle
deleted file mode 100644
index b20334b887..0000000000
--- a/platform_tools/android/apps/build.gradle
+++ /dev/null
@@ -1,86 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- jcenter()
- }
-}
-
-def getLocalProperties() {
- Properties properties = new Properties()
- File propFile = project.rootProject.file('local.properties')
- if (propFile.canRead()) {
- properties.load(propFile.newDataInputStream())
- }
- propFile = project.rootProject.file('gradle.properties')
- if (propFile.canRead()) {
- properties.load(propFile.newDataInputStream())
- }
- return properties
-}
-
-def getSDKPath() {
- String path = System.getenv("ANDROID_SDK_ROOT")
- if (path == null) {
- path = getLocalProperties().getProperty('sdk.dir', null)
- }
-
- if (path == null) {
- throw new GradleScriptException("Android SDK not found! Please set ANDROID_SDK_ROOT to" +
- " your path or define sdk.dir in gradle.properties")
- }
- return path
-}
-
-def getPathWithDepotTools() {
- System.getenv("PATH") + ":" + getLocalProperties().getProperty('depot_tools.dir', null)
- String path = System.getenv("PATH")
- if (!path.contains("depot_tools")) {
- path += ":" + getLocalProperties().getProperty('depot_tools.dir', null)
- }
-
- if (!path.contains("depot_tools")) {
- throw GradleScriptException("Depot Tools not found! Please update your path to include" +
- " depot_tools or define depot_tools.dir in gradle.properties")
- }
- return path
-}
-
-def constructBuildCommand(variant, buildTarget) {
- String cmdLine = "./platform_tools/android/bin/android_ninja $buildTarget"
- String deviceType = null
- if (variant.name.startsWith("arm64")) {
- deviceType = "arm64"
- } else if (variant.name.startsWith("arm")) {
- deviceType = "arm_v7_neon"
- } else if (variant.name.startsWith("x86_64")) {
- deviceType = "x86_64"
- } else if (variant.name.startsWith("x86")) {
- deviceType = "x86"
- } else if (variant.name.startsWith("mips")) {
- deviceType = "mips"
- } else if (variant.name.startsWith("mips64")) {
- deviceType = "mips64"
- }
-
- if (deviceType != null) {
- cmdLine += " -d " + deviceType
- }
-
- if (variant.name.endsWith("Release")) {
- cmdLine += " --release"
- }
- return cmdLine
-} \ No newline at end of file
diff --git a/platform_tools/android/apps/sample_app/build.gradle b/platform_tools/android/apps/sample_app/build.gradle
deleted file mode 100644
index e27a77ae24..0000000000
--- a/platform_tools/android/apps/sample_app/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 19
- buildToolsVersion "22.0.1"
-
- defaultConfig {
- applicationId "com.skia.sample_app"
- minSdkVersion 9
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call
- sourceSets.main.jniLibs.srcDir "src/main/libs"
-
- productFlavors {
- arm {}
- arm64 {}
- x86 {}
- x86_64 {}
- mips {}
- mips64 {}
- }
-
- // make sure that app is built and shared libraries are copied to correct directories
- applicationVariants.all{ variant ->
-
- def buildNativeLib = task("${variant.name}_NativeLib", type:Exec) {
- workingDir '../../../..' // top-level skia directory
- commandLine constructBuildCommand(variant, "CopySampleAppDeps").split()
- environment PATH: getPathWithDepotTools()
- environment ANDROID_SDK_ROOT: getSDKPath()
- }
-
- if (!hasProperty("suppressNativeBuild")) {
- TaskCollection<Task> assembleTask
- assembleTask = project.tasks.matching {
- it.name.contains("assemble") &&
- it.name.toLowerCase().endsWith(variant.name.toLowerCase())
- }
- assembleTask.getAt(0).dependsOn buildNativeLib
- }
- }
-} \ No newline at end of file
diff --git a/platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml b/platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml
deleted file mode 100644
index edb0424ba8..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.skia"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="14" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" />
- <!-- Needed to add to the download manager. -->
- <uses-permission android:name="android.permission.INTERNET" />
- <application android:label="SkiaAndroid">
- <activity android:name=".SkiaSampleActivity"
- android:theme="@android:style/Theme.Holo.Light"
- android:configChanges="orientation|screenSize"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java
deleted file mode 100644
index d9cd9f887d..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-package com.skia;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.DownloadManager;
-import android.content.Intent;
-import android.content.Context;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.io.File;
-
-public class SkiaSampleActivity extends Activity
-{
- private TextView mTitle;
- private SkiaSampleView mSampleView;
-
- private ArrayAdapter<String> mSlideList;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.layout);
- mTitle = (TextView) findViewById(R.id.title_view);
- mSlideList = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1);
-
- try {
- System.loadLibrary("skia_android");
- } catch (UnsatisfiedLinkError e) {
- // This might be because skia was linked to SampleApp statically.
- }
-
- try {
- System.loadLibrary("SampleApp");
-
- createSampleView(false, 0);
-
- setupActionBar();
- } catch (UnsatisfiedLinkError e) {
- mTitle.setText("ERROR: native library could not be loaded");
- }
- }
-
- private void createSampleView(boolean useOpenGLAPI, int msaaSampleCount) {
- if (mSampleView != null) {
- ViewGroup viewGroup = (ViewGroup) mSampleView.getParent();
- viewGroup.removeView(mSampleView);
- mSampleView.terminate();
- }
-
- // intent get intent extras if triggered from the command line
- Intent intent = this.getIntent();
- String flags = intent.getStringExtra("cmdLineFlags");
-
- if (flags == null || flags.isEmpty()) {
- flags = "--pictureDir /data/local/tmp/skia_skp ";
- flags += "--resourcePath /data/local/tmp/skia_resources ";
- }
-
- mSampleView = new SkiaSampleView(this, flags, useOpenGLAPI, msaaSampleCount);
- LinearLayout holder = (LinearLayout) findViewById(R.id.holder);
- holder.addView(mSampleView, new LinearLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
- }
-
- private void setupActionBar() {
- ActionBar.OnNavigationListener navigationCallback = new ActionBar.OnNavigationListener() {
- @Override
- public boolean onNavigationItemSelected(int position, long itemId) {
- mSampleView.goToSample(position);
- return true;
- }
- };
-
- ActionBar actionBar = getActionBar();
- actionBar.setDisplayShowHomeEnabled(false);
- actionBar.setDisplayShowTitleEnabled(false);
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
- actionBar.setListNavigationCallbacks(mSlideList, navigationCallback);
- }
-
- @Override
- protected void onResume () {
- super.onResume();
- if (mSampleView != null && mSampleView.getWidth() > 0 && mSampleView.getHeight() > 0) {
- //TODO try mSampleView.requestRender() instead
- mSampleView.inval();
- }
- }
-
- @Override
- public void onDestroy() {
- if (mSampleView != null) {
- mSampleView.terminate();
- }
- super.onDestroy();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.action_bar, menu);
- return true;
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- if (mSampleView != null) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- ((MenuItem) menu.findItem(R.id.glcontext_menu))
- .setEnabled(false);
-
- } else {
- boolean usesOpenGLAPI = mSampleView.getUsesOpenGLAPI();
- boolean isMSAA4 = mSampleView.getMSAASampleCount() == 4;
-
- ((MenuItem) menu.findItem(R.id.glcontext_opengles))
- .setChecked(!usesOpenGLAPI && !isMSAA4);
-
- ((MenuItem) menu.findItem(R.id.glcontext_msaa4_opengles))
- .setChecked(!usesOpenGLAPI && isMSAA4);
-
- ((MenuItem) menu.findItem(R.id.glcontext_opengl))
- .setChecked(usesOpenGLAPI && !isMSAA4);
-
- ((MenuItem) menu.findItem(R.id.glcontext_msaa4_opengl))
- .setChecked(usesOpenGLAPI && isMSAA4);
- }
- }
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (mSampleView == null) {
- return false;
- }
-
- switch (item.getItemId()) {
- case R.id.overview:
- mSampleView.showOverview();
- return true;
- case R.id.prev:
- mSampleView.previousSample();
- return true;
- case R.id.next:
- mSampleView.nextSample();
- return true;
- case R.id.toggle_rendering:
- mSampleView.toggleRenderingMode();
- return true;
- case R.id.slideshow:
- mSampleView.toggleSlideshow();
- return true;
- case R.id.fps:
- mSampleView.toggleFPS();
- return true;
- case R.id.tiling:
- mSampleView.toggleTiling();
- return true;
- case R.id.bbox:
- mSampleView.toggleBBox();
- return true;
- case R.id.save_to_pdf:
- mSampleView.saveToPDF();
- return true;
- case R.id.glcontext_opengles:
- return setOpenGLContextSettings(false, 0);
- case R.id.glcontext_msaa4_opengles:
- return setOpenGLContextSettings(false, 4);
- case R.id.glcontext_opengl:
- return setOpenGLContextSettings(true, 0);
- case R.id.glcontext_msaa4_opengl:
- return setOpenGLContextSettings(true, 4);
- default:
- return false;
- }
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- final int keycode = event.getKeyCode();
- if (keycode == KeyEvent.KEYCODE_BACK) {
- if (event.getAction() == KeyEvent.ACTION_UP) {
- finish();
- }
- return true;
- }
- return false;
- }
-
- private static final int SET_TITLE = 1;
- private static final int SET_SLIDES = 2;
- private static final int TOAST_DOWNLOAD = 3;
-
- private Handler mHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case SET_TITLE:
- mTitle.setText((String) msg.obj);
- SkiaSampleActivity.this.getActionBar().setSubtitle((String) msg.obj);
- break;
- case SET_SLIDES:
- mSlideList.addAll((String[]) msg.obj);
- break;
- case TOAST_DOWNLOAD:
- Toast.makeText(SkiaSampleActivity.this, (String) msg.obj,
- Toast.LENGTH_SHORT).show();
- break;
- default:
- break;
- }
- }
- };
-
- // Called by JNI
- @Override
- public void setTitle(CharSequence title) {
- mHandler.obtainMessage(SET_TITLE, title).sendToTarget();
- }
-
- // Called by JNI
- public void setSlideList(String[] slideList) {
- mHandler.obtainMessage(SET_SLIDES, slideList).sendToTarget();
- }
-
- // Called by JNI
- public void addToDownloads(final String title, final String desc, final String path) {
- File file = new File(path);
- final long length = file.exists() ? file.length() : 0;
- if (length == 0) {
- String failed = getString(R.string.save_failed);
- mHandler.obtainMessage(TOAST_DOWNLOAD, failed).sendToTarget();
- return;
- }
- String toast = getString(R.string.file_saved).replace("%s", title);
- mHandler.obtainMessage(TOAST_DOWNLOAD, toast).sendToTarget();
- final DownloadManager manager =
- (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
- new Thread("Add PDF to downloads") {
- @Override
- public void run() {
- final String mimeType = "application/pdf";
- manager.addCompletedDownload(title, desc, true, mimeType, path, length, true);
- }
- }.start();
- }
-
- private boolean setOpenGLContextSettings(boolean requestedOpenGLAPI, int requestedSampleCount) {
- if (mSampleView != null &&
- mSampleView.getMSAASampleCount() == requestedSampleCount &&
- mSampleView.getUsesOpenGLAPI() == requestedOpenGLAPI) {
- return true;
- }
-
- createSampleView(requestedOpenGLAPI, requestedSampleCount);
-
- return true;
- }
-}
diff --git a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java
deleted file mode 100644
index 55257094cd..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-package com.skia;
-
-import android.opengl.GLSurfaceView;
-import android.os.Handler;
-import android.util.Log;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-import javax.microedition.khronos.opengles.GL11;
-
-public class SkiaSampleRenderer implements GLSurfaceView.Renderer {
-
- private final SkiaSampleView mSampleView;
- private Handler mHandler = new Handler();
- private int mMSAASampleCount;
- private String mCmdLineFlags;
-
- SkiaSampleRenderer(SkiaSampleView view, String cmdLineFlags) {
- mSampleView = view;
- mCmdLineFlags = cmdLineFlags;
- }
-
- @Override
- public void onDrawFrame(GL10 gl) {
- draw();
- }
-
- @Override
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- updateSize(width, height);
- }
-
- @Override
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- if (gl instanceof GL11) {
- int value[] = new int[1];
- ((GL11) gl).glGetIntegerv(GL11.GL_SAMPLES, value, 0);
- if (value[0] == 1) {
- mMSAASampleCount = 0;
- } else {
- mMSAASampleCount = value[0];
- }
- }
-
- gl.glClearStencil(0);
- gl.glClear(GL10.GL_STENCIL_BUFFER_BIT);
-
- init((SkiaSampleActivity)mSampleView.getContext(), mCmdLineFlags, mMSAASampleCount);
- }
-
- // Called by JNI and the view.
- synchronized public int getMSAASampleCount() {
- return mMSAASampleCount;
- }
-
- // Called by JNI
- private void startTimer(int ms) {
- // After the delay, queue an event to the Renderer's thread
- // to handle the event on the timer queue
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- mSampleView.queueEvent(new Runnable() {
- @Override
- public void run() {
- serviceQueueTimer();
- }
- });
- }
- }, ms);
- }
-
- // Called by JNI
- private void queueSkEvent() {
- mSampleView.queueEvent(new Runnable() {
- @Override
- public void run() {
- processSkEvent();
- }
- });
- }
-
- // Called by JNI
- private void requestRender() {
- mSampleView.requestRender();
- }
-
- native void init(SkiaSampleActivity activity, String flags, int msaaSampleCount);
- native void term();
- native void draw();
- native void updateSize(int w, int h);
- native void handleClick(int owner, float x, float y, int state);
- native void showOverview();
- native void nextSample();
- native void previousSample();
- native void goToSample(int position);
- native void toggleRenderingMode();
- native void toggleSlideshow();
- native void toggleFPS();
- native void toggleTiling();
- native void toggleBBox();
- native void processSkEvent();
- native void serviceQueueTimer();
- native void saveToPDF();
- native void postInval();
-} \ No newline at end of file
diff --git a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java
deleted file mode 100644
index c33f8ae8ac..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-package com.skia;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.egl.EGLDisplay;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.content.Context;
-import android.opengl.EGL14;
-import android.opengl.GLSurfaceView;
-import android.os.Build;
-import android.util.Log;
-import android.view.MotionEvent;
-
-public class SkiaSampleView extends GLSurfaceView {
-
- private final SkiaSampleRenderer mSampleRenderer;
- private boolean mRequestedOpenGLAPI; // true == use (desktop) OpenGL. false == use OpenGL ES.
- private int mRequestedMSAASampleCount;
-
- public SkiaSampleView(Context ctx, String cmdLineFlags, boolean useOpenGL, int msaaSampleCount) {
- super(ctx);
-
- mSampleRenderer = new SkiaSampleRenderer(this, cmdLineFlags);
- mRequestedMSAASampleCount = msaaSampleCount;
-
- setEGLContextClientVersion(2);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- setEGLConfigChooser(8, 8, 8, 8, 0, 8);
- } else {
- mRequestedOpenGLAPI = useOpenGL;
- setEGLConfigChooser(new SampleViewEGLConfigChooser());
- }
- setRenderer(mSampleRenderer);
- setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- int count = event.getPointerCount();
- for (int i = 0; i < count; i++) {
- final float x = event.getX(i);
- final float y = event.getY(i);
- final int owner = event.getPointerId(i);
- int action = event.getAction() & MotionEvent.ACTION_MASK;
- switch (action) {
- case MotionEvent.ACTION_POINTER_UP:
- action = MotionEvent.ACTION_UP;
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- action = MotionEvent.ACTION_DOWN;
- break;
- default:
- break;
- }
- final int finalAction = action;
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.handleClick(owner, x, y, finalAction);
- }
- });
- }
- return true;
- }
-
- public void inval() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.postInval();
- }
- });
- }
-
- public void terminate() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.term();
- }
- });
- }
-
- public void showOverview() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.showOverview();
- }
- });
- }
-
- public void nextSample() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.nextSample();
- }
- });
- }
-
- public void previousSample() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.previousSample();
- }
- });
- }
-
- public void goToSample(final int position) {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.goToSample(position);
- }
- });
- }
-
- public void toggleRenderingMode() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.toggleRenderingMode();
- }
- });
- }
-
- public void toggleSlideshow() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.toggleSlideshow();
- }
- });
- }
-
- public void toggleFPS() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.toggleFPS();
- }
- });
- }
-
- public void toggleTiling() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.toggleTiling();
- }
- });
- }
-
- public void toggleBBox() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.toggleBBox();
- }
- });
- }
-
- public void saveToPDF() {
- queueEvent(new Runnable() {
- @Override
- public void run() {
- mSampleRenderer.saveToPDF();
- }
- });
- }
-
- public boolean getUsesOpenGLAPI() {
- return mRequestedOpenGLAPI;
- }
-
- public int getMSAASampleCount() {
- return mSampleRenderer.getMSAASampleCount();
- }
-
- private class SampleViewEGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
-
- @Override
- public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
- int numConfigs = 0;
- int[] configSpec = null;
- int[] value = new int[1];
-
- int[] validAPIs = new int[] {
- EGL14.EGL_OPENGL_API,
- EGL14.EGL_OPENGL_ES_API
- };
- int initialAPI = mRequestedOpenGLAPI ? 0 : 1;
-
- for (int i = initialAPI; i < validAPIs.length && numConfigs == 0; i++) {
- int currentAPI = validAPIs[i];
- EGL14.eglBindAPI(currentAPI);
-
- // setup the renderableType which will only be included in the
- // spec if we are attempting to get access to the OpenGL APIs.
- int renderableType = EGL14.EGL_OPENGL_BIT;
- if (currentAPI == EGL14.EGL_OPENGL_API) {
- renderableType = EGL14.EGL_OPENGL_ES2_BIT;
- }
-
- if (mRequestedMSAASampleCount > 0) {
- configSpec = new int[] {
- EGL10.EGL_RED_SIZE, 8,
- EGL10.EGL_GREEN_SIZE, 8,
- EGL10.EGL_BLUE_SIZE, 8,
- EGL10.EGL_ALPHA_SIZE, 8,
- EGL10.EGL_DEPTH_SIZE, 0,
- EGL10.EGL_STENCIL_SIZE, 8,
- EGL10.EGL_SAMPLE_BUFFERS, 1,
- EGL10.EGL_SAMPLES, mRequestedMSAASampleCount,
- EGL10.EGL_RENDERABLE_TYPE, renderableType,
- EGL10.EGL_NONE
- };
-
- // EGL_RENDERABLE_TYPE is only needed when attempting to use
- // the OpenGL API (not ES) and causes many EGL drivers to fail
- // with a BAD_ATTRIBUTE error.
- if (!mRequestedOpenGLAPI) {
- configSpec[16] = EGL10.EGL_NONE;
- Log.i("Skia", "spec: " + configSpec);
- }
-
- if (!egl.eglChooseConfig(display, configSpec, null, 0, value)) {
- Log.i("Skia", "Could not get MSAA context count: " + mRequestedMSAASampleCount);
- }
-
- numConfigs = value[0];
- }
-
- if (numConfigs <= 0) {
- // Try without multisampling.
- configSpec = new int[] {
- EGL10.EGL_RED_SIZE, 8,
- EGL10.EGL_GREEN_SIZE, 8,
- EGL10.EGL_BLUE_SIZE, 8,
- EGL10.EGL_ALPHA_SIZE, 8,
- EGL10.EGL_DEPTH_SIZE, 0,
- EGL10.EGL_STENCIL_SIZE, 8,
- EGL10.EGL_RENDERABLE_TYPE, renderableType,
- EGL10.EGL_NONE
- };
-
- // EGL_RENDERABLE_TYPE is only needed when attempting to use
- // the OpenGL API (not ES) and causes many EGL drivers to fail
- // with a BAD_ATTRIBUTE error.
- if (!mRequestedOpenGLAPI) {
- configSpec[12] = EGL10.EGL_NONE;
- Log.i("Skia", "spec: " + configSpec);
- }
-
- if (!egl.eglChooseConfig(display, configSpec, null, 0, value)) {
- Log.i("Skia", "Could not get non-MSAA context count");
- }
- numConfigs = value[0];
- }
- }
-
- if (numConfigs <= 0) {
- throw new IllegalArgumentException("No configs match configSpec");
- }
-
- // Get all matching configurations.
- EGLConfig[] configs = new EGLConfig[numConfigs];
- if (!egl.eglChooseConfig(display, configSpec, configs, numConfigs, value)) {
- throw new IllegalArgumentException("Could not get config data");
- }
-
- for (int i = 0; i < configs.length; ++i) {
- EGLConfig config = configs[i];
- if (findConfigAttrib(egl, display, config , EGL10.EGL_RED_SIZE, 0) == 8 &&
- findConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0) == 8 &&
- findConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0) == 8 &&
- findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0) == 8 &&
- findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0) == 8) {
- return config;
- }
- }
-
- throw new IllegalArgumentException("Could not find suitable EGL config");
- }
-
- private int findConfigAttrib(EGL10 egl, EGLDisplay display,
- EGLConfig config, int attribute, int defaultValue) {
- int[] value = new int[1];
- if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
- return value[0];
- }
- return defaultValue;
- }
-
- }
-}
diff --git a/platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h b/platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h
deleted file mode 100644
index 6bcb148b46..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/*
- * Copyright 2011 Skia
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef _ANDROID_TO_SKIA_KEYCODES_H
-#define _ANDROID_TO_SKIA_KEYCODES_H
-
-#include "android/keycodes.h"
-#include "SkKey.h"
-
-// Convert an Android keycode to an SkKey. This is an incomplete list, only
-// including keys used by the sample app.
-SkKey AndroidKeycodeToSkKey(int keycode) {
- switch (keycode) {
- case AKEYCODE_DPAD_LEFT:
- return kLeft_SkKey;
- case AKEYCODE_DPAD_RIGHT:
- return kRight_SkKey;
- case AKEYCODE_DPAD_UP:
- return kUp_SkKey;
- case AKEYCODE_DPAD_DOWN:
- return kDown_SkKey;
- case AKEYCODE_BACK:
- return kBack_SkKey;
- default:
- return kNONE_SkKey;
- }
-}
-
-#endif
diff --git a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
deleted file mode 100644
index d66221a01c..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-
-/*
- * Copyright 2011 Skia
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "com_skia_SkiaSampleRenderer.h"
-
-#include "SampleApp.h"
-#include "SkApplication.h"
-#include "SkCanvas.h"
-#include "SkDevice.h"
-#include "SkEvent.h"
-#include "SkWindow.h"
-
-#include <jni.h>
-#include "AndroidKeyToSkKey.h"
-
-
-///////////////////////////////////////////
-///////////////// Globals /////////////////
-///////////////////////////////////////////
-
-struct ActivityGlue {
- JNIEnv* m_env;
- jweak m_obj;
- jmethodID m_setTitle;
- jmethodID m_setSlideList;
- jmethodID m_addToDownloads;
- ActivityGlue() {
- m_env = NULL;
- m_obj = NULL;
- m_setTitle = NULL;
- m_setSlideList = NULL;
- m_addToDownloads = NULL;
- }
-} gActivityGlue;
-
-struct WindowGlue {
- jweak m_obj;
- jmethodID m_inval;
- jmethodID m_queueSkEvent;
- jmethodID m_startTimer;
- jmethodID m_getMSAASampleCount;
- WindowGlue() {
- m_obj = NULL;
- m_inval = NULL;
- m_queueSkEvent = NULL;
- m_startTimer = NULL;
- m_getMSAASampleCount = NULL;
- }
-} gWindowGlue;
-
-SampleWindow* gWindow;
-
-///////////////////////////////////////////
-///////////// SkOSWindow impl /////////////
-///////////////////////////////////////////
-
-SkOSWindow::SkOSWindow(void*) : fDestroyRequested(false) {
-}
-
-SkOSWindow::~SkOSWindow() {
-}
-
-bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int /*msaaSampleCount*/, AttachmentInfo* info)
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env || !gWindowGlue.m_getMSAASampleCount || !gWindowGlue.m_obj) {
- return false;
- }
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
- return false;
- }
- info->fSampleCount = env->CallIntMethod(gWindowGlue.m_obj, gWindowGlue.m_getMSAASampleCount);
-
- // This is the value requested in SkiaSampleView.java.
- info->fStencilBits = 8;
- return true;
-}
-
-void SkOSWindow::detach() {
-}
-
-void SkOSWindow::present() {
-}
-
-void SkOSWindow::closeWindow() {
-}
-
-void SkOSWindow::setVsync(bool) {
-}
-
-void SkOSWindow::onSetTitle(const char title[])
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env) {
- return;
- }
- if (env->IsSameObject(gActivityGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Activity is invalid");
- return;
- }
-
- jstring string = env->NewStringUTF(title);
- env->CallVoidMethod(gActivityGlue.m_obj, gActivityGlue.m_setTitle, string);
- env->DeleteLocalRef(string);
-}
-
-void SkOSWindow::onHandleInval(const SkIRect& rect)
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env || !gWindowGlue.m_inval || !gWindowGlue.m_obj) {
- return;
- }
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
- return;
- }
- env->CallVoidMethod(gWindowGlue.m_obj, gWindowGlue.m_inval);
-}
-
-void SkOSWindow::onPDFSaved(const char title[], const char desc[],
- const char path[])
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env || !gActivityGlue.m_addToDownloads || !gActivityGlue.m_obj) {
- return;
- }
- if (env->IsSameObject(gActivityGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Activity is invalid");
- return;
- }
-
- jstring jtitle = env->NewStringUTF(title);
- jstring jdesc = env->NewStringUTF(desc);
- jstring jpath = env->NewStringUTF(path);
-
- env->CallVoidMethod(gActivityGlue.m_obj, gActivityGlue.m_addToDownloads,
- jtitle, jdesc, jpath);
-
- env->DeleteLocalRef(jtitle);
- env->DeleteLocalRef(jdesc);
- env->DeleteLocalRef(jpath);
-}
-
-///////////////////////////////////////////
-/////////////// SkEvent impl //////////////
-///////////////////////////////////////////
-
-void SkEvent::SignalQueueTimer(SkMSec ms)
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env || !gWindowGlue.m_startTimer || !gWindowGlue.m_obj || !ms) {
- return;
- }
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
- return;
- }
- env->CallVoidMethod(gWindowGlue.m_obj,
- gWindowGlue.m_startTimer, ms);
-}
-
-void SkEvent::SignalNonEmptyQueue()
-{
- JNIEnv* env = gActivityGlue.m_env;
- if (!env || !gWindowGlue.m_queueSkEvent || !gWindowGlue.m_obj) {
- return;
- }
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
- SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
- return;
- }
- env->CallVoidMethod(gWindowGlue.m_obj, gWindowGlue.m_queueSkEvent);
-}
-
-///////////////////////////////////////////
-////////////////// JNI ////////////////////
-///////////////////////////////////////////
-
-static jmethodID GetJMethod(JNIEnv* env, jclass clazz, const char name[],
- const char signature[])
-{
- jmethodID m = env->GetMethodID(clazz, name, signature);
- if (!m) SkDebugf("Could not find Java method %s\n", name);
- return m;
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_init(JNIEnv* env,
- jobject thiz, jobject jsampleActivity, jstring cmdLineFlags, jint msaaSampleCount)
-{
- // setup jni hooks to the java activity
- gActivityGlue.m_env = env;
- jclass clazz = env->FindClass("com/skia/SkiaSampleActivity");
- gActivityGlue.m_obj = env->NewWeakGlobalRef(jsampleActivity);
- gActivityGlue.m_setTitle = GetJMethod(env, clazz, "setTitle", "(Ljava/lang/CharSequence;)V");
- gActivityGlue.m_setSlideList = GetJMethod(env, clazz, "setSlideList", "([Ljava/lang/String;)V");
- gActivityGlue.m_addToDownloads = GetJMethod(env, clazz, "addToDownloads",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
- env->DeleteLocalRef(clazz);
-
- // setup jni hooks to the java renderer
- clazz = env->FindClass("com/skia/SkiaSampleRenderer");
- gWindowGlue.m_obj = env->NewWeakGlobalRef(thiz);
- gWindowGlue.m_inval = GetJMethod(env, clazz, "requestRender", "()V");
- gWindowGlue.m_queueSkEvent = GetJMethod(env, clazz, "queueSkEvent", "()V");
- gWindowGlue.m_startTimer = GetJMethod(env, clazz, "startTimer", "(I)V");
- gWindowGlue.m_getMSAASampleCount = GetJMethod(env, clazz, "getMSAASampleCount", "()I");
- env->DeleteLocalRef(clazz);
-
- application_init();
-
- const char* flags = env->GetStringUTFChars(cmdLineFlags, JNI_FALSE);
- SkTArray<SkString> flagEntries;
- SkStrSplit(flags, " ", &flagEntries);
-
- SkTArray<const char*> args;
- args.push_back("SampleApp");
- for (int i = 0; i < flagEntries.count(); i++) {
- SkDebugf(flagEntries[i].c_str());
- args.push_back(flagEntries[i].c_str());
- }
-
- SkString msaaSampleCountString;
- if (msaaSampleCount > 0) {
- args.push_back("--msaa");
- msaaSampleCountString.appendS32(static_cast<uint32_t>(msaaSampleCount));
- args.push_back(msaaSampleCountString.c_str());
- }
-
- if (gWindow) {
- SkDebugf("The sample window already exists.");
- } else {
- gWindow = new SampleWindow(NULL, args.count(), const_cast<char**>(args.begin()), NULL);
- }
-
- // cleanup the command line flags
- env->ReleaseStringUTFChars(cmdLineFlags, flags);
-
- // send the list of slides up to the activity
- const int slideCount = gWindow->sampleCount();
- jobjectArray slideList = env->NewObjectArray(slideCount, env->FindClass("java/lang/String"), env->NewStringUTF(""));
- for (int i = 0; i < slideCount; i++) {
- jstring slideTitle = env->NewStringUTF(gWindow->getSampleTitle(i).c_str());
- env->SetObjectArrayElement(slideList, i, slideTitle);
- env->DeleteLocalRef(slideTitle);
- }
- env->CallVoidMethod(gActivityGlue.m_obj, gActivityGlue.m_setSlideList, slideList);
- env->DeleteLocalRef(slideList);
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_term(JNIEnv* env,
- jobject thiz)
-{
- delete gWindow;
- gWindow = NULL;
- application_term();
- if (gWindowGlue.m_obj) {
- env->DeleteWeakGlobalRef(gWindowGlue.m_obj);
- gWindowGlue.m_obj = NULL;
- }
- if (gActivityGlue.m_obj) {
- env->DeleteWeakGlobalRef(gActivityGlue.m_obj);
- gActivityGlue.m_obj = NULL;
- }
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_draw(
- JNIEnv* env, jobject thiz)
-{
- if (!gWindow) return;
- gWindow->update(NULL);
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_updateSize(JNIEnv* env,
- jobject thiz, jint w, jint h)
-{
- gWindow->resize(w, h);
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_handleClick(JNIEnv* env,
- jobject thiz, jint owner, jfloat x, jfloat y, jint jstate)
-{
- SkView::Click::State state;
- switch(jstate) {
- case 0: // MotionEvent.ACTION_DOWN
- state = SkView::Click::kDown_State;
- break;
- case 1: // MotionEvent.ACTION_UP
- case 3: // MotionEvent.ACTION_CANCEL
- state = SkView::Click::kUp_State;
- break;
- case 2: // MotionEvent.ACTION_MOVE
- state = SkView::Click::kMoved_State;
- break;
- default:
- SkDebugf("motion event ignored\n");
- return;
- }
- gWindow->handleClick(x, y, state, reinterpret_cast<void*>(owner));
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_nextSample(
- JNIEnv* env, jobject thiz)
-{
- gWindow->nextSample();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_previousSample(
- JNIEnv* env, jobject thiz)
-{
- gWindow->previousSample();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_goToSample(
- JNIEnv* env, jobject thiz, jint position)
-{
- gWindow->goToSample(position);
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleRenderingMode(
- JNIEnv* env, jobject thiz)
-{
- gWindow->toggleRendering();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_showOverview(
- JNIEnv* env, jobject thiz)
-{
- gWindow->showOverview();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleSlideshow(
- JNIEnv* env, jobject thiz)
-{
- gWindow->toggleSlideshow();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleFPS(
- JNIEnv* env, jobject thiz)
-{
- gWindow->toggleFPS();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleTiling(
- JNIEnv* env, jobject thiz)
-{
- gWindow->handleChar('t');
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleBBox(
- JNIEnv* env, jobject thiz)
-{
- gWindow->handleChar('b');
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_processSkEvent(
- JNIEnv* env, jobject thiz)
-{
- if (SkEvent::ProcessEvent()) {
- SkEvent::SignalNonEmptyQueue();
- }
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_serviceQueueTimer(
- JNIEnv* env, jobject thiz)
-{
- SkEvent::ServiceQueueTimer();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_saveToPDF(
- JNIEnv* env, jobject thiz)
-{
- gWindow->saveToPdf();
-}
-
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_postInval(
- JNIEnv* env, jobject thiz)
-{
- gWindow->postInvalDelay();
-}
diff --git a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h
deleted file mode 100644
index 8883a3a9f0..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2015 Skia
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_skia_SkiaSampleRenderer */
-
-#ifndef _Included_com_skia_SkiaSampleRenderer
-#define _Included_com_skia_SkiaSampleRenderer
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: init
- * Signature: (Lcom/skia/SkiaSampleActivity;Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_init
- (JNIEnv *, jobject, jobject, jstring, jint);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: term
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_term
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: draw
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_draw
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: updateSize
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_updateSize
- (JNIEnv *, jobject, jint, jint);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: handleClick
- * Signature: (IFFI)V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_handleClick
- (JNIEnv *, jobject, jint, jfloat, jfloat, jint);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: showOverview
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_showOverview
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: nextSample
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_nextSample
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: previousSample
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_previousSample
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: goToSample
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_goToSample
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: toggleRenderingMode
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleRenderingMode
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: toggleSlideshow
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleSlideshow
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: toggleFPS
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleFPS
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: toggleTiling
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleTiling
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: toggleBBox
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_toggleBBox
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: processSkEvent
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_processSkEvent
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: serviceQueueTimer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_serviceQueueTimer
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: saveToPdf
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_saveToPDF
- (JNIEnv *, jobject);
-
-/*
- * Class: com_skia_SkiaSampleRenderer
- * Method: postInval
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_postInval
- (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.png b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.png
deleted file mode 100644
index b696a6bb22..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.png
+++ /dev/null
Binary files differ
diff --git a/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.png b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.png
deleted file mode 100644
index 5550c5a6ff..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.png
+++ /dev/null
Binary files differ
diff --git a/platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml b/platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml
deleted file mode 100644
index cdb90e9961..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2011 Google Inc.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/holder"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <TextView android:id="@+id/title_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
-</LinearLayout>
-
diff --git a/platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml b/platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml
deleted file mode 100644
index 72e135e43b..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2011 Google Inc.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:id="@+id/fps"
- android:title="@string/fps"
- android:showAsAction="ifRoom"
- />
- <item
- android:id="@+id/toggle_rendering"
- android:title="@string/toggle_rendering"
- android:showAsAction="ifRoom"
- />
- <item
- android:id="@+id/prev"
- android:showAsAction="always"
- android:icon="@drawable/ic_btn_find_prev"
- />
- <item
- android:id="@+id/next"
- android:showAsAction="always"
- android:icon="@drawable/ic_btn_find_next"
- />
- <item
- android:id="@+id/overview"
- android:title="@string/overview"
- />
- <item
- android:id="@+id/slideshow"
- android:title="@string/slideshow"
- />
- <item
- android:id="@+id/tiling"
- android:title="@string/tiling"
- />
- <item
- android:id="@+id/bbox"
- android:title="@string/bbox"
- />
- <item
- android:id="@+id/glcontext_menu"
- android:title="@string/glcontext_menu">
- <menu>
- <item
- android:id="@+id/glcontext_opengles"
- android:title="@string/glcontext_opengles"
- android:checkable="true"
- />
- <item
- android:id="@+id/glcontext_msaa4_opengles"
- android:title="@string/glcontext_msaa4_opengles"
- android:checkable="true"
- />
- <item
- android:id="@+id/glcontext_opengl"
- android:title="@string/glcontext_opengl"
- android:checkable="true"
- />
- <item
- android:id="@+id/glcontext_msaa4_opengl"
- android:title="@string/glcontext_msaa4_opengl"
- android:checkable="true"
- />
- </menu>
- </item>
- <item
- android:id="@+id/save_to_pdf"
- android:title="@string/save_to_pdf"
- />
-</menu>
diff --git a/platform_tools/android/apps/sample_app/src/main/res/values/strings.xml b/platform_tools/android/apps/sample_app/src/main/res/values/strings.xml
deleted file mode 100644
index b0b4e7b74b..0000000000
--- a/platform_tools/android/apps/sample_app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">Skia Samples</string>
- <string name="overview">Overview</string>
- <string name="toggle_rendering">Toggle Rendering</string>
- <string name="slideshow">Slideshow</string>
- <string name="fps">FPS</string>
- <string name="tiling">Toggle Tiling</string>
- <string name="bbox">Toggle SKP BBox</string>
- <string name="save_to_pdf">Save to PDF</string>
- <string name="save_failed">Save Failed</string>
- <string name="file_saved">%s saved!</string>
- <string name="glcontext_menu">Set OpenGL Context Type</string>
- <string name="glcontext_opengles">OpenGL ES</string>
- <string name="glcontext_msaa4_opengles">OpenGL ES, MSAA4</string>
- <string name="glcontext_opengl">OpenGL</string>
- <string name="glcontext_msaa4_opengl">OpenGL, MSAA4</string>
-</resources> \ No newline at end of file
diff --git a/platform_tools/android/apps/settings.gradle b/platform_tools/android/apps/settings.gradle
deleted file mode 100644
index 89cc95447b..0000000000
--- a/platform_tools/android/apps/settings.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-include ':sample_app'
-include ':visualbench'
diff --git a/platform_tools/android/apps/visualbench/build.gradle b/platform_tools/android/apps/visualbench/build.gradle
deleted file mode 100644
index 81322b026e..0000000000
--- a/platform_tools/android/apps/visualbench/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 19
- buildToolsVersion "22.0.1"
-
- defaultConfig {
- applicationId "com.skia.visualbench"
- minSdkVersion 9
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call
- sourceSets.main.jniLibs.srcDir "src/main/libs"
-
- productFlavors {
- arm {}
- arm64 {}
- x86 {}
- x86_64 {}
- mips {}
- mips64 {}
- }
-
- // make sure that app is built and shared libraries are copied to correct directories
- applicationVariants.all{ variant ->
-
- def buildNativeLib = task("${variant.name}_NativeLib", type:Exec) {
- workingDir '../../../..' // top-level skia directory
- commandLine constructBuildCommand(variant, "CopyVisualBenchDeps").split()
- environment PATH: getPathWithDepotTools()
- environment ANDROID_SDK_ROOT: getSDKPath()
- }
-
- if (!hasProperty("suppressNativeBuild")) {
- TaskCollection<Task> assembleTask
- assembleTask = project.tasks.matching {
- it.name.contains("assemble") &&
- it.name.toLowerCase().endsWith(variant.name.toLowerCase())
- }
- assembleTask.getAt(0).dependsOn buildNativeLib
- }
- }
-} \ No newline at end of file
diff --git a/platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml b/platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml
deleted file mode 100644
index c15dee6e16..0000000000
--- a/platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- BEGIN_INCLUDE(manifest) -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.skia"
- android:versionCode="1"
- android:versionName="1.0">
-
- <!-- This is the platform API where NativeActivity was introduced. -->
- <uses-sdk android:minSdkVersion="9" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.WRITE_SETTINGS" />
- <application android:label="VisualBenchActivity">
- <activity android:name=".VisualBenchActivity"
- android:label="VisualBenchActivity"
- android:configChanges="orientation|keyboardHidden"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
- <meta-data android:name="android.app.lib_name"
- android:value="visualbench" />
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
-<!-- END_INCLUDE(manifest) -->
diff --git a/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java b/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java
deleted file mode 100644
index 90f70bfe0a..0000000000
--- a/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-package com.skia;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.util.Log;
-import android.view.View;
-import android.view.WindowManager;
-
-public class VisualBenchActivity extends android.app.NativeActivity {
- static {
- System.loadLibrary("skia_android");
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- // Setup a bunch of window parameters. We have to do this here to prevent our backend from
- // getting spurious term / init messages when we relayout
-
- // Layout fullscreen and keep screen on
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN |
- WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
- View.SYSTEM_UI_FLAG_FULLSCREEN |// hide status bar
- View.SYSTEM_UI_FLAG_IMMERSIVE);
-
- // Disable backlight to keep the system as cool as possible
- // TODO make this configurable
- Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
-
- WindowManager.LayoutParams lp = getWindow().getAttributes();
- lp.screenBrightness = 0; // 0f - no backlight
- getWindow().setAttributes(lp);
- }
-}
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
deleted file mode 100644
index e2bc99610f..0000000000
--- a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkOSWindow_Android.h"
-
-#include <GLES/gl.h>
-
-SkOSWindow::SkOSWindow(void* hwnd) {
- fWindow.fDisplay = EGL_NO_DISPLAY;
- fWindow.fContext = EGL_NO_CONTEXT;
- fWindow.fSurface = EGL_NO_SURFACE;
- fNativeWindow = (ANativeWindow*)hwnd;
- fDestroyRequested = false;
-}
-
-SkOSWindow::~SkOSWindow() {
- if (fWindow.fDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (fWindow.fContext != EGL_NO_CONTEXT) {
- eglDestroyContext(fWindow.fDisplay, fWindow.fContext);
- }
- if (fWindow.fSurface != EGL_NO_SURFACE) {
- eglDestroySurface(fWindow.fDisplay, fWindow.fSurface);
- }
- eglTerminate(fWindow.fDisplay);
- }
- fWindow.fDisplay = EGL_NO_DISPLAY;
- fWindow.fContext = EGL_NO_CONTEXT;
- fWindow.fSurface = EGL_NO_SURFACE;
-}
-
-bool SkOSWindow::attach(SkBackEndTypes attachType,
- int /*msaaSampleCount*/,
- AttachmentInfo* info) {
- static const EGLint kEGLContextAttribsForOpenGL[] = {
- EGL_NONE
- };
-
- static const EGLint kEGLContextAttribsForOpenGLES[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
- static const struct {
- const EGLint* fContextAttribs;
- EGLenum fAPI;
- EGLint fRenderableTypeBit;
- } kAPIs[] = {
- { // OpenGL
- kEGLContextAttribsForOpenGL,
- EGL_OPENGL_API,
- EGL_OPENGL_BIT,
- },
- { // OpenGL ES. This seems to work for both ES2 and 3 (when available).
- kEGLContextAttribsForOpenGLES,
- EGL_OPENGL_ES_API,
- EGL_OPENGL_ES2_BIT,
- },
- };
-
- size_t apiLimit = SK_ARRAY_COUNT(kAPIs);
-
- for (size_t api = 0; api < apiLimit; ++api) {
- EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- EGLint majorVersion;
- EGLint minorVersion;
- eglInitialize(display, &majorVersion, &minorVersion);
-
-#if 0
- SkDebugf("VENDOR: %s\n", eglQueryString(fDisplay, EGL_VENDOR));
- SkDebugf("APIS: %s\n", eglQueryString(fDisplay, EGL_CLIENT_APIS));
- SkDebugf("VERSION: %s\n", eglQueryString(fDisplay, EGL_VERSION));
- SkDebugf("EXTENSIONS %s\n", eglQueryString(fDisplay, EGL_EXTENSIONS));
-#endif
-
- if (!eglBindAPI(kAPIs[api].fAPI)) {
- continue;
- }
-
- const EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, kAPIs[api].fRenderableTypeBit,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
-
- EGLint format;
- EGLint numConfigs;
- EGLConfig config;
- EGLSurface surface;
- EGLContext context;
-
- /* Here, the application chooses the configuration it desires. In this
- * sample, we have a very simplified selection process, where we pick
- * the first EGLConfig that matches our criteria */
- eglChooseConfig(display, configAttribs, &config, 1, &numConfigs);
-
- /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
- * guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
- * As soon as we picked a EGLConfig, we can safely reconfigure the
- * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
- eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
-
- ANativeWindow_setBuffersGeometry(fNativeWindow, 0, 0, format);
-
- surface = eglCreateWindowSurface(display, config, fNativeWindow, NULL);
- context = eglCreateContext(display, config, NULL, kAPIs[api].fContextAttribs);
- if (EGL_NO_CONTEXT == context) {
- SkDebugf("eglCreateContext failed. EGL Error: 0x%08x\n", eglGetError());
- continue;
- }
-
- if (!eglMakeCurrent(display, surface, surface, context)) {
- SkDebugf("eglMakeCurrent failed. EGL Error: 0x%08x\n", eglGetError());
- continue;
- }
-
- fWindow.fDisplay = display;
- fWindow.fContext = context;
- fWindow.fSurface = surface;
- }
-
- if (fWindow.fDisplay && fWindow.fContext && fWindow.fSurface) {
- EGLint w, h;
- eglQuerySurface(fWindow.fDisplay, fWindow.fSurface, EGL_WIDTH, &w);
- eglQuerySurface(fWindow.fDisplay, fWindow.fSurface, EGL_HEIGHT, &h);
-
- glViewport(0, 0, w, h);
- glClearColor(0.0, 0, 0, 0.0);
- glClearStencil(0);
- glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
- // We retrieve the fullscreen width and height
- this->setSize((SkScalar)w, (SkScalar)h);
- return true;
- } else {
- return false;
- }
-}
-
-void SkOSWindow::detach() {
- fDestroyRequested = true;
-}
-
-void SkOSWindow::present() {
- if (fWindow.fDisplay != EGL_NO_DISPLAY && fWindow.fContext != EGL_NO_CONTEXT) {
- eglSwapBuffers(fWindow.fDisplay, fWindow.fSurface);
- }
-}
-
-void SkOSWindow::closeWindow() {
- fDestroyRequested = true;
-}
-
-void SkOSWindow::setVsync(bool vsync) {
- if (fWindow.fDisplay != EGL_NO_DISPLAY) {
- int swapInterval = vsync ? 1 : 0;
- eglSwapInterval(fWindow.fDisplay, swapInterval);
- }
-}
-
-void SkOSWindow::onSetTitle(const char title[]) {
-}
-
-void SkOSWindow::onHandleInval(const SkIRect& rect) {
-}
-
-void SkOSWindow::onPDFSaved(const char title[], const char desc[], const char path[]) {
-}
-
-///////////////////////////////////////////
-/////////////// SkEvent impl //////////////
-///////////////////////////////////////////
-
-void SkEvent::SignalQueueTimer(SkMSec ms) {
-}
-
-void SkEvent::SignalNonEmptyQueue() {
-}
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
deleted file mode 100644
index 2ea6b76b39..0000000000
--- a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- */
-
-#include <android_native_app_glue.h>
-
-#include "SkApplication.h"
-#include "VisualBench.h"
-
-/**
- * Shared state for our app.
- */
-enum State {
- kInit_State,
- kAnimate_State,
- kDestroyRequested_State,
- kFinished_State,
-};
-
-struct VisualBenchState {
- VisualBenchState() : fApp(NULL), fWindow(NULL), fState(kInit_State) {}
- struct android_app* fApp;
- SkOSWindow* fWindow;
- SkTArray<SkString> fFlags;
- State fState;
-};
-
-static void handle_cmd(struct android_app* app, int32_t cmd) {
- struct VisualBenchState* state = (struct VisualBenchState*)app->userData;
- switch (cmd) {
- case APP_CMD_INIT_WINDOW:
- // The window is being shown, get it ready.
- if (state->fApp->window != NULL && kInit_State == state->fState) {
- // drain any events that occurred before |window| was assigned.
- while (SkEvent::ProcessEvent());
-
- // Start normal Skia sequence
- application_init();
-
- SkTArray<const char*> args;
- args.push_back("VisualBench");
- for (int i = 0; i < state->fFlags.count(); i++) {
- SkDebugf(state->fFlags[i].c_str());
- args.push_back(state->fFlags[i].c_str());
- }
-
- state->fWindow = create_sk_window((void*)state->fApp->window,
- args.count(),
- const_cast<char**>(args.begin()));
- state->fWindow->forceInvalAll();
- state->fState = kAnimate_State;
- }
- break;
- case APP_CMD_TERM_WINDOW:
- state->fState = kDestroyRequested_State;
- break;
- }
-}
-
-void android_main(struct android_app* state) {
- struct VisualBenchState visualBenchState;
-
- // Make sure glue isn't stripped.
- app_dummy();
-
- state->userData = &visualBenchState;
- state->onAppCmd = handle_cmd;
- visualBenchState.fApp = state;
-
- // Get command line arguments
- JavaVM* jvm = state->activity->vm;
- JNIEnv *env;
- jvm->AttachCurrentThread(&env, 0);
-
- jobject me = state->activity->clazz;
-
- jclass acl = env->GetObjectClass(me); //class pointer of NativeActivity
- jmethodID giid = env->GetMethodID(acl, "getIntent", "()Landroid/content/Intent;");
- jobject intent = env->CallObjectMethod(me, giid); //Got our intent
-
- jclass icl = env->GetObjectClass(intent); //class pointer of Intent
- jmethodID gseid = env->GetMethodID(icl, "getStringExtra",
- "(Ljava/lang/String;)Ljava/lang/String;");
-
- jstring jsParam1 = (jstring)env->CallObjectMethod(intent, gseid,
- env->NewStringUTF("cmdLineFlags"));
- if (jsParam1) {
- const char* flags = env->GetStringUTFChars(jsParam1, 0);
- SkStrSplit(flags, " ", &visualBenchState.fFlags);
- env->ReleaseStringUTFChars(jsParam1, flags);
- }
- jvm->DetachCurrentThread();
-
- while (1) {
- // Read all pending events.
- int ident;
- int events;
- struct android_poll_source* source;
-
- // We loop until all events are read, then continue to draw the next frame of animation.
- while ((ident=ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0) {
- // Process this event.
- if (source != NULL) {
- source->process(state, source);
- }
-
- // Check if we are exiting.
- if (state->destroyRequested != 0) {
- return;
- }
-
- }
-
- if (visualBenchState.fWindow) {
- if (visualBenchState.fWindow->destroyRequested()) {
- visualBenchState.fState = kDestroyRequested_State;
- } else {
- visualBenchState.fWindow->update(NULL);
- }
- }
-
- if (kDestroyRequested_State == visualBenchState.fState) {
- SkDELETE(visualBenchState.fWindow);
- visualBenchState.fWindow = NULL;
- application_term();
- ANativeActivity_finish(state->activity);
- visualBenchState.fState = kFinished_State;
- }
- }
-}