diff --git a/libs/hwui/AssetAtlas.h b/libs/hwui/AssetAtlas.h
index dba9e62..1772eff 100644
--- a/libs/hwui/AssetAtlas.h
+++ b/libs/hwui/AssetAtlas.h
@@ -106,7 +106,7 @@
         friend class AssetAtlas;
     };
 
-    AssetAtlas(): mTexture(NULL), mImage(NULL),
+    AssetAtlas(): mTexture(nullptr), mImage(nullptr),
             mBlendKey(true), mOpaqueKey(false) { }
     ~AssetAtlas() { terminate(); }
 
diff --git a/libs/hwui/CanvasState.h b/libs/hwui/CanvasState.h
index 6883d0a..9e6a9c3 100644
--- a/libs/hwui/CanvasState.h
+++ b/libs/hwui/CanvasState.h
@@ -161,7 +161,7 @@
     int getHeight() { return mHeight; }
 
     inline const Snapshot* currentSnapshot() const {
-        return mSnapshot != NULL ? mSnapshot.get() : mFirstSnapshot.get();
+        return mSnapshot != nullptr ? mSnapshot.get() : mFirstSnapshot.get();
     }
     inline Snapshot* writableSnapshot() { return mSnapshot.get(); }
     inline const Snapshot* firstSnapshot() const { return mFirstSnapshot.get(); }
diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h
index b6309ff..c92ab91 100644
--- a/libs/hwui/DeferredDisplayList.h
+++ b/libs/hwui/DeferredDisplayList.h
@@ -69,7 +69,7 @@
 class OpStatePair {
 public:
     OpStatePair()
-            : op(NULL), state(NULL) {}
+            : op(nullptr), state(nullptr) {}
     OpStatePair(DrawOp* newOp, const DeferredDisplayState* newState)
             : op(newOp), state(newState) {}
     OpStatePair(const OpStatePair& other)
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 6646da7..0bfcb16b 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -74,48 +74,51 @@
 // ----------------------------------------------------------------------------
 // Frame state operations
 // ----------------------------------------------------------------------------
-    virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
-    virtual void prepare(bool opaque) {
+    virtual void prepareDirty(float left, float top, float right,
+            float bottom, bool opaque) override;
+    virtual void prepare(bool opaque) override {
         prepareDirty(0.0f, 0.0f, mState.getWidth(), mState.getHeight(), opaque);
     }
-    virtual bool finish();
+    virtual bool finish() override;
     virtual void interrupt();
     virtual void resume();
 
 // ----------------------------------------------------------------------------
 // Canvas state operations
 // ----------------------------------------------------------------------------
-    virtual void setViewport(int width, int height) { mState.setViewport(width, height); }
+    virtual void setViewport(int width, int height) override { mState.setViewport(width, height); }
 
     // Save (layer)
-    virtual int getSaveCount() const { return mState.getSaveCount(); }
-    virtual int save(int flags);
-    virtual void restore();
-    virtual void restoreToCount(int saveCount);
+    virtual int getSaveCount() const override { return mState.getSaveCount(); }
+    virtual int save(int flags) override;
+    virtual void restore() override;
+    virtual void restoreToCount(int saveCount) override;
     virtual int saveLayer(float left, float top, float right, float bottom,
-            const SkPaint* paint, int flags);
+            const SkPaint* paint, int flags) override;
 
     // Matrix
-    virtual void getMatrix(SkMatrix* outMatrix) const { mState.getMatrix(outMatrix); }
+    virtual void getMatrix(SkMatrix* outMatrix) const override { mState.getMatrix(outMatrix); }
 
-    virtual void translate(float dx, float dy, float dz = 0.0f);
-    virtual void rotate(float degrees);
-    virtual void scale(float sx, float sy);
-    virtual void skew(float sx, float sy);
+    virtual void translate(float dx, float dy, float dz = 0.0f) override;
+    virtual void rotate(float degrees) override;
+    virtual void scale(float sx, float sy) override;
+    virtual void skew(float sx, float sy) override;
 
-    virtual void setMatrix(const SkMatrix& matrix);
-    virtual void concatMatrix(const SkMatrix& matrix);
+    virtual void setMatrix(const SkMatrix& matrix) override;
+    virtual void concatMatrix(const SkMatrix& matrix) override;
 
     // Clip
-    virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
-    virtual bool clipPath(const SkPath* path, SkRegion::Op op);
-    virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
+    virtual bool clipRect(float left, float top, float right, float bottom,
+            SkRegion::Op op) override;
+    virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
+    virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
 
     // Misc
-    virtual void setDrawFilter(SkDrawFilter* filter);
-    virtual const Rect& getLocalClipBounds() const { return mState.getLocalClipBounds(); }
+    virtual void setDrawFilter(SkDrawFilter* filter) override;
+    virtual const Rect& getLocalClipBounds() const override { return mState.getLocalClipBounds(); }
     const Rect& getRenderTargetClipBounds() const { return mState.getRenderTargetClipBounds(); }
-    virtual bool quickRejectConservative(float left, float top, float right, float bottom) const {
+    virtual bool quickRejectConservative(float left, float top,
+            float right, float bottom) const override {
         return mState.quickRejectConservative(left, top, right, bottom);
     }
 
@@ -126,57 +129,57 @@
 // ----------------------------------------------------------------------------
 // Canvas draw operations
 // ----------------------------------------------------------------------------
-    virtual void drawColor(int color, SkXfermode::Mode mode);
+    virtual void drawColor(int color, SkXfermode::Mode mode) override;
 
     // Bitmap-based
-    virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint);
+    virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) override;
     virtual void drawBitmap(const SkBitmap* bitmap, float srcLeft, float srcTop,
             float srcRight, float srcBottom, float dstLeft, float dstTop,
-            float dstRight, float dstBottom, const SkPaint* paint);
-    virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint);
+            float dstRight, float dstBottom, const SkPaint* paint) override;
+    virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint) override;
     virtual void drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight,
-            const float* vertices, const int* colors, const SkPaint* paint);
+            const float* vertices, const int* colors, const SkPaint* paint) override;
     virtual void drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
-            float left, float top, float right, float bottom, const SkPaint* paint);
+            float left, float top, float right, float bottom, const SkPaint* paint) override;
 
     // Shapes
     virtual void drawRect(float left, float top, float right, float bottom,
-            const SkPaint* paint);
-    virtual void drawRects(const float* rects, int count, const SkPaint* paint);
+            const SkPaint* paint) override;
+    virtual void drawRects(const float* rects, int count, const SkPaint* paint) override;
     virtual void drawRoundRect(float left, float top, float right, float bottom,
-            float rx, float ry, const SkPaint* paint);
+            float rx, float ry, const SkPaint* paint) override;
     virtual void drawRoundRect(CanvasPropertyPrimitive* left, CanvasPropertyPrimitive* top,
                 CanvasPropertyPrimitive* right, CanvasPropertyPrimitive* bottom,
                 CanvasPropertyPrimitive* rx, CanvasPropertyPrimitive* ry,
                 CanvasPropertyPaint* paint);
-    virtual void drawCircle(float x, float y, float radius, const SkPaint* paint);
+    virtual void drawCircle(float x, float y, float radius, const SkPaint* paint) override;
     virtual void drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y,
                 CanvasPropertyPrimitive* radius, CanvasPropertyPaint* paint);
     virtual void drawOval(float left, float top, float right, float bottom,
-            const SkPaint* paint);
+            const SkPaint* paint) override;
     virtual void drawArc(float left, float top, float right, float bottom,
-            float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint);
-    virtual void drawPath(const SkPath* path, const SkPaint* paint);
-    virtual void drawLines(const float* points, int count, const SkPaint* paint);
-    virtual void drawPoints(const float* points, int count, const SkPaint* paint);
+            float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint) override;
+    virtual void drawPath(const SkPath* path, const SkPaint* paint) override;
+    virtual void drawLines(const float* points, int count, const SkPaint* paint) override;
+    virtual void drawPoints(const float* points, int count, const SkPaint* paint) override;
 
     // Text
     virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
             const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds,
-            DrawOpMode drawOpMode = kDrawOpMode_Immediate);
+            DrawOpMode drawOpMode = kDrawOpMode_Immediate) override;
     virtual void drawTextOnPath(const char* text, int bytesCount, int count, const SkPath* path,
-            float hOffset, float vOffset, const SkPaint* paint);
+            float hOffset, float vOffset, const SkPaint* paint) override;
     virtual void drawPosText(const char* text, int bytesCount, int count,
-            const float* positions, const SkPaint* paint);
+            const float* positions, const SkPaint* paint) override;
 
 // ----------------------------------------------------------------------------
 // Canvas draw operations - special
 // ----------------------------------------------------------------------------
     virtual void drawLayer(DeferredLayerUpdater* layerHandle, float x, float y);
-    virtual void drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t replayFlags);
+    virtual void drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t replayFlags) override;
 
     // TODO: rename for consistency
-    virtual void callDrawGLFunction(Functor* functor, Rect& dirty);
+    virtual void callDrawGLFunction(Functor* functor, Rect& dirty) override;
 
     void setHighContrastText(bool highContrastText) {
         mHighContrastText = highContrastText;
@@ -185,9 +188,9 @@
 // ----------------------------------------------------------------------------
 // CanvasState callbacks
 // ----------------------------------------------------------------------------
-    virtual void onViewportInitialized() { }
-    virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) { }
-    virtual GLuint onGetTargetFbo() const { return -1; }
+    virtual void onViewportInitialized() override { }
+    virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) override { }
+    virtual GLuint onGetTargetFbo() const override { return -1; }
 
 private:
 
@@ -217,7 +220,7 @@
 
     template<class T>
     inline const T* refBuffer(const T* srcBuffer, int32_t count) {
-        if (!srcBuffer) return NULL;
+        if (!srcBuffer) return nullptr;
 
         T* dstBuffer = (T*) mDisplayListData->allocator.alloc(count * sizeof(T));
         memcpy(dstBuffer, srcBuffer, count * sizeof(T));
@@ -229,10 +232,10 @@
     }
 
     inline const SkPath* refPath(const SkPath* path) {
-        if (!path) return NULL;
+        if (!path) return nullptr;
 
         const SkPath* pathCopy = mPathMap.valueFor(path);
-        if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
+        if (pathCopy == nullptr || pathCopy->getGenerationID() != path->getGenerationID()) {
             SkPath* newPathCopy = new SkPath(*path);
             newPathCopy->setSourcePath(path);
 
@@ -249,7 +252,7 @@
     }
 
     inline const SkPaint* refPaint(const SkPaint* paint) {
-        if (!paint) return NULL;
+        if (!paint) return nullptr;
 
         // If there is a draw filter apply it here and store the modified paint
         // so that we don't need to modify the paint every time we access it.
@@ -264,7 +267,7 @@
         const SkPaint* cachedPaint = mPaintMap.valueFor(key);
         // In the unlikely event that 2 unique paints have the same hash we do a
         // object equality check to ensure we don't erroneously dedup them.
-        if (cachedPaint == NULL || *cachedPaint != *paint) {
+        if (cachedPaint == nullptr || *cachedPaint != *paint) {
             cachedPaint =  new SkPaint(*paint);
             // replaceValueFor() performs an add if the entry doesn't exist
             mPaintMap.replaceValueFor(key, cachedPaint);
@@ -275,7 +278,7 @@
     }
 
     inline SkPaint* copyPaint(const SkPaint* paint) {
-        if (!paint) return NULL;
+        if (!paint) return nullptr;
         SkPaint* paintCopy = new SkPaint(*paint);
         mDisplayListData->paints.add(paintCopy);
 
@@ -289,7 +292,7 @@
 
         const SkRegion* regionCopy = mRegionMap.valueFor(region);
         // TODO: Add generation ID to SkRegion
-        if (regionCopy == NULL) {
+        if (regionCopy == nullptr) {
             regionCopy = new SkRegion(*region);
             // replaceValueFor() performs an add if the entry doesn't exist
             mRegionMap.replaceValueFor(region, regionCopy);
diff --git a/libs/hwui/Fence.h b/libs/hwui/Fence.h
index f175e98..fc29f7ac1 100644
--- a/libs/hwui/Fence.h
+++ b/libs/hwui/Fence.h
@@ -43,7 +43,7 @@
     Fence() {
         mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
         if (mDisplay != EGL_NO_DISPLAY) {
-            mFence = eglCreateSyncKHR(mDisplay, EGL_SYNC_FENCE_KHR, NULL);
+            mFence = eglCreateSyncKHR(mDisplay, EGL_SYNC_FENCE_KHR, nullptr);
         } else {
             mFence = EGL_NO_SYNC_KHR;
         }
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index e11128c..668ee64 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -66,7 +66,7 @@
     }
     ~TextSetupFunctor() { }
 
-    status_t operator ()(int what, void* data);
+    status_t operator ()(int what, void* data) override;
 
     OpenGLRenderer* renderer;
     float x;
diff --git a/libs/hwui/GammaFontRenderer.h b/libs/hwui/GammaFontRenderer.h
index 46cfd04..623df1f 100644
--- a/libs/hwui/GammaFontRenderer.h
+++ b/libs/hwui/GammaFontRenderer.h
@@ -59,36 +59,36 @@
         delete mRenderer;
     }
 
-    void clear() {
+    void clear() override {
         delete mRenderer;
-        mRenderer = NULL;
+        mRenderer = nullptr;
     }
 
-    void flush() {
+    void flush() override {
         if (mRenderer) {
             mRenderer->flushLargeCaches();
         }
     }
 
-    FontRenderer& getFontRenderer(const SkPaint* paint) {
+    FontRenderer& getFontRenderer(const SkPaint* paint) override {
         if (!mRenderer) {
             mRenderer = new FontRenderer;
         }
         return *mRenderer;
     }
 
-    uint32_t getFontRendererCount() const {
+    uint32_t getFontRendererCount() const override {
         return 1;
     }
 
-    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
         return mRenderer ? mRenderer->getCacheSize(format) : 0;
     }
 
-    void describe(ProgramDescription& description, const SkPaint* paint) const;
-    void setupProgram(ProgramDescription& description, Program* program) const;
+    void describe(ProgramDescription& description, const SkPaint* paint) const override;
+    void setupProgram(ProgramDescription& description, Program* program) const override;
 
-    void endPrecaching();
+    void endPrecaching() override;
 
 private:
     ShaderGammaFontRenderer(bool multiGamma);
@@ -105,18 +105,18 @@
         delete mRenderer;
     }
 
-    void clear() {
+    void clear() override {
         delete mRenderer;
-        mRenderer = NULL;
+        mRenderer = nullptr;
     }
 
-    void flush() {
+    void flush() override {
         if (mRenderer) {
             mRenderer->flushLargeCaches();
         }
     }
 
-    FontRenderer& getFontRenderer(const SkPaint* paint) {
+    FontRenderer& getFontRenderer(const SkPaint* paint) override {
         if (!mRenderer) {
             mRenderer = new FontRenderer;
             mRenderer->setGammaTable(&mGammaTable[0]);
@@ -124,21 +124,21 @@
         return *mRenderer;
     }
 
-    uint32_t getFontRendererCount() const {
+    uint32_t getFontRendererCount() const override {
         return 1;
     }
 
-    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
         return mRenderer ? mRenderer->getCacheSize(format) : 0;
     }
 
-    void describe(ProgramDescription& description, const SkPaint* paint) const {
+    void describe(ProgramDescription& description, const SkPaint* paint) const override {
     }
 
-    void setupProgram(ProgramDescription& description, Program* program) const {
+    void setupProgram(ProgramDescription& description, Program* program) const override {
     }
 
-    void endPrecaching();
+    void endPrecaching() override;
 
 private:
     LookupGammaFontRenderer();
@@ -153,16 +153,16 @@
 public:
     ~Lookup3GammaFontRenderer();
 
-    void clear();
-    void flush();
+    void clear() override;
+    void flush() override;
 
-    FontRenderer& getFontRenderer(const SkPaint* paint);
+    FontRenderer& getFontRenderer(const SkPaint* paint) override;
 
-    uint32_t getFontRendererCount() const {
+    uint32_t getFontRendererCount() const override {
         return kGammaCount;
     }
 
-    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+    uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
         if (fontRenderer >= kGammaCount) return 0;
 
         FontRenderer* renderer = mRenderers[fontRenderer];
@@ -171,13 +171,13 @@
         return renderer->getCacheSize(format);
     }
 
-    void describe(ProgramDescription& description, const SkPaint* paint) const {
+    void describe(ProgramDescription& description, const SkPaint* paint) const override {
     }
 
-    void setupProgram(ProgramDescription& description, Program* program) const {
+    void setupProgram(ProgramDescription& description, Program* program) const override {
     }
 
-    void endPrecaching();
+    void endPrecaching() override;
 
 private:
     Lookup3GammaFontRenderer();
diff --git a/libs/hwui/GradientCache.h b/libs/hwui/GradientCache.h
index c94b6f0..ef4e0cd 100644
--- a/libs/hwui/GradientCache.h
+++ b/libs/hwui/GradientCache.h
@@ -33,8 +33,8 @@
 struct GradientCacheEntry {
     GradientCacheEntry() {
         count = 0;
-        colors = NULL;
-        positions = NULL;
+        colors = nullptr;
+        positions = nullptr;
     }
 
     GradientCacheEntry(uint32_t* colors, float* positions, uint32_t count) {
@@ -118,7 +118,7 @@
      * Used as a callback when an entry is removed from the cache.
      * Do not invoke directly.
      */
-    void operator()(GradientCacheEntry& shader, Texture*& texture);
+    void operator()(GradientCacheEntry& shader, Texture*& texture) override;
 
     /**
      * Returns the texture associated with the specified shader.
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 0ff8f3e..7d17b9b 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -96,10 +96,10 @@
 private:
     struct LayerEntry {
         LayerEntry():
-            mLayer(NULL), mWidth(0), mHeight(0) {
+            mLayer(nullptr), mWidth(0), mHeight(0) {
         }
 
-        LayerEntry(const uint32_t layerWidth, const uint32_t layerHeight): mLayer(NULL) {
+        LayerEntry(const uint32_t layerWidth, const uint32_t layerHeight): mLayer(nullptr) {
             mWidth = Layer::computeIdealWidth(layerWidth);
             mHeight = Layer::computeIdealHeight(layerHeight);
         }
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 1c5c578..a760135 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -210,7 +210,7 @@
 
     void decomposeScale(float& sx, float& sy) const;
 
-    void dump(const char* label = NULL) const;
+    void dump(const char* label = nullptr) const;
 
     static const Matrix4& identity();
 
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index f200c55..1c4c327 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -680,7 +680,7 @@
             writableSnapshot()->resetTransform(-bounds.left, -bounds.top, 0.0f);
             writableSnapshot()->resetClip(clip.left, clip.top, clip.right, clip.bottom);
             writableSnapshot()->initializeViewport(bounds.getWidth(), bounds.getHeight());
-            writableSnapshot()->roundRectClipState = NULL;
+            writableSnapshot()->roundRectClipState = nullptr;
         }
     }
 
@@ -791,7 +791,7 @@
                 // Unfortunately some drivers will turn the entire target texture black
                 // when reading outside of the window.
                 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, layer->getWidth(), layer->getHeight(),
-                        0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+                        0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
                 layer->setEmpty(false);
             }
 
@@ -817,7 +817,7 @@
     writableSnapshot()->resetTransform(-bounds.left, -bounds.top, 0.0f);
     writableSnapshot()->resetClip(clip.left, clip.top, clip.right, clip.bottom);
     writableSnapshot()->initializeViewport(bounds.getWidth(), bounds.getHeight());
-    writableSnapshot()->roundRectClipState = NULL;
+    writableSnapshot()->roundRectClipState = nullptr;
 
     endTiling();
     debugOverdraw(false, false);
@@ -865,7 +865,7 @@
 
     bool clipRequired = false;
     mState.calculateQuickRejectForScissor(rect.left, rect.top, rect.right, rect.bottom,
-            &clipRequired, NULL, false); // safely ignore return, should never be rejected
+            &clipRequired, nullptr, false); // safely ignore return, should never be rejected
     mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);
 
     if (fboLayer) {
@@ -917,10 +917,10 @@
     dirtyClip();
 
     // Failing to add the layer to the cache should happen only if the layer is too large
-    layer->setConvexMask(NULL);
+    layer->setConvexMask(nullptr);
     if (!mCaches.layerCache.put(layer)) {
         LAYER_LOGD("Deleting layer");
-        layer->decStrong(0);
+        layer->decStrong(nullptr);
     }
 }
 
@@ -1037,14 +1037,14 @@
     , mLayer(layer) {
     }
 
-    virtual bool asACustomShader(void** data) const {
+    virtual bool asACustomShader(void** data) const override {
         if (data) {
             *data = static_cast<void*>(mLayer);
         }
         return true;
     }
 
-    virtual bool isOpaque() const {
+    virtual bool isOpaque() const override {
         return !mLayer->isBlend();
     }
 
@@ -1053,13 +1053,13 @@
         LOG_ALWAYS_FATAL("LayerShader should never be drawn with raster backend.");
     }
 
-    virtual void flatten(SkWriteBuffer&) const {
+    virtual void flatten(SkWriteBuffer&) const override {
         LOG_ALWAYS_FATAL("LayerShader should never be flattened.");
     }
 
-    virtual Factory getFactory() const {
+    virtual Factory getFactory() const override {
         LOG_ALWAYS_FATAL("LayerShader should never be created from a stream.");
-        return NULL;
+        return nullptr;
     }
 private:
     // Unowned.
@@ -1092,7 +1092,7 @@
         const SkPath* maskPath = layer->getConvexMask();
         DRAW_DOUBLE_STENCIL(drawConvexPath(*maskPath, &paint));
 
-        paint.setShader(NULL);
+        paint.setShader(nullptr);
         restore();
 
         return;
@@ -1173,7 +1173,7 @@
 
         if (numQuads >= gMaxNumberOfQuads) {
             DRAW_DOUBLE_STENCIL(glDrawElements(GL_TRIANGLES, numQuads * 6,
-                            GL_UNSIGNED_SHORT, NULL));
+                    GL_UNSIGNED_SHORT, nullptr));
             numQuads = 0;
             mesh = mCaches.getRegionMesh();
         }
@@ -1181,7 +1181,7 @@
 
     if (numQuads > 0) {
         DRAW_DOUBLE_STENCIL(glDrawElements(GL_TRIANGLES, numQuads * 6,
-                        GL_UNSIGNED_SHORT, NULL));
+                GL_UNSIGNED_SHORT, nullptr));
     }
 
 #if DEBUG_LAYERS_AS_REGIONS
@@ -1267,7 +1267,7 @@
         GLsizei drawCount = min(elementsCount, (GLsizei) gMaxNumberOfQuads * 6);
 
         setupDrawIndexedVertices(&mesh[0].x);
-        glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, NULL);
+        glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, nullptr);
 
         elementsCount -= drawCount;
         // Though there are 4 vertices in a quad, we use 6 indices per
@@ -1408,13 +1408,13 @@
  * This method should be called when restoreDisplayState() won't be restoring the clip
  */
 void OpenGLRenderer::setupMergedMultiDraw(const Rect* clipRect) {
-    if (clipRect != NULL) {
+    if (clipRect != nullptr) {
         writableSnapshot()->setClip(clipRect->left, clipRect->top, clipRect->right, clipRect->bottom);
     } else {
         writableSnapshot()->setClip(0, 0, mState.getWidth(), mState.getHeight());
     }
     dirtyClip();
-    mCaches.setScissorEnabled(clipRect != NULL || mScissorOptimizationDisabled);
+    mCaches.setScissorEnabled(clipRect != nullptr || mScissorOptimizationDisabled);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1643,21 +1643,21 @@
 }
 
 void OpenGLRenderer::setupDrawShader(const SkShader* shader) {
-    if (shader != NULL) {
+    if (shader != nullptr) {
         SkiaShader::describe(&mCaches, mDescription, mExtensions, *shader);
     }
 }
 
 void OpenGLRenderer::setupDrawColorFilter(const SkColorFilter* filter) {
-    if (filter == NULL) {
+    if (filter == nullptr) {
         return;
     }
 
     SkXfermode::Mode mode;
-    if (filter->asColorMode(NULL, &mode)) {
+    if (filter->asColorMode(nullptr, &mode)) {
         mDescription.colorOp = ProgramDescription::kColorBlend;
         mDescription.colorMode = mode;
-    } else if (filter->asColorMatrix(NULL)) {
+    } else if (filter->asColorMatrix(nullptr)) {
         mDescription.colorOp = ProgramDescription::kColorMatrix;
     }
 }
@@ -1724,7 +1724,8 @@
 
     bool dirty = right - left > 0.0f && bottom - top > 0.0f;
     const Matrix4& transformMatrix = ignoreTransform ? Matrix4::identity() : *currentTransform();
-    mCaches.currentProgram->set(writableSnapshot()->getOrthoMatrix(), mModelViewMatrix, transformMatrix, offset);
+    mCaches.currentProgram->set(writableSnapshot()->getOrthoMatrix(),
+            mModelViewMatrix, transformMatrix, offset);
     if (dirty && mTrackDirtyRegions) {
         if (!ignoreTransform) {
             dirtyLayer(left, top, right, bottom, *currentTransform());
@@ -1747,7 +1748,7 @@
 }
 
 void OpenGLRenderer::setupDrawShaderUniforms(const SkShader* shader, bool ignoreTransform) {
-    if (shader == NULL) {
+    if (shader == nullptr) {
         return;
     }
 
@@ -1765,7 +1766,7 @@
 }
 
 void OpenGLRenderer::setupDrawColorFilterUniforms(const SkColorFilter* filter) {
-    if (NULL == filter) {
+    if (nullptr == filter) {
         return;
     }
 
@@ -1813,7 +1814,7 @@
 
 void OpenGLRenderer::setupDrawSimpleMesh() {
     bool force = mCaches.bindMeshBuffer();
-    mCaches.bindPositionVertexPointer(force, 0);
+    mCaches.bindPositionVertexPointer(force, nullptr);
     mCaches.unbindIndicesBuffer();
 }
 
@@ -1933,7 +1934,8 @@
     }
 }
 
-void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, const SkPaint* paint) {
+void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top,
+        const SkPaint* paint) {
     float x = left;
     float y = top;
 
@@ -1953,7 +1955,7 @@
     // No need to check for a UV mapper on the texture object, only ARGB_8888
     // bitmaps get packed in the atlas
     drawAlpha8TextureMesh(x, y, x + texture->width, y + texture->height, texture->id,
-            paint, (GLvoid*) NULL, (GLvoid*) gMeshTextureOffset,
+            paint, (GLvoid*) nullptr, (GLvoid*) gMeshTextureOffset,
             GL_TRIANGLE_STRIP, gMeshCount, ignoreTransform);
 }
 
@@ -2374,14 +2376,16 @@
         glDrawArrays(GL_TRIANGLE_STRIP, 0, vertexBuffer.getVertexCount());
     } else if (mode == VertexBuffer::kOnePolyRingShadow) {
         mCaches.bindShadowIndicesBuffer();
-        glDrawElements(GL_TRIANGLE_STRIP, ONE_POLY_RING_SHADOW_INDEX_COUNT, GL_UNSIGNED_SHORT, 0);
+        glDrawElements(GL_TRIANGLE_STRIP, ONE_POLY_RING_SHADOW_INDEX_COUNT,
+                GL_UNSIGNED_SHORT, nullptr);
     } else if (mode == VertexBuffer::kTwoPolyRingShadow) {
         mCaches.bindShadowIndicesBuffer();
-        glDrawElements(GL_TRIANGLE_STRIP, TWO_POLY_RING_SHADOW_INDEX_COUNT, GL_UNSIGNED_SHORT, 0);
+        glDrawElements(GL_TRIANGLE_STRIP, TWO_POLY_RING_SHADOW_INDEX_COUNT,
+                GL_UNSIGNED_SHORT, nullptr);
     } else if (mode == VertexBuffer::kIndices) {
         mCaches.unbindIndicesBuffer();
-        glDrawElements(GL_TRIANGLE_STRIP, vertexBuffer.getIndexCount(), GL_UNSIGNED_SHORT,
-                vertexBuffer.getIndices());
+        glDrawElements(GL_TRIANGLE_STRIP, vertexBuffer.getIndexCount(),
+                GL_UNSIGNED_SHORT, vertexBuffer.getIndices());
     }
 
     if (isAA) {
@@ -2491,7 +2495,7 @@
         return;
     }
 
-    if (p->getPathEffect() != 0) {
+    if (p->getPathEffect() != nullptr) {
         mCaches.activeTexture(0);
         const PathTexture* texture = mCaches.pathCache.getRoundRect(
                 right - left, bottom - top, rx, ry, p);
@@ -2509,7 +2513,7 @@
             || paintWillNotDraw(*p)) {
         return;
     }
-    if (p->getPathEffect() != 0) {
+    if (p->getPathEffect() != nullptr) {
         mCaches.activeTexture(0);
         const PathTexture* texture = mCaches.pathCache.getCircle(radius, p);
         drawShape(x - radius, y - radius, texture, p);
@@ -2532,7 +2536,7 @@
         return;
     }
 
-    if (p->getPathEffect() != 0) {
+    if (p->getPathEffect() != nullptr) {
         mCaches.activeTexture(0);
         const PathTexture* texture = mCaches.pathCache.getOval(right - left, bottom - top, p);
         drawShape(left, top, texture, p);
@@ -2556,7 +2560,7 @@
     }
 
     // TODO: support fills (accounting for concavity if useCenter && sweepAngle > 180)
-    if (p->getStyle() != SkPaint::kStroke_Style || p->getPathEffect() != 0 || useCenter) {
+    if (p->getStyle() != SkPaint::kStroke_Style || p->getPathEffect() != nullptr || useCenter) {
         mCaches.activeTexture(0);
         const PathTexture* texture = mCaches.pathCache.getArc(right - left, bottom - top,
                 startAngle, sweepAngle, useCenter, p);
@@ -2592,7 +2596,7 @@
 
     if (p->getStyle() != SkPaint::kFill_Style) {
         // only fill style is supported by drawConvexPath, since others have to handle joins
-        if (p->getPathEffect() != 0 || p->getStrokeJoin() != SkPaint::kMiter_Join ||
+        if (p->getPathEffect() != nullptr || p->getStrokeJoin() != SkPaint::kMiter_Join ||
                 p->getStrokeMiter() != SkPaintDefaults_MiterLimit) {
             mCaches.activeTexture(0);
             const PathTexture* texture =
@@ -2661,7 +2665,7 @@
     setupDrawPureColorUniforms();
     setupDrawColorFilterUniforms(getColorFilter(paint));
     setupDrawShaderUniforms(getShader(paint));
-    setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+    setupDrawMesh(nullptr, (GLvoid*) gMeshTextureOffset);
 
     glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
 }
@@ -2673,7 +2677,7 @@
 
 void OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count,
         const float* positions, const SkPaint* paint) {
-    if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
+    if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
         return;
     }
 
@@ -2718,7 +2722,7 @@
 
     TextSetupFunctor functor(this, x, y, pureTranslate, alpha, mode, paint);
     if (fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
-            positions, hasActiveLayer ? &bounds : NULL, &functor)) {
+            positions, hasActiveLayer ? &bounds : nullptr, &functor)) {
         if (hasActiveLayer) {
             if (!pureTranslate) {
                 currentTransform()->mapRect(bounds);
@@ -2821,7 +2825,7 @@
     if (drawOpMode == kDrawOpMode_Immediate) {
         // The checks for corner-case ignorable text and quick rejection is only done for immediate
         // drawing as ops from DeferredDisplayList are already filtered for these
-        if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint) ||
+        if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint) ||
                 quickRejectSetupScissor(bounds)) {
             return;
         }
@@ -2871,7 +2875,7 @@
     fontRenderer.setTextureFiltering(linearFilter);
 
     // TODO: Implement better clipping for scaled/rotated text
-    const Rect* clip = !pureTranslate ? NULL : mState.currentClipRect();
+    const Rect* clip = !pureTranslate ? nullptr : mState.currentClipRect();
     Rect layerBounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
 
     bool status;
@@ -2883,10 +2887,10 @@
         SkPaint paintCopy(*paint);
         paintCopy.setTextAlign(SkPaint::kLeft_Align);
         status = fontRenderer.renderPosText(&paintCopy, clip, text, 0, bytesCount, count, x, y,
-                positions, hasActiveLayer ? &layerBounds : NULL, &functor, forceFinish);
+                positions, hasActiveLayer ? &layerBounds : nullptr, &functor, forceFinish);
     } else {
         status = fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
-                positions, hasActiveLayer ? &layerBounds : NULL, &functor, forceFinish);
+                positions, hasActiveLayer ? &layerBounds : nullptr, &functor, forceFinish);
     }
 
     if ((status || drawOpMode != kDrawOpMode_Immediate) && hasActiveLayer) {
@@ -2903,7 +2907,7 @@
 
 void OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count,
         const SkPath* path, float hOffset, float vOffset, const SkPaint* paint) {
-    if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
+    if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
         return;
     }
 
@@ -2925,7 +2929,7 @@
     const bool hasActiveLayer = hasLayer();
 
     if (fontRenderer.renderTextOnPath(paint, clip, text, 0, bytesCount, count, path,
-            hOffset, vOffset, hasActiveLayer ? &bounds : NULL, &functor)) {
+            hOffset, vOffset, hasActiveLayer ? &bounds : nullptr, &functor)) {
         if (hasActiveLayer) {
             currentTransform()->mapRect(bounds);
             dirtyLayerUnchecked(bounds, getRegion());
@@ -2956,7 +2960,7 @@
         return;
     }
 
-    mat4* transform = NULL;
+    mat4* transform = nullptr;
     if (layer->isTextureLayer()) {
         transform = &layer->getTransform();
         if (!transform->isIdentity()) {
@@ -2966,8 +2970,9 @@
     }
 
     bool clipRequired = false;
-    const bool rejected = mState.calculateQuickRejectForScissor(x, y,
-            x + layer->layer.getWidth(), y + layer->layer.getHeight(), &clipRequired, NULL, false);
+    const bool rejected = mState.calculateQuickRejectForScissor(
+            x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight(),
+            &clipRequired, nullptr, false);
 
     if (rejected) {
         if (transform && !transform->isIdentity()) {
@@ -3021,7 +3026,7 @@
 
                 setupDrawMeshIndices(&mesh[0].x, &mesh[0].u);
                 DRAW_DOUBLE_STENCIL_IF(!layer->hasDrawnSinceUpdate,
-                        glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, NULL));
+                        glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, nullptr));
 
                 elementsCount -= drawCount;
                 // Though there are 4 vertices in a quad, we use 6 indices per
@@ -3095,7 +3100,7 @@
     setupDrawPureColorUniforms();
     setupDrawColorFilterUniforms(getColorFilter(paint));
     setupDrawShaderUniforms(getShader(paint));
-    setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+    setupDrawMesh(nullptr, (GLvoid*) gMeshTextureOffset);
 
     glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
 }
@@ -3283,7 +3288,7 @@
         Texture* texture, const SkPaint* paint) {
     texture->setWrap(GL_CLAMP_TO_EDGE, true);
 
-    GLvoid* vertices = (GLvoid*) NULL;
+    GLvoid* vertices = (GLvoid*) nullptr;
     GLvoid* texCoords = (GLvoid*) gMeshTextureOffset;
 
     if (texture->uvMapper) {
@@ -3366,7 +3371,7 @@
     setupDrawColorFilterUniforms(getColorFilter(paint));
     setupDrawMeshIndices(vertices, texCoords, vbo);
 
-    glDrawElements(drawMode, elementsCount, GL_UNSIGNED_SHORT, NULL);
+    glDrawElements(drawMode, elementsCount, GL_UNSIGNED_SHORT, nullptr);
 }
 
 void OpenGLRenderer::drawAlpha8TextureMesh(float left, float top, float right, float bottom,
@@ -3374,14 +3379,14 @@
         GLvoid* vertices, GLvoid* texCoords, GLenum drawMode, GLsizei elementsCount,
         bool ignoreTransform, ModelViewMode modelViewMode, bool dirty) {
 
-    int color = paint != NULL ? paint->getColor() : 0;
+    int color = paint != nullptr ? paint->getColor() : 0;
     int alpha;
     SkXfermode::Mode mode;
     getAlphaAndMode(paint, &alpha, &mode);
 
     setupDraw();
     setupDrawWithTexture(true);
-    if (paint != NULL) {
+    if (paint != nullptr) {
         setupDrawAlpha8Color(color, alpha);
     }
     setupDrawColorFilter(getColorFilter(paint));
@@ -3402,7 +3407,7 @@
 void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode,
         ProgramDescription& description, bool swapSrcDst) {
 
-    if (writableSnapshot()->roundRectClipState != NULL /*&& !mSkipOutlineClip*/) {
+    if (writableSnapshot()->roundRectClipState != nullptr /*&& !mSkipOutlineClip*/) {
         blend = true;
         mDescription.hasRoundRectClip = true;
     }
@@ -3452,7 +3457,7 @@
 
 bool OpenGLRenderer::useProgram(Program* program) {
     if (!program->isInUse()) {
-        if (mCaches.currentProgram != NULL) mCaches.currentProgram->remove();
+        if (mCaches.currentProgram != nullptr) mCaches.currentProgram->remove();
         program->use();
         mCaches.currentProgram = program;
         return false;
@@ -3468,7 +3473,8 @@
     TextureVertex::setUV(v++, u2, v2);
 }
 
-void OpenGLRenderer::getAlphaAndMode(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) const {
+void OpenGLRenderer::getAlphaAndMode(const SkPaint* paint, int* alpha,
+        SkXfermode::Mode* mode) const {
     getAlphaAndModeDirect(paint, alpha,  mode);
     if (mDrawModifiers.mOverrideLayerAlpha < 1.0f) {
         // if drawing a layer, ignore the paint's alpha
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index d3c35a8..fbb90a7 100755
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -126,13 +126,14 @@
     void initLight(const Vector3& lightCenter, float lightRadius,
             uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
 
-    virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
-    virtual void prepare(bool opaque) {
+    virtual void prepareDirty(float left, float top, float right, float bottom,
+            bool opaque) override;
+    virtual void prepare(bool opaque) override {
         prepareDirty(0.0f, 0.0f, mState.getWidth(), mState.getHeight(), opaque);
     }
-    virtual bool finish();
+    virtual bool finish() override;
 
-    virtual void callDrawGLFunction(Functor* functor, Rect& dirty);
+    virtual void callDrawGLFunction(Functor* functor, Rect& dirty) override;
 
     void pushLayerUpdate(Layer* layer);
     void cancelLayerUpdate(Layer* layer);
@@ -140,8 +141,8 @@
     void markLayersAsBuildLayers();
 
     virtual int saveLayer(float left, float top, float right, float bottom,
-            const SkPaint* paint, int flags) {
-        return saveLayer(left, top, right, bottom, paint, flags, NULL);
+            const SkPaint* paint, int flags) override {
+        return saveLayer(left, top, right, bottom, paint, flags, nullptr);
     }
 
     // Specialized saveLayer implementation, which will pass the convexMask to an FBO layer, if
@@ -152,49 +153,51 @@
     int saveLayerDeferred(float left, float top, float right, float bottom,
             const SkPaint* paint, int flags);
 
-    virtual void drawRenderNode(RenderNode* displayList, Rect& dirty, int32_t replayFlags = 1);
+    virtual void drawRenderNode(RenderNode* displayList, Rect& dirty,
+            int32_t replayFlags = 1) override;
     virtual void drawLayer(Layer* layer, float x, float y);
-    virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint);
+    virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) override;
     void drawBitmaps(const SkBitmap* bitmap, AssetAtlas::Entry* entry, int bitmapCount,
             TextureVertex* vertices, bool pureTranslate, const Rect& bounds, const SkPaint* paint);
     virtual void drawBitmap(const SkBitmap* bitmap, float srcLeft, float srcTop,
             float srcRight, float srcBottom, float dstLeft, float dstTop,
-            float dstRight, float dstBottom, const SkPaint* paint);
-    virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint);
+            float dstRight, float dstBottom, const SkPaint* paint) override;
+    virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint) override;
     virtual void drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight,
-            const float* vertices, const int* colors, const SkPaint* paint);
+            const float* vertices, const int* colors, const SkPaint* paint) override;
     void drawPatches(const SkBitmap* bitmap, AssetAtlas::Entry* entry,
             TextureVertex* vertices, uint32_t indexCount, const SkPaint* paint);
     virtual void drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
-            float left, float top, float right, float bottom, const SkPaint* paint);
+            float left, float top, float right, float bottom, const SkPaint* paint) override;
     void drawPatch(const SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry,
             float left, float top, float right, float bottom, const SkPaint* paint);
-    virtual void drawColor(int color, SkXfermode::Mode mode);
+    virtual void drawColor(int color, SkXfermode::Mode mode) override;
     virtual void drawRect(float left, float top, float right, float bottom,
-            const SkPaint* paint);
+            const SkPaint* paint) override;
     virtual void drawRoundRect(float left, float top, float right, float bottom,
-            float rx, float ry, const SkPaint* paint);
-    virtual void drawCircle(float x, float y, float radius, const SkPaint* paint);
+            float rx, float ry, const SkPaint* paint) override;
+    virtual void drawCircle(float x, float y, float radius, const SkPaint* paint) override;
     virtual void drawOval(float left, float top, float right, float bottom,
-            const SkPaint* paint);
+            const SkPaint* paint) override;
     virtual void drawArc(float left, float top, float right, float bottom,
-            float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint);
-    virtual void drawPath(const SkPath* path, const SkPaint* paint);
-    virtual void drawLines(const float* points, int count, const SkPaint* paint);
-    virtual void drawPoints(const float* points, int count, const SkPaint* paint);
+            float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint) override;
+    virtual void drawPath(const SkPath* path, const SkPaint* paint) override;
+    virtual void drawLines(const float* points, int count, const SkPaint* paint) override;
+    virtual void drawPoints(const float* points, int count, const SkPaint* paint) override;
     virtual void drawTextOnPath(const char* text, int bytesCount, int count, const SkPath* path,
-            float hOffset, float vOffset, const SkPaint* paint);
+            float hOffset, float vOffset, const SkPaint* paint) override;
     virtual void drawPosText(const char* text, int bytesCount, int count,
-            const float* positions, const SkPaint* paint);
+            const float* positions, const SkPaint* paint) override;
     virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
             const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds,
-            DrawOpMode drawOpMode = kDrawOpMode_Immediate);
-    virtual void drawRects(const float* rects, int count, const SkPaint* paint);
+            DrawOpMode drawOpMode = kDrawOpMode_Immediate) override;
+    virtual void drawRects(const float* rects, int count, const SkPaint* paint) override;
 
     void drawShadow(float casterAlpha,
-            const VertexBuffer* ambientShadowVertexBuffer, const VertexBuffer* spotShadowVertexBuffer);
+            const VertexBuffer* ambientShadowVertexBuffer,
+            const VertexBuffer* spotShadowVertexBuffer);
 
-    virtual void setDrawFilter(SkDrawFilter* filter);
+    virtual void setDrawFilter(SkDrawFilter* filter) override;
 
     // If this value is set to < 1.0, it overrides alpha set on layer (see drawBitmap, drawLayer)
     void setOverrideLayerAlpha(float alpha) { mDrawModifiers.mOverrideLayerAlpha = alpha; }
@@ -264,7 +267,8 @@
      * @param alpha Where to store the resulting alpha
      * @param mode Where to store the resulting xfermode
      */
-    static inline void getAlphaAndModeDirect(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) {
+    static inline void getAlphaAndModeDirect(const SkPaint* paint, int* alpha,
+            SkXfermode::Mode* mode) {
         *mode = getXfermodeDirect(paint);
         *alpha = getAlphaDirect(paint);
     }
@@ -301,7 +305,7 @@
     }
 
     static inline bool hasTextShadow(const SkPaint* paint) {
-        return getTextShadow(paint, NULL);
+        return getTextShadow(paint, nullptr);
     }
 
     /**
@@ -335,34 +339,36 @@
     ///////////////////////////////////////////////////////////////////
     /// State manipulation
 
-    virtual void setViewport(int width, int height) { mState.setViewport(width, height); }
+    virtual void setViewport(int width, int height) override { mState.setViewport(width, height); }
 
-    virtual int getSaveCount() const;
-    virtual int save(int flags);
-    virtual void restore();
-    virtual void restoreToCount(int saveCount);
+    virtual int getSaveCount() const override;
+    virtual int save(int flags) override;
+    virtual void restore() override;
+    virtual void restoreToCount(int saveCount) override;
 
-    virtual void getMatrix(SkMatrix* outMatrix) const { mState.getMatrix(outMatrix); }
-    virtual void setMatrix(const SkMatrix& matrix) { mState.setMatrix(matrix); }
-    virtual void concatMatrix(const SkMatrix& matrix) { mState.concatMatrix(matrix); }
+    virtual void getMatrix(SkMatrix* outMatrix) const override { mState.getMatrix(outMatrix); }
+    virtual void setMatrix(const SkMatrix& matrix) override { mState.setMatrix(matrix); }
+    virtual void concatMatrix(const SkMatrix& matrix) override { mState.concatMatrix(matrix); }
 
-    virtual void translate(float dx, float dy, float dz = 0.0f);
-    virtual void rotate(float degrees);
-    virtual void scale(float sx, float sy);
-    virtual void skew(float sx, float sy);
+    virtual void translate(float dx, float dy, float dz = 0.0f) override;
+    virtual void rotate(float degrees) override;
+    virtual void scale(float sx, float sy) override;
+    virtual void skew(float sx, float sy) override;
 
     void setMatrix(const Matrix4& matrix); // internal only convenience method
     void concatMatrix(const Matrix4& matrix); // internal only convenience method
 
-    virtual const Rect& getLocalClipBounds() const { return mState.getLocalClipBounds(); }
+    virtual const Rect& getLocalClipBounds() const override { return mState.getLocalClipBounds(); }
     const Rect& getRenderTargetClipBounds() const { return mState.getRenderTargetClipBounds(); }
-    virtual bool quickRejectConservative(float left, float top, float right, float bottom) const {
+    virtual bool quickRejectConservative(float left, float top,
+            float right, float bottom) const override {
         return mState.quickRejectConservative(left, top, right, bottom);
     }
 
-    virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
-    virtual bool clipPath(const SkPath* path, SkRegion::Op op);
-    virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
+    virtual bool clipRect(float left, float top,
+            float right, float bottom, SkRegion::Op op) override;
+    virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
+    virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
 
     /**
      * Does not support different clipping Ops (that is, every call to setClippingOutline is
@@ -380,9 +386,9 @@
     ///////////////////////////////////////////////////////////////////
     /// CanvasStateClient interface
 
-    virtual void onViewportInitialized();
-    virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored);
-    virtual GLuint onGetTargetFbo() const { return 0; }
+    virtual void onViewportInitialized() override;
+    virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) override;
+    virtual GLuint onGetTargetFbo() const override { return 0; }
 
     SkPath* allocPathForFrame() {
         SkPath* path = new SkPath();
@@ -427,8 +433,8 @@
     void attachStencilBufferToLayer(Layer* layer);
 
     bool quickRejectSetupScissor(float left, float top, float right, float bottom,
-            const SkPaint* paint = NULL);
-    bool quickRejectSetupScissor(const Rect& bounds, const SkPaint* paint = NULL) {
+            const SkPaint* paint = nullptr);
+    bool quickRejectSetupScissor(const Rect& bounds, const SkPaint* paint = nullptr) {
         return quickRejectSetupScissor(bounds.left, bounds.top,
                 bounds.right, bounds.bottom, paint);
     }
@@ -495,7 +501,7 @@
      * null then null is returned.
      */
     static inline SkColorFilter* getColorFilter(const SkPaint* paint) {
-        return paint ? paint->getColorFilter() : NULL;
+        return paint ? paint->getColorFilter() : nullptr;
     }
 
     /**
@@ -503,7 +509,7 @@
      * null then null is returned.
      */
     static inline const SkShader* getShader(const SkPaint* paint) {
-        return paint ? paint->getShader() : NULL;
+        return paint ? paint->getShader() : nullptr;
     }
 
     /**
@@ -903,8 +909,8 @@
      * space must be scaled up and translated to fill the quad provided in (l,t,r,b). These
      * transformations are stored in the modelView matrix and uploaded to the shader.
      *
-     * @param offset Set to true if the the matrix should be fudged (translated) slightly to disambiguate
-     * geometry pixel positioning. See Vertex::GeometryFudgeFactor().
+     * @param offset Set to true if the the matrix should be fudged (translated) slightly to
+     * disambiguate geometry pixel positioning. See Vertex::GeometryFudgeFactor().
      *
      * @param ignoreTransform Set to true if l,t,r,b coordinates already in layer space,
      * currentTransform() will be ignored. (e.g. when drawing clip in layer coordinates to stencil,
@@ -930,7 +936,7 @@
     void setupDrawTextureTransform();
     void setupDrawTextureTransformUniforms(mat4& transform);
     void setupDrawTextGammaUniforms();
-    void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = NULL, GLuint vbo = 0);
+    void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = nullptr, GLuint vbo = 0);
     void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors);
     void setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo = 0);
     void setupDrawIndexedVertices(GLvoid* vertices);
diff --git a/libs/hwui/Outline.h b/libs/hwui/Outline.h
index 6dacd5ed..5e9b213 100644
--- a/libs/hwui/Outline.h
+++ b/libs/hwui/Outline.h
@@ -95,7 +95,7 @@
     }
 
     const SkPath* getPath() const {
-        if (mType == kOutlineType_None || mType == kOutlineType_Empty) return NULL;
+        if (mType == kOutlineType_None || mType == kOutlineType_Empty) return nullptr;
 
         return &mPath;
     }
diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h
index d5bbfa6..1af4bb7 100644
--- a/libs/hwui/Patch.h
+++ b/libs/hwui/Patch.h
@@ -31,7 +31,7 @@
 namespace android {
 namespace uirenderer {
 
-class TextureVertex;
+struct TextureVertex;
 
 ///////////////////////////////////////////////////////////////////////////////
 // 9-patch structures
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index 1e40997..4cb5338 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -91,7 +91,7 @@
 
 private:
     struct PatchDescription {
-        PatchDescription(): mPatch(NULL), mBitmapWidth(0), mBitmapHeight(0),
+        PatchDescription(): mPatch(nullptr), mBitmapWidth(0), mBitmapHeight(0),
                 mPixelWidth(0), mPixelHeight(0) {
         }
 
@@ -146,7 +146,7 @@
      * to track available regions of memory in the VBO.
      */
     struct BufferBlock {
-        BufferBlock(uint32_t offset, uint32_t size): offset(offset), size(size), next(NULL) {
+        BufferBlock(uint32_t offset, uint32_t size): offset(offset), size(size), next(nullptr) {
         }
 
         uint32_t offset;
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h
index b0f00c7..ecd3712 100644
--- a/libs/hwui/PathCache.h
+++ b/libs/hwui/PathCache.h
@@ -87,7 +87,7 @@
     }
 
     void clearTask() {
-        if (mTask != NULL) {
+        if (mTask != nullptr) {
             mTask.clear();
         }
     }
@@ -165,7 +165,7 @@
      * Used as a callback when an entry is removed from the cache.
      * Do not invoke directly.
      */
-    void operator()(PathDescription& path, PathTexture*& texture);
+    void operator()(PathDescription& path, PathTexture*& texture) override;
 
     /**
      * Clears the cache. This causes all textures to be deleted.
@@ -292,7 +292,7 @@
         PathProcessor(Caches& caches);
         ~PathProcessor() { }
 
-        virtual void onProcess(const sp<Task<SkBitmap*> >& task);
+        virtual void onProcess(const sp<Task<SkBitmap*> >& task) override;
 
     private:
         uint32_t mMaxTextureSize;
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 7b9459a..a0312e1 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -255,7 +255,7 @@
 
 static inline DebugLevel readDebugLevel() {
     char property[PROPERTY_VALUE_MAX];
-    if (property_get(PROPERTY_DEBUG, property, NULL) > 0) {
+    if (property_get(PROPERTY_DEBUG, property, nullptr) > 0) {
         return (DebugLevel) atoi(property);
     }
     return kDebugDisabled;
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index 13265a9..b046b6f 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -248,7 +248,7 @@
         bottom = fmaxf(bottom, y);
     }
 
-    void dump(const char* label = NULL) const {
+    void dump(const char* label = nullptr) const {
         ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom);
     }
 
diff --git a/libs/hwui/RenderBufferCache.h b/libs/hwui/RenderBufferCache.h
index af8060f..6c668b0 100644
--- a/libs/hwui/RenderBufferCache.h
+++ b/libs/hwui/RenderBufferCache.h
@@ -78,11 +78,11 @@
 private:
     struct RenderBufferEntry {
         RenderBufferEntry():
-            mBuffer(NULL), mWidth(0), mHeight(0) {
+            mBuffer(nullptr), mWidth(0), mHeight(0) {
         }
 
         RenderBufferEntry(GLenum format, const uint32_t width, const uint32_t height):
-            mBuffer(NULL), mFormat(format), mWidth(width), mHeight(height) {
+            mBuffer(nullptr), mFormat(format), mWidth(width), mHeight(height) {
         }
 
         RenderBufferEntry(RenderBuffer* buffer):
diff --git a/libs/hwui/RenderProperties.h b/libs/hwui/RenderProperties.h
index be43e60..f0e22d6 100644
--- a/libs/hwui/RenderProperties.h
+++ b/libs/hwui/RenderProperties.h
@@ -188,7 +188,7 @@
         if (matrix) {
             mStaticMatrix = new SkMatrix(*matrix);
         } else {
-            mStaticMatrix = NULL;
+            mStaticMatrix = nullptr;
         }
         return true;
     }
@@ -203,7 +203,7 @@
         if (matrix) {
             mAnimationMatrix = new SkMatrix(*matrix);
         } else {
-            mAnimationMatrix = NULL;
+            mAnimationMatrix = nullptr;
         }
         return true;
     }
@@ -571,7 +571,7 @@
 
     bool hasShadow() const {
         return getZ() > 0.0f
-                && getOutline().getPath() != NULL
+                && getOutline().getPath() != nullptr
                 && getOutline().getAlpha() != 0.0f;
     }
 
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index 2b7b567..ee44d7a 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -79,13 +79,13 @@
     // TODO: move to a method on android:Paint
     static inline bool paintWillNotDrawText(const SkPaint& paint) {
         return paint.getAlpha() == 0
-                && paint.getLooper() == NULL
+                && paint.getLooper() == nullptr
                 && !paint.getColorFilter()
                 && getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
     }
 
     static bool isBlendedColorFilter(const SkColorFilter* filter) {
-        if (filter == NULL) {
+        if (filter == nullptr) {
             return false;
         }
         return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0;
diff --git a/libs/hwui/RevealClip.h b/libs/hwui/RevealClip.h
index a9600f1..0084a8e 100644
--- a/libs/hwui/RevealClip.h
+++ b/libs/hwui/RevealClip.h
@@ -54,7 +54,7 @@
     float getRadius() const { return mRadius; }
 
     const SkPath* getPath() const {
-        if (!mShouldClip) return NULL;
+        if (!mShouldClip) return nullptr;
 
         return &mPath;
     }
diff --git a/libs/hwui/TessellationCache.h b/libs/hwui/TessellationCache.h
index a7c50eb..3efeaf6 100644
--- a/libs/hwui/TessellationCache.h
+++ b/libs/hwui/TessellationCache.h
@@ -166,7 +166,7 @@
     sp<TaskProcessor<VertexBuffer*> > mProcessor;
     LruCache<Description, Buffer*> mCache;
     class BufferRemovedListener : public OnEntryRemoved<Description, Buffer*> {
-        void operator()(Description& description, Buffer*& buffer);
+        void operator()(Description& description, Buffer*& buffer) override;
     };
     BufferRemovedListener mBufferRemovedListener;
 
@@ -178,8 +178,8 @@
     // holds a pointer, and implicit strong ref to each shadow task of the frame
     LruCache<ShadowDescription, Task<vertexBuffer_pair_t*>*> mShadowCache;
     class BufferPairRemovedListener : public OnEntryRemoved<ShadowDescription, Task<vertexBuffer_pair_t*>*> {
-        void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) {
-            bufferPairTask->decStrong(NULL);
+        void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) override {
+            bufferPairTask->decStrong(nullptr);
         }
     };
     BufferPairRemovedListener mBufferPairRemovedListener;
diff --git a/libs/hwui/TextDropShadowCache.h b/libs/hwui/TextDropShadowCache.h
index bb53a23..caf089f 100644
--- a/libs/hwui/TextDropShadowCache.h
+++ b/libs/hwui/TextDropShadowCache.h
@@ -34,8 +34,8 @@
 class FontRenderer;
 
 struct ShadowText {
-    ShadowText(): len(0), radius(0.0f), textSize(0.0f), typeface(NULL),
-            flags(0), italicStyle(0.0f), scaleX(0), text(NULL), positions(NULL) {
+    ShadowText(): len(0), radius(0.0f), textSize(0.0f), typeface(nullptr),
+            flags(0), italicStyle(0.0f), scaleX(0), text(nullptr), positions(nullptr) {
     }
 
     // len is the number of bytes in text
@@ -76,7 +76,7 @@
         uint32_t charCount = len / sizeof(char16_t);
         str.setTo((const char16_t*) text, charCount);
         text = str.string();
-        if (positions != NULL) {
+        if (positions != nullptr) {
             positionsCopy.clear();
             positionsCopy.appendArray(positions, charCount * 2);
             positions = positionsCopy.array();
@@ -134,7 +134,7 @@
      * Used as a callback when an entry is removed from the cache.
      * Do not invoke directly.
      */
-    void operator()(ShadowText& text, ShadowTexture*& texture);
+    void operator()(ShadowText& text, ShadowTexture*& texture) override;
 
     ShadowTexture* get(const SkPaint* paint, const char* text, uint32_t len,
             int numGlyphs, float radius, const float* positions);
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h
index d7d51a1..0e33e4c 100644
--- a/libs/hwui/TextureCache.h
+++ b/libs/hwui/TextureCache.h
@@ -62,7 +62,7 @@
      * Used as a callback when an entry is removed from the cache.
      * Do not invoke directly.
      */
-    void operator()(uint32_t&, Texture*& texture);
+    void operator()(uint32_t&, Texture*& texture) override;
 
     /**
      * Resets all Textures to not be marked as in use
diff --git a/libs/hwui/VertexBuffer.h b/libs/hwui/VertexBuffer.h
index 8c3a272..d81dd42 100644
--- a/libs/hwui/VertexBuffer.h
+++ b/libs/hwui/VertexBuffer.h
@@ -32,17 +32,17 @@
     };
 
     VertexBuffer()
-            : mBuffer(0)
-            , mIndices(0)
+            : mBuffer(nullptr)
+            , mIndices(nullptr)
             , mVertexCount(0)
             , mIndexCount(0)
             , mAllocatedVertexCount(0)
             , mAllocatedIndexCount(0)
             , mByteCount(0)
             , mMode(kStandard)
-            , mReallocBuffer(0)
-            , mCleanupMethod(NULL)
-            , mCleanupIndexMethod(NULL)
+            , mReallocBuffer(nullptr)
+            , mCleanupMethod(nullptr)
+            , mCleanupIndexMethod(nullptr)
     {}
 
     ~VertexBuffer() {
diff --git a/libs/hwui/font/CacheTexture.h b/libs/hwui/font/CacheTexture.h
index a107c7a..5d3f959 100644
--- a/libs/hwui/font/CacheTexture.h
+++ b/libs/hwui/font/CacheTexture.h
@@ -54,7 +54,7 @@
     CacheBlock* mPrev;
 
     CacheBlock(uint16_t x, uint16_t y, uint16_t width, uint16_t height):
-            mX(x), mY(y), mWidth(width), mHeight(height), mNext(NULL), mPrev(NULL) {
+            mX(x), mY(y), mWidth(width), mHeight(height), mNext(nullptr), mPrev(nullptr) {
     }
 
     static CacheBlock* insertBlock(CacheBlock* head, CacheBlock* newBlock);
@@ -146,7 +146,7 @@
     }
 
     uint16_t* indices() const {
-        return (uint16_t*) 0;
+        return (uint16_t*) nullptr;
     }
 
     void resetMesh() {
diff --git a/libs/hwui/font/Font.h b/libs/hwui/font/Font.h
index d54bc44..3119d73 100644
--- a/libs/hwui/font/Font.h
+++ b/libs/hwui/font/Font.h
@@ -38,7 +38,7 @@
 // Font
 ///////////////////////////////////////////////////////////////////////////////
 
-class CachedGlyphInfo;
+struct CachedGlyphInfo;
 class CacheTexture;
 class FontRenderer;
 
@@ -120,7 +120,7 @@
     void measure(const SkPaint* paint, const char* text, uint32_t start, uint32_t len,
             int numGlyphs, Rect *bounds, const float* positions);
 
-    void invalidateTextureCache(CacheTexture* cacheTexture = NULL);
+    void invalidateTextureCache(CacheTexture* cacheTexture = nullptr);
 
     CachedGlyphInfo* cacheGlyph(const SkPaint* paint, glyph_t glyph, bool precaching);
     void updateGlyphCache(const SkPaint* paint, const SkGlyph& skiaGlyph,
diff --git a/libs/hwui/thread/TaskManager.h b/libs/hwui/thread/TaskManager.h
index 5a933ab..10e8b9e 100644
--- a/libs/hwui/thread/TaskManager.h
+++ b/libs/hwui/thread/TaskManager.h
@@ -84,8 +84,8 @@
         void exit();
 
     private:
-        virtual status_t readyToRun();
-        virtual bool threadLoop();
+        virtual status_t readyToRun() override;
+        virtual bool threadLoop() override;
 
         // Lock for the list of tasks
         mutable Mutex mLock;
diff --git a/libs/hwui/thread/TaskProcessor.h b/libs/hwui/thread/TaskProcessor.h
index d1269f0..eb4ab64 100644
--- a/libs/hwui/thread/TaskProcessor.h
+++ b/libs/hwui/thread/TaskProcessor.h
@@ -47,7 +47,7 @@
     virtual void onProcess(const sp<Task<T> >& task) = 0;
 
 private:
-    virtual void process(const sp<TaskBase>& task) {
+    virtual void process(const sp<TaskBase>& task) override {
         sp<Task<T> > realTask = static_cast<Task<T>* >(task.get());
         // This is the right way to do it but sp<> doesn't play nice
         // sp<Task<T> > realTask = static_cast<sp<Task<T> > >(task);
diff --git a/libs/hwui/utils/SortedList.h b/libs/hwui/utils/SortedList.h
index 2fa890a..a2c8c52 100644
--- a/libs/hwui/utils/SortedList.h
+++ b/libs/hwui/utils/SortedList.h
@@ -93,13 +93,13 @@
     }
 
 protected:
-    virtual void do_construct(void* storage, size_t num) const;
-    virtual void do_destroy(void* storage, size_t num) const;
-    virtual void do_copy(void* dest, const void* from, size_t num) const;
-    virtual void do_splat(void* dest, const void* item, size_t num) const;
-    virtual void do_move_forward(void* dest, const void* from, size_t num) const;
-    virtual void do_move_backward(void* dest, const void* from, size_t num) const;
-    virtual int do_compare(const void* lhs, const void* rhs) const;
+    virtual void do_construct(void* storage, size_t num) const override;
+    virtual void do_destroy(void* storage, size_t num) const override;
+    virtual void do_copy(void* dest, const void* from, size_t num) const override;
+    virtual void do_splat(void* dest, const void* item, size_t num) const override;
+    virtual void do_move_forward(void* dest, const void* from, size_t num) const override;
+    virtual void do_move_backward(void* dest, const void* from, size_t num) const override;
+    virtual int do_compare(const void* lhs, const void* rhs) const override;
 }; // class SortedList
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/utils/SortedListImpl.h b/libs/hwui/utils/SortedListImpl.h
index dc385b5..b101826 100644
--- a/libs/hwui/utils/SortedListImpl.h
+++ b/libs/hwui/utils/SortedListImpl.h
@@ -41,7 +41,7 @@
     virtual int do_compare(const void* lhs, const void* rhs) const = 0;
 
 private:
-    ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;
+    ssize_t _indexOrderOf(const void* item, size_t* order = nullptr) const;
 
     // these are made private, because they can't be used on a SortedVector
     // (they don't have an implementation either)
