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

Review URL: https://codereview.chromium.org/1316233002
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 983a870..8c3b6ed 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -212,7 +212,7 @@
         return;
     }
     SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
-    if (NULL == codec.get()) {
+    if (nullptr == codec.get()) {
         SkDebugf("Couldn't create codec for %s.", path.c_str());
         return;
     }
@@ -418,17 +418,17 @@
         SINK("xps",  XPSSink);
     }
 #undef SINK
-    return NULL;
+    return nullptr;
 }
 
 static Sink* create_via(const char* tag, Sink* wrapped) {
 #define VIA(t, via, ...) if (0 == strcmp(t, tag)) { return new via(__VA_ARGS__); }
-    VIA("twice",     ViaTwice,         wrapped);
-    VIA("pipe",      ViaPipe,          wrapped);
-    VIA("serialize", ViaSerialization, wrapped);
-    VIA("2ndpic",    ViaSecondPicture, wrapped);
+    VIA("twice",     ViaTwice,             wrapped);
+    VIA("pipe",      ViaPipe,              wrapped);
+    VIA("serialize", ViaSerialization,     wrapped);
+    VIA("2ndpic",    ViaSecondPicture,     wrapped);
     VIA("sp",        ViaSingletonPictures, wrapped);
-    VIA("tiles",     ViaTiles, 256, 256,               NULL, wrapped);
+    VIA("tiles",     ViaTiles, 256, 256, nullptr,            wrapped);
     VIA("tiles_rt",  ViaTiles, 256, 256, new SkRTreeFactory, wrapped);
 
     if (FLAGS_matrix.count() == 4) {
@@ -447,7 +447,7 @@
 #endif
 
 #undef VIA
-    return NULL;
+    return nullptr;
 }
 
 static void gather_sinks() {
@@ -456,14 +456,14 @@
         SkTArray<SkString> parts;
         SkStrSplit(config, "-", &parts);
 
-        Sink* sink = NULL;
+        Sink* sink = nullptr;
         for (int i = parts.count(); i-- > 0;) {
             const char* part = parts[i].c_str();
-            Sink* next = (sink == NULL) ? create_sink(part) : create_via(part, sink);
-            if (next == NULL) {
+            Sink* next = (sink == nullptr) ? create_sink(part) : create_via(part, sink);
+            if (next == nullptr) {
                 SkDebugf("Skipping %s: Don't understand '%s'.\n", config, part);
                 delete sink;
-                sink = NULL;
+                sink = nullptr;
                 break;
             }
             sink = next;
@@ -539,7 +539,7 @@
 }
 
 static bool match(const char* needle, const char* haystack) {
-    return 0 == strcmp("_", needle) || NULL != strstr(haystack, needle);
+    return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
 }
 
 static ImplicitString is_blacklisted(const char* sink, const char* src,
@@ -648,10 +648,10 @@
             if (!FLAGS_writePath.isEmpty()) {
                 const char* ext = task->sink->fileExtension();
                 if (data->getLength()) {
-                    WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
+                    WriteToDisk(*task, md5, ext, data, data->getLength(), nullptr);
                     SkASSERT(bitmap.drawsNothing());
                 } else if (!bitmap.drawsNothing()) {
-                    WriteToDisk(*task, md5, ext, NULL, 0, &bitmap);
+                    WriteToDisk(*task, md5, ext, nullptr, 0, &bitmap);
                 }
             }
         }
@@ -838,7 +838,7 @@
             && !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
         return sk_tool_utils::create_portable_typeface(familyName, style);
     }
-    return NULL;
+    return nullptr;
 }
 
 #undef PORTABLE_FONT_PREFIX
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index f147248..4025f31 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -86,7 +86,7 @@
                                        SkImageInfo,
                                        int,
                                        bool) {
-    return NULL;
+    return nullptr;
 }
 
 }  // namespace DM
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index d46e590..1253014 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -41,24 +41,24 @@
 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {}
 
 Error GMSrc::draw(SkCanvas* canvas) const {
-    SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+    SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
     canvas->concat(gm->getInitialTransform());
     gm->draw(canvas);
     return "";
 }
 
 SkISize GMSrc::size() const {
-    SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+    SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
     return gm->getISize();
 }
 
 Name GMSrc::name() const {
-    SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+    SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
     return gm->getName();
 }
 
 void GMSrc::modifyGrContextOptions(GrContextOptions* options) const {
-    SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+    SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
     gm->modifyGrContextOptions(options);
 }
 
@@ -85,10 +85,10 @@
         return SkStringPrintf("Couldn't read %s.", fPath.c_str());
     }
     SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
-    if (NULL == codec.get()) {
+    if (nullptr == codec.get()) {
         // scaledCodec not supported, try normal codec
         codec.reset(SkCodec::NewFromData(encoded));
-        if (NULL == codec.get()) {
+        if (nullptr == codec.get()) {
             return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str());
         }
     }
@@ -128,9 +128,9 @@
     decodeInfo = decodeInfo.makeWH(size.width(), size.height());
 
     // Construct a color table for the decode if necessary
-    SkAutoTUnref<SkColorTable> colorTable(NULL);
-    SkPMColor* colorPtr = NULL;
-    int* colorCountPtr = NULL;
+    SkAutoTUnref<SkColorTable> colorTable(nullptr);
+    SkPMColor* colorPtr = nullptr;
+    int* colorCountPtr = nullptr;
     int maxColors = 256;
     if (kIndex_8_SkColorType == decodeInfo.colorType()) {
         SkPMColor colors[256];
@@ -145,14 +145,14 @@
     }
 
     SkBitmap bitmap;
-    if (!bitmap.tryAllocPixels(decodeInfo, NULL, colorTable.get())) {
+    if (!bitmap.tryAllocPixels(decodeInfo, nullptr, colorTable.get())) {
         return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(),
                               decodeInfo.width(), decodeInfo.height());
     }
 
     switch (fMode) {
         case kNormal_Mode: {
-            switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), NULL,
+            switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), nullptr,
                     colorPtr, colorCountPtr)) {
                 case SkCodec::kSuccess:
                     // We consider incomplete to be valid, since we should still decode what is
@@ -171,8 +171,8 @@
         case kScanline_Mode: {
             SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
                     SkScanlineDecoder::NewFromData(encoded));
-            if (NULL == scanlineDecoder || SkCodec::kSuccess !=
-                    scanlineDecoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
+            if (nullptr == scanlineDecoder || SkCodec::kSuccess !=
+                    scanlineDecoder->start(decodeInfo, nullptr, colorPtr, colorCountPtr)) {
                 return Error::Nonfatal("Cannot use scanline decoder for all images");
             }
 
@@ -215,7 +215,7 @@
             SkImageInfo largestSubsetDecodeInfo =
                     decodeInfo.makeWH(subsetWidth + extraX, subsetHeight + extraY);
             SkBitmap largestSubsetBm;
-            if (!largestSubsetBm.tryAllocPixels(largestSubsetDecodeInfo, NULL, colorTable.get())) {
+            if (!largestSubsetBm.tryAllocPixels(largestSubsetDecodeInfo, nullptr, colorTable.get())) {
                 return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(),
                         largestSubsetDecodeInfo.width(), largestSubsetDecodeInfo.height());
             }
@@ -235,15 +235,15 @@
                     //create scanline decoder for each subset
                     SkAutoTDelete<SkScanlineDecoder> subsetScanlineDecoder(
                             SkScanlineDecoder::NewFromData(encoded));
-                    if (NULL == subsetScanlineDecoder || SkCodec::kSuccess !=
+                    if (nullptr == subsetScanlineDecoder || SkCodec::kSuccess !=
                             subsetScanlineDecoder->start(
-                            decodeInfo, NULL, colorPtr, colorCountPtr))
+                            decodeInfo, nullptr, colorPtr, colorCountPtr))
                     {
                         if (x == 0 && y == 0) {
                             //first try, image may not be compatible
                             return Error::Nonfatal("Cannot use scanline decoder for all images");
                         } else {
-                            return "Error scanline decoder is NULL";
+                            return "Error scanline decoder is nullptr";
                         }
                     }
                     //skip to first line of subset
@@ -305,8 +305,8 @@
 
             // Decode odd stripes
             SkAutoTDelete<SkScanlineDecoder> decoder(SkScanlineDecoder::NewFromData(encoded));
-            if (NULL == decoder || SkCodec::kSuccess !=
-                    decoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
+            if (nullptr == decoder || SkCodec::kSuccess !=
+                    decoder->start(decodeInfo, nullptr, colorPtr, colorCountPtr)) {
                 return Error::Nonfatal("Cannot use scanline decoder for all images");
             }
             for (int i = 0; i < numStripes; i += 2) {
@@ -338,7 +338,7 @@
             }
 
             // Decode even stripes
-            const SkCodec::Result startResult = decoder->start(decodeInfo, NULL, colorPtr,
+            const SkCodec::Result startResult = decoder->start(decodeInfo, nullptr, colorPtr,
                                                                colorCountPtr);
             if (SkCodec::kSuccess != startResult) {
                 return "Failed to restart scanline decoder with same parameters.";
@@ -412,7 +412,7 @@
                                                    SkScalarRoundToInt(preScaleH * fScale));
                     size_t rowBytes = decodeInfo.minRowBytes();
                     if (!subsetBm.installPixels(decodeInfo, pixels, rowBytes, colorTable.get(),
-                                                NULL, NULL)) {
+                                                nullptr, nullptr)) {
                         return SkStringPrintf("could not install pixels for %s.", fPath.c_str());
                     }
                     const SkCodec::Result result = codec->getPixels(decodeInfo, pixels, rowBytes,
@@ -457,10 +457,10 @@
 SkISize CodecSrc::size() const {
     SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
     SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
-    if (NULL == codec) {
+    if (nullptr == codec) {
         // scaledCodec not supported, try regular codec
         codec.reset(SkCodec::NewFromData(encoded));
-        if (NULL == codec) {
+        if (nullptr == codec) {
             return SkISize::Make(0, 0);
         }
     }
@@ -504,7 +504,7 @@
             // Do not draw a bitmap with alpha to a destination without alpha.
             return Error::Nonfatal("Uninteresting to decode image with alpha into 565.");
         }
-        encoded.reset((SkData*)NULL);  // Might as well drop this when we're done with it.
+        encoded.reset((SkData*)nullptr);  // Might as well drop this when we're done with it.
         canvas->drawBitmap(bitmap, 0,0);
         return "";
     }
@@ -582,7 +582,7 @@
     if (!pic) {
         return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str());
     }
-    stream.reset((SkStream*)NULL);  // Might as well drop this when we're done with it.
+    stream.reset((SkStream*)nullptr);  // Might as well drop this when we're done with it.
 
     canvas->clipRect(kSKPViewport);
     canvas->drawPicture(pic);
@@ -649,7 +649,7 @@
         return "Could not create a surface.";
     }
     if (FLAGS_preAbandonGpuContext) {
-        SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, NULL);
+        SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr);
         factory.abandonContexts();
     }
     SkCanvas* canvas = surface->getCanvas();
@@ -694,7 +694,7 @@
                 SkCanvas* canvas =
                         doc->beginPage(SkIntToScalar(w), SkIntToScalar(h));
                 if (!canvas) {
-                    return "SkDocument::beginPage(w,h) returned NULL";
+                    return "SkDocument::beginPage(w,h) returned nullptr";
                 }
                 canvas->clipRect(letter);
                 canvas->translate(-letter.width() * x, -letter.height() * y);
@@ -709,7 +709,7 @@
         SkCanvas* canvas =
                 doc->beginPage(SkIntToScalar(width), SkIntToScalar(height));
         if (!canvas) {
-            return "SkDocument::beginPage(w,h) returned NULL";
+            return "SkDocument::beginPage(w,h) returned nullptr";
         }
         Error err = src.draw(canvas);
         if (!err.isEmpty()) {
@@ -729,7 +729,7 @@
 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
     SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
     if (!doc) {
-        return "SkDocument::CreatePDF() returned NULL";
+        return "SkDocument::CreatePDF() returned nullptr";
     }
     return draw_skdocument(src, doc.get(), dst);
 }
@@ -741,7 +741,7 @@
 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
     SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
     if (!doc) {
-        return "SkDocument::CreateXPS() returned NULL";
+        return "SkDocument::CreateXPS() returned nullptr";
     }
     return draw_skdocument(src, doc.get(), dst);
 }