Merge "docs: move new AIDL doc back into the existing doc, but move the side nav location out of tools" into honeycomb
diff --git a/Android.mk b/Android.mk
index 27c4bec8..fcb66ae 100644
--- a/Android.mk
+++ b/Android.mk
@@ -415,6 +415,8 @@
resources/samples/NotePad "Note Pad" \
-samplecode $(sample_dir)/SampleSyncAdapter \
resources/samples/SampleSyncAdapter "Sample Sync Adapter" \
+ -samplecode frameworks/base/libs/rs/java \
+ resources/samples/Renderscript "Renderscript" \
-samplecode $(sample_dir)/SearchableDictionary \
resources/samples/SearchableDictionary "Searchable Dictionary v2" \
-samplecode $(sample_dir)/SipDemo \
diff --git a/api/11.xml b/api/11.xml
index 4a40c36..ed4a2e0 100644
--- a/api/11.xml
+++ b/api/11.xml
@@ -37266,17 +37266,6 @@
visibility="public"
>
</field>
-<field name="USES_POLICY_SETS_GLOBAL_PROXY"
- type="int"
- transient="false"
- volatile="false"
- value="5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="USES_POLICY_WATCH_LOGIN"
type="int"
transient="false"
@@ -37592,17 +37581,6 @@
visibility="public"
>
</method>
-<method name="getGlobalProxyAdmin"
- return="android.content.ComponentName"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
<method name="getMaximumFailedPasswordsForWipe"
return="int"
abstract="false"
@@ -37887,23 +37865,6 @@
<parameter name="flags" type="int">
</parameter>
</method>
-<method name="setGlobalProxy"
- return="android.content.ComponentName"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="admin" type="android.content.ComponentName">
-</parameter>
-<parameter name="proxySpec" type="java.net.Proxy">
-</parameter>
-<parameter name="exclusionList" type="java.util.List<java.lang.String>">
-</parameter>
-</method>
<method name="setMaximumFailedPasswordsForWipe"
return="void"
abstract="false"
diff --git a/api/current.xml b/api/current.xml
index 4a40c36..ed4a2e0 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -37266,17 +37266,6 @@
visibility="public"
>
</field>
-<field name="USES_POLICY_SETS_GLOBAL_PROXY"
- type="int"
- transient="false"
- volatile="false"
- value="5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="USES_POLICY_WATCH_LOGIN"
type="int"
transient="false"
@@ -37592,17 +37581,6 @@
visibility="public"
>
</method>
-<method name="getGlobalProxyAdmin"
- return="android.content.ComponentName"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
<method name="getMaximumFailedPasswordsForWipe"
return="int"
abstract="false"
@@ -37887,23 +37865,6 @@
<parameter name="flags" type="int">
</parameter>
</method>
-<method name="setGlobalProxy"
- return="android.content.ComponentName"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="admin" type="android.content.ComponentName">
-</parameter>
-<parameter name="proxySpec" type="java.net.Proxy">
-</parameter>
-<parameter name="exclusionList" type="java.util.List<java.lang.String>">
-</parameter>
-</method>
<method name="setMaximumFailedPasswordsForWipe"
return="void"
abstract="false"
diff --git a/core/java/android/app/admin/DeviceAdminInfo.java b/core/java/android/app/admin/DeviceAdminInfo.java
index ec4ec89..1c7eb98 100644
--- a/core/java/android/app/admin/DeviceAdminInfo.java
+++ b/core/java/android/app/admin/DeviceAdminInfo.java
@@ -109,6 +109,7 @@
*
* <p>To control this policy, the device admin must have a "set-global-proxy"
* tag in the "uses-policies" section of its meta-data.
+ * @hide
*/
public static final int USES_POLICY_SETS_GLOBAL_PROXY = 5;
@@ -363,7 +364,7 @@
* the given policy control. The possible policy identifier inputs are:
* {@link #USES_POLICY_LIMIT_PASSWORD}, {@link #USES_POLICY_WATCH_LOGIN},
* {@link #USES_POLICY_RESET_PASSWORD}, {@link #USES_POLICY_FORCE_LOCK},
- * {@link #USES_POLICY_WIPE_DATA}, {@link #USES_POLICY_SETS_GLOBAL_PROXY},
+ * {@link #USES_POLICY_WIPE_DATA},
* {@link #USES_POLICY_EXPIRE_PASSWORD}, {@link #USES_ENCRYPTED_STORAGE}.
*/
public boolean usesPolicy(int policyIdent) {
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 3f3aa74..d71a7a3 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1028,6 +1028,7 @@
* @param exclusionList a list of domains to be excluded from the global proxy.
* @return returns null if the proxy was successfully set, or a {@link ComponentName}
* of the device admin that sets thew proxy otherwise.
+ * @hide
*/
public ComponentName setGlobalProxy(ComponentName admin, Proxy proxySpec,
List<String> exclusionList ) {
@@ -1080,6 +1081,7 @@
* Returns the component name setting the global proxy.
* @return ComponentName object of the device admin that set the global proxy, or
* null if no admin has set the proxy.
+ * @hide
*/
public ComponentName getGlobalProxyAdmin() {
if (mService != null) {
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index d028015..c0c96cc 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -70,7 +70,7 @@
</a> <span class="new">new!</span></li>
<li><a href="<?cs var:toroot ?>guide/topics/fundamentals/tasks-and-back-stack.html">
<span class="en">Tasks and Back Stack</span>
- </a></li>
+ </a> <span class="new">new!</span></li>
</ul>
</li>
<li class="toggle-list">
diff --git a/docs/html/guide/topics/graphics/renderscript.jd b/docs/html/guide/topics/graphics/renderscript.jd
index 54737ad..0e64c78 100644
--- a/docs/html/guide/topics/graphics/renderscript.jd
+++ b/docs/html/guide/topics/graphics/renderscript.jd
@@ -16,7 +16,7 @@
<ol>
<li><a href="#native-api">Native Renderscript APIs</a></li>
- <li><a href="#reflective-api">Reflective layer APIs</a></li>
+ <li><a href="#reflective-api">Reflected layer APIs</a></li>
<li><a href="#graphics-api">Graphics APIs</a></li>
</ol>
@@ -30,10 +30,18 @@
</ol>
</li>
</ol>
+ <h2>Related Samples</h2>
+ <ol>
+ <li><a href="{@docRoot}resources/samples/Renderscript/Balls/index.html">Balls</a></li>
+ <li><a href="{@docRoot}resources/samples/Renderscript/Fountain/index.html">Fountain</a></li>
+ <li><a href="{@docRoot}resources/samples/Renderscript/HelloCompute/index.html">Hello Compute</a></li>
+ <li><a href="{@docRoot}resources/samples/Renderscript/HelloWorld/index.html">Hello World</a></li>
+ <li><a href="{@docRoot}resources/samples/Renderscript/Samples/index.html">Samples</a></li>
+ </ol>
</div>
</div>
- <p>The Renderscript system offers high performance 3D rendering and mathematical computations at
+ <p>The Renderscript system offers high performance 3D rendering and mathematical computation at
the native level. The Renderscript APIs are intended for developers who are comfortable with
developing in C (C99 standard) and want to maximize performance in their applications. The
Renderscript system improves performance by running as native code on the device, but it also
@@ -46,47 +54,46 @@
intermediate code.</p>
<p>The disadvantage of the Renderscript system is that it adds complexity to the development and
- debugging processes and is not a substitute for the Android system APIs. It is a portable native
- language with pointers and explicit resource management. The target use is for performance
- critical code where the existing Android APIs are not sufficient. If what you are rendering or
- computing is very simple and does not require much processing power, you should still use the
- Android APIs for ease of development. Debugging visibility can be limited, because the
+ debugging processes. Debugging visibility can be limited, because the
Renderscript system can execute on processors other than the main CPU (such as the GPU), so if
- this occurs, debugging becomes more difficult. Remember the tradeoffs between development and
- debugging complexity versus performance when deciding to use Renderscript.</p>
+ this occurs, debugging becomes more difficult. The target use is for performance
+ critical code where the traditional framework APIs (such as using {@link android.opengl}) are not sufficient.
+ If what you are rendering or computing is very simple and does not require much processing power, you should still use the
+ traditional framework APIs for ease of development. Remember the tradeoffs between development and
+ debugging complexity versus performance when deciding to use Renderscript. </p>
<p>For an example of Renderscript in action, see the 3D carousel view in the Android 3.0 versions
of Google Books and YouTube or install the Renderscript sample applications that are shipped with
- the SDK in <code><sdk_root>/platforms/android-3.0/samples</code>.</p>
+ the SDK in <code><sdk_root>/samples/android-11/Renderscript</code>.</p>
<h2 id="overview">Renderscript System Overview</h2>
<p>The Renderscript system adopts a control and slave architecture where the low-level native
code is controlled by the higher level Android system that runs in the virtual machine (VM). When
- you use the Renderscript system, there are three layers of APIs that exist:</p>
+ you use the Renderscript system, there are three layers that exist:</p>
<ul>
- <li>The native Renderscript layer consists of the native Renderscript <code>.rs</code> files
- that you write to compute mathematical operations, render graphics, or both. This layer does
- the intensive computation or graphics rendering and returns the result back to the Android VM
- through the reflected layer.</li>
+ <li>The native Renderscript layer consists of native libraries that are packaged with the SDK.
+ The native Renderscript <code>.rs</code> files compute mathematical operations, render graphics,
+ or both. This layer does the intensive computation or graphics rendering and returns the result
+ back to the Android VM through the reflected layer.</li>
- <li>The reflected layer is a set of generated Android system classes (through reflection) based
- on the native layer interface that you define. This layer acts as a bridge between the native
+ <li>The reflected layer is a set of generated Android framework classes reflected from
+ the native Renderscript code that you wrote. This layer acts as a bridge between the native
Renderscript layer and the Android system layer. The Android build tools automatically generate
- the APIs for this layer during the build process.</li>
+ the classes for this layer during the build process. This layer also includes a set of Android
+ framework APIs that provide the memory and resource allocation classes to support this layer.</li>
- <li>The Android system layer consists of your normal Android APIs along with the Renderscript
+ <li>The Android system layer consists of the traditional framework APIs, which include the Renderscript
APIs in {@link android.renderscript}. This layer handles things such as the Activity lifecycle
- management of your application and calls the native Renderscript layer through the reflected
- layer.</li>
+ management of your application and calls the reflected layer to communicate with the native Renderscript code.</li>
</ul>
<p>To fully understand how the Renderscript system works, you must understand how the reflected
layer is generated and how it interacts with the native Renderscript layer and Android system
layer. The reflected layer provides the entry points into the native code, enabling the Android
- system code to give high level commands like, "rotate the view" or "filter the bitmap." It
- delegates all the heavy lifting to the native layer. To accomplish this, you need to create logic
+ system to give high level commands like, "rotate the view" or "filter the bitmap" to the
+ native layer, which does the heavy lifting. To accomplish this, you need to create logic
to hook together all of these layers so that they can correctly communicate.</p>
<p>At the root of everything is your Renderscript, which is the actual C code that you write and
@@ -94,11 +101,10 @@
and graphics. A compute Renderscript does not do any graphics rendering while a graphics
Renderscript does.</p>
- <p>When you create a Renderscript <code>.rs</code> file, an equivalent, reflective layer class,
- {@link android.renderscript.ScriptC}, is generated by the build tools and exposes the native
- functions to the Android system. This class is named
- <code><em>ScriptC_renderscript_filename</em></code>. The following list describes the major
- components of your native Renderscript code that is reflected:</p>
+ <p>When you create Renderscript <code>.rs</code> files, equivalent, reflected classes
+ are generated by the build tools and expose the native functions and data types and structures
+ to the Android system. The following list describes the major components of your native Renderscript
+ code that is reflected:</p>
<ul>
<li>The non-static functions in your Renderscript (<code>.rs</code> file) are reflected into
@@ -108,12 +114,12 @@
<li>Any non-static, global Renderscript variables are reflected into
<code><em>ScriptC_renderscript_filename</em></code>.
Accessor methods are generated, so the Android system layer can access the values.
- The <code>get()</code> method comes with a one-way communication restriction.
- The Android system layer always caches the last value that is set and returns that during a call to get.
- If the native Renderscript code has changed the value, the change does propagate back to the Android system layer
- for efficiency. If the global variables are initialized in the native Renderscript code, those values are used
- to initialize the Android system versions. If global variables are marked as <code>const</code>,
- then a <code>set()</code> method is not generated.
+ The <code>get</code> method comes with a one-way communication restriction.
+ The Android system layer always caches the last value that is set and returns that during a call to a <code>get<code> method.
+ If the native Renderscript code changes the value, the change does not propagate back to the Android system layer.
+ If the global variables are initialized in the native Renderscript code, those values are used
+ to initialize the corresponding values in the Android system. If global variables are marked as <code>const</code>,
+ then a <code>set</code> method is not generated.
</li>
<li>Structs are reflected into their own classes, one for each struct, into a class named
@@ -128,15 +134,14 @@
Renderscripts should not directly set the exported global pointers.</li>
</ul>
- <p>The Android system also has a corresponding Renderscript context object, {@link
+ <p>The Android framework API also has a corresponding Renderscript context object, {@link
android.renderscript.RenderScript} (for a compute Renderscript) or {@link
android.renderscript.RenderScriptGL} (for a graphics Renderscript). This context object allows
you to bind to the reflected Renderscript class, so that the Renderscript context knows what its
corresponding native Renderscript is. If you have a graphics Renderscript context, you can also
specify a variety of Programs (stages in the graphics pipeline) to tweek how your graphics are
rendered. A graphics Renderscript context also needs a surface to render on, {@link
- android.renderscript.RSSurfaceView}, which gets passed into its constructor. When all three of
- the layers are connected, the Renderscript system can compute or render graphics.</p>
+ android.renderscript.RSSurfaceView}, which gets passed into its constructor.</p>
<h2 id="api">API overview</h2>
@@ -145,15 +150,15 @@
because these functions are assumed to be running on a standard CPU. The Renderscript runtime
chooses the best processor to execute the code, which may not be the CPU, so it cannot guarantee
support for standard C libraries. What Renderscript does offer is an API that supports intensive
- computation with an extensive collection of math APIs. Some key features of the Renderscript APIs
- are:</p>
+ computation with an extensive collection of math APIs. The following sections group the APIs
+ into three distinct categories.</p>
<h3 id="native-api">Native Renderscript APIs</h3>
<p>The Renderscript headers are located in the <code>include</code> and
<code>clang-include</code> directories in the
- <code><sdk_root>/platforms/android-3.0/renderscript</code> directory of the Android SDK.
+ <code><sdk_root>/platforms/android-11/renderscript</code> directory of the Android SDK.
The headers are automatically included for you, except for the graphics specific header,
which you can define as follows:</p>
@@ -170,16 +175,14 @@
<li>Graphics rendering functions</li>
<li>Memory allocation request features</li>
<li>Data types and structures to support the Renderscript system such as
- Vector types for defining two-, three-, or four-vectors.</li></li>
- </ul>
+ Vector types for defining two-, three-, or four-vectors.</li>
</ul>
- <h3 id="reflective-api">Reflective layer APIs</h3>
+ <h3 id="reflective-api">Reflected layer APIs</h3>
- <p>These classes are not generated by the reflection process, and are actually part of the
- Android system APIs, but they are mainly used by the reflective layer classes to handle memory
- allocation and management for your Renderscript. You normally do not need to be call these classes
- directly.</p>
+ <p>These classes are mainly used by the reflected classes that are generated from your native Renderscript
+ code. They allocate and manage memory for your Renderscript on the Android system side.
+ You normally do not need to call these classes directly.</p>
<p>Because of the constraints of the Renderscript native layer, you cannot do any dynamic
memory allocation in your Renderscript <code>.rs</code> file.
@@ -195,7 +198,7 @@
The Android system object, which at this point is just an empty shell, is eventually garbage collected.
</p>
- <p>The following classes are mainly used by the reflective layer classes:</p>
+ <p>The following classes are mainly used by the reflected layer classes:</p>
<table>
<tr>
@@ -214,9 +217,9 @@
<td>
An {@link android.renderscript.Element} is the most basic element of a memory type. An
element represents one cell of a memory allocation. An element can have two forms: Basic or
- Complex. They are typically created from C structures that are used within Renderscript
- code and cannot contain pointers or nested arrays. The other common source of elements is
- bitmap formats.
+ Complex. They are typically created from C structures in your Renderscript
+ code during the reflection process. Elements cannot contain pointers or nested arrays.
+ The other common source of elements is bitmap formats.
<p>A basic element contains a single component of data of any valid Renderscript data type.
Examples of basic element data types include a single float value, a float4 vector, or a
@@ -253,12 +256,11 @@
<td>rs_allocation</td>
<td>
- An {@link android.renderscript.Allocation} provides the memory for applications. An {@link
+ <p>An {@link android.renderscript.Allocation} provides the memory for applications. An {@link
android.renderscript.Allocation} allocates memory based on a description of the memory that
- is represented by a {@link android.renderscript.Type}. The {@link
- android.renderscript.Type} describes an array of {@link android.renderscript.Element}s that
+ is represented by a {@link android.renderscript.Type}. The type describes an array of elements that
represent the memory to be allocated. Allocations are the primary way data moves into and
- out of scripts.
+ out of scripts.</p>
<p>Memory is user-synchronized and it's possible for allocations to exist in multiple
memory spaces concurrently. For example, if you make a call to the graphics card to load a
@@ -270,9 +272,9 @@
<p>Allocation data is uploaded in one of two primary ways: type checked and type unchecked.
For simple arrays there are <code>copyFrom()</code> functions that take an array from the
- Android system code and copy it to the native layer memory store. Both type checked and
+ Android system and copy it to the native layer memory store. Both type checked and
unchecked copies are provided. The unchecked variants allow the Android system to copy over
- arrays of structures because it not support inherently support structures. For example, if
+ arrays of structures because it does not support structures. For example, if
there is an allocation that is an array n floats, you can copy the data contained in a
float[n] array or a byte[n*4] array.</p>
</td>
@@ -331,7 +333,7 @@
state is taken from the bind points as set in the {@link android.renderscript.RenderScriptGL}
bind methods in the control environment (VM environment).</p>
- <p>For example, you can define this at the top of your native Renderscript code:</p>
+ <p>For example, you can define this at the top of your native graphics Renderscript code:</p>
<pre>
#pragma stateVertex(parent)
#pragma stateStore(parent)
@@ -354,9 +356,9 @@
<td>rs_program_vertex</td>
<td>
- The Renderscript vertex program, also known as a vertex shader, describes the stage in the
+ <p>The Renderscript vertex program, also known as a vertex shader, describes the stage in the
graphics pipeline responsible for manipulating geometric data in a user-defined way. The
- object is constructed by providing Renderscript with the following data:
+ object is constructed by providing Renderscript with the following data:</p>
<ul>
<li>An Element describing its varying inputs or attributes</li>
@@ -367,7 +369,9 @@
inputs</li>
</ul>
- <p>Once the program is created, bind it to the graphics context. It is then used for all
+ <p>Once the program is created, bind it to the {@link android.renderscript.RenderScriptGL}
+ graphics context by calling
+ {@link android.renderscript.RenderScriptGL#bindProgramVertex bindProgramVertex()}. It is then used for all
subsequent draw calls until you bind a new program. If the program has constant inputs, the
user needs to bind an allocation containing those inputs. The allocation’s type must match
the one provided during creation. The Renderscript library then does all the necessary
@@ -391,7 +395,7 @@
<td>rs_program_fragment</td>
- <td>The Renderscript fragment program, also known as the fragment shader, is responsible for
+ <td><p>The Renderscript fragment program, also known as the fragment shader, is responsible for
manipulating pixel data in a user-defined way. It’s constructed from a GLSL shader string
containing the program body, textures inputs, and a Type object describing the constants used
by the program. Like the vertex programs, when an allocation with constant input values is
@@ -401,7 +405,7 @@
rsgAllocationSyncAll so it could send the new values to hardware. Communication between the
vertex and fragment programs is handled internally in the GLSL code. For example, if the
fragment program is expecting a varying input called varTex0, the GLSL code inside the
- program vertex must provide it.
+ program vertex must provide it.</p>
<p> To bind shader constructs to the this Program, declare a struct containing the necessary shader constants in your native Renderscript code.
This struct is generated into a reflected class that you can use as a constant input element
during the Program's creation. It is an easy way to create an instance of this struct as an allocation.
@@ -416,7 +420,7 @@
<td>rs_program_store</td>
<td>The Renderscript ProgramStore contains a set of parameters that control how the graphics
- hardware writes to the framebuffer. It could be used to enable/disable depth writes and
+ hardware writes to the framebuffer. It could be used to enable and disable depth writes and
testing, setup various blending modes for effects like transparency and define write masks
for color components.</td>
</tr>
@@ -493,19 +497,19 @@
<ol>
<li>Analyze your application's requirements and figure out what you want to develop with
- Renderscript. To take full advantage of Renderscript, you want to use it when the computation
- or graphics performance you're getting with the normal Android system APIs is
+ Renderscript. To take full advantage of the Renderscript system, you want to use it when the computation
+ or graphics performance you're getting with the traditional framework APIs is
insufficient.</li>
<li>Design the interface of your Renderscript code and implement it using the native
Renderscript APIs that are included in the Android SDK in
- <code><sdk_root>/platforms/android-3.0/renderscript</code>.</li>
+ <code><sdk_root>/platforms/android-11/renderscript</code>.</li>
<li>Create an Android project as you would normally, in Eclipse or with the
<code>android</code> tool.</li>
<li>Place your Renderscript files in <code>src</code> folder of the Android project so that the
- build tools can generate the reflective layer classes.</li>
+ build tools can generate the reflected layer classes.</li>
<li>Create your application, calling the Renderscript through the reflected class layer when
you need to.</li>
@@ -513,16 +517,16 @@
<li>Build, install, and run your application as you would normally.</li>
</ol>
- <p>To see how a simple Renderscript application is put together, see <a href="#hello-world">The
- Hello World Renderscript Graphics Application</a>. The SDK also ships with many Renderscript
- samples in the<code><sdk_root>/samples/android-3.0/</code> directory.</p>
+ <p>To see how a simple Renderscript application is put together, see the
+ <a href="{@docRoot}resources/samples/Renderscript/index.html">Renderscript samples</a>
+ and <a href="#hello-graphics">The Hello Graphics Application</a> section of the documentation.</p>
<h3 id="hello-graphics">The Hello Graphics Application</h3>
<p>This small application demonstrates the structure of a simple Renderscript application. You
can model your Renderscript application after the basic structure of this application. You can
find the complete source in the SDK in the
- <code><android-sdk>/platforms/android-3.0/samples/HelloWorldRS directory</code>. The
+ <code><android-sdk>/samples/android-11/HelloWorldRS directory</code>. The
application uses Renderscript to draw the string, "Hello World!" to the screen and redraws the
text whenever the user touches the screen at the location of the touch. This application is only
a demonstration and you should not use the Renderscript system to do something this trivial. The
@@ -544,7 +548,7 @@
screen.</li>
<li>
- <p>The <code><project_root>/gen</code> directory contains the reflective layer classes
+ <p>The <code><project_root>/gen</code> directory contains the reflected layer classes
that are generated by the Android build tools. You will notice a
<code>ScriptC_helloworld</code> class, which is the reflective version of the Renderscript
and contains the entry points into the <code>helloworld.rs</code> native code. This file does
@@ -552,8 +556,8 @@
</li>
</ul>
- <p>Each file has its own distinct use. The following section demonstrates in detail how the
- sample works:</p>
+ <p>Each file has its own distinct use. The following files comprise the main parts of the sample and
+ demonstrate in detail how the sample works:</p>
<dl>
<dt><code>helloworld.rs</code></dt>
@@ -628,7 +632,7 @@
<dd>This class is generated by the Android build tools and is the reflected version of the
<code>helloworld.rs</code> Renderscript. It provides a a high level entry point into the
<code>helloworld.rs</code> native code by defining the corresponding methods that you can call
- from Android system APIs.</dd>
+ from the traditional framework APIs.</dd>
<dt><code>helloworld.bc</code> bytecode</dt>
diff --git a/docs/html/guide/topics/manifest/uses-library-element.jd b/docs/html/guide/topics/manifest/uses-library-element.jd
index f1b5e70..1d38c1a 100644
--- a/docs/html/guide/topics/manifest/uses-library-element.jd
+++ b/docs/html/guide/topics/manifest/uses-library-element.jd
@@ -3,34 +3,101 @@
<dl class="xml">
<dt>syntax:</dt>
-<dd><pre><uses-library android:<a href="#nm">name</a>="<i>string</i>" /></pre></dd>
-
+<dd>
+<pre class="stx">
+<uses-library android:<a href="#nm">name</a>="<var>string</var>"
+ android:<a href="#rq">required</a>=["true" | "false"] />
+</pre>
+</dd>
<dt>contained in:</dt>
-<dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code></dd>
-
+<dd>
+ <code>
+ <a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a>
+ </code>
+</dd>
<dt>description:</dt>
-<dd>Specifies a shared library that the application must be linked against.
-This element tells the system to include the library's code in the class
-loader for the package.
-
-<p>
-All of the {@code android} packages (such as {@link android.app},
-{@link android.content}, {@link android.view}, and {@link android.widget})
-are in the default library that all applications are automatically linked
-against. However, some packages (such as {@code maps} and {@code awt} are
-in separate libraries that are not automatically linked. Consult the
-documentation for the packages you're using to determine which library
-contains the package code.
-</p></dd>
-
+<dd>
+ Specifies a shared library that the application must be linked against.
+ This element tells the system to include the library's code in the class
+ loader for the package.
+ <p>
+ All of the {@code android} packages (such as {@link android.app},
+ {@link android.content}, {@link android.view}, and {@link android.widget})
+ are in the default library that all applications are automatically linked
+ against. However, some packages (such as {@code maps}) are
+ in separate libraries that are not automatically linked. Consult the
+ documentation for the packages you're using to determine which library
+ contains the package code.
+ </p>
+ <p>
+ This element also affects the installation of the application on a particular device and
+ the availability of the application in Android Market:
+ </p>
+ <dl>
+ <dt><em>Installation</em></dt>
+ <dd>
+ If this element is present and its {@code android:required} attribute is set to
+ {@code true}, the {@link android.content.pm.PackageManager} framework won't let the user
+ install the application unless the library is present on the user's device.
+ </dd>
+ <dt><em>Market</em></dt>
+ <dd>
+ Android Market filters applications based on the libraries installed on the
+ user's device. For more information about filtering, see the topic
+ <a href="{@docRoot}/guide/appendix/market-filters.html">Market Filters</a>.
+ </dd>
+ </dl>
+ <p>
+ The {@code android:required} attribute is described in detail in the following section.
+ </p>
+</dd>
<dt>attributes:</dt>
-<dd><dl class="attr">
-<dt><a name="nm"></a>{@code android:name}</dt>
-<dd>The name of the library.</dd>
-</dl></dd>
-
+<dd>
+ <dl class="attr">
+ <dt><a name="nm"></a>{@code android:name}</dt>
+ <dd>
+ The name of the library. The name is provided by the
+ documentation for the package you are using. An example of this is
+ "<code>android.test.runner</code>", a package that contains Android test
+ classes.
+ </dd>
+ <dt><a name="rq"></a>{@code android:required}</dt>
+ <dd>
+ Boolean value that indicates whether the application requires the
+ library specified by {@code android:name}:
+ <ul>
+ <li>
+ <code>"true"</code>: The application does not function without this
+ library. The system will not allow the application on a device that does not
+ have the library.
+ </li>
+ <li>
+ <code>"false"</code>: The application can use the
+ library if present, but is designed to function without it if necessary.
+ The system will allow the application to be installed, even if the library is
+ not present. If you use <code>"false"</code>, you are responsible for
+ checking at runtime that the library is available.
+ <p>
+ To check for a library, you can use reflection to determine
+ if a particular class is available.
+ </p>
+ </li>
+ </ul>
+ <p>
+ The default is <code>"true"</code>.
+ </p>
+ <p>Introduced in: API Level 7.</p>
+ </dd>
+ </dl>
+</dd>
<!-- ##api level indication## -->
<dt>introduced in:</dt>
<dd>API Level 1</dd>
-</dl>
+<dt>see also:</dt>
+<dd>
+ <ul>
+ <li>{@link android.content.pm.PackageManager}</li>
+ </ul>
+</dd>
+</dl>
\ No newline at end of file
diff --git a/docs/html/index.jd b/docs/html/index.jd
index 909dd32..2248752 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -129,14 +129,14 @@
'sdk': {
'layout':"imgLeft",
'icon':"sdk-small.png",
- 'name':"Android 2.3",
- 'img':"gingerdroid.png",
- 'title':"Android 2.3 is here!",
- 'desc': "<p>Android 2.3 is now available for the Android SDK. In addition, new "
-+ "tools and documentation are available, plus a new NDK that offers more than ever. "
-+ "For more information about what's in Android 2.3, read the "
-+ "<a href='{@docRoot}sdk/android-2.3.html'>version notes</a>.</p>"
-+ "<p>If you have an existing SDK, add Android 2.3 as an "
+ 'name':"Android 3.0",
+ 'img':"honeycomb-android.png",
+ 'title':"Android 3.0 is here!",
+ 'desc': "<p>Android 3.0 is now available for the Android SDK. It offers a redesigned UI and "
++ "all new developer APIs for an optimized experience on tablets and similar devices. "
++ "For more information about what's in Android 3.0, read the "
++ "<a href='{@docRoot}sdk/android-3.0.html'>version notes</a>.</p>"
++ "<p>If you have an existing SDK, add Android 3.0 as an "
+ "<a href='{@docRoot}sdk/adding-components.html'>SDK "
+ "component</a>. If you're new to Android, install the "
+ "<a href='{@docRoot}sdk/index.html'>SDK starter package</a>."
diff --git a/docs/html/resources/resources-data.js b/docs/html/resources/resources-data.js
index 5839064..b80e59a 100644
--- a/docs/html/resources/resources-data.js
+++ b/docs/html/resources/resources-data.js
@@ -496,6 +496,16 @@
}
},
{
+ tags: ['sample', 'new'],
+ path: 'samples/Renderscript/index.html',
+ title: {
+ en: 'Renderscript'
+ },
+ description: {
+ en: 'A set of samples that demonstrate how to use various features of the Renderscript APIs.'
+ }
+ },
+ {
tags: ['sample', 'accountsync'],
path: 'samples/SampleSyncAdapter/index.html',
title: {
diff --git a/docs/html/sdk/android-3.0-optimize.jd b/docs/html/sdk/android-3.0-optimize.jd
new file mode 100644
index 0000000..a22e69a
--- /dev/null
+++ b/docs/html/sdk/android-3.0-optimize.jd
@@ -0,0 +1,397 @@
+page.title=Optimizing Apps for Android 3.0
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+<h2>In this document</h2>
+<ol>
+<li><a href="#Setup">Set Up Your SDK with Android 3.0</a></li>
+<li><a href="#SearchableConfiguration">Optimize Your App for Tablets and Similar Devices</a></li>
+<li><a href="#SearchableActivity">Upgrade or Develop a New App for Tablets and Similar
+Devices</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>If you're developing an Android application, Android 3.0 introduces several features that allow
+you to enhance your user's experience on tablets and similar devices. Any application you've already
+published is compatible with devices running Android 3.0, by default, because Android applications
+are forward-compatible. However, there are some simple changes you should make to optimize your
+application for tablet-type devices.</p>
+
+<p>This document shows how you can optimize your existing application for Android 3.0 and
+maintain compatibility with older versions or upgrade your application completely with new APIs.</p>
+
+
+<p><b>To get started:</b></p>
+
+<ol>
+ <li><a href="#Setup">Set up your SDK with Android 3.0</a>.</li>
+ <li>Then choose to either optimize or upgrade:
+ <ol type="a">
+ <li><a href="#Optimize">Optimize Your App for Tablets and Similar Devices</a>.
+ <p>When you have an existing application and want to maintain compatibility with
+older versions of Android.</p>
+ </li>
+ <li><a href="#Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</a>.
+ <p>When you want to upgrade your application to use APIs introduced in Android 3.0 or
+ create a new application targeted to tablets and similar devices.</p></li>
+ </ol>
+ </li>
+</ol>
+
+
+<h2 id="Setup">Set Up Your SDK with Android 3.0</h2>
+
+<p>To start testing and developing your application on Android 3.0, set up your existing Android
+SDK with the new platform:</p>
+
+<p>(If you don't have an existing Android SDK, <a href="{@docRoot}sdk/index.html">download the
+SDK starter package now</a>.)</p>
+
+<ol>
+ <li><a href="{@docRoot}sdk/adding-components.html#launching">Launch the Android SDK and AVD
+Manager</a> and install the following:
+ <ul>
+ <li>SDK Platform Android 3.0</li>
+ <li>Android SDK Tools, revision 10</li>
+ <li>Android SDK Platform-tools, revision 3</li>
+ <li>Documentation for Android SDK, API 11</li>
+ <li>Samples for SDK API 11</li>
+ </ul>
+ </li>
+ <li><a href="{@docRoot}guide/developing/other-ide.html#AVD">Create an AVD</a> for a tablet-type
+device:
+ <p>Set the target to "Android 3.0" and the skin to "WXGA" (the default skin).</p></li>
+</ol>
+
+
+<h3>About emulator performance</h3>
+
+<p>Because the Android emulator must simulate the ARM instruction set on your computer
+and the WXGA screen is significantly larger than a typical virtual device, emulator performance is
+much slower than a real device.</p>
+
+<p>In particular, initializing the emulator can be slow and can take several minutes, depending on
+your hardware. When the emulator is booting, there is limited user feedback, so please be patient
+and wait until you see the home screen (or lock screen) appear. </p>
+
+<p>However, you don't need to boot the emulator each time you rebuild your
+application—typically you only need to boot at the start of a session and keep it running.
+Also see the tip below for information about using a snapshot to drastically reduce startup time
+after the first initialization. </p>
+
+<p>We're working hard to resolve the performance issues and it will improve in future tools
+releases. For the time being, the emulator is still best way to evaluate your application's
+appearance and functionality on Android 3.0 without a real device.</p>
+
+<p class="note"><strong>Tip:</strong> To improve the startup time for the emulator, enable snapshots
+for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in the AVD creator
+to <strong>Enable</strong> snapshots). Then, start the AVD from the AVD manager and check <b>Launch
+from snapshot</b> and <b>Save to snapshot</b>. This way, when you close the emulator, a snapshot of
+the AVD state is saved and used to quickly relaunch the AVD next time. However, when you choose to
+save a snapshot, the emulator will be slow to close, so you might want to disable <b>Save to
+snapshot</b> after you've acquired an initial snapshot (after you close the AVD for the first
+time).</p>
+
+
+
+<h2 id="Optimize">Optimize Your Application for Tablets and Similar Devices</h2>
+
+<p>If you've already developed an application for an earlier version of Android, there are a few
+things you can do to optimize it for a tablet-style experience on Android 3.0 without changing the
+minimum version required (you don't need to change your manifest's <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a>).</p>
+
+<p class="note"><strong>Note:</strong> All Android applications are forward-compatible, so
+there's nothing you <em>have to</em> do—if your application is a good citizen of the Android
+APIs, your app should work fine on devices running Android 3.0. However, in order to provide users
+a better experience when using your app on an Android 3.0 tablet or similar-size device, you
+should update your application to inherit the new system theme and provide some optimizations for
+larger screens.</p>
+
+<p>Here are a few things you can do to optimize your application for devices running Android
+3.0:</p>
+
+<ol>
+ <li><b>Test your current application on Android 3.0</b>
+ <ol>
+ <li>Build your application as-is and install it on your Android 3.0 AVD (created above during
+<a href="#Setup">setup</a>).</li>
+ <li>Perform your usual tests to be sure everything works and looks as expected.</li>
+ </ol>
+ </li>
+
+ <li><b>Apply the new "holographic" theme to your application</b>
+ <ol>
+ <li>Open your manifest file and update the <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element to
+set <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "11"}. For example:
+<pre>
+<manifest ... >
+ <uses-sdk android:minSdkVersion="4"
+ android:targetSdkVersion="11" />
+ <application ... >
+ ...
+ <application>
+</manifest>
+</pre>
+ <p>By targeting the Android 3.0 platform, the system automatically applies the holographic theme
+to each activity when your application runs on an Android 3.0 device. The holographic theme
+provides a new design for widgets, such as buttons and text boxes, and restyles other
+visual elements. This is the standard theme in applications built for Android 3.0, so your
+application will look more at home by enabling the theme.</p>
+ <p>Additionally, the holographic theme enables the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> in your activities when running on an
+Android 3.0 device. The Action Bar replaces the traditional title bar at the top of the activity
+window and provides the user access to the activity's Options Menu.</p>
+ </li>
+ <li>Continue to build your application against the minimum version specified by <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>,
+but install it on the Android 3.0 AVD. Repeat your tests to be sure that your user interface works
+well with the holographic theme.
+ <p class="note"><strong>Note:</strong> If you have applied other themes directly to your
+activities, they will override the inherited holographic theme. To resolve this, you can use
+the <a href="{@docRoot}guide/topics/resources/providing-resources.html#VersionQualifier">system
+version qualifier</a> to provide an alternative theme for Android 3.0 devices that's based on the
+holographic theme. For more information, read how to <a
+href="{@docRoot}guide/topics/ui/themes.html#SelectATheme">select a theme based on platform
+version</a>.</p>
+ </ol>
+ </li>
+
+ <li><b>Supply alternative layout resources for xlarge screens</b>
+ <p>By providing <a
+href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
+resources</a> when running on extra large screens (using the <code>xlarge</code> resource
+qualifier), you can improve the user experience of your application on tablet-type devices without
+using new APIs.</p>
+ <p>For example, here are some things to consider when creating a new layout for extra large
+screens:</p>
+ <ul>
+ <li>Landscape layout: The "normal" orientation for tablet-type devices is usually landscape
+(wide), so you should be sure that your activities offer a layout that's optimized for a wide
+viewing area. <p>You can specify landscape resources with the <code>land</code> resource
+qualifier, but if you want alternative resources for an extra large landscape screen, you
+should use both <code>xlarge</code> and <code>land</code> qualifiers. For example, {@code
+res/layout-xlarge-land/}. The order of the qualifier names is important; see <a
+href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">
+Providing Alternative Resources</a> for more information.</p></li>
+ <li>Button position: Consider whether the position of the most common buttons in your UI are
+easily accessible while holding a tablet with two hands.</li>
+ <li>Font sizes: Be sure your application uses {@code sp} units when setting font
+sizes. This alone should ensure a readable experience on tablet-style devices. In some cases,
+however, you might want to consider larger font sizes for <code>xlarge</code> configurations.</li>
+ </ul>
+ <p>In general, always be sure that your application follows the <a
+href="{@docRoot}guide/practices/screens_support.html#screen-independence">Best Practices
+for Screen Independence</a>.</p>
+ </li>
+</ol>
+
+
+
+
+
+<h2 id="Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</h2>
+
+<p>If you want to develop an application that's fully enhanced for tablet-type devices running
+Android 3.0, then you need to use new APIs in Android 3.0. This section introduces some of
+the new features you should use.</p>
+
+
+<h3>Declare the minimum system version</h3>
+
+<p>The first thing to do when you create a project for Android 3.0 is set your manifest's <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
+to {@code "11"}. For example:</p>
+
+<pre>
+<manifest ... >
+ <uses-sdk android:minSdkVersion="11" />
+ <application ... >
+ ...
+ <application>
+</manifest>
+</pre>
+
+<p>By targeting the Android 3.0 platform, the system automatically applies the new holographic theme
+to each of your activities.</p>
+
+<p>Additionally, the holographic theme enables the Action Bar for each activity.</p>
+
+
+<h3>Use the Action Bar</h3>
+
+<p>The Action Bar is a widget for activities that replaces the traditional title bar at the top of
+the screen. By default, the Action Bar includes the application logo on the left side, followed by
+the activity title, and any available items from the Options Menu on the right side.</p>
+
+<p>You can enable items from your activity's Options Menu to appear directly in the Action Bar as
+"action items" by adding {@code showAsAction="ifRoom"} to specific items in your <a
+href="{@docRoot}guide/topics/resources/menu-resource.html">menu resource</a>. You can also add
+navigation features to the Action Bar, such as tabs, and use the application icon to navigate to
+your application's "home" activity or "up" the activity hierarchy.</p>
+
+<p>For more information, read <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the
+Action Bar</a>.</p>
+
+
+
+<h3>Divide your activities into fragments</h3>
+
+<p>A fragment represents a behavior or a portion of user interface in an activity. You can combine
+multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple
+activities. You can think of a fragment as a modular section of an activity, which has its own
+lifecycle, receives its own input events, and which you can add or remove while the activity is
+running.</p>
+
+<p>For example, a news application can use one fragment to show a list of articles on the left and
+another fragment to display an article on the right—both fragments appear in one activity,
+side by side, and each fragment has its own set of lifecycle callback methods and handles its own
+input events. Thus, instead of using one activity to select an article and another activity to
+read the article, the user can select an article and read it all within the same activity.</p>
+
+<p>For more information, read the <a
+href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> document.</p>
+
+
+<h3>Use new animation APIs for transitions</h3>
+
+<p>An all new flexible animation framework allows you to animate arbitrary properties of any object
+(View, Drawable, Fragment, Object, or anything else). You can define several animation aspects
+(such as duration, repeat, interpolation, and more) for an object's int, float, and hexadecimal
+color values, by default. That is, when an object has a property field for one of these types, you
+can change its value over time to affect an animation.</p>
+
+<p>The {@link android.view.View} class also provides new APIs that leverage the new animation
+framework, allowing you to easily apply 2D and 3D transformations to views in your activity layout.
+New transformations are made possible with a set of object properties that define the view's layout
+position, orientation, transparency and more.</p>
+
+<p>For more information, read the <a
+href="{@docRoot}guide/topics/graphics/animation.html">Property Animation</a> document.</p>
+
+
+<h3>Enable hardware acceleration</h3>
+
+<p>You can now enable the OpenGL renderer for your application by setting {@code
+android:hardwareAccelerated="true"} in your manifest's <a
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
+element or for individual <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
+<activity>}</a> elements. Hardware acceleration results in smoother animations, smoother
+scrolling, and overall better performance and response to user interaction. When enabled, be sure
+that you thoroughly test your application on a device that supports hardware acceleration.</p>
+
+
+<h3>Enhance your app widgets</h3>
+
+<p>App widgets allow users to access information from your application directly from the Home
+screen and interact with ongoing services (such as preview their email and control music playback).
+Android 3.0 enhances these capabilities by enabling collections, created with widgets such as
+{@link android.widget.ListView}, {@link android.widget.GridView}, and the new {@link
+android.widget.StackView}. These widgets allow you to create more interactive app
+widgets, such as one with a scrolling list, and can automatically update their data through a {@link
+android.widget.RemoteViewsService}.</p>
+
+<p>Additionally, you should create a preview image of your app widget using the Widget Preview
+application (pre-installed in an Android 3.0 AVD) and reference it with the {@link
+android.appwidget.AppWidgetProviderInfo#previewImage android:previewImage} attribute, so that users
+can see what the app widget looks like before adding it to their Home screen.</p>
+
+
+<h3>Add other new features</h3>
+
+<p>Android 3.0 introduces many more APIs that you might find valuable for your
+application, such as drag and drop APIs, new Bluetooth APIs, a system-wide clipboard framework, a
+new graphics engine called Renderscript, and more.</p>
+
+<p>To learn more about the APIs mentioned above and more, see the <a
+href="{@docRoot}sdk/android-3.0.html">Android 3.0 Platform</a> document.</p>
+
+
+<h3>Publish your app for extra large screens</h3>
+
+<p>You should also decide whether your application is <em>only</em> for
+tablet-type devices (specifically, <em>xlarge</em> devices) or for all types of screen sizes.</p>
+
+<p>If you want your application to be available to all screen sizes (for example, for all
+phones and tablets), there's nothing you need to do. By default, an application with <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> set to {@code "4"} or higher will resize to fit any screen size.</p>
+
+<p>If your application is <em>only</em> for <em>xlarge</em> screens, include the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+<supports-screens>}</a> element in your manifest and declare that the application supports
+only <em>xlarge</em> screens, by declaring all other sizes {@code "false"}. For example:</p>
+
+<pre>
+<manifest ... >
+ ...
+ <supports-screens android:smallScreens="false"
+ android:normalScreens="false"
+ android:largeScreens="false"
+ android:xlargeScreens="true" />
+ <application ... >
+ ...
+ <application>
+</manifest>
+</pre>
+
+<p>With this declaration, you indicate that your application does not support any screen size except
+extra large. External services such as Android Market may then use this information to filter your
+application from devices that do not have an extra large screen.</p>
+
+
+
+<h3>Look at some samples</h3>
+
+<p>Many of the new features and APIs that are described in the <a
+href="{@docRoot}sdk/android-3.0.html#api">Android 3.0 Platform Preview</a> also have accompanying
+samples that can help you understand how to use them. To get the samples, download them from the SDK
+repository using the Android SDK Manager. After downloading the samples ("Samples for SDK API 11"),
+you can find them in <code><sdk_root>/samples/android-11/</code>. The links below can help you
+find samples for the features you are interested in:</p>
+
+<ul>
+ <li><a href="{@docRoot}resources/samples/HoneycombGallery/index.html">Honeycomb Gallery</a>:
+Demonstrates many new APIs in Android 3.0, including fragments, the action bar, drag and drop, and
+animations.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">
+Fragments</a>: Various samples that demonstrate fragment layouts, back stack, restoring state, and
+more.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarMechanics.html"
+>Action Bar</a>: Samples that demonstrate various Action Bar features, such as tabs, logos, and
+action items.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.
+html">Clipboard</a>: An example of how to use the clipboard for copy and paste operations.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/DragAndDropDemo.html">
+Drag and Drop</a>: An example of how to perform drag and drop with new View events.</li>
+ <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/List15.html">
+Multi-choice List</a>: An example of how to provide multiple-choice selection for ListView and
+GridView.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html">
+Content Loaders</a>: An example using new Loader APIs to asynchronously load data.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">
+Property Animation</a>: Several samples using the new animation APIs to animate object
+properties.</li>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.
+html">Search View Widget</a>: Example using the new search widget in the Action Bar (as an
+"action view").</li>
+ <li><a
+href="{@docRoot}resources/samples/Renderscript/index.html">Renderscript</a>: Contains several
+different applications that demonstrate using renderscript APIs for computations and 3D
+graphics.</li>
+</ul>
+
diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd
index 8088e32..6c88146 100644
--- a/docs/html/sdk/android-3.0.jd
+++ b/docs/html/sdk/android-3.0.jd
@@ -25,7 +25,7 @@
<h2>See Also</h2>
<ol>
- <li><a href="{@docRoot}sdk/preview/start.html">Getting Started</a></li>
+ <li><a href="{@docRoot}sdk/android-3.0-optimize.html">Optimizing Apps for Android 3.0</a></li>
</ol>
</div>
@@ -48,6 +48,10 @@
href="{@docRoot}sdk/android-{@sdkPlatformVersion}-highlights.html">Platform
Highlights</a>.</p>
+<p>Also see the <a href="{@docRoot}sdk/android-3.0-optimize.html">Optimizing Apps for Android
+3.0</a> document for information about how to optimize your existing applications for Android 3.0
+devices, even if you want to remain compatible with previous versions.</p>
+
<h2 id="relnotes">Revisions</h2>
diff --git a/docs/html/sdk/preview/start.jd b/docs/html/sdk/preview/start.jd
deleted file mode 100644
index d6e442e..0000000
--- a/docs/html/sdk/preview/start.jd
+++ /dev/null
@@ -1,294 +0,0 @@
-page.title=Getting Started with the Android 3.0 Preview
-@jd:body
-
-<p>Welcome to Android 3.0!</p>
-
-<p>Android 3.0 is the next major release of the Android platform and is optimized for larger screen
-devices, particularly tablets. We're offering a preview SDK so you can get a head-start developing
-applications for it or simply test and optimize your existing application for upcoming devices.</p>
-
-<p><strong>Be aware that:</strong></p>
-<ul>
- <li>The APIs in the preview SDK are <strong>not final</strong>. Some APIs may change in behavior
-or availability when the final SDK is made available.</li>
- <li>You <strong>cannot</strong> publish an application that's built against the preview
-SDK—you can only run an application built against the preview SDK on the Android
-emulator.</li>
- <li>The documentation on <a href="http://developer.android.com">developer.android.com</a>
-does <strong>not</strong> include the Android 3.0 documentation—to read the API reference and
-developer guides for Android 3.0, you must install the Android 3.0 preview documentation from
-the AVD and SDK Manager.</li>
-</ul>
-
-
-
-<h3>How do I start?</h3>
-
-<ol>
- <li><a href="#Setup">Set up the preview SDK</a></li>
- <li>Then choose your app adventure:
- <ol type="a">
- <li><a href="#Optimize">Optimize Your App for Tablets and Similar Devices</a>
- <p>When you have an existing application and you want to maintain compatibility with
-older versions of Android.</p>
- </li>
- <li><a href="#Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</a>
- <p>When you want to upgrade your application to use APIs introduced in Android 3.0 or
- create a new application targeted to tablets and similar devices.</p></li>
- </ol>
- </li>
-</ol>
-
-<h3>Code samples</h3>
-<p>Many of the new features and APIs that are described in the <a href="{@docRoot}sdk/android-3.0.html#api">
-Android 3.0 Platform Preview</a> also have accompanying samples that help you understand how to use them.
-To get the samples, download them from the SDK repository using the Android SDK Manager. After download
-the samples are located in <code><sdk_root>/samples/android-Honeycomb</code>. The list of links
-below helps you find samples for the features you are interested in:</p>
-<ul>
- <li><a href="{@docRoot}resources/samples/HoneycombGallery/index.html">Honeycomb Gallery</a> -
- A demo application highlighting how to use some of the new APIs in Honeycomb, including fragments, the action bar,
- drag and drop, transition animations, and a stack widget.</li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">Fragments</a>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarMechanics.html">Action Bar</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.html">Clipboard</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/DragAndDropDemo.html">Drag and Drop</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/List15.html">
- Multiple-choice selection for ListView and GridView</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html">Content Loaders</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">Property Animation</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.html">Search View Widget</a></li>
- <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/PopupMenu1.html">Popup Menu Widget</a></li>
-</ul>
-
-
-<h2 id="Setup">Set Up the Preview SDK</h2>
-
-<p>To start using the Android 3.0 preview SDK, set up your existing Android SDK with the new
-platform:</p>
-<p>(If you don't have an existing SDK, <a href="{@docRoot}sdk/index.html">download it
-now</a>.)</p>
-<ol>
- <li><a href="{@docRoot}sdk/adding-components.html#launching">Launch the Android SDK and AVD
-Manager</a> and install the following:
- <ul>
- <li>SDK Platform Android 3.0 Preview</li>
- <li>Android SDK Tools, revision 9</li>
- <li>Documentation for Android 'Honeycomb' Preview</li>
- <li>Samples for SDK API Honeycomb Preview</li>
- </ul>
- </li>
- <li><a href="{@docRoot}guide/developing/other-ide.html#AVD">Create an AVD</a> for tablets: set
-the target to "Android 3.0 (Preview)" and the skin to "WXGA".</li>
-</ol>
-
-
-<h3>About emulator performance</h3>
-
-<p>Because the Android emulator must simulate the ARM instruction set architecture on your
-computer and the WXGA screen is significantly larger than what the emulator
-normally handles, emulator performance is much slower than usual.</p>
-
-<p>In particular, initializing the emulator can be slow and can take several
-minutes, depending on your hardware. When the emulator is booting there is
-limited user feedback, so please be patient and continue waiting until you see
-the home screen appear. </p>
-
-<p>Note that you do not need to do a full boot of your emulator each time you
-rebuild your application — typically you only need to boot at the start of
-a session. See the Tips section below for information about using Snapshots to
-cut startup time after first initialization. </p>
-
-<p>We're working hard to resolve the performance issues and it will improve in future releases.
-Unfortunately, the emulator will perform slowly during your trial with the preview SDK. For the time
-being, the emulator is still best way to evaluate your application's appearance and functionality on
-Android 3.0.</p>
-
-<p class="note"><strong>Tip:</strong> To improve the startup time for the emulator, enable
-snapshots for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in
-the GUI). Then, start the AVD from the manager and check <b>Launch from snapshot</b> and <b>Save to
-snapshot</b>. This way, when you close the emulator, a snapshot of the AVD state is saved and
-used to quickly relaunch the AVD next time. However, when you choose to save a snapshot, the
-emulator will be slow to close, so you might want to enable <b>Save to
-snapshot</b> only for the first time you launch the AVD.</p>
-
-
-<h3>Known issues</h3>
-
-<p>The following known issues occur for Android 3.0 AVDs that are loaded in the emulator:</p>
- <ul>
- <li>You cannot take screenshots of an emulator screen. The Device Screen
- Capture window displays <strong>Screen not available</strong>.</li>
- <li>The emulator cannot receive incoming SMS messages.</li>
- <li>GPS emulation is currently not supported.</li>
- <li>When rotating the emulator screen by pressing Ctrl-F11, the screen turns green momentarily,
-then displays the normal interface.</li>
- <li>In some circumstances, the emulator displays a rotated portrait screen while in landscape
-mode. To view the screen correctly, rotate the emulator to portrait mode by pressing Ctrl-F11 or
-turn off the auto-rotate setting in <strong>Settings > Screen > Auto-rotate screen</strong>.</li>
- <li>The Dev Tools application sometimes crashes when trying to use the Package Browser
-feature.</li>
- <li>On Ubuntu 10.04 64-bit machines, you cannot create an AVD that has an SD card.</li>
- </ul>
-
-
-
-<h2 id="Optimize">Optimize Your Application for Tablets and Similar Devices</h2>
-
-<p>If you've already developed an application for Android, there are a few things you can do
-to optimize it for a tablet-style experience, without changing the minimum platform version required
-(you don't need to change the manifest {@code minSdkVersion}).</p>
-
-<p class="note"><strong>Note:</strong> All Android applications are forward-compatible, so
-there's nothing you <em>have to</em> do—if your application is a good citizen of the Android
-APIs, your app should work fine on devices running Android 3.0. However, in order to provide users
-a better experience when running your app on an Android 3.0 tablet or similar-size device, we
-recommend that you update your application to adapt to the new system theme and optimize your
-application for larger screens.</p>
-
-<p>Here's what you can do to optimize your application for tablets running Android
-3.0:</p>
-
-<ol>
- <li><b>Test your current application on Android 3.0</b>
- <ol>
- <li>Build your application as-is and install it on your WXGA AVD (created above).</li>
- <li>Perform your usual tests to be sure everything works and looks as expected.</li>
- </ol>
- </li>
-
- <li><b>Apply the new "holographic" theme to your application</b>
- <ol>
- <li>Open your manifest file and update the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element to
-set {@code android:targetSdkVersion} to {@code "Honeycomb"}. For example:
-<pre>
-<manifest ... >
- <uses-sdk android:minSdkVersion="4"
- android:targetSdkVersion="Honeycomb" />
- <application ... >
- ...
- <application>
-</manifest>
-</pre>
- <p class="note"><strong>Note:</strong> The API Level value "Honeycomb" is a provisional API
-Level that is valid only while testing against the preview SDK. You
-<strong>should not</strong> publish your application using this API Level. When the final version of
-the Android 3.0 SDK is made available, you must change this value to the real API Level that will be
-specified for Android 3.0. For more information, read about <a
-href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.</p>
- <p>By targeting the Android 3.0 platform, the system automatically applies the Holographic theme
-to each of your activities, when running on an Android 3.0 device.</p>
- </li>
- <li>Continue to build against your application's {@code minSdkVersion}, but install it
-on the Android 3.0 AVD. Perform more testing on your application to be sure that your user interface
-works well with the Holographic theme.
- <p class="note"><strong>Note:</strong> If you've applied themes to your activities already,
-they will override the Holographic theme that the system applies when you set the {@code
-android:targetSdkVersion} to {@code "Honeycomb"}.
-Once the Android 3.0 APIs are finalized and an official API Level is assigned, you can use
-the <a href="{@docRoot}guide/topics/resources/providing-resources.html#VersionQualifier">system
-version qualifier</a> to provide an alternative theme that's based on the Holographic theme when
-your application is running on Android 3.0.</p>
- </ol>
- </li>
-
- <li><b>Supply alternative layout resources for xlarge screens</b>
- <p>As discussed in the guide to <a
-href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>, Android
-2.3 and above support the <code>xlarge</code> resource qualifier, which you should use to supply
-alternative layouts for extra large screens.</p>
- <p>By providing alternative layouts for some of your activities when running on extra large
-screens, you can improve the user experience of your application on a tablet without using any
-new APIs.</p>
- <p>For example, here are some things to consider when creating a new layout for tables:</p>
- <ul>
- <li>Landscape layout: The "normal" orientation for tablets is usually landscape (wide), so
-you should be sure that your activities offer an appropriate layout for such a wide viewing
-area.</li>
- <li>Button position: Consider whether the position of the most common buttons in your UI are
-easily accessible while holding a tablet with two hands.</li>
- </ul>
- </li>
-</ol>
-
- <p>In general, always be sure that your application follows the <a
-href="{@docRoot}guide/practices/screens_support.html#screen-independence">Best Practices
-for Screen Independence</a>.</p>
-
-
-<h2 id="Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</h2>
-
-<p>If you want to develop something truly for tablet-type devices running Android 3.0, then you need
-to use new APIs available in Android 3.0. This section introduces some of the new features that you
-should use.</p>
-
-<p>The first thing to do when you create a project with the Android 3.0 preview is set the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element to
-use {@code "Honeycomb"} for the {@code android:minSdkVersion}. For example:</p>
-
-<pre>
-<manifest ... >
- <uses-sdk android:minSdkVersion="Honeycomb" />
- <application ... >
- ...
- <application>
-</manifest>
-</pre>
-
-<p class="note"><strong>Note:</strong> The API Level value "Honeycomb" is a provisional API
-Level that is valid only while building and testing against the preview SDK. You
-<strong>cannot</strong> publish your application using this API Level. When the final version of the
-Android 3.0 SDK is made available, you must change this value to the real API Level that is
-specified for Android 3.0. For more information, read about <a
-href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.</p>
-
-<p>Be sure that the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-<uses-sdk>}</a> element appears <strong>before</strong> the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
-element.</p>
-
-<p>By targeting the Android 3.0 platform (and declaring it before <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>),
-the system automatically applies the new Holographic theme to each of your
-activities.</p>
-
-
-
-<h3>Publishing your app for tablet-type devices only</h3>
-
-<p>Additionally, you should decide whether your application is for <em>only</em> tablet devices
-(specifically, <em>xlarge</em> devices) or for devices of all sizes that may run Android 3.0.</p>
-
-<p>If your application is <em>only</em> for tablets (<em>xlarge</em> screens; not for mobile
-devices/phones), then you should include the <a
-href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-<supports-screens>}</a> element in your manifest with all sizes except for xlarge declared
-false. For example:</p>
-
-<pre>
-<manifest ... >
- <uses-sdk android:minSdkVersion="Honeycomb" />
- <supports-screens android:smallScreens="false"
- android:normalScreens="false"
- android:largeScreens="false"
- android:xlargeScreens="true" />
- <application ... >
- ...
- <application>
-</manifest>
-</pre>
-
-<p>With this declaration, you indicate that your application does not support any screen size except
-extra large. External services such as Android Market may use this to filter your application
-from devices that do not have an extra large screen.</p>
-
-<p>Otherwise, if you want your application to be available to both small devices (phones) and large
-devices (tablets), do <em>not</em> include the <a
-href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-<supports-screens>}</a> element.</p>
-
-<div class="special">
-<p>To learn more about some of the new APIs,
-see the <a href="{@docRoot}sdk/android-3.0.html">Android 3.0 Platform Preview</a> document.</p>
-</div>
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index 1b94b2c..c1894d8 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -80,6 +80,7 @@
<div><a href="<?cs var:toroot ?>sdk/android-3.0.html">
<span class="en">Android 3.0 Platform</span></a> <span class="new">new!</span></div>
<ul>
+ <li><a href="<?cs var:toroot ?>sdk/android-3.0-optimize.html">Optimizing Apps for 3.0</a></li>
<li><a href="<?cs var:toroot ?>sdk/android-3.0-highlights.html">Platform Highlights</a></li>
<li><a href="<?cs var:toroot ?>sdk/api_diff/11/changes.html">API Differences Report »</a></li>
</ul>
@@ -88,10 +89,17 @@
<div><a href="<?cs var:toroot ?>sdk/android-2.3.3.html">
<span class="en">Android 2.3.3 Platform</span></a> <span class="new">new!</span></div>
<ul>
- <li><a href="<?cs var:toroot ?>sdk/android-2.3-highlights.html">Platform Highlights</a></li>
<li><a href="<?cs var:toroot ?>sdk/api_diff/10/changes.html">API Differences Report »</a></li>
</ul>
</li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>sdk/android-2.3.html">
+ <span class="en">Android 2.3 Platform</span></a></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>sdk/android-2.3-highlights.html">Platform Highlights</a></li>
+ <li><a href="<?cs var:toroot ?>sdk/api_diff/9/changes.html">API Differences Report »</a></li>
+ </ul>
+ </li>
<li><a href="<?cs var:toroot ?>sdk/android-2.2.html">Android 2.2 Platform</a></li>
<li><a href="<?cs var:toroot ?>sdk/android-2.1.html">Android 2.1 Platform</a></li>
<li><a href="<?cs var:toroot ?>sdk/android-1.6.html">Android 1.6 Platform</a></li>
@@ -99,13 +107,6 @@
<li class="toggle-list">
<div><a href="#" onclick="toggle(this.parentNode.parentNode,true); return false;">Older Platforms</a></div>
<ul>
- <li class="toggle-list">
- <div><a href="<?cs var:toroot ?>sdk/android-2.3.html">
- <span class="en">Android 2.3 Platform</span></a></div>
- <ul>
- <li><a href="<?cs var:toroot ?>sdk/api_diff/9/changes.html">API Differences Report »</a></li>
- </ul>
- </li>
<li><a href="<?cs var:toroot ?>sdk/android-2.0.1.html">Android 2.0.1 Platform</a></li>
<li><a href="<?cs var:toroot ?>sdk/android-2.0.html">Android 2.0 Platform</a></li>
<li><a href="<?cs var:toroot ?>sdk/android-1.1.html">Android 1.1 Platform</a></li>
diff --git a/libs/rs/java/Balls/_index.html b/libs/rs/java/Balls/_index.html
new file mode 100644
index 0000000..8760485
--- /dev/null
+++ b/libs/rs/java/Balls/_index.html
@@ -0,0 +1 @@
+<p>A brute force physics simulation that renders many balls onto the screen and moves them according to user touch and gravity.</p>
\ No newline at end of file
diff --git a/libs/rs/java/Fountain/_index.html b/libs/rs/java/Fountain/_index.html
new file mode 100644
index 0000000..223242f
--- /dev/null
+++ b/libs/rs/java/Fountain/_index.html
@@ -0,0 +1,5 @@
+<p>An example that renders many dots on the screen that follow a user's touch. The dots fall
+to the bottom of the screen when the user releases the finger.</p>
+
+
+
diff --git a/libs/rs/java/HelloCompute/_index.html b/libs/rs/java/HelloCompute/_index.html
new file mode 100644
index 0000000..abfd978
--- /dev/null
+++ b/libs/rs/java/HelloCompute/_index.html
@@ -0,0 +1,2 @@
+<p>A Renderscript compute sample that filters a bitmap. No Renderscript graphics APIs are used
+in this sample.</p>
\ No newline at end of file
diff --git a/libs/rs/java/HelloWorld/_index.html b/libs/rs/java/HelloWorld/_index.html
new file mode 100644
index 0000000..4cab738
--- /dev/null
+++ b/libs/rs/java/HelloWorld/_index.html
@@ -0,0 +1 @@
+<p>A Renderscript graphics application that draws the text "Hello, World!" where the user touches.</p>
\ No newline at end of file
diff --git a/libs/rs/java/ImageProcessing/Android.mk b/libs/rs/java/ImageProcessing/Android.mk
deleted file mode 100644
index 7fa30d0..0000000
--- a/libs/rs/java/ImageProcessing/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifneq ($(TARGET_SIMULATOR),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-renderscript-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
-
-LOCAL_PACKAGE_NAME := ImageProcessing
-
-include $(BUILD_PACKAGE)
-
-endif
diff --git a/libs/rs/java/ImageProcessing/AndroidManifest.xml b/libs/rs/java/ImageProcessing/AndroidManifest.xml
deleted file mode 100644
index 0fcbf1e..0000000
--- a/libs/rs/java/ImageProcessing/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.rs.image">
-
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-sdk android:minSdkVersion="11" />
- <application android:label="Image Processing">
- <activity android:name="ImageProcessingActivity"
- android:screenOrientation="portrait">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/libs/rs/java/ImageProcessing/res/drawable-hdpi/data.jpg b/libs/rs/java/ImageProcessing/res/drawable-hdpi/data.jpg
deleted file mode 100644
index 81a87b1..0000000
--- a/libs/rs/java/ImageProcessing/res/drawable-hdpi/data.jpg
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/ImageProcessing/res/drawable/data.jpg b/libs/rs/java/ImageProcessing/res/drawable/data.jpg
deleted file mode 100644
index 81a87b1..0000000
--- a/libs/rs/java/ImageProcessing/res/drawable/data.jpg
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/ImageProcessing/res/layout/main.xml b/libs/rs/java/ImageProcessing/res/layout/main.xml
deleted file mode 100644
index c6ec729..0000000
--- a/libs/rs/java/ImageProcessing/res/layout/main.xml
+++ /dev/null
@@ -1,187 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <SurfaceView
- android:id="@+id/surface"
- android:layout_width="1dip"
- android:layout_height="1dip" />
-
- <ImageView
- android:id="@+id/display"
- android:layout_width="320dip"
- android:layout_height="266dip" />
-
- <Button
- android:layout_marginBottom="170dip"
- android:layout_width="wrap_content"
- android:layout_height="40dip"
- android:text="@string/benchmark"
- android:onClick="benchmark"
- android:layout_gravity="bottom"/>
-
- <TextView
- android:id="@+id/benchmarkText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="100dip"
- android:layout_marginBottom="175dip"
- android:layout_gravity="bottom"
- android:text="@string/saturation"/>
-
- <SeekBar
- android:id="@+id/inSaturation"
- android:layout_marginBottom="140dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/inSaturationText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="50dip"
- android:layout_marginBottom="142dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/saturation"/>
-
- <SeekBar
- android:id="@+id/inGamma"
- android:layout_marginBottom="110dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/inGammaText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="50dip"
- android:layout_marginBottom="112dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/gamma"/>
-
- <SeekBar
- android:id="@+id/outWhite"
- android:layout_marginBottom="80dip"
- android:layout_marginLeft="170dip"
- android:layout_marginRight="10dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/outWhiteText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="220dip"
- android:layout_marginBottom="82dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/out_white"/>
-
- <SeekBar
- android:id="@+id/inWhite"
- android:layout_marginBottom="80dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="170dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/inWhiteText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="50dip"
- android:layout_marginBottom="82dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/in_white"/>
-
- <SeekBar
- android:id="@+id/outBlack"
- android:layout_marginBottom="50dip"
- android:layout_marginLeft="170dip"
- android:layout_marginRight="10dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/outBlackText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="220dip"
- android:layout_marginBottom="52dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/out_black"/>
-
- <SeekBar
- android:id="@+id/inBlack"
- android:layout_marginBottom="50dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="170dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/inBlackText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="50dip"
- android:layout_marginBottom="52dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/in_black"/>
-
- <SeekBar
- android:id="@+id/radius"
- android:layout_marginBottom="10dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
- <TextView
- android:id="@+id/blurText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:layout_marginLeft="50dip"
- android:layout_marginBottom="12dip"
- android:textColor="#000"
- android:layout_gravity="bottom"
- android:text="@string/blur_description"/>
-
-</merge>
\ No newline at end of file
diff --git a/libs/rs/java/ImageProcessing/res/values/strings.xml b/libs/rs/java/ImageProcessing/res/values/strings.xml
deleted file mode 100644
index cc5cc4d..0000000
--- a/libs/rs/java/ImageProcessing/res/values/strings.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2008 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- General -->
- <skip />
- <!--slider label -->
- <string name="blur_description">Blur Radius</string>
- <string name="in_white">In White</string>
- <string name="out_white">Out White</string>
- <string name="in_black">In Black</string>
- <string name="out_black">Out Black</string>
- <string name="gamma">Gamma</string>
- <string name="saturation">Saturation</string>
- <string name="benchmark">Benchmark</string>
-
-</resources>
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
deleted file mode 100644
index 5de09f7..0000000
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.image;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.renderscript.ScriptC;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Script;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.view.View;
-import java.lang.Math;
-
-public class ImageProcessingActivity extends Activity
- implements SurfaceHolder.Callback,
- SeekBar.OnSeekBarChangeListener {
- private Bitmap mBitmapIn;
- private Bitmap mBitmapOut;
- private Bitmap mBitmapScratch;
- private ScriptC_threshold mScript;
- private ScriptC_vertical_blur mScriptVBlur;
- private ScriptC_horizontal_blur mScriptHBlur;
- private int mRadius = 0;
- private SeekBar mRadiusSeekBar;
-
- private float mInBlack = 0.0f;
- private SeekBar mInBlackSeekBar;
- private float mOutBlack = 0.0f;
- private SeekBar mOutBlackSeekBar;
- private float mInWhite = 255.0f;
- private SeekBar mInWhiteSeekBar;
- private float mOutWhite = 255.0f;
- private SeekBar mOutWhiteSeekBar;
- private float mGamma = 1.0f;
- private SeekBar mGammaSeekBar;
-
- private float mSaturation = 1.0f;
- private SeekBar mSaturationSeekBar;
-
- private TextView mBenchmarkResult;
-
- @SuppressWarnings({"FieldCanBeLocal"})
- private RenderScript mRS;
- @SuppressWarnings({"FieldCanBeLocal"})
- private Type mPixelType;
- @SuppressWarnings({"FieldCanBeLocal"})
- private Allocation mInPixelsAllocation;
- @SuppressWarnings({"FieldCanBeLocal"})
- private Allocation mOutPixelsAllocation;
- @SuppressWarnings({"FieldCanBeLocal"})
- private Allocation mScratchPixelsAllocation1;
- private Allocation mScratchPixelsAllocation2;
-
- private SurfaceView mSurfaceView;
- private ImageView mDisplayView;
-
- class FilterCallback extends RenderScript.RSMessageHandler {
- private Runnable mAction = new Runnable() {
- public void run() {
- mDisplayView.invalidate();
- }
- };
-
- @Override
- public void run() {
- mSurfaceView.removeCallbacks(mAction);
- mSurfaceView.post(mAction);
- }
- }
-
- int in[];
- int interm[];
- int out[];
- int MAX_RADIUS = 25;
- // Store our coefficients here
- float gaussian[];
-
- private long javaFilter() {
- final int width = mBitmapIn.getWidth();
- final int height = mBitmapIn.getHeight();
- final int count = width * height;
-
- if (in == null) {
- in = new int[count];
- interm = new int[count];
- out = new int[count];
- gaussian = new float[MAX_RADIUS * 2 + 1];
- mBitmapIn.getPixels(in, 0, width, 0, 0, width, height);
- }
-
- long t = java.lang.System.currentTimeMillis();
-
- int w, h, r;
-
- float fRadius = (float)mRadius;
- int radius = (int)mRadius;
-
- // Compute gaussian weights for the blur
- // e is the euler's number
- float e = 2.718281828459045f;
- float pi = 3.1415926535897932f;
- // g(x) = ( 1 / sqrt( 2 * pi ) * sigma) * e ^ ( -x^2 / 2 * sigma^2 )
- // x is of the form [-radius .. 0 .. radius]
- // and sigma varies with radius.
- // Based on some experimental radius values and sigma's
- // we approximately fit sigma = f(radius) as
- // sigma = radius * 0.4 + 0.6
- // The larger the radius gets, the more our gaussian blur
- // will resemble a box blur since with large sigma
- // the gaussian curve begins to lose its shape
- float sigma = 0.4f * fRadius + 0.6f;
- // Now compute the coefficints
- // We will store some redundant values to save some math during
- // the blur calculations
- // precompute some values
- float coeff1 = 1.0f / (float)(Math.sqrt( 2.0f * pi ) * sigma);
- float coeff2 = - 1.0f / (2.0f * sigma * sigma);
- float normalizeFactor = 0.0f;
- float floatR = 0.0f;
- for (r = -radius; r <= radius; r ++) {
- floatR = (float)r;
- gaussian[r + radius] = coeff1 * (float)Math.pow(e, floatR * floatR * coeff2);
- normalizeFactor += gaussian[r + radius];
- }
-
- //Now we need to normalize the weights because all our coefficients need to add up to one
- normalizeFactor = 1.0f / normalizeFactor;
- for (r = -radius; r <= radius; r ++) {
- floatR = (float)r;
- gaussian[r + radius] *= normalizeFactor;
- }
-
- float blurredPixelR = 0.0f;
- float blurredPixelG = 0.0f;
- float blurredPixelB = 0.0f;
- float blurredPixelA = 0.0f;
-
- for (h = 0; h < height; h ++) {
- for (w = 0; w < width; w ++) {
-
- blurredPixelR = 0.0f;
- blurredPixelG = 0.0f;
- blurredPixelB = 0.0f;
- blurredPixelA = 0.0f;
-
- for (r = -radius; r <= radius; r ++) {
- // Stepping left and right away from the pixel
- int validW = w + r;
- // Clamp to zero and width max() isn't exposed for ints yet
- if (validW < 0) {
- validW = 0;
- }
- if (validW > width - 1) {
- validW = width - 1;
- }
-
- int input = in[h*width + validW];
-
- int R = ((input >> 24) & 0xff);
- int G = ((input >> 16) & 0xff);
- int B = ((input >> 8) & 0xff);
- int A = (input & 0xff);
-
- float weight = gaussian[r + radius];
-
- blurredPixelR += (float)(R)*weight;
- blurredPixelG += (float)(G)*weight;
- blurredPixelB += (float)(B)*weight;
- blurredPixelA += (float)(A)*weight;
- }
-
- int R = (int)blurredPixelR;
- int G = (int)blurredPixelG;
- int B = (int)blurredPixelB;
- int A = (int)blurredPixelA;
-
- interm[h*width + w] = (R << 24) | (G << 16) | (B << 8) | (A);
- }
- }
-
- for (h = 0; h < height; h ++) {
- for (w = 0; w < width; w ++) {
-
- blurredPixelR = 0.0f;
- blurredPixelG = 0.0f;
- blurredPixelB = 0.0f;
- blurredPixelA = 0.0f;
- for (r = -radius; r <= radius; r ++) {
- int validH = h + r;
- // Clamp to zero and width
- if (validH < 0) {
- validH = 0;
- }
- if (validH > height - 1) {
- validH = height - 1;
- }
-
- int input = interm[validH*width + w];
-
- int R = ((input >> 24) & 0xff);
- int G = ((input >> 16) & 0xff);
- int B = ((input >> 8) & 0xff);
- int A = (input & 0xff);
-
- float weight = gaussian[r + radius];
-
- blurredPixelR += (float)(R)*weight;
- blurredPixelG += (float)(G)*weight;
- blurredPixelB += (float)(B)*weight;
- blurredPixelA += (float)(A)*weight;
- }
-
- int R = (int)blurredPixelR;
- int G = (int)blurredPixelG;
- int B = (int)blurredPixelB;
- int A = (int)blurredPixelA;
-
- out[h*width + w] = (R << 24) | (G << 16) | (B << 8) | (A);
- }
- }
-
- t = java.lang.System.currentTimeMillis() - t;
- android.util.Log.v("Img", "Java frame time ms " + t);
- mBitmapOut.setPixels(out, 0, width, 0, 0, width, height);
- return t;
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (fromUser) {
-
- if (seekBar == mRadiusSeekBar) {
- float fRadius = progress / 100.0f;
- fRadius *= (float)(MAX_RADIUS);
- mRadius = (int)fRadius;
-
- mScript.set_radius(mRadius);
- } else if (seekBar == mInBlackSeekBar) {
- mInBlack = (float)progress;
- mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite);
- } else if (seekBar == mOutBlackSeekBar) {
- mOutBlack = (float)progress;
- mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite);
- } else if (seekBar == mInWhiteSeekBar) {
- mInWhite = (float)progress + 127.0f;
- mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite);
- } else if (seekBar == mOutWhiteSeekBar) {
- mOutWhite = (float)progress + 127.0f;
- mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite);
- } else if (seekBar == mGammaSeekBar) {
- mGamma = (float)progress/100.0f;
- mGamma = Math.max(mGamma, 0.1f);
- mGamma = 1.0f / mGamma;
- mScriptVBlur.invoke_setGamma(mGamma);
- } else if (seekBar == mSaturationSeekBar) {
- mSaturation = (float)progress / 50.0f;
- mScriptVBlur.invoke_setSaturation(mSaturation);
- }
-
- long t = java.lang.System.currentTimeMillis();
- if (true) {
- mScript.invoke_filter();
- mOutPixelsAllocation.copyTo(mBitmapOut);
- } else {
- javaFilter();
- mDisplayView.invalidate();
- }
-
- t = java.lang.System.currentTimeMillis() - t;
- android.util.Log.v("Img", "Renderscript frame time core ms " + t);
- }
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- mBitmapIn = loadBitmap(R.drawable.data);
- mBitmapOut = loadBitmap(R.drawable.data);
- mBitmapScratch = loadBitmap(R.drawable.data);
-
- mSurfaceView = (SurfaceView) findViewById(R.id.surface);
- mSurfaceView.getHolder().addCallback(this);
-
- mDisplayView = (ImageView) findViewById(R.id.display);
- mDisplayView.setImageBitmap(mBitmapOut);
-
- mRadiusSeekBar = (SeekBar) findViewById(R.id.radius);
- mRadiusSeekBar.setOnSeekBarChangeListener(this);
-
- mInBlackSeekBar = (SeekBar)findViewById(R.id.inBlack);
- mInBlackSeekBar.setOnSeekBarChangeListener(this);
- mInBlackSeekBar.setMax(128);
- mInBlackSeekBar.setProgress(0);
- mOutBlackSeekBar = (SeekBar)findViewById(R.id.outBlack);
- mOutBlackSeekBar.setOnSeekBarChangeListener(this);
- mOutBlackSeekBar.setMax(128);
- mOutBlackSeekBar.setProgress(0);
-
- mInWhiteSeekBar = (SeekBar)findViewById(R.id.inWhite);
- mInWhiteSeekBar.setOnSeekBarChangeListener(this);
- mInWhiteSeekBar.setMax(128);
- mInWhiteSeekBar.setProgress(128);
- mOutWhiteSeekBar = (SeekBar)findViewById(R.id.outWhite);
- mOutWhiteSeekBar.setOnSeekBarChangeListener(this);
- mOutWhiteSeekBar.setMax(128);
- mOutWhiteSeekBar.setProgress(128);
-
- mGammaSeekBar = (SeekBar)findViewById(R.id.inGamma);
- mGammaSeekBar.setOnSeekBarChangeListener(this);
- mGammaSeekBar.setMax(150);
- mGammaSeekBar.setProgress(100);
-
- mSaturationSeekBar = (SeekBar)findViewById(R.id.inSaturation);
- mSaturationSeekBar.setOnSeekBarChangeListener(this);
- mSaturationSeekBar.setProgress(50);
-
- mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
- mBenchmarkResult.setText("Benchmark not yet run");
- }
-
- public void surfaceCreated(SurfaceHolder holder) {
- createScript();
- mScript.invoke_filter();
- mOutPixelsAllocation.copyTo(mBitmapOut);
- }
-
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- }
-
- private void createScript() {
- mRS = RenderScript.create(this);
- mRS.setMessageHandler(new FilterCallback());
-
- mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
- Allocation.MipmapControl.MIPMAP_NONE,
- Allocation.USAGE_SCRIPT);
- mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut,
- Allocation.MipmapControl.MIPMAP_NONE,
- Allocation.USAGE_SCRIPT);
-
- Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS));
- tb.setX(mBitmapIn.getWidth());
- tb.setY(mBitmapIn.getHeight());
- mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
- mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
- mScriptVBlur = new ScriptC_vertical_blur(mRS, getResources(), R.raw.vertical_blur);
- mScriptHBlur = new ScriptC_horizontal_blur(mRS, getResources(), R.raw.horizontal_blur);
-
- mScript = new ScriptC_threshold(mRS, getResources(), R.raw.threshold);
- mScript.set_width(mBitmapIn.getWidth());
- mScript.set_height(mBitmapIn.getHeight());
- mScript.set_radius(mRadius);
-
- mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite);
- mScriptVBlur.invoke_setGamma(mGamma);
- mScriptVBlur.invoke_setSaturation(mSaturation);
-
- mScript.bind_InPixel(mInPixelsAllocation);
- mScript.bind_OutPixel(mOutPixelsAllocation);
- mScript.bind_ScratchPixel1(mScratchPixelsAllocation1);
- mScript.bind_ScratchPixel2(mScratchPixelsAllocation2);
-
- mScript.set_vBlurScript(mScriptVBlur);
- mScript.set_hBlurScript(mScriptHBlur);
- }
-
- private Bitmap loadBitmap(int resource) {
- final BitmapFactory.Options options = new BitmapFactory.Options();
- options.inPreferredConfig = Bitmap.Config.ARGB_8888;
- return copyBitmap(BitmapFactory.decodeResource(getResources(), resource, options));
- }
-
- private static Bitmap copyBitmap(Bitmap source) {
- Bitmap b = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
- Canvas c = new Canvas(b);
- c.drawBitmap(source, 0, 0, null);
- source.recycle();
- return b;
- }
-
- // button hook
- public void benchmark(View v) {
- android.util.Log.v("Img", "Benchmarking");
- int oldRadius = mRadius;
- mRadius = MAX_RADIUS;
- mScript.set_radius(mRadius);
-
- long t = java.lang.System.currentTimeMillis();
-
- mScript.invoke_filter();
- mOutPixelsAllocation.copyTo(mBitmapOut);
-
- t = java.lang.System.currentTimeMillis() - t;
- android.util.Log.v("Img", "Renderscript frame time core ms " + t);
-
- //long javaTime = javaFilter();
- //mBenchmarkResult.setText("RS: " + t + " ms Java: " + javaTime + " ms");
- mBenchmarkResult.setText("RS: " + t + " ms");
-
- mRadius = oldRadius;
- mScript.set_radius(mRadius);
-
- mScript.invoke_filter();
- mOutPixelsAllocation.copyTo(mBitmapOut);
- }
-}
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs b/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs
deleted file mode 100644
index 652ffd7..0000000
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#pragma version(1)
-
-#include "ip.rsh"
-
-void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32_t y) {
- float4 *output = (float4 *)v_out;
- const FilterStruct *fs = (const FilterStruct *)usrData;
- const float4 *input = (const float4 *)rsGetElementAt(fs->ain, 0, y);
-
- float3 blurredPixel = 0;
- const float *gPtr = fs->gaussian;
- if ((x > fs->radius) && (x < (fs->width - fs->radius))) {
- const float4 *i = input + (x - fs->radius);
- for (int r = -fs->radius; r <= fs->radius; r ++) {
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
- i++;
- }
- } else {
- for (int r = -fs->radius; r <= fs->radius; r ++) {
- // Stepping left and right away from the pixel
- int validW = rsClamp(x + r, (uint)0, (uint)(fs->width - 1));
- blurredPixel += input[validW].xyz * gPtr[0];
- gPtr++;
- }
- }
-
- output->xyz = blurredPixel;
-}
-
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ip.rsh b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ip.rsh
deleted file mode 100644
index 1d7a719..0000000
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ip.rsh
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma rs java_package_name(com.android.rs.image)
-
-#define MAX_RADIUS 25
-
-typedef struct FilterStruct_s {
- rs_allocation ain;
-
- float *gaussian; //[MAX_RADIUS * 2 + 1];
- int height;
- int width;
- int radius;
-
-} FilterStruct;
-
-
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/threshold.rs b/libs/rs/java/ImageProcessing/src/com/android/rs/image/threshold.rs
deleted file mode 100644
index f2f9a36..0000000
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/threshold.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-#pragma version(1)
-
-#include "ip.rsh"
-
-int height;
-int width;
-int radius;
-
-uchar4 * InPixel;
-uchar4 * OutPixel;
-float4 * ScratchPixel1;
-float4 * ScratchPixel2;
-
-rs_script vBlurScript;
-rs_script hBlurScript;
-
-const int CMD_FINISHED = 1;
-
-// Store our coefficients here
-static float gaussian[MAX_RADIUS * 2 + 1];
-
-
-static void computeGaussianWeights() {
- // Compute gaussian weights for the blur
- // e is the euler's number
- float e = 2.718281828459045f;
- float pi = 3.1415926535897932f;
- // g(x) = ( 1 / sqrt( 2 * pi ) * sigma) * e ^ ( -x^2 / 2 * sigma^2 )
- // x is of the form [-radius .. 0 .. radius]
- // and sigma varies with radius.
- // Based on some experimental radius values and sigma's
- // we approximately fit sigma = f(radius) as
- // sigma = radius * 0.4 + 0.6
- // The larger the radius gets, the more our gaussian blur
- // will resemble a box blur since with large sigma
- // the gaussian curve begins to lose its shape
- float sigma = 0.4f * (float)radius + 0.6f;
-
- // Now compute the coefficints
- // We will store some redundant values to save some math during
- // the blur calculations
- // precompute some values
- float coeff1 = 1.0f / (sqrt( 2.0f * pi ) * sigma);
- float coeff2 = - 1.0f / (2.0f * sigma * sigma);
-
- float normalizeFactor = 0.0f;
- float floatR = 0.0f;
- int r;
- for (r = -radius; r <= radius; r ++) {
- floatR = (float)r;
- gaussian[r + radius] = coeff1 * pow(e, floatR * floatR * coeff2);
- normalizeFactor += gaussian[r + radius];
- }
-
- //Now we need to normalize the weights because all our coefficients need to add up to one
- normalizeFactor = 1.0f / normalizeFactor;
- for (r = -radius; r <= radius; r ++) {
- floatR = (float)r;
- gaussian[r + radius] *= normalizeFactor;
- }
-}
-
-
-static void copyInput() {
- rs_allocation ain;
- rsSetObject(&ain,rsGetAllocation(InPixel));
- uint32_t dimx = rsAllocationGetDimX(ain);
- uint32_t dimy = rsAllocationGetDimY(ain);
- for (uint32_t y = 0; y < dimy; y++) {
- for (uint32_t x = 0; x < dimx; x++) {
- ScratchPixel1[x + y * dimx] = convert_float4(InPixel[x + y * dimx]);
- }
- }
-}
-
-void filter() {
- copyInput();
- computeGaussianWeights();
-
- FilterStruct fs;
- fs.gaussian = gaussian;
- fs.width = width;
- fs.height = height;
- fs.radius = radius;
-
- fs.ain = rsGetAllocation(ScratchPixel1);
- rsForEach(hBlurScript, fs.ain, rsGetAllocation(ScratchPixel2), &fs);
-
- fs.ain = rsGetAllocation(ScratchPixel2);
- rsForEach(vBlurScript, fs.ain, rsGetAllocation(OutPixel), &fs);
- rsSendToClientBlocking(CMD_FINISHED);
-}
-
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/vertical_blur.rs b/libs/rs/java/ImageProcessing/src/com/android/rs/image/vertical_blur.rs
deleted file mode 100644
index bd4ae4e..0000000
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/vertical_blur.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-#pragma version(1)
-
-#include "ip.rsh"
-
-static float inBlack;
-static float outBlack;
-static float inWhite;
-static float outWhite;
-static float3 gamma;
-static float saturation;
-
-static float inWMinInB;
-static float outWMinOutB;
-static float overInWMinInB;
-static rs_matrix3x3 colorMat;
-
-void setLevels(float iBlk, float oBlk, float iWht, float oWht) {
- inBlack = iBlk;
- outBlack = oBlk;
- inWhite = iWht;
- outWhite = oWht;
-
- inWMinInB = inWhite - inBlack;
- outWMinOutB = outWhite - outBlack;
- overInWMinInB = 1.f / inWMinInB;
-}
-
-void setSaturation(float sat) {
- saturation = sat;
-
- // Saturation
- // Linear weights
- //float rWeight = 0.3086f;
- //float gWeight = 0.6094f;
- //float bWeight = 0.0820f;
-
- // Gamma 2.2 weights (we haven't converted our image to linear space yet for perf reasons)
- float rWeight = 0.299f;
- float gWeight = 0.587f;
- float bWeight = 0.114f;
-
- float oneMinusS = 1.0f - saturation;
- rsMatrixSet(&colorMat, 0, 0, oneMinusS * rWeight + saturation);
- rsMatrixSet(&colorMat, 0, 1, oneMinusS * rWeight);
- rsMatrixSet(&colorMat, 0, 2, oneMinusS * rWeight);
- rsMatrixSet(&colorMat, 1, 0, oneMinusS * gWeight);
- rsMatrixSet(&colorMat, 1, 1, oneMinusS * gWeight + saturation);
- rsMatrixSet(&colorMat, 1, 2, oneMinusS * gWeight);
- rsMatrixSet(&colorMat, 2, 0, oneMinusS * bWeight);
- rsMatrixSet(&colorMat, 2, 1, oneMinusS * bWeight);
- rsMatrixSet(&colorMat, 2, 2, oneMinusS * bWeight + saturation);
-}
-
-void setGamma(float g) {
- gamma = (float3)g;
-}
-
-//sliao
-extern uchar3 __attribute__((overloadable)) convert2uchar3(float3 xyz);
-
-void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32_t y) {
- uchar4 *output = (uchar4 *)v_out;
- const FilterStruct *fs = (const FilterStruct *)usrData;
- const float4 *input = (const float4 *)rsGetElementAt(fs->ain, x, 0);
-
- float3 blurredPixel = 0;
- const float *gPtr = fs->gaussian;
- if ((y > fs->radius) && (y < (fs->height - fs->radius))) {
- const float4 *i = input + ((y - fs->radius) * fs->width);
- for (int r = -fs->radius; r <= fs->radius; r ++) {
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
- i += fs->width;
- }
- } else {
- for (int r = -fs->radius; r <= fs->radius; r ++) {
- int validH = rsClamp(y + r, (uint)0, (uint)(fs->height - 1));
- const float4 *i = input + validH * fs->width;
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
- }
- }
-
- float3 temp = rsMatrixMultiply(&colorMat, blurredPixel);
- temp = (clamp(temp, 0.f, 255.f) - inBlack) * overInWMinInB;
- if (gamma.x != 1.0f)
- temp = pow(temp, (float3)gamma);
- temp = clamp(temp * outWMinOutB + outBlack, 0.f, 255.f);
-
- output->xyz = convert_uchar3(temp);
- //output->w = input->w;
-}
-
diff --git a/libs/rs/java/ModelViewer/Android.mk b/libs/rs/java/ModelViewer/Android.mk
deleted file mode 100644
index efe77d7..0000000
--- a/libs/rs/java/ModelViewer/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifneq ($(TARGET_SIMULATOR),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
-
-LOCAL_PACKAGE_NAME := ModelViewer
-
-include $(BUILD_PACKAGE)
-
-endif
diff --git a/libs/rs/java/ModelViewer/AndroidManifest.xml b/libs/rs/java/ModelViewer/AndroidManifest.xml
deleted file mode 100644
index 959fe53..0000000
--- a/libs/rs/java/ModelViewer/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.modelviewer">
- <application android:label="ModelViewer">
- <activity android:name="SimpleModel"
- android:label="SimpleModel"
- android:screenOrientation="portrait"
- android:theme="@android:style/Theme.Black.NoTitleBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="SceneGraph"
- android:label="SceneGraph"
- android:theme="@android:style/Theme.Black.NoTitleBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/libs/rs/java/ModelViewer/res/drawable/robot.png b/libs/rs/java/ModelViewer/res/drawable/robot.png
deleted file mode 100644
index f7353fd..0000000
--- a/libs/rs/java/ModelViewer/res/drawable/robot.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/ModelViewer/res/raw/robot.a3d b/libs/rs/java/ModelViewer/res/raw/robot.a3d
deleted file mode 100644
index f48895c..0000000
--- a/libs/rs/java/ModelViewer/res/raw/robot.a3d
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraph.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraph.java
deleted file mode 100644
index b8717a7..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraph.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Config;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class SceneGraph extends Activity {
-
- private SceneGraphView mView;
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- // Create our Preview view and set it as the content of our
- // Activity
- mView = new SceneGraphView(this);
- setContentView(mView);
- }
-
- @Override
- protected void onResume() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onResume();
- mView.resume();
- }
-
- @Override
- protected void onPause() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onPause();
- mView.pause();
- }
-
-}
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java
deleted file mode 100644
index f91f31e..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import java.io.Writer;
-import java.util.Map;
-import java.util.Vector;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.Element.Builder;
-import android.renderscript.Font.Style;
-import android.renderscript.ProgramStore.DepthFunc;
-import android.util.Log;
-
-
-public class SceneGraphRS {
-
- private final int STATE_LAST_FOCUS = 1;
-
- int mWidth;
- int mHeight;
- int mRotation;
-
- public SceneGraphRS() {
- }
-
- public void init(RenderScriptGL rs, Resources res, int width, int height) {
- mRS = rs;
- mRes = res;
- mWidth = width;
- mHeight = height;
- mRotation = 0;
- initRS();
- }
-
- private Resources mRes;
- private RenderScriptGL mRS;
- private Sampler mSampler;
- private ProgramStore mPSBackground;
- private ProgramFragment mPFBackground;
- private ProgramVertex mPVBackground;
- private ProgramVertexFixedFunction.Constants mPVA;
-
- private Allocation mGridImage;
- private Allocation mAllocPV;
-
- private Mesh mMesh;
-
- private Font mItalic;
- private Allocation mTextAlloc;
-
- private ScriptC_scenegraph mScript;
- private ScriptC_transform mTransformScript;
-
- int mLastX;
- int mLastY;
-
- public void touchEvent(int x, int y) {
- int dx = mLastX - x;
- if (Math.abs(dx) > 50 || Math.abs(dx) < 3) {
- dx = 0;
- }
-
- mRotation -= dx;
- if (mRotation > 360) {
- mRotation -= 360;
- }
- if (mRotation < 0) {
- mRotation += 360;
- }
-
- mScript.set_gRotate(-(float)mRotation);
-
- mLastX = x;
- mLastY = y;
- }
-
- private void initPFS() {
- ProgramStore.Builder b = new ProgramStore.Builder(mRS);
-
- b.setDepthFunc(ProgramStore.DepthFunc.LESS);
- b.setDitherEnabled(false);
- b.setDepthMaskEnabled(true);
- mPSBackground = b.create();
-
- mScript.set_gPFSBackground(mPSBackground);
- }
-
- private void initPF() {
- Sampler.Builder bs = new Sampler.Builder(mRS);
- bs.setMinification(Sampler.Value.LINEAR);
- bs.setMagnification(Sampler.Value.LINEAR);
- bs.setWrapS(Sampler.Value.CLAMP);
- bs.setWrapT(Sampler.Value.CLAMP);
- mSampler = bs.create();
-
- ProgramFragmentFixedFunction.Builder b = new ProgramFragmentFixedFunction.Builder(mRS);
- b.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.REPLACE,
- ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
- mPFBackground = b.create();
- mPFBackground.bindSampler(mSampler, 0);
-
- mScript.set_gPFBackground(mPFBackground);
- }
-
- private void initPV() {
- ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS);
- mPVBackground = pvb.create();
-
- mPVA = new ProgramVertexFixedFunction.Constants(mRS);
- ((ProgramVertexFixedFunction)mPVBackground).bindConstants(mPVA);
-
- mScript.set_gPVBackground(mPVBackground);
- }
-
- private void loadImage() {
- mGridImage = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.robot,
- Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
- Allocation.USAGE_GRAPHICS_TEXTURE);
- mScript.set_gTGrid(mGridImage);
- }
-
- private void initTextAllocation() {
- String allocString = "Displaying file: R.raw.robot";
- mTextAlloc = Allocation.createFromString(mRS, allocString, Allocation.USAGE_SCRIPT);
- mScript.set_gTextAlloc(mTextAlloc);
- }
-
- SgTransform mRootTransform;
- SgTransform mGroup1;
-
- SgTransform mRobot1;
- SgTransform mRobot2;
-
- void initTransformHierarchy() {
- mRootTransform = new SgTransform(mRS);
-
- mGroup1 = new SgTransform(mRS);
- mRootTransform.addChild(mGroup1);
-
- mRobot1 = new SgTransform(mRS);
- mRobot2 = new SgTransform(mRS);
-
- mGroup1.addChild(mRobot1);
- mGroup1.addChild(mRobot2);
-
- mGroup1.setTransform(0, new Float4(0.0f, 0.0f, -15.0f, 0.0f), TransformType.TRANSLATE);
- mGroup1.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, 15.0f), TransformType.ROTATE);
-
- mRobot1.setTransform(0, new Float4(-3.0f, -0.5f, 0.0f, 0.0f), TransformType.TRANSLATE);
- mRobot1.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, 20.0f), TransformType.ROTATE);
- mRobot1.setTransform(2, new Float4(0.2f, 0.2f, 0.2f, 0.0f), TransformType.SCALE);
-
- mRobot2.setTransform(0, new Float4(3.0f, 0.0f, 0.0f, 0.0f), TransformType.TRANSLATE);
- mRobot2.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, -20.0f), TransformType.ROTATE);
- mRobot2.setTransform(2, new Float4(0.3f, 0.3f, 0.3f, 0.0f), TransformType.SCALE);
- }
-
- private void initRS() {
-
- mScript = new ScriptC_scenegraph(mRS, mRes, R.raw.scenegraph);
- mTransformScript = new ScriptC_transform(mRS, mRes, R.raw.transform);
- mTransformScript.set_transformScript(mTransformScript);
-
- mScript.set_gTransformRS(mTransformScript);
-
- initPFS();
- initPF();
- initPV();
-
- loadImage();
-
- FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot);
- FileA3D.IndexEntry entry = model.getIndexEntry(0);
- if (entry == null || entry.getEntryType() != FileA3D.EntryType.MESH) {
- Log.e("rs", "could not load model");
- } else {
- mMesh = (Mesh)entry.getObject();
- mScript.set_gTestMesh(mMesh);
- }
-
- mItalic = Font.create(mRS, mRes, "serif", Font.Style.ITALIC, 8);
- mScript.set_gItalic(mItalic);
-
- initTextAllocation();
-
- initTransformHierarchy();
-
- mScript.bind_gRootNode(mRootTransform.getField());
-
- mScript.bind_gGroup(mGroup1.mParent.mChildField);
- mScript.bind_gRobot1(mRobot1.mParent.mChildField);
- mScript.set_gRobot1Index(mRobot1.mIndexInParentGroup);
- mScript.bind_gRobot2(mRobot2.mParent.mChildField);
- mScript.set_gRobot2Index(mRobot2.mIndexInParentGroup);
-
- mRS.bindRootScript(mScript);
- }
-}
-
-
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphView.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphView.java
deleted file mode 100644
index 0b6a3b8..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphView.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class SceneGraphView extends RSSurfaceView {
-
- public SceneGraphView(Context context) {
- super(context);
- //setFocusable(true);
- }
-
- private RenderScriptGL mRS;
- private SceneGraphRS mRender;
-
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- super.surfaceChanged(holder, format, w, h);
- if (mRS == null) {
- RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
- sc.setDepth(16, 24);
- mRS = createRenderScriptGL(sc);
- mRS.setSurface(holder, w, h);
- mRender = new SceneGraphRS();
- mRender.init(mRS, getResources(), w, h);
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- if (mRS != null) {
- mRS = null;
- destroyRenderScriptGL();
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- // break point at here
- // this method doesn't work when 'extends View' include 'extends ScrollView'.
- return super.onKeyDown(keyCode, event);
- }
-
-
- @Override
- public boolean onTouchEvent(MotionEvent ev)
- {
- boolean ret = true;
- int act = ev.getAction();
- if (act == ev.ACTION_UP) {
- ret = false;
- }
-
- mRender.touchEvent((int)ev.getX(), (int)ev.getY());
- return ret;
- }
-}
-
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java
deleted file mode 100644
index f5484e2..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import java.io.Writer;
-import java.util.Map;
-import java.util.Vector;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.Element.Builder;
-import android.renderscript.ProgramStore.DepthFunc;
-import android.util.Log;
-
-enum TransformType {
-
- NONE(0),
- TRANSLATE(1),
- ROTATE(2),
- SCALE(3);
-
- int mID;
- TransformType(int id) {
- mID = id;
- }
-}
-
-public class SgTransform {
-
-
- ScriptField_SgTransform mTransformField;
- ScriptField_SgTransform mChildField;
- public ScriptField_SgTransform.Item mTransformData;
-
- RenderScript mRS;
-
- Vector mChildren;
- SgTransform mParent;
- int mIndexInParentGroup;
-
- public void setParent(SgTransform parent, int parentIndex) {
- mParent = parent;
- mIndexInParentGroup = parentIndex;
- }
-
- public void addChild(SgTransform child) {
- mChildren.add(child);
- child.setParent(this, mChildren.size() - 1);
- }
-
- public void setTransform(int index, Float4 value, TransformType type) {
- mTransformData.transforms[index] = value;
- mTransformData.transformTypes[index] = type.mID;
- }
-
- void initData() {
- int numElements = mTransformData.transforms.length;
- mTransformData.transformTypes = new int[numElements];
- for (int i = 0; i < numElements; i ++) {
- mTransformData.transforms[i] = new Float4(0, 0, 0, 0);
- mTransformData.transformTypes[i] = TransformType.NONE.mID;
- }
-
- mTransformData.isDirty = 1;
- mTransformData.children = null;
- }
-
- public SgTransform(RenderScript rs) {
- mRS = rs;
- mTransformData = new ScriptField_SgTransform.Item();
- mChildren = new Vector();
- initData();
- }
-
- public ScriptField_SgTransform.Item getData() {
- if (mChildren.size() != 0) {
- mChildField = new ScriptField_SgTransform(mRS, mChildren.size());
- mTransformData.children = mChildField.getAllocation();
-
- for (int i = 0; i < mChildren.size(); i ++) {
- SgTransform child = (SgTransform)mChildren.get(i);
- mChildField.set(child.getData(), i, false);
- }
- mChildField.copyAll();
- }
-
- return mTransformData;
- }
-
- public ScriptField_SgTransform getField() {
- mTransformField = new ScriptField_SgTransform(mRS, 1);
- mTransformField.set(getData(), 0, true);
- return mTransformField;
- }
-}
-
-
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModel.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModel.java
deleted file mode 100644
index 9910970..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModel.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Config;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class SimpleModel extends Activity {
-
- private SimpleModelView mView;
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- // Create our Preview view and set it as the content of our
- // Activity
- mView = new SimpleModelView(this);
- setContentView(mView);
- }
-
- @Override
- protected void onResume() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onResume();
- mView.resume();
- }
-
- @Override
- protected void onPause() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onPause();
- mView.pause();
- }
-
-}
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java
deleted file mode 100644
index b18a327..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import java.io.Writer;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.ProgramStore.DepthFunc;
-import android.util.Log;
-
-
-public class SimpleModelRS {
-
- private final int STATE_LAST_FOCUS = 1;
-
- int mWidth;
- int mHeight;
- int mRotation;
-
- public SimpleModelRS() {
- }
-
- public void init(RenderScriptGL rs, Resources res, int width, int height) {
- mRS = rs;
- mRes = res;
- mWidth = width;
- mHeight = height;
- mRotation = 0;
- initRS();
- }
-
- private Resources mRes;
- private RenderScriptGL mRS;
- private Sampler mSampler;
- private ProgramStore mPSBackground;
- private ProgramFragment mPFBackground;
- private ProgramVertex mPVBackground;
- private ProgramVertexFixedFunction.Constants mPVA;
-
- private Allocation mGridImage;
- private Allocation mAllocPV;
-
- private Mesh mMesh;
-
- private Font mItalic;
- private Allocation mTextAlloc;
-
- private ScriptC_simplemodel mScript;
-
- int mLastX;
- int mLastY;
-
- public void touchEvent(int x, int y) {
- int dx = mLastX - x;
- if (Math.abs(dx) > 50 || Math.abs(dx) < 3) {
- dx = 0;
- }
-
- mRotation -= dx;
- if (mRotation > 360) {
- mRotation -= 360;
- }
- if (mRotation < 0) {
- mRotation += 360;
- }
-
- mScript.set_gRotate((float)mRotation);
-
- mLastX = x;
- mLastY = y;
- }
-
- private void initPFS() {
- ProgramStore.Builder b = new ProgramStore.Builder(mRS);
-
- b.setDepthFunc(ProgramStore.DepthFunc.LESS);
- b.setDitherEnabled(false);
- b.setDepthMaskEnabled(true);
- mPSBackground = b.create();
-
- mScript.set_gPFSBackground(mPSBackground);
- }
-
- private void initPF() {
- Sampler.Builder bs = new Sampler.Builder(mRS);
- bs.setMinification(Sampler.Value.LINEAR);
- bs.setMagnification(Sampler.Value.LINEAR);
- bs.setWrapS(Sampler.Value.CLAMP);
- bs.setWrapT(Sampler.Value.CLAMP);
- mSampler = bs.create();
-
- ProgramFragmentFixedFunction.Builder b = new ProgramFragmentFixedFunction.Builder(mRS);
- b.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.REPLACE,
- ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
- mPFBackground = b.create();
- mPFBackground.bindSampler(mSampler, 0);
-
- mScript.set_gPFBackground(mPFBackground);
- }
-
- private void initPV() {
- ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS);
- mPVBackground = pvb.create();
-
- mPVA = new ProgramVertexFixedFunction.Constants(mRS);
- ((ProgramVertexFixedFunction)mPVBackground).bindConstants(mPVA);
-
- mScript.set_gPVBackground(mPVBackground);
- }
-
- private void loadImage() {
- mGridImage = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.robot,
- Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
- Allocation.USAGE_GRAPHICS_TEXTURE);
- mScript.set_gTGrid(mGridImage);
- }
-
- private void initTextAllocation() {
- String allocString = "Displaying file: R.raw.robot";
- mTextAlloc = Allocation.createFromString(mRS, allocString, Allocation.USAGE_SCRIPT);
- mScript.set_gTextAlloc(mTextAlloc);
- }
-
- private void initRS() {
-
- mScript = new ScriptC_simplemodel(mRS, mRes, R.raw.simplemodel);
-
- initPFS();
- initPF();
- initPV();
-
- loadImage();
-
- FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot);
- FileA3D.IndexEntry entry = model.getIndexEntry(0);
- if (entry == null || entry.getEntryType() != FileA3D.EntryType.MESH) {
- Log.e("rs", "could not load model");
- } else {
- mMesh = (Mesh)entry.getObject();
- mScript.set_gTestMesh(mMesh);
- }
-
- mItalic = Font.create(mRS, mRes, "serif", Font.Style.ITALIC, 8);
- mScript.set_gItalic(mItalic);
-
- initTextAllocation();
-
- mRS.bindRootScript(mScript);
- }
-}
-
-
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelView.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelView.java
deleted file mode 100644
index 5c5956d..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelView.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class SimpleModelView extends RSSurfaceView {
-
- public SimpleModelView(Context context) {
- super(context);
- //setFocusable(true);
- }
-
- private RenderScriptGL mRS;
- private SimpleModelRS mRender;
-
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- super.surfaceChanged(holder, format, w, h);
- if (mRS == null) {
- RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
- sc.setDepth(16, 24);
- mRS = createRenderScriptGL(sc);
- mRS.setSurface(holder, w, h);
- mRender = new SimpleModelRS();
- mRender.init(mRS, getResources(), w, h);
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- if (mRS != null) {
- mRS = null;
- destroyRenderScriptGL();
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- // break point at here
- // this method doesn't work when 'extends View' include 'extends ScrollView'.
- return super.onKeyDown(keyCode, event);
- }
-
-
- @Override
- public boolean onTouchEvent(MotionEvent ev)
- {
- boolean ret = true;
- int act = ev.getAction();
- if (act == ev.ACTION_UP) {
- ret = false;
- }
-
- mRender.touchEvent((int)ev.getX(), (int)ev.getY());
- return ret;
- }
-}
-
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs
deleted file mode 100644
index 3679068..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.modelviewer)
-
-#include "rs_graphics.rsh"
-#include "transform_def.rsh"
-
-rs_program_vertex gPVBackground;
-rs_program_fragment gPFBackground;
-
-rs_allocation gTGrid;
-rs_mesh gTestMesh;
-
-rs_program_store gPFSBackground;
-
-float gRotate;
-
-rs_font gItalic;
-rs_allocation gTextAlloc;
-
-rs_script gTransformRS;
-
-SgTransform *gGroup;
-SgTransform *gRobot1;
-int gRobot1Index;
-SgTransform *gRobot2;
-int gRobot2Index;
-
-SgTransform *gRootNode;
-
-void init() {
- gRotate = 0.0f;
-}
-
-int root(int launchID) {
-
- gGroup->transforms[1].w += 0.5f;
- gGroup->isDirty = 1;
-
- SgTransform *robot1Ptr = gRobot1 + gRobot1Index;
-
- robot1Ptr->transforms[1].w -= 1.5f;
- robot1Ptr->isDirty = 1;
-
- SgTransform *robot2Ptr = gRobot2 + gRobot2Index;
- robot2Ptr->transforms[1].w += 2.5f;
- robot2Ptr->isDirty = 1;
-
- rsForEach(gTransformRS, gRootNode->children, gRootNode->children, 0);
-
- rsgClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- rsgClearDepth(1.0f);
-
- rsgBindProgramVertex(gPVBackground);
- rs_matrix4x4 proj;
- float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
- rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f);
- rsgProgramVertexLoadProjectionMatrix(&proj);
-
- rsgBindProgramFragment(gPFBackground);
- rsgBindProgramStore(gPFSBackground);
- rsgBindTexture(gPFBackground, 0, gTGrid);
-
- rsgProgramVertexLoadModelMatrix(&robot1Ptr->globalMat);
- rsgDrawMesh(gTestMesh);
-
- rsgProgramVertexLoadModelMatrix(&robot2Ptr->globalMat);
- rsgDrawMesh(gTestMesh);
-
- //color(0.3f, 0.3f, 0.3f, 1.0f);
- rsgDrawText("Renderscript transform test", 30, 695);
-
- rsgBindFont(gItalic);
- rsgDrawText(gTextAlloc, 30, 730);
-
- return 10;
-}
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs
deleted file mode 100644
index 419de62..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.modelviewer)
-
-#include "rs_graphics.rsh"
-
-rs_program_vertex gPVBackground;
-rs_program_fragment gPFBackground;
-
-rs_allocation gTGrid;
-rs_mesh gTestMesh;
-
-rs_program_store gPFSBackground;
-
-float gRotate;
-
-rs_font gItalic;
-rs_allocation gTextAlloc;
-
-void init() {
- gRotate = 0.0f;
-}
-
-int root(int launchID) {
-
- rsgClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- rsgClearDepth(1.0f);
-
- rsgBindProgramVertex(gPVBackground);
- rs_matrix4x4 proj;
- float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
- rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f);
- rsgProgramVertexLoadProjectionMatrix(&proj);
-
- rsgBindProgramFragment(gPFBackground);
- rsgBindProgramStore(gPFSBackground);
- rsgBindTexture(gPFBackground, 0, gTGrid);
-
- rs_matrix4x4 matrix;
- rsMatrixLoadIdentity(&matrix);
- // Position our model on the screen
- rsMatrixTranslate(&matrix, 0.0f, -0.3f, -10.0f);
- rsMatrixScale(&matrix, 0.2f, 0.2f, 0.2f);
- rsMatrixRotate(&matrix, 25.0f, 1.0f, 0.0f, 0.0f);
- rsMatrixRotate(&matrix, gRotate, 0.0f, 1.0f, 0.0f);
- rsgProgramVertexLoadModelMatrix(&matrix);
-
- rsgDrawMesh(gTestMesh);
-
- rsgFontColor(0.3f, 0.3f, 0.3f, 1.0f);
- rsgDrawText("Renderscript model test", 30, 695);
-
- rsgBindFont(gItalic);
- rsgDrawText(gTextAlloc, 30, 730);
-
- return 10;
-}
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs
deleted file mode 100644
index f328025..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.modelviewer)
-
-#include "transform_def.rsh"
-
-rs_script transformScript;
-
-typedef struct {
- int changed;
- rs_matrix4x4 *mat;
-} ParentData;
-
-static void appendTransformation(int type, float4 data, rs_matrix4x4 *mat) {
- rs_matrix4x4 temp;
-
- switch (type) {
- case TRANSFORM_TRANSLATE:
- rsMatrixLoadTranslate(&temp, data.x, data.y, data.z);
- break;
- case TRANSFORM_ROTATE:
- rsMatrixLoadRotate(&temp, data.w, data.x, data.y, data.z);
- break;
- case TRANSFORM_SCALE:
- rsMatrixLoadScale(&temp, data.x, data.y, data.z);
- break;
- }
- rsMatrixMultiply(mat, &temp);
-}
-
-void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32_t y) {
-
- SgTransform *data = (SgTransform *)v_out;
- const ParentData *parent = (const ParentData *)usrData;
-
- //rsDebug("Transform data", (int)data);
- //rsDebug("Entering parent", (int)parent);
-
- rs_matrix4x4 *localMat = &data->localMat;
- rs_matrix4x4 *globalMat = &data->globalMat;
-
- ParentData toChild;
- toChild.changed = 0;
- toChild.mat = globalMat;
-
- //rsDebug("Transform is dirty", data->isDirty);
-
- // Refresh matrices if dirty
- if (data->isDirty) {
- data->isDirty = 0;
- toChild.changed = 1;
-
- // Reset our local matrix
- rsMatrixLoadIdentity(localMat);
-
- for (int i = 0; i < 16; i ++) {
- if (data->transformTypes[i] == TRANSFORM_NONE) {
- break;
- }
- //rsDebug("Transform adding transformation", transformTypes[i]);
- appendTransformation(data->transformTypes[i], data->transforms[i], localMat);
- }
- }
-
- //rsDebug("Transform checking parent", (int)0);
-
- if (parent) {
- if (parent->changed) {
- toChild.changed = 1;
-
- rsMatrixLoad(globalMat, parent->mat);
- rsMatrixMultiply(globalMat, localMat);
- }
- } else {
- rsMatrixLoad(globalMat, localMat);
- }
-
- //rsDebug("Transform calling self with child ", (int)data->children.p);
- if (data->children.p) {
- rsForEach(transformScript, data->children, data->children, (void*)&toChild);
- }
-}
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh
deleted file mode 100644
index 24a36c1..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.modelviewer)
-
-#define TRANSFORM_NONE 0
-#define TRANSFORM_TRANSLATE 1
-#define TRANSFORM_ROTATE 2
-#define TRANSFORM_SCALE 3
-
-typedef struct __attribute__((packed, aligned(4))) SgTransform {
- rs_matrix4x4 globalMat;
- rs_matrix4x4 localMat;
-
- float4 transforms[16];
- int transformTypes[16];
-
- int isDirty;
-
- rs_allocation children;
-
-} SgTransform;
diff --git a/libs/rs/java/Samples/_index.html b/libs/rs/java/Samples/_index.html
new file mode 100644
index 0000000..5872431
--- /dev/null
+++ b/libs/rs/java/Samples/_index.html
@@ -0,0 +1 @@
+<p>A set of samples that demonstrate how to use various features of the Renderscript APIs.</p>
\ No newline at end of file
diff --git a/libs/rs/java/_index.html b/libs/rs/java/_index.html
new file mode 100644
index 0000000..5872431
--- /dev/null
+++ b/libs/rs/java/_index.html
@@ -0,0 +1 @@
+<p>A set of samples that demonstrate how to use various features of the Renderscript APIs.</p>
\ No newline at end of file
diff --git a/libs/rs/java/tests/Android.mk b/libs/rs/java/tests/Android.mk
deleted file mode 100644
index 6c992d5..0000000
--- a/libs/rs/java/tests/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifneq ($(TARGET_SIMULATOR),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RSTest
-
-include $(BUILD_PACKAGE)
-
-endif
diff --git a/libs/rs/java/tests/AndroidManifest.xml b/libs/rs/java/tests/AndroidManifest.xml
deleted file mode 100644
index b660398..0000000
--- a/libs/rs/java/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.rs.test">
- <application
- android:label="_RS_Test"
- android:icon="@drawable/test_pattern">
- <activity android:name="RSTest"
- android:screenOrientation="portrait">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/libs/rs/java/tests/res/drawable/test_pattern.png b/libs/rs/java/tests/res/drawable/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/libs/rs/java/tests/res/drawable/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/tests/src/com/android/rs/test/RSTest.java b/libs/rs/java/tests/src/com/android/rs/test/RSTest.java
deleted file mode 100644
index 6b8fa6b..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/RSTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Config;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class RSTest extends Activity {
- //EventListener mListener = new EventListener();
-
- private static final String LOG_TAG = "libRS_jni";
- private static final boolean DEBUG = false;
- private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
-
- private RSTestView mView;
-
- // get the current looper (from your Activity UI thread for instance
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- // Create our Preview view and set it as the content of our
- // Activity
- mView = new RSTestView(this);
- setContentView(mView);
- }
-
- @Override
- protected void onResume() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity loses focus
- super.onResume();
- mView.resume();
- }
-
- @Override
- protected void onPause() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity loses focus
- super.onPause();
- mView.pause();
- }
-
- static void log(String message) {
- if (LOG_ENABLED) {
- Log.v(LOG_TAG, message);
- }
- }
-
-
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java b/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java
deleted file mode 100644
index 541bf22..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.ArrayList;
-import java.util.ListIterator;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class RSTestCore {
- int mWidth;
- int mHeight;
- Context mCtx;
-
- public RSTestCore(Context ctx) {
- mCtx = ctx;
- }
-
- private Resources mRes;
- private RenderScriptGL mRS;
-
- private Font mFont;
- ScriptField_ListAllocs_s mListAllocs;
- int mLastX;
- int mLastY;
- private ScriptC_rslist mScript;
-
- private ArrayList<UnitTest> unitTests;
- private ListIterator<UnitTest> test_iter;
- private UnitTest activeTest;
- private boolean stopTesting;
-
- /* Periodic timer for ensuring future tests get scheduled */
- private Timer mTimer;
- public static final int RS_TIMER_PERIOD = 100;
-
- public void init(RenderScriptGL rs, Resources res, int width, int height) {
- mRS = rs;
- mRes = res;
- mWidth = width;
- mHeight = height;
- stopTesting = false;
-
- mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
-
- unitTests = new ArrayList<UnitTest>();
-
- unitTests.add(new UT_primitives(this, mRes, mCtx));
- unitTests.add(new UT_rsdebug(this, mRes, mCtx));
- unitTests.add(new UT_rstime(this, mRes, mCtx));
- unitTests.add(new UT_rstypes(this, mRes, mCtx));
- unitTests.add(new UT_math(this, mRes, mCtx));
- unitTests.add(new UT_fp_mad(this, mRes, mCtx));
- /*
- unitTests.add(new UnitTest(null, "<Pass>", 1));
- unitTests.add(new UnitTest());
- unitTests.add(new UnitTest(null, "<Fail>", -1));
-
- for (int i = 0; i < 20; i++) {
- unitTests.add(new UnitTest(null, "<Pass>", 1));
- }
- */
-
- UnitTest [] uta = new UnitTest[unitTests.size()];
- uta = unitTests.toArray(uta);
-
- mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
- for (int i = 0; i < uta.length; i++) {
- ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
- listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
- listElem.result = uta[i].result;
- mListAllocs.set(listElem, i, false);
- uta[i].setItem(listElem);
- }
-
- mListAllocs.copyAll();
-
- mScript.bind_gList(mListAllocs);
-
- mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
- mScript.set_gFont(mFont);
-
- mRS.bindRootScript(mScript);
-
- test_iter = unitTests.listIterator();
- refreshTestResults(); /* Kick off the first test */
-
- TimerTask pTask = new TimerTask() {
- public void run() {
- refreshTestResults();
- }
- };
-
- mTimer = new Timer();
- mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
- }
-
- public void checkAndRunNextTest() {
- if (activeTest != null) {
- if (!activeTest.isAlive()) {
- /* Properly clean up on our last test */
- try {
- activeTest.join();
- }
- catch (InterruptedException e) {
- }
- activeTest = null;
- }
- }
-
- if (!stopTesting && activeTest == null) {
- if (test_iter.hasNext()) {
- activeTest = test_iter.next();
- activeTest.start();
- /* This routine will only get called once when a new test
- * should start running. The message handler in UnitTest.java
- * ensures this. */
- }
- else {
- if (mTimer != null) {
- mTimer.cancel();
- mTimer.purge();
- mTimer = null;
- }
- }
- }
- }
-
- public void refreshTestResults() {
- checkAndRunNextTest();
-
- if (mListAllocs != null && mScript != null && mRS != null) {
- mListAllocs.copyAll();
-
- mScript.bind_gList(mListAllocs);
- mRS.bindRootScript(mScript);
- }
- }
-
- public void cleanup() {
- stopTesting = true;
- UnitTest t = activeTest;
-
- /* Stop periodic refresh of testing */
- if (mTimer != null) {
- mTimer.cancel();
- mTimer.purge();
- mTimer = null;
- }
-
- /* Wait to exit until we finish the current test */
- if (t != null) {
- try {
- t.join();
- }
- catch (InterruptedException e) {
- }
- t = null;
- }
-
- }
-
- public void newTouchPosition(float x, float y, float pressure, int id) {
- }
-
- public void onActionDown(int x, int y) {
- mScript.set_gDY(0.0f);
- mLastX = x;
- mLastY = y;
- refreshTestResults();
- }
-
- public void onActionMove(int x, int y) {
- int dx = mLastX - x;
- int dy = mLastY - y;
-
- if (Math.abs(dy) <= 2) {
- dy = 0;
- }
-
- mScript.set_gDY(dy);
-
- mLastX = x;
- mLastY = y;
- refreshTestResults();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java b/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java
deleted file mode 100644
index 368f286..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class RSTestView extends RSSurfaceView {
-
- private Context mCtx;
-
- public RSTestView(Context context) {
- super(context);
- mCtx = context;
- //setFocusable(true);
- }
-
- private RenderScriptGL mRS;
- private RSTestCore mRender;
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- super.surfaceChanged(holder, format, w, h);
- if (mRS == null) {
- RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
- mRS = createRenderScriptGL(sc);
- mRS.setSurface(holder, w, h);
- mRender = new RSTestCore(mCtx);
- mRender.init(mRS, getResources(), w, h);
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- if(mRS != null) {
- mRender.cleanup();
- mRS = null;
- destroyRenderScriptGL();
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- return super.onKeyDown(keyCode, event);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev)
- {
- boolean ret = false;
- int act = ev.getAction();
- if (act == ev.ACTION_DOWN) {
- mRender.onActionDown((int)ev.getX(), (int)ev.getY());
- ret = true;
- }
- else if (act == ev.ACTION_MOVE) {
- mRender.onActionMove((int)ev.getX(), (int)ev.getY());
- ret = true;
- }
-
- return ret;
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java b/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java
deleted file mode 100644
index f2c91af..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_fp_mad extends UnitTest {
- private Resources mRes;
-
- protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "Fp_Mad", ctx);
- mRes = res;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
- pRS.setMessageHandler(mRsMessage);
- s.invoke_fp_mad_test(0, 0);
- pRS.finish();
- waitForMessage();
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_math.java b/libs/rs/java/tests/src/com/android/rs/test/UT_math.java
deleted file mode 100644
index bf133be..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_math.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_math extends UnitTest {
- private Resources mRes;
-
- protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "Math", ctx);
- mRes = res;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_math s = new ScriptC_math(pRS, mRes, R.raw.math);
- pRS.setMessageHandler(mRsMessage);
- s.invoke_math_test(0, 0);
- pRS.finish();
- waitForMessage();
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java b/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
deleted file mode 100644
index b7a65a5..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_primitives extends UnitTest {
- private Resources mRes;
-
- protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "Primitives", ctx);
- mRes = res;
- }
-
- private boolean initializeGlobals(ScriptC_primitives s) {
- float pF = s.get_floatTest();
- if (pF != 1.99f) {
- return false;
- }
- s.set_floatTest(2.99f);
-
- double pD = s.get_doubleTest();
- if (pD != 2.05) {
- return false;
- }
- s.set_doubleTest(3.05);
-
- byte pC = s.get_charTest();
- if (pC != -8) {
- return false;
- }
- s.set_charTest((byte)-16);
-
- short pS = s.get_shortTest();
- if (pS != -16) {
- return false;
- }
- s.set_shortTest((short)-32);
-
- int pI = s.get_intTest();
- if (pI != -32) {
- return false;
- }
- s.set_intTest(-64);
-
- long pL = s.get_longTest();
- if (pL != 17179869184l) {
- return false;
- }
- s.set_longTest(17179869185l);
-
- long puL = s.get_ulongTest();
- if (puL != 4611686018427387904L) {
- return false;
- }
- s.set_ulongTest(4611686018427387903L);
-
-
- long pLL = s.get_longlongTest();
- if (pLL != 68719476736L) {
- return false;
- }
- s.set_longlongTest(68719476735L);
-
- long pu64 = s.get_uint64_tTest();
- if (pu64 != 117179869184l) {
- return false;
- }
- s.set_uint64_tTest(117179869185l);
-
- return true;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
- pRS.setMessageHandler(mRsMessage);
- if (!initializeGlobals(s)) {
- // initializeGlobals failed
- result = -1;
- } else {
- s.invoke_primitives_test(0, 0);
- pRS.finish();
- waitForMessage();
- }
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java b/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java
deleted file mode 100644
index 0614b1a..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rsdebug extends UnitTest {
- private Resources mRes;
-
- protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "rsDebug", ctx);
- mRes = res;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
- pRS.setMessageHandler(mRsMessage);
- s.invoke_test_rsdebug(0, 0);
- pRS.finish();
- waitForMessage();
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_rstime.java b/libs/rs/java/tests/src/com/android/rs/test/UT_rstime.java
deleted file mode 100644
index f302e1a..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_rstime.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstime extends UnitTest {
- private Resources mRes;
-
- protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "rsTime", ctx);
- mRes = res;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_rstime s = new ScriptC_rstime(pRS, mRes, R.raw.rstime);
- pRS.setMessageHandler(mRsMessage);
- s.invoke_test_rstime(0, 0);
- pRS.finish();
- waitForMessage();
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java b/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java
deleted file mode 100644
index 74211c8..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstypes extends UnitTest {
- private Resources mRes;
-
- protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
- super(rstc, "rsTypes", ctx);
- mRes = res;
- }
-
- public void run() {
- RenderScript pRS = RenderScript.create(mCtx);
- ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
- pRS.setMessageHandler(mRsMessage);
- s.invoke_test_rstypes(0, 0);
- pRS.finish();
- waitForMessage();
- pRS.destroy();
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java b/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
deleted file mode 100644
index a7722c7..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.rs.test;
-import android.content.Context;
-import android.renderscript.RenderScript.RSMessageHandler;
-import android.util.Log;
-
-public class UnitTest extends Thread {
- public String name;
- public int result;
- private ScriptField_ListAllocs_s.Item mItem;
- private RSTestCore mRSTC;
- private boolean msgHandled;
- protected Context mCtx;
-
- /* These constants must match those in shared.rsh */
- public static final int RS_MSG_TEST_PASSED = 100;
- public static final int RS_MSG_TEST_FAILED = 101;
-
- private static int numTests = 0;
- public int testID;
-
- protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
- super();
- mRSTC = rstc;
- name = n;
- msgHandled = false;
- mCtx = ctx;
- result = initResult;
- testID = numTests++;
- }
-
- protected UnitTest(RSTestCore rstc, String n, Context ctx) {
- this(rstc, n, 0, ctx);
- }
-
- protected UnitTest(RSTestCore rstc, Context ctx) {
- this (rstc, "<Unknown>", ctx);
- }
-
- protected UnitTest(Context ctx) {
- this (null, ctx);
- }
-
- protected RSMessageHandler mRsMessage = new RSMessageHandler() {
- public void run() {
- if (result == 0) {
- switch (mID) {
- case RS_MSG_TEST_PASSED:
- result = 1;
- break;
- case RS_MSG_TEST_FAILED:
- result = -1;
- break;
- default:
- android.util.Log.v("RenderScript", "Unit test got unexpected message");
- return;
- }
- }
-
- if (mItem != null) {
- mItem.result = result;
- msgHandled = true;
- try {
- mRSTC.refreshTestResults();
- }
- catch (IllegalStateException e) {
- /* Ignore the case where our message receiver has been
- disconnected. This happens when we leave the application
- before it finishes running all of the unit tests. */
- }
- }
- }
- };
-
- public void waitForMessage() {
- while (!msgHandled) {
- yield();
- }
- }
-
- public void setItem(ScriptField_ListAllocs_s.Item item) {
- mItem = item;
- }
-
- public void run() {
- /* This method needs to be implemented for each subclass */
- if (mRSTC != null) {
- mRSTC.refreshTestResults();
- }
- }
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/fp_mad.rs b/libs/rs/java/tests/src/com/android/rs/test/fp_mad.rs
deleted file mode 100644
index b6f2b2a6..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/fp_mad.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "shared.rsh"
-
-const int TEST_COUNT = 1;
-
-static float data_f1[1025];
-static float4 data_f4[1025];
-
-static void test_mad4(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~1 billion ops
- for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
- for (int i=0; i < (1000); i++) {
- data_f4[i] = (data_f4[i] * 0.02f +
- data_f4[i+1] * 0.04f +
- data_f4[i+2] * 0.05f +
- data_f4[i+3] * 0.1f +
- data_f4[i+4] * 0.2f +
- data_f4[i+5] * 0.2f +
- data_f4[i+6] * 0.1f +
- data_f4[i+7] * 0.05f +
- data_f4[i+8] * 0.04f +
- data_f4[i+9] * 0.02f + 1.f);
- }
- }
-
- float time = end(index);
- rsDebug("fp_mad4 M ops", 1000.f / time);
-}
-
-static void test_mad(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~1 billion ops
- for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
- for (int i=0; i < (1000); i++) {
- data_f1[i] = (data_f1[i] * 0.02f +
- data_f1[i+1] * 0.04f +
- data_f1[i+2] * 0.05f +
- data_f1[i+3] * 0.1f +
- data_f1[i+4] * 0.2f +
- data_f1[i+5] * 0.2f +
- data_f1[i+6] * 0.1f +
- data_f1[i+7] * 0.05f +
- data_f1[i+8] * 0.04f +
- data_f1[i+9] * 0.02f + 1.f);
- }
- }
-
- float time = end(index);
- rsDebug("fp_mad M ops", 1000.f / time);
-}
-
-static void test_norm(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~10 M ops
- for (int ct=0; ct < 1000 * 10; ct++) {
- for (int i=0; i < (1000); i++) {
- data_f4[i] = normalize(data_f4[i]);
- }
- }
-
- float time = end(index);
- rsDebug("fp_norm M ops", 10.f / time);
-}
-
-static void test_sincos4(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~10 M ops
- for (int ct=0; ct < 1000 * 10 / 4; ct++) {
- for (int i=0; i < (1000); i++) {
- data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
- }
- }
-
- float time = end(index);
- rsDebug("fp_sincos4 M ops", 10.f / time);
-}
-
-static void test_sincos(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~10 M ops
- for (int ct=0; ct < 1000 * 10; ct++) {
- for (int i=0; i < (1000); i++) {
- data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
- }
- }
-
- float time = end(index);
- rsDebug("fp_sincos M ops", 10.f / time);
-}
-
-static void test_clamp(uint32_t index) {
- start();
-
- // Do ~100 M ops
- for (int ct=0; ct < 1000 * 100; ct++) {
- for (int i=0; i < (1000); i++) {
- data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
- }
- }
-
- float time = end(index);
- rsDebug("fp_clamp M ops", 100.f / time);
-
- start();
- // Do ~100 M ops
- for (int ct=0; ct < 1000 * 100; ct++) {
- for (int i=0; i < (1000); i++) {
- if (data_f1[i] < -1.f) data_f1[i] = -1.f;
- if (data_f1[i] > -1.f) data_f1[i] = 1.f;
- }
- }
-
- time = end(index);
- rsDebug("fp_clamp ref M ops", 100.f / time);
-}
-
-static void test_clamp4(uint32_t index) {
- start();
-
- float total = 0;
- // Do ~100 M ops
- for (int ct=0; ct < 1000 * 100 /4; ct++) {
- for (int i=0; i < (1000); i++) {
- data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
- }
- }
-
- float time = end(index);
- rsDebug("fp_clamp4 M ops", 100.f / time);
-}
-
-void fp_mad_test(uint32_t index, int test_num) {
- int x;
- for (x=0; x < 1025; x++) {
- data_f1[x] = (x & 0xf) * 0.1f;
- data_f4[x].x = (x & 0xf) * 0.1f;
- data_f4[x].y = (x & 0xf0) * 0.1f;
- data_f4[x].z = (x & 0x33) * 0.1f;
- data_f4[x].w = (x & 0x77) * 0.1f;
- }
-
- test_mad4(index);
- test_mad(index);
-
- for (x=0; x < 1025; x++) {
- data_f1[x] = (x & 0xf) * 0.1f + 1.f;
- data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
- data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
- data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
- data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
- }
-
- test_norm(index);
- test_sincos4(index);
- test_sincos(index);
- test_clamp4(index);
- test_clamp(index);
-
- // TODO Actually verify test result accuracy
- rsDebug("fp_mad_test PASSED", 0);
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/math.rs b/libs/rs/java/tests/src/com/android/rs/test/math.rs
deleted file mode 100644
index 8cad82b..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/math.rs
+++ /dev/null
@@ -1,322 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define TEST_FN_FUNC_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1); \
- f2 = fnc(f2); \
- f3 = fnc(f3); \
- f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, (float*) &f1); \
- f2 = fnc(f2, (float2*) &f2); \
- f3 = fnc(f3, (float3*) &f3); \
- f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1); \
- f2 = fnc(f2, f2); \
- f3 = fnc(f3, f3); \
- f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1); \
- f2 = fnc(f2, f1); \
- f3 = fnc(f3, f1); \
- f4 = fnc(f4, f1);
-
-#define TEST_FN_FUNC_FN_IN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, i1); \
- f2 = fnc(f2, i2); \
- f3 = fnc(f3, i3); \
- f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, i1); \
- f2 = fnc(f2, i1); \
- f3 = fnc(f3, i1); \
- f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1, f1); \
- f2 = fnc(f2, f2, f2); \
- f3 = fnc(f3, f3, f3); \
- f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_PIN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, (int*) &i1); \
- f2 = fnc(f2, (int2*) &i2); \
- f3 = fnc(f3, (int3*) &i3); \
- f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1, (int*) &i1); \
- f2 = fnc(f2, f2, (int2*) &i2); \
- f3 = fnc(f3, f3, (int3*) &i3); \
- f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- i1 = fnc(f1); \
- i2 = fnc(f2); \
- i3 = fnc(f3); \
- i4 = fnc(f4);
-
-
-static bool test_fp_math(uint32_t index) {
- bool failed = false;
- start();
-
- TEST_FN_FUNC_FN(acos);
- TEST_FN_FUNC_FN(acosh);
- TEST_FN_FUNC_FN(acospi);
- TEST_FN_FUNC_FN(asin);
- TEST_FN_FUNC_FN(asinh);
- TEST_FN_FUNC_FN(asinpi);
- TEST_FN_FUNC_FN(atan);
- TEST_FN_FUNC_FN_FN(atan2);
- TEST_FN_FUNC_FN(atanh);
- TEST_FN_FUNC_FN(atanpi);
- TEST_FN_FUNC_FN_FN(atan2pi);
- TEST_FN_FUNC_FN(cbrt);
- TEST_FN_FUNC_FN(ceil);
- TEST_FN_FUNC_FN_FN(copysign);
- TEST_FN_FUNC_FN(cos);
- TEST_FN_FUNC_FN(cosh);
- TEST_FN_FUNC_FN(cospi);
- TEST_FN_FUNC_FN(erfc);
- TEST_FN_FUNC_FN(erf);
- TEST_FN_FUNC_FN(exp);
- TEST_FN_FUNC_FN(exp2);
- TEST_FN_FUNC_FN(exp10);
- TEST_FN_FUNC_FN(expm1);
- TEST_FN_FUNC_FN(fabs);
- TEST_FN_FUNC_FN_FN(fdim);
- TEST_FN_FUNC_FN(floor);
- TEST_FN_FUNC_FN_FN_FN(fma);
- TEST_FN_FUNC_FN_FN(fmax);
- TEST_FN_FUNC_FN_F(fmax);
- TEST_FN_FUNC_FN_FN(fmin);
- TEST_FN_FUNC_FN_F(fmin);
- TEST_FN_FUNC_FN_FN(fmod);
- TEST_FN_FUNC_FN_PFN(fract);
- TEST_FN_FUNC_FN_PIN(frexp);
- TEST_FN_FUNC_FN_FN(hypot);
- TEST_IN_FUNC_FN(ilogb);
- TEST_FN_FUNC_FN_IN(ldexp);
- TEST_FN_FUNC_FN_I(ldexp);
- TEST_FN_FUNC_FN(lgamma);
- TEST_FN_FUNC_FN_PIN(lgamma);
- TEST_FN_FUNC_FN(log);
- TEST_FN_FUNC_FN(log2);
- TEST_FN_FUNC_FN(log10);
- TEST_FN_FUNC_FN(log1p);
- TEST_FN_FUNC_FN(logb);
- TEST_FN_FUNC_FN_FN_FN(mad);
- TEST_FN_FUNC_FN_PFN(modf);
- // nan
- TEST_FN_FUNC_FN_FN(nextafter);
- TEST_FN_FUNC_FN_FN(pow);
- TEST_FN_FUNC_FN_IN(pown);
- TEST_FN_FUNC_FN_FN(powr);
- TEST_FN_FUNC_FN_FN(remainder);
- TEST_FN_FUNC_FN_FN_PIN(remquo);
- TEST_FN_FUNC_FN(rint);
- TEST_FN_FUNC_FN_IN(rootn);
- TEST_FN_FUNC_FN(round);
- TEST_FN_FUNC_FN(rsqrt);
- TEST_FN_FUNC_FN(sin);
- TEST_FN_FUNC_FN_PFN(sincos);
- TEST_FN_FUNC_FN(sinh);
- TEST_FN_FUNC_FN(sinpi);
- TEST_FN_FUNC_FN(sqrt);
- TEST_FN_FUNC_FN(tan);
- TEST_FN_FUNC_FN(tanh);
- TEST_FN_FUNC_FN(tanpi);
- TEST_FN_FUNC_FN(tgamma);
- TEST_FN_FUNC_FN(trunc);
-
- float time = end(index);
-
- if (failed) {
- rsDebug("test_fp_math FAILED", time);
- }
- else {
- rsDebug("test_fp_math PASSED", time);
- }
-
- return failed;
-}
-
-#define DECL_INT(prefix) \
-volatile char prefix##_c_1 = 1; \
-volatile char2 prefix##_c_2 = 1; \
-volatile char3 prefix##_c_3 = 1; \
-volatile char4 prefix##_c_4 = 1; \
-volatile uchar prefix##_uc_1 = 1; \
-volatile uchar2 prefix##_uc_2 = 1; \
-volatile uchar3 prefix##_uc_3 = 1; \
-volatile uchar4 prefix##_uc_4 = 1; \
-volatile short prefix##_s_1 = 1; \
-volatile short2 prefix##_s_2 = 1; \
-volatile short3 prefix##_s_3 = 1; \
-volatile short4 prefix##_s_4 = 1; \
-volatile ushort prefix##_us_1 = 1; \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1; \
-volatile int2 prefix##_i_2 = 1; \
-volatile int3 prefix##_i_3 = 1; \
-volatile int4 prefix##_i_4 = 1; \
-volatile uint prefix##_ui_1 = 1; \
-volatile uint2 prefix##_ui_2 = 1; \
-volatile uint3 prefix##_ui_3 = 1; \
-volatile uint4 prefix##_ui_4 = 1; \
-volatile long prefix##_l_1 = 1; \
-volatile ulong prefix##_ul_1 = 1;
-
-#define TEST_INT_OP_TYPE(op, type) \
-rsDebug("Testing " #op " for " #type "1", i++); \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1; \
-rsDebug("Testing " #op " for " #type "2", i++); \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2; \
-rsDebug("Testing " #op " for " #type "3", i++); \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3; \
-rsDebug("Testing " #op " for " #type "4", i++); \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op) \
-TEST_INT_OP_TYPE(op, c) \
-TEST_INT_OP_TYPE(op, uc) \
-TEST_INT_OP_TYPE(op, s) \
-TEST_INT_OP_TYPE(op, us) \
-TEST_INT_OP_TYPE(op, i) \
-TEST_INT_OP_TYPE(op, ui) \
-rsDebug("Testing " #op " for l1", i++); \
-res_l_1 = src1_l_1 op src2_l_1; \
-rsDebug("Testing " #op " for ul1", i++); \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-static bool test_basic_operators() {
- bool failed = false;
- int i = 0;
-
- TEST_INT_OP(+);
- TEST_INT_OP(-);
- TEST_INT_OP(*);
- TEST_INT_OP(/);
- TEST_INT_OP(%);
- TEST_INT_OP(<<);
- TEST_INT_OP(>>);
-
- if (failed) {
- rsDebug("test_basic_operators FAILED", 0);
- }
- else {
- rsDebug("test_basic_operators PASSED", 0);
- }
-
- return failed;
-}
-
-#define TEST_CVT(to, from, type) \
-rsDebug("Testing convert from " #from " to " #to, 0); \
-to##1 = from##1; \
-to##2 = convert_##type##2(from##2); \
-to##3 = convert_##type##3(from##3); \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type) \
-TEST_CVT(to, c, type); \
-TEST_CVT(to, uc, type); \
-TEST_CVT(to, s, type); \
-TEST_CVT(to, us, type); \
-TEST_CVT(to, i, type); \
-TEST_CVT(to, ui, type); \
-TEST_CVT(to, f, type); \
-
-static bool test_convert() {
- bool failed = false;
-
- TEST_CVT_MATRIX(c, char);
- TEST_CVT_MATRIX(uc, uchar);
- TEST_CVT_MATRIX(s, short);
- TEST_CVT_MATRIX(us, ushort);
- TEST_CVT_MATRIX(i, int);
- TEST_CVT_MATRIX(ui, uint);
- TEST_CVT_MATRIX(f, float);
-
- if (failed) {
- rsDebug("test_convert FAILED", 0);
- }
- else {
- rsDebug("test_convert PASSED", 0);
- }
-
- return failed;
-}
-
-void math_test(uint32_t index, int test_num) {
- bool failed = false;
- failed |= test_convert();
- failed |= test_fp_math(index);
- failed |= test_basic_operators();
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- }
-}
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/primitives.rs b/libs/rs/java/tests/src/com/android/rs/test/primitives.rs
deleted file mode 100644
index ce451da..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/primitives.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool test_primitive_types(uint32_t index) {
- bool failed = false;
- start();
-
- _RS_ASSERT(floatTest == 2.99f);
- _RS_ASSERT(doubleTest == 3.05);
- _RS_ASSERT(charTest == -16);
- _RS_ASSERT(shortTest == -32);
- _RS_ASSERT(intTest == -64);
- _RS_ASSERT(longTest == 17179869185l);
- _RS_ASSERT(longlongTest == 68719476735l);
-
- _RS_ASSERT(ucharTest == 8);
- _RS_ASSERT(ushortTest == 16);
- _RS_ASSERT(uintTest == 32);
- _RS_ASSERT(ulongTest == 4611686018427387903L);
- _RS_ASSERT(int64_tTest == -17179869184l);
- _RS_ASSERT(uint64_tTest == 117179869185l);
-
- float time = end(index);
-
- if (failed) {
- rsDebug("test_primitives FAILED", time);
- }
- else {
- rsDebug("test_primitives PASSED", time);
- }
-
- return failed;
-}
-
-void primitives_test(uint32_t index, int test_num) {
- bool failed = false;
- failed |= test_primitive_types(index);
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- }
-}
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/rsdebug.rs b/libs/rs/java/tests/src/com/android/rs/test/rsdebug.rs
deleted file mode 100644
index f7942a5..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/rsdebug.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool basic_test(uint32_t index) {
- bool failed = false;
-
- // This test focuses primarily on compilation-time, not run-time.
- // For this reason, none of the outputs are actually checked.
-
- rsDebug("floatTest", floatTest);
- rsDebug("doubleTest", doubleTest);
- rsDebug("charTest", charTest);
- rsDebug("shortTest", shortTest);
- rsDebug("intTest", intTest);
- rsDebug("longTest", longTest);
- rsDebug("longlongTest", longlongTest);
-
- rsDebug("ucharTest", ucharTest);
- rsDebug("ushortTest", ushortTest);
- rsDebug("uintTest", uintTest);
- rsDebug("ulongTest", ulongTest);
- rsDebug("int64_tTest", int64_tTest);
- rsDebug("uint64_tTest", uint64_tTest);
-
- return failed;
-}
-
-void test_rsdebug(uint32_t index, int test_num) {
- bool failed = false;
- failed |= basic_test(index);
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- rsDebug("rsdebug_test FAILED", -1);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- rsDebug("rsdebug_test PASSED", 0);
- }
-}
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/rslist.rs b/libs/rs/java/tests/src/com/android/rs/test/rslist.rs
deleted file mode 100644
index 67c2b86..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/rslist.rs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-#include "rs_graphics.rsh"
-
-float gDY;
-
-rs_font gFont;
-
-typedef struct ListAllocs_s {
- rs_allocation text;
- int result;
-} ListAllocs;
-
-ListAllocs *gList;
-
-void init() {
- gDY = 0.0f;
-}
-
-int textPos = 0;
-
-int root(int launchID) {
-
- rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- rsgClearDepth(1.0f);
-
- textPos -= (int)gDY*2;
- gDY *= 0.95;
-
- rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
- rsgBindFont(gFont);
-
- rs_allocation listAlloc;
- rsSetObject(&listAlloc, rsGetAllocation(gList));
- int allocSize = rsAllocationGetDimX(listAlloc);
-
- int width = rsgGetWidth();
- int height = rsgGetHeight();
-
- int itemHeight = 80;
- int totalItemHeight = itemHeight * allocSize;
-
- /* Prevent scrolling above the top of the list */
- int firstItem = height - totalItemHeight;
- if (firstItem < 0) {
- firstItem = 0;
- }
-
- /* Prevent scrolling past the last line of the list */
- int lastItem = -1 * (totalItemHeight - height);
- if (lastItem > 0) {
- lastItem = 0;
- }
-
- if (textPos > firstItem) {
- textPos = firstItem;
- }
- else if (textPos < lastItem) {
- textPos = lastItem;
- }
-
- int currentYPos = itemHeight + textPos;
-
- for(int i = 0; i < allocSize; i ++) {
- if(currentYPos - itemHeight > height) {
- break;
- }
-
- if(currentYPos > 0) {
- switch(gList[i].result) {
- case 1: /* Passed */
- rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
- break;
- case -1: /* Failed */
- rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
- break;
- case 0: /* Still Testing */
- rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
- break;
- default: /* Unknown */
- rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
- break;
- }
- rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
- rsgDrawText(gList[i].text, 30, currentYPos - 32);
- }
- currentYPos += itemHeight;
- }
-
- return 10;
-}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/rstime.rs b/libs/rs/java/tests/src/com/android/rs/test/rstime.rs
deleted file mode 100644
index 5e3e078..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/rstime.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "shared.rsh"
-
-static bool basic_test(uint32_t index) {
- bool failed = false;
-
- rs_time_t curTime = rsTime(0);
- rs_tm tm;
- rsDebug("curTime", curTime);
-
- rsLocaltime(&tm, &curTime);
-
- rsDebug("tm.tm_sec", tm.tm_sec);
- rsDebug("tm.tm_min", tm.tm_min);
- rsDebug("tm.tm_hour", tm.tm_hour);
- rsDebug("tm.tm_mday", tm.tm_mday);
- rsDebug("tm.tm_mon", tm.tm_mon);
- rsDebug("tm.tm_year", tm.tm_year);
- rsDebug("tm.tm_wday", tm.tm_wday);
- rsDebug("tm.tm_yday", tm.tm_yday);
- rsDebug("tm.tm_isdst", tm.tm_isdst);
-
- // Test a specific time (only valid for PST localtime)
- curTime = 1294438893;
- rsLocaltime(&tm, &curTime);
-
- _RS_ASSERT(tm.tm_sec == 33);
- _RS_ASSERT(tm.tm_min == 21);
- _RS_ASSERT(tm.tm_hour == 14);
- _RS_ASSERT(tm.tm_mday == 7);
- _RS_ASSERT(tm.tm_mon == 0);
- _RS_ASSERT(tm.tm_year == 111);
- _RS_ASSERT(tm.tm_wday == 5);
- _RS_ASSERT(tm.tm_yday == 6);
- _RS_ASSERT(tm.tm_isdst == 0);
-
- return failed;
-}
-
-void test_rstime(uint32_t index, int test_num) {
- bool failed = false;
- failed |= basic_test(index);
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- rsDebug("rstime_test FAILED", -1);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- rsDebug("rstime_test PASSED", 0);
- }
-}
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/rstypes.rs b/libs/rs/java/tests/src/com/android/rs/test/rstypes.rs
deleted file mode 100644
index f3bf244..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/rstypes.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element elementTest;
-rs_type typeTest;
-rs_allocation allocationTest;
-rs_sampler samplerTest;
-rs_script scriptTest;
-rs_mesh meshTest;
-rs_program_fragment program_fragmentTest;
-rs_program_vertex program_vertexTest;
-rs_program_raster program_rasterTest;
-rs_program_store program_storeTest;
-rs_font fontTest;
-
-rs_matrix4x4 matrix4x4Test;
-rs_matrix3x3 matrix3x3Test;
-rs_matrix2x2 matrix2x2Test;
-
-struct my_struct {
- int i;
- rs_font fontTestStruct;
-};
-
-static bool basic_test(uint32_t index) {
- bool failed = false;
-
- rs_matrix4x4 matrix4x4TestLocal;
- rs_matrix3x3 matrix3x3TestLocal;
- rs_matrix2x2 matrix2x2TestLocal;
-
- // This test focuses primarily on compilation-time, not run-time.
- rs_element elementTestLocal;
- rs_type typeTestLocal;
- rs_allocation allocationTestLocal;
- rs_sampler samplerTestLocal;
- rs_script scriptTestLocal;
- rs_mesh meshTestLocal;
- rs_program_fragment program_fragmentTestLocal;
- rs_program_vertex program_vertexTestLocal;
- rs_program_raster program_rasterTestLocal;
- rs_program_store program_storeTestLocal;
- rs_font fontTestLocal;
-
- rs_font fontTestLocalArray[4];
-
- rs_font fontTestLocalPreInit = fontTest;
-
- struct my_struct structTest;
-
- rsSetObject(&fontTestLocal, fontTest);
- //allocationTestLocal = allocationTest;
-
- rsSetObject(&fontTest, fontTestLocal);
- //allocationTest = allocationTestLocal;
-
- /*for (int i = 0; i < 4; i++) {
- rsSetObject(&fontTestLocalArray[i], fontTestLocal);
- }*/
-
- /*rsSetObject(&fontTest, fontTestLocalArray[3]);*/
-
- return failed;
-}
-
-void test_rstypes(uint32_t index, int test_num) {
- bool failed = false;
- failed |= basic_test(index);
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- rsDebug("rstypes_test FAILED", -1);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- rsDebug("rstypes_test PASSED", 0);
- }
-}
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/shared.rsh b/libs/rs/java/tests/src/com/android/rs/test/shared.rsh
deleted file mode 100644
index 21be9af..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/shared.rsh
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-typedef struct TestResult_s {
- rs_allocation name;
- bool pass;
- float score;
- int64_t time;
-} TestResult;
-//TestResult *g_results;
-
-static int64_t g_time;
-
-static void start(void) {
- g_time = rsUptimeMillis();
-}
-
-static float end(uint32_t idx) {
- int64_t t = rsUptimeMillis() - g_time;
- //g_results[idx].time = t;
- //rsDebug("test time", (int)t);
- return ((float)t) / 1000.f;
-}
-
-#define _RS_ASSERT(b) \
-do { \
- if (!(b)) { \
- failed = true; \
- rsDebug(#b " FAILED", 0); \
- } \
-\
-} while (0)
-
-/* These constants must match those in UnitTest.java */
-static const int RS_MSG_TEST_PASSED = 100;
-static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/test_root.rs b/libs/rs/java/tests/src/com/android/rs/test/test_root.rs
deleted file mode 100644
index 6dc83ba..0000000
--- a/libs/rs/java/tests/src/com/android/rs/test/test_root.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Fountain test script
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-#pragma stateFragment(parent)
-
-#include "rs_graphics.rsh"
-
-
-typedef struct TestResult {
- rs_allocation name;
- bool pass;
- float score;
-} TestResult_t;
-TestResult_t *results;
-
-int root() {
-
- return 0;
-}
-
-