diff options
| author | Stephen Hines <srhines@google.com> | 2011-05-18 13:15:01 -0700 |
|---|---|---|
| committer | Stephen Hines <srhines@google.com> | 2011-05-18 13:15:01 -0700 |
| commit | 06819a6a547578ea41548f3d6d932e111b8a850a (patch) | |
| tree | 5c24b2b398c213acb856d4d81074827894e6302c /samples/RenderScript | |
| parent | ad41ab204dd4f9474dc690fe7afa19a817bc9f32 (diff) | |
| download | android_development-06819a6a547578ea41548f3d6d932e111b8a850a.tar.gz android_development-06819a6a547578ea41548f3d6d932e111b8a850a.tar.bz2 android_development-06819a6a547578ea41548f3d6d932e111b8a850a.zip | |
Simplify HelloCompute example. :)
Change-Id: I45ca48df6f56c7f01f32fe609e8975c34ea183be
Diffstat (limited to 'samples/RenderScript')
| -rw-r--r-- | samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java | 5 | ||||
| -rw-r--r-- | samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs | 10 |
2 files changed, 2 insertions, 13 deletions
diff --git a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java index a017273c3..0d6c47be1 100644 --- a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java +++ b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java @@ -62,10 +62,7 @@ public class HelloCompute extends Activity { mScript = new ScriptC_mono(mRS, getResources(), R.raw.mono); - mScript.set_gIn(mInAllocation); - mScript.set_gOut(mOutAllocation); - mScript.set_gScript(mScript); - mScript.invoke_filter(); + mScript.forEach_root(mInAllocation, mOutAllocation); mOutAllocation.copyTo(mBitmapOut); } diff --git a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs index a7c9b8bbe..08592f558 100644 --- a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs +++ b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs @@ -17,20 +17,12 @@ #pragma version(1) #pragma rs java_package_name(com.example.android.rs.hellocompute) -rs_allocation gIn; -rs_allocation gOut; -rs_script gScript; - const static float3 gMonoMult = {0.299f, 0.587f, 0.114f}; -void root(const uchar4 *v_in, uchar4 *v_out, const void *usrData, uint32_t x, uint32_t y) { +void root(const uchar4 *v_in, uchar4 *v_out) { float4 f4 = rsUnpackColor8888(*v_in); float3 mono = dot(f4.rgb, gMonoMult); *v_out = rsPackColorTo8888(mono); } -void filter() { - rsForEach(gScript, gIn, gOut, 0); -} - |
