Add overrides and switch to nullptr keyword

Changes generated with clang-modernize.

Additionally, fixed some struct-vs-class usage to make clang happy.

Change-Id: Ic6ef2427401ff1e794d26f21f7b44868fc75fb72
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)