Update rollo with icon images.
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 0000000..513f0be
--- /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 0000000..83b6910
--- /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 0000000..1ed8f1e
--- /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 0000000..dd2cd95
--- /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 e6acc9c..64a0d0f 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 @@
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 0f7e26b..003a2a0 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 @@
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 @@
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 @@
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 @@
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 9c99e2b..55daf7e 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -324,8 +324,8 @@
//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();