aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-08-28 10:34:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-28 17:48:57 +0000
commita93a14a99816d25b773f0b12868143702baf44bf (patch)
tree727e7cb88867bdc12cbcf8baa354ae3afc9444e2 /include
parent695db408437807d049ecc02b3b852704092728f2 (diff)
Convert NULL and 0 to nullptr.
This was created by looking at warnings produced by clang's -Wzero-as-null-pointer-constant. This updates most issues in Skia code. However, there are places where GL and Vulkan want pointer values which are explicitly 0, external headers which use NULL directly, and possibly more uses in un-compiled sources (for other platforms). Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345 Reviewed-on: https://skia-review.googlesource.com/39521 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h6
-rw-r--r--include/core/SkCanvas.h21
-rw-r--r--include/core/SkDataTable.h4
-rw-r--r--include/core/SkDocument.h2
-rw-r--r--include/core/SkDrawable.h2
-rw-r--r--include/core/SkImageFilter.h4
-rw-r--r--include/core/SkImageInfo.h2
-rw-r--r--include/core/SkMask.h8
-rw-r--r--include/core/SkMatrix.h2
-rw-r--r--include/core/SkMetaData.h24
-rw-r--r--include/core/SkMultiPictureDraw.h4
-rw-r--r--include/core/SkPaint.h12
-rw-r--r--include/core/SkPath.h4
-rw-r--r--include/core/SkPathEffect.h4
-rw-r--r--include/core/SkPicture.h6
-rw-r--r--include/core/SkPictureRecorder.h4
-rw-r--r--include/core/SkPixelRef.h2
-rw-r--r--include/core/SkPixmap.h4
-rw-r--r--include/core/SkPoint.h4
-rw-r--r--include/core/SkRegion.h4
-rw-r--r--include/core/SkStream.h10
-rw-r--r--include/core/SkString.h6
-rw-r--r--include/core/SkTextBlob.h12
-rw-r--r--include/core/SkTypes.h2
-rw-r--r--include/core/SkWriteBuffer.h2
-rw-r--r--include/core/SkWriter32.h10
-rw-r--r--include/effects/SkColorFilterImageFilter.h2
-rw-r--r--include/effects/SkGradientShader.h13
-rw-r--r--include/gpu/GrGpuResource.h2
-rw-r--r--include/gpu/GrRenderTarget.h2
-rw-r--r--include/gpu/GrResourceKey.h4
-rw-r--r--include/ports/SkFontConfigInterface.h2
-rw-r--r--include/ports/SkFontMgr_indirect.h2
-rw-r--r--include/private/SkPathRef.h10
-rw-r--r--include/private/SkTArray.h4
-rw-r--r--include/private/SkTDArray.h24
-rw-r--r--include/private/SkTSearch.h2
-rw-r--r--include/private/SkTemplates.h16
-rw-r--r--include/utils/SkCamera.h2
-rw-r--r--include/utils/SkDumpCanvas.h2
-rw-r--r--include/utils/SkInterpolator.h8
-rw-r--r--include/utils/SkLua.h38
-rw-r--r--include/views/SkEvent.h22
43 files changed, 165 insertions, 155 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index f880883cd4..3304f3c3ec 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -393,7 +393,7 @@ public:
it has non-null pixels).
*/
bool readyToDraw() const {
- return this->getPixels() != NULL;
+ return this->getPixels() != nullptr;
}
/** Returns a non-zero, unique value corresponding to the pixels in our
@@ -564,12 +564,12 @@ public:
#endif
bool extractAlpha(SkBitmap* dst) const {
- return this->extractAlpha(dst, NULL, NULL, NULL);
+ return this->extractAlpha(dst, nullptr, nullptr, nullptr);
}
bool extractAlpha(SkBitmap* dst, const SkPaint* paint,
SkIPoint* offset) const {
- return this->extractAlpha(dst, paint, NULL, offset);
+ return this->extractAlpha(dst, paint, nullptr, offset);
}
/** Set dst to contain alpha layer of this bitmap. If destination bitmap
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 5881808520..e856eebcf4 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -96,7 +96,7 @@ public:
* by any device/pixels. Typically this use used by subclasses who handle
* the draw calls in some other way.
*/
- SkCanvas(int width, int height, const SkSurfaceProps* props = NULL);
+ SkCanvas(int width, int height, const SkSurfaceProps* props = nullptr);
/** Construct a canvas with the specified device to draw into.
@@ -193,7 +193,7 @@ public:
*
* On failure, returns NULL and the info, rowBytes, and origin parameters are ignored.
*/
- void* accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin = NULL);
+ void* accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin = nullptr);
SkRasterHandleAllocator::Handle accessTopRasterHandle() const;
@@ -733,9 +733,10 @@ public:
@param top The position of the top side of the image being drawn
@param paint The paint used to draw the image, or NULL
*/
- void drawImage(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint = NULL);
+ void drawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint = nullptr);
void drawImage(const sk_sp<SkImage>& image, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) {
+ const SkPaint* paint = nullptr) {
this->drawImage(image.get(), left, top, paint);
}
@@ -843,7 +844,7 @@ public:
@param paint The paint used to draw the bitmap, or NULL
*/
void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL);
+ const SkPaint* paint = nullptr);
/** Draw the specified bitmap, scaling and translating so that it fills the specified
* dst rect. If the src rect is non-null, only that subset of the bitmap is transformed
@@ -881,7 +882,7 @@ public:
* - The sides (along the shrink axis) and center are not drawn
*/
void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
- const SkPaint* paint = NULL);
+ const SkPaint* paint = nullptr);
/**
* Specifies coordinates to divide a bitmap into (xCount*yCount) rects.
@@ -1056,7 +1057,7 @@ public:
canvas.
*/
void drawPicture(const SkPicture* picture) {
- this->drawPicture(picture, NULL, NULL);
+ this->drawPicture(picture, nullptr, nullptr);
}
void drawPicture(const sk_sp<SkPicture>& picture) {
this->drawPicture(picture.get());
@@ -1153,7 +1154,7 @@ public:
* If the intent is to force the contents of the drawable into this canvas immediately,
* then drawable->draw(canvas) may be called.
*/
- void drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = NULL);
+ void drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = nullptr);
void drawDrawable(SkDrawable* drawable, SkScalar x, SkScalar y);
/**
@@ -1356,7 +1357,7 @@ protected:
// If non-NULL, The imageFilter parameter will be used to expand the clip
// and offscreen bounds for any margin required by the filter DAG.
bool clipRectBounds(const SkRect* bounds, SaveLayerFlags flags, SkIRect* intersection,
- const SkImageFilter* imageFilter = NULL);
+ const SkImageFilter* imageFilter = nullptr);
private:
/** After calling saveLayer(), there can be any number of devices that make
@@ -1583,7 +1584,7 @@ public:
void restore() {
if (fCanvas) {
fCanvas->restoreToCount(fSaveCount);
- fCanvas = NULL;
+ fCanvas = nullptr;
}
}
diff --git a/include/core/SkDataTable.h b/include/core/SkDataTable.h
index f8aba9a559..a46f74efba 100644
--- a/include/core/SkDataTable.h
+++ b/include/core/SkDataTable.h
@@ -42,10 +42,10 @@ public:
* @param size If non-null, this returns the byte size of this entry. This
* will be the same value that atSize(index) would return.
*/
- const void* at(int index, size_t* size = NULL) const;
+ const void* at(int index, size_t* size = nullptr) const;
template <typename T>
- const T* atT(int index, size_t* size = NULL) const {
+ const T* atT(int index, size_t* size = nullptr) const {
return reinterpret_cast<const T*>(this->at(index, size));
}
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index 0d9c23b8bf..ac08224b46 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -178,7 +178,7 @@ public:
* scope when endPage() or close() is called, or the document is deleted.
*/
SkCanvas* beginPage(SkScalar width, SkScalar height,
- const SkRect* content = NULL);
+ const SkRect* content = nullptr);
/**
* Call endPage() when the content for the current page has been drawn
diff --git a/include/core/SkDrawable.h b/include/core/SkDrawable.h
index c5053a847d..f466d0a59c 100644
--- a/include/core/SkDrawable.h
+++ b/include/core/SkDrawable.h
@@ -32,7 +32,7 @@ public:
* (i.e. the saveLevel() on the canvas will match what it was when draw() was called,
* and the current matrix and clip settings will not be changed.
*/
- void draw(SkCanvas*, const SkMatrix* = NULL);
+ void draw(SkCanvas*, const SkMatrix* = nullptr);
void draw(SkCanvas*, SkScalar x, SkScalar y);
SkPicture* newPictureSnapshot();
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index d9b0fb04ab..60000798e4 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -434,13 +434,13 @@ private:
};
/**
- * Helper to unflatten the common data, and return NULL if we fail.
+ * Helper to unflatten the common data, and return nullptr if we fail.
*/
#define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
Common localVar; \
do { \
if (!localVar.unflatten(buffer, expectedCount)) { \
- return NULL; \
+ return nullptr; \
} \
} while (0)
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index d3cbda3cf9..f659bf7742 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -144,7 +144,7 @@ static inline size_t SkColorTypeComputeOffset(SkColorType ct, int x, int y, size
* alphaType for this colorType, return it in canonical.
*/
bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
- SkAlphaType* canonical = NULL);
+ SkAlphaType* canonical = nullptr);
///////////////////////////////////////////////////////////////////////////////
diff --git a/include/core/SkMask.h b/include/core/SkMask.h
index a6d5606478..9d3a7b495f 100644
--- a/include/core/SkMask.h
+++ b/include/core/SkMask.h
@@ -59,7 +59,7 @@ struct SkMask {
uint8_t* getAddr1(int x, int y) const {
SkASSERT(kBW_Format == fFormat);
SkASSERT(fBounds.contains(x, y));
- SkASSERT(fImage != NULL);
+ SkASSERT(fImage != nullptr);
return fImage + ((x - fBounds.fLeft) >> 3) + (y - fBounds.fTop) * fRowBytes;
}
@@ -70,7 +70,7 @@ struct SkMask {
uint8_t* getAddr8(int x, int y) const {
SkASSERT(kA8_Format == fFormat);
SkASSERT(fBounds.contains(x, y));
- SkASSERT(fImage != NULL);
+ SkASSERT(fImage != nullptr);
return fImage + x - fBounds.fLeft + (y - fBounds.fTop) * fRowBytes;
}
@@ -82,7 +82,7 @@ struct SkMask {
uint16_t* getAddrLCD16(int x, int y) const {
SkASSERT(kLCD16_Format == fFormat);
SkASSERT(fBounds.contains(x, y));
- SkASSERT(fImage != NULL);
+ SkASSERT(fImage != nullptr);
uint16_t* row = (uint16_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
return row + (x - fBounds.fLeft);
}
@@ -95,7 +95,7 @@ struct SkMask {
uint32_t* getAddr32(int x, int y) const {
SkASSERT(kARGB32_Format == fFormat);
SkASSERT(fBounds.contains(x, y));
- SkASSERT(fImage != NULL);
+ SkASSERT(fImage != nullptr);
uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
return row + (x - fBounds.fLeft);
}
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 1752f26d13..746f176f4c 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -682,7 +682,7 @@ public:
*
* Possible reasons to fail: perspective, one or more scale factors are zero.
*/
- bool decomposeScale(SkSize* scale, SkMatrix* remaining = NULL) const;
+ bool decomposeScale(SkSize* scale, SkMatrix* remaining = nullptr) const;
/**
* Return a reference to a const identity matrix
diff --git a/include/core/SkMetaData.h b/include/core/SkMetaData.h
index c8ca7f1419..a8ebaac2ad 100644
--- a/include/core/SkMetaData.h
+++ b/include/core/SkMetaData.h
@@ -48,14 +48,14 @@ public:
void reset();
- bool findS32(const char name[], int32_t* value = NULL) const;
- bool findScalar(const char name[], SkScalar* value = NULL) const;
+ bool findS32(const char name[], int32_t* value = nullptr) const;
+ bool findScalar(const char name[], SkScalar* value = nullptr) const;
const SkScalar* findScalars(const char name[], int* count,
- SkScalar values[] = NULL) const;
+ SkScalar values[] = nullptr) const;
const char* findString(const char name[]) const;
- bool findPtr(const char name[], void** value = NULL, PtrProc* = NULL) const;
- bool findBool(const char name[], bool* value = NULL) const;
- const void* findData(const char name[], size_t* byteCount = NULL) const;
+ bool findPtr(const char name[], void** value = nullptr, PtrProc* = nullptr) const;
+ bool findBool(const char name[], bool* value = nullptr) const;
+ const void* findData(const char name[], size_t* byteCount = nullptr) const;
bool hasS32(const char name[], int32_t value) const {
int32_t v;
@@ -67,8 +67,8 @@ public:
}
bool hasString(const char name[], const char value[]) const {
const char* v = this->findString(name);
- return (v == NULL && value == NULL) ||
- (v != NULL && value != NULL && !strcmp(v, value));
+ return (v == nullptr && value == nullptr) ||
+ (v != nullptr && value != nullptr && !strcmp(v, value));
}
bool hasPtr(const char name[], void* value) const {
void* v;
@@ -86,9 +86,9 @@ public:
void setS32(const char name[], int32_t value);
void setScalar(const char name[], SkScalar value);
- SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL);
+ SkScalar* setScalars(const char name[], int count, const SkScalar values[] = nullptr);
void setString(const char name[], const char value[]);
- void setPtr(const char name[], void* value, PtrProc proc = NULL);
+ void setPtr(const char name[], void* value, PtrProc proc = nullptr);
void setBool(const char name[], bool value);
// the data is copied from the input pointer.
void setData(const char name[], const void* data, size_t byteCount);
@@ -101,7 +101,7 @@ public:
bool removeData(const char name[]);
// helpers for SkRefCnt
- bool findRefCnt(const char name[], SkRefCnt** ptr = NULL) {
+ bool findRefCnt(const char name[], SkRefCnt** ptr = nullptr) {
return this->findPtr(name, reinterpret_cast<void**>(ptr));
}
bool hasRefCnt(const char name[], SkRefCnt* ptr) {
@@ -131,7 +131,7 @@ public:
class Iter {
public:
- Iter() : fRec(NULL) {}
+ Iter() : fRec(nullptr) {}
Iter(const SkMetaData&);
/** Reset the iterator, so that calling next() will return the first
diff --git a/include/core/SkMultiPictureDraw.h b/include/core/SkMultiPictureDraw.h
index 9995721ab9..e798f06263 100644
--- a/include/core/SkMultiPictureDraw.h
+++ b/include/core/SkMultiPictureDraw.h
@@ -40,8 +40,8 @@ public:
*/
void add(SkCanvas* canvas,
const SkPicture* picture,
- const SkMatrix* matrix = NULL,
- const SkPaint* paint = NULL);
+ const SkMatrix* matrix = nullptr,
+ const SkPaint* paint = nullptr);
/**
* Perform all the previously added draws. This will reset the state
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 56daaf3a8a..e2937c9ea5 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -739,7 +739,7 @@ public:
@return true if the path represents style fill, or false if it represents hairline
*/
bool getFillPath(const SkPath& src, SkPath* dst) const {
- return this->getFillPath(src, dst, NULL, 1);
+ return this->getFillPath(src, dst, nullptr, 1);
}
/** Optional colors used when filling a path, such as a gradient.
@@ -1293,7 +1293,7 @@ public:
@return recommended spacing between lines
*/
- SkScalar getFontSpacing() const { return this->getFontMetrics(NULL, 0); }
+ SkScalar getFontSpacing() const { return this->getFontMetrics(nullptr, 0); }
/** Converts text into glyph indices.
Returns the number of glyph indices represented by text.
@@ -1355,7 +1355,7 @@ public:
@return number of glyphs represented by text of length byteLength
*/
int countText(const void* text, size_t byteLength) const {
- return this->textToGlyphs(text, byteLength, NULL);
+ return this->textToGlyphs(text, byteLength, nullptr);
}
/** Returns the advance width of text if kVerticalText_Flag is clear,
@@ -1386,7 +1386,7 @@ public:
@return advance width or height
*/
SkScalar measureText(const void* text, size_t length) const {
- return this->measureText(text, length, NULL);
+ return this->measureText(text, length, nullptr);
}
/** Returns the bytes of text that fit within maxWidth.
@@ -1407,7 +1407,7 @@ public:
@return bytes of text that fit, always less than or equal to length
*/
size_t breakText(const void* text, size_t length, SkScalar maxWidth,
- SkScalar* measuredWidth = NULL) const;
+ SkScalar* measuredWidth = nullptr) const;
/** Retrieves the advance and bounds for each glyph in text, and returns
the glyph count in text.
@@ -1428,7 +1428,7 @@ public:
@return glyph count in text
*/
int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
- SkRect bounds[] = NULL) const;
+ SkRect bounds[] = nullptr) const;
/** Returns the geometry as SkPath equivalent to the drawn text.
Uses SkPaint::TextEncoding to decode text, SkTypeface to get the glyph paths,
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 0a70f0e9ad..f0d6f3b2ae 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -663,7 +663,7 @@ public:
* @param direction If not null, set to the rectangle's direction
* @return true if the path specifies a rectangle
*/
- bool isRect(SkRect* rect, bool* isClosed = NULL, Direction* direction = NULL) const;
+ bool isRect(SkRect* rect, bool* isClosed = nullptr, Direction* direction = nullptr) const;
/** Returns true if the path specifies a pair of nested rectangles, or would draw a
pair of nested rectangles when filled. If so, and if
@@ -677,7 +677,7 @@ public:
@param dirs If not null, returns the direction of the rects
@return true if the path describes a pair of nested rectangles
*/
- bool isNestedFillRects(SkRect rect[2], Direction dirs[2] = NULL) const;
+ bool isNestedFillRects(SkRect rect[2], Direction dirs[2] = nullptr) const;
/**
* Add a closed rectangle contour to the path
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index 65adb33f3c..8988139d1f 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -76,7 +76,7 @@ public:
public:
PointData()
: fFlags(0)
- , fPoints(NULL)
+ , fPoints(nullptr)
, fNumPoints(0) {
fSize.set(SK_Scalar1, SK_Scalar1);
// 'asPoints' needs to initialize/fill-in 'fClipRect' if it sets
@@ -132,7 +132,7 @@ public:
};
struct DashInfo {
- DashInfo() : fIntervals(NULL), fCount(0), fPhase(0) {}
+ DashInfo() : fIntervals(nullptr), fCount(0), fPhase(0) {}
DashInfo(SkScalar* intervals, int32_t count, SkScalar phase)
: fIntervals(intervals), fCount(count), fPhase(phase) {}
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 891c11dae5..290434c8ad 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -96,7 +96,7 @@ public:
@param canvas the canvas receiving the drawing commands.
@param callback a callback that allows interruption of playback
*/
- virtual void playback(SkCanvas*, AbortCallback* = NULL) const = 0;
+ virtual void playback(SkCanvas*, AbortCallback* = nullptr) const = 0;
/** Return a cull rect for this picture.
Ops recorded into this picture that attempt to draw outside the cull might not be drawn.
@@ -152,11 +152,11 @@ public:
#ifdef SK_SUPPORT_LEGACY_PICTURE_GPUVETO
/** Return true if the picture is suitable for rendering on the GPU. */
- bool suitableForGpuRasterization(GrContext*, const char** whyNot = NULL) const;
+ bool suitableForGpuRasterization(GrContext*, const char** whyNot = nullptr) const;
#endif
// Returns NULL if this is not an SkBigPicture.
- virtual const SkBigPicture* asSkBigPicture() const { return NULL; }
+ virtual const SkBigPicture* asSkBigPicture() const { return nullptr; }
// Global setting to enable or disable security precautions for serialization.
static void SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set);
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index 09839cba5e..cadd193afc 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -48,11 +48,11 @@ public:
@return the canvas.
*/
SkCanvas* beginRecording(const SkRect& bounds,
- SkBBHFactory* bbhFactory = NULL,
+ SkBBHFactory* bbhFactory = nullptr,
uint32_t recordFlags = 0);
SkCanvas* beginRecording(SkScalar width, SkScalar height,
- SkBBHFactory* bbhFactory = NULL,
+ SkBBHFactory* bbhFactory = nullptr,
uint32_t recordFlags = 0) {
return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory, recordFlags);
}
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index b14cbdf20e..49f0f97f2f 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -97,7 +97,7 @@ public:
fAddedToCache.store(true);
}
- virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
+ virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return nullptr; }
protected:
// default impl does nothing.
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h
index c703386d1f..55e38cca4b 100644
--- a/include/core/SkPixmap.h
+++ b/include/core/SkPixmap.h
@@ -22,7 +22,7 @@ struct SkMask;
class SK_API SkPixmap {
public:
SkPixmap()
- : fPixels(NULL), fRowBytes(0), fInfo(SkImageInfo::MakeUnknown(0, 0))
+ : fPixels(nullptr), fRowBytes(0), fInfo(SkImageInfo::MakeUnknown(0, 0))
{}
SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes)
@@ -32,7 +32,7 @@ public:
void reset();
void reset(const SkImageInfo& info, const void* addr, size_t rowBytes);
void reset(const SkImageInfo& info) {
- this->reset(info, NULL, 0);
+ this->reset(info, nullptr, 0);
}
// overrides the colorspace in the SkImageInfo of the pixmap
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index f5ecbab78c..2cc57126f2 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -496,7 +496,7 @@ struct SK_API SkPoint {
*/
SkScalar distanceToLineBetweenSqd(const SkPoint& a,
const SkPoint& b,
- Side* side = NULL) const;
+ Side* side = nullptr) const;
/**
* Returns the distance to the infinite line between two pts. Also
@@ -505,7 +505,7 @@ struct SK_API SkPoint {
*/
SkScalar distanceToLineBetween(const SkPoint& a,
const SkPoint& b,
- Side* side = NULL) const {
+ Side* side = nullptr) const {
return SkScalarSqrt(this->distanceToLineBetweenSqd(a, b, side));
}
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index 49e5a19dbb..32be090764 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -20,7 +20,7 @@ namespace android {
}
#define SkRegion_gEmptyRunHeadPtr ((SkRegion::RunHead*)-1)
-#define SkRegion_gRectRunHeadPtr 0
+#define SkRegion_gRectRunHeadPtr nullptr
/** \class SkRegion
@@ -316,7 +316,7 @@ public:
*/
class SK_API Iterator {
public:
- Iterator() : fRgn(NULL), fDone(true) {}
+ Iterator() : fRgn(nullptr), fDone(true) {}
Iterator(const SkRegion&);
// if we have a region, reset to it and return true, else return false
bool rewind();
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 1862117bb6..fde6baf0c9 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -59,7 +59,7 @@ public:
* @return the actual number bytes that could be skipped.
*/
size_t skip(size_t size) {
- return this->read(NULL, size);
+ return this->read(nullptr, size);
}
/**
@@ -104,7 +104,7 @@ public:
/** Duplicates this stream. If this cannot be done, returns NULL.
* The returned stream will be positioned at the beginning of its data.
*/
- virtual SkStreamRewindable* duplicate() const { return NULL; }
+ virtual SkStreamRewindable* duplicate() const { return nullptr; }
//SkStreamSeekable
/** Returns true if this stream can report it's current position. */
@@ -127,7 +127,7 @@ public:
/** Duplicates this stream. If this cannot be done, returns NULL.
* The returned stream will be positioned the same as this stream.
*/
- virtual SkStreamSeekable* fork() const { return NULL; }
+ virtual SkStreamSeekable* fork() const { return nullptr; }
//SkStreamAsset
/** Returns true if this stream can report it's total length. */
@@ -138,7 +138,7 @@ public:
//SkStreamMemory
/** Returns the starting address for the data. If this cannot be done, returns NULL. */
//TODO: replace with virtual const SkData* getData()
- virtual const void* getMemoryBase() { return NULL; }
+ virtual const void* getMemoryBase() { return nullptr; }
};
/** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */
@@ -373,7 +373,7 @@ public:
/** Returns true if the current path could be opened.
*/
- bool isValid() const { return fFILE != NULL; }
+ bool isValid() const { return fFILE != nullptr; }
bool write(const void* buffer, size_t size) override;
void flush() override;
diff --git a/include/core/SkString.h b/include/core/SkString.h
index 4a2d91f2df..621c661142 100644
--- a/include/core/SkString.h
+++ b/include/core/SkString.h
@@ -35,13 +35,13 @@ int SkStrStartsWithOneOf(const char string[], const char prefixes[]);
static int SkStrFind(const char string[], const char substring[]) {
const char *first = strstr(string, substring);
- if (NULL == first) return -1;
+ if (nullptr == first) return -1;
return SkToInt(first - &string[0]);
}
static int SkStrFindLastOf(const char string[], const char subchar) {
const char* last = strrchr(string, subchar);
- if (NULL == last) return -1;
+ if (nullptr == last) return -1;
return SkToInt(last - &string[0]);
}
@@ -180,7 +180,7 @@ public:
void reset();
/** Destructive resize, does not preserve contents. */
- void resize(size_t len) { this->set(NULL, len); }
+ void resize(size_t len) { this->set(nullptr, len); }
void set(const SkString& src) { *this = src; }
void set(const char text[]);
void set(const char text[], size_t len);
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index f3cde25482..e15bf918a8 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -185,9 +185,9 @@ public:
SkScalar y,
int textByteCount,
SkString lang,
- const SkRect* bounds = NULL);
+ const SkRect* bounds = nullptr);
const RunBuffer& allocRun(const SkPaint& font, int count, SkScalar x, SkScalar y,
- const SkRect* bounds = NULL) {
+ const SkRect* bounds = nullptr) {
return this->allocRunText(font, count, x, y, 0, SkString(), bounds);
}
@@ -210,9 +210,9 @@ public:
*/
const RunBuffer& allocRunTextPosH(const SkPaint& font, int count, SkScalar y,
int textByteCount, SkString lang,
- const SkRect* bounds = NULL);
+ const SkRect* bounds = nullptr);
const RunBuffer& allocRunPosH(const SkPaint& font, int count, SkScalar y,
- const SkRect* bounds = NULL) {
+ const SkRect* bounds = nullptr) {
return this->allocRunTextPosH(font, count, y, 0, SkString(), bounds);
}
@@ -235,9 +235,9 @@ public:
*/
const RunBuffer& allocRunTextPos(const SkPaint& font, int count,
int textByteCount, SkString lang,
- const SkRect* bounds = NULL);
+ const SkRect* bounds = nullptr);
const RunBuffer& allocRunPos(const SkPaint& font, int count,
- const SkRect* bounds = NULL) {
+ const SkRect* bounds = nullptr) {
return this->allocRunTextPos(font, count, 0, SkString(), bounds);
}
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index b453249ea1..9887c91695 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -216,7 +216,7 @@ template <typename D, typename S> D SkTo(S s) {
/** Returns 0 or 1 based on the condition
*/
-#define SkToBool(cond) ((cond) != 0)
+#define SkToBool(cond) (bool(cond))
#define SK_MaxS16 32767
#define SK_MinS16 -32767
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h
index 36c74c140f..6cbd4eaf54 100644
--- a/include/core/SkWriteBuffer.h
+++ b/include/core/SkWriteBuffer.h
@@ -91,7 +91,7 @@ public:
fWriter.write(buffer, bytes);
}
- void reset(void* storage = NULL, size_t storageSize = 0) {
+ void reset(void* storage = nullptr, size_t storageSize = 0) {
fWriter.reset(storage, storageSize);
}
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 478d24ba95..beaaee1c7c 100644
--- a/include/core/SkWriter32.h
+++ b/include/core/SkWriter32.h
@@ -32,7 +32,7 @@ public:
* first time an allocation doesn't fit. From then it will use dynamically allocated storage.
* This used to be optional behavior, but pipe now relies on it.
*/
- SkWriter32(void* external = NULL, size_t externalBytes = 0) {
+ SkWriter32(void* external = nullptr, size_t externalBytes = 0) {
this->reset(external, externalBytes);
}
@@ -42,7 +42,7 @@ public:
SK_ATTR_DEPRECATED("use bytesWritten")
size_t size() const { return this->bytesWritten(); }
- void reset(void* external = NULL, size_t externalBytes = 0) {
+ void reset(void* external = nullptr, size_t externalBytes = 0) {
SkASSERT(SkIsAlign4((uintptr_t)external));
SkASSERT(SkIsAlign4(externalBytes));
@@ -136,19 +136,19 @@ public:
}
void writePath(const SkPath& path) {
- size_t size = path.writeToMemory(NULL);
+ size_t size = path.writeToMemory(nullptr);
SkASSERT(SkAlign4(size) == size);
path.writeToMemory(this->reserve(size));
}
void writeMatrix(const SkMatrix& matrix) {
- size_t size = matrix.writeToMemory(NULL);
+ size_t size = matrix.writeToMemory(nullptr);
SkASSERT(SkAlign4(size) == size);
matrix.writeToMemory(this->reserve(size));
}
void writeRegion(const SkRegion& rgn) {
- size_t size = rgn.writeToMemory(NULL);
+ size_t size = rgn.writeToMemory(nullptr);
SkASSERT(SkAlign4(size) == size);
rgn.writeToMemory(this->reserve(size));
}
diff --git a/include/effects/SkColorFilterImageFilter.h b/include/effects/SkColorFilterImageFilter.h
index e9af51c4d9..7812a91524 100644
--- a/include/effects/SkColorFilterImageFilter.h
+++ b/include/effects/SkColorFilterImageFilter.h
@@ -16,7 +16,7 @@ class SK_API SkColorFilterImageFilter : public SkImageFilter {
public:
static sk_sp<SkImageFilter> Make(sk_sp<SkColorFilter> cf,
sk_sp<SkImageFilter> input,
- const CropRect* cropRect = NULL);
+ const CropRect* cropRect = nullptr);
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h
index a4408ad9c3..9821c4be82 100644
--- a/include/effects/SkGradientShader.h
+++ b/include/effects/SkGradientShader.h
@@ -45,7 +45,7 @@ public:
static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode) {
- return MakeLinear(pts, colors, pos, count, mode, 0, NULL);
+ return MakeLinear(pts, colors, pos, count, mode, 0, nullptr);
}
/** Returns a shader that generates a linear gradient between the two specified points.
@@ -67,7 +67,7 @@ public:
static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
const SkScalar pos[], int count, SkShader::TileMode mode) {
- return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, 0, NULL);
+ return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, 0, nullptr);
}
/** Returns a shader that generates a radial gradient given the center and radius.
@@ -90,7 +90,7 @@ public:
static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode) {
- return MakeRadial(center, radius, colors, pos, count, mode, 0, NULL);
+ return MakeRadial(center, radius, colors, pos, count, mode, 0, nullptr);
}
/** Returns a shader that generates a radial gradient given the center and radius.
@@ -113,7 +113,8 @@ public:
static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
const SkScalar pos[], int count, SkShader::TileMode mode) {
- return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode, 0, NULL);
+ return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode,
+ 0, nullptr);
}
/**
@@ -132,7 +133,7 @@ public:
const SkColor colors[], const SkScalar pos[],
int count, SkShader::TileMode mode) {
return MakeTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, NULL);
+ 0, nullptr);
}
/**
@@ -153,7 +154,7 @@ public:
sk_sp<SkColorSpace> colorSpace, const SkScalar pos[],
int count, SkShader::TileMode mode) {
return MakeTwoPointConical(start, startRadius, end, endRadius, colors,
- std::move(colorSpace), pos, count, mode, 0, NULL);
+ std::move(colorSpace), pos, count, mode, 0, nullptr);
}
/** Returns a shader that generates a sweep gradient given a center.
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 677460ee40..6d28c1231d 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -154,7 +154,7 @@ public:
* @return true if the object has been released or abandoned,
* false otherwise.
*/
- bool wasDestroyed() const { return NULL == fGpu; }
+ bool wasDestroyed() const { return nullptr == fGpu; }
/**
* Retrieves the context that owns the object. Note that it is possible for
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index 5e4265ed33..94b1875e2e 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -63,7 +63,7 @@ public:
* @param rect a rect bounding the area needing resolve. NULL indicates
* the whole RT needs resolving.
*/
- void flagAsNeedingResolve(const SkIRect* rect = NULL);
+ void flagAsNeedingResolve(const SkIRect* rect = nullptr);
/**
* Call to override the region that needs to be resolved.
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h
index 2e7edab577..c0a08f8add 100644
--- a/include/gpu/GrResourceKey.h
+++ b/include/gpu/GrResourceKey.h
@@ -95,14 +95,14 @@ protected:
~Builder() { this->finish(); }
void finish() {
- if (NULL == fKey) {
+ if (nullptr == fKey) {
return;
}
GR_STATIC_ASSERT(0 == kHash_MetaDataIdx);
uint32_t* hash = &fKey->fKey[kHash_MetaDataIdx];
*hash = GrResourceKeyHash(hash + 1, fKey->internalSize() - sizeof(uint32_t));
fKey->validate();
- fKey = NULL;
+ fKey = nullptr;
}
uint32_t& operator[](int dataIdx) {
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index 3e279d45b8..c6b7b78628 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -62,7 +62,7 @@ public:
// If buffer is NULL, just return the number of bytes that would have
// been written. Will pad contents to a multiple of 4.
- size_t writeToMemory(void* buffer = NULL) const;
+ size_t writeToMemory(void* buffer = nullptr) const;
// Recreate from a flattened buffer, returning the number of bytes read.
size_t readFromMemory(const void* buffer, size_t length);
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index b9ab3ba913..251d74a83a 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -76,7 +76,7 @@ private:
{
SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;)
SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;)
- that.fTypeface = NULL;
+ that.fTypeface = nullptr;
}
~DataEntry() {
diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h
index f75b999f60..6d353089b0 100644
--- a/include/private/SkPathRef.h
+++ b/include/private/SkPathRef.h
@@ -83,7 +83,7 @@ public:
*/
SkPoint* growForRepeatedVerb(int /*SkPath::Verb*/ verb,
int numVbs,
- SkScalar** weights = NULL) {
+ SkScalar** weights = nullptr) {
return fPathRef->growForRepeatedVerb(verb, numVbs, weights);
}
@@ -328,8 +328,8 @@ private:
fBoundsIsDirty = true; // this also invalidates fIsFinite
fPointCnt = 0;
fVerbCnt = 0;
- fVerbs = NULL;
- fPoints = NULL;
+ fVerbs = nullptr;
+ fPoints = nullptr;
fFreeSpace = 0;
fGenerationID = kEmptyGenID;
fSegmentMask = 0;
@@ -395,8 +395,8 @@ private:
if (sizeDelta < 0 || static_cast<size_t>(sizeDelta) >= 3 * minSize) {
sk_free(fPoints);
- fPoints = NULL;
- fVerbs = NULL;
+ fPoints = nullptr;
+ fVerbs = nullptr;
fFreeSpace = 0;
fVerbCnt = 0;
fPointCnt = 0;
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h
index a6e4dedf9f..9e0b954fbf 100644
--- a/include/private/SkTArray.h
+++ b/include/private/SkTArray.h
@@ -320,10 +320,10 @@ public:
return fItemArray;
}
T* end() {
- return fItemArray ? fItemArray + fCount : NULL;
+ return fItemArray ? fItemArray + fCount : nullptr;
}
const T* end() const {
- return fItemArray ? fItemArray + fCount : NULL;
+ return fItemArray ? fItemArray + fCount : nullptr;
}
/**
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index 4c58d478fe..b0664aaa5b 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -20,7 +20,7 @@ public:
SkASSERT(src || count == 0);
fReserve = fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
if (count) {
fArray = (T*)sk_malloc_throw(count * sizeof(T));
memcpy(fArray, src, sizeof(T) * count);
@@ -84,7 +84,7 @@ public:
*/
T* release() {
T* array = fArray;
- fArray = NULL;
+ fArray = nullptr;
fReserve = fCount = 0;
return array;
}
@@ -110,8 +110,8 @@ public:
T* begin() { return fArray; }
const T* begin() const { return fArray; }
- T* end() { return fArray ? fArray + fCount : NULL; }
- const T* end() const { return fArray ? fArray + fCount : NULL; }
+ T* end() { return fArray ? fArray + fCount : nullptr; }
+ const T* end() const { return fArray ? fArray + fCount : nullptr; }
T& operator[](int index) {
SkASSERT(index < fCount);
@@ -132,7 +132,7 @@ public:
void reset() {
if (fArray) {
sk_free(fArray);
- fArray = NULL;
+ fArray = nullptr;
fReserve = fCount = 0;
} else {
SkASSERT(fReserve == 0 && fCount == 0);
@@ -171,12 +171,12 @@ public:
}
T* append() {
- return this->append(1, NULL);
+ return this->append(1, nullptr);
}
- T* append(int count, const T* src = NULL) {
+ T* append(int count, const T* src = nullptr) {
int oldCount = fCount;
if (count) {
- SkASSERT(src == NULL || fArray == NULL ||
+ SkASSERT(src == nullptr || fArray == nullptr ||
src + count <= fArray || fArray + oldCount <= src);
this->adjustCount(count);
@@ -194,9 +194,9 @@ public:
}
T* insert(int index) {
- return this->insert(index, 1, NULL);
+ return this->insert(index, 1, nullptr);
}
- T* insert(int index, int count, const T* src = NULL) {
+ T* insert(int index, int count, const T* src = nullptr) {
SkASSERT(count);
SkASSERT(index <= fCount);
size_t oldCount = fCount;
@@ -345,8 +345,8 @@ public:
#ifdef SK_DEBUG
void validate() const {
- SkASSERT((fReserve == 0 && fArray == NULL) ||
- (fReserve > 0 && fArray != NULL));
+ SkASSERT((fReserve == 0 && fArray == nullptr) ||
+ (fReserve > 0 && fArray != nullptr));
SkASSERT(fCount <= fReserve);
}
#endif
diff --git a/include/private/SkTSearch.h b/include/private/SkTSearch.h
index 549bcfd7c8..16ef0d695e 100644
--- a/include/private/SkTSearch.h
+++ b/include/private/SkTSearch.h
@@ -43,7 +43,7 @@ int SkTSearch(const T base[], int count, const K& key, size_t elemSize, LESS& le
return ~0;
}
- SkASSERT(base != NULL); // base may be NULL if count is zero
+ SkASSERT(base != nullptr); // base may be nullptr if count is zero
int lo = 0;
int hi = count - 1;
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h
index 919d160d0d..5ebf13ac36 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -87,14 +87,14 @@ public:
template <typename T> class SkAutoTArray : SkNoncopyable {
public:
SkAutoTArray() {
- fArray = NULL;
+ fArray = nullptr;
SkDEBUGCODE(fCount = 0;)
}
/** Allocate count number of T elements
*/
explicit SkAutoTArray(int count) {
SkASSERT(count >= 0);
- fArray = NULL;
+ fArray = nullptr;
if (count) {
fArray = new T[count];
}
@@ -106,7 +106,7 @@ public:
void reset(int count) {
delete[] fArray;
SkASSERT(count >= 0);
- fArray = NULL;
+ fArray = nullptr;
if (count) {
fArray = new T[count];
}
@@ -142,14 +142,14 @@ template <int kCountRequested, typename T> class SkAutoSTArray : SkNoncopyable {
public:
/** Initialize with no objects */
SkAutoSTArray() {
- fArray = NULL;
+ fArray = nullptr;
fCount = 0;
}
/** Allocate count number of T elements
*/
SkAutoSTArray(int count) {
- fArray = NULL;
+ fArray = nullptr;
fCount = 0;
this->reset(count);
}
@@ -184,7 +184,7 @@ public:
} else if (count > 0) {
fArray = (T*) fStorage;
} else {
- fArray = NULL;
+ fArray = nullptr;
}
fCount = count;
@@ -244,7 +244,7 @@ private:
template <typename T> class SkAutoTMalloc : SkNoncopyable {
public:
/** Takes ownership of the ptr. The ptr must be a value which can be passed to sk_free. */
- explicit SkAutoTMalloc(T* ptr = NULL) {
+ explicit SkAutoTMalloc(T* ptr = nullptr) {
fPtr = ptr;
}
@@ -308,7 +308,7 @@ public:
*/
T* release() {
T* ptr = fPtr;
- fPtr = NULL;
+ fPtr = nullptr;
return ptr;
}
diff --git a/include/utils/SkCamera.h b/include/utils/SkCamera.h
index 3cb13fc19b..911ff15031 100644
--- a/include/utils/SkCamera.h
+++ b/include/utils/SkCamera.h
@@ -75,7 +75,7 @@ public:
SkPatch3D();
void reset();
- void transform(const SkMatrix3D&, SkPatch3D* dst = NULL) const;
+ void transform(const SkMatrix3D&, SkPatch3D* dst = nullptr) const;
// dot a unit vector with the patch's normal
SkScalar dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const;
diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h
index 727c5797d7..e7f941c21d 100644
--- a/include/utils/SkDumpCanvas.h
+++ b/include/utils/SkDumpCanvas.h
@@ -21,7 +21,7 @@ class SkDumpCanvas : public SkCanvas {
public:
class Dumper;
- explicit SkDumpCanvas(Dumper* = 0);
+ explicit SkDumpCanvas(Dumper* = nullptr);
~SkDumpCanvas() override;
enum Verb {
diff --git a/include/utils/SkInterpolator.h b/include/utils/SkInterpolator.h
index e062b38f65..61e652519a 100644
--- a/include/utils/SkInterpolator.h
+++ b/include/utils/SkInterpolator.h
@@ -67,8 +67,8 @@ protected:
kReset = 2,
kHasBlend = 4
};
- static SkScalar ComputeRelativeT(SkMSec time, SkMSec prevTime,
- SkMSec nextTime, const SkScalar blend[4] = NULL);
+ static SkScalar ComputeRelativeT(SkMSec time, SkMSec prevTime, SkMSec nextTime,
+ const SkScalar blend[4] = nullptr);
int16_t fFrameCount;
uint8_t fElemCount;
uint8_t fFlags;
@@ -102,7 +102,7 @@ public:
1 is a linear blend (default)
*/
bool setKeyFrame(int index, SkMSec time, const SkScalar values[],
- const SkScalar blend[4] = NULL);
+ const SkScalar blend[4] = nullptr);
/** Return the computed values given the specified time. Return whether
those values are the result of pinning to either the first
@@ -111,7 +111,7 @@ public:
@param time The time to sample (in milliseconds)
@param (may be null) where to write the computed values.
*/
- Result timeToValues(SkMSec time, SkScalar values[] = NULL) const;
+ Result timeToValues(SkMSec time, SkScalar values[] = nullptr) const;
private:
SkScalar* fValues; // pointer into fStorage
diff --git a/include/utils/SkLua.h b/include/utils/SkLua.h
index ea3e166b04..651c4a71d5 100644
--- a/include/utils/SkLua.h
+++ b/include/utils/SkLua.h
@@ -30,7 +30,7 @@ class SkLua {
public:
static void Load(lua_State*);
- SkLua(const char termCode[] = NULL); // creates a new L, will close it
+ SkLua(const char termCode[] = nullptr); // creates a new L, will close it
SkLua(lua_State*); // uses L, will not close it
~SkLua();
@@ -41,24 +41,24 @@ public:
bool runCode(const char code[]);
bool runCode(const void* code, size_t size);
- void pushBool(bool, const char tableKey[] = NULL);
- void pushString(const char[], const char tableKey[] = NULL);
- void pushString(const char[], size_t len, const char tableKey[] = NULL);
- void pushString(const SkString&, const char tableKey[] = NULL);
- void pushArrayU16(const uint16_t[], int count, const char tableKey[] = NULL);
- void pushArrayPoint(const SkPoint[], int count, const char key[] = NULL);
- void pushArrayScalar(const SkScalar[], int count, const char key[] = NULL);
- void pushColor(SkColor, const char tableKey[] = NULL);
- void pushU32(uint32_t, const char tableKey[] = NULL);
- void pushScalar(SkScalar, const char tableKey[] = NULL);
- void pushRect(const SkRect&, const char tableKey[] = NULL);
- void pushRRect(const SkRRect&, const char tableKey[] = NULL);
- void pushDash(const SkPathEffect::DashInfo&, const char tableKey[] = NULL);
- void pushMatrix(const SkMatrix&, const char tableKey[] = NULL);
- void pushPaint(const SkPaint&, const char tableKey[] = NULL);
- void pushPath(const SkPath&, const char tableKey[] = NULL);
- void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
- void pushTextBlob(const SkTextBlob*, const char tableKey[] = NULL);
+ void pushBool(bool, const char tableKey[] = nullptr);
+ void pushString(const char[], const char tableKey[] = nullptr);
+ void pushString(const char[], size_t len, const char tableKey[] = nullptr);
+ void pushString(const SkString&, const char tableKey[] = nullptr);
+ void pushArrayU16(const uint16_t[], int count, const char tableKey[] = nullptr);
+ void pushArrayPoint(const SkPoint[], int count, const char key[] = nullptr);
+ void pushArrayScalar(const SkScalar[], int count, const char key[] = nullptr);
+ void pushColor(SkColor, const char tableKey[] = nullptr);
+ void pushU32(uint32_t, const char tableKey[] = nullptr);
+ void pushScalar(SkScalar, const char tableKey[] = nullptr);
+ void pushRect(const SkRect&, const char tableKey[] = nullptr);
+ void pushRRect(const SkRRect&, const char tableKey[] = nullptr);
+ void pushDash(const SkPathEffect::DashInfo&, const char tableKey[] = nullptr);
+ void pushMatrix(const SkMatrix&, const char tableKey[] = nullptr);
+ void pushPaint(const SkPaint&, const char tableKey[] = nullptr);
+ void pushPath(const SkPath&, const char tableKey[] = nullptr);
+ void pushCanvas(SkCanvas*, const char tableKey[] = nullptr);
+ void pushTextBlob(const SkTextBlob*, const char tableKey[] = nullptr);
private:
lua_State* fL;
diff --git a/include/views/SkEvent.h b/include/views/SkEvent.h
index b78fd6fc1d..091b7080a2 100644
--- a/include/views/SkEvent.h
+++ b/include/views/SkEvent.h
@@ -80,7 +80,7 @@ public:
* called (if not NULL).
*/
SkEvent* setTargetID(SkEventSinkID targetID) {
- fTargetProc = NULL;
+ fTargetProc = nullptr;
fTargetID = targetID;
return this;
}
@@ -122,17 +122,23 @@ public:
in value (if value is non-null). If there is no matching named field, return false
and ignore the value parameter.
*/
- bool findS32(const char name[], int32_t* value = NULL) const { return fMeta.findS32(name, value); }
+ bool findS32(const char name[], int32_t* value = nullptr) const {
+ return fMeta.findS32(name, value);
+ }
/** Return true if the event contains the named SkScalar field, and return the field
in value (if value is non-null). If there is no matching named field, return false
and ignore the value parameter.
*/
- bool findScalar(const char name[], SkScalar* value = NULL) const { return fMeta.findScalar(name, value); }
+ bool findScalar(const char name[], SkScalar* value = nullptr) const {
+ return fMeta.findScalar(name, value);
+ }
/** Return true if the event contains the named SkScalar field, and return the fields
in value[] (if value is non-null), and return the number of SkScalars in count (if count is non-null).
If there is no matching named field, return false and ignore the value and count parameters.
*/
- const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = NULL) const { return fMeta.findScalars(name, count, values); }
+ const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = nullptr) const {
+ return fMeta.findScalars(name, count, values);
+ }
/** Return the value of the named string field, or if no matching named field exists, return null.
*/
const char* findString(const char name[]) const { return fMeta.findString(name); }
@@ -142,7 +148,7 @@ public:
*/
bool findPtr(const char name[], void** value) const { return fMeta.findPtr(name, value); }
bool findBool(const char name[], bool* value) const { return fMeta.findBool(name, value); }
- const void* findData(const char name[], size_t* byteCount = NULL) const {
+ const void* findData(const char name[], size_t* byteCount = nullptr) const {
return fMeta.findData(name, byteCount);
}
@@ -164,7 +170,9 @@ public:
/** Add/replace the named SkScalar field to the event. In XML use the subelement <data name=... scalar=... /> */
void setScalar(const char name[], SkScalar value) { fMeta.setScalar(name, value); }
/** Add/replace the named SkScalar[] field to the event. */
- SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL) { return fMeta.setScalars(name, count, values); }
+ SkScalar* setScalars(const char name[], int count, const SkScalar values[] = nullptr) {
+ return fMeta.setScalars(name, count, values);
+ }
/** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */
void setString(const char name[], const SkString& value) { fMeta.setString(name, value.c_str()); }
/** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */
@@ -184,7 +192,7 @@ public:
/** Call this to initialize the event from the specified XML node */
void inflate(const SkDOM&, const SkDOMNode*);
- SkDEBUGCODE(void dump(const char title[] = NULL);)
+ SkDEBUGCODE(void dump(const char title[] = nullptr);)
///////////////////////////////////////////////////////////////////////////