summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-07-01 20:18:01 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2009-07-01 20:18:01 -0700
commitae78df4b46a9e1c9ccf2b925b85298f58e3d7e54 (patch)
tree9ad240569115c449ea72fe3629fd4dc5028b834d
parent7f32b426cd6a865ac5e6e3e9fa833e9327fb415a (diff)
parentaabd00960f3b98c3c5636d99212343d71956a1d1 (diff)
Merge change 6022
* changes: Update rollo with icon images.
-rw-r--r--libs/rs/java/Rollo/res/drawable/browser.pngbin0 -> 5772 bytes
-rw-r--r--libs/rs/java/Rollo/res/drawable/market.pngbin0 -> 4810 bytes
-rw-r--r--libs/rs/java/Rollo/res/drawable/photos.pngbin0 -> 4902 bytes
-rw-r--r--libs/rs/java/Rollo/res/drawable/settings.pngbin0 -> 3764 bytes
-rw-r--r--libs/rs/java/Rollo/res/raw/rollo.c4
-rw-r--r--libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java51
-rw-r--r--libs/rs/rsScriptC.cpp4
7 files changed, 43 insertions, 16 deletions
diff --git a/libs/rs/java/Rollo/res/drawable/browser.png b/libs/rs/java/Rollo/res/drawable/browser.png
new file mode 100644
index 000000000000..513f0be49693
--- /dev/null
+++ b/libs/rs/java/Rollo/res/drawable/browser.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/drawable/market.png b/libs/rs/java/Rollo/res/drawable/market.png
new file mode 100644
index 000000000000..83b6910fcdec
--- /dev/null
+++ b/libs/rs/java/Rollo/res/drawable/market.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/drawable/photos.png b/libs/rs/java/Rollo/res/drawable/photos.png
new file mode 100644
index 000000000000..1ed8f1e811ad
--- /dev/null
+++ b/libs/rs/java/Rollo/res/drawable/photos.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/drawable/settings.png b/libs/rs/java/Rollo/res/drawable/settings.png
new file mode 100644
index 000000000000..dd2cd9570486
--- /dev/null
+++ b/libs/rs/java/Rollo/res/drawable/settings.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/rollo.c b/libs/rs/java/Rollo/res/raw/rollo.c
index e6acc9cef44e..64a0d0fcd30c 100644
--- a/libs/rs/java/Rollo/res/raw/rollo.c
+++ b/libs/rs/java/Rollo/res/raw/rollo.c
@@ -1,7 +1,7 @@
#pragma version(1)
#pragma stateVertex(PV)
#pragma stateFragment(PF)
-#pragma stateFragmentStore(PFSBackground)
+#pragma stateFragmentStore(PFS)
int main(void* con, int ft, int launchID)
{
@@ -46,6 +46,8 @@ int main(void* con, int ft, int launchID)
ty1 = (y * 0x30000) - 0x48000;
ty2 = ty1 + 0x20000;
+ pfBindTexture(NAMED_PF, 0, loadI32(1, y));
+
drawQuad(tx1, ty1, tz1,
tx2, ty1, tz2,
tx2, ty2, tz2,
diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
index 0f7e26b0fa0e..003a2a06e54e 100644
--- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
+++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
@@ -68,12 +68,13 @@ public class RolloRS {
private RenderScript.ProgramFragment mPFImages;
private RenderScript.ProgramVertex mPV;
private ProgramVertexAlloc mPVAlloc;
+ private RenderScript.Allocation[] mIcons;
private int[] mAllocStateBuf;
private RenderScript.Allocation mAllocState;
- private float[] mBufferPos;
- //private float[] mBufferPV;
+ private int[] mAllocIconIDBuf;
+ private RenderScript.Allocation mAllocIconID;
private void initNamed() {
mRS.samplerBegin();
@@ -95,20 +96,12 @@ public class RolloRS {
mRS.programFragmentStoreBegin(null, null);
mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
- mRS.programFragmentStoreDitherEnable(true);
- mPFSBackground = mRS.programFragmentStoreCreate();
- mPFSBackground.setName("PFSBackground");
-
- /*
- mRS.programFragmentStoreBegin(null, null);
- mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.EQUAL);
mRS.programFragmentStoreDitherEnable(false);
mRS.programFragmentStoreDepthMask(false);
mRS.programFragmentStoreBlendFunc(RenderScript.BlendSrcFunc.ONE,
RenderScript.BlendDstFunc.ONE);
- mPFSImages = mRS.programFragmentStoreCreate();
- mPFSImages.setName("PFSImages");
-*/
+ mPFSBackground = mRS.programFragmentStoreCreate();
+ mPFSBackground.setName("PFS");
mPVAlloc = new ProgramVertexAlloc(mRS);
@@ -126,13 +119,44 @@ public class RolloRS {
Log.e("rs", "Done loading named");
+
+
+ {
+ mIcons = new RenderScript.Allocation[4];
+ mAllocIconIDBuf = new int[mIcons.length];
+ mAllocIconID = mRS.allocationCreatePredefSized(
+ RenderScript.ElementPredefined.USER_I32, mAllocIconIDBuf.length);
+
+
+ BitmapDrawable bd;
+ Bitmap b;
+
+ bd = (BitmapDrawable)mRes.getDrawable(R.drawable.browser);
+ mIcons[0] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true);
+
+ bd = (BitmapDrawable)mRes.getDrawable(R.drawable.market);
+ mIcons[1] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true);
+
+ bd = (BitmapDrawable)mRes.getDrawable(R.drawable.photos);
+ mIcons[2] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true);
+
+ bd = (BitmapDrawable)mRes.getDrawable(R.drawable.settings);
+ mIcons[3] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true);
+
+ for(int ct=0; ct < mIcons.length; ct++) {
+ mIcons[ct].uploadToTexture(0);
+ mAllocIconIDBuf[ct] = mIcons[ct].getID();
+ }
+ mAllocIconID.data(mAllocIconIDBuf);
+ }
+
}
private void initRS() {
mRS.scriptCBegin();
- mRS.scriptCSetClearColor(0.0f, 0.7f, 0.0f, 1.0f);
+ mRS.scriptCSetClearColor(0.0f, 0.0f, 0.1f, 1.0f);
mRS.scriptCSetScript(mRes, R.raw.rollo);
mRS.scriptCSetRoot(true);
mScript = mRS.scriptCCreate();
@@ -141,6 +165,7 @@ public class RolloRS {
mAllocState = mRS.allocationCreatePredefSized(
RenderScript.ElementPredefined.USER_I32, mAllocStateBuf.length);
mScript.bindAllocation(mAllocState, 0);
+ mScript.bindAllocation(mAllocIconID, 1);
setPosition(0, 0);
mRS.contextBindRootScript(mScript);
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 9c99e2b4f8c2..55daf7ec4ce3 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -324,8 +324,8 @@ extern "C" void drawQuad(int32_t x1, int32_t y1, int32_t z1,
//LOGE("0x%08x, 0x%08x, 0x%08x", x3, y3, z3);
//LOGE("0x%08x, 0x%08x, 0x%08x", x4, y4, z4);
- int32_t vtx[] = {x1,y1,z1, x4,y4,z4, x3,y3,z3, x2,y2,z2};
- static const int32_t tex[] = {0,0, 0,0x10000, 0x10000,0, 0x10000,0x10000};
+ int32_t vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
+ static const int32_t tex[] = {0,0, 0,0x10000, 0x10000,0x10000, 0x10000,0};
rsc->setupCheck();