Remove legacy drawing functions.
Skip element names starting with '#'

Change-Id: I6b0967ed1dc47c072c3bed7c0219e2215a7068a6
diff --git a/rsProgramVertex.cpp b/rsProgramVertex.cpp
index d667c86..e7292c0 100644
--- a/rsProgramVertex.cpp
+++ b/rsProgramVertex.cpp
@@ -160,6 +160,11 @@
             const Element *e = mInputElements[ct].get();
             for (uint32_t field=0; field < e->getFieldCount(); field++) {
                 const Element *f = e->getField(field);
+                const char *fn = e->getFieldName(field);
+
+                if (fn[0] == '#') {
+                    continue;
+                }
 
                 // Cannot be complex
                 rsAssert(!f->getFieldCount());
@@ -172,7 +177,7 @@
                     rsAssert(0);
                 }
 
-                mShader.append(e->getFieldName(field));
+                mShader.append(fn);
                 mShader.append(";\n");
             }
         }
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 01a23c0..f0de908 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -121,38 +121,6 @@
 // Drawing
 //////////////////////////////////////////////////////////////////////////////
 
-static void SC_drawLine(float x1, float y1, float z1,
-                        float x2, float y2, float z2)
-{
-    GET_TLS();
-    if (!rsc->setupCheck()) {
-        return;
-    }
-
-    float vtx[] = { x1, y1, z1, x2, y2, z2 };
-    VertexArray va;
-    va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position");
-    va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
-
-    glDrawArrays(GL_LINES, 0, 2);
-}
-
-static void SC_drawPoint(float x, float y, float z)
-{
-    GET_TLS();
-    if (!rsc->setupCheck()) {
-        return;
-    }
-
-    float vtx[] = { x, y, z };
-
-    VertexArray va;
-    va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position");
-    va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
-
-    glDrawArrays(GL_POINTS, 0, 1);
-}
-
 static void SC_drawQuadTexCoords(float x1, float y1, float z1,
                                  float u1, float v1,
                                  float x2, float y2, float z2,
@@ -212,20 +180,7 @@
                 x,   sh - (y+h), z);
     rsc->setVertex((ProgramVertex *)tmp.get());
 }
-
-static void SC_drawSpriteScreenspaceCropped(float x, float y, float z, float w, float h,
-        float cx0, float cy0, float cx1, float cy1)
-{
-    GET_TLS();
-    if (!rsc->setupCheck()) {
-        return;
-    }
-
-    GLint crop[4] = {cx0, cy0, cx1, cy1};
-    glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
-    glDrawTexfOES(x, y, z, w, h);
-}
-
+/*
 static void SC_drawSprite(float x, float y, float z, float w, float h)
 {
     GET_TLS();
@@ -253,7 +208,7 @@
     SC_drawSpriteScreenspace(vout[0], vout[1], z, h, w);
     //rsc->setupCheck();
 }
-
+*/
 
 static void SC_drawRect(float x1, float y1,
                         float x2, float y2, float z)
@@ -303,91 +258,6 @@
     }
 }
 
-static void SC_pointAttenuation(float a, float b, float c)
-{
-    GLfloat params[] = { a, b, c };
-    glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, params);
-}
-
-static void SC_hsbToRgb(float h, float s, float b, float* rgb)
-{
-    float red = 0.0f;
-    float green = 0.0f;
-    float blue = 0.0f;
-
-    float x = h;
-    float y = s;
-    float z = b;
-
-    float hf = (x - (int) x) * 6.0f;
-    int ihf = (int) hf;
-    float f = hf - ihf;
-    float pv = z * (1.0f - y);
-    float qv = z * (1.0f - y * f);
-    float tv = z * (1.0f - y * (1.0f - f));
-
-    switch (ihf) {
-        case 0:         // Red is the dominant color
-            red = z;
-            green = tv;
-            blue = pv;
-            break;
-        case 1:         // Green is the dominant color
-            red = qv;
-            green = z;
-            blue = pv;
-            break;
-        case 2:
-            red = pv;
-            green = z;
-            blue = tv;
-            break;
-        case 3:         // Blue is the dominant color
-            red = pv;
-            green = qv;
-            blue = z;
-            break;
-        case 4:
-            red = tv;
-            green = pv;
-            blue = z;
-            break;
-        case 5:         // Red is the dominant color
-            red = z;
-            green = pv;
-            blue = qv;
-            break;
-    }
-
-    rgb[0] = red;
-    rgb[1] = green;
-    rgb[2] = blue;
-}
-
-static int SC_hsbToAbgr(float h, float s, float b, float a)
-{
-    //LOGE("hsb a %f, %f, %f    %f", h, s, b, a);
-    float rgb[3];
-    SC_hsbToRgb(h, s, b, rgb);
-    //LOGE("rgb  %f, %f, %f ", rgb[0], rgb[1], rgb[2]);
-    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)
-{
-    GET_TLS();
-    float rgb[3];
-    SC_hsbToRgb(h, s, b, rgb);
-    if (rsc->checkVersion2_0()) {
-        glVertexAttrib4f(1, rgb[0], rgb[1], rgb[2], a);
-    } else {
-        glColor4f(rgb[0], rgb[1], rgb[2], a);
-    }
-}
-
 static void SC_uploadToTexture2(RsAllocation va, uint32_t baseMipLevel)
 {
     GET_TLS();
@@ -475,8 +345,8 @@
     { "rsgGetWidth", (void *)&SC_getWidth },
     { "rsgGetHeight", (void *)&SC_getHeight },
 
-    { "_Z18rsgUploadToTextureii", (void *)&SC_uploadToTexture2 },
-    { "_Z18rsgUploadToTexturei", (void *)&SC_uploadToTexture },
+  { "_Z18rsgUploadToTextureii", (void *)&SC_uploadToTexture2 },
+  { "_Z18rsgUploadToTexturei", (void *)&SC_uploadToTexture },
     { "_Z18rsgUploadToTexture13rs_allocationi", (void *)&SC_uploadToTexture2 },
     { "_Z18rsgUploadToTexture13rs_allocation", (void *)&SC_uploadToTexture },
     { "rsgUploadToBufferObject", (void *)&SC_uploadToBufferObject },
@@ -486,13 +356,10 @@
     { "rsgDrawQuadTexCoords", (void *)&SC_drawQuadTexCoords },
     //{ "drawSprite", (void *)&SC_drawSprite },
     { "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace },
-    { "rsgDrawSpriteScreenspaceCropped", (void *)&SC_drawSpriteScreenspaceCropped },
-    { "rsgDrawLine", (void *)&SC_drawLine },
-    { "rsgDrawPoint", (void *)&SC_drawPoint },
     { "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh },
     { "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange },
-    { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh },
-    { "_Z17rsgDrawSimpleMeshiii", (void *)&SC_drawSimpleMeshRange },
+  { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh },
+  { "_Z17rsgDrawSimpleMeshiii", (void *)&SC_drawSimpleMeshRange },
 
     { "rsgClearColor", (void *)&SC_ClearColor },
     { "rsgClearDepth", (void *)&SC_ClearDepth },
@@ -505,10 +372,6 @@
     // misc
     //{ "pfClearColor", (void *)&SC_ClearColor },
     { "color", (void *)&SC_color },
-    { "hsb", (void *)&SC_hsb },
-    { "hsbToRgb", (void *)&SC_hsbToRgb },
-    { "hsbToAbgr", (void *)&SC_hsbToAbgr },
-    { "pointAttenuation", (void *)&SC_pointAttenuation },
 
     { NULL, NULL }
 };
diff --git a/rsVertexArray.cpp b/rsVertexArray.cpp
index 6f15db0..a13371a 100644
--- a/rsVertexArray.cpp
+++ b/rsVertexArray.cpp
@@ -123,6 +123,11 @@
     rsc->checkError("VertexArray::setupGL2 disabled");
     for (uint32_t ct=0; ct < mCount; ct++) {
         uint32_t slot = 0;
+
+        if (mAttribs[ct].name[0] == '#') {
+            continue;
+        }
+
         if (sc->isUserVertexProgram()) {
             slot = sc->vtxAttribSlot(ct);
         } else {
diff --git a/scriptc/rs_graphics.rsh b/scriptc/rs_graphics.rsh
index 6df2a56..c9667d0 100644
--- a/scriptc/rs_graphics.rsh
+++ b/scriptc/rs_graphics.rsh
@@ -29,8 +29,6 @@
 extern void rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4);
 //extern void rsgDrawSprite(float x, float y, float z, float w, float h);
 extern void rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
-extern void rsgDrawLine(float x1, float y1, float z1, float x2, float y2, float z2);
-extern void rsgDrawPoint(float x1, float y1, float z1);
 extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism);
 extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism, int start, int len);