Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
diff --git a/src/utils/SkBase64.cpp b/src/utils/SkBase64.cpp
index 545a8eb..4c3078f 100644
--- a/src/utils/SkBase64.cpp
+++ b/src/utils/SkBase64.cpp
@@ -26,7 +26,7 @@
     41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
 };
 
-SkBase64::SkBase64() : fLength((size_t) -1), fData(NULL) {
+SkBase64::SkBase64() : fLength((size_t) -1), fData(nullptr) {
 }
 
 #if defined _WIN32 && _MSC_VER >= 1300  // disable 'two', etc. may be used without having been initialized
@@ -111,7 +111,7 @@
 
 size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr, const char* encodeMap) {
     const char* encode;
-    if (NULL == encodeMap) {
+    if (nullptr == encodeMap) {
         encode = default_encode;
     } else {
         encode = encodeMap;
diff --git a/src/utils/SkBase64.h b/src/utils/SkBase64.h
index ba66dd2..13350b7 100644
--- a/src/utils/SkBase64.h
+++ b/src/utils/SkBase64.h
@@ -26,7 +26,7 @@
        encode[64] will be used as the pad character. Encodings other than the
        default encoding cannot be decoded.
     */
-    static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL);
+    static size_t Encode(const void* src, size_t length, void* dest, const char* encode = nullptr);
 
 private:
     Error decode(const void* srcPtr, size_t length, bool writeDestination);
diff --git a/src/utils/SkBitSet.cpp b/src/utils/SkBitSet.cpp
index 63d18ff..3ace15d 100755
--- a/src/utils/SkBitSet.cpp
+++ b/src/utils/SkBitSet.cpp
@@ -10,7 +10,7 @@
 #include "SkBitSet.h"
 
 SkBitSet::SkBitSet(int numberOfBits)
-    : fBitData(NULL), fDwordCount(0), fBitCount(numberOfBits) {
+    : fBitData(nullptr), fDwordCount(0), fBitCount(numberOfBits) {
     SkASSERT(numberOfBits > 0);
     // Round up size to 32-bit boundary.
     fDwordCount = (numberOfBits + 31) / 32;
@@ -18,7 +18,7 @@
 }
 
 SkBitSet::SkBitSet(const SkBitSet& source)
-    : fBitData(NULL), fDwordCount(0), fBitCount(0) {
+    : fBitData(nullptr), fDwordCount(0), fBitCount(0) {
     *this = source;
 }
 
@@ -36,7 +36,7 @@
 
 bool SkBitSet::operator==(const SkBitSet& rhs) {
     if (fBitCount == rhs.fBitCount) {
-        if (fBitData.get() != NULL) {
+        if (fBitData.get() != nullptr) {
             return (memcmp(fBitData.get(), rhs.fBitData.get(),
                            fDwordCount * sizeof(uint32_t)) == 0);
         }
@@ -50,7 +50,7 @@
 }
 
 void SkBitSet::clearAll() {
-    if (fBitData.get() != NULL) {
+    if (fBitData.get() != nullptr) {
         sk_bzero(fBitData.get(), fDwordCount * sizeof(uint32_t));
     }
 }
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
index e5fcc40..7ef11ee 100644
--- a/src/utils/SkBoundaryPatch.cpp
+++ b/src/utils/SkBoundaryPatch.cpp
@@ -7,7 +7,7 @@
  */
 #include "SkBoundaryPatch.h"
 
-SkBoundaryPatch::SkBoundaryPatch() : fBoundary(NULL) {}
+SkBoundaryPatch::SkBoundaryPatch() : fBoundary(nullptr) {}
 
 SkBoundaryPatch::~SkBoundaryPatch() {
     SkSafeUnref(fBoundary);
@@ -74,6 +74,6 @@
     fPts[12] = fPts[0];
 
     SkPoint loc;
-    SkEvalCubicAt(&fPts[e * 3], t, &loc, NULL, NULL);
+    SkEvalCubicAt(&fPts[e * 3], t, &loc, nullptr, nullptr);
     return loc;
 }
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index c7389ce..c8c462a 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -74,7 +74,7 @@
 }
 
 void SkPatch3D::transform(const SkMatrix3D& m, SkPatch3D* dst) const {
-    if (dst == NULL) {
+    if (dst == nullptr) {
         dst = (SkPatch3D*)this;
     }
     m.mapVector(fU, &dst->fU);
@@ -356,7 +356,7 @@
 }
 
 void Sk3DView::getMatrix(SkMatrix* matrix) const {
-    if (matrix != NULL) {
+    if (matrix != nullptr) {
         SkPatch3D   patch;
         patch.transform(fRec->fMatrix);
         fCamera.patchToMatrix(patch, matrix);
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 8ab853d..8b7a10a 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -104,9 +104,9 @@
     : INHERITED(kVersion, canvas)
     {
         layerCount = 0;
-        layers = NULL;
+        layers = nullptr;
         mcState.clipRectCount = 0;
-        mcState.clipRects = NULL;
+        mcState.clipRects = nullptr;
         originalCanvas = SkRef(canvas);
     }
 
@@ -203,7 +203,7 @@
     if (validator.failed()) {
         SkErrorInternals::SetError(kInvalidOperation_SkError,
                 "CaptureCanvasState does not support canvases with antialiased clips.\n");
-        return NULL;
+        return nullptr;
     }
 
     SkAutoTDelete<SkCanvasState_v1> canvasState(new SkCanvasState_v1(canvas));
@@ -226,7 +226,7 @@
         // we currently only work for bitmap backed devices
         SkPixmap pmap;
         if (!layer.device()->accessPixels(&pmap) || 0 == pmap.width() || 0 == pmap.height()) {
-            return NULL;
+            return nullptr;
         }
 
         SkCanvasLayerState* layerState =
@@ -245,7 +245,7 @@
                 layerState->raster.config = kRGB_565_RasterConfig;
                 break;
             default:
-                return NULL;
+                return nullptr;
         }
         layerState->raster.rowBytes = pmap.rowBytes();
         layerState->raster.pixels = pmap.writable_addr();
@@ -301,7 +301,7 @@
         kUnknown_SkColorType;
 
     if (colorType == kUnknown_SkColorType) {
-        return NULL;
+        return nullptr;
     }
 
     bitmap.installPixels(SkImageInfo::Make(layerState.width, layerState.height,
@@ -327,7 +327,7 @@
     const SkCanvasState_v1* state_v1 = static_cast<const SkCanvasState_v1*>(state);
 
     if (state_v1->layerCount < 1) {
-        return NULL;
+        return nullptr;
     }
 
     SkAutoTUnref<SkCanvasStack> canvas(new SkCanvasStack(state->width, state->height));
@@ -339,7 +339,7 @@
     for (int i = state_v1->layerCount - 1; i >= 0; --i) {
         SkAutoTUnref<SkCanvas> canvasLayer(create_canvas_from_canvas_layer(state_v1->layers[i]));
         if (!canvasLayer.get()) {
-            return NULL;
+            return nullptr;
         }
         canvas->pushCanvas(canvasLayer.get(), SkIPoint::Make(state_v1->layers[i].x,
                                                              state_v1->layers[i].y));
diff --git a/src/utils/SkCullPoints.cpp b/src/utils/SkCullPoints.cpp
index 76e63c7..f77acf1 100644
--- a/src/utils/SkCullPoints.cpp
+++ b/src/utils/SkCullPoints.cpp
@@ -76,7 +76,7 @@
 }
 
 SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) {
-    SkASSERT(line != NULL);
+    SkASSERT(line != nullptr);
 
     LineToResult result = kNo_Result;
     int x0 = fPrevPt.fX;
@@ -107,7 +107,7 @@
 #include "SkPath.h"
 
 SkCullPointsPath::SkCullPointsPath()
-    : fCP(), fPath(NULL) {
+    : fCP(), fPath(nullptr) {
 }
 
 SkCullPointsPath::SkCullPointsPath(const SkIRect& r, SkPath* dst)
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index de249f6..c177295 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -92,7 +92,7 @@
 static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
                       const SkRect* cullRect, SkScalar intervalLength,
                       SkPath* dstPath) {
-    if (NULL == cullRect) {
+    if (nullptr == cullRect) {
         return false;
     }
 
diff --git a/src/utils/SkDashPathPriv.h b/src/utils/SkDashPathPriv.h
index 94222a2..7453dce 100644
--- a/src/utils/SkDashPathPriv.h
+++ b/src/utils/SkDashPathPriv.h
@@ -15,11 +15,11 @@
      * Calculates the initialDashLength, initialDashIndex, and intervalLength based on the
      * inputed phase and intervals. If adjustedPhase is passed in, then the phase will be
      * adjusted to be between 0 and intervalLength. The result will be stored in adjustedPhase.
-     * If adjustedPhase is NULL then it is assumed phase is already between 0 and intervalLength
+     * If adjustedPhase is nullptr then it is assumed phase is already between 0 and intervalLength
      */
     void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count,
                             SkScalar* initialDashLength, int32_t* initialDashIndex,
-                            SkScalar* intervalLength, SkScalar* adjustedPhase = NULL);
+                            SkScalar* intervalLength, SkScalar* adjustedPhase = nullptr);
 
     bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
                         const SkScalar aIntervals[], int32_t count, SkScalar initialDashLength,
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index e8997ab..8d0209d 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -195,7 +195,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void SkDumpCanvas::willSave() {
-    this->dump(kSave_Verb, NULL, "save()");
+    this->dump(kSave_Verb, nullptr, "save()");
     this->INHERITED::willSave();
 }
 
@@ -220,7 +220,7 @@
 }
 
 void SkDumpCanvas::willRestore() {
-    this->dump(kRestore_Verb, NULL, "restore");
+    this->dump(kRestore_Verb, nullptr, "restore");
     this->INHERITED::willRestore();
 }
 
@@ -229,18 +229,18 @@
 
     switch (matrix.getType()) {
         case SkMatrix::kTranslate_Mask:
-            this->dump(kMatrix_Verb, NULL, "translate(%g %g)",
+            this->dump(kMatrix_Verb, nullptr, "translate(%g %g)",
                        SkScalarToFloat(matrix.getTranslateX()),
                        SkScalarToFloat(matrix.getTranslateY()));
             break;
         case SkMatrix::kScale_Mask:
-            this->dump(kMatrix_Verb, NULL, "scale(%g %g)",
+            this->dump(kMatrix_Verb, nullptr, "scale(%g %g)",
                        SkScalarToFloat(matrix.getScaleX()),
                        SkScalarToFloat(matrix.getScaleY()));
             break;
         default:
             matrix.toString(&str);
-            this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str());
+            this->dump(kMatrix_Verb, nullptr, "concat(%s)", str.c_str());
             break;
     }
 
@@ -250,7 +250,7 @@
 void SkDumpCanvas::didSetMatrix(const SkMatrix& matrix) {
     SkString str;
     matrix.toString(&str);
-    this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str());
+    this->dump(kMatrix_Verb, nullptr, "setMatrix(%s)", str.c_str());
     this->INHERITED::didSetMatrix(matrix);
 }
 
@@ -263,7 +263,7 @@
 void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(rect, &str);
-    this->dump(kClip_Verb, NULL, "clipRect(%s %s %s)", str.c_str(), toString(op),
+    this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString(op),
                EdgeStyleToAAString(edgeStyle));
     this->INHERITED::onClipRect(rect, op, edgeStyle);
 }
@@ -271,7 +271,7 @@
 void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(rrect, &str);
-    this->dump(kClip_Verb, NULL, "clipRRect(%s %s %s)", str.c_str(), toString(op),
+    this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString(op),
                EdgeStyleToAAString(edgeStyle));
     this->INHERITED::onClipRRect(rrect, op, edgeStyle);
 }
@@ -279,7 +279,7 @@
 void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(path, &str);
-    this->dump(kClip_Verb, NULL, "clipPath(%s %s %s)", str.c_str(), toString(op),
+    this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString(op),
                EdgeStyleToAAString(edgeStyle));
     this->INHERITED::onClipPath(path, op, edgeStyle);
 }
@@ -287,7 +287,7 @@
 void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     SkString str;
     toString(deviceRgn, &str);
-    this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(),
+    this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(),
                toString(op));
     this->INHERITED::onClipRegion(deviceRgn, op);
 }
@@ -448,13 +448,13 @@
 
 void SkDumpCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
                                  const SkPaint* paint) {
-    this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %f:%f:%f:%f", picture,
+    this->dump(kDrawPicture_Verb, nullptr, "drawPicture(%p) %f:%f:%f:%f", picture,
                picture->cullRect().fLeft, picture->cullRect().fTop,
                picture->cullRect().fRight, picture->cullRect().fBottom);
     fNestLevel += 1;
     this->INHERITED::onDrawPicture(picture, matrix, paint);
     fNestLevel -= 1;
-    this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %f:%f:%f:%f", &picture,
+    this->dump(kDrawPicture_Verb, nullptr, "endPicture(%p) %f:%f:%f:%f", &picture,
                picture->cullRect().fLeft, picture->cullRect().fTop,
                picture->cullRect().fRight, picture->cullRect().fBottom);
 }
@@ -552,6 +552,6 @@
     SkDebugf("%s\n", text);
 }
 
-SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {}
+SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, nullptr) {}
 
 #endif
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 08364d1..0955cfa 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -30,7 +30,7 @@
 
     size_t getLength() const override { return fLength; }
 
-    SkStreamRewindable* duplicate() const override { return NULL; }
+    SkStreamRewindable* duplicate() const override { return nullptr; }
 
 private:
     SkAutoTDelete<SkStream> fStream;
@@ -44,21 +44,21 @@
     // Total size of the buffer.
     const size_t            fBufferSize;
     // FIXME: SkAutoTMalloc throws on failure. Instead, Create should return a
-    // NULL stream.
+    // nullptr stream.
     SkAutoTMalloc<char>     fBuffer;
 
     // Read up to size bytes from already buffered data, and copy to
-    // dst, if non-NULL. Updates fOffset. Assumes that fOffset is less
+    // dst, if non-nullptr. Updates fOffset. Assumes that fOffset is less
     // than fBufferedSoFar.
     size_t readFromBuffer(char* dst, size_t size);
 
     // Buffer up to size bytes from the stream, and copy to dst if non-
-    // NULL. Updates fOffset and fBufferedSoFar. Assumes that fOffset is
+    // nullptr. Updates fOffset and fBufferedSoFar. Assumes that fOffset is
     // less than fBufferedSoFar, and size is greater than 0.
     size_t bufferAndWriteTo(char* dst, size_t size);
 
     // Read up to size bytes directly from the stream and into dst if non-
-    // NULL. Updates fOffset. Assumes fOffset is at or beyond the buffered
+    // nullptr. Updates fOffset. Assumes fOffset is at or beyond the buffered
     // data, and size is greater than 0.
     size_t readDirectlyFromStream(char* dst, size_t size);
 
@@ -66,8 +66,8 @@
 };
 
 SkStreamRewindable* SkFrontBufferedStream::Create(SkStream* stream, size_t bufferSize) {
-    if (NULL == stream) {
-        return NULL;
+    if (nullptr == stream) {
+        return nullptr;
     }
     return new FrontBufferedStream(stream, bufferSize);
 }
@@ -106,7 +106,7 @@
     // lesser of the size requested and the remainder of the buffered
     // data.
     const size_t bytesToCopy = SkTMin(size, fBufferedSoFar - fOffset);
-    if (dst != NULL) {
+    if (dst != nullptr) {
         memcpy(dst, fBuffer + fOffset, bytesToCopy);
     }
 
@@ -133,7 +133,7 @@
     SkASSERT(fBufferedSoFar <= fBufferSize);
 
     // Copy the buffer to the destination buffer and update the amount read.
-    if (dst != NULL) {
+    if (dst != nullptr) {
         memcpy(dst, buffer, buffered);
     }
 
@@ -185,7 +185,7 @@
         // and the destination buffer.
         size -= bytesCopied;
         SkASSERT(size + (fOffset - start) == totalSize);
-        if (dst != NULL) {
+        if (dst != nullptr) {
             dst += bytesCopied;
         }
     }
@@ -199,7 +199,7 @@
         // and the destination buffer.
         size -= buffered;
         SkASSERT(size + (fOffset - start) == totalSize);
-        if (dst != NULL) {
+        if (dst != nullptr) {
             dst += buffered;
         }
     }
diff --git a/src/utils/SkInterpolator.cpp b/src/utils/SkInterpolator.cpp
index 03e7e4a..cd9ad3a 100644
--- a/src/utils/SkInterpolator.cpp
+++ b/src/utils/SkInterpolator.cpp
@@ -12,9 +12,9 @@
 #include "SkTSearch.h"
 
 SkInterpolatorBase::SkInterpolatorBase() {
-    fStorage    = NULL;
-    fTimes      = NULL;
-    SkDEBUGCODE(fTimesArray = NULL;)
+    fStorage    = nullptr;
+    fTimes      = nullptr;
+    SkDEBUGCODE(fTimesArray = nullptr;)
 }
 
 SkInterpolatorBase::~SkInterpolatorBase() {
@@ -30,9 +30,9 @@
     fRepeat = SK_Scalar1;
     if (fStorage) {
         sk_free(fStorage);
-        fStorage = NULL;
-        fTimes = NULL;
-        SkDEBUGCODE(fTimesArray = NULL);
+        fStorage = nullptr;
+        fTimes = nullptr;
+        SkDEBUGCODE(fTimesArray = nullptr);
     }
 }
 
@@ -129,8 +129,8 @@
 
 SkInterpolator::SkInterpolator() {
     INHERITED::reset(0, 0);
-    fValues = NULL;
-    SkDEBUGCODE(fScalarsArray = NULL;)
+    fValues = nullptr;
+    SkDEBUGCODE(fScalarsArray = nullptr;)
 }
 
 SkInterpolator::SkInterpolator(int elemCount, int frameCount) {
@@ -159,9 +159,9 @@
 
 bool SkInterpolator::setKeyFrame(int index, SkMSec time,
                             const SkScalar values[], const SkScalar blend[4]) {
-    SkASSERT(values != NULL);
+    SkASSERT(values != nullptr);
 
-    if (blend == NULL) {
+    if (blend == nullptr) {
         blend = gIdentityBlend;
     }
 
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp
index 525917f..39032b6 100644
--- a/src/utils/SkLayer.cpp
+++ b/src/utils/SkLayer.cpp
@@ -18,7 +18,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 SkLayer::SkLayer() {
-    fParent = NULL;
+    fParent = nullptr;
     m_opacity = SK_Scalar1;
     m_size.set(0, 0);
     m_position.set(0, 0);
@@ -35,7 +35,7 @@
 }
 
 SkLayer::SkLayer(const SkLayer& src) : INHERITED() {
-    fParent = NULL;
+    fParent = nullptr;
     m_opacity = src.m_opacity;
     m_size = src.m_size;
     m_position = src.m_position;
@@ -93,14 +93,14 @@
         SkASSERT(m_children[index]->fParent == this);
         return m_children[index];
     }
-    return NULL;
+    return nullptr;
 }
 
 SkLayer* SkLayer::addChild(SkLayer* child) {
     SkASSERT(this != child);
     child->ref();
     child->detachFromParent();
-    SkASSERT(child->fParent == NULL);
+    SkASSERT(child->fParent == nullptr);
     child->fParent = this;
 
     *m_children.append() = child;
@@ -112,7 +112,7 @@
         int index = fParent->m_children.find(this);
         SkASSERT(index >= 0);
         fParent->m_children.remove(index);
-        fParent = NULL;
+        fParent = nullptr;
         this->unref();  // this call might delete us
     }
 }
@@ -122,7 +122,7 @@
     for (int i = 0; i < count; i++) {
         SkLayer* child = m_children[i];
         SkASSERT(child->fParent == this);
-        child->fParent = NULL;  // in case it has more than one owner
+        child->fParent = nullptr;  // in case it has more than one owner
         child->unref();
     }
     m_children.reset();
@@ -130,7 +130,7 @@
 
 SkLayer* SkLayer::getRootLayer() const {
     const SkLayer* root = this;
-    while (root->fParent != NULL) {
+    while (root->fParent != nullptr) {
         root = root->fParent;
     }
     return const_cast<SkLayer*>(root);
@@ -157,7 +157,7 @@
     }
 
     const SkLayer* layer = this;
-    while (layer->fParent != NULL) {
+    while (layer->fParent != nullptr) {
         layer = layer->fParent;
 
         SkMatrix tmp;
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index e5d4c2b..307e5f6 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -502,13 +502,13 @@
             return paint;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 static int lcanvas_drawImage(lua_State* L) {
     SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
     SkImage* image = get_ref<SkImage>(L, 2);
-    if (NULL == image) {
+    if (nullptr == image) {
         return 0;
     }
     SkScalar x = lua2scalar(L, 3);
@@ -522,12 +522,12 @@
 static int lcanvas_drawImageRect(lua_State* L) {
     SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
     SkImage* image = get_ref<SkImage>(L, 2);
-    if (NULL == image) {
+    if (nullptr == image) {
         return 0;
     }
 
     SkRect srcR, dstR;
-    SkRect* srcRPtr = NULL;
+    SkRect* srcRPtr = nullptr;
     if (!lua_isnil(L, 3)) {
         srcRPtr = lua2rect(L, 3, &srcR);
     }
@@ -543,8 +543,8 @@
     SkColor colorStorage[4];
     SkPoint texStorage[4];
 
-    const SkColor* colors = NULL;
-    const SkPoint* texs = NULL;
+    const SkColor* colors = nullptr;
+    const SkPoint* texs = nullptr;
 
     getarray_points(L, 2, cubics, 12);
 
@@ -560,7 +560,7 @@
         texs = texStorage;
     }
 
-    get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, NULL, *get_obj<SkPaint>(L, 5));
+    get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, nullptr, *get_obj<SkPaint>(L, 5));
     return 0;
 }
 
@@ -576,7 +576,7 @@
     SkPicture* picture = get_ref<SkPicture>(L, 2);
     SkScalar x = lua2scalar_def(L, 3, 0);
     SkScalar y = lua2scalar_def(L, 4, 0);
-    SkMatrix matrix, *matrixPtr = NULL;
+    SkMatrix matrix, *matrixPtr = nullptr;
     if (x || y) {
         matrix.setTranslate(x, y);
         matrixPtr = &matrix;
@@ -646,7 +646,7 @@
                                    &genID,
                                    &initialState,
                                    &resultBounds,
-                                   NULL);
+                                   nullptr);
 
     GrReducedClip::ElementList::Iter iter(elements);
     int i = 0;
@@ -671,7 +671,7 @@
 
 static int lcanvas_saveLayer(lua_State* L) {
     SkPaint paint;
-    lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(NULL, lua2OptionalPaint(L, 2, &paint)));
+    lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(nullptr, lua2OptionalPaint(L, 2, &paint)));
     return 1;
 }
 
@@ -710,7 +710,7 @@
     int height = lua2int_def(L, 3, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
     SkSurface* surface = get_ref<SkCanvas>(L, 1)->newSurface(info);
-    if (NULL == surface) {
+    if (nullptr == surface) {
         lua_pushnil(L);
     } else {
         push_ref(L, surface)->unref();
@@ -754,13 +754,13 @@
     { "newSurface", lcanvas_newSurface },
 
     { "__gc", lcanvas_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
 static int ldocument_beginPage(lua_State* L) {
-    const SkRect* contentPtr = NULL;
+    const SkRect* contentPtr = nullptr;
     push_ref(L, get_ref<SkDocument>(L, 1)->beginPage(lua2scalar(L, 2),
                                                      lua2scalar(L, 3),
                                                      contentPtr));
@@ -787,7 +787,7 @@
     { "endPage", ldocument_endPage },
     { "close", ldocument_close },
     { "__gc", ldocument_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1176,7 +1176,7 @@
     { "setShader", lpaint_setShader },
     { "getPathEffect", lpaint_getPathEffect },
     { "__gc", lpaint_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1260,7 +1260,7 @@
     { "isABitmap",      lshader_isABitmap },
     { "asAGradient",    lshader_asAGradient },
     { "__gc",           lshader_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1289,7 +1289,7 @@
 static const struct luaL_Reg gSkPathEffect_Methods[] = {
     { "asADash",        lpatheffect_asADash },
     { "__gc",           lpatheffect_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1301,7 +1301,7 @@
 
 static const struct luaL_Reg gSkImageFilter_Methods[] = {
     { "__gc",       lpimagefilter_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1390,7 +1390,7 @@
     { "setRectToRect", lmatrix_setRectToRect },
     { "invert", lmatrix_invert },
     { "mapXY", lmatrix_mapXY },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1568,7 +1568,7 @@
     { "cubicTo", lpath_cubicTo },
     { "close", lpath_close },
     { "__gc", lpath_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1620,7 +1620,7 @@
     { "type", lrrect_type },
     { "radii", lrrect_radii },
     { "__gc", lrrect_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1637,7 +1637,7 @@
 
 static int limage_newShader(lua_State* L) {
     SkShader::TileMode tmode = SkShader::kClamp_TileMode;
-    const SkMatrix* localM = NULL;
+    const SkMatrix* localM = nullptr;
     SkAutoTUnref<SkShader> shader(get_ref<SkImage>(L, 1)->newShader(tmode, tmode, localM));
     push_ref(L, shader.get());
     return 1;
@@ -1653,7 +1653,7 @@
     { "height", limage_height },
     { "newShader", limage_newShader },
     { "__gc", limage_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1670,7 +1670,7 @@
 
 static int lsurface_getCanvas(lua_State* L) {
     SkCanvas* canvas = get_ref<SkSurface>(L, 1)->getCanvas();
-    if (NULL == canvas) {
+    if (nullptr == canvas) {
         lua_pushnil(L);
     } else {
         push_ref(L, canvas);
@@ -1685,7 +1685,7 @@
 
 static int lsurface_newImageSnapshot(lua_State* L) {
     SkImage* image = get_ref<SkSurface>(L, 1)->newImageSnapshot();
-    if (NULL == image) {
+    if (nullptr == image) {
         lua_pushnil(L);
     } else {
         push_ref(L, image)->unref();
@@ -1698,7 +1698,7 @@
     int height = lua2int_def(L, 3, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
     SkSurface* surface = get_ref<SkSurface>(L, 1)->newSurface(info);
-    if (NULL == surface) {
+    if (nullptr == surface) {
         lua_pushnil(L);
     } else {
         push_ref(L, surface)->unref();
@@ -1718,7 +1718,7 @@
     { "newImageSnapshot", lsurface_newImageSnapshot },
     { "newSurface", lsurface_newSurface },
     { "__gc", lsurface_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1732,7 +1732,7 @@
     }
 
     SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->beginRecording(w, h);
-    if (NULL == canvas) {
+    if (nullptr == canvas) {
         lua_pushnil(L);
         return 1;
     }
@@ -1743,7 +1743,7 @@
 
 static int lpicturerecorder_getCanvas(lua_State* L) {
     SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->getRecordingCanvas();
-    if (NULL == canvas) {
+    if (nullptr == canvas) {
         lua_pushnil(L);
         return 1;
     }
@@ -1753,7 +1753,7 @@
 
 static int lpicturerecorder_endRecording(lua_State* L) {
     SkPicture* pic = get_obj<SkPictureRecorder>(L, 1)->endRecording();
-    if (NULL == pic) {
+    if (nullptr == pic) {
         lua_pushnil(L);
         return 1;
     }
@@ -1771,7 +1771,7 @@
     { "getCanvas", lpicturerecorder_getCanvas },
     { "endRecording", lpicturerecorder_endRecording },
     { "__gc", lpicturerecorder_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1795,7 +1795,7 @@
     { "width", lpicture_width },
     { "height", lpicture_height },
     { "__gc", lpicture_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1813,7 +1813,7 @@
 static const struct luaL_Reg gSkTextBlob_Methods[] = {
     { "bounds", ltextblob_bounds },
     { "__gc", ltextblob_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1839,7 +1839,7 @@
     { "getFamilyName", ltypeface_getFamilyName },
     { "getStyle", ltypeface_getStyle },
     { "__gc", ltypeface_gc },
-    { NULL, NULL }
+    { nullptr, nullptr }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1873,13 +1873,13 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 static int lsk_newDocumentPDF(lua_State* L) {
-    const char* file = NULL;
+    const char* file = nullptr;
     if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
-        file = lua_tolstring(L, 1, NULL);
+        file = lua_tolstring(L, 1, nullptr);
     }
 
     SkDocument* doc = SkDocument::CreatePDF(file);
-    if (NULL == doc) {
+    if (nullptr == doc) {
         // do I need to push a nil on the stack and return 1?
         return 0;
     } else {
@@ -1892,7 +1892,7 @@
     SkScalar sigmaX = lua2scalar_def(L, 1, 0);
     SkScalar sigmaY = lua2scalar_def(L, 2, 0);
     SkImageFilter* imf = SkBlurImageFilter::Create(sigmaX, sigmaY);
-    if (NULL == imf) {
+    if (nullptr == imf) {
         lua_pushnil(L);
     } else {
         push_ref(L, imf)->unref();
@@ -1910,8 +1910,8 @@
 
     SkPoint pts[] = { { x0, y0 }, { x1, y1 } };
     SkColor colors[] = { c0, c1 };
-    SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
-    if (NULL == s) {
+    SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
+    if (nullptr == s) {
         lua_pushnil(L);
     } else {
         push_ref(L, s)->unref();
@@ -1947,7 +1947,7 @@
 #include "SkTextBox.h"
 // Sk.newTextBlob(text, rect, paint)
 static int lsk_newTextBlob(lua_State* L) {
-    const char* text = lua_tolstring(L, 1, NULL);
+    const char* text = lua_tolstring(L, 1, nullptr);
     SkRect bounds;
     lua2rect(L, 2, &bounds);
     const SkPaint& paint = *get_obj<SkPaint>(L, 3);
@@ -1965,21 +1965,21 @@
 }
 
 static int lsk_newTypeface(lua_State* L) {
-    const char* name = NULL;
+    const char* name = nullptr;
     int style = SkTypeface::kNormal;
 
     int count = lua_gettop(L);
     if (count > 0 && lua_isstring(L, 1)) {
-        name = lua_tolstring(L, 1, NULL);
+        name = lua_tolstring(L, 1, nullptr);
         if (count > 1 && lua_isnumber(L, 2)) {
-            style = lua_tointegerx(L, 2, NULL) & SkTypeface::kBoldItalic;
+            style = lua_tointegerx(L, 2, nullptr) & SkTypeface::kBoldItalic;
         }
     }
 
     SkTypeface* face = SkTypeface::CreateFromName(name,
                                                   (SkTypeface::Style)style);
 //    SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, face->getRefCnt());
-    if (NULL == face) {
+    if (nullptr == face) {
         face = SkTypeface::RefDefault();
     }
     push_ref(L, face)->unref();
@@ -1992,7 +1992,7 @@
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
     SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
     SkSurface* surface = SkSurface::NewRaster(info, &props);
-    if (NULL == surface) {
+    if (nullptr == surface) {
         lua_pushnil(L);
     } else {
         push_ref(L, surface)->unref();
@@ -2002,7 +2002,7 @@
 
 static int lsk_loadImage(lua_State* L) {
     if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
-        const char* name = lua_tolstring(L, 1, NULL);
+        const char* name = lua_tolstring(L, 1, nullptr);
         SkAutoDataUnref data(SkData::NewFromFileName(name));
         if (data.get()) {
             SkImage* image = SkImage::NewFromEncoded(data);
diff --git a/src/utils/SkMeshUtils.cpp b/src/utils/SkMeshUtils.cpp
index 3857dc9..cf4e509 100644
--- a/src/utils/SkMeshUtils.cpp
+++ b/src/utils/SkMeshUtils.cpp
@@ -21,15 +21,15 @@
                          int texW, int texH, int rows, int cols) {
     if (rows < 2 || cols < 2) {
         sk_free(fStorage);
-        fStorage = NULL;
-        fTex = NULL;
-        fIndices = NULL;
+        fStorage = nullptr;
+        fTex = nullptr;
+        fIndices = nullptr;
         fTexCount = fIndexCount = 0;
         return false;
     }
 
     sk_free(fStorage);
-    fStorage = NULL;
+    fStorage = nullptr;
 
     fTexCount = rows * cols;
     rows -= 1;
@@ -96,7 +96,7 @@
                                          SkShader::kClamp_TileMode,
                                          SkShader::kClamp_TileMode))->unref();
         canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
-                             rows * cols, verts, idx.tex(), colors, NULL,
+                             rows * cols, verts, idx.tex(), colors, nullptr,
                              idx.indices(), idx.indexCount(), p);
     }
 }
diff --git a/src/utils/SkNinePatch.cpp b/src/utils/SkNinePatch.cpp
index 4a5308b..5ee488e 100644
--- a/src/utils/SkNinePatch.cpp
+++ b/src/utils/SkNinePatch.cpp
@@ -196,8 +196,8 @@
 
     mesh.fVerts = verts;
     mesh.fTexs = texs;
-    mesh.fColors = NULL;
-    mesh.fIndices = NULL;
+    mesh.fColors = nullptr;
+    mesh.fIndices = nullptr;
 
     // we use <= for YDivs, since the prebuild indices work for 3x2 and 3x1 too
     if (numXDivs == 2 && numYDivs <= 2) {
@@ -245,7 +245,7 @@
     }
     p.setShader(shader)->unref();
     canvas->drawVertices(SkCanvas::kTriangles_VertexMode, vCount,
-                         mesh.fVerts, mesh.fTexs, mesh.fColors, NULL,
+                         mesh.fVerts, mesh.fTexs, mesh.fColors, nullptr,
                          mesh.fIndices, indexCount, p);
 }
 
diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp
index cb12c2b..a0c003b 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -20,7 +20,7 @@
         return SkString();
     }
     const char* filename = strrchr(fullPath, SkPATH_SEPARATOR);
-    if (NULL == filename) {
+    if (nullptr == filename) {
         filename = fullPath;
     } else {
         ++filename;
@@ -33,7 +33,7 @@
         return SkString();
     }
     const char* end = strrchr(fullPath, SkPATH_SEPARATOR);
-    if (NULL == end) {
+    if (nullptr == end) {
         return SkString();
     }
     if (end == fullPath) {
diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp
index 446f9d4..b5a108e 100644
--- a/src/utils/SkParse.cpp
+++ b/src/utils/SkParse.cpp
@@ -112,7 +112,7 @@
     str = skip_ws(str);
 
     if (!is_hex(*str))
-        return NULL;
+        return nullptr;
 
     uint32_t n = 0;
     int max_digits = 8;
@@ -121,7 +121,7 @@
     while ((digit = to_hex(*str)) >= 0)
     {
         if (--max_digits < 0)
-            return NULL;
+            return nullptr;
         n = (n << 4) | digit;
         str += 1;
     }
@@ -132,7 +132,7 @@
             *value = n;
         return str;
     }
-    return NULL;
+    return nullptr;
 }
 
 const char* SkParse::FindS32(const char str[], int32_t* value)
@@ -148,7 +148,7 @@
     }
 
     if (!is_digit(*str))
-        return NULL;
+        return nullptr;
 
     int n = 0;
     while (is_digit(*str))
@@ -174,7 +174,7 @@
     }
 
     if (!is_digit(*str))
-        return NULL;
+        return nullptr;
 
     int n = 0;
     while (is_digit(*str))
@@ -207,7 +207,7 @@
     char* stop;
     float v = (float)strtod(str, &stop);
     if (str == stop) {
-        return NULL;
+        return nullptr;
     }
     if (value) {
         *value = v;
@@ -224,7 +224,7 @@
         for (;;)
         {
             str = SkParse::FindScalar(str, value);
-            if (--count == 0 || str == NULL)
+            if (--count == 0 || str == nullptr)
                 break;
 
             // keep going
@@ -272,14 +272,14 @@
         const char* end = strchr(list, ',');
         size_t      entryLen;
 
-        if (end == NULL) // last entry
+        if (end == nullptr) // last entry
             entryLen = strlen(list);
         else
             entryLen = end - list;
 
         if (entryLen == len && memcmp(target, list, len) == 0)
             return index;
-        if (end == NULL)
+        if (end == nullptr)
             break;
 
         list = end + 1; // skip the ','
diff --git a/src/utils/SkParseColor.cpp b/src/utils/SkParseColor.cpp
index 989a609..329b304 100644
--- a/src/utils/SkParseColor.cpp
+++ b/src/utils/SkParseColor.cpp
@@ -423,11 +423,11 @@
             while ((int) gColorNames[lo] >= 0)
                 ++lo;
         } else if (hi == mid)
-            return NULL;
+            return nullptr;
         else
             hi = mid;
     }
-    return NULL;
+    return nullptr;
 }
 
 // !!! move to char utilities
@@ -435,12 +435,12 @@
 //  char c;
 //  int separators = 0;
 //  while ((c = *str++) != '\0') {
-//      if (strchr(sep, c) == NULL)
+//      if (strchr(sep, c) == nullptr)
 //          continue;
 //      do {
 //          if ((c = *str++) == '\0')
 //              goto goHome;
-//      } while (strchr(sep, c) != NULL);
+//      } while (strchr(sep, c) != nullptr);
 //      separators++;
 //  }
 //goHome:
@@ -459,7 +459,7 @@
         uint32_t    hex;
         const char* end = SkParse::FindHex(value + 1, &hex);
 //      SkASSERT(end);
-        if (end == NULL)
+        if (end == nullptr)
             return end;
         size_t len = end - value - 1;
         if (len == 3 || len == 4) {
@@ -476,7 +476,7 @@
             return end;
         } else {
 //          SkASSERT(0);
-            return NULL;
+            return nullptr;
         }
 //  } else if (strchr(value, ',')) {
 //      SkScalar array[4];
@@ -484,8 +484,8 @@
 //      SkASSERT(count == 3 || count == 4);
 //      array[0] = SK_Scalar1 * 255;
 //      const char* end = SkParse::FindScalars(value, &array[4 - count], count);
-//      if (end == NULL)
-//          return NULL;
+//      if (end == nullptr)
+//          return nullptr;
         // !!! range check for errors?
 //      *colorPtr = SkColorSetARGB(SkScalarRoundToInt(array[0]), SkScalarRoundToInt(array[1]),
 //          SkScalarRoundToInt(array[2]), SkScalarRoundToInt(array[3]));
@@ -503,7 +503,7 @@
     for (index = 0; index < colorNamesSize; index++) {
         result = SK_ColorBLACK;
         SkNameRGB nameRGB = colorNames[index];
-        SkASSERT(FindColor(nameRGB.name, &result) != NULL);
+        SkASSERT(FindColor(nameRGB.name, &result) != nullptr);
         SkASSERT(result == (SkColor) (nameRGB.rgb | 0xFF000000));
     }
     for (index = 0; index < colorNamesSize; index++) {
@@ -513,9 +513,9 @@
         size_t len = strlen(nameRGB.name);
         memcpy(bad, nameRGB.name, len);
         bad[len - 1] -= 1;
-        SkASSERT(FindColor(bad, &result) == NULL);
+        SkASSERT(FindColor(bad, &result) == nullptr);
         bad[len - 1] += 2;
-        SkASSERT(FindColor(bad, &result) == NULL);
+        SkASSERT(FindColor(bad, &result) == nullptr);
     }
     result = SK_ColorBLACK;
     SkASSERT(FindColor("lightGrey", &result));
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 94c3112..3fecb46 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -167,7 +167,7 @@
                 break;
             case '~': {
                 SkPoint args[2];
-                data = find_points(data, args, 2, false, NULL);
+                data = find_points(data, args, 2, false, nullptr);
                 path.moveTo(args[0].fX, args[0].fY);
                 path.lineTo(args[1].fX, args[1].fY);
             } break;
diff --git a/src/utils/SkPatchGrid.cpp b/src/utils/SkPatchGrid.cpp
index 386e3a6..b7aaa82 100644
--- a/src/utils/SkPatchGrid.cpp
+++ b/src/utils/SkPatchGrid.cpp
@@ -12,12 +12,12 @@
     : fRows(0)
     , fCols(0)
     , fModeFlags(kNone_VertexType)
-    , fCornerPts(NULL)
-    , fCornerColors(NULL)
-    , fTexCoords(NULL)
-    , fHrzCtrlPts(NULL)
-    , fVrtCtrlPts(NULL)
-    , fXferMode(NULL) {
+    , fCornerPts(nullptr)
+    , fCornerColors(nullptr)
+    , fTexCoords(nullptr)
+    , fHrzCtrlPts(nullptr)
+    , fVrtCtrlPts(nullptr)
+    , fXferMode(nullptr) {
         this->reset(rows, cols, flags, xfer);
 }
 
@@ -33,7 +33,7 @@
                            const SkPoint texCoords[4]) {
     // Check for the passed paramaters to be within the range of the grid dimensions and a valid
     // pointer for the cubics' control points.
-    if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || NULL == cubics) {
+    if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || nullptr == cubics) {
         return false;
     }
     
@@ -79,7 +79,7 @@
 bool SkPatchGrid::getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4],
                            SkPoint texCoords[4]) const {
     
-    if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || NULL == cubics) {
+    if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || nullptr == cubics) {
         return false;
     }
     
@@ -159,7 +159,7 @@
     for (int y = 0; y < fRows; y++) {
         for (int x = 0; x < fCols; x++) {
             SkPoint cubics[12];
-            this->getPatch(x, y, cubics, NULL, NULL);
+            this->getPatch(x, y, cubics, nullptr, nullptr);
             SkMatrix matrix = canvas->getTotalMatrix();
             SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &matrix);
             maxCols[x] = SkMax32(maxCols[x], lod.width());
@@ -175,8 +175,8 @@
             this->getPatch(x, y, cubics, colors, texCoords);
             SkPatchUtils::VertexData data;
             if (SkPatchUtils::getVertexData(&data, cubics,
-                                            fModeFlags & kColors_VertexType ? colors : NULL,
-                                            fModeFlags & kTexs_VertexType ? texCoords : NULL,
+                                            fModeFlags & kColors_VertexType ? colors : nullptr,
+                                            fModeFlags & kTexs_VertexType ? texCoords : nullptr,
                                             maxCols[x], maxRows[y])) {
                 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCount,
                                      data.fPoints, data.fTexCoords, data.fColors, fXferMode,
diff --git a/src/utils/SkPatchGrid.h b/src/utils/SkPatchGrid.h
index cf90098..5bc2e65 100644
--- a/src/utils/SkPatchGrid.h
+++ b/src/utils/SkPatchGrid.h
@@ -88,7 +88,7 @@
     };
     
     SkPatchGrid(int rows = 0, int cols = 0, VertexType flags = kNone_VertexType,
-                SkXfermode* xfer = NULL);
+                SkXfermode* xfer = nullptr);
     
     ~SkPatchGrid();
     
@@ -103,9 +103,9 @@
                   const SkPoint texCoords[4]);
     
     /**
-     * Get patch at location (x,y). If cubics, colors or texCoords is not NULL it sets patch's
+     * Get patch at location (x,y). If cubics, colors or texCoords is not nullptr it sets patch's
      * array with its corresponding values.
-     * The function returns false if the cubics parameter is NULL or if the (x,y) coordinates are 
+     * The function returns false if the cubics parameter is nullptr or if the (x,y) coordinates are 
      * not within the range of the grid.
      */
     bool getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4], SkPoint texCoords[4]) const;
diff --git a/src/utils/SkPatchUtils.cpp b/src/utils/SkPatchUtils.cpp
index e9ff906..ad846f7 100644
--- a/src/utils/SkPatchUtils.cpp
+++ b/src/utils/SkPatchUtils.cpp
@@ -191,7 +191,7 @@
 
 bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint cubics[12],
                    const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY) {
-    if (lodX < 1 || lodY < 1 || NULL == cubics || NULL == data) {
+    if (lodX < 1 || lodY < 1 || nullptr == cubics || nullptr == data) {
         return false;
     }
 
diff --git a/src/utils/SkPatchUtils.h b/src/utils/SkPatchUtils.h
index 3560421..7c231f1 100644
--- a/src/utils/SkPatchUtils.h
+++ b/src/utils/SkPatchUtils.h
@@ -29,10 +29,10 @@
         VertexData()
         : fVertexCount(0)
         , fIndexCount(0)
-        , fPoints(NULL)
-        , fTexCoords(NULL)
-        , fColors(NULL)
-        , fIndices(NULL) { }
+        , fPoints(nullptr)
+        , fTexCoords(nullptr)
+        , fColors(nullptr)
+        , fIndices(nullptr) { }
         
         ~VertexData() {
             delete[] fPoints;
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index f441bf1..9c076cb 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -41,7 +41,7 @@
             continue;
         }
 
-        char *valptr = strtok(NULL, sep);
+        char *valptr = strtok(nullptr, sep);
         if (!valptr) {
             continue;
         }
@@ -240,7 +240,7 @@
 }
 
 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
-    const char *str = NULL;
+    const char *str = nullptr;
 
     for (int i = fConfigFileKeys.count() - 1 ; i >= 0; i--) {
         if (fConfigFileKeys[i]->equals(name)) {
@@ -301,7 +301,7 @@
         }
         return;
     }
-    SkASSERT(confArray != NULL);
+    SkASSERT(confArray != nullptr);
     for (SkRTConfBase **confBase = confArray->begin(); confBase != confArray->end(); confBase++) {
         // static_cast here is okay because there's only one kind of child class.
         SkRTConf<T> *concrete = static_cast<SkRTConf<T> *>(*confBase);
diff --git a/src/utils/SkTextBox.cpp b/src/utils/SkTextBox.cpp
index af05cad..ba6ef53 100644
--- a/src/utils/SkTextBox.cpp
+++ b/src/utils/SkTextBox.cpp
@@ -15,7 +15,7 @@
 
 static size_t linebreak(const char text[], const char stop[],
                         const SkPaint& paint, SkScalar margin,
-                        size_t* trailing = NULL)
+                        size_t* trailing = nullptr)
 {
     size_t lengthBreak = paint.breakText(text, stop - text, margin);
 
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index c256a61..e308f6e 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -35,7 +35,7 @@
 namespace SkTextureCompressor {
 
 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec) {
-    if (NULL == dimX || NULL == dimY) {
+    if (nullptr == dimX || nullptr == dimY) {
         return;
     }
 
@@ -147,7 +147,7 @@
 SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
     int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixmap.height());
     if (compressedDataSize < 0) {
-        return NULL;
+        return nullptr;
     }
 
     const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr());
@@ -156,7 +156,7 @@
     if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colorType(),
                                 pixmap.width(), pixmap.height(), pixmap.rowBytes(), format)) {
         dst->unref();
-        dst = NULL;
+        dst = nullptr;
     }
     return dst;
 }
@@ -174,10 +174,10 @@
             return CreateASTCBlitter(width, height, compressedBuffer, allocator);
 
         default:
-            return NULL;
+            return nullptr;
     }
 
-    return NULL;
+    return nullptr;
 }
 
 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* src,
diff --git a/src/utils/SkTextureCompressor.h b/src/utils/SkTextureCompressor.h
index f002cde..d4d4896 100644
--- a/src/utils/SkTextureCompressor.h
+++ b/src/utils/SkTextureCompressor.h
@@ -56,7 +56,7 @@
 
     // Returns an SkData holding a blob of compressed data that corresponds
     // to the pixmap. If the pixmap colorType cannot be compressed using the
-    // associated format, then we return NULL. The caller is responsible for
+    // associated format, then we return nullptr. The caller is responsible for
     // calling unref() on the returned data.
     SkData* CompressBitmapToFormat(const SkPixmap&, Format format);
 
diff --git a/src/utils/SkTextureCompressor_ASTC.cpp b/src/utils/SkTextureCompressor_ASTC.cpp
index 7969359..a6e91d6 100644
--- a/src/utils/SkTextureCompressor_ASTC.cpp
+++ b/src/utils/SkTextureCompressor_ASTC.cpp
@@ -1175,7 +1175,7 @@
     // in the maximum encoding that will fit the number of color values that
     // we need. Returns false on error. (See section C.2.22 of the spec)
     bool getColorValueEncoding(int *nBits, int *nTrits, int *nQuints) const {
-        if (NULL == nBits || NULL == nTrits || NULL == nQuints) {
+        if (nullptr == nBits || nullptr == nTrits || nullptr == nQuints) {
             return false;
         }
 
@@ -2057,7 +2057,7 @@
 SkBlitter* CreateASTCBlitter(int width, int height, void* outputBuffer,
                              SkTBlitterAllocator* allocator) {
     if ((width % 12) != 0 || (height % 12) != 0) {
-        return NULL;
+        return nullptr;
     }
 
     // Memset the output buffer to an encoding that decodes to zero. We must do this
diff --git a/src/utils/SkTextureCompressor_Blitter.h b/src/utils/SkTextureCompressor_Blitter.h
index e522375..0c259d6 100644
--- a/src/utils/SkTextureCompressor_Blitter.h
+++ b/src/utils/SkTextureCompressor_Blitter.h
@@ -366,10 +366,10 @@
     }
 
     // If the blitter just sets a single value for each pixel, return the
-    // bitmap it draws into, and assign value. If not, return NULL and ignore
+    // bitmap it draws into, and assign value. If not, return nullptr and ignore
     // the value parameter.
     const SkPixmap* justAnOpaqueColor(uint32_t* value) override {
-        return NULL;
+        return nullptr;
     }
 
     /**
diff --git a/src/utils/SkTextureCompressor_LATC.cpp b/src/utils/SkTextureCompressor_LATC.cpp
index f0cf4a9..3ee6b27 100644
--- a/src/utils/SkTextureCompressor_LATC.cpp
+++ b/src/utils/SkTextureCompressor_LATC.cpp
@@ -485,7 +485,7 @@
 SkBlitter* CreateLATCBlitter(int width, int height, void* outputBuffer,
                              SkTBlitterAllocator* allocator) {
     if ((width % 4) != 0 || (height % 4) != 0) {
-        return NULL;
+        return nullptr;
     }
 
 #if COMPRESS_LATC_FAST
@@ -502,7 +502,7 @@
         (width, height, outputBuffer);
 #elif COMPRESS_LATC_SLOW
     // TODO (krajcevski)
-    return NULL;
+    return nullptr;
 #endif
 }
 
diff --git a/src/utils/SkTextureCompressor_R11EAC.cpp b/src/utils/SkTextureCompressor_R11EAC.cpp
index c7edf37..291820b 100644
--- a/src/utils/SkTextureCompressor_R11EAC.cpp
+++ b/src/utils/SkTextureCompressor_R11EAC.cpp
@@ -638,7 +638,7 @@
                                SkTBlitterAllocator* allocator) {
 
     if ((width % 4) != 0 || (height % 4) != 0) {
-        return NULL;
+        return nullptr;
     }
 
     // Memset the output buffer to an encoding that decodes to zero. We must do this
diff --git a/src/utils/SkThreadUtils.h b/src/utils/SkThreadUtils.h
index 8963981..e89bc6d 100644
--- a/src/utils/SkThreadUtils.h
+++ b/src/utils/SkThreadUtils.h
@@ -14,7 +14,7 @@
 public:
     typedef void (*entryPointProc)(void*);
 
-    SkThread(entryPointProc entryPoint, void* data = NULL);
+    SkThread(entryPointProc entryPoint, void* data = nullptr);
 
     /**
      * Non-virtual, do not subclass.
diff --git a/src/utils/SkThreadUtils_pthread.cpp b/src/utils/SkThreadUtils_pthread.cpp
index 7dec907..0bd804d 100644
--- a/src/utils/SkThreadUtils_pthread.cpp
+++ b/src/utils/SkThreadUtils_pthread.cpp
@@ -14,8 +14,8 @@
 #include <signal.h>
 
 PThreadEvent::PThreadEvent() : fConditionFlag(false) {
-    pthread_cond_init(&fCondition, NULL);
-    pthread_mutex_init(&fConditionMutex, NULL);
+    pthread_cond_init(&fCondition, nullptr);
+    pthread_mutex_init(&fConditionMutex, nullptr);
 }
 PThreadEvent::~PThreadEvent() {
     pthread_mutex_destroy(&fConditionMutex);
@@ -65,7 +65,7 @@
     if (!pthreadData->fCanceled.isTriggered()) {
         pthreadData->fEntryPoint(pthreadData->fParam);
     }
-    return NULL;
+    return nullptr;
 }
 
 SkThread::SkThread(entryPointProc entryPoint, void* data) {
@@ -81,7 +81,7 @@
 }
 
 SkThread::~SkThread() {
-    if (fData != NULL) {
+    if (fData != nullptr) {
         SkThread_PThreadData* pthreadData = static_cast<SkThread_PThreadData*>(fData);
         // If created thread but start was never called, kill the thread.
         if (pthreadData->fValidPThread && !pthreadData->fStarted.isTriggered()) {
@@ -113,5 +113,5 @@
         return;
     }
 
-    pthread_join(pthreadData->fPThread, NULL);
+    pthread_join(pthreadData->fPThread, nullptr);
 }
diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp
index a064d3b..a5efb93 100644
--- a/src/utils/SkThreadUtils_win.cpp
+++ b/src/utils/SkThreadUtils_win.cpp
@@ -11,17 +11,17 @@
 #include "SkThreadUtils_win.h"
 
 SkThread_WinData::SkThread_WinData(SkThread::entryPointProc entryPoint, void* data)
-    : fHandle(NULL)
+    : fHandle(nullptr)
     , fParam(data)
     , fThreadId(0)
     , fEntryPoint(entryPoint)
     , fStarted(false)
 {
     fCancelEvent = CreateEvent(
-        NULL,  // default security attributes
+        nullptr,  // default security attributes
         false, //auto reset
         false, //not signaled
-        NULL); //no name
+        nullptr); //no name
 }
 
 SkThread_WinData::~SkThread_WinData() {
@@ -44,12 +44,12 @@
     SkThread_WinData* winData = new SkThread_WinData(entryPoint, data);
     fData = winData;
 
-    if (NULL == winData->fCancelEvent) {
+    if (nullptr == winData->fCancelEvent) {
         return;
     }
 
     winData->fHandle = CreateThread(
-        NULL,                   // default security attributes
+        nullptr,                   // default security attributes
         0,                      // use default stack size
         thread_start,           // thread function name (proxy)
         winData,                // argument to thread function (proxy args)
@@ -58,10 +58,10 @@
 }
 
 SkThread::~SkThread() {
-    if (fData != NULL) {
+    if (fData != nullptr) {
         SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
         // If created thread but start was never called, kill the thread.
-        if (winData->fHandle != NULL && !winData->fStarted) {
+        if (winData->fHandle != nullptr && !winData->fStarted) {
             if (SetEvent(winData->fCancelEvent) != 0) {
                 if (this->start()) {
                     this->join();
@@ -77,7 +77,7 @@
 
 bool SkThread::start() {
     SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
-    if (NULL == winData->fHandle) {
+    if (nullptr == winData->fHandle) {
         return false;
     }
 
@@ -90,7 +90,7 @@
 
 void SkThread::join() {
     SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
-    if (NULL == winData->fHandle || !winData->fStarted) {
+    if (nullptr == winData->fHandle || !winData->fStarted) {
         return;
     }
 
@@ -119,7 +119,7 @@
 
 bool SkThread::setProcessorAffinity(unsigned int processor) {
     SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
-    if (NULL == winData->fHandle) {
+    if (nullptr == winData->fHandle) {
         return false;
     }
 
diff --git a/src/utils/android/SkAndroidSDKCanvas.cpp b/src/utils/android/SkAndroidSDKCanvas.cpp
index 2eec95f..5106473 100644
--- a/src/utils/android/SkAndroidSDKCanvas.cpp
+++ b/src/utils/android/SkAndroidSDKCanvas.cpp
@@ -26,16 +26,16 @@
     if (shader->isABitmap()) {
         return;
     }
-    if (shader->asACompose(NULL)) {
+    if (shader->asACompose(nullptr)) {
         return;
     }
-    SkShader::GradientType gtype = shader->asAGradient(NULL);
+    SkShader::GradientType gtype = shader->asAGradient(nullptr);
     if (gtype == SkShader::kLinear_GradientType ||
         gtype == SkShader::kRadial_GradientType ||
         gtype == SkShader::kSweep_GradientType) {
         return;
     }
-    paint->setShader(NULL);
+    paint->setShader(nullptr);
 }
 
 void Filter(SkPaint* paint) {
@@ -48,7 +48,7 @@
     SkXfermode::Mode mode;
     SkXfermode::AsMode(paint->getXfermode(), &mode);
     if (mode > SkXfermode::kLighten_Mode) {
-        paint->setXfermode(NULL);
+        paint->setXfermode(nullptr);
     }
 
     // Force bilinear scaling or none
@@ -70,22 +70,22 @@
             paint->setColorFilter(
                 SkColorFilter::CreateModeFilter(color, SkXfermode::kSrcOver_Mode));
         } else if (!isMode && !cf->asColorMatrix(srcColorMatrix)) {
-            paint->setColorFilter(NULL);
+            paint->setColorFilter(nullptr);
         }
     }
 
 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
     SkPathEffect* pe = paint->getPathEffect();
     if (pe && !pe->exposedInAndroidJavaAPI()) {
-        paint->setPathEffect(NULL);
+        paint->setPathEffect(nullptr);
     }
 #endif
 
     // TODO: Android doesn't support all the flags that can be passed to
     // blur filters; we need plumbing to get them out.
 
-    paint->setImageFilter(NULL);
-    paint->setLooper(NULL);
+    paint->setImageFilter(nullptr);
+    paint->setLooper(nullptr);
 };
 
 }  // namespace
@@ -103,7 +103,7 @@
     }
 
 
-SkAndroidSDKCanvas::SkAndroidSDKCanvas() : fProxyTarget(NULL) { }
+SkAndroidSDKCanvas::SkAndroidSDKCanvas() : fProxyTarget(nullptr) { }
 
 void SkAndroidSDKCanvas::reset(SkCanvas* newTarget) { fProxyTarget = newTarget; }
 
@@ -292,7 +292,7 @@
     SkASSERT(pmap);
     SkImageInfo info;
     size_t rowBytes; 
-    const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, NULL);
+    const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, nullptr);
     if (addr) {
         pmap->reset(info, addr, rowBytes);
         return true;
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 5ce9067..f163cc5 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -50,7 +50,7 @@
         return gTable[idx];
     }
 
-    Factory getFactory() const override { return NULL; }
+    Factory getFactory() const override { return nullptr; }
 #ifndef SK_IGNORE_TO_STRING
     void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
 #endif
@@ -64,13 +64,13 @@
                            bool overrideFilterQuality,
                            SkFilterQuality quality)
         : INHERITED(width, height)
-        , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : NULL)
+        , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr)
         , fOverrideFilterQuality(overrideFilterQuality)
         , fFilterQuality(quality) {}
 
 protected:
     void onFilterPaint(SkPaint* paint, Type) const override {
-        if (NULL != fOverdrawXfermode.get()) {
+        if (nullptr != fOverdrawXfermode.get()) {
             paint->setAntiAlias(false);
             paint->setXfermode(fOverdrawXfermode.get());
         }
@@ -100,7 +100,7 @@
 
 SkDebugCanvas::SkDebugCanvas(int width, int height)
         : INHERITED(width, height)
-        , fPicture(NULL)
+        , fPicture(nullptr)
         , fFilter(false)
         , fMegaVizMode(false)
         , fOverdrawViz(false)
@@ -359,7 +359,7 @@
 
 void SkDebugCanvas::updatePaintFilterCanvas() {
     if (!fOverdrawViz && !fOverrideFilterQuality) {
-        fPaintFilterCanvas.reset(NULL);
+        fPaintFilterCanvas.reset(nullptr);
         return;
     }
 
@@ -515,7 +515,7 @@
                                    SkXfermode*, const uint16_t indices[], int indexCount,
                                    const SkPaint& paint) {
     this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
-                         texs, colors, NULL, indices, indexCount, paint));
+                         texs, colors, nullptr, indices, indexCount, paint));
 }
 
 void SkDebugCanvas::willRestore() {
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 75d8474..a9415dd 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -63,7 +63,7 @@
             break;
     }
     SkDEBUGFAIL("DrawType UNUSED\n");
-    return NULL;
+    return nullptr;
 }
 
 SkString SkDrawCommand::toString() const {
@@ -114,7 +114,7 @@
     canvas->restore();
 }
 
-void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRect = NULL) {
+void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRect = nullptr) {
     const SkISize& size = canvas->getDeviceSize();
 
     SkScalar xScale = SkIntToScalar(size.fWidth-2) / input.width();
@@ -270,7 +270,7 @@
         fPaint = *paint;
         fPaintPtr = &fPaint;
     } else {
-        fPaintPtr = NULL;
+        fPaintPtr = nullptr;
     }
 
     fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -300,7 +300,7 @@
         fPaint = *paint;
         fPaintPtr = &fPaint;
     } else {
-        fPaintPtr = NULL;
+        fPaintPtr = nullptr;
     }
 
     fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -336,7 +336,7 @@
         fPaint = *paint;
         fPaintPtr = &fPaint;
     } else {
-        fPaintPtr = NULL;
+        fPaintPtr = nullptr;
     }
     fConstraint = constraint;
 
@@ -764,7 +764,7 @@
         fPaint = *paint;
         fPaintPtr = &fPaint;
     } else {
-        fPaintPtr = NULL;
+        fPaintPtr = nullptr;
     }
 
     fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -829,7 +829,7 @@
 
 void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) const {
     canvas->drawTextOnPath(fText, fByteLength, fPath,
-                           fMatrix.isIdentity() ? NULL : &fMatrix,
+                           fMatrix.isIdentity() ? nullptr : &fMatrix,
                            fPaint);
 }
 
@@ -850,14 +850,14 @@
         fTexs = new SkPoint[vertexCount];
         memcpy(fTexs, texs, vertexCount * sizeof(SkPoint));
     } else {
-        fTexs = NULL;
+        fTexs = nullptr;
     }
 
     if (colors) {
         fColors = new SkColor[vertexCount];
         memcpy(fColors, colors, vertexCount * sizeof(SkColor));
     } else {
-        fColors = NULL;
+        fColors = nullptr;
     }
 
     fXfermode = xfermode;
@@ -869,7 +869,7 @@
         fIndices = new uint16_t[indexCount];
         memcpy(fIndices, indices, indexCount * sizeof(uint16_t));
     } else {
-        fIndices = NULL;
+        fIndices = nullptr;
     }
 
     fIndexCount = indexCount;
@@ -924,7 +924,7 @@
         fPaint = *paint;
         fPaintPtr = &fPaint;
     } else {
-        fPaintPtr = NULL;
+        fPaintPtr = nullptr;
     }
     fFlags = flags;
 
@@ -938,7 +938,7 @@
 }
 
 void SkSaveLayerCommand::execute(SkCanvas* canvas) const {
-    canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds,
+    canvas->saveLayer(fBounds.isEmpty() ? nullptr : &fBounds,
                       fPaintPtr,
                       fFlags);
 }
diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h
index b8eca79..c7e5f00 100644
--- a/src/utils/debugger/SkDrawCommand.h
+++ b/src/utils/debugger/SkDrawCommand.h
@@ -250,7 +250,7 @@
 
     void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; }
 
-    const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; }
+    const SkRect* srcRect() const { return fSrc.isEmpty() ? nullptr : &fSrc; }
     void setSrcRect(const SkRect& src) { fSrc = src; }
 
     const SkRect& dstRect() const { return fDst; }
diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp
index cba8d06..03820e1 100644
--- a/src/utils/debugger/SkObjectParser.cpp
+++ b/src/utils/debugger/SkObjectParser.cpp
@@ -151,7 +151,7 @@
     mPath->append(gConvexityStrings[path.getConvexity()]);
     mPath->append(", ");
 
-    if (path.isRect(NULL)) {
+    if (path.isRect(nullptr)) {
         mPath->append("isRect, ");
     } else {
         mPath->append("isNotRect, ");
@@ -235,7 +235,7 @@
 
     SkString* mRect = new SkString;
 
-    if (NULL == title) {
+    if (nullptr == title) {
         mRect->append("SkRect: ");
     } else {
         mRect->append(title);
@@ -256,7 +256,7 @@
 
     SkString* mRRect = new SkString;
 
-    if (NULL == title) {
+    if (nullptr == title) {
         mRRect->append("SkRRect (");
         if (rrect.isEmpty()) {
             mRRect->append("empty");
@@ -358,7 +358,7 @@
             decodedText->append("UTF-16: ");
             size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text,
                                                 SkToS32(byteLength / 2),
-                                                NULL);
+                                                nullptr);
             SkAutoSTMalloc<0x100, char> utf8(sizeNeeded);
             SkUTF16_ToUTF8((uint16_t*)text, SkToS32(byteLength / 2), utf8);
             decodedText->append(utf8, sizeNeeded);
diff --git a/src/utils/debugger/SkObjectParser.h b/src/utils/debugger/SkObjectParser.h
index c4d0da0..4c04935 100644
--- a/src/utils/debugger/SkObjectParser.h
+++ b/src/utils/debugger/SkObjectParser.h
@@ -89,13 +89,13 @@
         Returns a string representation of the SkRects coordinates.
         @param rect  SkRect
      */
-    static SkString* RectToString(const SkRect& rect, const char* title = NULL);
+    static SkString* RectToString(const SkRect& rect, const char* title = nullptr);
 
     /**
         Returns a string representation of an SkRRect.
         @param rrect  SkRRect
      */
-    static SkString* RRectToString(const SkRRect& rrect, const char* title = NULL);
+    static SkString* RRectToString(const SkRRect& rrect, const char* title = nullptr);
 
     /**
         Returns a string representation of the SkRegion enum.
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index 4675d71..0cbf704 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -101,7 +101,7 @@
                                     CGBitmapInfo* info) {
     bool upscaleTo32;
     if (!getBitmapInfo(bm, bitsPerComponent, info, &upscaleTo32)) {
-        return NULL;
+        return nullptr;
     }
 
     SkBitmap* copy;
@@ -122,8 +122,8 @@
     CGBitmapInfo info       SK_INIT_TO_AVOID_WARNING;
 
     SkBitmap* bitmap = prepareForImageRef(bm, &bitsPerComponent, &info);
-    if (NULL == bitmap) {
-        return NULL;
+    if (nullptr == bitmap) {
+        return nullptr;
     }
 
     const int w = bitmap->width();
@@ -138,7 +138,7 @@
                                                              SkBitmap_ReleaseInfo);
 
     bool releaseColorSpace = false;
-    if (NULL == colorSpace) {
+    if (nullptr == colorSpace) {
         colorSpace = CGColorSpaceCreateDeviceRGB();
         releaseColorSpace = true;
     }
@@ -146,7 +146,7 @@
     CGImageRef ref = CGImageCreate(w, h, bitsPerComponent,
                                    bitmap->bytesPerPixel() * 8,
                                    bitmap->rowBytes(), colorSpace, info, dataRef,
-                                   NULL, false, kCGRenderingIntentDefault);
+                                   nullptr, false, kCGRenderingIntentDefault);
 
     if (releaseColorSpace) {
         CGColorSpaceRelease(colorSpace);
@@ -192,19 +192,19 @@
 
 bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
     CGDataProviderRef data = SkCreateDataProviderFromStream(stream);
-    if (NULL == data) {
+    if (nullptr == data) {
         return false;
     }
 
     CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
     CGDataProviderRelease(data);
-    if (NULL == pdf) {
+    if (nullptr == pdf) {
         return false;
     }
     SkAutoPDFRelease releaseMe(pdf);
 
     CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
-    if (NULL == page) {
+    if (nullptr == page) {
         return false;
     }
 
@@ -221,7 +221,7 @@
 
     size_t bitsPerComponent;
     CGBitmapInfo info;
-    getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
+    getBitmapInfo(bitmap, &bitsPerComponent, &info, nullptr);
 
     CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
     CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
@@ -261,7 +261,7 @@
     CGContextRef cg = CGBitmapContextCreate(pixels, info.width(), info.height(), bitsPerComponent,
                                             rowBytes, cs, cg_bitmap_info);
     CFRelease(cs);
-    if (NULL == cg) {
+    if (nullptr == cg) {
         return false;
     }
 
diff --git a/src/utils/win/SkAutoCoInitialize.cpp b/src/utils/win/SkAutoCoInitialize.cpp
index 89115bf..78326a5 100644
--- a/src/utils/win/SkAutoCoInitialize.cpp
+++ b/src/utils/win/SkAutoCoInitialize.cpp
@@ -14,7 +14,7 @@
 
 SkAutoCoInitialize::SkAutoCoInitialize() :
     fHR(
-        CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
+        CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
     )
 { }
 
diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp
index 363ac43..2254961 100644
--- a/src/utils/win/SkDWrite.cpp
+++ b/src/utils/win/SkDWrite.cpp
@@ -12,7 +12,7 @@
 
 #include <dwrite.h>
 
-static IDWriteFactory* gDWriteFactory = NULL;
+static IDWriteFactory* gDWriteFactory = nullptr;
 
 static void release_dwrite_factory() {
     if (gDWriteFactory) {
@@ -52,7 +52,7 @@
 
 /** Converts a utf8 string to a WCHAR string. */
 HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name) {
-    int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, NULL, 0);
+    int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, nullptr, 0);
     if (0 == wlen) {
         HRM(HRESULT_FROM_WIN32(GetLastError()),
             "Could not get length for wchar to utf-8 conversion.");
@@ -67,7 +67,7 @@
 
 /** Converts a WCHAR string to a utf8 string. */
 HRESULT sk_wchar_to_skstring(WCHAR* name, int nameLen, SkString* skname) {
-    int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, NULL, 0, NULL, NULL);
+    int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, nullptr, 0, nullptr, nullptr);
     if (0 == len) {
         if (nameLen <= 0) {
             skname->reset();
@@ -78,7 +78,7 @@
     }
     skname->resize(len);
 
-    len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, NULL, NULL);
+    len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, nullptr, nullptr);
     if (0 == len) {
         HRM(HRESULT_FROM_WIN32(GetLastError()), "Could not convert utf-8 to wchar.");
     }
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index eb7e5dc..0e3d4fc 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -20,8 +20,8 @@
 SkDWriteFontFileStream::SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream)
     : fFontFileStream(SkRefComPtr(fontFileStream))
     , fPos(0)
-    , fLockedMemory(NULL)
-    , fFragmentLock(NULL) {
+    , fLockedMemory(nullptr)
+    , fFragmentLock(nullptr) {
 }
 
 SkDWriteFontFileStream::~SkDWriteFontFileStream() {
@@ -33,7 +33,7 @@
 size_t SkDWriteFontFileStream::read(void* buffer, size_t size) {
     HRESULT hr = S_OK;
 
-    if (NULL == buffer) {
+    if (nullptr == buffer) {
         size_t fileSize = this->getLength();
 
         if (fPos + size > fileSize) {
@@ -137,7 +137,7 @@
                                               SkDWriteFontFileStreamWrapper** streamFontFileStream)
 {
     *streamFontFileStream = new SkDWriteFontFileStreamWrapper(stream);
-    if (NULL == streamFontFileStream) {
+    if (nullptr == streamFontFileStream) {
         return E_OUTOFMEMORY;
     }
     return S_OK;
@@ -153,7 +153,7 @@
         AddRef();
         return S_OK;
     } else {
-        *ppvObject = NULL;
+        *ppvObject = nullptr;
         return E_NOINTERFACE;
     }
 }
@@ -180,8 +180,8 @@
     UINT64 fileSize;
     this->GetFileSize(&fileSize);
     if (fileOffset > fileSize || fragmentSize > fileSize - fileOffset) {
-        *fragmentStart = NULL;
-        *fragmentContext = NULL;
+        *fragmentStart = nullptr;
+        *fragmentContext = nullptr;
         return E_FAIL;
     }
 
@@ -192,14 +192,14 @@
     const void* data = fStream->getMemoryBase();
     if (data) {
         *fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fileOffset);
-        *fragmentContext = NULL;
+        *fragmentContext = nullptr;
 
     } else {
         // May be called from multiple threads.
         SkAutoMutexAcquire ama(fStreamMutex);
 
-        *fragmentStart = NULL;
-        *fragmentContext = NULL;
+        *fragmentStart = nullptr;
+        *fragmentContext = nullptr;
 
         if (!fStream->seek(static_cast<size_t>(fileOffset))) {
             return E_FAIL;
diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp
index b7ef88b..066d4a4 100644
--- a/src/utils/win/SkDWriteGeometrySink.cpp
+++ b/src/utils/win/SkDWriteGeometrySink.cpp
@@ -19,7 +19,7 @@
 SkDWriteGeometrySink::~SkDWriteGeometrySink() { }
 
 HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void **object) {
-    if (NULL == object) {
+    if (nullptr == object) {
         return E_INVALIDARG;
     }
     if (iid == __uuidof(IUnknown) || iid == __uuidof(IDWriteGeometrySink)) {
@@ -27,7 +27,7 @@
         this->AddRef();
         return S_OK;
     } else {
-        *object = NULL;
+        *object = nullptr;
         return E_NOINTERFACE;
     }
 }
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 0aea4a6..d565986 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -15,23 +15,23 @@
     }
     SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr);
 
-    LPSTR errorText = NULL;
+    LPSTR errorText = nullptr;
     FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                    FORMAT_MESSAGE_FROM_SYSTEM |
                    FORMAT_MESSAGE_IGNORE_INSERTS,
-                   NULL,
+                   nullptr,
                    hr,
                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                    (LPSTR) &errorText,
                    0,
-                   NULL
+                   nullptr
     );
 
-    if (NULL == errorText) {
+    if (nullptr == errorText) {
         SkDebugf("<unknown>\n");
     } else {
         SkDebugf("%s", errorText);
         LocalFree(errorText);
-        errorText = NULL;
+        errorText = nullptr;
     }
 }
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index dc9d163..f1dbcb2 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -22,7 +22,7 @@
 HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid
                                                       , void ** ppvObject)
 {
-    if (NULL == ppvObject) {
+    if (nullptr == ppvObject) {
         return E_INVALIDARG;
     }
     if (iid == __uuidof(IUnknown)
@@ -33,7 +33,7 @@
         AddRef();
         return S_OK;
     } else {
-        *ppvObject = NULL;
+        *ppvObject = nullptr;
         return E_NOINTERFACE;
     }
 }
@@ -122,7 +122,7 @@
                                     , bool deleteOnRelease
                                     , IStream ** ppStream)
 {
-    if (NULL == stream) {
+    if (nullptr == stream) {
         return E_INVALIDARG;
     }
     *ppStream = new SkIStream(stream, deleteOnRelease);
@@ -208,7 +208,7 @@
     if (0 == (grfStatFlag & STATFLAG_NONAME)) {
         return STG_E_INVALIDFLAG;
     }
-    pStatstg->pwcsName = NULL;
+    pStatstg->pwcsName = nullptr;
     // FIXME: Should not depend on getLength
     // See https://code.google.com/p/skia/issues/detail?id=1570
     pStatstg->cbSize.QuadPart = this->fSkStream->getLength();
@@ -268,7 +268,7 @@
     if (0 == (grfStatFlag & STATFLAG_NONAME)) {
         return STG_E_INVALIDFLAG;
     }
-    pStatstg->pwcsName = NULL;
+    pStatstg->pwcsName = nullptr;
     pStatstg->cbSize.QuadPart = 0;
     pStatstg->clsid = CLSID_NULL;
     pStatstg->type = STGTY_STREAM;
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 60f3cb3..ef07bea 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -13,7 +13,7 @@
 #include "SkTSort.h"
 
 bool SkWGLExtensions::hasExtension(HDC dc, const char* ext) const {
-    if (NULL == this->fGetExtensionsString) {
+    if (nullptr == this->fGetExtensionsString) {
         return false;
     }
     if (!strcmp("WGL_ARB_extensions_string", ext)) {
@@ -168,7 +168,7 @@
 #define DUMMY_CLASS STR_LIT("DummyClass")
 
 HWND create_dummy_window() {
-    HMODULE module = GetModuleHandle(NULL);
+    HMODULE module = GetModuleHandle(nullptr);
     HWND dummy;
     RECT windowRect;
     windowRect.left = 0;
@@ -183,10 +183,10 @@
     wc.cbClsExtra = 0;
     wc.cbWndExtra = 0;
     wc.hInstance = module;
-    wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
-    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wc.hbrBackground = NULL;
-    wc.lpszMenuName = NULL;
+    wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
+    wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
+    wc.hbrBackground = nullptr;
+    wc.lpszMenuName = nullptr;
     wc.lpszClassName = DUMMY_CLASS;
 
     if(!RegisterClass(&wc)) {
@@ -205,11 +205,11 @@
                                 0, 0,
                                 windowRect.right-windowRect.left,
                                 windowRect.bottom-windowRect.top,
-                                NULL, NULL,
+                                nullptr, nullptr,
                                 module,
-                                NULL))) {
+                                nullptr))) {
         UnregisterClass(DUMMY_CLASS, module);
-        return NULL;
+        return nullptr;
     }
     ShowWindow(dummy, SW_HIDE);
 
@@ -218,7 +218,7 @@
 
 void destroy_dummy_window(HWND dummy) {
     DestroyWindow(dummy);
-    HMODULE module = GetModuleHandle(NULL);
+    HMODULE module = GetModuleHandle(nullptr);
     UnregisterClass(DUMMY_CLASS, module);
 }
 }
@@ -227,16 +227,16 @@
                      (##NAME##Proc) wglGetProcAddress("wgl" #NAME #SUFFIX)
 
 SkWGLExtensions::SkWGLExtensions()
-    : fGetExtensionsString(NULL)
-    , fChoosePixelFormat(NULL)
-    , fGetPixelFormatAttribfv(NULL)
-    , fGetPixelFormatAttribiv(NULL)
-    , fCreateContextAttribs(NULL)
-    , fSwapInterval(NULL)
-    , fCreatePbuffer(NULL)
-    , fGetPbufferDC(NULL)
-    , fReleasePbufferDC(NULL)
-    , fDestroyPbuffer(NULL)
+    : fGetExtensionsString(nullptr)
+    , fChoosePixelFormat(nullptr)
+    , fGetPixelFormatAttribfv(nullptr)
+    , fGetPixelFormatAttribiv(nullptr)
+    , fCreateContextAttribs(nullptr)
+    , fSwapInterval(nullptr)
+    , fCreatePbuffer(nullptr)
+    , fGetPbufferDC(nullptr)
+    , fReleasePbufferDC(nullptr)
+    , fDestroyPbuffer(nullptr)
  {
     HDC prevDC = wglGetCurrentDC();
     HGLRC prevGLRC = wglGetCurrentContext();
@@ -272,7 +272,7 @@
         GET_PROC(ReleasePbufferDC, ARB);
         GET_PROC(DestroyPbuffer, ARB);
 
-        wglMakeCurrent(dummyDC, NULL);
+        wglMakeCurrent(dummyDC, nullptr);
         wglDeleteContext(dummyGLRC);
         destroy_dummy_window(dummyWND);
     }
@@ -329,11 +329,11 @@
     HDC prevDC = wglGetCurrentDC();
     HGLRC prevGLRC = wglGetCurrentContext();
 
-    HGLRC glrc = NULL;
+    HGLRC glrc = nullptr;
     if (kGLES_SkWGLContextRequest == contextType) {
         if (!extensions.hasExtension(dc, "WGL_EXT_create_context_es2_profile")) {
             wglMakeCurrent(prevDC, prevGLRC);
-            return NULL;
+            return nullptr;
         }
         static const int glesAttribs[] = {
             SK_WGL_CONTEXT_MAJOR_VERSION, 3,
@@ -341,10 +341,10 @@
             SK_WGL_CONTEXT_PROFILE_MASK,  SK_WGL_CONTEXT_ES2_PROFILE_BIT,
             0,
         };
-        glrc = extensions.createContextAttribs(dc, NULL, glesAttribs);
-        if (NULL == glrc) {
+        glrc = extensions.createContextAttribs(dc, nullptr, glesAttribs);
+        if (nullptr == glrc) {
             wglMakeCurrent(prevDC, prevGLRC);
-            return NULL;
+            return nullptr;
         }
     } else {
         if (kGLPreferCoreProfile_SkWGLContextRequest == contextType &&
@@ -366,7 +366,7 @@
             for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
                 coreProfileAttribs[1] = kCoreGLVersions[2 * v];
                 coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
-                glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs);
+                glrc = extensions.createContextAttribs(dc, nullptr, coreProfileAttribs);
                 if (glrc) {
                     break;
                 }
@@ -374,7 +374,7 @@
         }
     }
 
-    if (NULL == glrc) {
+    if (nullptr == glrc) {
         glrc = wglCreateContext(dc);
     }
     SkASSERT(glrc);
@@ -391,7 +391,7 @@
 HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contextType) {
     SkWGLExtensions extensions;
     if (!extensions.hasExtension(dc, "WGL_ARB_pixel_format")) {
-        return NULL;
+        return nullptr;
     }
 
     BOOL set = FALSE;
@@ -407,7 +407,7 @@
     }
 
     if (!set) {
-        return NULL;
+        return nullptr;
     }
 
     return create_gl_context(dc, extensions, contextType);}
@@ -417,7 +417,7 @@
     SkWGLExtensions extensions;
     if (!extensions.hasExtension(parentDC, "WGL_ARB_pixel_format") ||
         !extensions.hasExtension(parentDC, "WGL_ARB_pbuffer")) {
-        return NULL;
+        return nullptr;
     }
 
     // try for single buffer first
@@ -426,7 +426,7 @@
         get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSampleCount,
                                  pixelFormatsToTry);
         for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry); ++f) {
-            HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, NULL);
+            HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, nullptr);
             if (0 != pbuf) {
                 HDC dc = extensions.getPbufferDC(pbuf);
                 if (dc) {
@@ -440,7 +440,7 @@
             }
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 SkWGLPbufferContext::~SkWGLPbufferContext() {