Cleanup the Galaxy, add a few RS functions for Grass.
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 c6f5816..fae92f7 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 @@
         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 5f8ee2a..84a39aa 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -729,7 +729,7 @@
     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 @@
             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 @@
     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 @@
         "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 @@
         "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 }