Replace NULL macros with nullptr literals.

Change-Id: I918c40879aa547438f77e7d1a95fa2aa33bec398
diff --git a/rsContext.cpp b/rsContext.cpp
index 410ab35..a83eb9f 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -232,7 +232,7 @@
     uint32_t bufferLen = strlen(buffer);
 
     ObjectBaseRef<Font> lastFont(getFont());
-    setFont(NULL);
+    setFont(nullptr);
     float shadowCol = 0.1f;
     mStateFont.setFontColor(shadowCol, shadowCol, shadowCol, 1.0f);
     mStateFont.renderText(buffer, bufferLen, 5, getHeight() - 6);
@@ -248,10 +248,10 @@
 bool Context::loadRuntime(const char* filename, Context* rsc) {
 
     // TODO: store the driverSO somewhere so we can dlclose later
-    void *driverSO = NULL;
+    void *driverSO = nullptr;
 
     driverSO = dlopen(filename, RTLD_LAZY);
-    if (driverSO == NULL) {
+    if (driverSO == nullptr) {
         ALOGE("Failed loading RS driver: %s", dlerror());
         return false;
     }
@@ -262,13 +262,13 @@
     HalSig halInit = (HalSig) dlsym(driverSO, "rsdHalInit");
 
     // If we can't find the C variant, we go looking for the C++ version.
-    if (halInit == NULL) {
+    if (halInit == nullptr) {
         ALOGW("Falling back to find C++ rsdHalInit: %s", dlerror());
         halInit = (HalSig) dlsym(driverSO,
                 "_Z10rsdHalInitPN7android12renderscript7ContextEjj");
     }
 
-    if (halInit == NULL) {
+    if (halInit == nullptr) {
         dlclose(driverSO);
         ALOGE("Failed to find rsdHalInit: %s", dlerror());
         return false;
@@ -345,12 +345,12 @@
         if (!loadRuntime("libRSDriver.so", rsc)) {
             ALOGE("Failed to load default runtime!");
             rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed loading RS driver");
-            return NULL;
+            return nullptr;
         }
     }
 #else // RS_COMPATIBILITY_LIB
     if (rsdHalInit(rsc, 0, 0) != true) {
-        return NULL;
+        return nullptr;
     }
 #endif
 
@@ -361,19 +361,19 @@
     if (rsc->mIsGraphicsContext) {
         if (!rsc->initGLThread()) {
             rsc->setError(RS_ERROR_OUT_OF_MEMORY, "Failed initializing GL");
-            return NULL;
+            return nullptr;
         }
 
         rsc->mStateRaster.init(rsc);
-        rsc->setProgramRaster(NULL);
+        rsc->setProgramRaster(nullptr);
         rsc->mStateVertex.init(rsc);
-        rsc->setProgramVertex(NULL);
+        rsc->setProgramVertex(nullptr);
         rsc->mStateFragment.init(rsc);
-        rsc->setProgramFragment(NULL);
+        rsc->setProgramFragment(nullptr);
         rsc->mStateFragmentStore.init(rsc);
-        rsc->setProgramStore(NULL);
+        rsc->setProgramStore(nullptr);
         rsc->mStateFont.init(rsc);
-        rsc->setFont(NULL);
+        rsc->setFont(nullptr);
         rsc->mStateSampler.init(rsc);
         rsc->mFBOCache.init(rsc);
     }
@@ -382,7 +382,7 @@
     rsc->mRunning = true;
 
     if (rsc->isSynchronous()) {
-        return NULL;
+        return nullptr;
     }
 
     if (!rsc->mIsGraphicsContext) {
@@ -422,7 +422,7 @@
                 drawOnce |= rsc->mIO.playCoreCommands(rsc, -1);
             }
 
-            if ((rsc->mRootScript.get() != NULL) && rsc->mHasSurface &&
+            if ((rsc->mRootScript.get() != nullptr) && rsc->mHasSurface &&
                 (targetRate || drawOnce) && !rsc->mPaused) {
 
                 drawOnce = false;
@@ -454,7 +454,7 @@
 #endif
 
     //ALOGV("%p RS Thread exited", rsc);
-    return NULL;
+    return nullptr;
 }
 
 void Context::destroyWorkerThreadResources() {
@@ -504,11 +504,11 @@
 }
 
 Context::Context() {
-    mDev = NULL;
+    mDev = nullptr;
     mRunning = false;
     mExit = false;
     mPaused = false;
-    mObjHead = NULL;
+    mObjHead = nullptr;
     mError = RS_ERROR_NONE;
     mTargetSdkVersion = 14;
     mDPI = 96;
@@ -535,7 +535,7 @@
 
     if (!rsc->initContext(dev, sc)) {
         delete rsc;
-        return NULL;
+        return nullptr;
     }
     return rsc;
 }
@@ -560,7 +560,7 @@
         memset(&mUserSurfaceConfig, 0, sizeof(mUserSurfaceConfig));
     }
 
-    mIsGraphicsContext = sc != NULL;
+    mIsGraphicsContext = sc != nullptr;
 
     int status;
     pthread_attr_t threadAttr;
@@ -627,7 +627,7 @@
         pthread_mutex_lock(&gInitMutex);
         if (mDev) {
             mDev->removeContext(this);
-            mDev = NULL;
+            mDev = nullptr;
         }
         pthread_mutex_unlock(&gInitMutex);
     }
@@ -639,7 +639,7 @@
     rsAssert(mIsGraphicsContext);
     mHal.funcs.setSurface(this, w, h, sur);
 
-    mHasSurface = sur != NULL;
+    mHasSurface = sur != nullptr;
     mWidth = w;
     mHeight = h;
 
@@ -651,11 +651,11 @@
 
 uint32_t Context::getCurrentSurfaceWidth() const {
     for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) {
-        if (mFBOCache.mHal.state.colorTargets[i] != NULL) {
+        if (mFBOCache.mHal.state.colorTargets[i] != nullptr) {
             return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimX();
         }
     }
-    if (mFBOCache.mHal.state.depthTarget != NULL) {
+    if (mFBOCache.mHal.state.depthTarget != nullptr) {
         return mFBOCache.mHal.state.depthTarget->getType()->getDimX();
     }
     return mWidth;
@@ -663,11 +663,11 @@
 
 uint32_t Context::getCurrentSurfaceHeight() const {
     for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) {
-        if (mFBOCache.mHal.state.colorTargets[i] != NULL) {
+        if (mFBOCache.mHal.state.colorTargets[i] != nullptr) {
             return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimY();
         }
     }
-    if (mFBOCache.mHal.state.depthTarget != NULL) {
+    if (mFBOCache.mHal.state.depthTarget != nullptr) {
         return mFBOCache.mHal.state.depthTarget->getType()->getDimY();
     }
     return mHeight;
@@ -690,7 +690,7 @@
 
 void Context::setProgramStore(ProgramStore *pfs) {
     rsAssert(mIsGraphicsContext);
-    if (pfs == NULL) {
+    if (pfs == nullptr) {
         mFragmentStore.set(mStateFragmentStore.mDefault);
     } else {
         mFragmentStore.set(pfs);
@@ -699,7 +699,7 @@
 
 void Context::setProgramFragment(ProgramFragment *pf) {
     rsAssert(mIsGraphicsContext);
-    if (pf == NULL) {
+    if (pf == nullptr) {
         mFragment.set(mStateFragment.mDefault);
     } else {
         mFragment.set(pf);
@@ -708,7 +708,7 @@
 
 void Context::setProgramRaster(ProgramRaster *pr) {
     rsAssert(mIsGraphicsContext);
-    if (pr == NULL) {
+    if (pr == nullptr) {
         mRaster.set(mStateRaster.mDefault);
     } else {
         mRaster.set(pr);
@@ -717,7 +717,7 @@
 
 void Context::setProgramVertex(ProgramVertex *pv) {
     rsAssert(mIsGraphicsContext);
-    if (pv == NULL) {
+    if (pv == nullptr) {
         mVertex.set(mStateVertex.mDefault);
     } else {
         mVertex.set(pv);
@@ -726,7 +726,7 @@
 
 void Context::setFont(Font *f) {
     rsAssert(mIsGraphicsContext);
-    if (f == NULL) {
+    if (f == nullptr) {
         mFont.set(mStateFont.mDefault);
     } else {
         mFont.set(f);
@@ -957,7 +957,7 @@
                                      RsContextType ct, uint32_t flags) {
     //ALOGV("rsContextCreate dev=%p", vdev);
     Device * dev = static_cast<Device *>(vdev);
-    Context *rsc = Context::createContext(dev, NULL, ct, flags);
+    Context *rsc = Context::createContext(dev, nullptr, ct, flags);
     if (rsc) {
         rsc->setTargetSdkVersion(sdkVersion);
     }