Added ability to set font color.
Propagating the name of meshes and allocations from native a3d to java

Change-Id: If781f55340b5369459610e5e92ea69e240dcd24e
diff --git a/rs.spec b/rs.spec
index 1b81591..571b145 100644
--- a/rs.spec
+++ b/rs.spec
@@ -58,6 +58,11 @@
 	param size_t len
 	}
 
+GetName {
+	param void *obj
+	param const char **name
+	}
+
 ObjDestroy {
 	param void *obj
 	}
diff --git a/rsContext.cpp b/rsContext.cpp
index 61ef5d4..1c03954 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -944,13 +944,18 @@
     rsc->setFont(font);
 }
 
-
 void rsi_AssignName(Context *rsc, void * obj, const char *name, uint32_t len)
 {
     ObjectBase *ob = static_cast<ObjectBase *>(obj);
     rsc->assignName(ob, name, len);
 }
 
+void rsi_GetName(Context *rsc, void * obj, const char **name)
+{
+    ObjectBase *ob = static_cast<ObjectBase *>(obj);
+    (*name) = ob->getName();
+}
+
 void rsi_ObjDestroy(Context *rsc, void *obj)
 {
     ObjectBase *ob = static_cast<ObjectBase *>(obj);
diff --git a/rsFont.cpp b/rsFont.cpp
index d1346fc..e58d8b1 100644
--- a/rsFont.cpp
+++ b/rsFont.cpp
@@ -259,6 +259,7 @@
     mCurrentQuadIndex = 0;
     mRSC = NULL;
     mLibrary = NULL;
+    setFontColor(0.0f, 0.0f, 0.0f, 1.0f);
 }
 
 FontState::~FontState()
@@ -660,6 +661,14 @@
     renderText(text, allocSize, start, len, x, y);
 }
 
+void FontState::setFontColor(float r, float g, float b, float a) {
+    mFontColor[0] = r;
+    mFontColor[1] = g;
+    mFontColor[2] = b;
+    mFontColor[3] = a;
+    mFontColorDirty = true;
+}
+
 void FontState::deinit(Context *rsc)
 {
     mInitialized = false;
diff --git a/rsFont.h b/rsFont.h
index e1a957a..2d9a34a 100644
--- a/rsFont.h
+++ b/rsFont.h
@@ -116,6 +116,8 @@
     void renderText(Allocation *alloc, int x, int y);
     void renderText(Allocation *alloc, uint32_t start, int len, int x, int y);
 
+    void setFontColor(float r, float g, float b, float a);
+
 protected:
 
     friend class Font;
@@ -151,6 +153,9 @@
 
     Context *mRSC;
 
+    float mFontColor[4];
+    bool mFontColorDirty;
+
     // Free type library, we only need one copy
     FT_Library mLibrary;
     FT_Library getLib();
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 06638ac..22b0945 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -332,6 +332,12 @@
     rsi_ContextBindFont(rsc, font);
 }
 
+static void SC_FontColor(float r, float g, float b, float a)
+{
+    GET_TLS();
+    rsc->mStateFont.setFontColor(r, g, b, a);
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // Class implementation
 //////////////////////////////////////////////////////////////////////////////
@@ -388,6 +394,7 @@
     { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc },
 
     { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont },
+    { "_Z12rsgFontColorffff", (void *)&SC_FontColor },
 
     // misc
     { "_Z5colorffff", (void *)&SC_color },
diff --git a/scriptc/rs_graphics.rsh b/scriptc/rs_graphics.rsh
index 8f89cba..4f53963 100644
--- a/scriptc/rs_graphics.rsh
+++ b/scriptc/rs_graphics.rsh
@@ -71,6 +71,8 @@
     rsgDrawText(rs_allocation, int x, int y);
 extern void __attribute__((overloadable))
     rsgBindFont(rs_font);
+extern void __attribute__((overloadable))
+    rsgFontColor(float, float, float, float);
 
 ///////////////////////////////////////////////////////
 // misc