diff options
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/browser.png (renamed from libs/rs/java/Rollo/res/drawable/browser.png) | bin | 5772 -> 5772 bytes | |||
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/market.png (renamed from libs/rs/java/Rollo/res/drawable/market.png) | bin | 4810 -> 4810 bytes | |||
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/photos.png (renamed from libs/rs/java/Rollo/res/drawable/photos.png) | bin | 4902 -> 4902 bytes | |||
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/settings.png (renamed from libs/rs/java/Rollo/res/drawable/settings.png) | bin | 3764 -> 3764 bytes | |||
| -rw-r--r-- | libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java | 22 | ||||
| -rw-r--r-- | libs/rs/rsScriptC.cpp | 89 | ||||
| -rw-r--r-- | libs/rs/rsScriptC.h | 1 |
7 files changed, 37 insertions, 75 deletions
diff --git a/libs/rs/java/Rollo/res/drawable/browser.png b/libs/rs/java/Rollo/res/raw/browser.png Binary files differindex 513f0be49693..513f0be49693 100644 --- a/libs/rs/java/Rollo/res/drawable/browser.png +++ b/libs/rs/java/Rollo/res/raw/browser.png diff --git a/libs/rs/java/Rollo/res/drawable/market.png b/libs/rs/java/Rollo/res/raw/market.png Binary files differindex 83b6910fcdec..83b6910fcdec 100644 --- a/libs/rs/java/Rollo/res/drawable/market.png +++ b/libs/rs/java/Rollo/res/raw/market.png diff --git a/libs/rs/java/Rollo/res/drawable/photos.png b/libs/rs/java/Rollo/res/raw/photos.png Binary files differindex 1ed8f1e811ad..1ed8f1e811ad 100644 --- a/libs/rs/java/Rollo/res/drawable/photos.png +++ b/libs/rs/java/Rollo/res/raw/photos.png diff --git a/libs/rs/java/Rollo/res/drawable/settings.png b/libs/rs/java/Rollo/res/raw/settings.png Binary files differindex dd2cd9570486..dd2cd9570486 100644 --- a/libs/rs/java/Rollo/res/drawable/settings.png +++ b/libs/rs/java/Rollo/res/raw/settings.png 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 fc928d6e1bfc..daf3aa6fa9f6 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java @@ -24,6 +24,7 @@ import android.renderscript.ProgramVertexAlloc; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; @@ -188,20 +189,21 @@ public class RolloRS { 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); + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inScaled = false; + + b = BitmapFactory.decodeResource(mRes, R.raw.browser, opts); + mIcons[0] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - bd = (BitmapDrawable)mRes.getDrawable(R.drawable.market); - mIcons[1] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true); + b = BitmapFactory.decodeResource(mRes, R.raw.market, opts); + mIcons[1] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - bd = (BitmapDrawable)mRes.getDrawable(R.drawable.photos); - mIcons[2] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true); + b = BitmapFactory.decodeResource(mRes, R.raw.photos, opts); + mIcons[2] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); - bd = (BitmapDrawable)mRes.getDrawable(R.drawable.settings); - mIcons[3] = mRS.allocationCreateFromBitmap(bd.getBitmap(), RenderScript.ElementPredefined.RGB_565, true); + b = BitmapFactory.decodeResource(mRes, R.raw.settings, opts); + mIcons[3] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true); for(int ct=0; ct < mIcons.length; ct++) { mIcons[ct].uploadToTexture(0); diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 21d792cb10a3..adbe3e9d07e6 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -353,67 +353,6 @@ static void SC_drawQuad(float x1, float y1, float z1, glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } -extern "C" void drawQuad(int32_t x1, int32_t y1, int32_t z1, - int32_t x2, int32_t y2, int32_t z2, - int32_t x3, int32_t y3, int32_t z3, - int32_t x4, int32_t y4, int32_t z4) -{ - GET_TLS(); - //x1 = (x1 << 16); - //x2 = (x2 << 16); - //y1 = (y1 << 16); - //y2 = (y2 << 16); - - //LOGE("Quad"); - //LOGE("0x%08x, 0x%08x, 0x%08x", x1, y1, z1); - //LOGE("0x%08x, 0x%08x, 0x%08x", x2, y2, z2); - //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, x2,y2,z2, x3,y3,z3, x4,y4,z4}; - static const int32_t tex[] = {0,0, 0,0x10000, 0x10000,0x10000, 0x10000,0}; - - - rsc->setupCheck(); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tm->mBufferObjects[1]); - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FIXED, 0, vtx); - - glClientActiveTexture(GL_TEXTURE0); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FIXED, 0, tex); - glClientActiveTexture(GL_TEXTURE1); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FIXED, 0, tex); - glClientActiveTexture(GL_TEXTURE0); - - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - //glColorPointer(4, GL_UNSIGNED_BYTE, 12, ptr); - - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); -} - -extern "C" int32_t sinx(int32_t angle) -{ - float a = ((float)angle) / 0x10000; - a *= 3.14f / 180.f; - float s = (float)sin(a); - return int32_t(s * 0x10000); -} - -extern "C" int32_t cosx(int32_t angle) -{ - float a = ((float)angle) / 0x10000; - a *= 3.14f / 180.f; - float s = (float)cos(a); - return int32_t(s * 0x10000); -} - extern "C" float sinf(float angle) { float s = (float)sin(angle); @@ -580,12 +519,12 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = { { "loadF", (void *)&SC_loadF, "float loadF(int, int)" }, { "storeI32", (void *)&SC_storeI32, "void storeI32(int, int, int)" }, { "storeF", (void *)&SC_storeF, "void storeF(int, int, float)" }, - { "drawQuad", (void *)&SC_drawQuad, "drawQuad(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" }, + { "drawQuad", (void *)&SC_drawQuad, "void drawQuad(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" }, { "sinf", (void *)&sinf, "float sinf(float)" }, { "cosf", (void *)&cosf, "float cosf(float)" }, - { "contextBindProgramFragmentStore", (void *)&contextBindProgramFragmentStore, "" }, - { "pfClearColor", (void *)&pfClearColor, "" }, - { "pfBindTexture", (void *)&pfBindTexture, "" }, + { "contextBindProgramFragmentStore", (void *)&contextBindProgramFragmentStore, "void contextBindProgramFragmentStore(int)" }, + { "pfClearColor", (void *)&pfClearColor, "void pfClearColor(float, float, float, float)" }, + { "pfBindTexture", (void *)&pfBindTexture, "void pfBindTexture(int, int, int)" }, { NULL, NULL, NULL } @@ -618,12 +557,24 @@ static ACCvoid* symbolLookup(ACCvoid* pContext, const ACCchar* name) return NULL; } +void ScriptCState::appendDecls(String8 *str) +{ + ScriptCState::SymbolTable_t *syms = gSyms; + while (syms->mPtr) { + str->append(syms->mDecl); + str->append(";\n"); + syms++; + } +} + void ScriptCState::runCompiler(Context *rsc) { mAccScript = accCreateScript(); String8 tmp; rsc->appendNameDefines(&tmp); + appendDecls(&tmp); + //tmp.append("#line 1\n"); const char* scriptSource[] = {tmp.string(), mProgram.mScriptText}; int scriptLength[] = {tmp.length(), mProgram.mScriptTextLength} ; @@ -633,6 +584,14 @@ void ScriptCState::runCompiler(Context *rsc) accGetScriptLabel(mAccScript, "main", (ACCvoid**) &mProgram.mScript); rsAssert(mProgram.mScript); + if (!mProgram.mScript) { + ACCchar buf[4096]; + ACCsizei len; + accGetScriptInfoLog(mAccScript, sizeof(buf), &len, buf); + LOGE(buf); + + } + mEnviroment.mFragment.set(rsc->getDefaultProgramFragment()); mEnviroment.mVertex.set(rsc->getDefaultProgramVertex()); mEnviroment.mFragmentStore.set(rsc->getDefaultProgramFragmentStore()); diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h index 9d9ec4977dbd..3a3f2f7ed43f 100644 --- a/libs/rs/rsScriptC.h +++ b/libs/rs/rsScriptC.h @@ -77,6 +77,7 @@ public: }; static SymbolTable_t gSyms[]; static const SymbolTable_t * lookupSymbol(const char *); + static void appendDecls(String8 *str); }; |