Move to smart pointers for refcounting RS contexts

Change-Id: I0dc6adc4e02c7427a4234c549d3555a501fe5f90
diff --git a/cpp/ScriptC.cpp b/cpp/ScriptC.cpp
index 39b17d4..3a1909d 100644
--- a/cpp/ScriptC.cpp
+++ b/cpp/ScriptC.cpp
@@ -14,22 +14,20 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "libRS_cpp"
-
 #include <utils/Log.h>
 #include <malloc.h>
 
-#include "ScriptC.h"
+#include "RenderScript.h"
 
 using namespace android;
 using namespace renderscriptCpp;
 
-ScriptC::ScriptC(RenderScript *rs,
+ScriptC::ScriptC(sp<RS> rs,
                  const void *codeTxt, size_t codeLength,
                  const char *cachedName, size_t cachedNameLength,
                  const char *cacheDir, size_t cacheDirLength)
 : Script(NULL, rs) {
-    mID = rsScriptCCreate(rs->mContext, cachedName, cachedNameLength,
+    mID = rsScriptCCreate(rs->getContext(), cachedName, cachedNameLength,
                           cacheDir, cacheDirLength, (const char *)codeTxt, codeLength);
 }