diff options
author | Romain Guy <romainguy@android.com> | 2009-08-20 17:08:33 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-08-20 17:08:33 -0700 |
commit | d22fff7185979537877213c826879c0100a20b11 (patch) | |
tree | 0c2b1dbccc215f45b4ce290a7fa0a7f7f3cb83fb /libs/rs/rsScriptC_Lib.cpp | |
parent | 1c1629da30bd1b125c59ab9bbcecff3bb3e74324 (diff) |
Cleanup the Galaxy, add a few RS functions for Grass.
Diffstat (limited to 'libs/rs/rsScriptC_Lib.cpp')
-rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
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 } |