diff options
| author | 2009-08-20 17:08:54 -0700 | |
|---|---|---|
| committer | 2009-08-20 17:08:54 -0700 | |
| commit | 75e6c77139dac6bc8f408e3e3a1c87bbfe8078be (patch) | |
| tree | b71f9dc0ae9f7c56fb98f1fff12bfc673d158f60 /libs/rs | |
| parent | d57ca2deff2a3d7e346043d39d9245a578b691a2 (diff) | |
| parent | d22fff7185979537877213c826879c0100a20b11 (diff) | |
Merge change 22169 into eclair
* changes:
Cleanup the Galaxy, add a few RS functions for Grass.
Diffstat (limited to 'libs/rs')
| -rw-r--r-- | libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java | 2 | ||||
| -rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 41 |
2 files changed, 40 insertions, 3 deletions
diff --git a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java b/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java index c6f5816edf14..fae92f74d422 100644 --- a/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java +++ b/libs/rs/java/Galaxy/src/com/android/galaxy/rs/GalaxyRS.java @@ -115,7 +115,7 @@ class GalaxyRS { loadTextures(); ScriptC.Builder sb = new ScriptC.Builder(mRS); - sb.setType(mStateType, "State", 0); + sb.setType(mStateType, "State", RSID_STATE); sb.setScript(mResources, R.raw.galaxy); sb.setRoot(true); diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp index 5f8ee2a9ec80..84a39aa304ab 100644 --- a/libs/rs/rsScriptC_Lib.cpp +++ b/libs/rs/rsScriptC_Lib.cpp @@ -729,7 +729,7 @@ static void SC_shininess(float s) glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, s); } -static void SC_hsb(float h, float s, float b, float a) +static void SC_hsbToRgb(float h, float s, float b, float* rgb) { float red = 0.0f; float green = 0.0f; @@ -779,7 +779,26 @@ static void SC_hsb(float h, float s, float b, float a) break; } - glColor4f(red, green, blue, a); + rgb[0] = red; + rgb[1] = green; + rgb[2] = blue; +} + +static int SC_hsbToAbgr(float h, float s, float b, float a) +{ + float rgb[3]; + SC_hsbToRgb(h, s, b, rgb); + return int(a * 255.0f) << 24 | + int(rgb[2] * 255.0f) << 16 | + int(rgb[1] * 255.0f) << 8 | + int(rgb[0] * 255.0f); +} + +static void SC_hsb(float h, float s, float b, float a) +{ + float rgb[3]; + SC_hsbToRgb(h, s, b, rgb); + glColor4f(rgb[0], rgb[1], rgb[2], a); } static void SC_uploadToTexture(RsAllocation va, uint32_t baseMipLevel) @@ -809,11 +828,21 @@ static void SC_debugF(const char *s, float f) LOGE("%s %f", s, f); } +static void SC_debugHexF(const char *s, float f) +{ + LOGE("%s 0x%x", s, *((int *) (&f))); +} + static void SC_debugI32(const char *s, int32_t i) { LOGE("%s %i", s, i); } +static void SC_debugHexI32(const char *s, int32_t i) +{ + LOGE("%s 0x%x", s, i); +} + static uint32_t SC_getWidth() { GET_TLS(); @@ -1055,6 +1084,10 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = { "void", "(float, float, float, float)" }, { "hsb", (void *)&SC_hsb, "void", "(float, float, float, float)" }, + { "hsbToRgb", (void *)&SC_hsbToRgb, + "void", "(float, float, float, float*)" }, + { "hsbToAbgr", (void *)&SC_hsbToAbgr, + "int", "(float, float, float, float)" }, { "ambient", (void *)&SC_ambient, "void", "(float, float, float, float)" }, { "diffuse", (void *)&SC_diffuse, @@ -1088,6 +1121,10 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = { "void", "(void *, float)" }, { "debugI32", (void *)&SC_debugI32, "void", "(void *, int)" }, + { "debugHexF", (void *)&SC_debugHexF, + "void", "(void *, float)" }, + { "debugHexI32", (void *)&SC_debugHexI32, + "void", "(void *, int)" }, { NULL, NULL, NULL, NULL } |