Skip to content

Commit

Permalink
Style Change: NULL->nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
HalCanary authored and Commit bot committed Aug 27, 2015
1 parent 435af2f commit 96fcdcc
Show file tree
Hide file tree
Showing 1,145 changed files with 7,454 additions and 7,440 deletions.
6 changes: 3 additions & 3 deletions bench/AlternatingColorPatternBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AlternatingColorPatternBench : public Benchmark {


AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType)
: fBmShader(NULL) {
: fBmShader(nullptr) {
fPattern1 = gColorPatterns[pattern1];
fPattern2 = gColorPatterns[pattern2];
fName.printf("colorPattern_%s_%s_%s",
Expand Down Expand Up @@ -137,10 +137,10 @@ class AlternatingColorPatternBench : public Benchmark {
}
if (0 == count % 2) {
fColors[count] = fPattern1.fColor;
fShaders[count] = fPattern1.fIsBitmap ? fBmShader : NULL;
fShaders[count] = fPattern1.fIsBitmap ? fBmShader : nullptr;
} else {
fColors[count] = fPattern2.fColor;
fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL;
fShaders[count] = fPattern2.fIsBitmap ? fBmShader : nullptr;
}
++count;
}
Expand Down
2 changes: 1 addition & 1 deletion bench/BenchLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "SkStream.h"

BenchLogger::BenchLogger()
: fFileStream(NULL) {}
: fFileStream(nullptr) {}

BenchLogger::~BenchLogger() {
if (fFileStream) {
Expand Down
2 changes: 1 addition & 1 deletion bench/BezierBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BezierBench : public Benchmark {
fJoin = j;
fProc = proc;
fWidth = SkIntToScalar(w);
fName.printf("draw_stroke_bezier_%s_%s_%s_%g", proc(NULL, 0), gCapName[c], gJoinName[j], w);
fName.printf("draw_stroke_bezier_%s_%s_%s_%g", proc(nullptr, 0), gCapName[c], gJoinName[j], w);

fRec.fQuad.moveTo(20, 20);
fRec.fQuad.quadTo(60, 20, 60, 60);
Expand Down
2 changes: 1 addition & 1 deletion bench/BitmapBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst, SkAlphaType aT
}
SkColorTable* ctable = new SkColorTable(storage, 216);
dst->allocPixels(SkImageInfo::Make(src.width(), src.height(), kIndex_8_SkColorType, aType),
NULL, ctable);
nullptr, ctable);
ctable->unref();

SkAutoLockPixels alps(src);
Expand Down
4 changes: 2 additions & 2 deletions bench/BlurImageFilterBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class BlurImageFilterBench : public Benchmark {
SkIntToScalar(fCheckerboard.height()));
const SkImageFilter::CropRect cropRect =
SkImageFilter::CropRect(bmpRect.makeInset(10.f, 10.f));
const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : NULL;
const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : nullptr;

paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, NULL, crop))->unref();
paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, nullptr, crop))->unref();

for (int i = 0; i < loops; i++) {
canvas->drawBitmap(fCheckerboard, kX, kY, &paint);
Expand Down
6 changes: 3 additions & 3 deletions bench/BlurRectBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class BlurRectSeparableBench: public BlurRectBench {

public:
BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
fSrcMask.fImage = NULL;
fSrcMask.fImage = nullptr;
}

~BlurRectSeparableBench() {
Expand Down Expand Up @@ -144,7 +144,7 @@ class BlurRectBoxFilterBench: public BlurRectSeparableBench {

void makeBlurryRect(const SkRect&) override {
SkMask mask;
mask.fImage = NULL;
mask.fImage = nullptr;
SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
kNormal_SkBlurStyle, kHigh_SkBlurQuality);
SkMask::FreeImage(mask.fImage);
Expand All @@ -171,7 +171,7 @@ class BlurRectGaussianBench: public BlurRectSeparableBench {

void makeBlurryRect(const SkRect&) override {
SkMask mask;
mask.fImage = NULL;
mask.fImage = nullptr;
SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
&mask, fSrcMask, kNormal_SkBlurStyle);
SkMask::FreeImage(mask.fImage);
Expand Down
6 changes: 3 additions & 3 deletions bench/ChartBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void gen_data(SkScalar yAvg, SkScalar ySpread, int count,

// Generates a path to stroke along the top of each plot and a fill path for the area below each
// plot. The fill path is bounded below by the bottomData plot points or a horizontal line at
// yBase if bottomData == NULL.
// yBase if bottomData == nullptr.
// The plots are animated by rotating the data points by leftShift.
static void gen_paths(const SkTDArray<SkScalar>& topData,
const SkTDArray<SkScalar>* bottomData,
Expand All @@ -40,7 +40,7 @@ static void gen_paths(const SkTDArray<SkScalar>& topData,
plot->rewind();
fill->rewind();
plot->incReserve(topData.count());
if (NULL == bottomData) {
if (nullptr == bottomData) {
fill->incReserve(topData.count() + 2);
} else {
fill->incReserve(2 * topData.count());
Expand Down Expand Up @@ -149,7 +149,7 @@ class ChartBench : public Benchmark {
fillPaint.setAntiAlias(fAA);
fillPaint.setStyle(SkPaint::kFill_Style);

SkTDArray<SkScalar>* prevData = NULL;
SkTDArray<SkScalar>* prevData = nullptr;
for (int i = 0; i < kNumGraphs; ++i) {
gen_paths(fData[i],
prevData,
Expand Down
2 changes: 1 addition & 1 deletion bench/CmapBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void*

SkTypeface* face = paint.getTypeface();
for (int i = 0; i < loops; ++i) {
face->charsToGlyphs(text, encoding, NULL, glyphCount);
face->charsToGlyphs(text, encoding, nullptr, glyphCount);
}
}

Expand Down
2 changes: 1 addition & 1 deletion bench/CodecBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void CodecBench::onDraw(const int n, SkCanvas* canvas) {
const SkCodec::Result result =
#endif
codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(),
NULL, colorTable, &colorCount);
nullptr, colorTable, &colorCount);
SkASSERT(result == SkCodec::kSuccess
|| result == SkCodec::kIncompleteInput);
}
Expand Down
4 changes: 2 additions & 2 deletions bench/ColorCubeBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ColorCubeBench : public Benchmark {
public:
ColorCubeBench()
: fCubeDimension(0)
, fCubeData(NULL) {
, fCubeData(nullptr) {
fSize = SkISize::Make(2880, 1800); // 2014 Macbook Pro resolution
}

Expand Down Expand Up @@ -54,7 +54,7 @@ class ColorCubeBench : public Benchmark {
};
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());
}

void make_bitmap() {
Expand Down
6 changes: 3 additions & 3 deletions bench/ColorFilterBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ColorFilterBaseBench : public Benchmark {
SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARGE);
}

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,
Expand All @@ -38,7 +38,7 @@ class ColorFilterBaseBench : public Benchmark {
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;
Expand All @@ -49,7 +49,7 @@ class ColorFilterBaseBench : public Benchmark {
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::kSrcIn_Mode));
return SkColorFilterImageFilter::Create(filter, input);
Expand Down
4 changes: 2 additions & 2 deletions bench/DashBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class RectDashBench : public DashBench {

SkPaint p(paint);
p.setStyle(SkPaint::kFill_Style);
p.setPathEffect(NULL);
p.setPathEffect(nullptr);

int count = SkScalarRoundToInt((pts[1].fX - pts[0].fX) / (2*fWidth));
SkScalar dx = SkIntToScalar(2 * fWidth);
Expand Down Expand Up @@ -198,7 +198,7 @@ class MakeDashBench : public Benchmark {
for (int i = 0; i < loops; ++i) {
SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);

fPE->filterPath(&dst, fPath, &rec, NULL);
fPE->filterPath(&dst, fPath, &rec, nullptr);
dst.rewind();
}
}
Expand Down
2 changes: 1 addition & 1 deletion bench/DecodingBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ DecodingBench::DecodingBench(SkString path, SkColorType colorType)
// Ensure that we can create a decoder.
SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData));
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
SkASSERT(decoder != NULL);
SkASSERT(decoder != nullptr);
#endif
}

Expand Down
24 changes: 12 additions & 12 deletions bench/ETCBitmapBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
#include "etc1.h"

// This takes the etc1 data pointed to by orig, and copies it `factor` times in each
// dimension. The return value is the new data or NULL on error.
// dimension. The return value is the new data or nullptr on error.
static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
SkASSERT(orig);
SkASSERT(factor > 1);

const etc1_byte* origData = reinterpret_cast<const etc1_byte*>(orig);
if (!etc1_pkm_is_valid(orig)) {
return NULL;
return nullptr;
}

etc1_uint32 origWidth = etc1_pkm_get_width(origData);
Expand All @@ -37,12 +37,12 @@ static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
static const etc1_uint32 kETC1BlockHeight = 4;
if ((origWidth % kETC1BlockWidth) != 0 ||
(origHeight % kETC1BlockHeight) != 0) {
return NULL;
return nullptr;
}

// The picture must be at least as large as a block.
if (origWidth <= kETC1BlockWidth || origHeight <= kETC1BlockHeight) {
return NULL;
return nullptr;
}

etc1_uint32 newWidth = origWidth * factor;
Expand Down Expand Up @@ -80,7 +80,7 @@ static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
class ETCBitmapBenchBase : public Benchmark {
public:
ETCBitmapBenchBase() : fPKMData(loadPKM()) {
if (NULL == fPKMData) {
if (nullptr == fPKMData) {
SkDebugf("Could not load PKM data!");
}
}
Expand All @@ -93,17 +93,17 @@ class ETCBitmapBenchBase : public Benchmark {
SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
// Expand the data
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 NULL;
return nullptr;
}

const etc1_uint32 kExpansionFactor = 8;
etc1_byte* expandedETC1 =
create_expanded_etc1_bitmap(fileData->bytes(), kExpansionFactor);
if (NULL == expandedETC1) {
if (nullptr == expandedETC1) {
SkDebugf("Error expanding ETC1 data by factor of %d\n", kExpansionFactor);
return NULL;
return nullptr;
}

etc1_uint32 width = etc1_pkm_get_width(expandedETC1);
Expand Down Expand Up @@ -145,7 +145,7 @@ class ETCBitmapBench : public ETCBitmapBenchBase {
}

void onPreDraw() override {
if (NULL == fPKMData) {
if (nullptr == fPKMData) {
SkDebugf("Failed to load PKM data!\n");
return;
}
Expand All @@ -164,7 +164,7 @@ class ETCBitmapBench : public ETCBitmapBenchBase {

void onDraw(const int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops; ++i) {
canvas->drawBitmap(this->fBitmap, 0, 0, NULL);
canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
}
}

Expand Down Expand Up @@ -210,7 +210,7 @@ class ETCBitmapUploadBench : public ETCBitmapBench {
if (pr) {
pr->notifyPixelsChanged();
}
canvas->drawBitmap(this->fBitmap, 0, 0, NULL);
canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
}
}

Expand Down
2 changes: 1 addition & 1 deletion bench/FontCacheBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void dump_array(const uint16_t array[], int count) {
class FontCacheEfficiency : public Benchmark {
public:
FontCacheEfficiency() {
if (false) dump_array(NULL, 0);
if (false) dump_array(nullptr, 0);
if (false) rotr(0, 0);
}

Expand Down
16 changes: 8 additions & 8 deletions bench/GLBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@

const GrGLContext* GLBench::getGLContext(SkCanvas* canvas) {
// This bench exclusively tests GL calls directly
if (NULL == canvas->getGrContext()) {
return NULL;
if (nullptr == canvas->getGrContext()) {
return nullptr;
}
GrContext* context = canvas->getGrContext();
GrGpu* gpu = context->getGpu();
if (!gpu) {
SkDebugf("Couldn't get Gr gpu.");
return NULL;
return nullptr;
}

const GrGLContext* ctx = gpu->glContextForTesting();
if (!ctx) {
SkDebugf("Couldn't get an interface\n");
return NULL;
return nullptr;
}

return this->onGetGLContext(ctx);
Expand Down Expand Up @@ -64,7 +64,7 @@ GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GR_GL_CALL_RET(gl, shader, CreateShader(type));

// Load the shader source
GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, NULL));
GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr));

// Compile the shader
GR_GL_CALL(gl, CompileShader(shader));
Expand All @@ -74,7 +74,7 @@ GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLchar infoLog[512];
GR_GL_CALL(gl, GetShaderiv(shader, GR_GL_COMPILE_STATUS, &success));
if (!success) {
GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, NULL, infoLog));
GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, nullptr, infoLog));
SkDebugf("ERROR::SHADER::COMPLIATION_FAILED: %s\n", infoLog);
}

Expand All @@ -97,7 +97,7 @@ GrGLuint GLBench::CreateProgram(const GrGLInterface* gl, const char* vshader, co
GrGLchar infoLog[512];
GR_GL_CALL(gl, GetProgramiv(shaderProgram, GR_GL_LINK_STATUS, &success));
if (!success) {
GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, NULL, infoLog));
GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, nullptr, infoLog));
SkDebugf("Linker Error: %s\n", infoLog);
}
GR_GL_CALL(gl, DeleteShader(vertexShader));
Expand All @@ -124,7 +124,7 @@ GrGLuint GLBench::SetupFramebuffer(const GrGLInterface* gl, int screenWidth, int
0, //border
GR_GL_RGBA, //format
GR_GL_UNSIGNED_BYTE, // type
NULL));
nullptr));

// bind framebuffer
GrGLuint framebuffer;
Expand Down
2 changes: 1 addition & 1 deletion bench/GLInstancedArraysBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static void setup_matrices(int numQuads, Func f) {
const GrGLContext* GLCpuPosInstancedArraysBench::onGetGLContext(const GrGLContext* ctx) {
// We only care about gpus with drawArraysInstanced support
if (!ctx->interface()->fFunctions.fDrawArraysInstanced) {
return NULL;
return nullptr;
}
return ctx;
}
Expand Down
2 changes: 1 addition & 1 deletion bench/GLVec4ScalarBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void GLVec4ScalarBench::setupSingleVbo(const GrGLInterface* gl, const SkMatrix*
void GLVec4ScalarBench::setup(const GrGLContext* ctx) {
const GrGLInterface* gl = ctx->interface();
if (!gl) {
SkFAIL("GL interface is NULL in setup()!\n");
SkFAIL("GL interface is nullptr in setup()!\n");
}
fFboTextureId = SetupFramebuffer(gl, kScreenWidth, kScreenHeight);

Expand Down
2 changes: 1 addition & 1 deletion bench/GameBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class GameBench : public Benchmark {
{ SkIntToScalar(src.fRight), SkIntToScalar(src.fBottom) },
};
canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
4, verts, uvs, NULL, NULL,
4, verts, uvs, nullptr, nullptr,
indices, 6, p2);
} else {
canvas->drawBitmapRect(fAtlas, src, dst, &p,
Expand Down
Loading

0 comments on commit 96fcdcc

Please sign in to comment.