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 /gm | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'gm')
144 files changed, 422 insertions, 428 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index 7ede6a5fe1..b3c39b7b14 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -140,7 +140,7 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) { newc->drawCircle(50, 50, 49, paint); canvas->drawBitmap(bm, 10, 10); - CGImageRef image = SkCreateCGImageRefWithColorspace(bm, NULL); + CGImageRef image = SkCreateCGImageRefWithColorspace(bm, nullptr); SkBitmap bm2; SkCreateBitmapFromCGImage(&bm2, image); diff --git a/gm/aarectmodes.cpp b/gm/aarectmodes.cpp index e0df7d84b1..fb5145bc5f 100644 --- a/gm/aarectmodes.cpp +++ b/gm/aarectmodes.cpp @@ -161,7 +161,7 @@ namespace skiagm { SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); canvas->drawRect(bounds, fBGPaint); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); SkScalar dy = drawCell(canvas, mode, gAlphaValue[alpha & 1], gAlphaValue[alpha & 2]); diff --git a/gm/aaxfermodes.cpp b/gm/aaxfermodes.cpp index d33423a35e..9e07f8d751 100644 --- a/gm/aaxfermodes.cpp +++ b/gm/aaxfermodes.cpp @@ -161,7 +161,7 @@ protected: void onDraw(SkCanvas* canvas) override { draw_pass(canvas, kCheckerboard_Pass); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); canvas->translate(kMargin, kMargin); draw_pass(canvas, kBackground_Pass); diff --git a/gm/addarc.cpp b/gm/addarc.cpp index 3bfed8d549..0d1ea93133 100644 --- a/gm/addarc.cpp +++ b/gm/addarc.cpp @@ -101,7 +101,7 @@ protected: SkPathMeasure meas(path, false); SkScalar arcLen = rad * R; SkPoint pos; - if (meas.getPosTan(arcLen, &pos, NULL)) { + if (meas.getPosTan(arcLen, &pos, nullptr)) { canvas->drawLine(0, 0, pos.x(), pos.y(), measPaint); } } diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp index 2fbd71de24..4cabf2ec9b 100644 --- a/gm/all_bitmap_configs.cpp +++ b/gm/all_bitmap_configs.cpp @@ -75,7 +75,7 @@ static void color_wheel_native(SkCanvas* canvas) { const SkScalar D = 0.3f * SkIntToScalar(SCALE); const SkScalar X = SkDoubleToScalar(D * sqrt_3_over_2); const SkScalar Y = D * SK_ScalarHalf; - sk_tool_utils::set_portable_typeface(&p, NULL, SkTypeface::kBold); + sk_tool_utils::set_portable_typeface(&p, nullptr, SkTypeface::kBold); p.setTextSize(0.28125f * SCALE); draw_center_letter('K', &p, SK_ColorBLACK, Z, Z, canvas); draw_center_letter('R', &p, SK_ColorRED, Z, D, canvas); @@ -127,7 +127,7 @@ static SkBitmap indexed_bitmap() { SkAutoTUnref<SkColorTable> ctable(new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors))); SkImageInfo info = SkImageInfo::Make(SCALE, SCALE, kIndex_8_SkColorType, kPremul_SkAlphaType); - bm.allocPixels(info, NULL, ctable); + bm.allocPixels(info, nullptr, ctable); SkAutoLockPixels autoLockPixels1(n32bitmap); SkAutoLockPixels autoLockPixels2(bm); for (int y = 0; y < SCALE; ++y) { @@ -155,7 +155,7 @@ DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { SkPaint p; p.setColor(SK_ColorBLACK); p.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&p, NULL); + sk_tool_utils::set_portable_typeface(&p, nullptr); sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8); diff --git a/gm/alphagradients.cpp b/gm/alphagradients.cpp index b209cec9d1..71ec27c975 100644 --- a/gm/alphagradients.cpp +++ b/gm/alphagradients.cpp @@ -28,12 +28,12 @@ protected: SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fBottom } }; SkPaint paint; uint32_t flags = doPreMul ? SkGradientShader::kInterpolateColorsInPremul_Flag : 0; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, - SkShader::kClamp_TileMode, flags, NULL); + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, + SkShader::kClamp_TileMode, flags, nullptr); paint.setShader(s)->unref(); canvas->drawRect(r, paint); - paint.setShader(NULL); + paint.setShader(nullptr); paint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(r, paint); } diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp index 4b8194464f..53385ea6ab 100644 --- a/gm/arithmode.cpp +++ b/gm/arithmode.cpp @@ -31,7 +31,7 @@ static SkBitmap make_src() { SK_ColorTRANSPARENT, SK_ColorGREEN, SK_ColorCYAN, SK_ColorRED, SK_ColorMAGENTA, SK_ColorWHITE, }; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); paint.setShader(s)->unref(); canvas.drawPaint(paint); @@ -47,7 +47,7 @@ static SkBitmap make_dst() { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN, sk_tool_utils::color_to_565(SK_ColorGRAY) }; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); paint.setShader(s)->unref(); canvas.drawPaint(paint); @@ -105,13 +105,13 @@ protected: SkScalar gap = SkIntToScalar(src.width() + 20); while (k < stop) { SkScalar x = 0; - canvas->drawBitmap(src, x, y, NULL); + canvas->drawBitmap(src, x, y, nullptr); x += gap; - canvas->drawBitmap(dst, x, y, NULL); + canvas->drawBitmap(dst, x, y, nullptr); x += gap; SkRect rect = SkRect::MakeXYWH(x, y, SkIntToScalar(WW), SkIntToScalar(HH)); - canvas->saveLayer(&rect, NULL); - canvas->drawBitmap(dst, x, y, NULL); + canvas->saveLayer(&rect, nullptr); + canvas->drawBitmap(dst, x, y, nullptr); SkXfermode* xfer = SkArithmeticMode::Create(k[0], k[1], k[2], k[3]); SkPaint paint; paint.setXfermode(xfer)->unref(); diff --git a/gm/astcbitmap.cpp b/gm/astcbitmap.cpp index 8ee7746f61..bc5e1e978f 100644 --- a/gm/astcbitmap.cpp +++ b/gm/astcbitmap.cpp @@ -70,7 +70,7 @@ protected: } SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str())); - if (NULL == fileData) { + if (nullptr == fileData) { SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n"); return; } diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 9edc11411a..ff75f74c66 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -121,12 +121,12 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { this->drawGpuOnlyMessage(canvas); return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { return; } @@ -159,7 +159,7 @@ protected: { // scope to contain GrTestTarget GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; @@ -269,12 +269,12 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { this->drawGpuOnlyMessage(canvas); return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { return; } @@ -307,7 +307,7 @@ protected: { // scope to contain GrTestTarget GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; @@ -512,12 +512,12 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { this->drawGpuOnlyMessage(canvas); return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { return; } @@ -548,7 +548,7 @@ protected: { // scope to contain GrTestTarget GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { continue; } GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index f19b57ce45..3facc8c47c 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -32,7 +32,7 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - GrContext* context = rt ? rt->getContext() : NULL; + GrContext* context = rt ? rt->getContext() : nullptr; if (!context) { this->drawGpuOnlyMessage(canvas); return; @@ -66,7 +66,7 @@ protected: canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } diff --git a/gm/bigtileimagefilter.cpp b/gm/bigtileimagefilter.cpp index dbd41c2ebd..3c55b71410 100644 --- a/gm/bigtileimagefilter.cpp +++ b/gm/bigtileimagefilter.cpp @@ -74,7 +74,7 @@ protected: SkAutoTUnref<SkTileImageFilter> tif2(SkTileImageFilter::Create( SkRect::MakeWH(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)), SkRect::MakeWH(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)), - NULL)); + nullptr)); p2.setImageFilter(tif2); canvas->translate(320, 320); diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index aeb88d6d22..b7273288ac 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -21,7 +21,7 @@ static void make_bm(SkBitmap* bm) { bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType, kPremul_SkAlphaType), - NULL, ctable); + nullptr, ctable); ctable->unref(); *bm->getAddr8(0, 0) = 0; diff --git a/gm/bitmaprect.cpp b/gm/bitmaprect.cpp index cfceab5af9..077f0ee273 100644 --- a/gm/bitmaprect.cpp +++ b/gm/bitmaprect.cpp @@ -23,7 +23,7 @@ static void make_bitmap(SkBitmap* bitmap) { paint.setAntiAlias(true); const SkPoint pts[] = { { 0, 0 }, { 64, 64 } }; const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE }; - paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, + paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode))->unref(); canvas.drawCircle(32, 32, 32, paint); } diff --git a/gm/bitmaprecttest.cpp b/gm/bitmaprecttest.cpp index 878029a8dd..741cc9ddfd 100644 --- a/gm/bitmaprecttest.cpp +++ b/gm/bitmaprecttest.cpp @@ -38,7 +38,7 @@ static void test_bitmaprect(SkCanvas* canvas) { SkBitmap bm; make_bm(&bm); - canvas->drawBitmap(bm, 150, 45, NULL); + canvas->drawBitmap(bm, 150, 45, nullptr); SkScalar scale = 0.472560018f; canvas->save(); @@ -47,7 +47,7 @@ static void test_bitmaprect(SkCanvas* canvas) { canvas->restore(); canvas->scale(-1, 1); - canvas->drawBitmap(bm, -310, 45, NULL); + canvas->drawBitmap(bm, -310, 45, nullptr); } class BitmapRectTestGM : public skiagm::GM { diff --git a/gm/bitmapshader.cpp b/gm/bitmapshader.cpp index 2b6906f381..5d7b35c2cd 100644 --- a/gm/bitmapshader.cpp +++ b/gm/bitmapshader.cpp @@ -84,7 +84,7 @@ protected: canvas->translate(0, 25); // clear the shader, colorized by a solid color with a bitmap mask - paint.setShader(NULL); + paint.setShader(nullptr); paint.setColor(SK_ColorGREEN); canvas->drawBitmap(fMask, 0, 0, &paint); canvas->drawBitmap(fMask, 30, 0, &paint); diff --git a/gm/bitmapsource2.cpp b/gm/bitmapsource2.cpp index 6c32f625d9..f65bafd2bc 100644 --- a/gm/bitmapsource2.cpp +++ b/gm/bitmapsource2.cpp @@ -66,7 +66,7 @@ protected: SkPaint p; p.setImageFilter(filter); - canvas->saveLayer(NULL, &p); + canvas->saveLayer(nullptr, &p); canvas->restore(); } diff --git a/gm/blend.cpp b/gm/blend.cpp index a89ecfe46d..94dc4c7f75 100644 --- a/gm/blend.cpp +++ b/gm/blend.cpp @@ -21,14 +21,14 @@ DEF_SIMPLE_GM(blend, canvas, 300, 100) { p.setColor(SK_ColorRED); canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); p.setColor(0xFC008000); canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p); canvas->restore(); p.setColor(SK_ColorRED); canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p); - canvas->saveLayerAlpha(NULL, 0xFC); + canvas->saveLayerAlpha(nullptr, 0xFC); p.setColor(sk_tool_utils::color_to_565(0xFF008000)); canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p); canvas->restore(); @@ -36,7 +36,7 @@ DEF_SIMPLE_GM(blend, canvas, 300, 100) { // Print out the colors in each block (if we're looking at 8888 raster). if (canvas->imageInfo().colorType() == kN32_SkColorType) { - if (const SkPMColor* px = (const SkPMColor*)canvas->peekPixels(NULL, NULL)) { + if (const SkPMColor* px = (const SkPMColor*)canvas->peekPixels(nullptr, nullptr)) { p.setColor(SK_ColorWHITE); for (int i = 0; i < 3; i++) { SkPMColor c = px[i * 100]; diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp index 0726f2cd52..6b7354071b 100644 --- a/gm/blurrect.cpp +++ b/gm/blurrect.cpp @@ -235,7 +235,7 @@ protected: canvas->save(); canvas->translate((SkScalar)cur_x, (SkScalar)cur_y); canvas->translate(-(bm.width() - r.width())/2, -(bm.height()-r.height())/2); - canvas->drawBitmap(bm, 0.f, 0.f, NULL); + canvas->drawBitmap(bm, 0.f, 0.f, nullptr); canvas->restore(); cur_x += bm.width() + fPadding; @@ -313,7 +313,7 @@ protected: center_x = (canvas_size.fWidth - mask.fBounds.width())/2; center_y = (canvas_size.fHeight - mask.fBounds.height())/2; - canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), NULL); + canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), nullptr); } private: diff --git a/gm/blurs.cpp b/gm/blurs.cpp index 8f95f007fa..d52a656963 100644 --- a/gm/blurs.cpp +++ b/gm/blurs.cpp @@ -56,7 +56,7 @@ protected: flags); paint.setMaskFilter(mf)->unref(); } else { - paint.setMaskFilter(NULL); + paint.setMaskFilter(nullptr); } canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100), SkIntToScalar(200 + gRecs[i].fCy*100), @@ -75,7 +75,7 @@ protected: canvas->drawText("Hamburgefons Style", 18, x, y, paint); canvas->drawText("Hamburgefons Style", 18, x, y + SkIntToScalar(50), paint); - paint.setMaskFilter(NULL); + paint.setMaskFilter(nullptr); paint.setColor(SK_ColorWHITE); x -= SkIntToScalar(2); y -= SkIntToScalar(2); diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp index 931dcfaf51..18de813134 100644 --- a/gm/colorcube.cpp +++ b/gm/colorcube.cpp @@ -20,18 +20,18 @@ static SkShader* MakeLinear() { }; static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; return SkGradientShader::CreateLinear( - pts, colors, NULL, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I()); + pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I()); } class ColorCubeGM : public GM { public: ColorCubeGM() : fInitialized(false) - , f3DLut4(NULL) - , f3DLut8(NULL) - , f3DLut16(NULL) - , f3DLut32(NULL) - , f3DLut64(NULL) + , f3DLut4(nullptr) + , f3DLut8(nullptr) + , f3DLut16(nullptr) + , f3DLut32(nullptr) + , f3DLut64(nullptr) { this->setBGColor(0xFF000000); } diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp index 8ef335a158..6dddc0fdc6 100644 --- a/gm/coloremoji.cpp +++ b/gm/coloremoji.cpp @@ -27,7 +27,7 @@ static SkShader* MakeLinear() { SK_ARRAY_COUNT(kColors), SkShader::kClamp_TileMode); } -static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) { +static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) { SkScalar matrix[20]; memset(matrix, 0, 20 * sizeof(SkScalar)); matrix[0] = matrix[5] = matrix[10] = 0.2126f; @@ -38,7 +38,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) { return SkColorFilterImageFilter::Create(filter, input); } -static SkImageFilter* make_blur(float amount, SkImageFilter* input = NULL) { +static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) { return SkBlurImageFilter::Create(amount, amount, input); } @@ -98,14 +98,14 @@ protected: } if (SkToBool(makeBlur) && SkToBool(makeGray)) { - SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(NULL)); + SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(nullptr)); SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, grayScale)); shaderPaint.setImageFilter(blur); } else if (SkToBool(makeBlur)) { - SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, NULL)); + SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, nullptr)); shaderPaint.setImageFilter(blur); } else if (SkToBool(makeGray)) { - SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(NULL)); + SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(nullptr)); shaderPaint.setImageFilter(grayScale); } shaderPaint.setTextSize(30); diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp index 500450f61b..4f5a768d57 100644 --- a/gm/colorfilterimagefilter.cpp +++ b/gm/colorfilterimagefilter.cpp @@ -18,11 +18,11 @@ #define FILTER_HEIGHT SkIntToScalar(30) #define MARGIN SkIntToScalar(10) -static SkImageFilter* make_blur(float amount, SkImageFilter* input = NULL) { +static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) { return SkBlurImageFilter::Create(amount, amount, input); } -static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) { +static SkImageFilter* make_brightness(float amount, SkImageFilter* input = nullptr) { SkScalar amount255 = SkScalarMul(amount, SkIntToScalar(255)); SkScalar matrix[20] = { 1, 0, 0, 0, amount255, 0, 1, 0, 0, amount255, @@ -32,7 +32,7 @@ static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) return SkColorFilterImageFilter::Create(filter, input); } -static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) { +static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) { SkScalar matrix[20]; memset(matrix, 0, 20 * sizeof(SkScalar)); matrix[0] = matrix[5] = matrix[10] = 0.2126f; @@ -43,7 +43,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) { return SkColorFilterImageFilter::Create(filter, input); } -static SkImageFilter* make_mode_blue(SkImageFilter* input = NULL) { +static SkImageFilter* make_mode_blue(SkImageFilter* input = nullptr) { SkAutoTUnref<SkColorFilter> filter( SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrc_Mode)); return SkColorFilterImageFilter::Create(filter, input); diff --git a/gm/colorfilters.cpp b/gm/colorfilters.cpp index 73ca7f318d..2d220d2c1d 100644 --- a/gm/colorfilters.cpp +++ b/gm/colorfilters.cpp @@ -20,14 +20,14 @@ static SkShader* make_shader(const SkRect& bounds) { SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, }; return SkGradientShader::CreateLinear(pts, - colors, NULL, SK_ARRAY_COUNT(colors), + colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); } typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t); static void install_nothing(SkPaint* paint, uint32_t, uint32_t) { - paint->setColorFilter(NULL); + paint->setColorFilter(nullptr); } static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) { diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index a80f8cb581..b466188c6a 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -67,7 +67,7 @@ protected: SkPoint pts[] = {{0, 0}, {SkIntToScalar(width), SkIntToScalar(height)}}; SkColor colors[] = {0x00000000, 0xFFFFFFFF}; SkPaint paint; - paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, + paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode))->unref(); canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), paint); return SkImage::NewFromBitmap(bm); diff --git a/gm/colortype.cpp b/gm/colortype.cpp index 4d8c9d6056..76b13817a9 100644 --- a/gm/colortype.cpp +++ b/gm/colortype.cpp @@ -13,7 +13,7 @@ class ColorTypeGM : public skiagm::GM { public: ColorTypeGM() - : fColorType(NULL) { + : fColorType(nullptr) { } virtual ~ColorTypeGM() { @@ -28,7 +28,7 @@ protected: }; SkMatrix local; local.setRotate(180); - SkShader* s = SkGradientShader::CreateSweep(0,0, colors, NULL, + SkShader* s = SkGradientShader::CreateSweep(0,0, colors, nullptr, SK_ARRAY_COUNT(colors), 0, &local); SkPaint paint; @@ -37,7 +37,7 @@ protected: SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold); - if (NULL == orig) { + if (nullptr == orig) { orig = SkTypeface::RefDefault(); } fColorType = new SkGTypeface(orig, paint); @@ -59,7 +59,7 @@ protected: for (SkScalar size = 10; size <= 100; size += 10) { paint.setTextSize(size); - canvas->translate(0, paint.getFontMetrics(NULL)); + canvas->translate(0, paint.getFontMetrics(nullptr)); canvas->drawText("Hamburgefons", 12, 10, 10, paint); } } diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp index 2926523c27..55d7697e35 100644 --- a/gm/colortypexfermode.cpp +++ b/gm/colortypexfermode.cpp @@ -20,7 +20,7 @@ public: const static int W = 64; const static int H = 64; ColorTypeXfermodeGM() - : fColorType(NULL) { + : fColorType(nullptr) { } virtual ~ColorTypeXfermodeGM() { @@ -35,7 +35,7 @@ protected: }; SkMatrix local; local.setRotate(180); - SkShader* s = SkGradientShader::CreateSweep(0,0, colors, NULL, + SkShader* s = SkGradientShader::CreateSweep(0,0, colors, nullptr, SK_ARRAY_COUNT(colors), 0, &local); SkPaint paint; @@ -44,7 +44,7 @@ protected: SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold); - if (NULL == orig) { + if (nullptr == orig) { orig = SkTypeface::RefDefault(); } fColorType = new SkGTypeface(orig, paint); @@ -138,7 +138,7 @@ protected: r.inset(-SK_ScalarHalf, -SK_ScalarHalf); p.setStyle(SkPaint::kStroke_Style); - p.setShader(NULL); + p.setShader(nullptr); canvas->drawRect(r, p); textP.setXfermode(mode); diff --git a/gm/colorwheel.cpp b/gm/colorwheel.cpp index dfa81ead70..efa3a6b0b4 100644 --- a/gm/colorwheel.cpp +++ b/gm/colorwheel.cpp @@ -40,7 +40,7 @@ DEF_SIMPLE_GM(colorwheel, canvas, 256, 256) { DEF_SIMPLE_GM(colorwheelnative, canvas, 128, 28) { SkPaint paint; - sk_tool_utils::set_portable_typeface(&paint, NULL, SkTypeface::kBold); + sk_tool_utils::set_portable_typeface(&paint, nullptr, SkTypeface::kBold); paint.setTextSize(18.0f); canvas->clear(sk_tool_utils::color_to_565(SK_ColorLTGRAY)); diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp index 74c877d8e6..bcbd7fd17a 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -115,7 +115,7 @@ protected: boundPaint.setColor(SK_ColorRED); boundPaint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(bounds, boundPaint); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); } for (int invBits = 0; invBits < 4; ++invBits) { diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp index 9d2103beb4..f5ab996f37 100644 --- a/gm/composeshader.cpp +++ b/gm/composeshader.cpp @@ -23,14 +23,14 @@ static SkShader* make_shader(SkXfermode::Mode mode) { pts[1].set(SkIntToScalar(100), 0); colors[0] = SK_ColorRED; colors[1] = SK_ColorBLUE; - SkAutoTUnref<SkShader> shaderA(SkGradientShader::CreateLinear(pts, colors, NULL, 2, + SkAutoTUnref<SkShader> shaderA(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode)); pts[0].set(0, 0); pts[1].set(0, SkIntToScalar(100)); colors[0] = SK_ColorBLACK; colors[1] = SkColorSetARGB(0x80, 0, 0, 0); - SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, NULL, 2, + SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode)); SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode)); @@ -102,7 +102,7 @@ protected: canvas->save(); for (int alpha = 0xFF; alpha > 0; alpha -= 0x28) { paint.setAlpha(0xFF); - paint.setShader(NULL); + paint.setShader(nullptr); canvas->drawRect(r, paint); paint.setAlpha(alpha); diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index f5d7853ba7..3d2e5865d8 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -40,17 +40,17 @@ protected: void onOnceBeforeDraw() override { SkColor colors[] = { 0xFFFF0000, 0x2000FF00, 0xFF0000FF}; SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(kRectSize, kRectSize) }; - fShader.reset(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), + fShader.reset(SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode)); } void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { this->drawGpuOnlyMessage(canvas); return; } @@ -92,7 +92,7 @@ protected: GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp index 6c494cdfc4..3eae959a65 100644 --- a/gm/convex_all_line_paths.cpp +++ b/gm/convex_all_line_paths.cpp @@ -165,7 +165,7 @@ protected: }; static_assert(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), "array_mismatch"); - SkAutoTDeleteArray<SkPoint> data(NULL); + SkAutoTDeleteArray<SkPoint> data(nullptr); const SkPoint* points; int numPts; if (index < (int) SK_ARRAY_COUNT(gPoints)) { diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp index 2aa05a83d2..fbfd1670d5 100644 --- a/gm/convexpolyclip.cpp +++ b/gm/convexpolyclip.cpp @@ -169,7 +169,7 @@ protected: clip->getBounds(&bounds); bounds.outset(2, 2); bounds.offset(x, y); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); } else { canvas->save(); } @@ -192,7 +192,7 @@ protected: clip->getBounds(&bounds); bounds.outset(2, 2); bounds.offset(x, y); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); } else { canvas->save(); } diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 95482f74be..b6a05cc6be 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -151,12 +151,12 @@ protected: void onDraw(SkCanvas* canvas) override { using namespace GrDefaultGeoProcFactory; GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { this->drawGpuOnlyMessage(canvas); return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { return; } @@ -176,7 +176,7 @@ protected: for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } @@ -227,7 +227,7 @@ protected: for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } diff --git a/gm/dashcubics.cpp b/gm/dashcubics.cpp index 246d0548ca..ecbe41537b 100644 --- a/gm/dashcubics.cpp +++ b/gm/dashcubics.cpp @@ -45,7 +45,7 @@ protected: canvas->drawPath(path, paint); paint.setColor(SK_ColorGREEN); - paint.setPathEffect(NULL); + paint.setPathEffect(nullptr); paint.setStrokeWidth(0); canvas->drawPath(path, paint); } diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp index e0cb2d714f..3eee43d147 100644 --- a/gm/dcshader.cpp +++ b/gm/dcshader.cpp @@ -226,7 +226,7 @@ protected: void onDraw(SkCanvas* canvas) override { // This GM exists to test a specific feature of the GPU backend. It does not work with the // sw rasterizer, tile modes, etc. - if (NULL == canvas->getGrContext()) { + if (nullptr == canvas->getGrContext()) { this->drawGpuOnlyMessage(canvas); return; } diff --git a/gm/dftext.cpp b/gm/dftext.cpp index f6bc0b2b9c..c66e03fdc8 100644 --- a/gm/dftext.cpp +++ b/gm/dftext.cpp @@ -81,7 +81,7 @@ protected: canvas->scale(scales[i], scales[i]); paint.setTextSize(textSizes[i]); canvas->drawText(text, textLen, 0, 0, paint); - y += paint.getFontMetrics(NULL)*scales[i]; + y += paint.getFontMetrics(nullptr)*scales[i]; } // check rotation @@ -95,7 +95,7 @@ protected: for (int ps = 6; ps <= 32; ps += 3) { paint.setTextSize(SkIntToScalar(ps)); canvas->drawText(text, textLen, rotX, rotY, paint); - rotY += paint.getFontMetrics(NULL); + rotY += paint.getFontMetrics(nullptr); } } @@ -111,7 +111,7 @@ protected: canvas->scale(scaleFactor, scaleFactor); paint.setTextSize(textSizes[i]); canvas->drawText(text, textLen, 0, 0, paint); - y += paint.getFontMetrics(NULL)*scaleFactor; + y += paint.getFontMetrics(nullptr)*scaleFactor; } // check pos text @@ -156,7 +156,7 @@ protected: paint.setColor(fg[i]); canvas->drawText(text, textLen, x, y, paint); - y += paint.getFontMetrics(NULL); + y += paint.getFontMetrics(nullptr); } paint.setColor(0xFF181C18); @@ -170,7 +170,7 @@ protected: paint.setColor(fg[i]); canvas->drawText(text, textLen, x, y, paint); - y += paint.getFontMetrics(NULL); + y += paint.getFontMetrics(nullptr); } // check skew @@ -202,7 +202,7 @@ protected: // since we prepended this matrix already, we blit using identity inputCanvas->resetMatrix(); SkImage* image = surface->newImageSnapshot(); - inputCanvas->drawImage(image, 0, 0, NULL); + inputCanvas->drawImage(image, 0, 0, nullptr); image->unref(); } #endif diff --git a/gm/discard.cpp b/gm/discard.cpp index 93da1ab52a..85ef382ae7 100644 --- a/gm/discard.cpp +++ b/gm/discard.cpp @@ -37,7 +37,7 @@ protected: void onDraw(SkCanvas* canvas) override { GrContext* context = canvas->getGrContext(); - if (NULL == context) { + if (nullptr == context) { return; } @@ -47,7 +47,7 @@ protected: SkImageInfo info = SkImageInfo::MakeN32Premul(size); SkSurface* surface = SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info); - if (NULL == surface) { + if (nullptr == surface) { return; } @@ -73,7 +73,7 @@ protected: surface->getCanvas()->drawPaint(paint); break; } - surface->draw(canvas, 10.f*x, 10.f*y, NULL); + surface->draw(canvas, 10.f*x, 10.f*y, nullptr); } } diff --git a/gm/displacement.cpp b/gm/displacement.cpp index 4450fe2eec..353d14ecd8 100644 --- a/gm/displacement.cpp +++ b/gm/displacement.cpp @@ -118,53 +118,53 @@ protected: paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kG_ChannelSelectorType, - 0.0f, displ, NULL, &cropRect))->unref(); + 0.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 0, 200, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kB_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 16.0f, displ, NULL, &cropRect))->unref(); + 16.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 100, 200, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kB_ChannelSelectorType, - 32.0f, displ, NULL, &cropRect))->unref(); + 32.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 200, 200, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kG_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 48.0f, displ, NULL, &cropRect))->unref(); + 48.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 300, 200, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 64.0f, displ, NULL, &cropRect))->unref(); + 64.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 400, 200, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kG_ChannelSelectorType, - 40.0f, displ, NULL, &cropRect))->unref(); + 40.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 0, 300, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kB_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 40.0f, displ, NULL, &cropRect))->unref(); + 40.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 100, 300, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kB_ChannelSelectorType, - 40.0f, displ, NULL, &cropRect))->unref(); + 40.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 200, 300, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kG_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 40.0f, displ, NULL, &cropRect))->unref(); + 40.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 300, 300, paint); paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kR_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 40.0f, displ, NULL, &cropRect))->unref(); + 40.0f, displ, nullptr, &cropRect))->unref(); drawClippedBitmap(canvas, 400, 300, paint); // Tests for images of different sizes @@ -199,7 +199,7 @@ protected: paint.setImageFilter(SkDisplacementMapEffect::Create( SkDisplacementMapEffect::kG_ChannelSelectorType, SkDisplacementMapEffect::kA_ChannelSelectorType, - 40.0f, NULL))->unref(); + 40.0f, nullptr))->unref(); drawClippedBitmap(canvas, 400, 400, paint); } diff --git a/gm/distantclip.cpp b/gm/distantclip.cpp index 54938b0d13..dbfe9160a8 100644 --- a/gm/distantclip.cpp +++ b/gm/distantclip.cpp @@ -34,7 +34,7 @@ protected: // We record a picture of huge vertical extents in which we clear the canvas to red, create // a 'extents' by 'extents' round rect clip at a vertical offset of 'offset', then draw // green into that. - SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, NULL, 0); + SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, nullptr, 0); rec->drawColor(SK_ColorRED); rec->save(); SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents); @@ -48,7 +48,7 @@ protected: // Next we play that picture into another picture of the same size. pict->playback(recorder.beginRecording(pict->cullRect().width(), pict->cullRect().height(), - NULL, 0)); + nullptr, 0)); SkAutoTUnref<SkPicture> pict2(recorder.endRecording()); // Finally we play the part of that second picture that should be green into the canvas. diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp index 5732378703..d7a8b35927 100644 --- a/gm/downsamplebitmap.cpp +++ b/gm/downsamplebitmap.cpp @@ -171,7 +171,7 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM { int fSize; void make_bitmap() override { - SkImageDecoder* codec = NULL; + SkImageDecoder* codec = nullptr; SkString resourcePath = GetResourcePath(fFilename.c_str()); SkFILEStream stream(resourcePath.c_str()); if (stream.isValid()) { @@ -219,20 +219,20 @@ protected: void onDraw(SkCanvas* canvas) override { SkScalar x = 4; SkScalar y = 4; - canvas->drawBitmap(fBM, x, y, NULL); + canvas->drawBitmap(fBM, x, y, nullptr); y += fBM.height() + 4; - SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(fBM, NULL)); + SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(fBM, nullptr)); SkMipMap::Level level; SkScalar scale = 0.5f; while (mm->extractLevel(scale, &level)) { SkImageInfo info = SkImageInfo::MakeN32Premul(level.fWidth, level.fHeight); SkBitmap bm; - bm.installPixels(info, level.fPixels, level.fRowBytes, NULL, + bm.installPixels(info, level.fPixels, level.fRowBytes, nullptr, &release_mipmap, (void*)(SkRef(mm.get()))); bm.setImmutable(); - canvas->drawBitmap(bm, x, y, NULL); + canvas->drawBitmap(bm, x, y, nullptr); y += bm.height() + 4; scale /= 2; if (info.width() == 1 || info.height() == 1) { diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp index 89bd49c0a2..858e4bf056 100644 --- a/gm/drawatlas.cpp +++ b/gm/drawatlas.cpp @@ -14,7 +14,7 @@ class DrawAtlasGM : public skiagm::GM { static SkImage* MakeAtlas(SkCanvas* caller, const SkRect& target) { SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); SkAutoTUnref<SkSurface> surface(caller->newSurface(info)); - if (NULL == surface) { + if (nullptr == surface) { surface.reset(SkSurface::NewRaster(info)); } SkCanvas* canvas = surface->getCanvas(); @@ -28,7 +28,7 @@ class DrawAtlasGM : public skiagm::GM { r.inset(-1, -1); // zero out a place (with a 1-pixel border) to land our drawing. canvas->drawRect(r, paint); - paint.setXfermode(NULL); + paint.setXfermode(nullptr); paint.setColor(SK_ColorBLUE); paint.setAntiAlias(true); canvas->drawOval(target, paint); @@ -52,7 +52,7 @@ protected: void onDraw(SkCanvas* canvas) override { const SkRect target = { 50, 50, 80, 90 }; - if (NULL == fAtlas) { + if (nullptr == fAtlas) { fAtlas.reset(MakeAtlas(canvas, target)); } @@ -91,9 +91,9 @@ protected: paint.setFilterQuality(kLow_SkFilterQuality); paint.setAntiAlias(true); - canvas->drawAtlas(fAtlas, xform, tex, N, NULL, &paint); + canvas->drawAtlas(fAtlas, xform, tex, N, nullptr, &paint); canvas->translate(0, 100); - canvas->drawAtlas(fAtlas, xform, tex, colors, N, SkXfermode::kSrcIn_Mode, NULL, &paint); + canvas->drawAtlas(fAtlas, xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint); } private: diff --git a/gm/drawatlascolor.cpp b/gm/drawatlascolor.cpp index a04822f033..b5f9d7a285 100644 --- a/gm/drawatlascolor.cpp +++ b/gm/drawatlascolor.cpp @@ -20,7 +20,7 @@ static SkImage* make_atlas(SkCanvas* caller, int atlasSize) { SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize); SkAutoTUnref<SkSurface> surface(caller->newSurface(info)); - if (NULL == surface) { + if (nullptr == surface) { surface.reset(SkSurface::NewRaster(info)); } SkCanvas* canvas = surface->getCanvas(); @@ -72,7 +72,7 @@ protected: void onDraw(SkCanvas* canvas) override { const SkRect target = SkRect::MakeWH(SkIntToScalar(kAtlasSize), SkIntToScalar(kAtlasSize)); - if (NULL == fAtlas) { + if (nullptr == fAtlas) { fAtlas.reset(make_atlas(canvas, kAtlasSize)); } @@ -138,7 +138,7 @@ protected: SkPaint textP; textP.setTextSize(SkIntToScalar(kTextPad)); textP.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&textP, NULL); + sk_tool_utils::set_portable_typeface(&textP, nullptr); for (int i = 0; i < numModes; ++i) { canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel), @@ -152,11 +152,11 @@ protected: SkIntToScalar(kTextPad+kPad)); // w/o a paint canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors, - gModes[i].fMode, NULL, NULL); + gModes[i].fMode, nullptr, nullptr); canvas->translate(0.0f, numColors*(target.height()+kPad)); // w a paint canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors, - gModes[i].fMode, NULL, &paint); + gModes[i].fMode, nullptr, &paint); canvas->restore(); } } diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp index 2a41465a35..dd6d2b7a7d 100644 --- a/gm/drawbitmaprect.cpp +++ b/gm/drawbitmaprect.cpp @@ -81,12 +81,12 @@ static SkImage* makebm(SkBitmap* bm, int w, int h) { static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkIRect& srcR, const SkRect& dstR) { - canvas->drawBitmapRect(bm, srcR, dstR, NULL); + canvas->drawBitmapRect(bm, srcR, dstR, nullptr); } static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcR, const SkRect& dstR) { - canvas->drawImageRect(image, srcR, dstR, NULL); + canvas->drawImageRect(image, srcR, dstR, nullptr); } static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcIR, @@ -226,6 +226,6 @@ private: typedef skiagm::GM INHERITED; }; -DEF_GM( return new DrawBitmapRectGM(canvasproc, NULL); ) +DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); ) diff --git a/gm/drawfilter.cpp b/gm/drawfilter.cpp index 8c29f07b02..b0a21e9a11 100644 --- a/gm/drawfilter.cpp +++ b/gm/drawfilter.cpp @@ -24,7 +24,7 @@ class TestFilter : public SkDrawFilter { public: bool filter(SkPaint* p, Type) override { p->setColor(SK_ColorRED); - p->setMaskFilter(NULL); + p->setMaskFilter(nullptr); return true; } }; @@ -53,7 +53,7 @@ protected: p.setColor(SK_ColorBLUE); p.setMaskFilter(fBlur.get()); SkRect r = { 20, 20, 100, 100 }; - canvas->setDrawFilter(NULL); + canvas->setDrawFilter(nullptr); canvas->drawRect(r, p); TestFilter redNoBlur; canvas->setDrawFilter(&redNoBlur); @@ -61,7 +61,7 @@ protected: canvas->drawRect(r, p); // Must unset if the DrawFilter is from the stack to avoid refcount errors! - canvas->setDrawFilter(NULL); + canvas->setDrawFilter(nullptr); } private: diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp index 624358f7eb..ffa7d6c91b 100644 --- a/gm/drawlooper.cpp +++ b/gm/drawlooper.cpp @@ -18,7 +18,7 @@ class DrawLooperGM : public skiagm::GM { public: - DrawLooperGM() : fLooper(NULL) { + DrawLooperGM() : fLooper(nullptr) { this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp index 56f99082f4..85071c56c4 100644 --- a/gm/drawminibitmaprect.cpp +++ b/gm/drawminibitmaprect.cpp @@ -16,7 +16,7 @@ static SkImage* makebm(SkCanvas* caller, int w, int h) { SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); SkAutoTUnref<SkSurface> surface(caller->newSurface(info)); - if (NULL == surface) { + if (nullptr == surface) { surface.reset(SkSurface::NewRaster(info)); } SkCanvas* canvas = surface->getCanvas(); @@ -79,7 +79,7 @@ protected: SkISize onISize() override { return SkISize::Make(gSize, gSize); } void onDraw(SkCanvas* canvas) override { - if (NULL == fImage) { + if (nullptr == fImage) { fImage.reset(makebm(canvas, gSurfaceSize, gSurfaceSize)); } diff --git a/gm/dropshadowimagefilter.cpp b/gm/dropshadowimagefilter.cpp index e06264c9da..1b6bca42d0 100644 --- a/gm/dropshadowimagefilter.cpp +++ b/gm/dropshadowimagefilter.cpp @@ -58,7 +58,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { bm.allocN32Pixels(bounds.width(), bounds.height()); bm.eraseColor(SK_ColorTRANSPARENT); SkCanvas c(bm); - draw_path(&c, r, NULL); + draw_path(&c, r, nullptr); paint.setImageFilter(imf); canvas->save(); @@ -125,7 +125,7 @@ protected: SkImageFilter::CropRect::kHasAll_CropEdge); SkImageFilter* filters[] = { - NULL, + nullptr, SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), SkDropShadowImageFilter::Create(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE, @@ -133,11 +133,11 @@ protected: SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, - SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, cfif, NULL), + SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, cfif, nullptr), SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, - SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NULL, &cropRect), + SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr, &cropRect), SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, - SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NULL, &bogusRect), + SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr, &bogusRect), SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode), }; diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp index 363bd4419c..11a700eabc 100644 --- a/gm/etc1bitmap.cpp +++ b/gm/etc1bitmap.cpp @@ -98,7 +98,7 @@ protected: SkString filename = GetResourcePath("mandrill_128."); filename.append(this->fileExtension()); SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str())); - if (NULL == fileData) { + if (nullptr == fileData) { SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n"); return; } @@ -182,7 +182,7 @@ protected: SkBitmap bm; SkString pkmFilename = GetResourcePath("mandrill_128.pkm"); SkAutoDataUnref fileData(SkData::NewFromFileName(pkmFilename.c_str())); - if (NULL == fileData) { + if (nullptr == fileData) { SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n"); return; } diff --git a/gm/factory.cpp b/gm/factory.cpp index 0a938629b9..66cb65ee24 100644 --- a/gm/factory.cpp +++ b/gm/factory.cpp @@ -37,7 +37,7 @@ protected: SkAutoTUnref<SkDiscardableMemoryPool> pool( SkDiscardableMemoryPool::Create(1)); SkAssertResult(SkInstallDiscardablePixelRef(SkImageGenerator::NewFromEncoded(data), - NULL, &fBitmap, pool)); + nullptr, &fBitmap, pool)); } } diff --git a/gm/fatpathfill.cpp b/gm/fatpathfill.cpp index 711d713852..be5fbc4d56 100644 --- a/gm/fatpathfill.cpp +++ b/gm/fatpathfill.cpp @@ -36,7 +36,7 @@ static void draw_fatpath(SkCanvas* canvas, SkSurface* surface, const SkPath& pat surface->getCanvas()->clear(SK_ColorTRANSPARENT); surface->getCanvas()->drawPath(path, paint); - surface->draw(canvas, 0, 0, NULL); + surface->draw(canvas, 0, 0, nullptr); paint.setAntiAlias(true); paint.setColor(SK_ColorRED); diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp index 1af16959c2..5c63910a78 100644 --- a/gm/filterbitmap.cpp +++ b/gm/filterbitmap.cpp @@ -196,7 +196,7 @@ protected: } void makeBitmap() override { - SkImageDecoder* codec = NULL; + SkImageDecoder* codec = nullptr; SkString resourcePath = GetResourcePath(fFilename.c_str()); SkFILEStream stream(resourcePath.c_str()); if (stream.isValid()) { diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp index f6797db9f3..fe06ff1049 100644 --- a/gm/filterfastbounds.cpp +++ b/gm/filterfastbounds.cpp @@ -116,7 +116,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) { SkDropShadowImageFilter::Create(10.0f, 10.0f, 3.0f, 3.0f, SK_ColorRED, kBoth, - source, NULL)); + source, nullptr)); add_paint(dsif, paints); } @@ -127,7 +127,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) { 3.0f, 3.0f, SK_ColorRED, SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode, - source, NULL)); + source, nullptr)); add_paint(dsif, paints); } @@ -231,7 +231,7 @@ protected: //----------- // Normal paints (no source) SkTArray<SkPaint> paints; - create_paints(NULL, &paints); + create_paints(nullptr, &paints); //----------- // Paints with a PictureImageFilter as a source diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp index 8df39bcec7..c5d7166423 100644 --- a/gm/filterindiabox.cpp +++ b/gm/filterindiabox.cpp @@ -99,7 +99,7 @@ protected: } void makeBitmap() { - SkImageDecoder* codec = NULL; + SkImageDecoder* codec = nullptr; SkString resourcePath = GetResourcePath(fFilename.c_str()); SkFILEStream stream(resourcePath.c_str()); if (stream.isValid()) { diff --git a/gm/fontcache.cpp b/gm/fontcache.cpp index 77a4c86572..30f8892c78 100644 --- a/gm/fontcache.cpp +++ b/gm/fontcache.cpp @@ -21,8 +21,8 @@ static SkScalar draw_string(SkCanvas* canvas, const SkString& text, SkScalar x, class FontCacheGM : public skiagm::GM { public: FontCacheGM() { - fTypefaces[0] = NULL; - fTypefaces[1] = NULL; + fTypefaces[0] = nullptr; + fTypefaces[1] = nullptr; } virtual ~FontCacheGM() { diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp index 9339115d0b..67be00d0ac 100644 --- a/gm/fontmgr.cpp +++ b/gm/fontmgr.cpp @@ -36,7 +36,7 @@ static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x, SkSafeUnref(paint.setTypeface(typeface)); x = drawString(canvas, ch, x, y, paint) + 20; - if (NULL == typeface) { + if (nullptr == typeface) { return x; } @@ -55,7 +55,7 @@ static const char* ja = "ja"; class FontMgrGM : public skiagm::GM { public: - FontMgrGM(SkFontMgr* fontMgr = NULL) { + FontMgrGM(SkFontMgr* fontMgr = nullptr) { SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); fName.set("fontmgr_iter"); @@ -92,7 +92,7 @@ protected: for (int i = 0; i < count; ++i) { SkString familyName; fm->getFamilyName(i, &familyName); - paint.setTypeface(NULL); + paint.setTypeface(nullptr); (void)drawString(canvas, familyName, 20, y, paint); SkScalar x = 220; @@ -111,7 +111,7 @@ protected: x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_str(), &zh, 1, fs); x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_str(), &ja, 1, fs); // check that emoji characters are found - x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c_str(), NULL,0, fs); + x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c_str(), nullptr,0, fs); } y += 24; } @@ -199,7 +199,7 @@ protected: break; } } - if (NULL == fset.get()) { + if (nullptr == fset.get()) { return; } diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp index 6087478566..69cf346c4d 100644 --- a/gm/fontscaler.cpp +++ b/gm/fontscaler.cpp @@ -73,7 +73,7 @@ protected: for (int ps = 6; ps <= 22; ps++) { paint.setTextSize(SkIntToScalar(ps)); canvas->drawText(text, textLen, x, y, paint); - y += paint.getFontMetrics(NULL); + y += paint.getFontMetrics(nullptr); } } canvas->translate(0, SkIntToScalar(360)); diff --git a/gm/fontscalerdistortable.cpp b/gm/fontscalerdistortable.cpp index 715f32169c..a207f967fd 100644 --- a/gm/fontscalerdistortable.cpp +++ b/gm/fontscalerdistortable.cpp @@ -75,7 +75,7 @@ protected: for (int ps = 6; ps <= 22; ps++) { paint.setTextSize(SkIntToScalar(ps)); canvas->drawText(text, textLen, x, y, paint); - y += paint.getFontMetrics(NULL); + y += paint.getFontMetrics(nullptr); } } canvas->translate(0, SkIntToScalar(360)); diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp index a46f828784..63acb40c13 100644 --- a/gm/gammatext.cpp +++ b/gm/gammatext.cpp @@ -14,7 +14,7 @@ static SkShader* make_heatGradient(const SkPoint pts[2]) { const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE }; - return SkGradientShader::CreateLinear(pts, bw, NULL, + return SkGradientShader::CreateLinear(pts, bw, nullptr, SK_ARRAY_COUNT(bw), SkShader::kClamp_TileMode); } @@ -106,7 +106,7 @@ static SkShader* make_gradient(SkColor c) { SkColor colors[2]; colors[0] = c; colors[1] = SkColorSetA(c, 0); - return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode); + return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode); } static void set_face(SkPaint* paint) { @@ -118,7 +118,7 @@ static void draw_pair(SkCanvas* canvas, SkPaint* paint, SkShader* shader) { const char text[] = "Now is the time for all good"; const size_t len = strlen(text); - paint->setShader(NULL); + paint->setShader(nullptr); canvas->drawText(text, len, 10, 20, *paint); paint->setShader(SkShader::CreateColorShader(paint->getColor()))->unref(); canvas->drawText(text, len, 10, 40, *paint); @@ -134,7 +134,7 @@ public: GammaShaderTextGM() { const SkColor colors[] = { SK_ColorBLACK, SK_ColorRED, SK_ColorBLUE }; for (size_t i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) { - fShaders[i] = NULL; + fShaders[i] = nullptr; fColors[i] = colors[i]; } } diff --git a/gm/giantbitmap.cpp b/gm/giantbitmap.cpp index e8bfad4990..571dbd8114 100644 --- a/gm/giantbitmap.cpp +++ b/gm/giantbitmap.cpp @@ -25,7 +25,7 @@ class GiantBitmapGM : public skiagm::GM { bool fDoRotate; const SkBitmap& getBitmap() { - if (NULL == fBM) { + if (nullptr == fBM) { fBM = new SkBitmap; fBM->allocN32Pixels(W, H); fBM->eraseColor(SK_ColorWHITE); @@ -60,7 +60,7 @@ class GiantBitmapGM : public skiagm::GM { } public: - GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(NULL) { + GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(nullptr) { fMode = mode; fDoFilter = doFilter; fDoRotate = doRotate; diff --git a/gm/glyph_pos.cpp b/gm/glyph_pos.cpp index e57f5c6767..15229b8dab 100644 --- a/gm/glyph_pos.cpp +++ b/gm/glyph_pos.cpp @@ -138,7 +138,7 @@ protected: if (drawRef) { SkScalar widths[sizeof(kText) - 1]; - paint.getTextWidths(kText, sizeof(kText) - 1, widths, NULL); + paint.getTextWidths(kText, sizeof(kText) - 1, widths, nullptr); paint.setStrokeWidth(0.0f); paint.setStyle(SkPaint::kStroke_Style); diff --git a/gm/glyph_pos_align.cpp b/gm/glyph_pos_align.cpp index e8528047aa..9add494ffd 100644 --- a/gm/glyph_pos_align.cpp +++ b/gm/glyph_pos_align.cpp @@ -36,7 +36,7 @@ protected: paint.setFakeBoldText(true); const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; - SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors, NULL, + SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode)); paint.setShader(grad); diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h index 029a533c62..6767b90f51 100644 --- a/gm/gm_expectations.h +++ b/gm/gm_expectations.h @@ -147,10 +147,10 @@ namespace skiagm { * If this Expectation is based on a single SkBitmap, return a * pointer to that SkBitmap. Otherwise (if the Expectation is * empty, or if it was based on a list of checksums rather - * than a single bitmap), returns NULL. + * than a single bitmap), returns nullptr. */ const SkBitmap *asBitmap() const { - return (kUnknown_SkColorType == fBitmap.colorType()) ? NULL : &fBitmap; + return (kUnknown_SkColorType == fBitmap.colorType()) ? nullptr : &fBitmap; } /** diff --git a/gm/gradientDirtyLaundry.cpp b/gm/gradientDirtyLaundry.cpp index 2ba0963013..8ef5fc9229 100644 --- a/gm/gradientDirtyLaundry.cpp +++ b/gm/gradientDirtyLaundry.cpp @@ -30,9 +30,9 @@ static const SkColor gColors[] = { //static const SkScalar gPos[] = { SK_Scalar1*999/2000, SK_Scalar1*1001/2000 }; static const GradData gGradData[] = { - { 40, gColors, NULL }, + { 40, gColors, nullptr }, // { 2, gColors, gPos }, - // { 2, gCol2, NULL }, + // { 2, gCol2, nullptr }, }; static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp index 10499ca986..77227599e6 100644 --- a/gm/gradient_matrix.cpp +++ b/gm/gradient_matrix.cpp @@ -62,7 +62,7 @@ static const SkScalar TESTGRID_Y = SkIntToScalar(200); static const int IMAGES_X = 4; // number of images per row static SkShader* make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) { - return SkGradientShader::CreateLinear(pts, gColors, NULL, SK_ARRAY_COUNT(gColors), + return SkGradientShader::CreateLinear(pts, gColors, nullptr, SK_ARRAY_COUNT(gColors), SkShader::kClamp_TileMode, 0, &localMatrix); } @@ -71,7 +71,7 @@ static SkShader* make_radial_gradient(const SkPoint pts[2], const SkMatrix& loca center.set(SkScalarAve(pts[0].fX, pts[1].fX), SkScalarAve(pts[0].fY, pts[1].fY)); float radius = (center - pts[0]).length(); - return SkGradientShader::CreateRadial(center, radius, gColors, NULL, SK_ARRAY_COUNT(gColors), + return SkGradientShader::CreateRadial(center, radius, gColors, nullptr, SK_ARRAY_COUNT(gColors), SkShader::kClamp_TileMode, 0, &localMatrix); } diff --git a/gm/gradients.cpp b/gm/gradients.cpp index ea2b8eae6b..ee6380c7ca 100644 --- a/gm/gradients.cpp +++ b/gm/gradients.cpp @@ -31,10 +31,10 @@ static const SkColor gColorClamp[] = { }; static const GradData gGradData[] = { - { 2, gColors, NULL }, + { 2, gColors, nullptr }, { 2, gColors, gPos0 }, { 2, gColors, gPos1 }, - { 5, gColors, NULL }, + { 5, gColors, nullptr }, { 5, gColors, gPos2 }, { 4, gColorClamp, gPosClamp } }; @@ -311,7 +311,7 @@ protected: canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); SkShader* shader = SkGradientShader::CreateRadial( SkPoint(center), - SkIntToScalar(200), gColors, NULL, 5, + SkIntToScalar(200), gColors, nullptr, 5, SkShader::kClamp_TileMode); paint.setShader(shader); canvas->drawRect(r, paint); @@ -401,18 +401,18 @@ protected: for (size_t i = 0; i < SK_ARRAY_COUNT(flags); i++) { SkAutoTUnref<SkShader> sweep( SkGradientShader::CreateSweep(cx, cy, sweep_colors, - NULL, SK_ARRAY_COUNT(sweep_colors), - flags[i], NULL)); + nullptr, SK_ARRAY_COUNT(sweep_colors), + flags[i], nullptr)); SkAutoTUnref<SkShader> radial1( SkGradientShader::CreateRadial(center, radius, colors1, - NULL, SK_ARRAY_COUNT(colors1), + nullptr, SK_ARRAY_COUNT(colors1), SkShader::kClamp_TileMode, - flags[i], NULL)); + flags[i], nullptr)); SkAutoTUnref<SkShader> radial2( SkGradientShader::CreateRadial(center, radius, colors2, - NULL, SK_ARRAY_COUNT(colors2), + nullptr, SK_ARRAY_COUNT(colors2), SkShader::kClamp_TileMode, - flags[i], NULL)); + flags[i], nullptr)); paint1.setShader(sweep); paint2.setShader(radial1); paint3.setShader(radial2); @@ -445,7 +445,7 @@ protected: const SkPoint center = { 0, 0 }; const SkScalar kRadius = 3000; const SkColor gColors[] = { 0xFFFFFFFF, 0xFF000000 }; - fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, NULL, 2, + fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, nullptr, 2, SkShader::kClamp_TileMode)); } diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp index d06ae5bdbf..3e73d1b4b3 100644 --- a/gm/gradients_no_texture.cpp +++ b/gm/gradients_no_texture.cpp @@ -20,10 +20,10 @@ static const SkColor gColors[] = { }; static const GradData gGradData[] = { - { 1, gColors, NULL }, - { 2, gColors, NULL }, - { 3, gColors, NULL }, - { 4, gColors, NULL }, + { 1, gColors, nullptr }, + { 2, gColors, nullptr }, + { 3, gColors, nullptr }, + { 4, gColors, nullptr }, }; static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { @@ -126,7 +126,7 @@ struct ColorPos { SkScalar* fPos; int fCount; - ColorPos() : fColors(NULL), fPos(NULL), fCount(0) {} + ColorPos() : fColors(nullptr), fPos(nullptr), fCount(0) {} ~ColorPos() { delete[] fColors; delete[] fPos; @@ -180,7 +180,7 @@ static void make1(ColorPos* rec) { SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, }; - rec->construct(colors, NULL, SK_ARRAY_COUNT(colors)); + rec->construct(colors, nullptr, SK_ARRAY_COUNT(colors)); } static void make2(ColorPos* rec) { diff --git a/gm/gradtext.cpp b/gm/gradtext.cpp index b576ede644..acb88d6e52 100644 --- a/gm/gradtext.cpp +++ b/gm/gradtext.cpp @@ -14,7 +14,7 @@ static SkShader* make_grad(SkScalar width) { SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE }; SkPoint pts[] = { { 0, 0 }, { width, 0 } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); } @@ -23,7 +23,7 @@ static SkShader* make_grad(SkScalar width) { static SkShader* make_grad2(SkScalar width) { SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; SkPoint pts[] = { { 0, 0 }, { width, 0 } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); } @@ -31,7 +31,7 @@ static SkShader* make_grad2(SkScalar width) { static SkShader* make_chrome_solid() { SkColor colors[] = { SK_ColorGREEN, SK_ColorGREEN }; SkPoint pts[] = { { 0, 0 }, { 1, 0 } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, 2, + return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode); } diff --git a/gm/hairmodes.cpp b/gm/hairmodes.cpp index 74eda7b913..4f85c19883 100644 --- a/gm/hairmodes.cpp +++ b/gm/hairmodes.cpp @@ -106,7 +106,7 @@ namespace skiagm { SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); canvas->drawRect(bounds, fBGPaint); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); SkScalar dy = drawCell(canvas, mode, gAlphaValue[alpha & 1], gAlphaValue[alpha & 2]); diff --git a/gm/image.cpp b/gm/image.cpp index 205b4ab278..726ab97a8f 100644 --- a/gm/image.cpp +++ b/gm/image.cpp @@ -21,7 +21,7 @@ static void drawJpeg(SkCanvas* canvas, const SkISize& size) { // be exercised on machines other than mike's. Will require a // rebaseline. SkAutoDataUnref data(SkData::NewFromFileName("/Users/mike/Downloads/skia.google.jpeg")); - if (NULL == data.get()) { + if (nullptr == data.get()) { return; } SkImage* image = SkImage::NewFromEncoded(data); @@ -29,7 +29,7 @@ static void drawJpeg(SkCanvas* canvas, const SkISize& size) { SkAutoCanvasRestore acr(canvas, true); canvas->scale(size.width() * 1.0f / image->width(), size.height() * 1.0f / image->height()); - canvas->drawImage(image, 0, 0, NULL); + canvas->drawImage(image, 0, 0, nullptr); image->unref(); } } @@ -76,9 +76,9 @@ static void test_surface(SkCanvas* canvas, SkSurface* surf, bool usePaint) { // paint.setFilterBitmap(true); // paint.setAlpha(0x80); - canvas->drawImage(imgR, 0, 0, usePaint ? &paint : NULL); - canvas->drawImage(imgG, 0, 80, usePaint ? &paint : NULL); - surf->draw(canvas, 0, 160, usePaint ? &paint : NULL); + canvas->drawImage(imgR, 0, 0, usePaint ? &paint : nullptr); + canvas->drawImage(imgG, 0, 80, usePaint ? &paint : nullptr); + surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr); SkRect src1, src2, src3; src1.iset(0, 0, surf->width(), surf->height()); @@ -92,10 +92,10 @@ static void test_surface(SkCanvas* canvas, SkSurface* surf, bool usePaint) { dst3.set(0, 400, 65, 465); dst4.set(0, 480, 65, 545); - canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : NULL); - canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : NULL); - canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : NULL); - canvas->drawImageRect(imgG, dst4, usePaint ? &paint : NULL); + canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : nullptr); + canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : nullptr); + canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : nullptr); + canvas->drawImageRect(imgG, dst4, usePaint ? &paint : nullptr); imgG->unref(); imgR->unref(); @@ -241,20 +241,20 @@ protected: if (subset) { srcR.set(*subset); } - canvas->legacy_drawImageRect(image, subset ? &srcR : NULL, dstR, &paint); + canvas->legacy_drawImageRect(image, subset ? &srcR : nullptr, dstR, &paint); canvas->translate(newW + 20.0f, 0); // image method SkAutoTUnref<SkImage> image2(image->newImage(newW, newH, subset, fq)); - canvas->drawImage(image2, 0, 0, NULL); + canvas->drawImage(image2, 0, 0, nullptr); canvas->translate(image2->width() + 20.0f, 0); } void drawImage(SkCanvas* canvas, SkImage* image, SkFilterQuality fq) { - canvas->drawImage(image, 0, 0, NULL); + canvas->drawImage(image, 0, 0, nullptr); canvas->translate(image->width() + 20.0f, 0); - this->drawResized(canvas, image, image->width()*4/10, image->height()*4/10, NULL, fq); + this->drawResized(canvas, image, image->width()*4/10, image->height()*4/10, nullptr, fq); SkIRect subset = SkIRect::MakeLTRB(W/4, H/4, W/2, H/2); this->drawResized(canvas, image, W, H, &subset, fq); diff --git a/gm/imagealphathreshold.cpp b/gm/imagealphathreshold.cpp index a418f0fe68..13a0ffa90b 100644 --- a/gm/imagealphathreshold.cpp +++ b/gm/imagealphathreshold.cpp @@ -47,7 +47,7 @@ protected: SkPaint paint; paint.setImageFilter( SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f))->unref(); - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); paint.setAntiAlias(true); SkPaint rect_paint; diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp index efb5988d65..f6ac0982b7 100644 --- a/gm/imageblur.cpp +++ b/gm/imageblur.cpp @@ -35,7 +35,7 @@ protected: void onDraw(SkCanvas* canvas) override { SkPaint paint; paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref(); - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); const char* str = "The quick brown fox jumped over the lazy dog."; SkRandom rand; diff --git a/gm/imageblur2.cpp b/gm/imageblur2.cpp index 58e40961e4..223582f120 100644 --- a/gm/imageblur2.cpp +++ b/gm/imageblur2.cpp @@ -59,7 +59,7 @@ protected: SkPaint paint; paint.setImageFilter(SkBlurImageFilter::Create(sigmaX, sigmaY))->unref(); - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); SkRandom rand; SkPaint textPaint; diff --git a/gm/imageblurtiled.cpp b/gm/imageblurtiled.cpp index ed4ae6cef3..68e5785ddf 100644 --- a/gm/imageblurtiled.cpp +++ b/gm/imageblurtiled.cpp @@ -41,7 +41,7 @@ protected: for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size) { canvas->save(); canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); const char* str[] = { "The quick", "brown fox", diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp index 54e50e47f2..e28bf5255e 100644 --- a/gm/imagefilters.cpp +++ b/gm/imagefilters.cpp @@ -31,7 +31,7 @@ protected: // want to force a layer, so modes like DstIn can combine meaningfully, but the final // image can still be shown against our default (opaque) background. non-opaque GMs // are a lot more trouble to compare/triage. - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); canvas->drawColor(SK_ColorGREEN); SkPaint paint; @@ -62,7 +62,7 @@ protected: for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) { canvas->save(); - this->doDraw(canvas, modes[i], NULL); + this->doDraw(canvas, modes[i], nullptr); canvas->translate(240, 0); this->doDraw(canvas, modes[i], imf); canvas->restore(); diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp index 61c3f11f58..0101a9c2a0 100644 --- a/gm/imagefiltersbase.cpp +++ b/gm/imagefiltersbase.cpp @@ -32,7 +32,7 @@ public: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) protected: - FailImageFilter() : INHERITED(0, NULL) {} + FailImageFilter() : INHERITED(0, nullptr) {} bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result, SkIPoint* offset) const override { @@ -67,7 +67,7 @@ public: IdentityImageFilter::GetFlattenableType()); } }; - static IdentityImageFilter* Create(SkImageFilter* input = NULL) { + static IdentityImageFilter* Create(SkImageFilter* input = nullptr) { return new IdentityImageFilter(input); } @@ -160,7 +160,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { bm.allocN32Pixels(bounds.width(), bounds.height()); bm.eraseColor(SK_ColorTRANSPARENT); SkCanvas c(bm); - draw_path(&c, r, NULL); + draw_path(&c, r, nullptr); canvas->drawBitmap(bm, 0, 0, &paint); } @@ -176,7 +176,7 @@ static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { bm.allocN32Pixels(bounds.width(), bounds.height()); bm.eraseColor(SK_ColorTRANSPARENT); SkCanvas c(bm); - draw_path(&c, r, NULL); + draw_path(&c, r, nullptr); SkPoint loc = { r.fLeft, r.fTop }; canvas->getTotalMatrix().mapPoints(&loc, 1); @@ -216,7 +216,7 @@ protected: SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode); SkImageFilter* filters[] = { - NULL, + nullptr, IdentityImageFilter::Create(), FailImageFilter::Create(), SkColorFilterImageFilter::Create(cf), @@ -309,8 +309,8 @@ protected: this->installFilter(&paint); } if (doSaveLayer) { - canvas->saveLayer(NULL, &paint); - paint.setImageFilter(NULL); + canvas->saveLayer(nullptr, &paint); + paint.setImageFilter(nullptr); } this->drawWaterfall(canvas, paint); diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp index a641ca3473..362d327b37 100644 --- a/gm/imagefiltersclipped.cpp +++ b/gm/imagefiltersclipped.cpp @@ -53,7 +53,7 @@ protected: 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; diff --git a/gm/imagefilterscropexpand.cpp b/gm/imagefilterscropexpand.cpp index 8f90fb14bd..cfbf13a759 100644 --- a/gm/imagefilterscropexpand.cpp +++ b/gm/imagefilterscropexpand.cpp @@ -68,7 +68,7 @@ protected: 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; @@ -105,7 +105,7 @@ protected: SkAutoTUnref<SkImageFilter> gradient_circle_source( SkBitmapSource::Create(gradient_circle)); SkAutoTUnref<SkImageFilter> noop_cropped( - SkOffsetImageFilter::Create(0, 0, NULL, &crop_rect)); + SkOffsetImageFilter::Create(0, 0, nullptr, &crop_rect)); SkScalar sk255 = SkIntToScalar(255); SkScalar matrix[20] = { 1, 0, 0, 0, 0, 0, 1, 0, 0, sk255, diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp index c5bef7b3f8..92e45ea499 100644 --- a/gm/imagefilterscropped.cpp +++ b/gm/imagefilterscropped.cpp @@ -60,7 +60,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { bm.allocN32Pixels(bounds.width(), bounds.height()); bm.eraseColor(SK_ColorTRANSPARENT); SkCanvas c(bm); - draw_path(&c, r, NULL); + draw_path(&c, r, nullptr); paint.setImageFilter(imf); canvas->drawBitmap(bm, 0, 0, &paint); @@ -149,23 +149,23 @@ protected: SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get())); - SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, NULL, &cropRect)); - SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, NULL, &cropRect)); + SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, nullptr, &cropRect)); + SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, nullptr, &cropRect)); SkImageFilter* filters[] = { - NULL, - SkColorFilterImageFilter::Create(cf.get(), NULL, &cropRect), - SkBlurImageFilter::Create(1.0f, 1.0f, NULL, &cropRect), - SkBlurImageFilter::Create(8.0f, 0.0f, NULL, &cropRect), - SkBlurImageFilter::Create(0.0f, 8.0f, NULL, &cropRect), - SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &cropRect), - SkErodeImageFilter::Create(1, 1, NULL, &cropRect), + nullptr, + SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), + SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect), + SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect), + SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect), + SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect), + SkErodeImageFilter::Create(1, 1, nullptr, &cropRect), SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), - SkErodeImageFilter::Create(8, 8, NULL, &cropRect), - SkMergeImageFilter::Create(NULL, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect), - SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &bogusRect), - SkColorFilterImageFilter::Create(cf.get(), NULL, &bogusRect), + SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), + SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect), + SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect), + SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect), }; SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp index 521dd3c7ef..66b32e99c3 100644 --- a/gm/imagefiltersgraph.cpp +++ b/gm/imagefiltersgraph.cpp @@ -194,7 +194,7 @@ protected: SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcIn_Mode)); SkImageFilter::CropRect cropRect(SkRect::MakeWH(SkIntToScalar(95), SkIntToScalar(100))); SkAutoTUnref<SkImageFilter> blend( - SkXfermodeImageFilter::Create(mode, blur, NULL, &cropRect)); + SkXfermodeImageFilter::Create(mode, blur, nullptr, &cropRect)); SkPaint paint; paint.setImageFilter(blend); @@ -211,7 +211,7 @@ protected: SkIntToScalar(80), SkIntToScalar(80))); SkImageFilter::CropRect innerRect(SkRect::MakeXYWH(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(60), SkIntToScalar(60))); - SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1, NULL, &outerRect)); + SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1, nullptr, &outerRect)); SkAutoTUnref<SkImageFilter> color2(SkColorFilterImageFilter::Create(cf2, color1, &innerRect)); SkPaint paint; diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp index 2e4756a9b3..b53263606c 100644 --- a/gm/imagefiltersscaled.cpp +++ b/gm/imagefiltersscaled.cpp @@ -52,7 +52,7 @@ protected: 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; diff --git a/gm/imagefilterstransformed.cpp b/gm/imagefilterstransformed.cpp index 794a47167a..9259ce4fce 100644 --- a/gm/imagefilterstransformed.cpp +++ b/gm/imagefilterstransformed.cpp @@ -45,7 +45,7 @@ protected: 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; diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp index 68faf801c6..faa3eefa7e 100644 --- a/gm/imagefromyuvtextures.cpp +++ b/gm/imagefromyuvtextures.cpp @@ -41,7 +41,7 @@ protected: static const SkColor kColors[] = { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), kBmpSize / 2.f, kColors, - NULL, SK_ARRAY_COUNT(kColors), + nullptr, SK_ARRAY_COUNT(kColors), SkShader::kMirror_TileMode))->unref(); SkBitmap rgbBmp; rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true); @@ -156,7 +156,7 @@ protected: canvas->drawImage(images[i], x, y); images[i]->unref(); - images[i] = NULL; + images[i] = nullptr; } } diff --git a/gm/imagemagnifier.cpp b/gm/imagemagnifier.cpp index ac1941c121..2bf22262dc 100644 --- a/gm/imagemagnifier.cpp +++ b/gm/imagemagnifier.cpp @@ -38,7 +38,7 @@ protected: SkIntToScalar(WIDTH / 2), SkIntToScalar(HEIGHT / 2)), 100))->unref(); - canvas->saveLayer(NULL, &filterPaint); + canvas->saveLayer(nullptr, &filterPaint); const char* str = "The quick brown fox jumped over the lazy dog."; SkRandom rand; for (int i = 0; i < 25; ++i) { diff --git a/gm/imageresizetiled.cpp b/gm/imageresizetiled.cpp index bc640bc6aa..1da2bcea3a 100644 --- a/gm/imageresizetiled.cpp +++ b/gm/imageresizetiled.cpp @@ -47,7 +47,7 @@ protected: canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); canvas->scale(SkScalarInvert(RESIZE_FACTOR), SkScalarInvert(RESIZE_FACTOR)); - canvas->saveLayer(NULL, &paint); + canvas->saveLayer(nullptr, &paint); const char* str[] = { "The quick", "brown fox", diff --git a/gm/lerpmode.cpp b/gm/lerpmode.cpp index f690c76fa6..bcf17c37a8 100644 --- a/gm/lerpmode.cpp +++ b/gm/lerpmode.cpp @@ -18,7 +18,7 @@ static void show_circlelayers(SkCanvas* canvas, SkXfermode* mode) { r.fRight = bounds.centerX(); canvas->drawRect(r, paint); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); paint.setColor(0x80FF0000); r = bounds; @@ -48,7 +48,7 @@ protected: } void onDraw(SkCanvas* canvas) override { - show_circlelayers(canvas, NULL); + show_circlelayers(canvas, nullptr); canvas->translate(150, 0); SkAutoTUnref<SkXfermode> mode(SkLerpXfermode::Create(0.5f)); show_circlelayers(canvas, mode.get()); diff --git a/gm/lighting.cpp b/gm/lighting.cpp index a464a07480..d68e67db16 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -93,12 +93,12 @@ protected: SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100)); - SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0, NULL, &cropRect)); + SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0, nullptr, &cropRect)); int y = 0; for (int i = 0; i < 3; i++) { - const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : NULL; - SkImageFilter* input = (i == 2) ? noopCropped.get() : NULL; + const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : nullptr; + SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr; paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, diff --git a/gm/lumafilter.cpp b/gm/lumafilter.cpp index 46a22f84c4..3244b2b055 100644 --- a/gm/lumafilter.cpp +++ b/gm/lumafilter.cpp @@ -38,7 +38,7 @@ static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, paint.setARGB(0x20, 0, 0, 0xff); canvas->drawRect(bounds, paint); - canvas->saveLayer(&bounds, NULL); + canvas->saveLayer(&bounds, nullptr); r = bounds; r.inset(kInset, 0); @@ -119,9 +119,9 @@ protected: SkShader* fShader1; SkShader* fShader2; } shaders[] = { - { NULL, NULL }, - { NULL, fGr2 }, - { fGr1, NULL }, + { nullptr, nullptr }, + { nullptr, fGr2 }, + { fGr1, nullptr }, { fGr1, fGr2 }, }; diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp index b912f90cfe..1e6a49d4b6 100644 --- a/gm/matrixconvolution.cpp +++ b/gm/matrixconvolution.cpp @@ -49,7 +49,7 @@ protected: void draw(SkCanvas* canvas, int x, int y, const SkIPoint& kernelOffset, SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha, - const SkImageFilter::CropRect* cropRect = NULL) { + const SkImageFilter::CropRect* cropRect = nullptr) { SkScalar kernel[9] = { SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), @@ -66,7 +66,7 @@ protected: kernelOffset, tileMode, convolveAlpha, - NULL, + nullptr, cropRect)); paint.setImageFilter(filter); canvas->save(); diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp index 596cc19d6e..4eb5c2aa3c 100644 --- a/gm/mipmap.cpp +++ b/gm/mipmap.cpp @@ -45,7 +45,7 @@ static void test_mip(SkCanvas* canvas) { canvas->drawImageRect(img, dst, &paint); canvas->translate(0, 20); } - canvas->drawImage(img, 20, 20, NULL); + canvas->drawImage(img, 20, 20, nullptr); } class MipMapGM : public skiagm::GM { diff --git a/gm/modecolorfilters.cpp b/gm/modecolorfilters.cpp index 9f70bf8674..b5ede710f1 100644 --- a/gm/modecolorfilters.cpp +++ b/gm/modecolorfilters.cpp @@ -20,7 +20,7 @@ static SkShader* make_color_shader(SkColor color) { static const SkPoint kPts[] = {{0, 0}, {1, 1}}; SkColor colors[] = {color, color}; - return SkGradientShader::CreateLinear(kPts, colors, NULL, 2, SkShader::kClamp_TileMode); + return SkGradientShader::CreateLinear(kPts, colors, nullptr, 2, SkShader::kClamp_TileMode); } static SkShader* make_solid_shader() { @@ -82,7 +82,7 @@ protected: bgPaint.setXfermodeMode(SkXfermode::kSrc_Mode); SkShader* shaders[] = { - NULL, // use a paint color instead of a shader + nullptr, // use a paint color instead of a shader make_solid_shader(), make_transparent_shader(), make_trans_black_shader(), @@ -127,7 +127,7 @@ protected: paint.setColorFilter(cf); for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); ++s) { paint.setShader(shaders[s]); - bool hasShader = NULL == paint.getShader(); + bool hasShader = nullptr == paint.getShader(); int paintColorCnt = hasShader ? SK_ARRAY_COUNT(alphas) : SK_ARRAY_COUNT(colors); SkColor* paintColors = hasShader ? alphas : colors; for (int pc = 0; pc < paintColorCnt; ++pc) { @@ -137,7 +137,7 @@ protected: SkRect rect = SkRect::MakeXYWH(x * kRectWidth, y * kRectHeight, SkIntToScalar(kRectWidth), SkIntToScalar(kRectHeight)); - canvas->saveLayer(&rect, NULL); + canvas->saveLayer(&rect, nullptr); canvas->drawRect(rect, bgPaint); canvas->drawRect(rect, paint); canvas->restore(); diff --git a/gm/morphology.cpp b/gm/morphology.cpp index cb321c6efd..3fb11d82d1 100644 --- a/gm/morphology.cpp +++ b/gm/morphology.cpp @@ -73,18 +73,18 @@ protected: for (unsigned j = 0; j < 4; ++j) { for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { - const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; + const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : nullptr; if (j & 0x01) { paint.setImageFilter(SkErodeImageFilter::Create( samples[i].fRadiusX, samples[i].fRadiusY, - NULL, + nullptr, cr))->unref(); } else { paint.setImageFilter(SkDilateImageFilter::Create( samples[i].fRadiusX, samples[i].fRadiusY, - NULL, + nullptr, cr))->unref(); } drawClippedBitmap(canvas, paint, i * 140, j * 140); diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp index 3a0b0fa7d9..88d6cd798f 100644 --- a/gm/multipicturedraw.cpp +++ b/gm/multipicturedraw.cpp @@ -68,7 +68,7 @@ static const SkPicture* make_hex_plane_picture(SkColor fillColor) { xPos = 0; for (int x = 0; x < kNumHexX; ++x) { - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); canvas->translate(xPos, yPos + ((x % 2) ? kRoot3Over2 * kHexSide : 0)); canvas->drawPath(hex, fill); canvas->drawPath(hex, stroke); @@ -111,7 +111,7 @@ static const SkPicture* make_single_layer_hex_plane_picture() { SkCanvas* canvas = recorder.beginRecording(kBig, kBig, &bbhFactory, SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag); - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); SkScalar xPos = 0.0f, yPos = 0.0f; @@ -171,7 +171,7 @@ static const SkPicture* make_tri_picture() { r.outset(2.0f, 2.0f); // outset for stroke canvas->clipRect(r); // The saveLayer/restore block is to exercise layer hoisting - canvas->saveLayer(NULL, NULL); + canvas->saveLayer(nullptr, nullptr); canvas->drawPath(tri, fill); canvas->drawPath(tri, stroke); canvas->restore(); @@ -245,8 +245,8 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height) SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); SkSurface* surface = canvas->newSurface(info); - if (NULL == surface) { - // picture canvas returns NULL so fall back to raster + if (nullptr == surface) { + // picture canvas returns nullptr so fall back to raster surface = SkSurface::NewRaster(info); } @@ -257,7 +257,7 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height) // fragments potentially generated by the MultiPictureDraw object class ComposeStep { public: - ComposeStep() : fSurf(NULL), fX(0.0f), fY(0.0f), fPaint(NULL) { } + ComposeStep() : fSurf(nullptr), fX(0.0f), fY(0.0f), fPaint(nullptr) { } ~ComposeStep() { SkSafeUnref(fSurf); delete fPaint; @@ -474,7 +474,7 @@ namespace skiagm { SkASSERT(SK_ARRAY_COUNT(gContentMthds) == kContentCnt); for (int i = 0; i < kNumPictures; ++i) { - fPictures[i] = NULL; + fPictures[i] = nullptr; } } diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp index 267c41587b..4074add1bb 100644 --- a/gm/ninepatchstretch.cpp +++ b/gm/ninepatchstretch.cpp @@ -70,7 +70,7 @@ protected: } void onDraw(SkCanvas* canvas) override { - if (NULL == fBitmap.pixelRef()) { + if (nullptr == fBitmap.pixelRef()) { fImage.reset(make_image(canvas, &fCenter)); image_to_bitmap(fImage, &fBitmap); } @@ -85,7 +85,7 @@ protected: { fixed * 4, fixed * 4 } }; - canvas->drawBitmap(fBitmap, 10, 10, NULL); + canvas->drawBitmap(fBitmap, 10, 10, nullptr); SkScalar x = SkIntToScalar(100); SkScalar y = SkIntToScalar(100); diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp index 35ccc053c4..fdf2aa85fa 100644 --- a/gm/offsetimagefilter.cpp +++ b/gm/offsetimagefilter.cpp @@ -96,7 +96,7 @@ protected: SkIRect cropRect = SkIRect::MakeXYWH(0, 0, 100, 100); SkImageFilter::CropRect rect(SkRect::Make(cropRect)); - SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, NULL, &rect)); + SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, nullptr, &rect)); paint.setImageFilter(filter); drawClippedBitmap(canvas, fBitmap, paint, 2, cropRect); } @@ -120,7 +120,7 @@ protected: SkISize onISize() override { return SkISize::Make(640, 200); } void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf, - const SkRect* clipR = NULL) { + const SkRect* clipR = nullptr) { SkPaint p; if (clipR) { @@ -167,23 +167,23 @@ protected: canvas->translate(40, 40); canvas->save(); - this->doDraw(canvas, r, NULL); + this->doDraw(canvas, r, nullptr); canvas->translate(100, 0); this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20)); canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr0)); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr0)); canvas->translate(100, 0); this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r); canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr1)); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr1)); SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40); canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, NULL), &clipR); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, nullptr), &clipR); canvas->restore(); // 2nd row @@ -194,19 +194,19 @@ protected: */ // crop==clip==src - this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0), &r); // crop==src, clip==dst canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r2); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0), &r2); // crop==dst, clip==src canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2), &r); // crop==clip==dst canvas->translate(100, 0); - this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r2); + this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2), &r2); } private: diff --git a/gm/ovals.cpp b/gm/ovals.cpp index 32c9e71640..e4cc46eb21 100755 --- a/gm/ovals.cpp +++ b/gm/ovals.cpp @@ -267,7 +267,7 @@ protected: canvas->drawRect(oval, rectPaint); canvas->drawOval(oval, fPaints[i]); - fPaints[i].setShader(NULL); + fPaints[i].setShader(nullptr); canvas->restore(); } diff --git a/gm/patch.cpp b/gm/patch.cpp index df3a84e534..c3e43004a6 100644 --- a/gm/patch.cpp +++ b/gm/patch.cpp @@ -17,7 +17,7 @@ static SkShader* make_shader() { }; const SkPoint pts[] = { { 100.f / 4.f, 0.f }, { 3.f * 100.f / 4.f, 100.f } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); } @@ -124,20 +124,20 @@ protected: canvas->translate(x * 350.0f, y * 350.0f); switch (x) { case 0: - canvas->drawPatch(cubics, NULL, NULL, xfer, paint); + canvas->drawPatch(cubics, nullptr, nullptr, xfer, paint); break; case 1: - canvas->drawPatch(cubics, colors, NULL, xfer, paint); + canvas->drawPatch(cubics, colors, nullptr, xfer, paint); break; case 2: paint.setShader(shader); - canvas->drawPatch(cubics, NULL, texCoords, xfer, paint); - paint.setShader(NULL); + canvas->drawPatch(cubics, nullptr, texCoords, xfer, paint); + paint.setShader(nullptr); break; case 3: paint.setShader(shader); canvas->drawPatch(cubics, colors, texCoords, xfer, paint); - paint.setShader(NULL); + paint.setShader(nullptr); break; default: break; diff --git a/gm/patchgrid.cpp b/gm/patchgrid.cpp index 89a9847271..6f77d48a88 100644 --- a/gm/patchgrid.cpp +++ b/gm/patchgrid.cpp @@ -110,7 +110,7 @@ protected: static const int kCols = 4; canvas->scale(3, 3); - SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, NULL); + SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr); for (int i = 0; i < kRows; i++) { for (int j = 0; j < kCols; j++) { SkPoint points[12]; @@ -137,7 +137,7 @@ protected: colors[3] = cornerColors[i + 1][j]; colors[2] = cornerColors[i + 1][j + 1]; - grid.setPatch(j, i, points, colors, NULL); + grid.setPatch(j, i, points, colors, nullptr); } } @@ -146,7 +146,7 @@ protected: for (int y = 0; y < dims.height(); y++) { for (int x = 0; x < dims.width(); x++) { SkPoint cubics[12]; - grid.getPatch(x, y, cubics, NULL, NULL); + grid.getPatch(x, y, cubics, nullptr, nullptr); draw_control_points(canvas, cubics); } } diff --git a/gm/patheffects.cpp b/gm/patheffects.cpp index c71d32bb75..517d02e547 100644 --- a/gm/patheffects.cpp +++ b/gm/patheffects.cpp @@ -79,7 +79,7 @@ static const PE_Proc gPE[] = { hair_pe, hair2_pe, stroke_pe, dash_pe, one_d_pe } static void fill_pe(SkPaint* paint) { paint->setStyle(SkPaint::kFill_Style); - paint->setPathEffect(NULL); + paint->setPathEffect(nullptr); } static void discrete_pe(SkPaint* paint) { diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp index a2b1ee0142..f4e42e8165 100644 --- a/gm/pathfill.cpp +++ b/gm/pathfill.cpp @@ -198,7 +198,7 @@ protected: canvas->save(); canvas->clipRect(clipR); - const SkRect* clipPtr = doclip ? &clipR : NULL; + const SkRect* clipPtr = doclip ? &clipR : nullptr; show(canvas, path, paint, clipPtr, clipR.fTop, clipR.centerY()); show(canvas, path, paint, clipPtr, clipR.centerY(), clipR.fBottom); diff --git a/gm/pathopsskpclip.cpp b/gm/pathopsskpclip.cpp index c9092f4ad2..1c8cf99cb8 100644 --- a/gm/pathopsskpclip.cpp +++ b/gm/pathopsskpclip.cpp @@ -34,7 +34,7 @@ protected: void onDraw(SkCanvas* canvas) override { SkPictureRecorder recorder; - SkCanvas* rec = recorder.beginRecording(1200, 900, NULL, 0); + SkCanvas* rec = recorder.beginRecording(1200, 900, nullptr, 0); SkPath p; SkRect r = { SkIntToScalar(100), diff --git a/gm/peekpixels.cpp b/gm/peekpixels.cpp index b8c1678c03..a443c41b89 100644 --- a/gm/peekpixels.cpp +++ b/gm/peekpixels.cpp @@ -47,7 +47,7 @@ protected: size_t rowBytes; const void* addr = surfCanvas->peekPixels(&info, &rowBytes); if (addr && bitmap.installPixels(info, const_cast<void*>(addr), rowBytes)) { - canvas->drawBitmap(bitmap, 0, 0, NULL); + canvas->drawBitmap(bitmap, 0, 0, nullptr); } } @@ -55,12 +55,12 @@ protected: canvas->translate(120, 0); SkAutoROCanvasPixels ropixels(surfCanvas); if (ropixels.asROBitmap(&bitmap)) { - canvas->drawBitmap(bitmap, 0, 0, NULL); + canvas->drawBitmap(bitmap, 0, 0, nullptr); } // test Surface canvas->translate(120, 0); - surface->draw(canvas, 0, 0, NULL); + surface->draw(canvas, 0, 0, nullptr); } } diff --git a/gm/perlinnoise.cpp b/gm/perlinnoise.cpp index 702e545c60..e4c559801b 100644 --- a/gm/perlinnoise.cpp +++ b/gm/perlinnoise.cpp @@ -39,9 +39,9 @@ protected: SkISize tileSize = SkISize::Make(fSize.width() / 2, fSize.height() / 2); SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, - seed, stitchTiles ? &tileSize : NULL) : + seed, stitchTiles ? &tileSize : nullptr) : SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, - seed, stitchTiles ? &tileSize : NULL); + seed, stitchTiles ? &tileSize : nullptr); SkPaint paint; paint.setShader(shader)->unref(); if (stitchTiles) { @@ -112,9 +112,9 @@ protected: bool stitchTiles) { SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, - seed, stitchTiles ? &fSize : NULL) : + seed, stitchTiles ? &fSize : nullptr) : SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, - seed, stitchTiles ? &fSize : NULL); + seed, stitchTiles ? &fSize : nullptr); paint->setShader(shader)->unref(); } diff --git a/gm/picture.cpp b/gm/picture.cpp index 175e0a76f2..1f8ded0bac 100644 --- a/gm/picture.cpp +++ b/gm/picture.cpp @@ -40,7 +40,7 @@ static SkPicture* make_picture() { class PictureGM : public skiagm::GM { public: PictureGM() - : fPicture(NULL) + : fPicture(nullptr) {} protected: @@ -65,7 +65,7 @@ protected: canvas->drawPicture(fPicture); matrix.setTranslate(110, 0); - canvas->drawPicture(fPicture, &matrix, NULL); + canvas->drawPicture(fPicture, &matrix, nullptr); matrix.postTranslate(110, 0); canvas->drawPicture(fPicture, &matrix, &paint); diff --git a/gm/pictureimagefilter.cpp b/gm/pictureimagefilter.cpp index fd8ae62fa2..7f6cfbdd9a 100644 --- a/gm/pictureimagefilter.cpp +++ b/gm/pictureimagefilter.cpp @@ -24,7 +24,7 @@ protected: void makePicture() { SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); + SkCanvas* canvas = recorder.beginRecording(100, 100, nullptr, 0); canvas->clear(SK_ColorBLACK); SkPaint paint; paint.setAntiAlias(true); diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp index d28749a644..c35c5c964e 100644 --- a/gm/pictureshader.cpp +++ b/gm/pictureshader.cpp @@ -33,7 +33,7 @@ public: void onOnceBeforeDraw() override { // Build the picture. SkPictureRecorder recorder; - SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, NULL, 0); + SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, nullptr, 0); this->drawTile(pictureCanvas); fPicture.reset(recorder.endRecording()); @@ -150,12 +150,9 @@ private: canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSceneSize), paint); - SkAutoTUnref<SkShader> pictureShader(SkShader::CreatePictureShader( - fPicture, - kTileConfigs[tileMode].tmx, - kTileConfigs[tileMode].tmy, - &localMatrix, - NULL)); + SkAutoTUnref<SkShader> pictureShader( + SkShader::CreatePictureShader(fPicture, kTileConfigs[tileMode].tmx, + kTileConfigs[tileMode].tmy, &localMatrix, nullptr)); paint.setShader(pictureShader.get()); canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); @@ -200,12 +197,9 @@ DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400) { c->drawLine(20, 20, 80, 80, p); SkAutoTUnref<SkPicture> picture(recorder.endRecording()); - SkAutoTUnref<SkShader> shader(SkShader::CreatePictureShader( - picture.get(), - SkShader::kRepeat_TileMode, - SkShader::kRepeat_TileMode, - NULL, - NULL)); + SkAutoTUnref<SkShader> shader( + SkShader::CreatePictureShader(picture.get(), SkShader::kRepeat_TileMode, + SkShader::kRepeat_TileMode, nullptr, nullptr)); p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green canvas->drawPaint(p); diff --git a/gm/pictureshadertile.cpp b/gm/pictureshadertile.cpp index a84e23343d..30776c338b 100644 --- a/gm/pictureshadertile.cpp +++ b/gm/pictureshadertile.cpp @@ -121,7 +121,7 @@ protected: if (tile == SkRect::MakeWH(kPictureSize, kPictureSize)) { // When the tile == picture bounds, exercise the picture + offset path. picturePtr = offsetPicture.get(); - tilePtr = NULL; + tilePtr = nullptr; } fShaders[i].reset(SkShader::CreatePictureShader(picturePtr, diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp index 4a6da53c97..ca7f554fdb 100644 --- a/gm/resizeimagefilter.cpp +++ b/gm/resizeimagefilter.cpp @@ -27,7 +27,7 @@ protected: const SkRect& rect, const SkSize& deviceSize, SkFilterQuality filterQuality, - SkImageFilter* input = NULL) { + SkImageFilter* input = nullptr) { SkRect dstRect; canvas->getTotalMatrix().mapRect(&dstRect, rect); canvas->save(); diff --git a/gm/roundrects.cpp b/gm/roundrects.cpp index b27d0f4309..ab7ee696c2 100644 --- a/gm/roundrects.cpp +++ b/gm/roundrects.cpp @@ -282,7 +282,7 @@ protected: canvas->drawRect(rect, rectPaint); canvas->drawRRect(circleRect, fPaints[i]); - fPaints[i].setShader(NULL); + fPaints[i].setShader(nullptr); canvas->restore(); } diff --git a/gm/rrects.cpp b/gm/rrects.cpp index f9a21db0f2..c4736c7222 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -57,12 +57,12 @@ protected: SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight); } void onDraw(SkCanvas* canvas) override { - GrContext* context = NULL; + GrContext* context = nullptr; #if SK_SUPPORT_GPU GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - context = rt ? rt->getContext() : NULL; + context = rt ? rt->getContext() : nullptr; #endif - if (kEffect_Type == fType && NULL == context) { + if (kEffect_Type == fType && nullptr == context) { this->drawGpuOnlyMessage(canvas); return; } @@ -102,7 +102,7 @@ protected: #if SK_SUPPORT_GPU GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } diff --git a/gm/samplerstress.cpp b/gm/samplerstress.cpp index eff6281cdd..4bec6784a8 100644 --- a/gm/samplerstress.cpp +++ b/gm/samplerstress.cpp @@ -21,8 +21,8 @@ class SamplerStressGM : public GM { public: SamplerStressGM() : fTextureCreated(false) - , fShader(NULL) - , fMaskFilter(NULL) { + , fShader(nullptr) + , fMaskFilter(nullptr) { } virtual ~SamplerStressGM() { diff --git a/gm/shaderbounds.cpp b/gm/shaderbounds.cpp index 4363d4eee3..fd42973dba 100644 --- a/gm/shaderbounds.cpp +++ b/gm/shaderbounds.cpp @@ -18,7 +18,7 @@ static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate, colors[0] = SK_ColorBLUE; colors[1] = SK_ColorYELLOW; } - return SkGradientShader::CreateLinear(pts, colors, NULL, 2, + return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode, 0, &localMatrix); } diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp index fd74e7c6ce..e68ee98df0 100644 --- a/gm/shadertext.cpp +++ b/gm/shadertext.cpp @@ -42,8 +42,8 @@ static const SkColor gColors[] = { }; static const GradData gGradData[] = { - { 2, gColors, NULL }, - { 5, gColors, NULL }, + { 2, gColors, nullptr }, + { 5, gColors, nullptr }, }; static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { @@ -174,7 +174,7 @@ protected: ++i; canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth), SkIntToScalar((i % testsPerCol) * rowHeight)); - canvas->drawTextOnPath(text, textLen, path, NULL, paint); + canvas->drawTextOnPath(text, textLen, path, nullptr, paint); canvas->restore(); } canvas->restore(); diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp index f4af684ae9..8ceb5e494b 100644 --- a/gm/shadertext2.cpp +++ b/gm/shadertext2.cpp @@ -175,8 +175,8 @@ protected: canvas->save(); canvas->concat(matrices[m].fMatrix); - canvas->drawTextOnPath(kText, kTextLen, path, NULL, paint); - canvas->drawTextOnPath(kText, kTextLen, path, NULL, outlinePaint); + canvas->drawTextOnPath(kText, kTextLen, path, nullptr, paint); + canvas->drawTextOnPath(kText, kTextLen, path, nullptr, outlinePaint); canvas->restore(); SkPaint stroke; stroke.setStyle(SkPaint::kStroke_Style); diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp index 276ec14f49..b2a34f3b4c 100644 --- a/gm/shallowgradient.cpp +++ b/gm/shallowgradient.cpp @@ -12,13 +12,13 @@ typedef SkShader* (*MakeShaderProc)(const SkColor[], int count, const SkSize&); static SkShader* shader_linear(const SkColor colors[], int count, const SkSize& size) { SkPoint pts[] = { { 0, 0 }, { size.width(), size.height() } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, count, + return SkGradientShader::CreateLinear(pts, colors, nullptr, count, SkShader::kClamp_TileMode); } static SkShader* shader_radial(const SkColor colors[], int count, const SkSize& size) { SkPoint center = { size.width()/2, size.height()/2 }; - return SkGradientShader::CreateRadial(center, size.width()/2, colors, NULL, count, + return SkGradientShader::CreateRadial(center, size.width()/2, colors, nullptr, count, SkShader::kClamp_TileMode); } @@ -26,13 +26,13 @@ static SkShader* shader_conical(const SkColor colors[], int count, const SkSize& SkPoint center = { size.width()/2, size.height()/2 }; return SkGradientShader::CreateTwoPointConical(center, size.width()/64, center, size.width()/2, - colors, NULL, count, + colors, nullptr, count, SkShader::kClamp_TileMode); } static SkShader* shader_sweep(const SkColor colors[], int count, const SkSize& size) { return SkGradientShader::CreateSweep(size.width()/2, size.height()/2, - colors, NULL, count); + colors, nullptr, count); } class ShallowGradientGM : public skiagm::GM { diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp index 372cb1bafb..3b10c47ea0 100644 --- a/gm/simpleaaclip.cpp +++ b/gm/simpleaaclip.cpp @@ -68,10 +68,10 @@ protected: } void buildRgn(SkAAClip* clip, SkRegion::Op op) { - clip->setPath(fBasePath, NULL, true); + clip->setPath(fBasePath, nullptr, true); SkAAClip clip2; - clip2.setPath(fRectPath, NULL, true); + clip2.setPath(fRectPath, nullptr, true); clip->op(clip2, op); } diff --git a/gm/spritebitmap.cpp b/gm/spritebitmap.cpp index 9e1bb87810..ceed50acaa 100644 --- a/gm/spritebitmap.cpp +++ b/gm/spritebitmap.cpp @@ -23,7 +23,7 @@ static void make_bm(SkBitmap* bm) { } static void draw_2_bitmaps(SkCanvas* canvas, const SkBitmap& bm, bool doClip, - int dx, int dy, SkImageFilter* filter = NULL) { + int dx, int dy, SkImageFilter* filter = nullptr) { SkAutoCanvasRestore acr(canvas, true); SkPaint paint; diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp index 7a7e89e052..86fe89bd1a 100644 --- a/gm/srcmode.cpp +++ b/gm/srcmode.cpp @@ -21,13 +21,13 @@ typedef void (*PaintProc)(SkPaint*); static void identity_paintproc(SkPaint* paint) { - paint->setShader(NULL); + paint->setShader(nullptr); } static void gradient_paintproc(SkPaint* paint) { const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE }; const SkPoint pts[] = { { 0, 0 }, { W, H } }; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); paint->setShader(s)->unref(); @@ -126,8 +126,8 @@ protected: callNewSurface = false; } #endif - SkSurface* surface = callNewSurface ? canvas->newSurface(info) : NULL; - if (NULL == surface) { + SkSurface* surface = callNewSurface ? canvas->newSurface(info) : nullptr; + if (nullptr == surface) { // picture canvas will return null, so fall-back to raster surface = SkSurface::NewRaster(info); } @@ -139,7 +139,7 @@ protected: this->isCanvasDeferred())); surf->getCanvas()->drawColor(SK_ColorWHITE); this->drawContent(surf->getCanvas()); - surf->draw(canvas, 0, 0, NULL); + surf->draw(canvas, 0, 0, nullptr); } private: diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp index 4e8eaffcca..e8878b5e3b 100644 --- a/gm/strokefill.cpp +++ b/gm/strokefill.cpp @@ -307,7 +307,7 @@ protected: SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_FirstDirection)); path2.reset(); - SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, NULL)); + SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, nullptr)); path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction); SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstDirection)); canvas->drawPath(path2, paint); @@ -333,7 +333,7 @@ protected: r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), SkIntToScalar(100), SkIntToScalar(100)); path4.reset(); - SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); + SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); path4.addRect(r, SkPath::kCCW_Direction); SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_FirstDirection)); path4.moveTo(0, 0); // test for crbug.com/247770 @@ -342,7 +342,7 @@ protected: r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), SkIntToScalar(100), SkIntToScalar(100)); path4.reset(); - SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); + SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); path4.addRect(r, SkPath::kCW_Direction); SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstDirection)); path4.moveTo(0, 0); // test for crbug.com/247770 diff --git a/gm/surface.cpp b/gm/surface.cpp index 694a0d09ab..bf7f931f46 100644 --- a/gm/surface.cpp +++ b/gm/surface.cpp @@ -18,7 +18,7 @@ static SkShader* make_shader() { int b = 0xBB; SkPoint pts[] = { { 0, 0 }, { W, H } }; SkColor colors[] = { SkColorSetRGB(a, a, a), SkColorSetRGB(b, b, b) }; - return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode); + return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode); } static SkSurface* make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo, @@ -48,7 +48,7 @@ static void test_draw(SkCanvas* canvas, const char label[]) { paint.setShader(make_shader())->unref(); canvas->drawRect(SkRect::MakeWH(W, H), paint); - paint.setShader(NULL); + paint.setShader(nullptr); paint.setColor(SK_ColorWHITE); paint.setTextSize(32); @@ -95,7 +95,7 @@ protected: SkAutoTUnref<SkSurface> surface(make_surface(ctx, info, rec[i].fGeo, disallowAA, disallowDither)); test_draw(surface->getCanvas(), rec[i].fLabel); - surface->draw(canvas, x, y, NULL); + surface->draw(canvas, x, y, nullptr); y += H; } x += W; @@ -134,23 +134,23 @@ protected: void onDraw(SkCanvas* canvas) override { SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); - SkAutoTUnref<SkSurface> surf(canvas->newSurface(info, NULL)); + SkAutoTUnref<SkSurface> surf(canvas->newSurface(info, nullptr)); if (!surf.get()) { surf.reset(SkSurface::NewRaster(info)); } drawInto(surf->getCanvas()); SkAutoTUnref<SkImage> image(surf->newImageSnapshot()); - canvas->drawImage(image, 10, 10, NULL); + canvas->drawImage(image, 10, 10, nullptr); - SkAutoTUnref<SkSurface> surf2(image->newSurface(info, NULL)); + SkAutoTUnref<SkSurface> surf2(image->newSurface(info, nullptr)); drawInto(surf2->getCanvas()); // Assert that the props were communicated transitively through the first image SkASSERT(equal(surf->props(), surf2->props())); SkAutoTUnref<SkImage> image2(surf2->newImageSnapshot()); - canvas->drawImage(image2, 10 + SkIntToScalar(image->width()) + 10, 10, NULL); + canvas->drawImage(image2, 10 + SkIntToScalar(image->width()) + 10, 10, nullptr); } private: diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp index 0855ac0ea3..1053bb2518 100644 --- a/gm/tablecolorfilter.cpp +++ b/gm/tablecolorfilter.cpp @@ -17,7 +17,7 @@ static SkShader* make_shader0(int w, int h) { SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN, SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE }; - return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); } static void make_bm0(SkBitmap* bm) { @@ -37,7 +37,7 @@ static SkShader* make_shader1(int w, int h) { SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, }; - return SkGradientShader::CreateRadial(SkPoint::Make(cx, cy), cx, colors, NULL, + return SkGradientShader::CreateRadial(SkPoint::Make(cx, cy), cx, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); } static void make_bm1(SkBitmap* bm) { @@ -74,7 +74,7 @@ static void make_table2(uint8_t table[]) { } static SkColorFilter* make_null_cf() { - return NULL; + return nullptr; } static SkColorFilter* make_cf0() { @@ -93,7 +93,7 @@ static SkColorFilter* make_cf3() { uint8_t table0[256]; make_table0(table0); uint8_t table1[256]; make_table1(table1); uint8_t table2[256]; make_table2(table2); - return SkTableColorFilter::CreateARGB(NULL, table0, table1, table2); + return SkTableColorFilter::CreateARGB(nullptr, table0, table1, table2); } class TableColorFilterGM : public skiagm::GM { @@ -159,12 +159,12 @@ protected: canvas->drawBitmap(bm, x, y, &paint); } - paint.setColorFilter(NULL); + paint.setColorFilter(nullptr); for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]()); SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Create( - colorFilter1, NULL, NULL)); + colorFilter1, nullptr, nullptr)); // Move down to the next line and draw it // each draw being at xOffset of the previous one @@ -173,7 +173,7 @@ protected: for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j) { SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[j]()); SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageFilter::Create( - colorFilter2, imageFilter1, NULL)); + colorFilter2, imageFilter1, nullptr)); paint.setImageFilter(imageFilter2); canvas->drawBitmap(bm, x, y, &paint); x += xOffset; diff --git a/gm/texdata.cpp b/gm/texdata.cpp index e7c15b2498..13a1c2a6c2 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -39,7 +39,7 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTarget(); GrContext* ctx = canvas->getGrContext(); - GrDrawContext* drawContext = ctx ? ctx->drawContext() : NULL; + GrDrawContext* drawContext = ctx ? ctx->drawContext() : nullptr; if (drawContext && target) { SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); static const int stride = 2 * S; diff --git a/gm/textblob.cpp b/gm/textblob.cpp index 5020e7c5ef..a38215653d 100644 --- a/gm/textblob.cpp +++ b/gm/textblob.cpp @@ -76,7 +76,7 @@ protected: SkPaint p; p.setTypeface(fTypeface); size_t txtLen = strlen(fText); - int glyphCount = p.textToGlyphs(fText, txtLen, NULL); + int glyphCount = p.textToGlyphs(fText, txtLen, nullptr); fGlyphs.append(glyphCount); p.textToGlyphs(fText, txtLen, fGlyphs.begin()); diff --git a/gm/textbloblooper.cpp b/gm/textbloblooper.cpp index dc4be0b129..c40a4eb2c6 100644 --- a/gm/textbloblooper.cpp +++ b/gm/textbloblooper.cpp @@ -30,7 +30,7 @@ static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkTDArray<uint16_t> glyphs; size_t len = strlen(text); - glyphs.append(paint.textToGlyphs(text, len, NULL)); + glyphs.append(paint.textToGlyphs(text, len, nullptr)); paint.textToGlyphs(text, len, glyphs.begin()); const SkScalar advanceX = paint.getTextSize() * 0.85f; @@ -90,7 +90,7 @@ static SkShader* make_shader(const SkRect& bounds) { SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, }; return SkGradientShader::CreateLinear(pts, - colors, NULL, SK_ARRAY_COUNT(colors), + colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode); } @@ -202,7 +202,7 @@ protected: SkLayerDrawLooper::kColorFilter_Bit | SkLayerDrawLooper::kXfermode_Bit, &color_filter, xfermode, SK_ARRAY_COUNT(xfermode))); - fLoopers.push_back().reset(setupLooper(0, NULL, skew, SK_ARRAY_COUNT(skew))); + fLoopers.push_back().reset(setupLooper(0, nullptr, skew, SK_ARRAY_COUNT(skew))); fLoopers.push_back().reset(setupLooper(SkLayerDrawLooper::kMaskFilter_Bit | SkLayerDrawLooper::kShader_Bit | SkLayerDrawLooper::kColorFilter_Bit | diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp index a76c6f575b..9f745d6106 100644 --- a/gm/textblobmixedsizes.cpp +++ b/gm/textblobmixedsizes.cpp @@ -165,7 +165,7 @@ protected: // since we prepended this matrix already, we blit using identity inputCanvas->resetMatrix(); SkImage* image = surface->newImageSnapshot(); - inputCanvas->drawImage(image, 0, 0, NULL); + inputCanvas->drawImage(image, 0, 0, nullptr); image->unref(); } #endif diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp index ada46cadfc..862d83b707 100644 --- a/gm/textblobrandomfont.cpp +++ b/gm/textblobrandomfont.cpp @@ -41,7 +41,7 @@ protected: // Setup our random scaler context SkAutoTUnref<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif", SkTypeface::kBold)); - if (NULL == orig) { + if (nullptr == orig) { orig.reset(SkTypeface::RefDefault()); } SkAutoTUnref<SkTypeface> random(new SkRandomTypeface(orig, paint, false)); @@ -93,7 +93,7 @@ protected: void onDraw(SkCanvas* canvas) override { // This GM exists to test a specific feature of the GPU backend. - if (NULL == canvas->getGrContext()) { + if (nullptr == canvas->getGrContext()) { this->drawGpuOnlyMessage(canvas); return; } diff --git a/gm/textblobshader.cpp b/gm/textblobshader.cpp index 5c9372d93c..30674e1d68 100644 --- a/gm/textblobshader.cpp +++ b/gm/textblobshader.cpp @@ -22,7 +22,7 @@ public: SkPaint p; sk_tool_utils::set_portable_typeface(&p); size_t txtLen = strlen(txt); - fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL)); + fGlyphs.append(p.textToGlyphs(txt, txtLen, nullptr)); p.textToGlyphs(txt, txtLen, fGlyphs.begin()); } @@ -40,16 +40,16 @@ protected: int glyphCount = fGlyphs.count(); const SkTextBlobBuilder::RunBuffer* run; - run = &builder.allocRun(p, glyphCount, 10, 10, NULL); + run = &builder.allocRun(p, glyphCount, 10, 10, nullptr); memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); - run = &builder.allocRunPosH(p, glyphCount, 80, NULL); + run = &builder.allocRunPosH(p, glyphCount, 80, nullptr); memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); for (int i = 0; i < glyphCount; ++i) { run->pos[i] = p.getTextSize() * i * .75f; } - run = &builder.allocRunPos(p, glyphCount, NULL); + run = &builder.allocRunPos(p, glyphCount, nullptr); memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); for (int i = 0; i < glyphCount; ++i) { run->pos[i * 2] = p.getTextSize() * i * .75f; diff --git a/gm/textblobuseaftergpufree.cpp b/gm/textblobuseaftergpufree.cpp index 363cd2fed9..91681b82ac 100644 --- a/gm/textblobuseaftergpufree.cpp +++ b/gm/textblobuseaftergpufree.cpp @@ -31,7 +31,7 @@ protected: void onDraw(SkCanvas* canvas) override { // This GM exists to test a specific feature of the GPU backend. - if (NULL == canvas->getGrContext()) { + if (nullptr == canvas->getGrContext()) { this->drawGpuOnlyMessage(canvas); return; } diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp index 03dbd68cc1..902bed3ea8 100644 --- a/gm/texteffects.cpp +++ b/gm/texteffects.cpp @@ -17,7 +17,7 @@ static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref(); rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); - p.setMaskFilter(NULL); + p.setMaskFilter(nullptr); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1); rastBuilder->addLayer(p); @@ -68,7 +68,7 @@ static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { p.setXfermodeMode(SkXfermode::kClear_Mode); rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2); - p.setXfermode(NULL); + p.setXfermode(nullptr); rastBuilder->addLayer(p); } @@ -119,8 +119,8 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { p.setXfermodeMode(SkXfermode::kClear_Mode); rastBuilder->addLayer(p); - p.setPathEffect(NULL); - p.setXfermode(NULL); + p.setPathEffect(nullptr); + p.setXfermode(nullptr); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1); rastBuilder->addLayer(p); @@ -136,8 +136,8 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { p.setXfermodeMode(SkXfermode::kClear_Mode); rastBuilder->addLayer(p); - p.setPathEffect(NULL); - p.setXfermode(NULL); + p.setPathEffect(nullptr); + p.setXfermode(nullptr); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1); rastBuilder->addLayer(p); @@ -199,7 +199,7 @@ protected: for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) { apply_shader(&paint, i); - // paint.setMaskFilter(NULL); + // paint.setMaskFilter(nullptr); // paint.setColor(SK_ColorBLACK); canvas->drawText(str.c_str(), str.size(), x, y, paint); diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index eb0f2cc944..facfb7a792 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -49,19 +49,19 @@ protected: SkColor colors1[] = { SK_ColorCYAN, SK_ColorLTGRAY, SK_ColorGRAY }; paint.setShader(SkGradientShader::CreateSweep(65.f, 75.f, colors1, - NULL, SK_ARRAY_COUNT(colors1)))->unref(); + nullptr, SK_ARRAY_COUNT(colors1)))->unref(); canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, fBmp.width() + 10.f, fBmp.height() + 10.f), paint); SkColor colors2[] = { SK_ColorMAGENTA, SK_ColorLTGRAY, SK_ColorYELLOW }; - paint.setShader(SkGradientShader::CreateSweep(45.f, 55.f, colors2, NULL, + paint.setShader(SkGradientShader::CreateSweep(45.f, 55.f, colors2, nullptr, SK_ARRAY_COUNT(colors2)))->unref(); paint.setXfermodeMode(SkXfermode::kDarken_Mode); canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, fBmp.width() + 10.f, fBmp.height() + 10.f), paint); SkColor colors3[] = { SK_ColorBLUE, SK_ColorLTGRAY, SK_ColorGREEN }; - paint.setShader(SkGradientShader::CreateSweep(25.f, 35.f, colors3, NULL, + paint.setShader(SkGradientShader::CreateSweep(25.f, 35.f, colors3, nullptr, SK_ARRAY_COUNT(colors3)))->unref(); paint.setXfermodeMode(SkXfermode::kLighten_Mode); canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, @@ -70,23 +70,23 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { this->drawGpuOnlyMessage(canvas); return; } GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } - SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, NULL)); + SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, nullptr)); if (!texture) { return; } diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp index 1ec05113e1..e47e8fa659 100644 --- a/gm/tileimagefilter.cpp +++ b/gm/tileimagefilter.cpp @@ -98,7 +98,7 @@ protected: SkIntToScalar(fBitmap.height())); SkRect dstRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() * 2), SkIntToScalar(fBitmap.height() * 2)); - SkAutoTUnref<SkImageFilter> tile(SkTileImageFilter::Create(srcRect, dstRect, NULL)); + SkAutoTUnref<SkImageFilter> tile(SkTileImageFilter::Create(srcRect, dstRect, nullptr)); SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(matrix)); SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf, tile.get())); diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp index 4e4a2ff8ce..26b83486e8 100644 --- a/gm/tilemodes.cpp +++ b/gm/tilemodes.cpp @@ -171,14 +171,14 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { int index = (int)ty; switch (index % 3) { case 0: - return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), tx); + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx); case 1: - return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_ARRAY_COUNT(colors), tx); + return SkGradientShader::CreateRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx); case 2: - return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors)); + return SkGradientShader::CreateSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors)); } - return NULL; + return nullptr; } typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp index 87e3029a01..0d46fb66c5 100644 --- a/gm/tilemodes_scaled.cpp +++ b/gm/tilemodes_scaled.cpp @@ -175,14 +175,14 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { int index = (int)ty; switch (index % 3) { case 0: - return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), tx); + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx); case 1: - return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_ARRAY_COUNT(colors), tx); + return SkGradientShader::CreateRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx); case 2: - return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors)); + return SkGradientShader::CreateSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors)); } - return NULL; + return nullptr; } typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp index 9bfa2287ca..7942b4266a 100644 --- a/gm/tinybitmap.cpp +++ b/gm/tinybitmap.cpp @@ -20,7 +20,7 @@ static SkBitmap make_bitmap() { SkBitmap bm; bm.allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType), - NULL, ctable); + nullptr, ctable); ctable->unref(); bm.lockPixels(); diff --git a/gm/transparency.cpp b/gm/transparency.cpp index 62c277a691..73bd8b2023 100644 --- a/gm/transparency.cpp +++ b/gm/transparency.cpp @@ -32,7 +32,7 @@ static void make_transparency(SkCanvas* canvas, shaderColors[0] = SK_AlphaTRANSPARENT; shaderColors[1] = kColors[i]; SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear( - pts, shaderColors, NULL, 2, SkShader::kClamp_TileMode)); + pts, shaderColors, nullptr, 2, SkShader::kClamp_TileMode)); SkRect r = SkRect::MakeXYWH(0, i * kRowHeight, width, kRowHeight); SkPaint p; p.setShader(shader); @@ -70,6 +70,6 @@ DEF_SIMPLE_GM(transparency_check, canvas, 1792, 1080) { SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(256, 9)); make_transparency(surface->getCanvas(), 256.0f, 9.0f); canvas->scale(7.0f, 120.0f); - surface->draw(canvas, 0, 0, NULL); + surface->draw(canvas, 0, 0, nullptr); } } diff --git a/gm/typeface.cpp b/gm/typeface.cpp index b8f54abe37..d88efa51bf 100644 --- a/gm/typeface.cpp +++ b/gm/typeface.cpp @@ -135,7 +135,7 @@ protected: const size_t textLen = strlen(text); SkScalar x = SkIntToScalar(10); - SkScalar dy = paint.getFontMetrics(NULL); + SkScalar dy = paint.getFontMetrics(nullptr); SkScalar y = dy; if (fApplyKerning) { diff --git a/gm/vertices.cpp b/gm/vertices.cpp index 9533d81bb4..40dd9496ef 100644 --- a/gm/vertices.cpp +++ b/gm/vertices.cpp @@ -17,7 +17,7 @@ static SkShader* make_shader(SkScalar w, SkScalar h) { }; const SkPoint pts[] = { { w/4, 0 }, { 3*w/4, h } }; - return SkGradientShader::CreateLinear(pts, colors, NULL, + return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); } @@ -30,7 +30,7 @@ class VerticesGM : public skiagm::GM { unsigned fAlpha; public: - VerticesGM(unsigned alpha) : fShader(NULL), fAlpha(alpha) { + VerticesGM(unsigned alpha) : fShader(nullptr), fAlpha(alpha) { } virtual ~VerticesGM() { @@ -85,8 +85,8 @@ protected: const SkColor* fColors; const SkPoint* fTexs; } rec[] = { - { fColors, NULL }, - { NULL, fTexs }, + { fColors, nullptr }, + { nullptr, fTexs }, { fColors, fTexs }, }; diff --git a/gm/verttext.cpp b/gm/verttext.cpp index 9039685206..37cf37cbad 100644 --- a/gm/verttext.cpp +++ b/gm/verttext.cpp @@ -70,7 +70,7 @@ protected: p.setColor(0xFF0000FF); SkScalar adv[gLen]; - int numChars = paint.getTextWidths(gText, gLen, adv, NULL); + int numChars = paint.getTextWidths(gText, gLen, adv, nullptr); for (int i = 0; i < numChars; ++i) { canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); if (paint.isVerticalText()) { diff --git a/gm/verttext2.cpp b/gm/verttext2.cpp index 3a3955ee7c..4896cc992a 100644 --- a/gm/verttext2.cpp +++ b/gm/verttext2.cpp @@ -19,8 +19,8 @@ namespace skiagm { class VertText2GM : public GM { public: VertText2GM() - : fProp(NULL) - , fMono(NULL) { + : fProp(nullptr) + , fMono(nullptr) { } virtual ~VertText2GM() { diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp index 5e2dbd4f41..9b5496bc0f 100644 --- a/gm/verylargebitmap.cpp +++ b/gm/verylargebitmap.cpp @@ -15,7 +15,7 @@ static void make_bm(SkBitmap* bm, int width, int height, SkColor colors[2]) { SkCanvas canvas(*bm); SkPoint center = {SkIntToScalar(width)/2, SkIntToScalar(height)/2}; SkScalar radius = 40; - SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, NULL, 2, + SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, nullptr, 2, SkShader::kMirror_TileMode); SkPaint paint; paint.setShader(shader)->unref(); @@ -39,13 +39,13 @@ static void show_bm(SkCanvas* canvas, int width, int height, SkColor colors[2]) canvas->save(); canvas->clipRect(r); - canvas->drawBitmap(bm, 0, 0, NULL); + canvas->drawBitmap(bm, 0, 0, nullptr); canvas->restore(); canvas->drawRect(r, paint); r.offset(SkIntToScalar(150), 0); // exercises extract bitmap, but not shader - canvas->drawBitmapRect(bm, ir, r, NULL); + canvas->drawBitmapRect(bm, ir, r, nullptr); canvas->drawRect(r, paint); r.offset(SkIntToScalar(150), 0); diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp index 3efbbfad6a..80994a6ed8 100644 --- a/gm/xfermodeimagefilter.cpp +++ b/gm/xfermodeimagefilter.cpp @@ -138,8 +138,8 @@ protected: x = 0; y += fBitmap.height() + MARGIN; } - // Test NULL mode - filter.reset(SkXfermodeImageFilter::Create(NULL, background)); + // Test nullptr mode + filter.reset(SkXfermodeImageFilter::Create(nullptr, background)); paint.setImageFilter(filter); drawClippedBitmap(canvas, fBitmap, paint, x, y); x += fBitmap.width() + MARGIN; diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp index aae8cbd234..bc1bc7ff73 100644 --- a/gm/xfermodes.cpp +++ b/gm/xfermodes.cpp @@ -255,14 +255,14 @@ protected: p.setShader(s); canvas->drawRect(r, p); - canvas->saveLayer(&r, NULL); + canvas->saveLayer(&r, nullptr); draw_mode(canvas, mode, static_cast<SrcType>(sourceType), r.fLeft, r.fTop); canvas->restore(); r.inset(-SK_ScalarHalf, -SK_ScalarHalf); p.setStyle(SkPaint::kStroke_Style); - p.setShader(NULL); + p.setShader(nullptr); canvas->drawRect(r, p); #if 1 diff --git a/gm/xfermodes2.cpp b/gm/xfermodes2.cpp index 192a279bf4..db48c03d20 100644 --- a/gm/xfermodes2.cpp +++ b/gm/xfermodes2.cpp @@ -55,7 +55,7 @@ protected: SkRect r = SkRect::MakeWH(w, h); canvas->drawRect(r, p); - canvas->saveLayer(&r, NULL); + canvas->saveLayer(&r, nullptr); p.setShader(fDst); canvas->drawRect(r, p); @@ -67,8 +67,8 @@ protected: r.inset(-SK_ScalarHalf, -SK_ScalarHalf); p.setStyle(SkPaint::kStroke_Style); - p.setShader(NULL); - p.setXfermode(NULL); + p.setShader(nullptr); + p.setXfermode(nullptr); canvas->drawRect(r, p); canvas->restore(); diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp index c5e1695399..4466b1ce04 100644 --- a/gm/xfermodes3.cpp +++ b/gm/xfermodes3.cpp @@ -122,14 +122,14 @@ private: * dimensions exactly matching the layer size. */ SkCanvas* possiblyCreateTempCanvas(SkCanvas* baseCanvas, int w, int h) { - SkCanvas* tempCanvas = NULL; + SkCanvas* tempCanvas = nullptr; #if SK_SUPPORT_GPU GrContext* context = baseCanvas->getGrContext(); SkImageInfo baseInfo = baseCanvas->imageInfo(); SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(), baseInfo.profileType()); SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, - info, 0, NULL)); + info, 0, nullptr)); if (surface) { tempCanvas = SkRef(surface->getCanvas()); } @@ -147,8 +147,8 @@ private: SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); SkCanvas* modeCanvas; - if (NULL == layerCanvas) { - canvas->saveLayer(&r, NULL); + if (nullptr == layerCanvas) { + canvas->saveLayer(&r, nullptr); modeCanvas = canvas; } else { modeCanvas = layerCanvas; @@ -159,9 +159,9 @@ private: bgPaint.setShader(fBGShader); modeCanvas->drawRect(r, bgPaint); modeCanvas->drawRect(r, modePaint); - modeCanvas = NULL; + modeCanvas = nullptr; - if (NULL == layerCanvas) { + if (nullptr == layerCanvas) { canvas->restore(); } else { SkAutoROCanvasPixels ropixels(layerCanvas); @@ -205,7 +205,7 @@ private: bmpPaint.setShader(SkGradientShader::CreateRadial(kCenter, 3 * SkIntToScalar(kSize) / 4, kColors, - NULL, + nullptr, SK_ARRAY_COUNT(kColors), SkShader::kRepeat_TileMode))->unref(); diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 9d5ec450f9..4fd23efaa7 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -68,26 +68,26 @@ protected: void onDraw(SkCanvas* canvas) override { GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); - if (NULL == rt) { + if (nullptr == rt) { return; } GrContext* context = rt->getContext(); - if (NULL == context) { + if (nullptr == context) { this->drawGpuOnlyMessage(canvas); return; } GrTestTarget tt; context->getTestTarget(&tt); - if (NULL == tt.target()) { + if (nullptr == tt.target()) { SkDEBUGFAIL("Couldn't get Gr test target."); return; } SkAutoTUnref<GrTexture> texture[3]; - texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL)); - texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL)); - texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL)); + texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], nullptr)); + texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], nullptr)); + texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], nullptr)); if (!texture[0] || !texture[1] || !texture[2]) { return; |