aboutsummaryrefslogtreecommitdiffhomepage
path: root/site
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-08-27 07:41:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-27 07:41:16 -0700
commit96fcdcc219d2a0d3579719b84b28bede76efba64 (patch)
tree0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /site
parent435af2f736c85c3274a0c6760a3523810750d237 (diff)
Style Change: NULL->nullptr
Diffstat (limited to 'site')
-rw-r--r--site/dev/contrib/style.md22
-rw-r--r--site/dev/testing/fonts.md2
-rw-r--r--site/user/api/skpaint.md30
3 files changed, 27 insertions, 27 deletions
diff --git a/site/dev/contrib/style.md b/site/dev/contrib/style.md
index ec556d9b67..639738c28f 100644
--- a/site/dev/contrib/style.md
+++ b/site/dev/contrib/style.md
@@ -440,25 +440,25 @@ stdint.h types (int32_t, etc). Assert that counts, etc are not negative instead
of using unsigned. Bitfields use uint32_t unless they have to be made shorter
for packing or performance reasons.
-NULL, 0
+nullptr, 0
-------
-Use NULL for pointers, 0 for ints. We prefer explicit NULL comparisons when
-checking for NULL pointers (as documentation):
+Use nullptr for pointers, 0 for ints. We prefer explicit nullptr comparisons when
+checking for nullptr pointers (as documentation):
<!--?prettify?-->
~~~~
-if (NULL == x) { // slightly preferred over if (!x)
+if (nullptr == x) { // slightly preferred over if (!x)
...
}
~~~~
-When checking non-NULL pointers explicit comparisons are not required because it
+When checking non-nullptr pointers explicit comparisons are not required because it
reads like a double negative:
<!--?prettify?-->
~~~~
-if (x) { // slightly preferred over if (NULL != x)
+if (x) { // slightly preferred over if (nullptr != x)
...
}
~~~~
@@ -514,7 +514,7 @@ Variable (i.e. mutable) object parameters are passed to functions as pointers.
~~~~
// src and paint are optional
void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
- const SkRect& dst, const SkPaint* paint = NULL);
+ const SkRect& dst, const SkPaint* paint = nullptr);
// metrics is mutable (it is changed by the method)
SkScalar SkPaint::getFontMetrics(FontMetric* metrics, SkScalar scale) const;
// A reference to foo is retained by SkContainer
@@ -527,8 +527,8 @@ lined up with the first parameter on the same line
<!--?prettify?-->
~~~~
void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst,
- const SkPaint* paint = NULL) {
- this->drawBitmapRectToRect(bitmap, NULL, dst, paint,
+ const SkPaint* paint = nullptr) {
+ this->drawBitmapRectToRect(bitmap, nullptr, dst, paint,
kNone_DrawBitmapRectFlag);
}
~~~~
@@ -539,9 +539,9 @@ or placed on the next line indented eight spaces
~~~~
void drawBitmapRect(
const SkBitmap& bitmap, const SkRect& dst,
- const SkPaint* paint = NULL) {
+ const SkPaint* paint = nullptr) {
this->drawBitmapRectToRect(
- bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag);
+ bitmap, nullptr, dst, paint, kNone_DrawBitmapRectFlag);
}
~~~~
diff --git a/site/dev/testing/fonts.md b/site/dev/testing/fonts.md
index 317ee9f1fa..cf1eec6d96 100644
--- a/site/dev/testing/fonts.md
+++ b/site/dev/testing/fonts.md
@@ -70,7 +70,7 @@ Each gm specifies the typeface to use when drawing text. For now, to set the
portable typeface on the paint, call:
~~~~
-sk_tool_utils::set_portable_typeface(SkPaint* , const char* name = NULL,
+sk_tool_utils::set_portable_typeface(SkPaint* , const char* name = nullptr,
SkTypeface::Style style = SkTypeface::kNormal );
~~~~
diff --git a/site/user/api/skpaint.md b/site/user/api/skpaint.md
index 8f34df30d3..df38cda6fc 100644
--- a/site/user/api/skpaint.md
+++ b/site/user/api/skpaint.md
@@ -99,8 +99,8 @@ assign a SkShader to the paint.
SkColor colors[2] = {SK_ColorBLUE, SK_ColorYELLOW};
SkShader* shader =
SkGradientShader::CreateLinear(
- points, colors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL);
+ points, colors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -201,8 +201,8 @@ with a vertical alpha gradient.
SK_ColorMAGENTA};
SkAutoTUnref<SkShader> srcShader(
SkGradientShader::CreateLinear(
- srcPoints, srcColors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL));
+ srcPoints, srcColors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr));
src.setShader(srcShader);
SkPoint dstPoints[2] = {
@@ -214,8 +214,8 @@ with a vertical alpha gradient.
SK_ColorCYAN};
SkAutoTUnref<SkShader> dstShader(
SkGradientShader::CreateLinear(
- dstPoints, dstColors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL));
+ dstPoints, dstColors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr));
dst.setShader(dstShader);
canvas->clear(SK_ColorWHITE);
size_t N = sizeof(modes) / sizeof(modes[0]);
@@ -228,7 +228,7 @@ with a vertical alpha gradient.
canvas->drawText(desc, strlen(desc), 68.0f, 30.0f, text);
canvas->clipRect(SkRect::MakeWH(64.0f, 64.0f));
canvas->drawColor(SK_ColorLTGRAY);
- (void)canvas->saveLayer(NULL, NULL);
+ (void)canvas->saveLayer(nullptr, nullptr);
canvas->clear(SK_ColorTRANSPARENT);
canvas->drawPaint(dst);
src.setXfermodeMode(modes[i]);
@@ -275,7 +275,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkShader* shader =
SkGradientShader::CreateRadial(
SkPoint::Make(128.0f, 128.0f), 180.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -293,7 +293,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkGradientShader::CreateTwoPointConical(
SkPoint::Make(128.0f, 128.0f), 128.0f,
SkPoint::Make(128.0f, 16.0f), 16.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -311,7 +311,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, SK_ColorCYAN};
SkShader* shader =
SkGradientShader::CreateSweep(
- 128.0f, 128.0f, colors, NULL, 4, 0, NULL);
+ 128.0f, 128.0f, colors, nullptr, 4, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -326,7 +326,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
canvas->clear(SK_ColorWHITE);
SkShader* shader = SkPerlinNoiseShader::CreateFractalNoise(
- 0.05f, 0.05f, 4, 0.0f, NULL);
+ 0.05f, 0.05f, 4, 0.0f, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -341,7 +341,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
canvas->clear(SK_ColorWHITE);
SkShader* shader = SkPerlinNoiseShader::CreateTurbulence(
- 0.05f, 0.05f, 4, 0.0f, NULL);
+ 0.05f, 0.05f, 4, 0.0f, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -358,9 +358,9 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkShader* shader1 =
SkGradientShader::CreateRadial(
SkPoint::Make(128.0f, 128.0f), 180.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkShader* shader2 = SkPerlinNoiseShader::CreateTurbulence(
- 0.025f, 0.025f, 2, 0.0f, NULL);
+ 0.025f, 0.025f, 2, 0.0f, nullptr);
SkShader* shader =
new SkComposeShader(shader1, shader2);
SkPaint paint;
@@ -507,7 +507,7 @@ SkColorFilter
int x = (i - 96) * 255 / 64;
ct[i] = x < 0 ? 0 : x > 255 ? 255 : x;
}
- SkColorFilter* cf = SkTableColorFilter::CreateARGB(NULL, ct, ct, ct);
+ SkColorFilter* cf = SkTableColorFilter::CreateARGB(nullptr, ct, ct, ct);
SkPaint paint;
paint.setColorFilter(cf);
cf->unref();