diff options
author | halcanary <halcanary@google.com> | 2015-08-27 07:41:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 07:41:16 -0700 |
commit | 96fcdcc219d2a0d3579719b84b28bede76efba64 (patch) | |
tree | 0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /tests | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'tests')
129 files changed, 730 insertions, 724 deletions
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp index 1c4f391293..42fc7e7f96 100644 --- a/tests/AAClipTest.cpp +++ b/tests/AAClipTest.cpp @@ -62,7 +62,7 @@ static void copyToMask(const SkRegion& rgn, SkMask* mask) { if (rgn.isEmpty()) { mask->fBounds.setEmpty(); mask->fRowBytes = 0; - mask->fImage = NULL; + mask->fImage = nullptr; return; } @@ -185,7 +185,7 @@ static void test_path_bounds(skiatest::Reporter* reporter) { path.addOval(SkRect::MakeWH(sheight, sheight)); REPORTER_ASSERT(reporter, sheight == path.getBounds().height()); - clip.setPath(path, NULL, true); + clip.setPath(path, nullptr, true); REPORTER_ASSERT(reporter, height == clip.getBounds().height()); // this is the trimmed height of this cubic (with aa). The critical thing @@ -199,7 +199,7 @@ static void test_path_bounds(skiatest::Reporter* reporter) { imoveTo(path, 0, 20); icubicTo(path, 40, 40, 40, 0, 0, 20); REPORTER_ASSERT(reporter, sheight == path.getBounds().height()); - clip.setPath(path, NULL, true); + clip.setPath(path, nullptr, true); REPORTER_ASSERT(reporter, teardrop_height == clip.getBounds().height()); } @@ -228,9 +228,9 @@ static void test_empty(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, clip1 == clip0); SkMask mask; - mask.fImage = NULL; + mask.fImage = nullptr; clip0.copyToMask(&mask); - REPORTER_ASSERT(reporter, NULL == mask.fImage); + REPORTER_ASSERT(reporter, nullptr == mask.fImage); REPORTER_ASSERT(reporter, mask.fBounds.isEmpty()); } @@ -308,7 +308,7 @@ static void test_path_with_hole(skiatest::Reporter* reporter) { for (int i = 0; i < 2; ++i) { SkAAClip clip; - clip.setPath(path, NULL, 1 == i); + clip.setPath(path, nullptr, 1 == i); SkMask mask; clip.copyToMask(&mask); diff --git a/tests/AsADashTest.cpp b/tests/AsADashTest.cpp index 47f19717a4..c59dc8344f 100644 --- a/tests/AsADashTest.cpp +++ b/tests/AsADashTest.cpp @@ -24,7 +24,7 @@ DEF_TEST(AsADashTest_nullInfo, reporter) { const SkScalar phase = 2.0; SkAutoTUnref<SkDashPathEffect> pe(SkDashPathEffect::Create(inIntervals, 4, phase)); - SkPathEffect::DashType dashType = pe->asADash(NULL); + SkPathEffect::DashType dashType = pe->asADash(nullptr); REPORTER_ASSERT(reporter, SkPathEffect::kDash_DashType == dashType); } diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 1cb2944e99..65427ffd7b 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -193,15 +193,15 @@ static const int H = 33; static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul, SkColorType ct) { - SkColorTable* ctable = NULL; + SkColorTable* ctable = nullptr; if (kIndex_8_SkColorType == ct) { ctable = init_ctable(); } srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType), - NULL, ctable); + nullptr, ctable); srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType), - NULL, ctable); + nullptr, ctable); SkSafeUnref(ctable); init_src(*srcOpaque); init_src(*srcPremul); @@ -248,8 +248,8 @@ DEF_TEST(BitmapCopy_extractSubset, reporter) { SkAutoLockPixels alp0(subset); SkAutoLockPixels alp1(copy); // they should both have, or both not-have, a colortable - bool hasCT = subset.getColorTable() != NULL; - REPORTER_ASSERT(reporter, (copy.getColorTable() != NULL) == hasCT); + bool hasCT = subset.getColorTable() != nullptr; + REPORTER_ASSERT(reporter, (copy.getColorTable() != nullptr) == hasCT); } } } @@ -376,7 +376,7 @@ DEF_TEST(BitmapCopy, reporter) { // Create bitmap to act as source for copies and subsets. SkBitmap src, subset; - SkColorTable* ct = NULL; + SkColorTable* ct = nullptr; if (kIndex_8_SkColorType == src.colorType()) { ct = init_ctable(); } diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp index 2567256667..4d68e73dbe 100644 --- a/tests/BitmapTest.cpp +++ b/tests/BitmapTest.cpp @@ -16,17 +16,17 @@ static void test_peekpixels(skiatest::Reporter* reporter) { SkBitmap bm; // empty should return false - REPORTER_ASSERT(reporter, !bm.peekPixels(NULL)); + REPORTER_ASSERT(reporter, !bm.peekPixels(nullptr)); REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap)); // no pixels should return false bm.setInfo(SkImageInfo::MakeN32Premul(10, 10)); - REPORTER_ASSERT(reporter, !bm.peekPixels(NULL)); + REPORTER_ASSERT(reporter, !bm.peekPixels(nullptr)); REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap)); // real pixels should return true bm.allocPixels(info); - REPORTER_ASSERT(reporter, bm.peekPixels(NULL)); + REPORTER_ASSERT(reporter, bm.peekPixels(nullptr)); REPORTER_ASSERT(reporter, bm.peekPixels(&pmap)); REPORTER_ASSERT(reporter, pmap.info() == bm.info()); REPORTER_ASSERT(reporter, pmap.addr() == bm.getPixels()); @@ -43,7 +43,7 @@ static void test_bigalloc(skiatest::Reporter* reporter) { SkBitmap bm; REPORTER_ASSERT(reporter, !bm.tryAllocPixels(info)); - SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), NULL); + SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), nullptr); REPORTER_ASSERT(reporter, !pr); } diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp index 4689a305ac..b6a24eb98d 100644 --- a/tests/BlitRowTest.cpp +++ b/tests/BlitRowTest.cpp @@ -174,7 +174,7 @@ struct Mesh { void draw(SkCanvas* canvas, SkPaint* paint) { canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts, - NULL, NULL, NULL, 0, *paint); + nullptr, nullptr, nullptr, 0, *paint); } }; diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index cde700ef7f..89f3a0a5cf 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -171,7 +171,7 @@ static void ground_truth_2d(int width, int height, memset(src.fImage, 0xff, src.computeTotalImageSize()); - dst.fImage = NULL; + dst.fImage = nullptr; SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle); int midX = dst.fBounds.centerX(); @@ -281,7 +281,7 @@ static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path, int* result, int resultCount) { GrContext* grContext = factory->get(GrContextFactory::kNative_GLContextType); - if (NULL == grContext) { + if (nullptr == grContext) { return false; } @@ -292,7 +292,7 @@ static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path, desc.fHeight = 30; desc.fSampleCnt = 0; - SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, NULL, 0)); + SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0)); SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice (grContext, texture.get())); SkCanvas canvas(device.get()); @@ -430,7 +430,7 @@ static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma, const bool expectSuccess = sigma > 0 && 0 == (flags & SkBlurDrawLooper::kIgnoreTransform_BlurFlag); - if (NULL == lp.get()) { + if (nullptr == lp.get()) { REPORTER_ASSERT(reporter, sigma <= 0); } else { SkDrawLooper::BlurShadowRec rec; @@ -526,7 +526,7 @@ static void test_asABlur(skiatest::Reporter* reporter) { const SkBlurQuality quality = blurMaskFilterFlags_as_quality(flags); SkAutoTUnref<SkMaskFilter> mf(SkBlurMaskFilter::Create(style, sigma, flags)); - if (NULL == mf.get()) { + if (nullptr == mf.get()) { REPORTER_ASSERT(reporter, sigma <= 0); } else { REPORTER_ASSERT(reporter, sigma > 0); diff --git a/tests/CTest.cpp b/tests/CTest.cpp index 4cc8cd6666..f6ff4f0551 100644 --- a/tests/CTest.cpp +++ b/tests/CTest.cpp @@ -16,7 +16,7 @@ static void shader_test(skiatest::Reporter* reporter) { sk_imageinfo_t info = {64, 64, sk_colortype_get_default_8888(), PREMUL_SK_ALPHATYPE}; - sk_surface_t* surface = sk_surface_new_raster(&info, NULL); + sk_surface_t* surface = sk_surface_new_raster(&info, nullptr); sk_canvas_t* canvas = sk_surface_get_canvas(surface); sk_paint_t* paint = sk_paint_new(); @@ -30,21 +30,21 @@ static void shader_test(skiatest::Reporter* reporter) { sk_shader_t* shader; shader = sk_shader_new_radial_gradient( - &point, 1.0f, colors, NULL, 2, tilemode, NULL); - REPORTER_ASSERT(reporter, shader != NULL); + &point, 1.0f, colors, nullptr, 2, tilemode, nullptr); + REPORTER_ASSERT(reporter, shader != nullptr); sk_paint_set_shader(paint, shader); sk_shader_unref(shader); sk_canvas_draw_paint(canvas, paint); - shader = sk_shader_new_sweep_gradient(&point, colors, NULL, 2, NULL); - REPORTER_ASSERT(reporter, shader != NULL); + shader = sk_shader_new_sweep_gradient(&point, colors, nullptr, 2, nullptr); + REPORTER_ASSERT(reporter, shader != nullptr); sk_paint_set_shader(paint, shader); sk_shader_unref(shader); sk_canvas_draw_paint(canvas, paint); shader = sk_shader_new_two_point_conical_gradient( - &point, 10.0f, &point2, 50.0f, colors, NULL, 2, tilemode, NULL); - REPORTER_ASSERT(reporter, shader != NULL); + &point, 10.0f, &point2, 50.0f, colors, nullptr, 2, tilemode, nullptr); + REPORTER_ASSERT(reporter, shader != nullptr); sk_paint_set_shader(paint, shader); sk_shader_unref(shader); sk_canvas_draw_paint(canvas, paint); diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp index e3ceeaf152..c3fc9a47bf 100644 --- a/tests/CachedDataTest.cpp +++ b/tests/CachedDataTest.cpp @@ -78,14 +78,14 @@ DEF_TEST(CachedData, reporter) { const size_t size = 100; // test with client as last owner - SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.get() : NULL); + SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.get() : nullptr); check_data(reporter, data, 2, kInCache, kLocked); data->detachFromCacheAndUnref(); check_data(reporter, data, 1, kNotInCache, kLocked); data->unref(); // test with cache as last owner - data = test_locking(reporter, size, useDiscardable ? pool.get() : NULL); + data = test_locking(reporter, size, useDiscardable ? pool.get() : nullptr); check_data(reporter, data, 2, kInCache, kLocked); data->unref(); check_data(reporter, data, 1, kInCache, kUnlocked); diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp index 721c0908f8..b58880b10d 100644 --- a/tests/CachedDecodingPixelRefTest.cpp +++ b/tests/CachedDecodingPixelRefTest.cpp @@ -44,7 +44,7 @@ static SkData* create_data_from_bitmap(const SkBitmap& bm, if (SkImageEncoder::EncodeStream(&stream, bm, type, 100)) { return stream.copyToData(); } - return NULL; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// @@ -108,8 +108,8 @@ static void test_three_encodings(skiatest::Reporter* reporter, for (size_t i = 0; i < SK_ARRAY_COUNT(types); i++) { SkImageEncoder::Type type = types[i]; SkAutoDataUnref encoded(create_data_from_bitmap(original, type)); - REPORTER_ASSERT(reporter, encoded.get() != NULL); - if (NULL == encoded.get()) { + REPORTER_ASSERT(reporter, encoded.get() != nullptr); + if (nullptr == encoded.get()) { continue; } SkBitmap lazy; @@ -118,20 +118,20 @@ static void test_three_encodings(skiatest::Reporter* reporter, if (!installSuccess) { continue; } - REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); + REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); { SkAutoLockPixels autoLockPixels(lazy); // now pixels are good. REPORTER_ASSERT(reporter, lazy.getPixels()); - if (NULL == lazy.getPixels()) { + if (nullptr == lazy.getPixels()) { continue; } } // pixels should be gone! - REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); + REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); { SkAutoLockPixels autoLockPixels(lazy); // now pixels are good. REPORTER_ASSERT(reporter, lazy.getPixels()); - if (NULL == lazy.getPixels()) { + if (nullptr == lazy.getPixels()) { continue; } } @@ -184,7 +184,7 @@ protected: bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) override { - REPORTER_ASSERT(fReporter, pixels != NULL); + REPORTER_ASSERT(fReporter, pixels != nullptr); REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes()); if (fType != kSucceedGetPixels_TestType) { return false; @@ -214,7 +214,7 @@ static void check_test_image_generator_bitmap(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, TestImageGenerator::Height() == bm.height()); SkAutoLockPixels autoLockPixels(bm); REPORTER_ASSERT(reporter, bm.getPixels()); - if (NULL == bm.getPixels()) { + if (nullptr == bm.getPixels()) { return; } int errors = 0; @@ -240,21 +240,21 @@ static void check_pixelref(TestImageGenerator::TestType type, SkDiscardableMemory::Factory* factory) { SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType)); SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter)); - REPORTER_ASSERT(reporter, gen.get() != NULL); + REPORTER_ASSERT(reporter, gen.get() != nullptr); SkBitmap lazy; bool success; if (kSkCaching_PixelRefType == pixelRefType) { // Ignore factory; use global cache. success = SkCachingPixelRef::Install(gen.detach(), &lazy); } else { - success = SkInstallDiscardablePixelRef(gen.detach(), NULL, &lazy, factory); + success = SkInstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory); } REPORTER_ASSERT(reporter, success); if (TestImageGenerator::kSucceedGetPixels_TestType == type) { check_test_image_generator_bitmap(reporter, lazy); } else if (TestImageGenerator::kFailGetPixels_TestType == type) { SkAutoLockPixels autoLockPixels(lazy); - REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); + REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); } } @@ -278,17 +278,17 @@ DEF_TEST(DiscardableAndCachingPixelRef, reporter) { test_newlockdelete(reporter); check_pixelref(TestImageGenerator::kFailGetPixels_TestType, - reporter, kSkCaching_PixelRefType, NULL); + reporter, kSkCaching_PixelRefType, nullptr); check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, - reporter, kSkCaching_PixelRefType, NULL); + reporter, kSkCaching_PixelRefType, nullptr); check_pixelref(TestImageGenerator::kFailGetPixels_TestType, - reporter, kSkDiscardable_PixelRefType, NULL); + reporter, kSkDiscardable_PixelRefType, nullptr); check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, - reporter, kSkDiscardable_PixelRefType, NULL); + reporter, kSkDiscardable_PixelRefType, nullptr); SkAutoTUnref<SkDiscardableMemoryPool> pool( - SkDiscardableMemoryPool::Create(1, NULL)); + SkDiscardableMemoryPool::Create(1, nullptr)); REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); check_pixelref(TestImageGenerator::kFailGetPixels_TestType, reporter, kSkDiscardable_PixelRefType, pool); @@ -298,7 +298,7 @@ DEF_TEST(DiscardableAndCachingPixelRef, reporter) { REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool(); - // Only acts differently from NULL on a platform that has a + // Only acts differently from nullptr on a platform that has a // default discardable memory implementation that differs from the // global DM pool. check_pixelref(TestImageGenerator::kFailGetPixels_TestType, @@ -318,7 +318,7 @@ DEF_TEST(Image_NewFromGenerator, r) { TestImageGenerator::TestType test = testTypes[i]; SkImageGenerator* gen = new TestImageGenerator(test, r); SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen)); - if (NULL == image.get()) { + if (nullptr == image.get()) { ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed [" SK_SIZE_T_SPECIFIER "]", i); continue; @@ -332,7 +332,7 @@ DEF_TEST(Image_NewFromGenerator, r) { SkCanvas canvas(bitmap); const SkColor kDefaultColor = 0xffabcdef; canvas.clear(kDefaultColor); - canvas.drawImage(image, 0, 0, NULL); + canvas.drawImage(image, 0, 0, nullptr); if (TestImageGenerator::kSucceedGetPixels_TestType == test) { REPORTER_ASSERT( r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp index 8b6aa258c2..b5543a1523 100644 --- a/tests/CanvasStateTest.cpp +++ b/tests/CanvasStateTest.cpp @@ -37,9 +37,9 @@ public: OpenLibResult(skiatest::Reporter* reporter) { if (FLAGS_library.count() == 1) { fHandle = dlopen(FLAGS_library[0], RTLD_LAZY | RTLD_LOCAL); - REPORTER_ASSERT_MESSAGE(reporter, fHandle != NULL, "Failed to open library!"); + REPORTER_ASSERT_MESSAGE(reporter, fHandle != nullptr, "Failed to open library!"); } else { - fHandle = NULL; + fHandle = nullptr; } } @@ -81,7 +81,7 @@ DEF_TEST(CanvasState_test_complex_layers, reporter) { float r, float b, int32_t s); OpenLibResult openLibResult(reporter); - if (openLibResult.handle() != NULL) { + if (openLibResult.handle() != nullptr) { *(void**) (&drawFn) = dlsym(openLibResult.handle(), "complex_layers_draw_from_canvas_state"); } else { @@ -183,7 +183,7 @@ DEF_TEST(CanvasState_test_complex_clips, reporter) { int32_t regionRects, int32_t* rectCoords); OpenLibResult openLibResult(reporter); - if (openLibResult.handle() != NULL) { + if (openLibResult.handle() != nullptr) { *(void**) (&drawFn) = dlsym(openLibResult.handle(), "complex_clips_draw_from_canvas_state"); } else { @@ -271,7 +271,7 @@ DEF_TEST(CanvasState_test_draw_filters, reporter) { REPORTER_ASSERT(reporter, tmpCanvas); REPORTER_ASSERT(reporter, canvas.getDrawFilter()); - REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter()); + REPORTER_ASSERT(reporter, nullptr == tmpCanvas->getDrawFilter()); tmpCanvas->unref(); SkCanvasStateUtils::ReleaseCanvasState(state); @@ -292,7 +292,7 @@ DEF_TEST(CanvasState_test_soft_clips, reporter) { canvas.clipRRect(roundRect, SkRegion::kIntersect_Op, true); - SkSetErrorCallback(error_callback, NULL); + SkSetErrorCallback(error_callback, nullptr); SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); REPORTER_ASSERT(reporter, !state); @@ -318,7 +318,7 @@ DEF_TEST(CanvasState_test_saveLayer_clip, reporter) { // Check that saveLayer without the kClipToLayer_SaveFlag leaves the // clip stack unchanged. - canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_NoClipLayer_SaveFlag); + canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_NoClipLayer_SaveFlag); SkRect clipStackBounds; SkClipStack::BoundsType boundsType; canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); @@ -328,7 +328,7 @@ DEF_TEST(CanvasState_test_saveLayer_clip, reporter) { // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip // stack to the layer bounds. - canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_ClipLayer_SaveFlag); canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index f7976356e0..2ec25e4bab 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -215,7 +215,7 @@ static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { static void test_clipstack(skiatest::Reporter* reporter) { // The clipstack is refcounted, and needs to be able to out-live the canvas if a client has // ref'd it. - const SkClipStack* cs = NULL; + const SkClipStack* cs = nullptr; { SkCanvas canvas(10, 10); cs = SkRef(canvas.getClipStack()); @@ -356,7 +356,7 @@ TEST_STEP(SaveMatrixClip, SaveMatrixClipStep); static void SaveLayerStep(SkCanvas* canvas, const TestData& d, skiatest::Reporter* reporter, CanvasTestStep* testStep) { int saveCount = canvas->getSaveCount(); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); canvas->restore(); REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, testStep->assertMessage()); @@ -366,7 +366,7 @@ TEST_STEP(SaveLayer, SaveLayerStep); static void BoundedSaveLayerStep(SkCanvas* canvas, const TestData& d, skiatest::Reporter* reporter, CanvasTestStep* testStep) { int saveCount = canvas->getSaveCount(); - canvas->saveLayer(&d.fRect, NULL); + canvas->saveLayer(&d.fRect, nullptr); canvas->restore(); REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, testStep->assertMessage()); @@ -376,7 +376,7 @@ TEST_STEP(BoundedSaveLayer, BoundedSaveLayerStep); static void PaintSaveLayerStep(SkCanvas* canvas, const TestData& d, skiatest::Reporter* reporter, CanvasTestStep* testStep) { int saveCount = canvas->getSaveCount(); - canvas->saveLayer(NULL, &d.fPaint); + canvas->saveLayer(nullptr, &d.fPaint); canvas->restore(); REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, testStep->assertMessage()); @@ -418,7 +418,7 @@ static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); paint.setShader(shader)->unref(); canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, - NULL, NULL, NULL, 0, paint); + nullptr, nullptr, nullptr, 0, paint); } // NYI: issue 240. TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); @@ -427,7 +427,7 @@ static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, skiatest::Reporter*, CanvasTestStep*) { SkPictureRecorder recorder; SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIntToScalar(d.fHeight), - NULL, 0); + nullptr, 0); testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); testCanvas->clipRect(d.fRect); testCanvas->drawRect(d.fRect, d.fPaint); @@ -658,15 +658,15 @@ static void test_newraster(skiatest::Reporter* reporter) { // now try a deliberately bad info info = info.makeWH(-1, info.height()); - REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); + REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); // too big info = info.makeWH(1 << 30, 1 << 30); - REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); + REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); // not a valid pixel type info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType()); - REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); + REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes)); // We should succeed with a zero-sized valid info info = SkImageInfo::MakeN32Premul(0, 0); @@ -696,7 +696,7 @@ DEF_TEST(Canvas_SaveState, reporter) { REPORTER_ASSERT(reporter, 1 == n); REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); - n = canvas.saveLayer(NULL, NULL); + n = canvas.saveLayer(nullptr, nullptr); REPORTER_ASSERT(reporter, 2 == n); REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); diff --git a/tests/ChecksumTest.cpp b/tests/ChecksumTest.cpp index 3658bd771e..0302ea9886 100644 --- a/tests/ChecksumTest.cpp +++ b/tests/ChecksumTest.cpp @@ -32,8 +32,8 @@ DEF_TEST(Checksum, r) { for (size_t i = 0; i < SK_ARRAY_COUNT(kAlgorithms); ++i) { const algorithmProc algorithm = kAlgorithms[i]; - // Hash of NULL is always 0. - ASSERT(algorithm(NULL, 0) == 0); + // Hash of nullptr is always 0. + ASSERT(algorithm(nullptr, 0) == 0); const uint32_t hash = algorithm(data, kBytes); // Should be deterministic. diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp index c0ff7632c7..c57fb37850 100644 --- a/tests/ClipCacheTest.cpp +++ b/tests/ClipCacheTest.cpp @@ -33,7 +33,7 @@ static GrTexture* create_texture(GrContext* context) { // We are initializing the texture with zeros here GrTexture* texture = context->textureProvider()->createTexture(desc, false, textureData, 0); if (!texture) { - return NULL; + return nullptr; } return texture; @@ -52,7 +52,7 @@ static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { desc.fWidth = kXSize; desc.fHeight = kYSize; - GrTexture* texture = context->textureProvider()->createTexture(desc, false, NULL, 0); + GrTexture* texture = context->textureProvider()->createTexture(desc, false, nullptr, 0); if (!texture) { return; } @@ -117,7 +117,7 @@ static void check_state(skiatest::Reporter* reporter, static void check_empty_state(skiatest::Reporter* reporter, const GrClipMaskCache& cache) { REPORTER_ASSERT(reporter, SkClipStack::kInvalidGenID == cache.getLastClipGenID()); - REPORTER_ASSERT(reporter, NULL == cache.getLastMask()); + REPORTER_ASSERT(reporter, nullptr == cache.getLastMask()); SkIRect emptyBound; emptyBound.setEmpty(); @@ -156,7 +156,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) { GrTexture* texture1 = cache.getLastMask(); REPORTER_ASSERT(reporter, texture1); - if (NULL == texture1) { + if (nullptr == texture1) { return; } @@ -179,7 +179,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) { GrTexture* texture2 = cache.getLastMask(); REPORTER_ASSERT(reporter, texture2); - if (NULL == texture2) { + if (nullptr == texture2) { return; } @@ -219,7 +219,7 @@ DEF_GPUTEST(ClipCache, reporter, factory) { continue; } GrContext* context = factory->get(glType); - if (NULL == context) { + if (nullptr == context) { continue; } diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 662e68040e..a18d1efe06 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -144,7 +144,7 @@ static void test_iterators(skiatest::Reporter* reporter) { // bottom to top iteration { - const SkClipStack::Element* element = NULL; + const SkClipStack::Element* element = nullptr; SkClipStack::B2TIter iter(stack); int i; @@ -159,7 +159,7 @@ static void test_iterators(skiatest::Reporter* reporter) { // top to bottom iteration { - const SkClipStack::Element* element = NULL; + const SkClipStack::Element* element = nullptr; SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); int i; @@ -174,7 +174,7 @@ static void test_iterators(skiatest::Reporter* reporter) { // skipToTopmost { - const SkClipStack::Element* element = NULL; + const SkClipStack::Element* element = nullptr; SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); @@ -383,7 +383,7 @@ static int count(const SkClipStack& stack) { SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); - const SkClipStack::Element* element = NULL; + const SkClipStack::Element* element = nullptr; int count = 0; for (element = iter.prev(); element; element = iter.prev(), ++count) { @@ -964,7 +964,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { int32_t reducedGenID; GrReducedClip::InitialState initial; SkIRect tBounds(inflatedIBounds); - SkIRect* tightBounds = r.nextBool() ? &tBounds : NULL; + SkIRect* tightBounds = r.nextBool() ? &tBounds : nullptr; GrReducedClip::ReduceClipStack(stack, inflatedIBounds, &reducedClips, @@ -1129,7 +1129,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { &reducedClips, &reducedGenID, &initial, - testCases[i].tighterBounds.isEmpty() ? NULL : &tightBounds); + testCases[i].tighterBounds.isEmpty() ? nullptr : &tightBounds); REPORTER_ASSERT(reporter, reducedClips.count() == testCases[i].reducedClipCount); SkASSERT(reducedClips.count() == testCases[i].reducedClipCount); diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp index ec6d645196..81d8eb42b5 100644 --- a/tests/CodexTest.cpp +++ b/tests/CodexTest.cpp @@ -46,7 +46,7 @@ static void compare_to_good_digest(skiatest::Reporter* r, const SkMD5::Digest& g /** * Test decoding an SkCodec to a particular SkImageInfo. * - * Calling getPixels(info) should return expectedResult, and if goodDigest is non NULL, + * Calling getPixels(info) should return expectedResult, and if goodDigest is non nullptr, * the resulting decode should match. */ static void test_info(skiatest::Reporter* r, SkCodec* codec, const SkImageInfo& info, @@ -104,14 +104,14 @@ static void check(skiatest::Reporter* r, SkImageInfo info565 = info.makeColorType(kRGB_565_SkColorType); SkCodec::Result expected = (supports565 && info.alphaType() == kOpaque_SkAlphaType) ? SkCodec::kSuccess : SkCodec::kInvalidConversion; - test_info(r, codec, info565, expected, NULL); + test_info(r, codec, info565, expected, nullptr); } SkBitmap bm; bm.allocPixels(info); SkAutoLockPixels autoLockPixels(bm); SkCodec::Result result = - codec->getPixels(info, bm.getPixels(), bm.rowBytes(), NULL, NULL, NULL); + codec->getPixels(info, bm.getPixels(), bm.rowBytes(), nullptr, nullptr, nullptr); REPORTER_ASSERT(r, result == SkCodec::kSuccess); SkMD5::Digest digest; @@ -124,13 +124,13 @@ static void check(skiatest::Reporter* r, // Check alpha type conversions if (info.alphaType() == kOpaque_SkAlphaType) { test_info(r, codec, info.makeAlphaType(kUnpremul_SkAlphaType), - SkCodec::kInvalidConversion, NULL); + SkCodec::kInvalidConversion, nullptr); test_info(r, codec, info.makeAlphaType(kPremul_SkAlphaType), - SkCodec::kInvalidConversion, NULL); + SkCodec::kInvalidConversion, nullptr); } else { // Decoding to opaque should fail test_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType), - SkCodec::kInvalidConversion, NULL); + SkCodec::kInvalidConversion, nullptr); SkAlphaType otherAt = info.alphaType(); if (kPremul_SkAlphaType == otherAt) { otherAt = kUnpremul_SkAlphaType; @@ -138,7 +138,7 @@ static void check(skiatest::Reporter* r, otherAt = kPremul_SkAlphaType; } // The other non-opaque alpha type should always succeed, but not match. - test_info(r, codec, info.makeAlphaType(otherAt), SkCodec::kSuccess, NULL); + test_info(r, codec, info.makeAlphaType(otherAt), SkCodec::kSuccess, nullptr); } } @@ -185,7 +185,7 @@ static void check(skiatest::Reporter* r, SkBitmap bm; bm.allocPixels(subsetInfo); const SkCodec::Result result = codec->getPixels(bm.info(), bm.getPixels(), bm.rowBytes(), - &opts, NULL, NULL); + &opts, nullptr, nullptr); if (supportsSubsetDecoding) { REPORTER_ASSERT(r, result == SkCodec::kSuccess); @@ -302,7 +302,7 @@ static void test_dimensions(skiatest::Reporter* r, const char path[]) { SkAutoTMalloc<SkPMColor> pixels(totalBytes); SkCodec::Result result = - codec->getPixels(scaledInfo, pixels.get(), rowBytes, NULL, NULL, NULL); + codec->getPixels(scaledInfo, pixels.get(), rowBytes, nullptr, nullptr, nullptr); REPORTER_ASSERT(r, SkCodec::kSuccess == result); } } @@ -339,7 +339,7 @@ static void test_invalid(skiatest::Reporter* r, const char path[]) { return; } SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); - REPORTER_ASSERT(r, NULL == codec); + REPORTER_ASSERT(r, nullptr == codec); } DEF_TEST(Codec_Empty, r) { @@ -371,7 +371,7 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) { SkPMColor colorStorage[256]; int colorCount; SkCodec::Result result = decoder->start( - decoder->getInfo().makeColorType(kIndex_8_SkColorType), NULL, colorStorage, &colorCount); + decoder->getInfo().makeColorType(kIndex_8_SkColorType), nullptr, colorStorage, &colorCount); REPORTER_ASSERT(r, SkCodec::kSuccess == result); // The rest of the test is uninteresting if kIndex8 is not supported if (SkCodec::kSuccess != result) { @@ -381,7 +381,7 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) { // This should return kInvalidParameters because, in kIndex_8 mode, we must pass in a valid // colorPtr and a valid colorCountPtr. result = decoder->start( - decoder->getInfo().makeColorType(kIndex_8_SkColorType), NULL, NULL, NULL); + decoder->getInfo().makeColorType(kIndex_8_SkColorType), nullptr, nullptr, nullptr); REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); result = decoder->start( decoder->getInfo().makeColorType(kIndex_8_SkColorType)); diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp index d0b0d77ed4..ee8f12b2fb 100644 --- a/tests/ColorFilterTest.cpp +++ b/tests/ColorFilterTest.cpp @@ -42,12 +42,12 @@ static void test_composecolorfilter_limit(skiatest::Reporter* reporter) { for (int i = 2; i < way_too_many; ++i) { SkAutoTUnref<SkColorFilter> filter(make_filter()); parent.reset(SkColorFilter::CreateComposeFilter(parent, filter)); - if (NULL == parent) { + if (nullptr == parent) { REPORTER_ASSERT(reporter, i > 2); // we need to have succeeded at least once! return; } } - REPORTER_ASSERT(reporter, false); // we never saw a NULL :( + REPORTER_ASSERT(reporter, false); // we never saw a nullptr :( } #define ILLEGAL_MODE ((SkXfermode::Mode)-1) @@ -59,14 +59,14 @@ DEF_TEST(ColorFilter, reporter) { SkColor color = rand.nextU(); // ensure we always get a filter, by avoiding the possibility of a - // special case that would return NULL (if color's alpha is 0 or 0xFF) + // special case that would return nullptr (if color's alpha is 0 or 0xFF) color = SkColorSetA(color, 0x7F); SkColorFilter* cf = SkColorFilter::CreateModeFilter(color, (SkXfermode::Mode)mode); // allow for no filter if we're in Dst mode (its a no op) - if (SkXfermode::kDst_Mode == mode && NULL == cf) { + if (SkXfermode::kDst_Mode == mode && nullptr == cf) { continue; } diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp index 228aee9031..d7c3d1d8d4 100644 --- a/tests/DashPathEffectTest.cpp +++ b/tests/DashPathEffectTest.cpp @@ -19,8 +19,8 @@ DEF_TEST(DashPathEffectTest_crbug_348821, r) { SkScalar phase = SK_ScalarInfinity; // Used to force the bad fInitialDashLength = -1 path. SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, count, phase)); - // NULL -> refuses to work with flattening framework. - REPORTER_ASSERT(r, dash->getFactory() != NULL); + // nullptr -> refuses to work with flattening framework. + REPORTER_ASSERT(r, dash->getFactory() != nullptr); SkWriteBuffer buffer; buffer.writeFlattenable(dash); diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index 58600ef3ee..177c9d37d5 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -33,10 +33,10 @@ static void test_datatable_is_empty(skiatest::Reporter* reporter, static void test_emptytable(skiatest::Reporter* reporter) { SkAutoTUnref<SkDataTable> table0(SkDataTable::NewEmpty()); - SkAutoTUnref<SkDataTable> table1(SkDataTable::NewCopyArrays(NULL, NULL, 0)); - SkAutoTUnref<SkDataTable> table2(SkDataTable::NewCopyArray(NULL, 0, 0)); - SkAutoTUnref<SkDataTable> table3(SkDataTable::NewArrayProc(NULL, 0, 0, - NULL, NULL)); + SkAutoTUnref<SkDataTable> table1(SkDataTable::NewCopyArrays(nullptr, nullptr, 0)); + SkAutoTUnref<SkDataTable> table2(SkDataTable::NewCopyArray(nullptr, 0, 0)); + SkAutoTUnref<SkDataTable> table3(SkDataTable::NewArrayProc(nullptr, 0, 0, + nullptr, nullptr)); test_datatable_is_empty(reporter, table0); test_datatable_is_empty(reporter, table1); @@ -122,7 +122,7 @@ static void test_globaltable(skiatest::Reporter* reporter) { int count = SK_ARRAY_COUNT(gData); SkAutoTUnref<SkDataTable> table(SkDataTable::NewArrayProc(gData, - sizeof(gData[0]), count, NULL, NULL)); + sizeof(gData[0]), count, nullptr, nullptr)); REPORTER_ASSERT(reporter, table->count() == count); for (int i = 0; i < count; ++i) { @@ -168,7 +168,7 @@ static void test_cstring(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, r0->equals(r1)); - SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL)); + SkAutoTUnref<SkData> r2(SkData::NewWithCString(nullptr)); REPORTER_ASSERT(reporter, 1 == r2->size()); REPORTER_ASSERT(reporter, 0 == *r2->bytes()); } @@ -193,13 +193,13 @@ static void test_files(skiatest::Reporter* reporter) { SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag); SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file)); - REPORTER_ASSERT(reporter, r1.get() != NULL); + REPORTER_ASSERT(reporter, r1.get() != nullptr); REPORTER_ASSERT(reporter, r1->size() == 26); REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0); int fd = sk_fileno(file); SkAutoTUnref<SkData> r2(SkData::NewFromFD(fd)); - REPORTER_ASSERT(reporter, r2.get() != NULL); + REPORTER_ASSERT(reporter, r2.get() != nullptr); REPORTER_ASSERT(reporter, r2->size() == 26); REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0); } diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp index 04b1f4010e..b41262f738 100644 --- a/tests/DequeTest.cpp +++ b/tests/DequeTest.cpp @@ -13,8 +13,8 @@ static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int c REPORTER_ASSERT(reporter, deq.empty()); REPORTER_ASSERT(reporter, 0 == deq.count()); REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize()); - REPORTER_ASSERT(reporter, NULL == deq.front()); - REPORTER_ASSERT(reporter, NULL == deq.back()); + REPORTER_ASSERT(reporter, nullptr == deq.front()); + REPORTER_ASSERT(reporter, nullptr == deq.back()); } else { REPORTER_ASSERT(reporter, !deq.empty()); REPORTER_ASSERT(reporter, count == deq.count()); diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp index e0145bc5ab..cabd14b6ea 100644 --- a/tests/DiscardableMemoryPoolTest.cpp +++ b/tests/DiscardableMemoryPoolTest.cpp @@ -10,12 +10,12 @@ DEF_TEST(DiscardableMemoryPool, reporter) { SkAutoTUnref<SkDiscardableMemoryPool> pool( - SkDiscardableMemoryPool::Create(1, NULL)); + SkDiscardableMemoryPool::Create(1, nullptr)); pool->setRAMBudget(3); REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); SkAutoTDelete<SkDiscardableMemory> dm1(pool->create(100)); - REPORTER_ASSERT(reporter, dm1->data() != NULL); + REPORTER_ASSERT(reporter, dm1->data() != nullptr); REPORTER_ASSERT(reporter, 100 == pool->getRAMUsed()); dm1->unlock(); REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); diff --git a/tests/DiscardableMemoryTest.cpp b/tests/DiscardableMemoryTest.cpp index da36ffd8b0..28dd6e98a5 100644 --- a/tests/DiscardableMemoryTest.cpp +++ b/tests/DiscardableMemoryTest.cpp @@ -13,12 +13,12 @@ DEF_TEST(DiscardableMemory, reporter) { const char testString[] = "HELLO, WORLD!"; const size_t len = sizeof(testString); SkAutoTDelete<SkDiscardableMemory> dm(SkDiscardableMemory::Create(len)); - REPORTER_ASSERT(reporter, dm.get() != NULL); - if (NULL == dm.get()) { + REPORTER_ASSERT(reporter, dm.get() != nullptr); + if (nullptr == dm.get()) { return; } void* ptr = dm->data(); - REPORTER_ASSERT(reporter, ptr != NULL); + REPORTER_ASSERT(reporter, ptr != nullptr); memcpy(ptr, testString, sizeof(testString)); dm->unlock(); bool success = dm->lock(); diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 0b0c87c88e..8836a7bd5c 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -32,9 +32,9 @@ protected: static void test_faulty_pixelref(skiatest::Reporter* reporter) { // need a cache, but don't expect to use it, so the budget is not critical SkAutoTUnref<SkDiscardableMemoryPool> pool( - SkDiscardableMemoryPool::Create(10 * 1000, NULL)); + SkDiscardableMemoryPool::Create(10 * 1000, nullptr)); SkBitmap bm; - bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, NULL, &bm, pool); + bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, nullptr, &bm, pool); REPORTER_ASSERT(reporter, success); // now our bitmap has a pixelref, but we know it will fail to lock @@ -300,7 +300,7 @@ DEF_TEST(DrawBitmapRect, reporter) { SkIRect srcR = { gWidth, 0, gWidth + 16, 16 }; SkRect dstR = { 0, 0, SkIntToScalar(16), SkIntToScalar(16) }; - canvas.drawBitmapRect(src, srcR, dstR, NULL); + canvas.drawBitmapRect(src, srcR, dstR, nullptr); // ensure that we draw nothing if srcR does not intersect the bitmap REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp index de4672dd67..6381a3c8fa 100644 --- a/tests/DrawFilterTest.cpp +++ b/tests/DrawFilterTest.cpp @@ -30,14 +30,14 @@ static void test_saverestore(skiatest::Reporter* reporter) { SkAutoTUnref<TestFilter> df(new TestFilter); - REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter()); + REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter()); canvas->save(); canvas->setDrawFilter(df); - REPORTER_ASSERT(reporter, NULL != canvas->getDrawFilter()); + REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter()); canvas->restore(); - REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter()); + REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter()); } DEF_TEST(DrawFilter, reporter) { diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp index 67af75568a..4351faf70e 100644 --- a/tests/DrawPathTest.cpp +++ b/tests/DrawPathTest.cpp @@ -269,7 +269,7 @@ static void test_crbug_165432(skiatest::Reporter* reporter) { SkPath filteredPath; SkStrokeRec rec(paint); - REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, NULL)); + REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullptr)); REPORTER_ASSERT(reporter, filteredPath.isEmpty()); } diff --git a/tests/DynamicHashTest.cpp b/tests/DynamicHashTest.cpp index 4a5bb850f8..289b332c02 100644 --- a/tests/DynamicHashTest.cpp +++ b/tests/DynamicHashTest.cpp @@ -100,14 +100,14 @@ DEF_TEST(DynamicHash_lookup, reporter) { ASSERT(hash.countCollisions(9) == 2); // We can find our data right? - ASSERT(hash.find(1) != NULL); + ASSERT(hash.find(1) != nullptr); ASSERT(hash.find(1)->value == 2.0); - ASSERT(hash.find(5) != NULL); + ASSERT(hash.find(5) != nullptr); ASSERT(hash.find(5)->value == 3.0); // These aren't in the hash. - ASSERT(hash.find(2) == NULL); - ASSERT(hash.find(9) == NULL); + ASSERT(hash.find(2) == nullptr); + ASSERT(hash.find(9) == nullptr); } DEF_TEST(DynamicHash_remove, reporter) { @@ -123,16 +123,16 @@ DEF_TEST(DynamicHash_remove, reporter) { hash.remove(1); // a should be marked deleted, and b should still be findable. - ASSERT(hash.find(1) == NULL); - ASSERT(hash.find(5) != NULL); + ASSERT(hash.find(1) == nullptr); + ASSERT(hash.find(5) != nullptr); ASSERT(hash.find(5)->value == 3.0); // This will go in the same slot as 'a' did before. ASSERT(hash.countCollisions(9) == 0); hash.add(&c); - ASSERT(hash.find(9) != NULL); + ASSERT(hash.find(9) != nullptr); ASSERT(hash.find(9)->value == 4.0); - ASSERT(hash.find(5) != NULL); + ASSERT(hash.find(5) != nullptr); ASSERT(hash.find(5)->value == 3.0); } @@ -161,7 +161,7 @@ template<typename T> static void TestIter(skiatest::Reporter* reporter) { for (T iter(&hash); !iter.done(); ++iter) { int key = (*iter).key; keys[count] = key; - ASSERT(hash.find(key) != NULL); + ASSERT(hash.find(key) != nullptr); ++count; } ASSERT(3 == count); @@ -177,7 +177,7 @@ template<typename T> static void TestIter(skiatest::Reporter* reporter) { int key = (*iter).key; keys[count] = key; ASSERT(key != 1); - ASSERT(hash.find(key) != NULL); + ASSERT(hash.find(key) != nullptr); ++count; } ASSERT(2 == count); @@ -215,8 +215,8 @@ static void TestResetOrRewind(skiatest::Reporter* reporter, bool testReset) { ASSERT(hash.count() == 2); ASSERT(hash.capacity() == 4); - ASSERT(hash.find(1) != NULL); - ASSERT(hash.find(2) != NULL); + ASSERT(hash.find(1) != nullptr); + ASSERT(hash.find(2) != nullptr); } DEF_TEST(DynamicHash_reset, reporter) { diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp index 1adc7442af..c5103c813f 100644 --- a/tests/FloatingPointTextureTest.cpp +++ b/tests/FloatingPointTextureTest.cpp @@ -55,14 +55,14 @@ void runFPTest(skiatest::Reporter* reporter, GrContextFactory* factory, continue; } GrContext* context = factory->get(type); - if (NULL == context) { + if (nullptr == context) { continue; } SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture( desc, false, controlPixelData.begin(), 0)); // Floating point textures are NOT supported everywhere - if (NULL == fpTexture) { + if (nullptr == fpTexture) { continue; } fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0); diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp index 7ac3da363a..7843a412a1 100644 --- a/tests/FontHostStreamTest.cpp +++ b/tests/FontHostStreamTest.cpp @@ -91,7 +91,7 @@ DEF_TEST(FontHostStream, reporter) { SkTypeface* origTypeface = paint.getTypeface(); SkAutoTUnref<SkTypeface> aur; - if (NULL == origTypeface) { + if (nullptr == origTypeface) { origTypeface = aur.reset(SkTypeface::RefDefault()); } diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index db83e06b62..d9a3df414a 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -112,7 +112,7 @@ static void test_charsToGlyphs(skiatest::Reporter* reporter, SkTypeface* face) { } static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream, int ttcIndex) { - int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL); + int n = SkFontStream::GetTableTags(stream, ttcIndex, nullptr); SkAutoTArray<SkFontTableTag> array(n); int n2 = SkFontStream::GetTableTags(stream, ttcIndex, array.get()); @@ -214,7 +214,7 @@ static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) { static void test_tables(skiatest::Reporter* reporter) { static const char* const gNames[] = { - NULL, // default font + nullptr, // default font "Helvetica", "Arial", "Times", "Times New Roman", "Courier", "Courier New", @@ -242,7 +242,7 @@ static void test_tables(skiatest::Reporter* reporter) { */ static void test_advances(skiatest::Reporter* reporter) { static const char* const faces[] = { - NULL, // default font + nullptr, // default font "Arial", "Times", "Times New Roman", "Helvetica", "Courier", "Courier New", "Verdana", "monospace", }; diff --git a/tests/FontMgrAndroidParserTest.cpp b/tests/FontMgrAndroidParserTest.cpp index 5c282ed2a7..a45bc259f4 100644 --- a/tests/FontMgrAndroidParserTest.cpp +++ b/tests/FontMgrAndroidParserTest.cpp @@ -187,7 +187,7 @@ DEF_TEST(FontMgrAndroidParser, reporter) { SkFontMgr_Android_Parser::GetCustomFontFamilies(v22FontFamilies, SkString("/custom/font/path/"), GetResourcePath("android_fonts/v22/fonts.xml").c_str(), - NULL); + nullptr); if (v22FontFamilies.count() > 0) { REPORTER_ASSERT(reporter, v22FontFamilies.count() == 54); diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp index a1dc9dc0b3..56a791a98b 100644 --- a/tests/FontMgrTest.cpp +++ b/tests/FontMgrTest.cpp @@ -14,7 +14,7 @@ #include "SkPaint.h" static void test_font(skiatest::Reporter* reporter) { uint32_t flags = 0; - SkAutoTUnref<SkFont> font(SkFont::Create(NULL, 24, SkFont::kA8_MaskType, flags)); + SkAutoTUnref<SkFont> font(SkFont::Create(nullptr, 24, SkFont::kA8_MaskType, flags)); REPORTER_ASSERT(reporter, font->getTypeface()); REPORTER_ASSERT(reporter, 24 == font->getSize()); @@ -61,7 +61,7 @@ static void test_alias_names(skiatest::Reporter* reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) { SkAutoTUnref<SkTypeface> first(SkTypeface::CreateFromName(inNames[i], SkTypeface::kNormal)); - if (NULL == first.get()) { + if (nullptr == first.get()) { continue; } for (int j = 0; j < 10; ++j) { diff --git a/tests/FontObjTest.cpp b/tests/FontObjTest.cpp index c2d8f5d328..9d18ce6b2e 100644 --- a/tests/FontObjTest.cpp +++ b/tests/FontObjTest.cpp @@ -43,7 +43,7 @@ static void test_cachedfont(skiatest::Reporter* reporter, const SkPaint& paint) static void test_cachedfont(skiatest::Reporter* reporter) { static const char* const faces[] = { - NULL, // default font + nullptr, // default font "Arial", "Times", "Times New Roman", "Helvetica", "Courier", "Courier New", "Verdana", "monospace", }; diff --git a/tests/GLInterfaceValidationTest.cpp b/tests/GLInterfaceValidationTest.cpp index 1448f28fb0..7af34a7fe0 100755 --- a/tests/GLInterfaceValidationTest.cpp +++ b/tests/GLInterfaceValidationTest.cpp @@ -24,7 +24,7 @@ DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { if (GrContextFactory::kNVPR_GLContextType == glCtxType && factory->getGLContext(GrContextFactory::kNative_GLContextType) && !factory->getGLContext(GrContextFactory::kNative_GLContextType)->gl()->hasExtension("GL_NV_path_rendering")) { - REPORTER_ASSERT(reporter, NULL == glCtx); + REPORTER_ASSERT(reporter, nullptr == glCtx); continue; } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index d5251baf75..7f23f93d34 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -127,7 +127,7 @@ static GrRenderTarget* random_render_target(GrTextureProvider* textureProvider, textureProvider->assignUniqueKeyToTexture(key, texture); } } - return texture ? texture->asRenderTarget() : NULL; + return texture ? texture->asRenderTarget() : nullptr; } static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestData* d) { @@ -202,13 +202,13 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) { dummyDesc.fWidth = 34; dummyDesc.fHeight = 18; SkAutoTUnref<GrTexture> dummyTexture1( - context->textureProvider()->createTexture(dummyDesc, false, NULL, 0)); + context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)); dummyDesc.fFlags = kNone_GrSurfaceFlags; dummyDesc.fConfig = kAlpha_8_GrPixelConfig; dummyDesc.fWidth = 16; dummyDesc.fHeight = 22; SkAutoTUnref<GrTexture> dummyTexture2( - context->textureProvider()->createTexture(dummyDesc, false, NULL, 0)); + context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)); if (!dummyTexture1 || ! dummyTexture2) { SkDebugf("Could not allocate dummy textures"); diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp index 5aa80d0b1f..f89914fa74 100644 --- a/tests/GeometryTest.cpp +++ b/tests/GeometryTest.cpp @@ -60,7 +60,7 @@ static void test_evalquadat(skiatest::Reporter* reporter) { check_pairs(reporter, i, t, "quad-pos", r0.fX, r0.fY, r1.fX, r1.fY); SkVector v0; - SkEvalQuadAt(pts, t, NULL, &v0); + SkEvalQuadAt(pts, t, nullptr, &v0); SkVector v1 = SkEvalQuadTangentAt(pts, t); check_pairs(reporter, i, t, "quad-tan", v0.fX, v0.fY, v1.fX, v1.fY); @@ -71,14 +71,14 @@ static void test_evalquadat(skiatest::Reporter* reporter) { static void test_conic_eval_pos(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) { SkPoint p0, p1; - conic.evalAt(t, &p0, NULL); + conic.evalAt(t, &p0, nullptr); p1 = conic.evalAt(t); check_pairs(reporter, 0, t, "conic-pos", p0.fX, p0.fY, p1.fX, p1.fY); } static void test_conic_eval_tan(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) { SkVector v0, v1; - conic.evalAt(t, NULL, &v0); + conic.evalAt(t, nullptr, &v0); v1 = conic.evalTangentAt(t); check_pairs(reporter, 0, t, "conic-tan", v0.fX, v0.fY, v1.fX, v1.fY); } @@ -155,9 +155,9 @@ static void test_cubic_tangents(skiatest::Reporter* reporter) { for (int index = 0; index < count; ++index) { SkConic conic(&pts[index * 3], 0.707f); SkVector start, mid, end; - SkEvalCubicAt(&pts[index * 4], 0, NULL, &start, NULL); - SkEvalCubicAt(&pts[index * 4], .5f, NULL, &mid, NULL); - SkEvalCubicAt(&pts[index * 4], 1, NULL, &end, NULL); + SkEvalCubicAt(&pts[index * 4], 0, nullptr, &start, nullptr); + SkEvalCubicAt(&pts[index * 4], .5f, nullptr, &mid, nullptr); + SkEvalCubicAt(&pts[index * 4], 1, nullptr, &end, nullptr); REPORTER_ASSERT(reporter, start.fX && start.fY); REPORTER_ASSERT(reporter, mid.fX && mid.fY); REPORTER_ASSERT(reporter, end.fX && end.fY); diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp index 0c4cf234bf..5ecc623756 100644 --- a/tests/GpuColorFilterTest.cpp +++ b/tests/GpuColorFilterTest.cpp @@ -121,7 +121,7 @@ DEF_GPUTEST(GpuColorFilter, reporter, factory) { GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type); GrContext* grContext = factory->get(glType); - if (NULL == grContext) { + if (nullptr == grContext) { continue; } diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index b86689fd4e..f23f5ef8dc 100644 --- a/tests/GpuDrawPathTest.cpp +++ b/tests/GpuDrawPathTest.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "SkTypes.h" + #if SK_SUPPORT_GPU #include "GrContext.h" @@ -48,7 +50,7 @@ DEF_GPUTEST(GpuDrawPath, reporter, factory) { GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type); GrContext* grContext = factory->get(glType); - if (NULL == grContext) { + if (nullptr == grContext) { continue; } static const int sampleCounts[] = { 0, 4, 16 }; @@ -58,7 +60,7 @@ DEF_GPUTEST(GpuDrawPath, reporter, factory) { SkAutoTUnref<SkSurface> surface( SkSurface::NewRenderTarget(grContext, SkSurface::kNo_Budgeted, info, - sampleCounts[i], NULL)); + sampleCounts[i], nullptr)); test_drawPathEmpty(reporter, surface->getCanvas()); } } diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index 411a10ba3b..95ac7b641d 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -46,7 +46,7 @@ static void create_layers(skiatest::Reporter* reporter, SkIRect::MakeEmpty(), SkMatrix::I(), indices, 1, - NULL); + nullptr); REPORTER_ASSERT(reporter, layer); GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(), indices, 1); @@ -57,8 +57,8 @@ static void create_layers(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); - REPORTER_ASSERT(reporter, NULL == layer->texture()); - REPORTER_ASSERT(reporter, NULL == layer->paint()); + REPORTER_ASSERT(reporter, nullptr == layer->texture()); + REPORTER_ASSERT(reporter, nullptr == layer->paint()); REPORTER_ASSERT(reporter, !layer->isAtlased()); } } @@ -106,7 +106,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { GrContext* context = factory->get(glCtxType); - if (NULL == context) { + if (nullptr == context) { continue; } @@ -169,7 +169,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { } else { #endif // The final layer should not be atlased. - REPORTER_ASSERT(reporter, NULL == layer->texture()); + REPORTER_ASSERT(reporter, nullptr == layer->texture()); REPORTER_ASSERT(reporter, !layer->isAtlased()); #if GR_CACHE_HOISTED_LAYERS } @@ -207,12 +207,12 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { // The one that was never atlased should still be around REPORTER_ASSERT(reporter, layer); - REPORTER_ASSERT(reporter, NULL == layer->texture()); + REPORTER_ASSERT(reporter, nullptr == layer->texture()); REPORTER_ASSERT(reporter, !layer->isAtlased()); #if GR_CACHE_HOISTED_LAYERS } else { // The one bumped out of the atlas (i.e., 0) should be gone - REPORTER_ASSERT(reporter, NULL == layer); + REPORTER_ASSERT(reporter, nullptr == layer); } #endif } @@ -242,7 +242,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { // but should eliminate the free-floating layers. create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); - picture.reset(NULL); + picture.reset(nullptr); cache.processDeletedPictures(); REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index 1d884acd9c..787f16c983 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "SkTypes.h" + #if SK_SUPPORT_GPU #include "GrContextFactory.h" @@ -16,17 +18,17 @@ DEF_GPUTEST(GrContextFactory, reporter, factory) { // Before we ask for a context, we expect the GL context to not be there. REPORTER_ASSERT(reporter, - NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType)); + nullptr == factory->getGLContext(GrContextFactory::kNull_GLContextType)); // After we ask for a context, we expect that the GL context to be there. factory->get(GrContextFactory::kNull_GLContextType); REPORTER_ASSERT(reporter, - factory->getGLContext(GrContextFactory::kNull_GLContextType) != NULL); + factory->getGLContext(GrContextFactory::kNull_GLContextType) != nullptr); // If we did not ask for a context with the particular GL context, we would // expect the particular GL context to not be there. REPORTER_ASSERT(reporter, - NULL == factory->getGLContext(GrContextFactory::kDebug_GLContextType)); + nullptr == factory->getGLContext(GrContextFactory::kDebug_GLContextType)); } #endif diff --git a/tests/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp index 6f3f31f17b..ce3da8098e 100644 --- a/tests/GrDrawTargetTest.cpp +++ b/tests/GrDrawTargetTest.cpp @@ -27,7 +27,7 @@ DEF_GPUTEST(GrDrawTarget, reporter, factory) { GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type); GrContext* grContext = factory->get(glType); - if (NULL == grContext) { + if (nullptr == grContext) { continue; } diff --git a/tests/GrGLSLPrettyPrintTest.cpp b/tests/GrGLSLPrettyPrintTest.cpp index 827a27b4c5..1a5152fa75 100644 --- a/tests/GrGLSLPrettyPrintTest.cpp +++ b/tests/GrGLSLPrettyPrintTest.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "SkTypes.h" + #if SK_SUPPORT_GPU #include "Test.h" #include "gl/GrGLSLPrettyPrint.h" @@ -117,7 +119,7 @@ DEF_TEST(GrGLSLPrettyPrint, r) { // Just test we don't crash with garbage input ASSERT(GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(), 1, - true).c_str() != NULL); + true).c_str() != nullptr); } #endif diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp index 4f53c1deda..1aecce328c 100644 --- a/tests/GrMemoryPoolTest.cpp +++ b/tests/GrMemoryPoolTest.cpp @@ -51,7 +51,7 @@ public: } static void ResetAllocator() { - gPool.reset(NULL); + gPool.reset(nullptr); } private: @@ -164,7 +164,7 @@ A* A::Create(SkRandom* r) { return new E; default: // suppress warning - return NULL; + return nullptr; } } diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index b40ae7cc94..87b7a2edfa 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -76,10 +76,10 @@ public: const GrProcOptInfo& colorPOI, const GrProcOptInfo& covPOI) { SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode)); SkAutoTUnref<GrXferProcessor> xp( - xpf->createXferProcessor(colorPOI, covPOI, false, NULL, caps)); + xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps)); TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false)); xpf->getInvariantBlendedColor(colorPOI, &fBlendedColor); - fOptFlags = xp->getOptimizations(colorPOI, covPOI, false, NULL, caps); + fOptFlags = xp->getOptimizations(colorPOI, covPOI, false, nullptr, caps); GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType); xp->getBlendInfo(&fBlendInfo); TEST_ASSERT(!xp->willReadDstColor()); @@ -100,8 +100,8 @@ public: static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { GrProcOptInfo colorPOI, covPOI; - colorPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, false); - covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true); + colorPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, false); + covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true); SkASSERT(!colorPOI.isOpaque()); SkASSERT(!colorPOI.isSolidWhite()); @@ -291,9 +291,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { GrProcOptInfo colorPOI, covPOI; - colorPOI.calcWithInitialValues(NULL, 0, GrColorPackRGBA(229, 0, 154, 0), + colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(229, 0, 154, 0), kR_GrColorComponentFlag | kB_GrColorComponentFlag, false); - covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true); + covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true); SkASSERT(!colorPOI.isOpaque()); SkASSERT(!colorPOI.isSolidWhite()); @@ -494,8 +494,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { GrProcOptInfo colorPOI, covPOI; - colorPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kA_GrColorComponentFlag, false); - covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true); + colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kA_GrColorComponentFlag, false); + covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true); SkASSERT(colorPOI.isOpaque()); SkASSERT(!colorPOI.isSolidWhite()); @@ -691,9 +691,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) { GrProcOptInfo colorPOI, covPOI; - colorPOI.calcWithInitialValues(NULL, 0, GrColorPackRGBA(0, 82, 0, 255), + colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(0, 82, 0, 255), kG_GrColorComponentFlag | kA_GrColorComponentFlag, false); - covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true); + covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true); SkASSERT(colorPOI.isOpaque()); SkASSERT(!colorPOI.isSolidWhite()); @@ -916,8 +916,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) } testLCDCoverageBatch; GrProcOptInfo colorPOI, covPOI; - colorPOI.calcColorWithBatch(&testLCDCoverageBatch, NULL, 0); - covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, NULL, 0); + colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0); + covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0); SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); SkASSERT(covPOI.isFourChannelOutput()); @@ -926,7 +926,7 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false)); SkAutoTUnref<GrXferProcessor> xp( - xpf->createXferProcessor(colorPOI, covPOI, false, NULL, caps)); + xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps)); if (!xp) { ERRORF(reporter, "Failed to create an XP with LCD coverage."); return; @@ -985,13 +985,13 @@ static void test_no_dual_source_blending(skiatest::Reporter* reporter) { for (size_t c = 0; c < SK_ARRAY_COUNT(testColors); c++) { GrProcOptInfo colorPOI; - colorPOI.calcWithInitialValues(NULL, 0, testColors[c], testColorFlags[c], false); + colorPOI.calcWithInitialValues(nullptr, 0, testColors[c], testColorFlags[c], false); for (int f = 0; f <= 1; f++) { GrProcOptInfo covPOI; if (!f) { - covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true); + covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true); } else { - covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), + covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true); } for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index b9bb319210..24ffc7c5d3 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -27,7 +27,7 @@ DEF_GPUTEST(GrSurface, reporter, factory) { desc.fWidth = 256; desc.fHeight = 256; desc.fSampleCnt = 0; - GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, NULL, 0); + GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0); REPORTER_ASSERT(reporter, texRT1 == texRT1->asRenderTarget()); REPORTER_ASSERT(reporter, texRT1 == texRT1->asTexture()); @@ -39,8 +39,8 @@ DEF_GPUTEST(GrSurface, reporter, factory) { static_cast<GrSurface*>(texRT1->asTexture())); desc.fFlags = kNone_GrSurfaceFlags; - GrSurface* tex1 = context->textureProvider()->createTexture(desc, false, NULL, 0); - REPORTER_ASSERT(reporter, NULL == tex1->asRenderTarget()); + GrSurface* tex1 = context->textureProvider()->createTexture(desc, false, nullptr, 0); + REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget()); REPORTER_ASSERT(reporter, tex1 == tex1->asTexture()); REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1) == tex1->asTexture()); diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp index ab5c02ac94..f046f8ff6b 100644 --- a/tests/GrTextureMipMapInvalidationTest.cpp +++ b/tests/GrTextureMipMapInvalidationTest.cpp @@ -29,12 +29,12 @@ DEF_GPUTEST(GrTextureMipMapInvalidationTest, reporter, factory) { desc.fWidth = 256; desc.fHeight = 256; desc.fSampleCnt = 0; - GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, NULL, 0); - GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, NULL, 0); - REPORTER_ASSERT(reporter, NULL != texRT1); - REPORTER_ASSERT(reporter, NULL != texRT2); + GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0); + GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, nullptr, 0); + REPORTER_ASSERT(reporter, nullptr != texRT1); + REPORTER_ASSERT(reporter, nullptr != texRT2); GrTexture* tex = texRT1->asTexture(); - REPORTER_ASSERT(reporter, NULL != tex); + REPORTER_ASSERT(reporter, nullptr != tex); SkBitmap bitmap; GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap); diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp index a2814a3961..d0ea1f2b4d 100644 --- a/tests/GradientTest.cpp +++ b/tests/GradientTest.cpp @@ -18,7 +18,7 @@ static void test_big_grad(skiatest::Reporter* reporter) { const SkColor colors[] = { SK_ColorRED, SK_ColorBLUE }; const SkPoint pts[] = {{ 15, 14.7112684f }, { 0.709064007f, 12.6108112f }}; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode); + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode); SkPaint paint; paint.setShader(s)->unref(); @@ -67,15 +67,15 @@ struct GradRec { static void none_gradproc(skiatest::Reporter* reporter, const GradRec&) { SkAutoTUnref<SkShader> s(SkShader::CreateEmptyShader()); - REPORTER_ASSERT(reporter, SkShader::kNone_GradientType == s->asAGradient(NULL)); + REPORTER_ASSERT(reporter, SkShader::kNone_GradientType == s->asAGradient(nullptr)); } static void color_gradproc(skiatest::Reporter* reporter, const GradRec& rec) { SkAutoTUnref<SkShader> s(new SkColorShader(rec.fColors[0])); - REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(NULL)); + REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(nullptr)); SkShader::GradientInfo info; - info.fColors = NULL; + info.fColors = nullptr; info.fColorCount = 0; s->asAGradient(&info); REPORTER_ASSERT(reporter, 1 == info.fColorCount); diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp index f53faaf864..c90c377cc2 100644 --- a/tests/HashTest.cpp +++ b/tests/HashTest.cpp @@ -94,7 +94,7 @@ namespace { class CopyCounter { public: - CopyCounter() : fID(0), fCounter(NULL) {} + CopyCounter() : fID(0), fCounter(nullptr) {} CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {} diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp index 98fb4efb7d..89d2f8d5dd 100644 --- a/tests/ImageCacheTest.cpp +++ b/tests/ImageCacheTest.cpp @@ -27,7 +27,7 @@ struct TestingRec : public SkResourceCache::Rec { const Key& getKey() const override { return fKey; } size_t bytesUsed() const override { return sizeof(fKey) + sizeof(fValue); } const char* getCategory() const override { return "test_cache"; } - SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return NULL; } + SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return nullptr; } static bool Visitor(const SkResourceCache::Rec& baseRec, void* context) { const TestingRec& rec = static_cast<const TestingRec&>(baseRec); @@ -122,7 +122,7 @@ DEF_TEST(ImageCache, reporter) { } { SkAutoTUnref<SkDiscardableMemoryPool> pool( - SkDiscardableMemoryPool::Create(defLimit, NULL)); + SkDiscardableMemoryPool::Create(defLimit, nullptr)); gPool = pool.get(); SkResourceCache cache(pool_factory); test_cache(reporter, cache, true); diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index 971c3e791f..69ed7dedad 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -87,7 +87,7 @@ static void compare_unpremul(skiatest::Reporter* reporter, const SkString& filen } SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); - if (NULL == decoder.get()) { + if (nullptr == decoder.get()) { SkDebugf("couldn't decode %s\n", filename.c_str()); return; } @@ -176,7 +176,7 @@ static void test_alphaType(skiatest::Reporter* reporter, const SkString& filenam SkFILEStream stream(filename.c_str()); SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); - if (NULL == decoder.get()) { + if (nullptr == decoder.get()) { return; } @@ -281,7 +281,7 @@ DEF_TEST(ImageDecoding_unpremul, reporter) { // This should never fail since we know the images we're decoding. SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); REPORTER_ASSERT(reporter, decoder.get()); - if (NULL == decoder.get()) { + if (nullptr == decoder.get()) { continue; } @@ -424,8 +424,8 @@ DEF_TEST(WebP, reporter) { static SkPixelRef* install_pixel_ref(SkBitmap* bitmap, SkStreamRewindable* stream, int sampleSize, bool ditherImage) { - SkASSERT(bitmap != NULL); - SkASSERT(stream != NULL); + SkASSERT(bitmap != nullptr); + SkASSERT(stream != nullptr); SkASSERT(stream->rewind()); SkColorType colorType = bitmap->colorType(); SkDecodingImageGenerator::Options opts(sampleSize, ditherImage, colorType); @@ -433,7 +433,7 @@ static SkPixelRef* install_pixel_ref(SkBitmap* bitmap, SkDecodingImageGenerator::Create(stream, opts), bitmap)) { return bitmap->pixelRef(); } - return NULL; + return nullptr; } /** * A test for the SkDecodingImageGenerator::Create and @@ -515,13 +515,13 @@ static void test_options(skiatest::Reporter* reporter, SkBitmap bm; bool success = false; if (useData) { - if (NULL == encodedData) { + if (nullptr == encodedData) { return; } success = SkInstallDiscardablePixelRef( SkDecodingImageGenerator::Create(encodedData, opts), &bm); } else { - if (NULL == encodedStream) { + if (nullptr == encodedStream) { return; } success = SkInstallDiscardablePixelRef( @@ -554,7 +554,7 @@ static void test_options(skiatest::Reporter* reporter, // && out_size <= SkNextPow2(((in_size - 1) / sample_size) + 1)); #endif // SK_BUILD_FOR_ANDROID || SK_BUILD_FOR_UNIX SkAutoLockPixels alp(bm); - if (bm.getPixels() == NULL) { + if (bm.getPixels() == nullptr) { ERRORF(reporter, "Pixel decode failed [sampleSize=%d dither=%s " "colorType=%s %s]", opts.fSampleSize, yn(opts.fDitherImage), options_colorType(opts), path.c_str()); @@ -635,10 +635,10 @@ DEF_TEST(ImageDecoderOptions, reporter) { } SkAutoDataUnref encodedData(SkData::NewFromFileName(path.c_str())); - REPORTER_ASSERT(reporter, encodedData.get() != NULL); + REPORTER_ASSERT(reporter, encodedData.get() != nullptr); SkAutoTDelete<SkStreamRewindable> encodedStream( SkStream::NewFromFile(path.c_str())); - REPORTER_ASSERT(reporter, encodedStream.get() != NULL); + REPORTER_ASSERT(reporter, encodedStream.get() != nullptr); for (size_t i = 0; i < SK_ARRAY_COUNT(scaleList); ++i) { for (size_t j = 0; j < SK_ARRAY_COUNT(ditherList); ++j) { @@ -702,13 +702,13 @@ public: SkASSERT(bm); if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) { bm->setPixels(fPixels, ct); - fPixels = NULL; + fPixels = nullptr; fSize = 0; return true; } - return bm->tryAllocPixels(NULL, ct); + return bm->tryAllocPixels(nullptr, ct); } - bool ready() { return fPixels != NULL; } + bool ready() { return fPixels != nullptr; } private: void* fPixels; size_t fSize; @@ -727,7 +727,7 @@ DEF_TEST(ImageDecoding_JpegOverwrite, r) { return; } SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); - if (NULL == decoder.get()) { + if (nullptr == decoder.get()) { ERRORF(r, "\nSkImageDecoder::Factory failed.\n"); return; } diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index f2aa0e94e9..8c3206680a 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -47,7 +47,7 @@ namespace { class MatrixTestImageFilter : public SkImageFilter { public: MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix) - : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMatrix) { + : SkImageFilter(0, nullptr), fReporter(reporter), fExpectedMatrix(expectedMatrix) { } virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx, @@ -123,7 +123,7 @@ static void make_small_bitmap(SkBitmap& bitmap) { } } -static SkImageFilter* make_scale(float amount, SkImageFilter* input = NULL) { +static SkImageFilter* make_scale(float amount, SkImageFilter* input = nullptr) { SkScalar s = amount; SkScalar matrix[20] = { s, 0, 0, 0, 0, 0, s, 0, 0, 0, @@ -155,10 +155,10 @@ DEF_TEST(ImageFilter, reporter) { // Check that two non-clipping color-matrice-filters concatenate into a single filter. SkAutoTUnref<SkImageFilter> halfBrightness(make_scale(0.5f)); SkAutoTUnref<SkImageFilter> quarterBrightness(make_scale(0.5f, halfBrightness)); - REPORTER_ASSERT(reporter, NULL == quarterBrightness->getInput(0)); + REPORTER_ASSERT(reporter, nullptr == quarterBrightness->getInput(0)); SkColorFilter* cf; REPORTER_ASSERT(reporter, quarterBrightness->asColorFilter(&cf)); - REPORTER_ASSERT(reporter, cf->asColorMatrix(NULL)); + REPORTER_ASSERT(reporter, cf->asColorMatrix(nullptr)); cf->unref(); } @@ -167,38 +167,38 @@ DEF_TEST(ImageFilter, reporter) { // concatenates into a single filter, but not a matrixfilter (due to clamping). SkAutoTUnref<SkImageFilter> doubleBrightness(make_scale(2.0f)); SkAutoTUnref<SkImageFilter> halfBrightness(make_scale(0.5f, doubleBrightness)); - REPORTER_ASSERT(reporter, NULL == halfBrightness->getInput(0)); + REPORTER_ASSERT(reporter, nullptr == halfBrightness->getInput(0)); SkColorFilter* cf; REPORTER_ASSERT(reporter, halfBrightness->asColorFilter(&cf)); - REPORTER_ASSERT(reporter, !cf->asColorMatrix(NULL)); + REPORTER_ASSERT(reporter, !cf->asColorMatrix(nullptr)); cf->unref(); } { // Check that a color filter image filter without a crop rect can be // expressed as a color filter. - SkAutoTUnref<SkImageFilter> gray(make_grayscale(NULL, NULL)); - REPORTER_ASSERT(reporter, true == gray->asColorFilter(NULL)); + SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr)); + REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr)); } { // Check that a colorfilterimage filter without a crop rect but with an input // that is another colorfilterimage can be expressed as a colorfilter (composed). - SkAutoTUnref<SkImageFilter> mode(make_blue(NULL, NULL)); - SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, NULL)); - REPORTER_ASSERT(reporter, true == gray->asColorFilter(NULL)); + SkAutoTUnref<SkImageFilter> mode(make_blue(nullptr, nullptr)); + SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, nullptr)); + REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr)); } { // Test that if we exceed the limit of what ComposeColorFilter can combine, we still // can build the DAG and won't assert if we call asColorFilter. - SkAutoTUnref<SkImageFilter> filter(make_blue(NULL, NULL)); + SkAutoTUnref<SkImageFilter> filter(make_blue(nullptr, nullptr)); const int kWayTooManyForComposeColorFilter = 100; for (int i = 0; i < kWayTooManyForComposeColorFilter; ++i) { - filter.reset(make_blue(filter, NULL)); + filter.reset(make_blue(filter, nullptr)); // the first few of these will succeed, but after we hit the internal limit, // it will then return false. - (void)filter->asColorFilter(NULL); + (void)filter->asColorFilter(nullptr); } } @@ -206,8 +206,8 @@ DEF_TEST(ImageFilter, reporter) { // Check that a color filter image filter with a crop rect cannot // be expressed as a color filter. SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(0, 0, 100, 100)); - SkAutoTUnref<SkImageFilter> grayWithCrop(make_grayscale(NULL, &cropRect)); - REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(NULL)); + SkAutoTUnref<SkImageFilter> grayWithCrop(make_grayscale(nullptr, &cropRect)); + REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(nullptr)); } { @@ -276,7 +276,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80)); SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60)); - SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect)); + SkAutoTUnref<SkImageFilter> input(make_grayscale(nullptr, &inputCropRect)); SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); @@ -315,7 +315,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep SkIPoint offset; SkString str; str.printf("filter %d", static_cast<int>(i)); - SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); + SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(proxy, bitmap, ctx, &result, &offset), str.c_str()); REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, str.c_str()); @@ -338,7 +338,7 @@ static SkBitmap make_gradient_circle(int width, int height) { colors[0] = SK_ColorWHITE; colors[1] = SK_ColorBLACK; SkAutoTUnref<SkShader> shader( - SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2, + SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2, SkShader::kClamp_TileMode) ); SkPaint paint; @@ -365,12 +365,12 @@ static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, skiatest::Repo SkBitmap positiveResult1, negativeResult1; SkBitmap positiveResult2, negativeResult2; SkIPoint offset; - SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); + SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); positiveFilter->filterImage(proxy, gradient, ctx, &positiveResult1, &offset); negativeFilter->filterImage(proxy, gradient, ctx, &negativeResult1, &offset); SkMatrix negativeScale; negativeScale.setScale(-SK_Scalar1, SK_Scalar1); - SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest(), NULL); + SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest(), nullptr); positiveFilter->filterImage(proxy, gradient, negativeCTX, &negativeResult2, &offset); negativeFilter->filterImage(proxy, gradient, negativeCTX, &positiveResult2, &offset); SkAutoLockPixels lockP1(positiveResult1); @@ -469,14 +469,14 @@ DEF_TEST(ImageFilterDrawTiled, reporter) { SkMatrixConvolutionImageFilter::Create( kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1), SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) }, - { "merge", SkMergeImageFilter::Create(NULL, NULL, SkXfermode::kSrcOver_Mode) }, + { "merge", SkMergeImageFilter::Create(nullptr, nullptr, SkXfermode::kSrcOver_Mode) }, { "merge with disjoint inputs", SkMergeImageFilter::Create( rectShaderFilterLeft, rectShaderFilterRight, SkXfermode::kSrcOver_Mode) }, { "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) }, { "dilate", SkDilateImageFilter::Create(3, 2) }, { "erode", SkErodeImageFilter::Create(2, 3) }, { "tile", SkTileImageFilter::Create(SkRect::MakeXYWH(0, 0, 50, 50), - SkRect::MakeXYWH(0, 0, 100, 100), NULL) }, + SkRect::MakeXYWH(0, 0, 100, 100), nullptr) }, { "matrix", SkImageFilter::CreateMatrixFilter(matrix, kLow_SkFilterQuality) }, { "blur and offset", SkOffsetImageFilter::Create(five, five, blur.get()) }, { "picture and blur", SkBlurImageFilter::Create(five, five, pictureFilter.get()) }, @@ -572,7 +572,7 @@ DEF_TEST(ImageFilterDrawMatrixBBH, reporter) { SkRTreeFactory factory; draw_saveLayer_picture(width, height, tileSize, &factory, &result1); - draw_saveLayer_picture(width, height, tileSize, NULL, &result2); + draw_saveLayer_picture(width, height, tileSize, nullptr, &result2); for (int y = 0; y < height; y++) { int diffs = memcmp(result1.getAddr32(0, y), result2.getAddr32(0, y), result1.rowBytes()); @@ -583,16 +583,16 @@ DEF_TEST(ImageFilterDrawMatrixBBH, reporter) { } } -static SkImageFilter* makeBlur(SkImageFilter* input = NULL) { +static SkImageFilter* makeBlur(SkImageFilter* input = nullptr) { return SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input); } -static SkImageFilter* makeDropShadow(SkImageFilter* input = NULL) { +static SkImageFilter* makeDropShadow(SkImageFilter* input = nullptr) { return SkDropShadowImageFilter::Create( SkIntToScalar(100), SkIntToScalar(100), SkIntToScalar(10), SkIntToScalar(10), SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, - input, NULL); + input, nullptr); } DEF_TEST(ImageFilterBlurThenShadowBounds, reporter) { @@ -647,7 +647,7 @@ static void draw_blurred_rect(SkCanvas* canvas) { SkPaint filterPaint; filterPaint.setColor(SK_ColorWHITE); filterPaint.setImageFilter(filter); - canvas->saveLayer(NULL, &filterPaint); + canvas->saveLayer(nullptr, &filterPaint); SkPaint whitePaint; whitePaint.setColor(SK_ColorWHITE); canvas->drawRect(SkRect::Make(SkIRect::MakeWH(4, 4)), whitePaint); @@ -686,7 +686,7 @@ DEF_TEST(ImageFilterDrawTiledBlurRTree, reporter) { // The only difference between these two pictures is that one has RTree aceleration. SkCanvas* recordingCanvas1 = recorder1.beginRecording(SkIntToScalar(width), SkIntToScalar(height), - NULL, 0); + nullptr, 0); SkCanvas* recordingCanvas2 = recorder2.beginRecording(SkIntToScalar(width), SkIntToScalar(height), &factory, 0); @@ -794,7 +794,7 @@ DEF_TEST(ImageFilterMatrix, reporter) { SkAutoTUnref<MatrixTestImageFilter> imageFilter( new MatrixTestImageFilter(reporter, expectedMatrix)); paint.setImageFilter(imageFilter.get()); - recordingCanvas->saveLayer(NULL, &paint); + recordingCanvas->saveLayer(nullptr, &paint); SkPaint solidPaint; solidPaint.setColor(0xFFFFFFFF); recordingCanvas->save(); @@ -882,7 +882,7 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { SkBitmap result; SkIPoint offset; - SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NULL); + SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), nullptr); SkBitmap bitmap; bitmap.allocN32Pixels(2, 2); const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); @@ -924,7 +924,7 @@ DEF_TEST(ImageFilterEmptySaveLayer, reporter) { REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); - recordingCanvas->saveLayer(NULL, &imageFilterPaint); + recordingCanvas->saveLayer(nullptr, &imageFilterPaint); recordingCanvas->restore(); SkAutoTUnref<SkPicture> picture2(recorder.endRecording()); @@ -969,7 +969,7 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) { SkScalar gain = SK_Scalar1, bias = 0; SkIPoint kernelOffset = SkIPoint::Make(1, 1); - // Check that an enormous (non-allocatable) kernel gives a NULL filter. + // Check that an enormous (non-allocatable) kernel gives a nullptr filter. SkAutoTUnref<SkImageFilter> conv(SkMatrixConvolutionImageFilter::Create( SkISize::Make(1<<30, 1<<30), kernel, @@ -979,21 +979,21 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) { SkMatrixConvolutionImageFilter::kRepeat_TileMode, false)); - REPORTER_ASSERT(reporter, NULL == conv.get()); + REPORTER_ASSERT(reporter, nullptr == conv.get()); - // Check that a NULL kernel gives a NULL filter. + // Check that a nullptr kernel gives a nullptr filter. conv.reset(SkMatrixConvolutionImageFilter::Create( SkISize::Make(1, 1), - NULL, + nullptr, gain, bias, kernelOffset, SkMatrixConvolutionImageFilter::kRepeat_TileMode, false)); - REPORTER_ASSERT(reporter, NULL == conv.get()); + REPORTER_ASSERT(reporter, nullptr == conv.get()); - // Check that a kernel width < 1 gives a NULL filter. + // Check that a kernel width < 1 gives a nullptr filter. conv.reset(SkMatrixConvolutionImageFilter::Create( SkISize::Make(0, 1), kernel, @@ -1003,9 +1003,9 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) { SkMatrixConvolutionImageFilter::kRepeat_TileMode, false)); - REPORTER_ASSERT(reporter, NULL == conv.get()); + REPORTER_ASSERT(reporter, nullptr == conv.get()); - // Check that kernel height < 1 gives a NULL filter. + // Check that kernel height < 1 gives a nullptr filter. conv.reset(SkMatrixConvolutionImageFilter::Create( SkISize::Make(1, -1), kernel, @@ -1015,7 +1015,7 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) { SkMatrixConvolutionImageFilter::kRepeat_TileMode, false)); - REPORTER_ASSERT(reporter, NULL == conv.get()); + REPORTER_ASSERT(reporter, nullptr == conv.get()); } static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* reporter) { @@ -1031,7 +1031,7 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re SkColorFilterImageFilter::Create(green.get())); SkImageFilter::CropRect cropRect(SkRect::MakeEmpty()); SkAutoTUnref<SkColorFilterImageFilter> croppedOut( - SkColorFilterImageFilter::Create(green.get(), NULL, &cropRect)); + SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect)); // Check that an xfermode image filter whose input has been cropped out still draws the other // input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning. @@ -1082,7 +1082,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) { // Test that saveLayer() with a filter nested inside another saveLayer() applies the // correct offset to the filter matrix. SkRect bounds1 = SkRect::MakeXYWH(10, 10, 30, 30); - canvas.saveLayer(&bounds1, NULL); + canvas.saveLayer(&bounds1, nullptr); SkPaint filterPaint; filterPaint.setImageFilter(matrixFilter); SkRect bounds2 = SkRect::MakeXYWH(20, 20, 10, 10); @@ -1105,7 +1105,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) { // correct offset to the filter matrix. canvas.clear(0x0); canvas.readPixels(info, &pixel, 4, 25, 25); - canvas.saveLayer(&bounds1, NULL); + canvas.saveLayer(&bounds1, nullptr); canvas.drawSprite(bitmap, 20, 20, &filterPaint); canvas.restore(); @@ -1129,12 +1129,12 @@ DEF_TEST(ComposedImageFilterOffset, reporter) { SkImageFilter::Proxy proxy(&device); SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); - SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, NULL, &cropRect)); + SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, nullptr, &cropRect)); SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blurFilter, offsetFilter.get())); SkBitmap result; SkIPoint offset; - SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); + SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &result, &offset)); REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); } @@ -1149,10 +1149,10 @@ DEF_TEST(PartialCropRect, reporter) { SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30), SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge); - SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect)); + SkAutoTUnref<SkImageFilter> filter(make_grayscale(nullptr, &cropRect)); SkBitmap result; SkIPoint offset; - SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); + SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr); REPORTER_ASSERT(reporter, filter->filterImage(&proxy, bitmap, ctx, &result, &offset)); REPORTER_ASSERT(reporter, offset.fX == 0); REPORTER_ASSERT(reporter, offset.fY == 0); @@ -1216,7 +1216,7 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) { DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); - if (NULL == context) { + if (nullptr == context) { return; } const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); @@ -1234,7 +1234,7 @@ DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); - if (NULL == context) { + if (nullptr == context) { return; } const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); @@ -1252,7 +1252,7 @@ DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) { DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); - if (NULL == context) { + if (nullptr == context) { return; } const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); @@ -1270,7 +1270,7 @@ DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); - if (NULL == context) { + if (nullptr == context) { return; } const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); diff --git a/tests/ImageGeneratorTest.cpp b/tests/ImageGeneratorTest.cpp index 1846f5762e..d6f546acb1 100644 --- a/tests/ImageGeneratorTest.cpp +++ b/tests/ImageGeneratorTest.cpp @@ -14,7 +14,7 @@ static bool gMyFactoryWasCalled; static SkImageGenerator* my_factory(SkData*) { gMyFactoryWasCalled = true; - return NULL; + return nullptr; } static void test_imagegenerator_factory(skiatest::Reporter* reporter) { @@ -27,14 +27,14 @@ static void test_imagegenerator_factory(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !gMyFactoryWasCalled); gen = SkImageGenerator::NewFromEncoded(data); - REPORTER_ASSERT(reporter, NULL == gen); + REPORTER_ASSERT(reporter, nullptr == gen); REPORTER_ASSERT(reporter, !gMyFactoryWasCalled); // Test is racy, in that it hopes no other thread is changing this global... SkGraphics::ImageGeneratorFromEncodedFactory prev = SkGraphics::SetImageGeneratorFromEncodedFactory(my_factory); gen = SkImageGenerator::NewFromEncoded(data); - REPORTER_ASSERT(reporter, NULL == gen); + REPORTER_ASSERT(reporter, nullptr == gen); REPORTER_ASSERT(reporter, gMyFactoryWasCalled); SkGraphics::SetImageGeneratorFromEncodedFactory(prev); } @@ -50,16 +50,16 @@ DEF_TEST(ImageGenerator, reporter) { sizes[0] = SkISize::Make(200, 200); sizes[1] = SkISize::Make(100, 100); sizes[2] = SkISize::Make( 50, 50); - void* planes[3] = { NULL }; + void* planes[3] = { nullptr }; size_t rowBytes[3] = { 0 }; SkYUVColorSpace colorSpace; // Check that the YUV decoding API does not cause any crashes - ig.getYUV8Planes(sizes, NULL, NULL, &colorSpace); - ig.getYUV8Planes(sizes, NULL, NULL, NULL); - ig.getYUV8Planes(sizes, planes, NULL, NULL); - ig.getYUV8Planes(sizes, NULL, rowBytes, NULL); - ig.getYUV8Planes(sizes, planes, rowBytes, NULL); + ig.getYUV8Planes(sizes, nullptr, nullptr, &colorSpace); + ig.getYUV8Planes(sizes, nullptr, nullptr, nullptr); + ig.getYUV8Planes(sizes, planes, nullptr, nullptr); + ig.getYUV8Planes(sizes, nullptr, rowBytes, nullptr); + ig.getYUV8Planes(sizes, planes, rowBytes, nullptr); ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace); int dummy; diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp index 522bd9447f..3718cf16cc 100644 --- a/tests/ImageIsOpaqueTest.cpp +++ b/tests/ImageIsOpaqueTest.cpp @@ -75,7 +75,7 @@ DEF_GPUTEST(ImageIsOpaqueTest_GPU, reporter, factory) { GrContext* context = factory->get(glCtxType); - if (NULL == context) { + if (nullptr == context) { continue; } diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp index c78b7157a2..c01fbe7ee8 100644 --- a/tests/ImageNewShaderTest.cpp +++ b/tests/ImageNewShaderTest.cpp @@ -153,7 +153,7 @@ DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) { GrContext* context = factory->get(glCtxType); - if (NULL == context) { + if (nullptr == context) { continue; } diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index de945f978b..bbf6682084 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -80,7 +80,7 @@ static void test_encode(skiatest::Reporter* reporter, GrContext* ctx) { SkAutoTUnref<SkImage> decoded(SkImage::NewFromEncoded(origEncoded)); REPORTER_ASSERT(reporter, decoded); - assert_equal(reporter, orig, NULL, decoded); + assert_equal(reporter, orig, nullptr, decoded); // Now see if we can instantiate an image from a subset of the surface/origEncoded @@ -90,7 +90,7 @@ static void test_encode(skiatest::Reporter* reporter, GrContext* ctx) { } DEF_TEST(Image_Encode_Cpu, reporter) { - test_encode(reporter, NULL); + test_encode(reporter, nullptr); } #if SK_SUPPORT_GPU diff --git a/tests/IndexedPngOverflowTest.cpp b/tests/IndexedPngOverflowTest.cpp index 914053a3ac..78f8d94b1a 100644 --- a/tests/IndexedPngOverflowTest.cpp +++ b/tests/IndexedPngOverflowTest.cpp @@ -40,5 +40,5 @@ DEF_TEST(IndexedPngOverflow, reporter) { SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(SkImageInfo::MakeN32Premul(20, 1))); SkCanvas* canvas = surface->getCanvas(); SkRect destRect = SkRect::MakeXYWH(0, 0, 20, 1); - canvas->drawBitmapRect(image, destRect, NULL); + canvas->drawBitmapRect(image, destRect, nullptr); } diff --git a/tests/JpegTest.cpp b/tests/JpegTest.cpp index 1153a3682b..daa932c4c9 100644 --- a/tests/JpegTest.cpp +++ b/tests/JpegTest.cpp @@ -470,7 +470,7 @@ DEF_TEST(Jpeg_YUV, reporter) { SkPixelRef* pixelRef = bitmap.pixelRef(); SkISize yuvSizes[3]; - bool sizesComputed = (NULL != pixelRef) && pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NULL); + bool sizesComputed = (nullptr != pixelRef) && pixelRef->getYUV8Planes(yuvSizes, nullptr, nullptr, nullptr); REPORTER_ASSERT(reporter, sizesComputed); if (!sizesComputed) { @@ -495,5 +495,5 @@ DEF_TEST(Jpeg_YUV, reporter) { planes[2] = (uint8_t*)planes[1] + sizes[1]; // Get the YUV planes - REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes, NULL)); + REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes, nullptr)); } diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp index eb36d643a8..4315e6dbd6 100644 --- a/tests/KtxTest.cpp +++ b/tests/KtxTest.cpp @@ -33,7 +33,7 @@ DEF_TEST(KtxReadWrite, reporter) { uint8_t *pixels = reinterpret_cast<uint8_t*>(bm8888.getPixels()); REPORTER_ASSERT(reporter, pixels); - if (NULL == pixels) { + if (nullptr == pixels) { return; } @@ -72,7 +72,7 @@ DEF_TEST(KtxReadWrite, reporter) { REPORTER_ASSERT(reporter, decodedPixels); REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize()); - if (NULL == decodedPixels) { + if (nullptr == decodedPixels) { return; } @@ -144,7 +144,7 @@ DEF_TEST(KtxReexportPKM, reporter) { // Load PKM file into a bitmap SkBitmap etcBitmap; SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); - if (NULL == fileData) { + if (nullptr == fileData) { SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str()); return; } diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp index 3d1921514c..5a0e1d89ba 100644 --- a/tests/LListTest.cpp +++ b/tests/LListTest.cpp @@ -91,12 +91,12 @@ static void TestTInternalLList(skiatest::Reporter* reporter) { check_list(list, reporter, true, 0, false, false, false, false, elements); // test out methods that add to the middle of the list. - list.addAfter(&elements[1], NULL); + list.addAfter(&elements[1], nullptr); check_list(list, reporter, false, 1, false, true, false, false, elements); list.remove(&elements[1]); - list.addBefore(&elements[1], NULL); + list.addBefore(&elements[1], nullptr); check_list(list, reporter, false, 1, false, true, false, false, elements); list.addBefore(&elements[0], &elements[1]); @@ -129,8 +129,8 @@ static void TestTLList(skiatest::Reporter* reporter) { Iter iter4; REPORTER_ASSERT(reporter, list1.isEmpty()); - REPORTER_ASSERT(reporter, NULL == iter1.init(list1, Iter::kHead_IterStart)); - REPORTER_ASSERT(reporter, NULL == iter1.init(list1, Iter::kTail_IterStart)); + REPORTER_ASSERT(reporter, nullptr == iter1.init(list1, Iter::kHead_IterStart)); + REPORTER_ASSERT(reporter, nullptr == iter1.init(list1, Iter::kTail_IterStart)); // Try popping an empty list list1.popHead(); list1.popTail(); @@ -271,9 +271,9 @@ static void TestTLList(skiatest::Reporter* reporter) { Iter np = next; np.prev(); // pn should match next unless the target node was the head, in which case prev // walked off the list. - REPORTER_ASSERT(reporter, pn.get() == next.get() || NULL == prev.get()); + REPORTER_ASSERT(reporter, pn.get() == next.get() || nullptr == prev.get()); // Similarly, np should match prev unless next originally walked off the tail. - REPORTER_ASSERT(reporter, np.get() == prev.get() || NULL == next.get()); + REPORTER_ASSERT(reporter, np.get() == prev.get() || nullptr == next.get()); --count; } REPORTER_ASSERT(reporter, count == list1.count()); diff --git a/tests/LayerRasterizerTest.cpp b/tests/LayerRasterizerTest.cpp index 82060b01b0..a81cca4037 100644 --- a/tests/LayerRasterizerTest.cpp +++ b/tests/LayerRasterizerTest.cpp @@ -81,7 +81,7 @@ static bool equals(const SkLayerRasterizer_Rec& rec1, const SkLayerRasterizer_Re DEF_TEST(LayerRasterizer_copy, reporter) { SkLayerRasterizer::Builder builder; - REPORTER_ASSERT(reporter, NULL == builder.snapshotRasterizer()); + REPORTER_ASSERT(reporter, nullptr == builder.snapshotRasterizer()); SkPaint paint; // Create a bunch of paints with different flags. for (uint32_t flags = 0x01; flags < SkPaint::kAllFlags; flags <<= 1) { @@ -105,9 +105,9 @@ DEF_TEST(LayerRasterizer_copy, reporter) { REPORTER_ASSERT(reporter, largerCount == LayerRasterizerTester::CountLayers(*detached.get())); REPORTER_ASSERT(reporter, smallerCount == largerCount - 1); - const SkLayerRasterizer_Rec* recFirstCopy = NULL; - const SkLayerRasterizer_Rec* recOneLarger = NULL; - const SkLayerRasterizer_Rec* recDetached = NULL; + const SkLayerRasterizer_Rec* recFirstCopy = nullptr; + const SkLayerRasterizer_Rec* recOneLarger = nullptr; + const SkLayerRasterizer_Rec* recDetached = nullptr; const SkDeque& layersFirstCopy = LayerRasterizerTester::GetLayers(*firstCopy.get()); const SkDeque& layersOneLarger = LayerRasterizerTester::GetLayers(*oneLarger.get()); @@ -131,7 +131,7 @@ DEF_TEST(LayerRasterizer_copy, reporter) { REPORTER_ASSERT(reporter, equals(*recOneLarger, *recDetached)); if (smallerCount == i) { - REPORTER_ASSERT(reporter, recFirstCopy == NULL); + REPORTER_ASSERT(reporter, recFirstCopy == nullptr); } else { REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); } @@ -140,5 +140,5 @@ DEF_TEST(LayerRasterizer_copy, reporter) { DEF_TEST(LayerRasterizer_detachEmpty, reporter) { SkLayerRasterizer::Builder builder; - REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer()); + REPORTER_ASSERT(reporter, nullptr == builder.detachRasterizer()); } diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp index e267d6f72c..2e6c07d103 100644 --- a/tests/MallocPixelRefTest.cpp +++ b/tests/MallocPixelRefTest.cpp @@ -25,71 +25,71 @@ DEF_TEST(MallocPixelRef, reporter) { SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13); { SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, NULL)); + SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, nullptr)); // rowbytes too small. - REPORTER_ASSERT(reporter, NULL == pr.get()); + REPORTER_ASSERT(reporter, nullptr == pr.get()); } { size_t rowBytes = info.minRowBytes() - 1; size_t size = info.getSafeSize(rowBytes); SkAutoDataUnref data(SkData::NewUninitialized(size)); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data)); + SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data)); // rowbytes too small. - REPORTER_ASSERT(reporter, NULL == pr.get()); + REPORTER_ASSERT(reporter, nullptr == pr.get()); } { size_t rowBytes = info.minRowBytes() + 2; size_t size = info.getSafeSize(rowBytes) - 1; SkAutoDataUnref data(SkData::NewUninitialized(size)); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data)); + SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data)); // data too small. - REPORTER_ASSERT(reporter, NULL == pr.get()); + REPORTER_ASSERT(reporter, nullptr == pr.get()); } size_t rowBytes = info.minRowBytes() + 7; size_t size = info.getSafeSize(rowBytes) + 9; { SkAutoMalloc memory(size); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, NULL)); - REPORTER_ASSERT(reporter, pr.get() != NULL); + SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, nullptr)); + REPORTER_ASSERT(reporter, pr.get() != nullptr); REPORTER_ASSERT(reporter, memory.get() == pr->pixels()); } { SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewAllocate(info, rowBytes, NULL)); - REPORTER_ASSERT(reporter, pr.get() != NULL); + SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr)); + REPORTER_ASSERT(reporter, pr.get() != nullptr); REPORTER_ASSERT(reporter, pr->pixels()); } { void* addr = static_cast<void*>(new uint8_t[size]); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr, - delete_uint8_proc, NULL)); - REPORTER_ASSERT(reporter, pr.get() != NULL); + SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr, + delete_uint8_proc, nullptr)); + REPORTER_ASSERT(reporter, pr.get() != nullptr); REPORTER_ASSERT(reporter, addr == pr->pixels()); } { int x = 0; SkAutoMalloc memory(size); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, + SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, memory.get(), set_to_one_proc, static_cast<void*>(&x))); - REPORTER_ASSERT(reporter, pr.get() != NULL); + REPORTER_ASSERT(reporter, pr.get() != nullptr); REPORTER_ASSERT(reporter, memory.get() == pr->pixels()); REPORTER_ASSERT(reporter, 0 == x); - pr.reset(NULL); + pr.reset(nullptr); // make sure that set_to_one_proc was called. REPORTER_ASSERT(reporter, 1 == x); } { void* addr = static_cast<void*>(new uint8_t[size]); - REPORTER_ASSERT(reporter, addr != NULL); + REPORTER_ASSERT(reporter, addr != nullptr); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr, - delete_uint8_proc, NULL)); + SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr, + delete_uint8_proc, nullptr)); REPORTER_ASSERT(reporter, addr == pr->pixels()); } { @@ -97,9 +97,9 @@ DEF_TEST(MallocPixelRef, reporter) { SkData* dataPtr = data.get(); REPORTER_ASSERT(reporter, dataPtr->unique()); SkAutoTUnref<SkMallocPixelRef> pr( - SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data.get())); + SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get())); REPORTER_ASSERT(reporter, !(dataPtr->unique())); - data.reset(NULL); + data.reset(nullptr); REPORTER_ASSERT(reporter, dataPtr->unique()); REPORTER_ASSERT(reporter, dataPtr->data() == pr->pixels()); } diff --git a/tests/MaskCacheTest.cpp b/tests/MaskCacheTest.cpp index f4e316c6c9..13cd354c91 100644 --- a/tests/MaskCacheTest.cpp +++ b/tests/MaskCacheTest.cpp @@ -24,7 +24,7 @@ static void check_data(skiatest::Reporter* reporter, SkCachedData* data, int refcnt, CachedState cacheState, LockedState lockedState) { REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt); REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState)); - bool isLocked = (data->data() != NULL); + bool isLocked = (data->data() != nullptr); REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked)); } @@ -40,7 +40,7 @@ DEF_TEST(RRectMaskCache, reporter) { SkMask mask; SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rrect, &mask, &cache); - REPORTER_ASSERT(reporter, NULL == data); + REPORTER_ASSERT(reporter, nullptr == data); size_t size = 256; data = cache.newCachedData(size); @@ -78,7 +78,7 @@ DEF_TEST(RectsMaskCache, reporter) { SkMask mask; SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rects, 1, &mask, &cache); - REPORTER_ASSERT(reporter, NULL == data); + REPORTER_ASSERT(reporter, nullptr == data); size_t size = 256; data = cache.newCachedData(size); diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index 9208ed13ad..f4b6783c36 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -430,17 +430,17 @@ static void test_invert(skiatest::Reporter* reporter) { SkMatrix44 tinyScale(SkMatrix44::kIdentity_Constructor); tinyScale.setDouble(0, 0, 1e-39); REPORTER_ASSERT(reporter, tinyScale.getType() == SkMatrix44::kScale_Mask); - REPORTER_ASSERT(reporter, !tinyScale.invert(NULL)); + REPORTER_ASSERT(reporter, !tinyScale.invert(nullptr)); REPORTER_ASSERT(reporter, !tinyScale.invert(&inverse)); SkMatrix44 tinyScaleTranslate(SkMatrix44::kIdentity_Constructor); tinyScaleTranslate.setDouble(0, 0, 1e-38); - REPORTER_ASSERT(reporter, tinyScaleTranslate.invert(NULL)); + REPORTER_ASSERT(reporter, tinyScaleTranslate.invert(nullptr)); tinyScaleTranslate.setDouble(0, 3, 10); REPORTER_ASSERT( reporter, tinyScaleTranslate.getType() == (SkMatrix44::kScale_Mask | SkMatrix44::kTranslate_Mask)); - REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(NULL)); + REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(nullptr)); REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(&inverse)); SkMatrix44 tinyScalePerspective(SkMatrix44::kIdentity_Constructor); @@ -449,7 +449,7 @@ static void test_invert(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, (tinyScalePerspective.getType() & SkMatrix44::kPerspective_Mask) == SkMatrix44::kPerspective_Mask); - REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(NULL)); + REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(nullptr)); REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(&inverse)); } @@ -835,7 +835,7 @@ DEF_TEST(Matrix44, reporter) { mat.setScale(3, 3, 3); rot.setRotateDegreesAbout(0, 0, -1, 90); mat.postConcat(rot); - REPORTER_ASSERT(reporter, mat.invert(NULL)); + REPORTER_ASSERT(reporter, mat.invert(nullptr)); mat.invert(&inverse); iden1.setConcat(mat, inverse); REPORTER_ASSERT(reporter, is_identity(iden1)); @@ -849,7 +849,7 @@ DEF_TEST(Matrix44, reporter) { rot.setRotateDegreesAbout(0, 0, -1, 90); mat.postConcat(rot); mat.postTranslate(v,v,v); - REPORTER_ASSERT(reporter, mat.invert(NULL)); + REPORTER_ASSERT(reporter, mat.invert(nullptr)); mat.invert(&inverse); iden1.setConcat(mat, inverse); REPORTER_ASSERT(reporter, is_identity(iden1)); @@ -864,7 +864,7 @@ DEF_TEST(Matrix44, reporter) { mat.postTranslate(SkDoubleToMScalar(1.0e+2), SkDoubleToMScalar(3.0), SkDoubleToMScalar(1.0e-2)); - REPORTER_ASSERT(reporter, mat.invert(NULL)); + REPORTER_ASSERT(reporter, mat.invert(nullptr)); mat.invert(&inverse); iden1.setConcat(mat, inverse); REPORTER_ASSERT(reporter, is_identity(iden1)); @@ -872,7 +872,7 @@ DEF_TEST(Matrix44, reporter) { // test degenerate matrix mat.reset(); mat.set3x3(1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0); - REPORTER_ASSERT(reporter, !mat.invert(NULL)); + REPORTER_ASSERT(reporter, !mat.invert(nullptr)); // test rol/col Major getters { diff --git a/tests/MatrixClipCollapseTest.cpp b/tests/MatrixClipCollapseTest.cpp index c9940272c0..de6af362eb 100644 --- a/tests/MatrixClipCollapseTest.cpp +++ b/tests/MatrixClipCollapseTest.cpp @@ -192,8 +192,8 @@ static void emit_clip(SkCanvas* canvas, ClipType clip) { } static void add_clip(ClipType clip, MatType mat, SkTDArray<DrawType>* expected) { - if (NULL == expected) { - // expected is NULL if this clip will be fused into later clips + if (nullptr == expected) { + // expected is nullptr if this clip will be fused into later clips return; } @@ -255,8 +255,8 @@ static void emit_mat(SkCanvas* canvas, MatType mat) { } static void add_mat(MatType mat, SkTDArray<DrawType>* expected) { - if (NULL == expected) { - // expected is NULL if this matrix call will be fused into later ones + if (nullptr == expected) { + // expected is nullptr if this matrix call will be fused into later ones return; } @@ -475,7 +475,7 @@ static void emit_body2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, (*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, accumulatedClips+1); *expected->append() = SAVE_LAYER; // TODO: widen testing to exercise saveLayer's parameters - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); if (needsSaveRestore) { *expected->append() = SAVE; } @@ -513,14 +513,14 @@ static void emit_body3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, (*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, accumulatedClips+1); *expected->append() = SAVE_LAYER; // TODO: widen testing to exercise saveLayer's parameters - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); (*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, 1); if (kNone_MatType != mat || kNone_ClipType != clip) { *expected->append() = SAVE; } *expected->append() = SAVE_LAYER; // TODO: widen testing to exercise saveLayer's parameters - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); if (needsSaveRestore) { *expected->append() = SAVE; } @@ -569,11 +569,11 @@ static void emit_struct1(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, ClipType clip, PFEmitBody emitBody, DrawOpType draw, SkTDArray<DrawType>* expected) { - (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these get fused into later ops + (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these get fused into later ops canvas->save(); (*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1); canvas->restore(); - (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get removed + (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get removed } // Emit: @@ -592,14 +592,14 @@ static void emit_struct2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, ClipType clip, PFEmitBody emitBody, DrawOpType draw, SkTDArray<DrawType>* expected) { - (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get fused into later ops + (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get fused into later ops canvas->save(); (*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1); canvas->restore(); canvas->save(); (*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1); canvas->restore(); - (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get removed + (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get removed } // Emit: @@ -621,17 +621,17 @@ static void emit_struct3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat, ClipType clip, PFEmitBody emitBody, DrawOpType draw, SkTDArray<DrawType>* expected) { - (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get fused into later ops + (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get fused into later ops canvas->save(); (*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1); canvas->restore(); canvas->save(); - (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get fused into later ops + (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get fused into later ops canvas->save(); (*emitBody)(canvas, emitMC, mat, clip, draw, expected, 2); canvas->restore(); canvas->restore(); - (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get removed + (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get removed } ////////////////////////////////////////////////////////////////////////////// diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 2296b8f2b5..57e79576b0 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -142,7 +142,7 @@ static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) { // add 100 in case we have a bug, I don't want to kill my stack in the test static const size_t kBufferSize = SkMatrix::kMaxFlattenSize + 100; char buffer[kBufferSize]; - size_t size1 = m.writeToMemory(NULL); + size_t size1 = m.writeToMemory(nullptr); size_t size2 = m.writeToMemory(buffer); REPORTER_ASSERT(reporter, size1 == size2); REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize); @@ -497,7 +497,7 @@ static void test_matrix_decomposition(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2)); REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2)); // make sure it doesn't crash if we pass in NULLs - REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, NULL, NULL, NULL)); + REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, nullptr, nullptr, nullptr)); // rotation only mat.setRotate(kRotation0); @@ -711,7 +711,7 @@ static void test_matrix_homogeneous(skiatest::Reporter* reporter) { // doesn't crash with null dst, src, count == 0 { - mats[0].mapHomogeneousPoints(NULL, NULL, 0); + mats[0].mapHomogeneousPoints(nullptr, nullptr, 0); } // uniform scale of point @@ -822,7 +822,7 @@ DEF_TEST(Matrix, reporter) { mat.setScale(SkIntToScalar(3), SkIntToScalar(5), SkIntToScalar(20), 0); mat.postRotate(SkIntToScalar(25)); - REPORTER_ASSERT(reporter, mat.invert(NULL)); + REPORTER_ASSERT(reporter, mat.invert(nullptr)); REPORTER_ASSERT(reporter, mat.invert(&inverse)); iden1.setConcat(mat, inverse); REPORTER_ASSERT(reporter, is_identity(iden1)); @@ -832,17 +832,17 @@ DEF_TEST(Matrix, reporter) { test_flatten(reporter, iden2); mat.setScale(0, SK_Scalar1); - REPORTER_ASSERT(reporter, !mat.invert(NULL)); + REPORTER_ASSERT(reporter, !mat.invert(nullptr)); REPORTER_ASSERT(reporter, !mat.invert(&inverse)); mat.setScale(SK_Scalar1, 0); - REPORTER_ASSERT(reporter, !mat.invert(NULL)); + REPORTER_ASSERT(reporter, !mat.invert(nullptr)); REPORTER_ASSERT(reporter, !mat.invert(&inverse)); // Inverting this matrix results in a non-finite matrix mat.setAll(0.0f, 1.0f, 2.0f, 0.0f, 1.0f, -3.40277175e+38f, 1.00003040f, 1.0f, 0.0f); - REPORTER_ASSERT(reporter, !mat.invert(NULL)); + REPORTER_ASSERT(reporter, !mat.invert(nullptr)); REPORTER_ASSERT(reporter, !mat.invert(&inverse)); // rectStaysRect test diff --git a/tests/MemsetTest.cpp b/tests/MemsetTest.cpp index 1e1378b4ad..76412eec77 100644 --- a/tests/MemsetTest.cpp +++ b/tests/MemsetTest.cpp @@ -30,7 +30,7 @@ static void test_chunkalloc(skiatest::Reporter* reporter) { //------------------------------------------------------------------------ // check empty check_alloc(reporter, alloc, 0, 0, 0); - REPORTER_ASSERT(reporter, !alloc.contains(NULL)); + REPORTER_ASSERT(reporter, !alloc.contains(nullptr)); REPORTER_ASSERT(reporter, !alloc.contains(reporter)); // reset on empty allocator diff --git a/tests/MetaDataTest.cpp b/tests/MetaDataTest.cpp index 9d8d5dd5a9..25673981c8 100644 --- a/tests/MetaDataTest.cpp +++ b/tests/MetaDataTest.cpp @@ -84,7 +84,7 @@ DEF_TEST(MetaData, reporter) { int loop = 0; int count; SkMetaData::Type t; - while ((name = iter.next(&t, &count)) != NULL) + while ((name = iter.next(&t, &count)) != nullptr) { int match = 0; for (unsigned i = 0; i < SK_ARRAY_COUNT(gElems); i++) diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp index c8396effa6..5e5e894870 100644 --- a/tests/MipMapTest.cpp +++ b/tests/MipMapTest.cpp @@ -11,7 +11,7 @@ #include "Test.h" static void make_bitmap(SkBitmap* bm, SkRandom& rand) { - // for now, Build needs a min size of 2, otherwise it will return NULL. + // for now, Build needs a min size of 2, otherwise it will return nullptr. // should fix that to support 1 X N, where N > 1 to return non-null. int w = 2 + rand.nextU() % 1000; int h = 2 + rand.nextU() % 1000; @@ -25,10 +25,10 @@ DEF_TEST(MipMap, reporter) { for (int i = 0; i < 500; ++i) { make_bitmap(&bm, rand); - SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, NULL)); + SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, nullptr)); - REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, NULL)); - REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, NULL)); + REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, nullptr)); + REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, nullptr)); SkMipMap::Level prevLevel; sk_bzero(&prevLevel, sizeof(prevLevel)); diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp index facc6ad3f7..3276145fa4 100644 --- a/tests/OSPathTest.cpp +++ b/tests/OSPathTest.cpp @@ -86,8 +86,8 @@ DEF_TEST(OSPath, reporter) { SkString baseOfDir = SkOSPath::Basename(dir.c_str()); REPORTER_ASSERT(reporter, baseOfDir.size() == 0); - // Basename of NULL is an empty string. - SkString empty = SkOSPath::Basename(NULL); + // Basename of nullptr is an empty string. + SkString empty = SkOSPath::Basename(nullptr); REPORTER_ASSERT(reporter, empty.size() == 0); // File in root dir @@ -99,7 +99,7 @@ DEF_TEST(OSPath, reporter) { filename.reset(); test_dir_with_file(reporter, dir, filename); - // Test that NULL can be used for the directory and filename. - SkString emptyPath = SkOSPath::Join(NULL, NULL); + // Test that nullptr can be used for the directory and filename. + SkString emptyPath = SkOSPath::Join(nullptr, nullptr); REPORTER_ASSERT(reporter, emptyPath.isEmpty()); } diff --git a/tests/PDFDeflateWStreamTest.cpp b/tests/PDFDeflateWStreamTest.cpp index a85212c2c3..f4d8dd3730 100644 --- a/tests/PDFDeflateWStreamTest.cpp +++ b/tests/PDFDeflateWStreamTest.cpp @@ -27,7 +27,7 @@ void skia_free_func(void*, void* address) { sk_free(address); } /** * Use the un-deflate compression algorithm to decompress the data in src, - * returning the result. Returns NULL if an error occurs. + * returning the result. Returns nullptr if an error occurs. */ SkStreamAsset* stream_inflate(SkStream* src) { SkDynamicMemoryWStream decompressedDynamicMemoryWStream; @@ -39,8 +39,8 @@ SkStreamAsset* stream_inflate(SkStream* src) { z_stream flateData; flateData.zalloc = &skia_alloc_func; flateData.zfree = &skia_free_func; - flateData.opaque = NULL; - flateData.next_in = NULL; + flateData.opaque = nullptr; + flateData.next_in = nullptr; flateData.avail_in = 0; flateData.next_out = outputBuffer; flateData.avail_out = kBufferSize; @@ -51,8 +51,8 @@ SkStreamAsset* stream_inflate(SkStream* src) { uint8_t* input = (uint8_t*)src->getMemoryBase(); size_t inputLength = src->getLength(); - if (input == NULL || inputLength == 0) { - input = NULL; + if (input == nullptr || inputLength == 0) { + input = nullptr; flateData.next_in = inputBuffer; flateData.avail_in = 0; } else { @@ -73,7 +73,7 @@ SkStreamAsset* stream_inflate(SkStream* src) { if (rc != Z_OK) break; if (flateData.avail_in == 0) { - if (input != NULL) + if (input != nullptr) break; size_t read = src->read(&inputBuffer, kBufferSize); if (read == 0) diff --git a/tests/PDFDocumentTest.cpp b/tests/PDFDocumentTest.cpp index f9fcdff6a2..04c3ede6aa 100644 --- a/tests/PDFDocumentTest.cpp +++ b/tests/PDFDocumentTest.cpp @@ -82,7 +82,7 @@ static void test_file(skiatest::Reporter* reporter) { doc->close(); FILE* file = fopen(path.c_str(), "r"); - REPORTER_ASSERT(reporter, file != NULL); + REPORTER_ASSERT(reporter, file != nullptr); char header[100]; REPORTER_ASSERT(reporter, fread(header, 4, 1, file) != 0); REPORTER_ASSERT(reporter, strncmp(header, "%PDF", 4) == 0); diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp index 33fcc80ef7..529c97233c 100644 --- a/tests/PDFGlyphsToUnicodeTest.cpp +++ b/tests/PDFGlyphsToUnicodeTest.cpp @@ -126,7 +126,7 @@ endbfchar\n"; buffer.reset(); - append_cmap_sections(glyphToUnicode, NULL, &buffer, false, 0xFC, 0x110); + append_cmap_sections(glyphToUnicode, nullptr, &buffer, false, 0xFC, 0x110); char expectedResultSingleBytes[] = "2 beginbfchar\n\ diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp index cfe6776bf5..530ed2a1d0 100644 --- a/tests/PDFJpegEmbedTest.cpp +++ b/tests/PDFJpegEmbedTest.cpp @@ -46,7 +46,7 @@ static SkData* load_resource( SkDebugf("\n%s: Resource '%s' can not be found.\n", test, filename); } - return data; // May return NULL. + return data; // May return nullptr. } /** @@ -70,9 +70,9 @@ DEF_TEST(PDFJpegEmbedTest, r) { canvas->clear(SK_ColorLTGRAY); SkBitmap bm1(bitmap_from_data(mandrillData)); - canvas->drawBitmap(bm1, 65.0, 0.0, NULL); + canvas->drawBitmap(bm1, 65.0, 0.0, nullptr); SkBitmap bm2(bitmap_from_data(cmykData)); - canvas->drawBitmap(bm2, 0.0, 512.0, NULL); + canvas->drawBitmap(bm2, 0.0, 512.0, nullptr); canvas->flush(); document->endPage(); diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index 8af806cbe7..3253fcaf71 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -32,7 +32,7 @@ struct Catalog { } // namespace template <typename T> -static SkString emit_to_string(T& obj, Catalog* catPtr = NULL) { +static SkString emit_to_string(T& obj, Catalog* catPtr = nullptr) { Catalog catalog; SkDynamicMemoryWStream buffer; if (!catPtr) { @@ -364,7 +364,7 @@ namespace { class DummyImageFilter : public SkImageFilter { public: - DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(visited) {} + DummyImageFilter(bool visited = false) : SkImageFilter(0, nullptr), fVisited(visited) {} ~DummyImageFilter() override {} virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result, SkIPoint* offset) const override { diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index 1fca8dc656..7affa9ee94 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -294,7 +294,7 @@ DEF_TEST(Paint_MoreFlattening, r) { paint.setTextScaleX(1.0f); // Default value, ignored. paint.setTextSize(19); paint.setXfermode(SkXfermode::Create(SkXfermode::kModulate_Mode))->unref(); - paint.setLooper(NULL); // Default value, ignored. + paint.setLooper(nullptr); // Default value, ignored. SkWriteBuffer writer; paint.flatten(writer); @@ -333,7 +333,7 @@ DEF_TEST(Paint_getHash, r) { // SkTypeface is the first field we hash, so test it specially. paint.setTypeface(SkTypeface::RefDefault())->unref(); REPORTER_ASSERT(r, paint.getHash() != defaultHash); - paint.setTypeface(NULL); + paint.setTypeface(nullptr); REPORTER_ASSERT(r, paint.getHash() == defaultHash); // This is part of fBitfields, the last field we hash. diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp index 88b469e21a..8fc100ee02 100755 --- a/tests/PathOpsAngleIdeas.cpp +++ b/tests/PathOpsAngleIdeas.cpp @@ -419,7 +419,7 @@ static void testQuadAngles(skiatest::Reporter* reporter, const SkDQuad& quad1, c SkPoint shortQuads[2][3]; SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); + SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr)); contour.init(&state, false, false); makeSegment(&contour, quad1, shortQuads[0], allocator); makeSegment(&contour, quad1, shortQuads[1], allocator); diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp index cec8dde68a..faf5da50f2 100644 --- a/tests/PathOpsAngleTest.cpp +++ b/tests/PathOpsAngleTest.cpp @@ -235,7 +235,7 @@ static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet); DEF_TEST(PathOpsAngleCircle, reporter) { SkChunkAlloc allocator(4096); SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); + SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr)); contour.init(&state, false, false); for (int index = 0; index < circleDataSetSize; ++index) { CircleData& data = circleDataSet[index]; @@ -427,7 +427,7 @@ struct FourPoints { DEF_TEST(PathOpsAngleAfter, reporter) { SkChunkAlloc allocator(4096); SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); + SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr)); contour.init(&state, false, false); for (int index = intersectDataSetsSize - 1; index >= 0; --index) { IntersectData* dataArray = intersectDataSets[index]; diff --git a/tests/PathOpsBattles.cpp b/tests/PathOpsBattles.cpp index 2920a01557..6e0d3a4177 100644 --- a/tests/PathOpsBattles.cpp +++ b/tests/PathOpsBattles.cpp @@ -11123,5 +11123,5 @@ DEF_TEST(PathOpsBattle, reporter) { #if DEBUG_SHOW_TEST_NAME strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); #endif - RunTestSet(reporter, tests, testCount, firstTest, NULL, stopTest, runReverse); + RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse); } diff --git a/tests/PathOpsBuildUseTest.cpp b/tests/PathOpsBuildUseTest.cpp index 76a54f6fbe..67e42520aa 100644 --- a/tests/PathOpsBuildUseTest.cpp +++ b/tests/PathOpsBuildUseTest.cpp @@ -2431,5 +2431,5 @@ DEF_TEST(PathOpsBuildUse, reporter) { #if DEBUG_SHOW_TEST_NAME strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); #endif - RunTestSet(reporter, tests, testCount, firstTest, NULL, stopTest, runReverse); + RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse); } diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp index 08fc632732..88684fe18d 100644 --- a/tests/PathOpsBuilderTest.cpp +++ b/tests/PathOpsBuilderTest.cpp @@ -31,7 +31,7 @@ DEF_TEST(PathOpsBuilder, reporter) { REPORTER_ASSERT(reporter, builder.resolve(&result)); bool closed; SkPath::Direction dir; - REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); + REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); REPORTER_ASSERT(reporter, closed); REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); @@ -42,7 +42,7 @@ DEF_TEST(PathOpsBuilder, reporter) { rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction); builder.add(rectPath, kUnion_SkPathOp); REPORTER_ASSERT(reporter, builder.resolve(&result)); - REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); + REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); REPORTER_ASSERT(reporter, closed); REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); REPORTER_ASSERT(reporter, rectPath == result); @@ -58,7 +58,7 @@ DEF_TEST(PathOpsBuilder, reporter) { builder.add(rect2, kUnion_SkPathOp); builder.add(rect3, kUnion_SkPathOp); REPORTER_ASSERT(reporter, builder.resolve(&result)); - REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); + REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir)); REPORTER_ASSERT(reporter, closed); SkRect expected; expected.set(0, 1, 5, 3); diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp index 507d865926..263c37b120 100755 --- a/tests/PathOpsDebug.cpp +++ b/tests/PathOpsDebug.cpp @@ -1066,7 +1066,7 @@ void SkOpSegment::dumpAngles() const { const SkOpSpanBase* span = &fHead; do { const SkOpAngle* fAngle = span->fromAngle(); - const SkOpAngle* tAngle = span->final() ? NULL : span->upCast()->toAngle(); + const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle(); if (fAngle) { SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID()); fAngle->dumpTo(this, tAngle); @@ -1285,7 +1285,7 @@ const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { segment = segment->next(); } } while ((contour = contour->next())); - return NULL; + return nullptr; } SkOpContour* SkOpGlobalState::debugContour(int id) { @@ -1295,7 +1295,7 @@ SkOpContour* SkOpGlobalState::debugContour(int id) { return contour; } } while ((contour = contour->next())); - return NULL; + return nullptr; } const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { @@ -1318,7 +1318,7 @@ const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { segment = segment->next(); } } while ((contour = contour->next())); - return NULL; + return nullptr; } const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { @@ -1332,7 +1332,7 @@ const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { segment = segment->next(); } } while ((contour = contour->next())); - return NULL; + return nullptr; } const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { @@ -1353,7 +1353,7 @@ const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { segment = segment->next(); } } while ((contour = contour->next())); - return NULL; + return nullptr; } #endif diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 1401290f83..7209617985 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -425,14 +425,14 @@ bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& st if (!state.fReporter->verbose()) { return true; } - int result = comparePaths(state.fReporter, NULL, path, out, *state.fBitmap); + int result = comparePaths(state.fReporter, nullptr, path, out, *state.fBitmap); if (result) { SkAutoMutexAcquire autoM(simplifyDebugOut); char temp[8192]; sk_bzero(temp, sizeof(temp)); SkMemoryWStream stream(temp, sizeof(temp)); - const char* pathPrefix = NULL; - const char* nameSuffix = NULL; + const char* pathPrefix = nullptr; + const char* nameSuffix = nullptr; if (fillType == SkPath::kEvenOdd_FillType) { pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; nameSuffix = "x"; @@ -586,7 +586,7 @@ void initializeTests(skiatest::Reporter* reporter, const char* test) { inData.setCount((int) inFile.getLength()); size_t inLen = inData.count(); inFile.read(inData.begin(), inLen); - inFile.setPath(NULL); + inFile.setPath(nullptr); char* insert = strstr(inData.begin(), marker); if (insert) { insert += sizeof(marker) - 1; @@ -599,8 +599,8 @@ void initializeTests(skiatest::Reporter* reporter, const char* test) { void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFillType) { const char testFunction[] = "testSimplify(path);"; - const char* pathPrefix = NULL; - const char* nameSuffix = NULL; + const char* pathPrefix = nullptr; + const char* nameSuffix = nullptr; if (pathFillType == SkPath::kEvenOdd_FillType) { pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; nameSuffix = "x"; @@ -614,7 +614,7 @@ void outputProgress(char* ramStr, const char* pathStr, SkPathOp op) { SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes)); const char* nameSuffix = opSuffixes[op]; SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE); - outputToStream(pathStr, NULL, nameSuffix, testFunction, true, rRamStream); + outputToStream(pathStr, nullptr, nameSuffix, testFunction, true, rRamStream); } void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count, diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp index fbe0116eb5..98189ef2d1 100644 --- a/tests/PathOpsOpTest.cpp +++ b/tests/PathOpsOpTest.cpp @@ -5528,11 +5528,11 @@ DEF_TEST(PathOpsOp, reporter) { strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); #endif if (runSubTests && runSubTestsFirst) { - RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); + RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse); } RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse); if (runSubTests && !runSubTestsFirst) { - RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); + RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse); } } @@ -5743,5 +5743,5 @@ DEF_TEST(PathOpsFailOp, reporter) { #if DEBUG_SHOW_TEST_NAME strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); #endif - RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false); + RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, false); } diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp index 8f03ba0051..bd82311c38 100644 --- a/tests/PathOpsSimplifyTest.cpp +++ b/tests/PathOpsSimplifyTest.cpp @@ -5340,10 +5340,10 @@ static bool runReverse = false; DEF_TEST(PathOpsSimplify, reporter) { if (runSubTests && runSubTestsFirst) { - RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); + RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse); } RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse); if (runSubTests && !runSubTestsFirst) { - RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse); + RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse); } } diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp index de4f48c586..edc79d18e6 100644 --- a/tests/PathOpsSkpClipTest.cpp +++ b/tests/PathOpsSkpClipTest.cpp @@ -443,7 +443,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn } void TestResult::testOne() { - SkPicture* pic = NULL; + SkPicture* pic = nullptr; { #if DEBUG_SHOW_TEST_NAME if (fTestStep == kCompareBits) { @@ -533,8 +533,8 @@ DEFINE_string2(match, m, "PathOpsSkpClipThreaded", "^ and $ requires an exact match\n" "If a test does not match any list entry,\n" "it is skipped unless some list entry starts with ~"); -DEFINE_string2(dir, d, NULL, "range of directories (e.g., 1-100)"); -DEFINE_string2(skp, s, NULL, "skp to test"); +DEFINE_string2(dir, d, nullptr, "range of directories (e.g., 1-100)"); +DEFINE_string2(skp, s, nullptr, "skp to test"); DEFINE_bool2(single, z, false, "run tests on a single thread internally."); DEFINE_int32(testIndex, 0, "override local test index (PathOpsSkpClipOneOff only)."); DEFINE_bool2(verbose, v, false, "enable verbose output."); @@ -614,7 +614,7 @@ public: while (fNames && ++fIndex < fNames->count()) { return (*fNames)[fIndex]; } - return NULL; + return nullptr; } void set(const SkCommandLineFlags::StringArray& names) { @@ -705,7 +705,7 @@ bool Less(const SortByName& a, const SortByName& b) { static bool doOneDir(TestState* state, bool threaded) { int dirNo = state->fResult.fDirNo; - SkString dirName = get_in_path(dirNo, NULL); + SkString dirName = get_in_path(dirNo, nullptr); if (!dirName.size()) { return false; } @@ -912,7 +912,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) { int dirNo; gDirs.reset(); while ((dirNo = gDirs.next()) > 0) { - SkString dirName = get_in_path(dirNo, NULL); + SkString dirName = get_in_path(dirNo, nullptr); if (!dirName.size()) { continue; } @@ -943,7 +943,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) { } testRunner.render(); SkAutoTDeleteArray<SkTDArray<TestResult> > results(new SkTDArray<TestResult>[dirCount]); - if (!buildTests(results.get(), NULL)) { + if (!buildTests(results.get(), nullptr)) { return; } SkTDArray<TestResult> allResults; @@ -1042,10 +1042,10 @@ public: if (fReg) { TestRegistry::Factory fact = fReg->factory(); fReg = fReg->next(); - Test* test = fact(NULL); + Test* test = fact(nullptr); return test; } - return NULL; + return nullptr; } private: @@ -1096,7 +1096,7 @@ int tool_main(int argc, char** argv) { SkDebugf("%s", header.c_str()); Iter iter; Test* test; - while ((test = iter.next()) != NULL) { + while ((test = iter.next()) != nullptr) { SkAutoTDelete<Test> owned(test); if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) { test->run(); diff --git a/tests/PathOpsTSectDebug.h b/tests/PathOpsTSectDebug.h index 5780610c9b..51532f8476 100644 --- a/tests/PathOpsTSectDebug.h +++ b/tests/PathOpsTSectDebug.h @@ -21,13 +21,13 @@ const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugSpan(int id) co return test; } } while ((test = test->next())); - return NULL; + return nullptr; } template<typename TCurve, typename OppCurve> const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugT(double t) const { const SkTSpan<TCurve, OppCurve>* test = fHead; - const SkTSpan<TCurve, OppCurve>* closest = NULL; + const SkTSpan<TCurve, OppCurve>* closest = nullptr; double bestDist = DBL_MAX; do { if (between(test->fStartT, t, test->fEndT)) { @@ -132,12 +132,12 @@ void SkTSect<TCurve, OppCurve>::dumpCurves() const { template<typename TCurve, typename OppCurve> const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugSpan(int id) const { - return SkDEBUGRELEASE(fDebugSect->debugSpan(id), NULL); + return SkDEBUGRELEASE(fDebugSect->debugSpan(id), nullptr); } template<typename TCurve, typename OppCurve> const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugT(double t) const { - return SkDEBUGRELEASE(fDebugSect->debugT(t), NULL); + return SkDEBUGRELEASE(fDebugSect->debugT(t), nullptr); } template<typename TCurve, typename OppCurve> diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 68eb67722f..cd9e8847a1 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -314,7 +314,7 @@ static void test_bad_cubic_crbug229478() { SkPath dst; // Before the fix, this would infinite-recurse, and run out of stack // because we would keep trying to subdivide a degenerate cubic segment. - paint.getFillPath(path, &dst, NULL); + paint.getFillPath(path, &dst, nullptr); } static void build_path_170666(SkPath& path) { @@ -485,27 +485,27 @@ static void test_addrect(skiatest::Reporter* reporter) { SkPath path; path.lineTo(0, 0); path.addRect(SkRect::MakeWH(50, 100)); - REPORTER_ASSERT(reporter, path.isRect(NULL)); + REPORTER_ASSERT(reporter, path.isRect(nullptr)); path.reset(); path.lineTo(FLT_EPSILON, FLT_EPSILON); path.addRect(SkRect::MakeWH(50, 100)); - REPORTER_ASSERT(reporter, !path.isRect(NULL)); + REPORTER_ASSERT(reporter, !path.isRect(nullptr)); path.reset(); path.quadTo(0, 0, 0, 0); path.addRect(SkRect::MakeWH(50, 100)); - REPORTER_ASSERT(reporter, !path.isRect(NULL)); + REPORTER_ASSERT(reporter, !path.isRect(nullptr)); path.reset(); path.conicTo(0, 0, 0, 0, 0.5f); path.addRect(SkRect::MakeWH(50, 100)); - REPORTER_ASSERT(reporter, !path.isRect(NULL)); + REPORTER_ASSERT(reporter, !path.isRect(nullptr)); path.reset(); path.cubicTo(0, 0, 0, 0, 0, 0); path.addRect(SkRect::MakeWH(50, 100)); - REPORTER_ASSERT(reporter, !path.isRect(NULL)); + REPORTER_ASSERT(reporter, !path.isRect(nullptr)); } // Make sure we stay non-finite once we get there (unless we reset or rewind). @@ -926,7 +926,7 @@ static void check_direction(skiatest::Reporter* reporter, const SkPath& path, static void test_direction(skiatest::Reporter* reporter) { size_t i; SkPath path; - REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL)); + REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr)); REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection)); REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection)); REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kUnknown_FirstDirection)); @@ -943,7 +943,7 @@ static void test_direction(skiatest::Reporter* reporter) { path.reset(); bool valid = SkParsePath::FromSVGString(gDegen[i], &path); REPORTER_ASSERT(reporter, valid); - REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL)); + REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr)); } static const char* gCW[] = { @@ -1361,7 +1361,7 @@ static void setFromString(SkPath* path, const char str[]) { while (str) { SkScalar x, y; str = SkParse::FindScalar(str, &x); - if (NULL == str) { + if (nullptr == str) { break; } str = SkParse::FindScalar(str, &y); @@ -1507,7 +1507,7 @@ static void test_isLine(skiatest::Reporter* reporter) { SkPoint pts[2]; const SkScalar value = SkIntToScalar(5); - REPORTER_ASSERT(reporter, !path.isLine(NULL)); + REPORTER_ASSERT(reporter, !path.isLine(nullptr)); // set some non-zero values pts[0].set(value, value); @@ -1522,7 +1522,7 @@ static void test_isLine(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, value != moveX && value != moveY); path.moveTo(moveX, moveY); - REPORTER_ASSERT(reporter, !path.isLine(NULL)); + REPORTER_ASSERT(reporter, !path.isLine(nullptr)); REPORTER_ASSERT(reporter, !path.isLine(pts)); // check that pts was untouched REPORTER_ASSERT(reporter, pts[0].equals(value, value)); @@ -1533,7 +1533,7 @@ static void test_isLine(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, value != lineX && value != lineY); path.lineTo(lineX, lineY); - REPORTER_ASSERT(reporter, path.isLine(NULL)); + REPORTER_ASSERT(reporter, path.isLine(nullptr)); REPORTER_ASSERT(reporter, !pts[0].equals(moveX, moveY)); REPORTER_ASSERT(reporter, !pts[1].equals(lineX, lineY)); @@ -1542,14 +1542,14 @@ static void test_isLine(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY)); path.lineTo(0, 0); // too many points/verbs - REPORTER_ASSERT(reporter, !path.isLine(NULL)); + REPORTER_ASSERT(reporter, !path.isLine(nullptr)); REPORTER_ASSERT(reporter, !path.isLine(pts)); REPORTER_ASSERT(reporter, pts[0].equals(moveX, moveY)); REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY)); path.reset(); path.quadTo(1, 1, 2, 2); - REPORTER_ASSERT(reporter, !path.isLine(NULL)); + REPORTER_ASSERT(reporter, !path.isLine(nullptr)); } static void test_conservativelyContains(skiatest::Reporter* reporter) { @@ -1771,7 +1771,7 @@ static void test_isRect_open_close(skiatest::Reporter* reporter) { path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1); path.close(); - REPORTER_ASSERT(reporter, path.isRect(NULL, &isClosed, NULL)); + REPORTER_ASSERT(reporter, path.isRect(nullptr, &isClosed, nullptr)); REPORTER_ASSERT(reporter, isClosed); } @@ -1875,7 +1875,7 @@ static void test_isRect(skiatest::Reporter* reporter) { if (tests[testIndex].fClose) { path.close(); } - REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(NULL)); + REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(nullptr)); if (tests[testIndex].fIsRect) { SkRect computed, expected; @@ -1909,7 +1909,7 @@ static void test_isRect(skiatest::Reporter* reporter) { } path1.close(); path1.lineTo(1, 0); - REPORTER_ASSERT(reporter, !path1.isRect(NULL)); + REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); // fail, move in the middle path1.reset(); @@ -1921,7 +1921,7 @@ static void test_isRect(skiatest::Reporter* reporter) { path1.lineTo(r1[index].fX, r1[index].fY); } path1.close(); - REPORTER_ASSERT(reporter, !path1.isRect(NULL)); + REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); // fail, move on the edge path1.reset(); @@ -1930,7 +1930,7 @@ static void test_isRect(skiatest::Reporter* reporter) { path1.lineTo(r1[index].fX, r1[index].fY); } path1.close(); - REPORTER_ASSERT(reporter, !path1.isRect(NULL)); + REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); // fail, quad path1.reset(); @@ -1942,7 +1942,7 @@ static void test_isRect(skiatest::Reporter* reporter) { path1.lineTo(r1[index].fX, r1[index].fY); } path1.close(); - REPORTER_ASSERT(reporter, !path1.isRect(NULL)); + REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); // fail, cubic path1.reset(); @@ -1954,7 +1954,7 @@ static void test_isRect(skiatest::Reporter* reporter) { path1.lineTo(r1[index].fX, r1[index].fY); } path1.close(); - REPORTER_ASSERT(reporter, !path1.isRect(NULL)); + REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); } static void test_isNestedFillRects(skiatest::Reporter* reporter) { @@ -2042,7 +2042,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { path.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } REPORTER_ASSERT(reporter, - tests[testIndex].fIsNestedRect == path.isNestedFillRects(NULL)); + tests[testIndex].fIsNestedRect == path.isNestedFillRects(nullptr)); if (tests[testIndex].fIsNestedRect) { SkRect expected[2], computed[2]; SkPathPriv::FirstDirection expectedDirs[2]; @@ -2079,7 +2079,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { if (!rectFirst) { path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); // fail, move in the middle path1.reset(); @@ -2097,7 +2097,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { if (!rectFirst) { path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); // fail, move on the edge path1.reset(); @@ -2112,7 +2112,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { if (!rectFirst) { path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); // fail, quad path1.reset(); @@ -2130,7 +2130,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { if (!rectFirst) { path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); // fail, cubic path1.reset(); @@ -2148,13 +2148,13 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { if (!rectFirst) { path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); } - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); // fail, not nested path1.reset(); path1.addRect(1, 1, 3, 3, SkPath::kCW_Direction); path1.addRect(2, 2, 4, 4, SkPath::kCW_Direction); - REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); } // pass, constructed explicitly from manually closed rects specified as moves/lines. @@ -2169,7 +2169,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { path.lineTo(9, 9); path.lineTo(1, 9); path.lineTo(1, 1); - REPORTER_ASSERT(reporter, path.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, path.isNestedFillRects(nullptr)); // pass, stroke rect SkPath src, dst; @@ -2178,7 +2178,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { strokePaint.setStyle(SkPaint::kStroke_Style); strokePaint.setStrokeWidth(2); strokePaint.getFillPath(src, &dst); - REPORTER_ASSERT(reporter, dst.isNestedFillRects(NULL)); + REPORTER_ASSERT(reporter, dst.isNestedFillRects(nullptr)); } static void write_and_read_back(skiatest::Reporter* reporter, @@ -2198,7 +2198,7 @@ static void write_and_read_back(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() == p.getConvexityOrUnknown()); - REPORTER_ASSERT(reporter, readBack.isOval(NULL) == p.isOval(NULL)); + REPORTER_ASSERT(reporter, readBack.isOval(nullptr) == p.isOval(nullptr)); const SkRect& origBounds = p.getBounds(); const SkRect& readBackBounds = readBack.getBounds(); @@ -2225,7 +2225,7 @@ static void test_flattening(skiatest::Reporter* reporter) { // create a buffer that should be much larger than the path so we don't // kill our stack if writer goes too far. char buffer[1024]; - size_t size1 = p.writeToMemory(NULL); + size_t size1 = p.writeToMemory(nullptr); size_t size2 = p.writeToMemory(buffer); REPORTER_ASSERT(reporter, size1 == size2); @@ -2315,7 +2315,7 @@ static void test_transform(skiatest::Reporter* reporter) { p.transform(matrix, &p1); REPORTER_ASSERT(reporter, matrix.invert(&matrix)); - p1.transform(matrix, NULL); + p1.transform(matrix, nullptr); SkRect pBounds = p.getBounds(); SkRect p1Bounds = p1.getBounds(); REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fLeft, p1Bounds.fLeft)); @@ -3089,51 +3089,51 @@ static void test_oval(skiatest::Reporter* reporter) { rect = SkRect::MakeWH(SkIntToScalar(30), SkIntToScalar(50)); path.addOval(rect); - REPORTER_ASSERT(reporter, path.isOval(NULL)); + REPORTER_ASSERT(reporter, path.isOval(nullptr)); m.setRotate(SkIntToScalar(90)); SkPath tmp; path.transform(m, &tmp); // an oval rotated 90 degrees is still an oval. - REPORTER_ASSERT(reporter, tmp.isOval(NULL)); + REPORTER_ASSERT(reporter, tmp.isOval(nullptr)); m.reset(); m.setRotate(SkIntToScalar(30)); tmp.reset(); path.transform(m, &tmp); // an oval rotated 30 degrees is not an oval anymore. - REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); + REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); // since empty path being transformed. path.reset(); tmp.reset(); m.reset(); path.transform(m, &tmp); - REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); + REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); // empty path is not an oval tmp.reset(); - REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); + REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); // only has moveTo()s tmp.reset(); tmp.moveTo(0, 0); tmp.moveTo(SkIntToScalar(10), SkIntToScalar(10)); - REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); + REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); // mimic WebKit's calling convention, // call moveTo() first and then call addOval() path.reset(); path.moveTo(0, 0); path.addOval(rect); - REPORTER_ASSERT(reporter, path.isOval(NULL)); + REPORTER_ASSERT(reporter, path.isOval(nullptr)); // copy path path.reset(); tmp.reset(); tmp.addOval(rect); path = tmp; - REPORTER_ASSERT(reporter, path.isOval(NULL)); + REPORTER_ASSERT(reporter, path.isOval(nullptr)); } static void test_empty(skiatest::Reporter* reporter, const SkPath& p) { @@ -3204,7 +3204,7 @@ static void test_rrect(skiatest::Reporter* reporter) { p.addRRect(rr); bool closed; SkPath::Direction dir; - REPORTER_ASSERT(reporter, p.isRect(NULL, &closed, &dir)); + REPORTER_ASSERT(reporter, p.isRect(nullptr, &closed, &dir)); REPORTER_ASSERT(reporter, closed); REPORTER_ASSERT(reporter, SkPath::kCW_Direction == dir); test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction); @@ -3494,12 +3494,12 @@ static void test_get_point(skiatest::Reporter* reporter) { SkPath p; SkPoint pt = p.getPoint(0); REPORTER_ASSERT(reporter, pt == SkPoint::Make(0, 0)); - REPORTER_ASSERT(reporter, !p.getLastPt(NULL)); + REPORTER_ASSERT(reporter, !p.getLastPt(nullptr)); REPORTER_ASSERT(reporter, !p.getLastPt(&pt) && pt == SkPoint::Make(0, 0)); p.setLastPt(10, 10); pt = p.getPoint(0); REPORTER_ASSERT(reporter, pt == SkPoint::Make(10, 10)); - REPORTER_ASSERT(reporter, p.getLastPt(NULL)); + REPORTER_ASSERT(reporter, p.getLastPt(nullptr)); p.rMoveTo(10, 10); REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt == SkPoint::Make(20, 20)); } @@ -3615,7 +3615,7 @@ public: } { - SkScalar* weights = NULL; + SkScalar* weights = nullptr; ed.growForRepeatedVerb(SkPath::kConic_Verb, kRepeatCnt, &weights); REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs()); REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints()); @@ -3671,7 +3671,7 @@ static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool if (strlen(str) > 0) { REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str))); } else { - REPORTER_ASSERT(reporter, data->data() == NULL || !memcmp(data->data(), str, strlen(str))); + REPORTER_ASSERT(reporter, data->data() == nullptr || !memcmp(data->data(), str, strlen(str))); } } @@ -3842,8 +3842,8 @@ DEF_TEST(Paths, reporter) { REPORTER_ASSERT(reporter, !(p == empty)); // do getPoints and getVerbs return the right result - REPORTER_ASSERT(reporter, p.getPoints(NULL, 0) == 4); - REPORTER_ASSERT(reporter, p.getVerbs(NULL, 0) == 5); + REPORTER_ASSERT(reporter, p.getPoints(nullptr, 0) == 4); + REPORTER_ASSERT(reporter, p.getVerbs(nullptr, 0) == 5); SkPoint pts[4]; int count = p.getPoints(pts, 4); REPORTER_ASSERT(reporter, count == 4); @@ -3863,7 +3863,7 @@ DEF_TEST(Paths, reporter) { p.offset(SK_Scalar1*3, SK_Scalar1*4); REPORTER_ASSERT(reporter, bounds == p.getBounds()); - REPORTER_ASSERT(reporter, p.isRect(NULL)); + REPORTER_ASSERT(reporter, p.isRect(nullptr)); bounds2.setEmpty(); REPORTER_ASSERT(reporter, p.isRect(&bounds2)); REPORTER_ASSERT(reporter, bounds == bounds2); @@ -3871,7 +3871,7 @@ DEF_TEST(Paths, reporter) { // now force p to not be a rect bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2); p.addRect(bounds); - REPORTER_ASSERT(reporter, !p.isRect(NULL)); + REPORTER_ASSERT(reporter, !p.isRect(nullptr)); // Test an edge case w.r.t. the bound returned by isRect (i.e., the // path has a trailing moveTo. Please see crbug.com\445368) diff --git a/tests/PictureBBHTest.cpp b/tests/PictureBBHTest.cpp index d09403ff14..0a0d3da914 100644 --- a/tests/PictureBBHTest.cpp +++ b/tests/PictureBBHTest.cpp @@ -29,7 +29,7 @@ public: void run(skiatest::Reporter* reporter) { // No BBH - this->run(NULL, reporter); + this->run(nullptr, reporter); // With an R-Tree SkRTreeFactory RTreeFactory; diff --git a/tests/PictureShaderTest.cpp b/tests/PictureShaderTest.cpp index 113f4f86ee..14bdcf2d81 100644 --- a/tests/PictureShaderTest.cpp +++ b/tests/PictureShaderTest.cpp @@ -11,7 +11,7 @@ #include "SkShader.h" #include "Test.h" -// Test that attempting to create a picture shader with a NULL picture or +// Test that attempting to create a picture shader with a nullptr picture or // empty picture returns a shader that draws nothing. DEF_TEST(PictureShader_empty, reporter) { SkPaint paint; @@ -23,7 +23,7 @@ DEF_TEST(PictureShader_empty, reporter) { canvas.clear(SK_ColorGREEN); SkShader* shader = SkShader::CreatePictureShader( - NULL, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL); + nullptr, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr); paint.setShader(shader)->unref(); canvas.drawRect(SkRect::MakeWH(1,1), paint); @@ -31,10 +31,10 @@ DEF_TEST(PictureShader_empty, reporter) { SkPictureRecorder factory; - factory.beginRecording(0, 0, NULL, 0); + factory.beginRecording(0, 0, nullptr, 0); SkAutoTUnref<SkPicture> picture(factory.endRecording()); shader = SkShader::CreatePictureShader( - picture.get(), SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL); + picture.get(), SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr); paint.setShader(shader)->unref(); canvas.drawRect(SkRect::MakeWH(1,1), paint); diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index ce14213e82..de4d1e3e00 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -163,8 +163,8 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { SkAutoTUnref<SkPicture> picture(recorder.endRecording()); // path effects currently render an SkPicture undesireable for GPU rendering - const char *reason = NULL; - REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason)); + const char *reason = nullptr; + REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr, &reason)); REPORTER_ASSERT(reporter, reason); canvas = recorder.beginRecording(100, 100); @@ -187,7 +187,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { } picture.reset(recorder.endRecording()); // A lot of small AA concave paths should be fine for GPU rendering - REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr)); canvas = recorder.beginRecording(100, 100); { @@ -209,7 +209,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { } picture.reset(recorder.endRecording()); // A lot of large AA concave paths currently render an SkPicture undesireable for GPU rendering - REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr)); canvas = recorder.beginRecording(100, 100); { @@ -233,7 +233,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { } picture.reset(recorder.endRecording()); // hairline stroked AA concave paths are fine for GPU rendering - REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr)); canvas = recorder.beginRecording(100, 100); { @@ -250,7 +250,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { } picture.reset(recorder.endRecording()); // fast-path dashed effects are fine for GPU rendering ... - REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr)); canvas = recorder.beginRecording(100, 100); { @@ -265,7 +265,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { } picture.reset(recorder.endRecording()); // ... but only when applied to drawPoint() calls - REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr)); // Nest the previous picture inside a new one. canvas = recorder.beginRecording(100, 100); @@ -273,7 +273,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { canvas->drawPicture(picture.get()); } picture.reset(recorder.endRecording()); - REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL)); + REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr)); } #endif @@ -302,7 +302,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { &bbhFactory, SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag); - c->saveLayer(NULL, &complexPaint); + c->saveLayer(nullptr, &complexPaint); c->restore(); child.reset(recorder.endRecording()); @@ -337,11 +337,11 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { &bbhFactory, SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag); // 1) - c->saveLayer(NULL, &complexPaint); // layer #0 + c->saveLayer(nullptr, &complexPaint); // layer #0 c->restore(); // 2) - c->saveLayer(NULL, NULL); // layer #1 + c->saveLayer(nullptr, nullptr); // layer #1 c->translate(kWidth / 2.0f, kHeight / 2.0f); SkRect r = SkRect::MakeXYWH(0, 0, kWidth/2, kHeight/2); c->saveLayer(&r, &complexPaint); // layer #2 @@ -350,7 +350,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { // 3) { - c->saveLayer(NULL, &complexPaint); // layer #3 + c->saveLayer(nullptr, &complexPaint); // layer #3 c->restore(); } @@ -358,7 +358,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { layerPaint.setColor(SK_ColorRED); // Non-alpha only to avoid SaveLayerDrawRestoreNooper // 4) { - c->saveLayer(NULL, &layerPaint); // layer #4 + c->saveLayer(nullptr, &layerPaint); // layer #4 c->drawPicture(child); // layer #5 inside picture c->restore(); } @@ -368,7 +368,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { SkMatrix trans; trans.setTranslate(10, 10); - c->saveLayer(NULL, &layerPaint); // layer #6 + c->saveLayer(nullptr, &layerPaint); // layer #6 c->drawPicture(child, &trans, &picturePaint); // layer #7 inside picture c->restore(); } @@ -402,37 +402,37 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { const SkLayerInfo::BlockInfo& info6 = gpuData->block(7); const SkLayerInfo::BlockInfo& info7 = gpuData->block(6); - REPORTER_ASSERT(reporter, NULL == info0.fPicture); + REPORTER_ASSERT(reporter, nullptr == info0.fPicture); REPORTER_ASSERT(reporter, kWidth == info0.fBounds.width() && kHeight == info0.fBounds.height()); REPORTER_ASSERT(reporter, info0.fLocalMat.isIdentity()); REPORTER_ASSERT(reporter, info0.fPreMat.isIdentity()); REPORTER_ASSERT(reporter, 0 == info0.fBounds.fLeft && 0 == info0.fBounds.fTop); - REPORTER_ASSERT(reporter, NULL != info0.fPaint); + REPORTER_ASSERT(reporter, nullptr != info0.fPaint); REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayers); - REPORTER_ASSERT(reporter, NULL == info1.fPicture); + REPORTER_ASSERT(reporter, nullptr == info1.fPicture); REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.width() && kHeight/2.0 == info1.fBounds.height()); REPORTER_ASSERT(reporter, info1.fLocalMat.isIdentity()); REPORTER_ASSERT(reporter, info1.fPreMat.isIdentity()); REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.fLeft && kHeight/2.0 == info1.fBounds.fTop); - REPORTER_ASSERT(reporter, NULL == info1.fPaint); + REPORTER_ASSERT(reporter, nullptr == info1.fPaint); REPORTER_ASSERT(reporter, !info1.fIsNested && info1.fHasNestedLayers); // has a nested SL - REPORTER_ASSERT(reporter, NULL == info2.fPicture); + REPORTER_ASSERT(reporter, nullptr == info2.fPicture); REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.width() && kHeight / 2 == info2.fBounds.height()); // bound reduces size REPORTER_ASSERT(reporter, !info2.fLocalMat.isIdentity()); REPORTER_ASSERT(reporter, info2.fPreMat.isIdentity()); REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.fLeft && // translated kHeight / 2 == info2.fBounds.fTop); - REPORTER_ASSERT(reporter, NULL != info2.fPaint); + REPORTER_ASSERT(reporter, nullptr != info2.fPaint); REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers); // is nested - REPORTER_ASSERT(reporter, NULL == info3.fPicture); + REPORTER_ASSERT(reporter, nullptr == info3.fPicture); REPORTER_ASSERT(reporter, kWidth == info3.fBounds.width() && kHeight == info3.fBounds.height()); REPORTER_ASSERT(reporter, info3.fLocalMat.isIdentity()); @@ -441,7 +441,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, info3.fPaint); REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayers); - REPORTER_ASSERT(reporter, NULL == info4.fPicture); + REPORTER_ASSERT(reporter, nullptr == info4.fPicture); REPORTER_ASSERT(reporter, kWidth == info4.fBounds.width() && kHeight == info4.fBounds.height()); REPORTER_ASSERT(reporter, 0 == info4.fBounds.fLeft && 0 == info4.fBounds.fTop); @@ -457,10 +457,10 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 0 == info5.fBounds.fLeft && 0 == info5.fBounds.fTop); REPORTER_ASSERT(reporter, info5.fLocalMat.isIdentity()); REPORTER_ASSERT(reporter, info5.fPreMat.isIdentity()); - REPORTER_ASSERT(reporter, NULL != info5.fPaint); + REPORTER_ASSERT(reporter, nullptr != info5.fPaint); REPORTER_ASSERT(reporter, info5.fIsNested && !info5.fHasNestedLayers); // is nested - REPORTER_ASSERT(reporter, NULL == info6.fPicture); + REPORTER_ASSERT(reporter, nullptr == info6.fPicture); REPORTER_ASSERT(reporter, kWidth-10 == info6.fBounds.width() && kHeight-10 == info6.fBounds.height()); REPORTER_ASSERT(reporter, 10 == info6.fBounds.fLeft && 10 == info6.fBounds.fTop); @@ -476,7 +476,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 0 == info7.fBounds.fLeft && 0 == info7.fBounds.fTop); REPORTER_ASSERT(reporter, info7.fLocalMat.isIdentity()); REPORTER_ASSERT(reporter, info7.fPreMat.isIdentity()); - REPORTER_ASSERT(reporter, NULL != info7.fPaint); + REPORTER_ASSERT(reporter, nullptr != info7.fPaint); REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers); // is nested } } @@ -530,7 +530,7 @@ static void test_has_text(skiatest::Reporter* reporter) { path.moveTo(0, 0); path.lineTo(50, 50); - canvas->drawTextOnPath("Q", 1, path, NULL, SkPaint()); + canvas->drawTextOnPath("Q", 1, path, nullptr, SkPaint()); } picture.reset(recorder.endRecording()); REPORTER_ASSERT(reporter, picture->hasText()); @@ -668,14 +668,14 @@ DEF_TEST(PictureRecorder_replay, reporter) { SkCanvas* canvas = recorder.beginRecording(10, 10); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); SkAutoTUnref<SkPicture> copy(SkPictureRecorderReplayTester::Copy(&recorder)); // The extra save and restore comes from the Copy process. check_save_state(reporter, copy, 2, 1, 3); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); SkAutoTUnref<SkPicture> final(recorder.endRecording()); @@ -719,7 +719,7 @@ DEF_TEST(PictureRecorder_replay, reporter) { { SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(4, 3, NULL, 0); + SkCanvas* canvas = recorder.beginRecording(4, 3, nullptr, 0); create_imbalance(canvas); int expectedSaveCount = canvas->getSaveCount(); @@ -904,10 +904,10 @@ static void test_bitmap_with_encoded_data(skiatest::Reporter* reporter) { SkSetErrorCallback(assert_one_parse_error_cb, &context); SkMemoryStream pictureStream(picture1); SkClearLastError(); - SkAutoTUnref<SkPicture> pictureFromStream(SkPicture::CreateFromStream(&pictureStream, NULL)); - REPORTER_ASSERT(reporter, pictureFromStream.get() != NULL); + SkAutoTUnref<SkPicture> pictureFromStream(SkPicture::CreateFromStream(&pictureStream, nullptr)); + REPORTER_ASSERT(reporter, pictureFromStream.get() != nullptr); SkClearLastError(); - SkSetErrorCallback(NULL, NULL); + SkSetErrorCallback(nullptr, nullptr); } static void test_clip_bound_opt(skiatest::Reporter* reporter) { @@ -1331,7 +1331,7 @@ DEF_TEST(Picture_BitmapLeak, r) { REPORTER_ASSERT(r, !immut.pixelRef()->unique()); // When the picture goes away, it's just our bitmaps holding the refs. - pic.reset(NULL); + pic.reset(nullptr); REPORTER_ASSERT(r, mut.pixelRef()->unique()); REPORTER_ASSERT(r, immut.pixelRef()->unique()); } diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp index 775354c83d..01e2ce5c0b 100644 --- a/tests/PixelRefTest.cpp +++ b/tests/PixelRefTest.cpp @@ -23,21 +23,21 @@ static void test_dont_leak_install(skiatest::Reporter* reporter) { info = SkImageInfo::MakeN32Premul(0, 0); release_counter = 1; - success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter); + success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter); REPORTER_ASSERT(reporter, true == success); bm.reset(); REPORTER_ASSERT(reporter, 0 == release_counter); info = SkImageInfo::MakeN32Premul(10, 10); release_counter = 1; - success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter); + success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter); REPORTER_ASSERT(reporter, true == success); bm.reset(); REPORTER_ASSERT(reporter, 0 == release_counter); info = SkImageInfo::MakeN32Premul(-10, -10); release_counter = 1; - success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter); + success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter); REPORTER_ASSERT(reporter, false == success); bm.reset(); REPORTER_ASSERT(reporter, 0 == release_counter); @@ -48,12 +48,12 @@ static void test_install(skiatest::Reporter* reporter) { SkImageInfo info = SkImageInfo::MakeN32Premul(0, 0); SkBitmap bm; // make sure we don't assert on an empty install - success = bm.installPixels(info, NULL, 0); + success = bm.installPixels(info, nullptr, 0); REPORTER_ASSERT(reporter, success); // no pixels should be the same as setInfo() info = SkImageInfo::MakeN32Premul(10, 10); - success = bm.installPixels(info, NULL, 0); + success = bm.installPixels(info, nullptr, 0); REPORTER_ASSERT(reporter, success); } @@ -69,7 +69,7 @@ private: DEF_TEST(PixelRef_GenIDChange, r) { SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10); - SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, NULL)); + SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr)); // Register a listener. int count = 0; @@ -94,9 +94,9 @@ DEF_TEST(PixelRef_GenIDChange, r) { pixelRef->notifyPixelsChanged(); REPORTER_ASSERT(r, 1 == count); - // Quick check that NULL is safe. + // Quick check that nullptr is safe. REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID()); - pixelRef->addGenIDChangeListener(NULL); + pixelRef->addGenIDChangeListener(nullptr); pixelRef->notifyPixelsChanged(); test_install(r); diff --git a/tests/PointTest.cpp b/tests/PointTest.cpp index 08ce7208eb..84ea865827 100644 --- a/tests/PointTest.cpp +++ b/tests/PointTest.cpp @@ -74,7 +74,7 @@ static float force_as_float(skiatest::Reporter* reporter, float value) { // even the pair of memcpy calls are not sufficient, since those seem to // be no-op'd, so we add a runtime tests (just like get_value) to force // the compiler to give us an actual float. - if (NULL == reporter) { + if (nullptr == reporter) { storage = ~storage; } memcpy(&value, &storage, 4); diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp index e230f11025..211006ad21 100644 --- a/tests/PremulAlphaRoundTripTest.cpp +++ b/tests/PremulAlphaRoundTripTest.cpp @@ -87,7 +87,7 @@ DEF_GPUTEST(PremulAlphaRoundTrip, reporter, factory) { continue; } GrContext* ctx = factory->get(type); - if (NULL == ctx) { + if (nullptr == ctx) { continue; } device.reset(SkGpuDevice::Create(ctx, SkSurface::kNo_Budgeted, info, 0, &props, diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp index c17aae9e6e..7eb80f1712 100644 --- a/tests/QuickRejectTest.cpp +++ b/tests/QuickRejectTest.cpp @@ -98,7 +98,7 @@ static void test_layers(skiatest::Reporter* reporter) { // Test that saveLayer updates quickReject SkRect bounds = SkRect::MakeLTRB(50, 50, 70, 70); - canvas.saveLayer(&bounds, NULL); + canvas.saveLayer(&bounds, nullptr); REPORTER_ASSERT(reporter, true == canvas.quickReject(SkRect::MakeWH(10, 10))); REPORTER_ASSERT(reporter, false == canvas.quickReject(SkRect::MakeWH(60, 60))); } diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index b94be0eba8..09d6211024 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -328,7 +328,7 @@ DEF_GPUTEST(ReadPixels, reporter, factory) { continue; } GrContext* context = factory->get(type); - if (NULL == context) { + if (nullptr == context) { continue; } GrSurfaceDesc desc; diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index a767068622..301bf6b78e 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -23,7 +23,7 @@ DEF_GPUTEST(ReadWriteAlpha, reporter, factory) { continue; } GrContext* context = factory->get(glType); - if (NULL == context) { + if (nullptr == context) { continue; } diff --git a/tests/Reader32Test.cpp b/tests/Reader32Test.cpp index cfa08b3c1f..c49e57c330 100644 --- a/tests/Reader32Test.cpp +++ b/tests/Reader32Test.cpp @@ -35,8 +35,8 @@ static void assert_empty(skiatest::Reporter* reporter, const SkReader32& reader) DEF_TEST(Reader32, reporter) { SkReader32 reader; assert_empty(reporter, reader); - REPORTER_ASSERT(reporter, NULL == reader.base()); - REPORTER_ASSERT(reporter, NULL == reader.peek()); + REPORTER_ASSERT(reporter, nullptr == reader.base()); + REPORTER_ASSERT(reporter, nullptr == reader.peek()); size_t i; @@ -74,8 +74,8 @@ DEF_TEST(Reader32, reporter) { reader.read(buffer, sizeof(data2)); REPORTER_ASSERT(reporter, !memcmp(data2, buffer, sizeof(data2))); - reader.setMemory(NULL, 0); + reader.setMemory(nullptr, 0); assert_empty(reporter, reader); - REPORTER_ASSERT(reporter, NULL == reader.base()); - REPORTER_ASSERT(reporter, NULL == reader.peek()); + REPORTER_ASSERT(reporter, nullptr == reader.base()); + REPORTER_ASSERT(reporter, nullptr == reader.peek()); } diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp index 84ceb20f54..d8ca48d796 100644 --- a/tests/RecordDrawTest.cpp +++ b/tests/RecordDrawTest.cpp @@ -67,7 +67,7 @@ DEF_TEST(RecordDraw_Abort, r) { SkRecorder canvas(&rerecord, W, H); JustOneDraw callback; - SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, &callback); + SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr/*bbh*/, &callback); REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord)); REPORTER_ASSERT(r, 0 == count_instances_of_type<SkRecords::ClipRect>(rerecord)); @@ -81,7 +81,7 @@ DEF_TEST(RecordDraw_Unbalanced, r) { SkRecord rerecord; SkRecorder canvas(&rerecord, W, H); - SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, NULL/*callback*/); + SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr/*bbh*/, nullptr/*callback*/); int save_count = count_instances_of_type<SkRecords::Save>(rerecord); int restore_count = count_instances_of_type<SkRecords::Save>(rerecord); @@ -103,7 +103,7 @@ DEF_TEST(RecordDraw_SetMatrixClobber, r) { translate.setTranslate(20, 20); translateCanvas.setMatrix(translate); - SkRecordDraw(scaleRecord, &translateCanvas, NULL, NULL, 0, NULL/*bbh*/, NULL/*callback*/); + SkRecordDraw(scaleRecord, &translateCanvas, nullptr, nullptr, 0, nullptr/*bbh*/, nullptr/*callback*/); REPORTER_ASSERT(r, 4 == translateRecord.count()); assert_type<SkRecords::SetMatrix>(r, translateRecord, 0); assert_type<SkRecords::Save> (r, translateRecord, 1); @@ -215,7 +215,7 @@ DEF_TEST(RecordDraw_PartialStartStop, r) { SkRecord rerecord; SkRecorder canvas(&rerecord, kWidth, kHeight); - SkRecordPartialDraw(record, &canvas, NULL, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2 + SkRecordPartialDraw(record, &canvas, nullptr, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2 REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord)); int index = find_first_instances_of_type<SkRecords::DrawRect>(rerecord); @@ -238,7 +238,7 @@ DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) { paint.setImageFilter(SkDropShadowImageFilter::Create(20, 0, 0, 0, SK_ColorBLACK, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode))->unref(); - recorder.saveLayer(NULL, &paint); + recorder.saveLayer(nullptr, &paint); recorder.clipRect(SkRect::MakeWH(20, 40)); recorder.drawRect(SkRect::MakeWH(20, 40), SkPaint()); recorder.restore(); @@ -317,7 +317,7 @@ DEF_TEST(RecordDraw_drawImage, r){ SkRecord record; SkRecorder recorder(&record, 10, 10); recorder.drawImage(image, 0, 0); - SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); + SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); } REPORTER_ASSERT(r, canvas.fDrawImageCalled); canvas.resetTestValues(); @@ -326,7 +326,7 @@ DEF_TEST(RecordDraw_drawImage, r){ SkRecord record; SkRecorder recorder(&record, 10, 10); recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); - SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); + SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); } REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp index 25102c4fc8..dd6c410ed4 100644 --- a/tests/RecordOptsTest.cpp +++ b/tests/RecordOptsTest.cpp @@ -77,7 +77,7 @@ DEF_TEST(RecordOpts_SaveSaveLayerRestoreRestore, r) { // A previous bug NoOp'd away the first 3 commands. recorder.save(); - recorder.saveLayer(NULL, NULL); + recorder.saveLayer(nullptr, nullptr); recorder.restore(); recorder.restore(); @@ -131,13 +131,13 @@ DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) { translucentDrawPaint.setColor(0x0F020202); // Not opaque. // SaveLayer/Restore removed: No paint = no point. - recorder.saveLayer(NULL, NULL); + recorder.saveLayer(nullptr, nullptr); recorder.drawRect(draw, opaqueDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 0, true); // Bounds don't matter. - recorder.saveLayer(&bounds, NULL); + recorder.saveLayer(&bounds, nullptr); recorder.drawRect(draw, opaqueDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 3, true); @@ -145,31 +145,31 @@ DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) { // TODO(mtklein): test case with null draw paint // No change: layer paint isn't alpha-only. - recorder.saveLayer(NULL, &translucentLayerPaint); + recorder.saveLayer(nullptr, &translucentLayerPaint); recorder.drawRect(draw, opaqueDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 6, false); // No change: layer paint has an effect. - recorder.saveLayer(NULL, &xfermodeLayerPaint); + recorder.saveLayer(nullptr, &xfermodeLayerPaint); recorder.drawRect(draw, opaqueDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 9, false); // SaveLayer/Restore removed: we can fold in the alpha! - recorder.saveLayer(NULL, &alphaOnlyLayerPaint); + recorder.saveLayer(nullptr, &alphaOnlyLayerPaint); recorder.drawRect(draw, translucentDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 12, true); // SaveLayer/Restore removed: we can fold in the alpha! - recorder.saveLayer(NULL, &alphaOnlyLayerPaint); + recorder.saveLayer(nullptr, &alphaOnlyLayerPaint); recorder.drawRect(draw, opaqueDrawPaint); recorder.restore(); assert_savelayer_restore(r, &record, 15, true); const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, record, 16); - REPORTER_ASSERT(r, drawRect != NULL); + REPORTER_ASSERT(r, drawRect != nullptr); REPORTER_ASSERT(r, drawRect->paint.getColor() == 0x03020202); } @@ -223,9 +223,9 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) { { // Any combination of these should cause the pattern to be optimized. - SkRect* firstBounds[] = { NULL, &bounds }; - SkPaint* firstPaints[] = { NULL, &alphaOnlyLayerPaint }; - SkRect* secondBounds[] = { NULL, &bounds }; + SkRect* firstBounds[] = { nullptr, &bounds }; + SkPaint* firstPaints[] = { nullptr, &alphaOnlyLayerPaint }; + SkRect* secondBounds[] = { nullptr, &bounds }; SkPaint* secondPaints[] = { &opaqueFilterLayerPaint, &translucentFilterLayerPaint }; for (size_t i = 0; i < SK_ARRAY_COUNT(firstBounds); ++ i) { @@ -252,8 +252,8 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) { SkPaint* firstPaint; SkPaint* secondPaint; } noChangeTests[] = { - // No change: NULL filter layer paint not implemented. - { &alphaOnlyLayerPaint, NULL }, + // No change: nullptr filter layer paint not implemented. + { &alphaOnlyLayerPaint, nullptr }, // No change: layer paint is not alpha-only. { &translucentLayerPaint, &opaqueFilterLayerPaint }, // No change: layer paint has an xfereffect. @@ -268,10 +268,10 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) { }; for (size_t i = 0; i < SK_ARRAY_COUNT(noChangeTests); ++i) { - recorder.saveLayer(NULL, noChangeTests[i].firstPaint); + recorder.saveLayer(nullptr, noChangeTests[i].firstPaint); recorder.save(); recorder.clipRect(clip); - recorder.saveLayer(NULL, noChangeTests[i].secondPaint); + recorder.saveLayer(nullptr, noChangeTests[i].secondPaint); recorder.restore(); recorder.restore(); recorder.restore(); @@ -280,25 +280,25 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) { } // Test the folded alpha value. - recorder.saveLayer(NULL, &alphaOnlyLayerPaint); + recorder.saveLayer(nullptr, &alphaOnlyLayerPaint); recorder.save(); recorder.clipRect(clip); - recorder.saveLayer(NULL, &opaqueFilterLayerPaint); + recorder.saveLayer(nullptr, &opaqueFilterLayerPaint); recorder.restore(); recorder.restore(); recorder.restore(); assert_merge_svg_opacity_and_filter_layers(r, &record, index, true); const SkRecords::SaveLayer* saveLayer = assert_type<SkRecords::SaveLayer>(r, record, index + 3); - REPORTER_ASSERT(r, saveLayer != NULL); + REPORTER_ASSERT(r, saveLayer != nullptr); REPORTER_ASSERT(r, saveLayer->paint->getColor() == 0x03020202); index += 7; // Test that currently we do not fold alphas for patterns without the clip. This is just not // implemented. - recorder.saveLayer(NULL, &alphaOnlyLayerPaint); - recorder.saveLayer(NULL, &opaqueFilterLayerPaint); + recorder.saveLayer(nullptr, &alphaOnlyLayerPaint); + recorder.saveLayer(nullptr, &opaqueFilterLayerPaint); recorder.restore(); recorder.restore(); SkRecordMergeSvgOpacityAndFilterLayers(&record); diff --git a/tests/RecordPatternTest.cpp b/tests/RecordPatternTest.cpp index b88165d6f3..d1e48bb838 100644 --- a/tests/RecordPatternTest.cpp +++ b/tests/RecordPatternTest.cpp @@ -35,9 +35,9 @@ DEF_TEST(RecordPattern_Simple, r) { recorder.restore(); REPORTER_ASSERT(r, pattern.match(&record, 0)); - REPORTER_ASSERT(r, pattern.first<Save>() != NULL); - REPORTER_ASSERT(r, pattern.second<ClipRect>() != NULL); - REPORTER_ASSERT(r, pattern.third<Restore>() != NULL); + REPORTER_ASSERT(r, pattern.first<Save>() != nullptr); + REPORTER_ASSERT(r, pattern.second<ClipRect>() != nullptr); + REPORTER_ASSERT(r, pattern.third<Restore>() != nullptr); } DEF_TEST(RecordPattern_StartingIndex, r) { @@ -146,7 +146,7 @@ DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) { SkRecord record; SkRecorder recorder(&record, 1920, 1200); - recorder.saveLayer(NULL, NULL); + recorder.saveLayer(nullptr, nullptr); REPORTER_ASSERT(r, !pattern.match(&record, 0)); } diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp index 8c45ee14dd..3074cfdc13 100644 --- a/tests/RecordReplaceDrawTest.cpp +++ b/tests/RecordReplaceDrawTest.cpp @@ -50,7 +50,7 @@ DEF_TEST(RecordReplaceDraw_Abort, r) { SkRecorder canvas(&rerecord, kWidth, kHeight); JustOneDraw callback; - GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), &callback); + GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), &callback); switch (rerecord.count()) { case 3: @@ -83,7 +83,7 @@ DEF_TEST(RecordReplaceDraw_Unbalanced, r) { SkRecord rerecord; SkRecorder canvas(&rerecord, kWidth, kHeight); - GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), NULL/*callback*/); + GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), nullptr/*callback*/); // ensure rerecord is balanced (in this case by checking that the count is odd) REPORTER_ASSERT(r, (rerecord.count() & 1) == 1); @@ -97,10 +97,10 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) { SkRTreeFactory bbhFactory; SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntToScalar(kHeight), - useBBH ? &bbhFactory : NULL); + useBBH ? &bbhFactory : nullptr); SkPaint paint; - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); canvas->clear(SK_ColorRED); canvas->restore(); canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth / 2), SkIntToScalar(kHeight / 2)), @@ -125,14 +125,14 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) { desc.fSampleCnt = 0; SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, - false, NULL, 0)); + false, nullptr, 0)); layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight)); SkAutoTUnref<SkBBoxHierarchy> bbh; SkRecord rerecord; SkRecorder canvas(&rerecord, kWidth, kHeight); - GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), NULL/*callback*/); + GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callback*/); int recount = rerecord.count(); REPORTER_ASSERT(r, 2 == recount || 4 == recount); @@ -156,7 +156,7 @@ DEF_GPUTEST(RecordReplaceDraw, r, factory) { continue; } GrContext* context = factory->get(glType); - if (NULL == context) { + if (nullptr == context) { continue; } diff --git a/tests/RecordTestUtils.h b/tests/RecordTestUtils.h index 8243089e5d..e4421fab52 100644 --- a/tests/RecordTestUtils.h +++ b/tests/RecordTestUtils.h @@ -11,10 +11,10 @@ #include "SkRecord.h" #include "SkRecords.h" -// If the command we're reading is a U, set ptr to it, otherwise set it to NULL. +// If the command we're reading is a U, set ptr to it, otherwise set it to nullptr. template <typename U> struct ReadAs { - ReadAs() : ptr(NULL), type(SkRecords::Type(~0)) {} + ReadAs() : ptr(nullptr), type(SkRecords::Type(~0)) {} const U* ptr; SkRecords::Type type; diff --git a/tests/RecordingXfermodeTest.cpp b/tests/RecordingXfermodeTest.cpp index 7c234ada4c..05af84c377 100644 --- a/tests/RecordingXfermodeTest.cpp +++ b/tests/RecordingXfermodeTest.cpp @@ -50,9 +50,9 @@ class Drawer { canvas->clipRect(clipRect); canvas->clear(0xff000000); - canvas->saveLayer(NULL, &blackPaint); + canvas->saveLayer(nullptr, &blackPaint); canvas->drawRect(canvasRect, greenPaint); - canvas->saveLayer(NULL, &layerPaint); + canvas->saveLayer(nullptr, &layerPaint); canvas->drawBitmapRect(fCircleBM, SkRect::MakeXYWH(20,20,60,60), &blackPaint); canvas->restore(); canvas->restore(); diff --git a/tests/RefDictTest.cpp b/tests/RefDictTest.cpp index 469026ebc9..af30f86148 100644 --- a/tests/RefDictTest.cpp +++ b/tests/RefDictTest.cpp @@ -19,9 +19,9 @@ DEF_TEST(RefDict, reporter) { TestRC data0, data1; SkRefDict dict; - REPORTER_ASSERT(reporter, NULL == dict.find(NULL)); - REPORTER_ASSERT(reporter, NULL == dict.find("foo")); - REPORTER_ASSERT(reporter, NULL == dict.find("bar")); + REPORTER_ASSERT(reporter, nullptr == dict.find(nullptr)); + REPORTER_ASSERT(reporter, nullptr == dict.find("foo")); + REPORTER_ASSERT(reporter, nullptr == dict.find("bar")); dict.set("foo", &data0); REPORTER_ASSERT(reporter, &data0 == dict.find("foo")); @@ -36,8 +36,8 @@ DEF_TEST(RefDict, reporter) { REPORTER_ASSERT(reporter, data0.unique()); REPORTER_ASSERT(reporter, !data1.unique()); - dict.set("foo", NULL); - REPORTER_ASSERT(reporter, NULL == dict.find("foo")); + dict.set("foo", nullptr); + REPORTER_ASSERT(reporter, nullptr == dict.find("foo")); REPORTER_ASSERT(reporter, data0.unique()); REPORTER_ASSERT(reporter, data1.unique()); @@ -55,14 +55,14 @@ DEF_TEST(RefDict, reporter) { REPORTER_ASSERT(reporter, !data1.unique()); dict.removeAll(); - REPORTER_ASSERT(reporter, NULL == dict.find("foo")); - REPORTER_ASSERT(reporter, NULL == dict.find("bar")); + REPORTER_ASSERT(reporter, nullptr == dict.find("foo")); + REPORTER_ASSERT(reporter, nullptr == dict.find("bar")); REPORTER_ASSERT(reporter, data0.unique()); REPORTER_ASSERT(reporter, data1.unique()); { SkRefDict d; - REPORTER_ASSERT(reporter, NULL == d.find("foo")); + REPORTER_ASSERT(reporter, nullptr == d.find("foo")); REPORTER_ASSERT(reporter, data0.unique()); d.set("foo", &data0); REPORTER_ASSERT(reporter, &data0 == d.find("foo")); diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp index 121f16d6ec..4a96056419 100644 --- a/tests/RegionTest.cpp +++ b/tests/RegionTest.cpp @@ -266,7 +266,7 @@ DEF_TEST(Region, reporter) { // Test that writeToMemory reports the same number of bytes whether there was a // buffer to write to or not. static void test_write(const SkRegion& region, skiatest::Reporter* r) { - const size_t bytesNeeded = region.writeToMemory(NULL); + const size_t bytesNeeded = region.writeToMemory(nullptr); SkAutoMalloc storage(bytesNeeded); const size_t bytesWritten = region.writeToMemory(storage.get()); REPORTER_ASSERT(r, bytesWritten == bytesNeeded); diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index dff96f9213..d76da31920 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -38,7 +38,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanva size_t srcSize = src.getSize(); size_t initialCacheSize; - context->getResourceCacheUsage(NULL, &initialCacheSize); + context->getResourceCacheUsage(nullptr, &initialCacheSize); int oldMaxNum; size_t oldMaxBytes; @@ -60,7 +60,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanva src.notifyPixelsChanged(); size_t curCacheSize; - context->getResourceCacheUsage(NULL, &curCacheSize); + context->getResourceCacheUsage(nullptr, &curCacheSize); // we should never go over the size limit REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize); @@ -185,8 +185,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont static const int kW = 100; static const int kH = 100; - texIDs[0] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig); - texIDs[1] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig); + texIDs[0] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig); + texIDs[1] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig); context->resetContext(); @@ -208,8 +208,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont return; } - borrowed.reset(NULL); - adopted.reset(NULL); + borrowed.reset(nullptr); + adopted.reset(nullptr); context->flush(); @@ -235,7 +235,7 @@ public: TestResource(GrGpu* gpu, size_t size, GrGpuResource::LifeCycle lifeCycle) : INHERITED(gpu, lifeCycle) - , fToDelete(NULL) + , fToDelete(nullptr) , fSize(size) , fProperty(kA_SimulatedProperty) { ++fNumAlive; @@ -244,7 +244,7 @@ public: TestResource(GrGpu* gpu, GrGpuResource::LifeCycle lifeCycle) : INHERITED(gpu, lifeCycle) - , fToDelete(NULL) + , fToDelete(nullptr) , fSize(kDefaultSize) , fProperty(kA_SimulatedProperty) { ++fNumAlive; @@ -253,7 +253,7 @@ public: TestResource(GrGpu* gpu) : INHERITED(gpu, kCached_LifeCycle) - , fToDelete(NULL) + , fToDelete(nullptr) , fSize(kDefaultSize) , fProperty(kA_SimulatedProperty) { ++fNumAlive; @@ -297,7 +297,7 @@ private: TestResource(GrGpu* gpu, SimulatedProperty property, bool cached, ScratchConstructor) : INHERITED(gpu, cached ? kCached_LifeCycle : kUncached_LifeCycle) - , fToDelete(NULL) + , fToDelete(nullptr) , fSize(kDefaultSize) , fProperty(property) { GrScratchKey scratchKey; @@ -417,7 +417,7 @@ static void test_budgeting(skiatest::Reporter* reporter) { GrUniqueKey uniqueKey2; make_unique_key<0>(&uniqueKey2, 1); wrapped->resourcePriv().setUniqueKey(uniqueKey2); - REPORTER_ASSERT(reporter, NULL == cache->findAndRefUniqueResource(uniqueKey2)); + REPORTER_ASSERT(reporter, nullptr == cache->findAndRefUniqueResource(uniqueKey2)); // Make sure sizes are as we expect REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); @@ -557,7 +557,7 @@ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key); REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch()); REPORTER_ASSERT(reporter, !resource->resourcePriv().isBudgeted()); - REPORTER_ASSERT(reporter, NULL == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0)); + REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0)); REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); @@ -615,7 +615,7 @@ static void test_duplicate_scratch_key(skiatest::Reporter* reporter) { GrScratchKey scratchKey1; TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey1); // Check for negative case consistency. (leaks upon test failure.) - REPORTER_ASSERT(reporter, NULL == cache->findAndRefScratchResource(scratchKey1, TestResource::kDefaultSize, 0)); + REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(scratchKey1, TestResource::kDefaultSize, 0)); GrScratchKey scratchKey; TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey); @@ -662,7 +662,7 @@ static void test_remove_scratch_key(skiatest::Reporter* reporter) { // Ensure that scratch key lookup is correct for negative case. TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey); // (following leaks upon test failure). - REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == NULL); + REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr); // Scratch resources are registered with GrResourceCache just by existing. There are 2. TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey); @@ -742,21 +742,21 @@ static void test_scratch_key_consistency(skiatest::Reporter* reporter) { // Ensure that scratch key lookup is correct for negative case. TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey); // (following leaks upon test failure). - REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == NULL); + REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr); // Find the first resource with a scratch key and a copy of a scratch key. TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey); GrGpuResource* find = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0); - REPORTER_ASSERT(reporter, find != NULL); + REPORTER_ASSERT(reporter, find != nullptr); find->unref(); scratchKey2 = scratchKey; find = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0); - REPORTER_ASSERT(reporter, find != NULL); + REPORTER_ASSERT(reporter, find != nullptr); REPORTER_ASSERT(reporter, find == a || find == b); GrGpuResource* find2 = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0); - REPORTER_ASSERT(reporter, find2 != NULL); + REPORTER_ASSERT(reporter, find2 != nullptr); REPORTER_ASSERT(reporter, find2 == a || find2 == b); REPORTER_ASSERT(reporter, find2 != find); find2->unref(); @@ -956,7 +956,7 @@ static void test_cache_chained_purge(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); // Break the cycle - a->setUnrefWhenDestroyed(NULL); + a->setUnrefWhenDestroyed(nullptr); REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); cache->purgeAllUnlocked(); @@ -1080,9 +1080,9 @@ static void test_timestamp_wrap(skiatest::Reporter* reporter) { if (currShouldPurgeIdx < shouldPurgeIdxs.count() && shouldPurgeIdxs[currShouldPurgeIdx] == j) { ++currShouldPurgeIdx; - REPORTER_ASSERT(reporter, NULL == res); + REPORTER_ASSERT(reporter, nullptr == res); } else { - REPORTER_ASSERT(reporter, NULL != res); + REPORTER_ASSERT(reporter, nullptr != res); } SkSafeUnref(res); } @@ -1257,7 +1257,7 @@ DEF_GPUTEST(ResourceCache, reporter, factory) { continue; } GrContext* context = factory->get(glType); - if (NULL == context) { + if (nullptr == context) { continue; } GrSurfaceDesc desc; diff --git a/tests/SVGDeviceTest.cpp b/tests/SVGDeviceTest.cpp index c973f8b15f..494efbb3e7 100644 --- a/tests/SVGDeviceTest.cpp +++ b/tests/SVGDeviceTest.cpp @@ -24,21 +24,21 @@ void check_text_node(skiatest::Reporter* reporter, const SkPoint& offset, unsigned scalarsPerPos, const char* expected) { - if (root == NULL) { + if (root == nullptr) { ERRORF(reporter, "root element not found."); return; } const SkDOM::Node* textElem = dom.getFirstChild(root, "text"); - if (textElem == NULL) { + if (textElem == nullptr) { ERRORF(reporter, "<text> element not found."); return; } REPORTER_ASSERT(reporter, dom.getType(textElem) == SkDOM::kElement_Type); const SkDOM::Node* textNode= dom.getFirstChild(textElem); - REPORTER_ASSERT(reporter, textNode != NULL); - if (textNode != NULL) { + REPORTER_ASSERT(reporter, textNode != nullptr); + if (textNode != nullptr) { REPORTER_ASSERT(reporter, dom.getType(textNode) == SkDOM::kText_Type); REPORTER_ASSERT(reporter, strcmp(expected, dom.getName(textNode)) == 0); } @@ -46,8 +46,8 @@ void check_text_node(skiatest::Reporter* reporter, int textLen = SkToInt(strlen(expected)); const char* x = dom.findAttr(textElem, "x"); - REPORTER_ASSERT(reporter, x != NULL); - if (x != NULL) { + REPORTER_ASSERT(reporter, x != nullptr); + if (x != nullptr) { int xposCount = (scalarsPerPos < 1) ? 1 : textLen; REPORTER_ASSERT(reporter, SkParse::Count(x) == xposCount); @@ -63,8 +63,8 @@ void check_text_node(skiatest::Reporter* reporter, } const char* y = dom.findAttr(textElem, "y"); - REPORTER_ASSERT(reporter, y != NULL); - if (y != NULL) { + REPORTER_ASSERT(reporter, y != nullptr); + if (y != nullptr) { int yposCount = (scalarsPerPos < 2) ? 1 : textLen; REPORTER_ASSERT(reporter, SkParse::Count(y) == yposCount); diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index 31dbbe8ad9..01e90d898b 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -186,15 +186,15 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed, // Make sure this fails when it should (test with smaller size, but still multiple of 4) SkValidatingReadBuffer buffer(dataWritten, bytesWritten - 4); - T* obj = NULL; + T* obj = nullptr; SerializationUtils<T>::Read(buffer, &obj); REPORTER_ASSERT(reporter, !buffer.isValid()); - REPORTER_ASSERT(reporter, NULL == obj); + REPORTER_ASSERT(reporter, nullptr == obj); // Make sure this succeeds when it should SkValidatingReadBuffer buffer2(dataWritten, bytesWritten); const unsigned char* peekBefore = static_cast<const unsigned char*>(buffer2.skip(0)); - T* obj2 = NULL; + T* obj2 = nullptr; SerializationUtils<T>::Read(buffer2, &obj2); const unsigned char* peekAfter = static_cast<const unsigned char*>(buffer2.skip(0)); if (shouldSucceed) { @@ -205,7 +205,7 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed, } else { // If the deserialization was supposed to fail, make sure it did REPORTER_ASSERT(reporter, !buffer.isValid()); - REPORTER_ASSERT(reporter, NULL == obj2); + REPORTER_ASSERT(reporter, nullptr == obj2); } return obj2; // Return object to perform further validity tests on it @@ -267,7 +267,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap, static void TestXfermodeSerialization(skiatest::Reporter* reporter) { for (size_t i = 0; i <= SkXfermode::kLastMode; ++i) { if (i == SkXfermode::kSrcOver_Mode) { - // skip SrcOver, as it is allowed to return NULL from Create() + // skip SrcOver, as it is allowed to return nullptr from Create() continue; } SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(static_cast<SkXfermode::Mode>(i))); @@ -331,7 +331,7 @@ static void serialize_and_compare_typeface(SkTypeface* typeface, const char* tex SkIRect canvasRect = SkIRect::MakeWH(kBitmapSize, kBitmapSize); SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(canvasRect.width()), SkIntToScalar(canvasRect.height()), - NULL, 0); + nullptr, 0); canvas->drawColor(SK_ColorWHITE); canvas->drawText(text, 2, 24, 32, paint); SkAutoTUnref<SkPicture> picture(recorder.endRecording()); @@ -413,7 +413,7 @@ static void draw_something(SkCanvas* canvas) { canvas->save(); canvas->scale(0.5f, 0.5f); - canvas->drawBitmap(bitmap, 0, 0, NULL); + canvas->drawBitmap(bitmap, 0, 0, nullptr); canvas->restore(); paint.setAntiAlias(true); @@ -524,7 +524,7 @@ DEF_TEST(Serialization, reporter) { SkPictureRecorder recorder; draw_something(recorder.beginRecording(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize), - NULL, 0)); + nullptr, 0)); SkAutoTUnref<SkPicture> pict(recorder.endRecording()); // Serialize picture diff --git a/tests/SkBase64Test.cpp b/tests/SkBase64Test.cpp index a534768793..d855ef57ad 100644 --- a/tests/SkBase64Test.cpp +++ b/tests/SkBase64Test.cpp @@ -17,7 +17,7 @@ DEF_TEST(SkBase64, reporter) { for (int offset = 0; offset < 6; ++offset) { size_t length = 256 - offset; - size_t encodeLength = SkBase64::Encode(all + offset, length, NULL); + size_t encodeLength = SkBase64::Encode(all + offset, length, nullptr); SkAutoTMalloc<char> src(encodeLength + 1); SkBase64::Encode(all + offset, length, src.get()); src[SkToInt(encodeLength)] = '\0'; diff --git a/tests/SkImageTest.cpp b/tests/SkImageTest.cpp index fabc1fd146..8817f0b597 100644 --- a/tests/SkImageTest.cpp +++ b/tests/SkImageTest.cpp @@ -33,7 +33,7 @@ DEF_TEST(SkImageFromBitmap_extractSubset, reporter) { tgt.allocN32Pixels(gWidth, gHeight); SkCanvas canvas(tgt); canvas.clear(SK_ColorTRANSPARENT); - canvas.drawImage(image, 0, 0, NULL); + canvas.drawImage(image, 0, 0, nullptr); uint32_t pixel = 0; SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp index 58ab781725..6314863e50 100644 --- a/tests/SkResourceCacheTest.cpp +++ b/tests/SkResourceCacheTest.cpp @@ -142,7 +142,7 @@ static void check_data(skiatest::Reporter* reporter, const SkCachedData* data, int refcnt, CachedState cacheState, LockedState lockedState) { REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt); REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState)); - bool isLocked = (data->data() != NULL); + bool isLocked = (data->data() != nullptr); REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked)); } @@ -154,7 +154,7 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach src.setImmutable(); const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src, cache); - REPORTER_ASSERT(reporter, NULL == mipmap); + REPORTER_ASSERT(reporter, nullptr == mipmap); mipmap = SkMipMapCache::AddAndRef(src, cache); REPORTER_ASSERT(reporter, mipmap); diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 23cd30c0c1..98c54e032c 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -382,7 +382,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn } void TestResult::testOne() { - SkPicture* pic = NULL; + SkPicture* pic = nullptr; { SkString d; d.printf(" {%d, \"%s\"},", fDirNo, fFilename); @@ -417,7 +417,7 @@ void TestResult::testOne() { #else GrContext* context = contextFactory.get(kNative); #endif - if (NULL == context) { + if (nullptr == context) { SkDebugf("unable to allocate context for %s\n", fFilename); goto finish; } @@ -450,7 +450,7 @@ void TestResult::testOne() { desc.fWidth = dim.fX; desc.fHeight = dim.fY; desc.fSampleCnt = 0; - SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0)); + SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0)); if (!texture) { SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename, dim.fX, dim.fY); diff --git a/tests/SmallAllocatorTest.cpp b/tests/SmallAllocatorTest.cpp index 30c8ffa94a..774e0c9e89 100644 --- a/tests/SmallAllocatorTest.cpp +++ b/tests/SmallAllocatorTest.cpp @@ -32,7 +32,7 @@ template<uint32_t kMaxObjects, size_t kBytes> void test_allocator(skiatest::Repo SkSmallAllocator<kMaxObjects, kBytes> alloc; for (uint32_t i = 0; i < kMaxObjects; ++i) { CountingClass* c = alloc.template createT<CountingClass>(); - REPORTER_ASSERT(reporter, c != NULL); + REPORTER_ASSERT(reporter, c != nullptr); REPORTER_ASSERT(reporter, CountingClass::GetCount() == static_cast<int>(i+1)); } } @@ -78,6 +78,6 @@ DEF_TEST(SmallAllocator_pointer, reporter) { SkSmallAllocator<1, 8> alloc; Dummy d; DummyContainer* container = alloc.createT<DummyContainer>(&d); - REPORTER_ASSERT(reporter, container != NULL); + REPORTER_ASSERT(reporter, container != nullptr); REPORTER_ASSERT(reporter, container->getDummy() == &d); } diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index 6f78eca5f0..d307f51318 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -170,16 +170,16 @@ static void TestPackedUInt(skiatest::Reporter* reporter) { } } -// Test that setting an SkMemoryStream to a NULL data does not result in a crash when calling +// Test that setting an SkMemoryStream to a nullptr data does not result in a crash when calling // methods that access fData. static void TestDereferencingData(SkMemoryStream* memStream) { - memStream->read(NULL, 0); + memStream->read(nullptr, 0); memStream->getMemoryBase(); SkAutoDataUnref data(memStream->copyToData()); } static void TestNullData() { - SkData* nullData = NULL; + SkData* nullData = nullptr; SkMemoryStream memStream(nullData); TestDereferencingData(&memStream); @@ -241,9 +241,9 @@ static void test_peeking_front_buffered_stream(skiatest::Reporter* r, const SkStream& original, size_t bufferSize) { SkStream* dupe = original.duplicate(); - REPORTER_ASSERT(r, dupe != NULL); + REPORTER_ASSERT(r, dupe != nullptr); SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(dupe, bufferSize)); - REPORTER_ASSERT(r, bufferedStream != NULL); + REPORTER_ASSERT(r, bufferedStream != nullptr); test_peeking_stream(r, bufferedStream, bufferSize); } diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp index af21d861fe..595a0b194a 100644 --- a/tests/StringTest.cpp +++ b/tests/StringTest.cpp @@ -36,7 +36,7 @@ DEF_TEST(String, reporter) { SkString a; SkString b((size_t)0); SkString c(""); - SkString d(NULL, 0); + SkString d(nullptr, 0); REPORTER_ASSERT(reporter, a.isEmpty()); REPORTER_ASSERT(reporter, a == b && a == c && a == d); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 771fc9ea72..4efe985926 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -41,7 +41,7 @@ static void release_storage(void* pixels, void* context) { static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context, SkAlphaType at = kPremul_SkAlphaType, - SkImageInfo* requestedInfo = NULL) { + SkImageInfo* requestedInfo = nullptr) { const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at); if (requestedInfo) { @@ -58,11 +58,11 @@ static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context, release_storage, storage); } case kGpu_SurfaceType: - return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, NULL); + return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, nullptr); case kGpuScratch_SurfaceType: - return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, NULL); + return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, nullptr); } - return NULL; + return nullptr; } enum ImageType { @@ -83,26 +83,26 @@ public: static void test_empty_image(skiatest::Reporter* reporter) { const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType); - REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0)); - REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0)); - REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL, NULL)); - REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerator)); + REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterCopy(info, nullptr, 0)); + REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterData(info, nullptr, 0)); + REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromRaster(info, nullptr, 0, nullptr, nullptr)); + REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromGenerator(new EmptyGenerator)); } static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) { const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType); - REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info)); - REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0)); + REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRaster(info)); + REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRasterDirect(info, nullptr, 0)); if (ctx) { - REPORTER_ASSERT(reporter, NULL == - SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, NULL)); + REPORTER_ASSERT(reporter, nullptr == + SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, nullptr)); } } #if SK_SUPPORT_GPU static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext* ctx) { - if (NULL == ctx) { + if (nullptr == ctx) { return; } @@ -130,7 +130,7 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; wrappedDesc.fTextureHandle = texID; - SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, NULL)); + SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, nullptr)); REPORTER_ASSERT(reporter, surface); if (surface) { // Validate that we can draw to the canvas and that the original texture color is preserved @@ -196,7 +196,7 @@ struct ReleaseDataContext { ReleaseDataContext* state = (ReleaseDataContext*)context; REPORTER_ASSERT(state->fReporter, state->fData); state->fData->unref(); - state->fData = NULL; + state->fData = nullptr; } }; @@ -307,7 +307,7 @@ static SkImage* create_image(skiatest::Reporter* reporter, } } SkASSERT(false); - return NULL; + return nullptr; } static void set_pixels(SkPMColor pixels[], int count, SkPMColor color) { @@ -425,10 +425,10 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto const SkColor color = SK_ColorRED; const SkPMColor pmcolor = SkPreMultiplyColor(color); - GrContext* ctx = NULL; + GrContext* ctx = nullptr; #if SK_SUPPORT_GPU ctx = factory->get(GrContextFactory::kNative_GLContextType); - if (NULL == ctx) { + if (nullptr == ctx) { return; } #endif @@ -440,16 +440,16 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto SkImageInfo info; size_t rowBytes; - releaseCtx.fData = NULL; + releaseCtx.fData = nullptr; SkAutoTUnref<SkImage> image(create_image(reporter, gRec[i].fType, ctx, color, &releaseCtx)); if (!image.get()) { SkDebugf("failed to createImage[%d] %s\n", i, gRec[i].fName); continue; // gpu may not be enabled } if (kRasterProc_ImageType == gRec[i].fType) { - REPORTER_ASSERT(reporter, NULL != releaseCtx.fData); // we are tracking the data + REPORTER_ASSERT(reporter, nullptr != releaseCtx.fData); // we are tracking the data } else { - REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we ignored the context + REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we ignored the context } test_legacy_bitmap(reporter, image); @@ -469,7 +469,7 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto test_image_readpixels(reporter, image, pmcolor); } - REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we released the data + REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we released the data } static void test_canvaspeek(skiatest::Reporter* reporter, @@ -497,7 +497,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter, #endif for (int i= 0; i < cnt; ++i) { - GrContext* context = NULL; + GrContext* context = nullptr; #if SK_SUPPORT_GPU GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { @@ -505,7 +505,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter, } context = factory->get(glCtxType); - if (NULL == context) { + if (nullptr == context) { continue; } #endif @@ -534,7 +534,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, info2 == info); REPORTER_ASSERT(reporter, rb2 == rowBytes); } else { - REPORTER_ASSERT(reporter, NULL == addr2); + REPORTER_ASSERT(reporter, nullptr == addr2); } } } @@ -565,7 +565,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa #endif for (int i= 0; i < cnt; ++i) { - GrContext* context = NULL; + GrContext* context = nullptr; #if SK_SUPPORT_GPU GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { @@ -573,7 +573,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa } context = factory->get(glCtxType); - if (NULL == context) { + if (nullptr == context) { continue; } #endif @@ -598,10 +598,10 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa } static void test_snap_alphatype(skiatest::Reporter* reporter, GrContextFactory* factory) { - GrContext* context = NULL; + GrContext* context = nullptr; #if SK_SUPPORT_GPU context = factory->get(GrContextFactory::kNative_GLContextType); - if (NULL == context) { + if (nullptr == context) { return; } #endif @@ -706,12 +706,12 @@ static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType sur EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint)) EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0)) EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr)) - EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, NULL)) - EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, NULL)) + EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr)) + EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, nullptr)) EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testPaint)) EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoints2, \ testPaint)) - EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, NULL, \ + EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, nullptr, \ testPaint)) const SkSurface::BackendHandleAccess accessModes[] = { @@ -796,7 +796,7 @@ static void TestGetTexture(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, texture); REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle()); } else { - REPORTER_ASSERT(reporter, NULL == texture); + REPORTER_ASSERT(reporter, nullptr == texture); } surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); REPORTER_ASSERT(reporter, as_IB(image)->getTexture() == texture); @@ -883,13 +883,13 @@ static void TestSurfaceNoCanvas(skiatest::Reporter* reporter, DEF_GPUTEST(Surface, reporter, factory) { test_image(reporter); - TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL); - TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL); - TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard_ContentChangeMode); - TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ContentChangeMode); + TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, nullptr); + TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, nullptr); + TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kDiscard_ContentChangeMode); + TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kRetain_ContentChangeMode); test_empty_image(reporter); - test_empty_surface(reporter, NULL); + test_empty_surface(reporter, nullptr); test_imagepeek(reporter, factory); test_canvaspeek(reporter, factory); @@ -899,7 +899,7 @@ DEF_GPUTEST(Surface, reporter, factory) { test_snap_alphatype(reporter, factory); #if SK_SUPPORT_GPU - TestGetTexture(reporter, kRaster_SurfaceType, NULL); + TestGetTexture(reporter, kRaster_SurfaceType, nullptr); if (factory) { for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i; @@ -1005,7 +1005,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) { ReleaseTextureContext releaseCtx(reporter); SkAutoTUnref<SkImage> refImg(make_desc_image(ctx, w, h, srcTex, &releaseCtx)); - SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, NULL)); + SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, nullptr)); test_image_color(reporter, refImg, expected0); test_image_color(reporter, cpyImg, expected0); @@ -1025,7 +1025,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) { // Now exercise the release proc REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); - refImg.reset(NULL); // force a release of the image + refImg.reset(nullptr); // force a release of the image REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); } #endif diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp index c2ae07c4c8..6f0dabeb11 100644 --- a/tests/SwizzlerTest.cpp +++ b/tests/SwizzlerTest.cpp @@ -116,15 +116,15 @@ DEF_TEST(SwizzlerFill, r) { // Fill with a color check_fill(r, colorInfo, startRow, endRow, colorRowBytes, offset, - kFillColor, NULL); + kFillColor, nullptr); // Fill with an index check_fill(r, indexInfo, startRow, endRow, indexRowBytes, offset, - kFillIndex, NULL); + kFillIndex, nullptr); // Fill a grayscale image check_fill(r, grayInfo, startRow, endRow, grayRowBytes, offset, - kFillColor, NULL); + kFillColor, nullptr); } } } diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp index 53bb5fe842..c398c6c019 100644 --- a/tests/TLSTest.cpp +++ b/tests/TLSTest.cpp @@ -56,7 +56,7 @@ static int32_t gCounter; static void* FakeCreateTLS() { sk_atomic_inc(&gCounter); - return NULL; + return nullptr; } static void FakeDeleteTLS(void*) { diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index dbfd825038..c2bbf889bc 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -252,7 +252,7 @@ static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, GrResourceProvider* DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); - if (NULL == context) { + if (nullptr == context) { return; } GrSurfaceDesc desc; diff --git a/tests/Test.cpp b/tests/Test.cpp index c8c40cdfa4..f6f2bdab3d 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -12,7 +12,7 @@ #include "SkString.h" #include "SkTime.h" -DEFINE_string2(tmpDir, t, NULL, "Temp directory to use."); +DEFINE_string2(tmpDir, t, nullptr, "Temp directory to use."); void skiatest::Reporter::bumpTestCount() {} @@ -33,6 +33,6 @@ SkString skiatest::Failure::toString() const { } SkString skiatest::GetTmpDir() { - const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; + const char* tmpDir = FLAGS_tmpDir.isEmpty() ? nullptr : FLAGS_tmpDir[0]; return SkString(tmpDir); } diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp index cf2a2390b9..3a548c7835 100644 --- a/tests/TextBlobCacheTest.cpp +++ b/tests/TextBlobCacheTest.cpp @@ -100,7 +100,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContextFactory SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); for (int j = 0; j < set->count(); ++j) { SkFontStyle fs; - set->getStyle(j, &fs, NULL); + set->getStyle(j, &fs, nullptr); // We use a typeface which randomy returns unexpected mask formats to fuzz SkAutoTUnref<SkTypeface> orig(set->createTypeface(j)); @@ -124,7 +124,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContextFactory const SkTextBlobBuilder::RunBuffer& run = builder.allocRun(paint, maxTotalText, 0, 0, - NULL); + nullptr); memcpy(run.glyphs, text.get(), maxTotalText * sizeof(uint16_t)); } } diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index 5d08b0147d..ec748e7744 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -20,7 +20,7 @@ public: SkTextBlobBuilder builder; // empty run set - RunBuilderTest(reporter, builder, NULL, 0, NULL, 0); + RunBuilderTest(reporter, builder, nullptr, 0, nullptr, 0); RunDef set1[] = { { 128, SkTextBlob::kDefault_Positioning, 100, 100 }, @@ -206,7 +206,7 @@ private: static void AddRun(const SkPaint& font, int count, SkTextBlob::GlyphPositioning pos, const SkPoint& offset, SkTextBlobBuilder& builder, - const SkRect* bounds = NULL) { + const SkRect* bounds = nullptr) { switch (pos) { case SkTextBlob::kDefault_Positioning: { const SkTextBlobBuilder::RunBuffer& rb = builder.allocRun(font, count, offset.x(), diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp index ca8da28858..d2e6db209b 100644 --- a/tests/TextureCompressionTest.cpp +++ b/tests/TextureCompressionTest.cpp @@ -63,7 +63,7 @@ DEF_TEST(CompressAlphaFailDimensions, reporter) { continue; } SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt)); - REPORTER_ASSERT(reporter, NULL == data); + REPORTER_ASSERT(reporter, nullptr == data); } } @@ -92,7 +92,7 @@ DEF_TEST(CompressAlphaFailColorType, reporter) { continue; } SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt)); - REPORTER_ASSERT(reporter, NULL == data); + REPORTER_ASSERT(reporter, nullptr == data); } } @@ -120,7 +120,7 @@ DEF_TEST(CompressCheckerboard, reporter) { { uint8_t* pixels = reinterpret_cast<uint8_t*>(pixmap.writable_addr()); REPORTER_ASSERT(reporter, pixels); - if (NULL == pixels) { + if (nullptr == pixels) { return; } @@ -139,7 +139,7 @@ DEF_TEST(CompressCheckerboard, reporter) { SkAutoMalloc decompMemory(kWidth*kHeight); uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get()); REPORTER_ASSERT(reporter, decompBuffer); - if (NULL == decompBuffer) { + if (nullptr == decompBuffer) { return; } @@ -154,7 +154,7 @@ DEF_TEST(CompressCheckerboard, reporter) { SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt)); REPORTER_ASSERT(reporter, data); - if (NULL == data) { + if (nullptr == data) { continue; } @@ -167,7 +167,7 @@ DEF_TEST(CompressCheckerboard, reporter) { const uint8_t* pixels = reinterpret_cast<const uint8_t*>(pixmap.addr()); REPORTER_ASSERT(reporter, pixels); - if (NULL == pixels) { + if (nullptr == pixels) { continue; } @@ -213,7 +213,7 @@ DEF_TEST(CompressLATC, reporter) { SkAutoDataUnref latcData( SkTextureCompressor::CompressBitmapToFormat(pixmap, kLATCFormat)); REPORTER_ASSERT(reporter, latcData); - if (NULL == latcData) { + if (nullptr == latcData) { continue; } diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp index bb5d361bee..b3bc157eba 100644 --- a/tests/TypefaceTest.cpp +++ b/tests/TypefaceTest.cpp @@ -10,7 +10,7 @@ DEF_TEST(Typeface, reporter) { - SkAutoTUnref<SkTypeface> t1(SkTypeface::CreateFromName(NULL, SkTypeface::kNormal)); + SkAutoTUnref<SkTypeface> t1(SkTypeface::CreateFromName(nullptr, SkTypeface::kNormal)); SkAutoTUnref<SkTypeface> t2(SkTypeface::RefDefault(SkTypeface::kNormal)); REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), t2.get())); @@ -21,6 +21,6 @@ DEF_TEST(Typeface, reporter) { #ifdef SK_BUILD_FOR_ANDROID SkAutoTUnref<SkTypeface> t3(SkTypeface::CreateFromName("non-existent-font", SkTypeface::kNormal)); - REPORTER_ASSERT(reporter, NULL == t3.get()); + REPORTER_ASSERT(reporter, nullptr == t3.get()); #endif } diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index 6db8104acc..4dad52b50c 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -35,8 +35,8 @@ static void test_autounref(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, &obj == tmp.detach()); REPORTER_ASSERT(reporter, obj.unique()); - REPORTER_ASSERT(reporter, NULL == tmp.detach()); - REPORTER_ASSERT(reporter, NULL == tmp.get()); + REPORTER_ASSERT(reporter, nullptr == tmp.detach()); + REPORTER_ASSERT(reporter, nullptr == tmp.get()); obj.ref(); REPORTER_ASSERT(reporter, !obj.unique()); diff --git a/tests/WArrayTest.cpp b/tests/WArrayTest.cpp index 7f03e5bacd..48be952637 100644 --- a/tests/WArrayTest.cpp +++ b/tests/WArrayTest.cpp @@ -101,7 +101,7 @@ static const char* expectedSubset14 = "0[1] 5[2]"; static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>* data) { SkString result; bool leadingSpace = false; - while (data != NULL) { + while (data != nullptr) { if (leadingSpace) { result.append(" "); } else { @@ -174,34 +174,34 @@ class TestWData { }; DEF_TEST(WArray, reporter) { - TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1); - TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2); - TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3); - TestWData(reporter, data4, SK_ARRAY_COUNT(data4), NULL, 0, expected4); - TestWData(reporter, data5, SK_ARRAY_COUNT(data5), NULL, 0, expected5); - TestWData(reporter, data6, SK_ARRAY_COUNT(data6), NULL, 0, expected6); - TestWData(reporter, data7, SK_ARRAY_COUNT(data7), NULL, 0, expected7); + TestWData(reporter, data1, SK_ARRAY_COUNT(data1), nullptr, 0, expected1); + TestWData(reporter, data2, SK_ARRAY_COUNT(data2), nullptr, 0, expected2); + TestWData(reporter, data3, SK_ARRAY_COUNT(data3), nullptr, 0, expected3); + TestWData(reporter, data4, SK_ARRAY_COUNT(data4), nullptr, 0, expected4); + TestWData(reporter, data5, SK_ARRAY_COUNT(data5), nullptr, 0, expected5); + TestWData(reporter, data6, SK_ARRAY_COUNT(data6), nullptr, 0, expected6); + TestWData(reporter, data7, SK_ARRAY_COUNT(data7), nullptr, 0, expected7); TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7, SK_ARRAY_COUNT(subset7), expectedSubset7); - TestWData(reporter, data8, SK_ARRAY_COUNT(data8), NULL, 0, expected8); + TestWData(reporter, data8, SK_ARRAY_COUNT(data8), nullptr, 0, expected8); TestWData(reporter, data8, SK_ARRAY_COUNT(data8), subset8, SK_ARRAY_COUNT(subset8), expectedSubset8); - TestWData(reporter, data9, SK_ARRAY_COUNT(data9), NULL, 0, expected9); + TestWData(reporter, data9, SK_ARRAY_COUNT(data9), nullptr, 0, expected9); TestWData(reporter, data9, SK_ARRAY_COUNT(data9), subset9, SK_ARRAY_COUNT(subset9), expectedSubset9); - TestWData(reporter, data10, SK_ARRAY_COUNT(data10), NULL, 0, expected10); + TestWData(reporter, data10, SK_ARRAY_COUNT(data10), nullptr, 0, expected10); TestWData(reporter, data10, SK_ARRAY_COUNT(data10), subset10, SK_ARRAY_COUNT(subset10), expectedSubset10); - TestWData(reporter, data11, SK_ARRAY_COUNT(data11), NULL, 0, expected11); + TestWData(reporter, data11, SK_ARRAY_COUNT(data11), nullptr, 0, expected11); TestWData(reporter, data11, SK_ARRAY_COUNT(data11), subset11, SK_ARRAY_COUNT(subset11), expectedSubset11); - TestWData(reporter, data12, SK_ARRAY_COUNT(data12), NULL, 0, expected12); + TestWData(reporter, data12, SK_ARRAY_COUNT(data12), nullptr, 0, expected12); TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12, SK_ARRAY_COUNT(subset12), expectedSubset12); - TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); + TestWData(reporter, data13, SK_ARRAY_COUNT(data13), nullptr, 0, expected13); TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, SK_ARRAY_COUNT(subset13), expectedSubset13); - TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); + TestWData(reporter, data14, SK_ARRAY_COUNT(data14), nullptr, 0, expected14); TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, SK_ARRAY_COUNT(subset14), expectedSubset14); } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index a06130e36b..c4010b7119 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -200,7 +200,7 @@ static bool check_write(skiatest::Reporter* reporter, SkCanvas* canvas, const Sk canvasRowBytes = secretDevBitmap.rowBytes(); canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels()); - if (NULL == canvasPixels) { + if (nullptr == canvasPixels) { return false; } @@ -286,7 +286,7 @@ static bool alloc_row_bytes(SkBitmap* bm, const SkImageInfo& info, size_t rowByt if (!bm->setInfo(info, rowBytes)) { return false; } - SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, NULL); + SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr); bm->setPixelRef(pr)->unref(); return true; } @@ -306,7 +306,7 @@ static SkSurface* create_surface(const CanvasConfig& c, GrContext* grCtx) { if (!c.fTightRowBytes) { memset(pixels, DEV_PAD, size); } - return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes, free_pixels, NULL); + return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes, free_pixels, nullptr); } #if SK_SUPPORT_GPU case kGpu_BottomLeft_DevType: @@ -322,7 +322,7 @@ static SkSurface* create_surface(const CanvasConfig& c, GrContext* grCtx) { return SkSurface::NewRenderTargetDirect(texture->asRenderTarget()); #endif } - return NULL; + return nullptr; } static bool setup_bitmap(SkBitmap* bm, SkColorType ct, SkAlphaType at, int w, int h, int tightRB) { @@ -417,7 +417,7 @@ DEF_GPUTEST(WritePixels, reporter, factory) { } #endif for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) { - GrContext* context = NULL; + GrContext* context = nullptr; #if SK_SUPPORT_GPU if (isGPUDevice) { GrContextFactory::GLContextType type = @@ -426,7 +426,7 @@ DEF_GPUTEST(WritePixels, reporter, factory) { continue; } context = factory->get(type); - if (NULL == context) { + if (nullptr == context) { continue; } } diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp index d1366082ae..5849d731ef 100644 --- a/tests/Writer32Test.cpp +++ b/tests/Writer32Test.cpp @@ -31,8 +31,8 @@ static void test_string_null(skiatest::Reporter* reporter) { uint8_t storage[8]; SkWriter32 writer(storage, sizeof(storage)); - // Can we write NULL? - writer.writeString(NULL); + // Can we write nullptr? + writer.writeString(nullptr); const int32_t expected[] = { 0x0, 0x0 }; check_contents(reporter, writer, expected, sizeof(expected)); } @@ -241,7 +241,7 @@ DEF_TEST(Writer32_contiguous, reporter) { writer.reset(storage, sizeof(storage)); // This write is small enough to fit in storage, so it's contiguous. test1(reporter, &writer); - REPORTER_ASSERT(reporter, writer.contiguousArray() != NULL); + REPORTER_ASSERT(reporter, writer.contiguousArray() != nullptr); // Everything other aspect of contiguous/non-contiguous is an // implementation detail, not part of the public contract for diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp index 34f5233fcf..294d63db59 100644 --- a/tests/XfermodeTest.cpp +++ b/tests/XfermodeTest.cpp @@ -35,7 +35,7 @@ static void test_asMode(skiatest::Reporter* reporter) { } static void test_IsMode(skiatest::Reporter* reporter) { - REPORTER_ASSERT(reporter, SkXfermode::IsMode(NULL, + REPORTER_ASSERT(reporter, SkXfermode::IsMode(nullptr, SkXfermode::kSrcOver_Mode)); for (int i = 0; i <= SkXfermode::kLastMode; ++i) { @@ -46,7 +46,7 @@ static void test_IsMode(skiatest::Reporter* reporter) { SkSafeUnref(xfer); if (SkXfermode::kSrcOver_Mode != mode) { - REPORTER_ASSERT(reporter, !SkXfermode::IsMode(NULL, mode)); + REPORTER_ASSERT(reporter, !SkXfermode::IsMode(nullptr, mode)); } } } diff --git a/tests/YUVCacheTest.cpp b/tests/YUVCacheTest.cpp index f5b5897334..f3a09f116b 100644 --- a/tests/YUVCacheTest.cpp +++ b/tests/YUVCacheTest.cpp @@ -24,7 +24,7 @@ static void check_data(skiatest::Reporter* reporter, SkCachedData* data, int refcnt, CachedState cacheState, LockedState lockedState) { REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt); REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState)); - bool isLocked = (data->data() != NULL); + bool isLocked = (data->data() != nullptr); REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked)); } @@ -43,7 +43,7 @@ DEF_TEST(YUVPlanesCache, reporter) { const uint32_t genID = 12345678; SkCachedData* data = SkYUVPlanesCache::FindAndRef(genID, &yuvInfo, &cache); - REPORTER_ASSERT(reporter, NULL == data); + REPORTER_ASSERT(reporter, nullptr == data); size_t size = 256; data = cache.newCachedData(size); diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp index fbd35d081b..dc5ae97c3f 100644 --- a/tests/skia_test.cpp +++ b/tests/skia_test.cpp @@ -76,7 +76,7 @@ class SkTestRunnable : public SkRunnable { public: SkTestRunnable(const Test& test, Status* status, - GrContextFactory* grContextFactory = NULL) + GrContextFactory* grContextFactory = nullptr) : fTest(test), fStatus(status), fGrContextFactory(grContextFactory) {} virtual void run() { @@ -193,7 +193,7 @@ int test_main() { } } - GrContextFactory* grContextFactoryPtr = NULL; + GrContextFactory* grContextFactoryPtr = nullptr; #if SK_SUPPORT_GPU // Give GPU tests a context factory if that makes sense on this machine. GrContextFactory grContextFactory; |