aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
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 /src/core
parent435af2f736c85c3274a0c6760a3523810750d237 (diff)
Style Change: NULL->nullptr
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkAAClip.cpp48
-rw-r--r--src/core/SkAAClip.h10
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.cpp4
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.h4
-rw-r--r--src/core/SkAnnotation.cpp10
-rw-r--r--src/core/SkBitmap.cpp94
-rw-r--r--src/core/SkBitmapCache.cpp4
-rw-r--r--src/core/SkBitmapCache.h18
-rw-r--r--src/core/SkBitmapController.cpp20
-rw-r--r--src/core/SkBitmapController.h2
-rw-r--r--src/core/SkBitmapDevice.cpp22
-rw-r--r--src/core/SkBitmapFilter.cpp2
-rw-r--r--src/core/SkBitmapHeap.cpp56
-rw-r--r--src/core/SkBitmapHeap.h24
-rw-r--r--src/core/SkBitmapProcShader.cpp14
-rw-r--r--src/core/SkBitmapProcShader.h4
-rw-r--r--src/core/SkBitmapProcState.cpp40
-rw-r--r--src/core/SkBitmapProcState.h2
-rw-r--r--src/core/SkBitmapProcState_sample.h8
-rw-r--r--src/core/SkBitmapProcState_shaderproc.h2
-rw-r--r--src/core/SkBitmapScaler.cpp6
-rw-r--r--src/core/SkBitmapScaler.h2
-rw-r--r--src/core/SkBlitMask.h6
-rw-r--r--src/core/SkBlitMask_D32.cpp12
-rw-r--r--src/core/SkBlitRow_D16.cpp4
-rw-r--r--src/core/SkBlitRow_D32.cpp2
-rw-r--r--src/core/SkBlitter.cpp54
-rw-r--r--src/core/SkBlitter.h6
-rw-r--r--src/core/SkBlitter_A8.cpp16
-rw-r--r--src/core/SkBlitter_ARGB32.cpp16
-rw-r--r--src/core/SkBlitter_RGB16.cpp20
-rw-r--r--src/core/SkBlitter_Sprite.cpp4
-rw-r--r--src/core/SkBuffer.cpp6
-rw-r--r--src/core/SkCachedData.cpp6
-rw-r--r--src/core/SkCachedData.h4
-rw-r--r--src/core/SkCanvas.cpp190
-rw-r--r--src/core/SkChunkAlloc.cpp10
-rw-r--r--src/core/SkClipStack.cpp28
-rw-r--r--src/core/SkColorFilter.cpp2
-rw-r--r--src/core/SkColorTable.cpp2
-rw-r--r--src/core/SkComposeShader.cpp8
-rw-r--r--src/core/SkConfig8888.cpp8
-rw-r--r--src/core/SkConfig8888.h2
-rw-r--r--src/core/SkConvolver.cpp2
-rw-r--r--src/core/SkConvolver.h4
-rw-r--r--src/core/SkData.cpp32
-rw-r--r--src/core/SkDataTable.cpp16
-rw-r--r--src/core/SkDeque.cpp80
-rw-r--r--src/core/SkDescriptor.h12
-rw-r--r--src/core/SkDevice.cpp18
-rw-r--r--src/core/SkDeviceLooper.cpp6
-rw-r--r--src/core/SkDeviceProfile.cpp4
-rw-r--r--src/core/SkDeviceProfile.h4
-rw-r--r--src/core/SkDiscardableMemory.h4
-rw-r--r--src/core/SkDraw.cpp98
-rw-r--r--src/core/SkDrawLooper.cpp4
-rw-r--r--src/core/SkDrawable.cpp2
-rw-r--r--src/core/SkEdgeBuilder.cpp2
-rw-r--r--src/core/SkEmptyShader.h6
-rw-r--r--src/core/SkEndian.h6
-rw-r--r--src/core/SkError.cpp6
-rw-r--r--src/core/SkFilterShader.cpp6
-rw-r--r--src/core/SkFlattenable.cpp8
-rw-r--r--src/core/SkFont.cpp8
-rw-r--r--src/core/SkFontDescriptor.h4
-rw-r--r--src/core/SkFontMgr.cpp38
-rw-r--r--src/core/SkFontStream.cpp2
-rw-r--r--src/core/SkFontStream.h2
-rw-r--r--src/core/SkGeometry.cpp2
-rw-r--r--src/core/SkGeometry.h6
-rw-r--r--src/core/SkGlyph.h4
-rw-r--r--src/core/SkGlyphCache.cpp32
-rw-r--r--src/core/SkGlyphCache.h12
-rw-r--r--src/core/SkGlyphCache_Globals.h2
-rw-r--r--src/core/SkImageCacherator.h2
-rw-r--r--src/core/SkImageFilter.cpp18
-rw-r--r--src/core/SkImageGenerator.cpp22
-rw-r--r--src/core/SkImageGeneratorPriv.h6
-rw-r--r--src/core/SkImageInfo.cpp2
-rw-r--r--src/core/SkLayerInfo.h8
-rw-r--r--src/core/SkLazyFnPtr.h10
-rw-r--r--src/core/SkLightingShader.cpp22
-rw-r--r--src/core/SkLightingShader.h2
-rw-r--r--src/core/SkLocalMatrixShader.cpp6
-rw-r--r--src/core/SkMallocPixelRef.cpp40
-rw-r--r--src/core/SkMaskCache.cpp8
-rw-r--r--src/core/SkMaskCache.h10
-rw-r--r--src/core/SkMaskFilter.cpp12
-rw-r--r--src/core/SkMaskGamma.h6
-rw-r--r--src/core/SkMatrix.cpp4
-rw-r--r--src/core/SkMatrixImageFilter.cpp2
-rw-r--r--src/core/SkMatrixImageFilter.h4
-rw-r--r--src/core/SkMetaData.cpp22
-rw-r--r--src/core/SkMipMap.cpp18
-rw-r--r--src/core/SkMipMap.h2
-rw-r--r--src/core/SkMultiPictureDraw.cpp8
-rw-r--r--src/core/SkPaint.cpp188
-rw-r--r--src/core/SkPaintPriv.h6
-rw-r--r--src/core/SkPath.cpp36
-rw-r--r--src/core/SkPathMeasure.cpp14
-rw-r--r--src/core/SkPathRef.cpp22
-rw-r--r--src/core/SkPictureContentInfo.cpp2
-rw-r--r--src/core/SkPictureData.cpp38
-rw-r--r--src/core/SkPictureData.h2
-rw-r--r--src/core/SkPictureFlat.cpp18
-rw-r--r--src/core/SkPictureFlat.h22
-rw-r--r--src/core/SkPicturePlayback.cpp16
-rw-r--r--src/core/SkPictureRecord.cpp18
-rw-r--r--src/core/SkPictureRecorder.cpp22
-rw-r--r--src/core/SkPictureShader.cpp22
-rw-r--r--src/core/SkPixelRef.cpp10
-rw-r--r--src/core/SkPixmap.cpp18
-rw-r--r--src/core/SkPtrRecorder.cpp4
-rw-r--r--src/core/SkPtrRecorder.h8
-rw-r--r--src/core/SkRRect.cpp2
-rw-r--r--src/core/SkRWBuffer.cpp20
-rw-r--r--src/core/SkRWBuffer.h2
-rw-r--r--src/core/SkRasterClip.cpp6
-rw-r--r--src/core/SkRasterizer.cpp4
-rw-r--r--src/core/SkReadBuffer.cpp52
-rw-r--r--src/core/SkReadBuffer.h4
-rw-r--r--src/core/SkReader32.h10
-rw-r--r--src/core/SkRecordDraw.cpp22
-rw-r--r--src/core/SkRecordDraw.h2
-rw-r--r--src/core/SkRecordOpts.cpp8
-rw-r--r--src/core/SkRecordPattern.h10
-rw-r--r--src/core/SkRecorder.cpp28
-rw-r--r--src/core/SkRecorder.h2
-rw-r--r--src/core/SkRefDict.cpp14
-rw-r--r--src/core/SkRefDict.h8
-rw-r--r--src/core/SkRegion.cpp22
-rw-r--r--src/core/SkRegionPriv.h2
-rw-r--r--src/core/SkRegion_path.cpp30
-rw-r--r--src/core/SkResourceCache.cpp40
-rw-r--r--src/core/SkResourceCache.h10
-rw-r--r--src/core/SkScalar.cpp4
-rw-r--r--src/core/SkScalerContext.cpp32
-rw-r--r--src/core/SkScalerContext.h10
-rw-r--r--src/core/SkScan_AntiPath.cpp4
-rw-r--r--src/core/SkScan_Antihair.cpp20
-rw-r--r--src/core/SkScan_Hairline.cpp6
-rw-r--r--src/core/SkScan_Path.cpp26
-rw-r--r--src/core/SkSemaphore.cpp6
-rw-r--r--src/core/SkShader.cpp18
-rw-r--r--src/core/SkSmallAllocator.h30
-rw-r--r--src/core/SkSpriteBlitter_ARGB32.cpp16
-rw-r--r--src/core/SkSpriteBlitter_RGB16.cpp16
-rw-r--r--src/core/SkStream.cpp74
-rw-r--r--src/core/SkStreamPriv.h2
-rw-r--r--src/core/SkString.cpp4
-rw-r--r--src/core/SkStroke.cpp20
-rw-r--r--src/core/SkTDPQueue.h10
-rw-r--r--src/core/SkTDynamicHash.h14
-rw-r--r--src/core/SkTLList.h6
-rwxr-xr-xsrc/core/SkTLS.cpp18
-rw-r--r--src/core/SkTLS.h6
-rw-r--r--src/core/SkTMultiMap.h10
-rw-r--r--src/core/SkTSearch.cpp2
-rw-r--r--src/core/SkTaskGroup.cpp6
-rw-r--r--src/core/SkTextBlob.cpp18
-rw-r--r--src/core/SkTraceEvent.h4
-rw-r--r--src/core/SkTypeface.cpp34
-rw-r--r--src/core/SkTypefaceCache.cpp4
-rw-r--r--src/core/SkTypefaceCache.h2
-rw-r--r--src/core/SkUtils.cpp8
-rw-r--r--src/core/SkUtilsArm.cpp6
-rw-r--r--src/core/SkValidatingReadBuffer.cpp16
-rw-r--r--src/core/SkVarAlloc.cpp6
-rw-r--r--src/core/SkVertState.cpp2
-rw-r--r--src/core/SkVertState.h2
-rw-r--r--src/core/SkWriteBuffer.cpp54
-rw-r--r--src/core/SkWriter32.cpp4
-rw-r--r--src/core/SkXfermode.cpp32
-rw-r--r--src/core/SkYUVPlanesCache.cpp4
-rw-r--r--src/core/SkYUVPlanesCache.h6
175 files changed, 1397 insertions, 1397 deletions
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 902b87a6c7..bbd1f555f0 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -136,9 +136,9 @@ SkAAClip::Iter::Iter(const SkAAClip& clip) {
if (clip.isEmpty()) {
fDone = true;
fTop = fBottom = clip.fBounds.fBottom;
- fData = NULL;
- fCurrYOff = NULL;
- fStopYOff = NULL;
+ fData = nullptr;
+ fCurrYOff = nullptr;
+ fStopYOff = nullptr;
return;
}
@@ -163,7 +163,7 @@ void SkAAClip::Iter::next() {
if (curr >= fStopYOff) {
fDone = true;
fBottom = kMaxInt32;
- fData = NULL;
+ fData = nullptr;
} else {
fBottom += curr->fY - prev->fY;
fData += curr->fOffset - prev->fOffset;
@@ -188,7 +188,7 @@ static size_t compute_row_length(const uint8_t row[], int width) {
}
void SkAAClip::validate() const {
- if (NULL == fRunHead) {
+ if (nullptr == fRunHead) {
SkASSERT(fBounds.isEmpty());
return;
}
@@ -625,12 +625,12 @@ void SkAAClip::freeRuns() {
SkAAClip::SkAAClip() {
fBounds.setEmpty();
- fRunHead = NULL;
+ fRunHead = nullptr;
}
SkAAClip::SkAAClip(const SkAAClip& src) {
SkDEBUGCODE(fBounds.setEmpty();) // need this for validate
- fRunHead = NULL;
+ fRunHead = nullptr;
*this = src;
}
@@ -698,7 +698,7 @@ bool SkAAClip::set(const SkAAClip& src) {
bool SkAAClip::setEmpty() {
this->freeRuns();
fBounds.setEmpty();
- fRunHead = NULL;
+ fRunHead = nullptr;
return false;
}
@@ -763,7 +763,7 @@ bool SkAAClip::setRect(const SkRect& r, bool doAA) {
SkPath path;
path.addRect(r);
- return this->setPath(path, NULL, doAA);
+ return this->setPath(path, nullptr, doAA);
}
static void append_run(SkTDArray<uint8_t>& array, uint8_t value, int count) {
@@ -810,7 +810,7 @@ bool SkAAClip::setRegion(const SkRegion& rgn) {
SkRegion::Iterator iter(rgn);
int prevRight = 0;
int prevBot = 0;
- YOffset* currY = NULL;
+ YOffset* currY = nullptr;
for (; !iter.done(); iter.next()) {
const SkIRect& r = iter.rect();
@@ -869,7 +869,7 @@ const uint8_t* SkAAClip::findRow(int y, int* lastYForRow) const {
SkASSERT(fRunHead);
if (!y_in_rect(y, fBounds)) {
- return NULL;
+ return nullptr;
}
y -= fBounds.y(); // our yoffs values are relative to the top
@@ -960,7 +960,7 @@ public:
Builder(const SkIRect& bounds) : fBounds(bounds) {
fPrevY = -1;
fWidth = bounds.width();
- fCurrRow = NULL;
+ fCurrRow = nullptr;
fMinY = bounds.fTop;
}
@@ -1181,7 +1181,7 @@ private:
}
Row* flushRow(bool readyForAnother) {
- Row* next = NULL;
+ Row* next = nullptr;
int count = fRows.count();
if (count > 0) {
this->flushRowH(&fRows[count - 1]);
@@ -1298,7 +1298,7 @@ public:
{ unexpected(); }
const SkPixmap* justAnOpaqueColor(uint32_t*) override {
- return NULL;
+ return nullptr;
}
void blitH(int x, int y, int width) override {
@@ -1381,7 +1381,7 @@ bool SkAAClip::setPath(const SkPath& path, const SkRegion* clip, bool doAA) {
path.getBounds().roundOut(&ibounds);
SkRegion tmpClip;
- if (NULL == clip) {
+ if (nullptr == clip) {
tmpClip.setRect(ibounds);
clip = &tmpClip;
}
@@ -1608,8 +1608,8 @@ static void operateY(SkAAClip::Builder& builder, const SkAAClip& A,
int botB = iterB.bottom();
do {
- const uint8_t* rowA = NULL;
- const uint8_t* rowB = NULL;
+ const uint8_t* rowA = nullptr;
+ const uint8_t* rowB = nullptr;
int top, bot;
if (topA < topB) {
@@ -1803,7 +1803,7 @@ bool SkAAClip::op(const SkAAClip& clip, SkRegion::Op op) {
///////////////////////////////////////////////////////////////////////////////
bool SkAAClip::translate(int dx, int dy, SkAAClip* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return !this->isEmpty();
}
@@ -1839,7 +1839,7 @@ void SkAAClip::copyToMask(SkMask* mask) const {
mask->fFormat = SkMask::kA8_Format;
if (this->isEmpty()) {
mask->fBounds.setEmpty();
- mask->fImage = NULL;
+ mask->fImage = nullptr;
mask->fRowBytes = 0;
return;
}
@@ -1898,7 +1898,7 @@ SkAAClipBlitter::~SkAAClipBlitter() {
}
void SkAAClipBlitter::ensureRunsAndAA() {
- if (NULL == fScanlineScratch) {
+ if (nullptr == fScanlineScratch) {
// add 1 so we can store the terminating run count of 0
int count = fAAClipBounds.width() + 1;
// we use this either for fRuns + fAA, or a scaline of a mask
@@ -2092,7 +2092,7 @@ static MergeAAProc find_merge_aa_proc(SkMask::Format format) {
switch (format) {
case SkMask::kBW_Format:
SkDEBUGFAIL("unsupported");
- return NULL;
+ return nullptr;
case SkMask::kA8_Format:
case SkMask::k3D_Format: {
void (*proc8)(const uint8_t*, int, const uint8_t*, int, uint8_t*) = mergeT;
@@ -2104,7 +2104,7 @@ static MergeAAProc find_merge_aa_proc(SkMask::Format format) {
}
default:
SkDEBUGFAIL("unsupported");
- return NULL;
+ return nullptr;
}
}
@@ -2168,7 +2168,7 @@ void SkAAClipBlitter::blitMask(const SkMask& origMask, const SkIRect& clip) {
// if we're BW, we need to upscale to A8 (ugh)
SkMask grayMask;
- grayMask.fImage = NULL;
+ grayMask.fImage = nullptr;
if (SkMask::kBW_Format == origMask.fFormat) {
grayMask.fFormat = SkMask::kA8_Format;
grayMask.fBounds = origMask.fBounds;
@@ -2220,5 +2220,5 @@ void SkAAClipBlitter::blitMask(const SkMask& origMask, const SkIRect& clip) {
}
const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkAAClip.h b/src/core/SkAAClip.h
index 9f6a3d6012..0207233386 100644
--- a/src/core/SkAAClip.h
+++ b/src/core/SkAAClip.h
@@ -26,7 +26,7 @@ public:
void swap(SkAAClip&);
- bool isEmpty() const { return NULL == fRunHead; }
+ bool isEmpty() const { return nullptr == fRunHead; }
const SkIRect& getBounds() const { return fBounds; }
// Returns true iff the clip is not empty, and is just a hard-edged rect (no partial alpha).
@@ -36,7 +36,7 @@ public:
bool setEmpty();
bool setRect(const SkIRect&);
bool setRect(const SkRect&, bool doAA = true);
- bool setPath(const SkPath&, const SkRegion* clip = NULL, bool doAA = true);
+ bool setPath(const SkPath&, const SkRegion* clip = nullptr, bool doAA = true);
bool setRegion(const SkRegion&);
bool set(const SkAAClip&);
@@ -65,8 +65,8 @@ public:
return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom);
}
- const uint8_t* findRow(int y, int* lastYForRow = NULL) const;
- const uint8_t* findX(const uint8_t data[], int x, int* initialCount = NULL) const;
+ const uint8_t* findRow(int y, int* lastYForRow = nullptr) const;
+ const uint8_t* findX(const uint8_t data[], int x, int* initialCount = nullptr) const;
class Iter;
struct RunHead;
@@ -99,7 +99,7 @@ private:
class SkAAClipBlitter : public SkBlitter {
public:
- SkAAClipBlitter() : fScanlineScratch(NULL) {}
+ SkAAClipBlitter() : fScanlineScratch(nullptr) {}
virtual ~SkAAClipBlitter();
void init(SkBlitter* blitter, const SkAAClip* aaclip) {
diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp
index 81e98f3613..56a557c343 100644
--- a/src/core/SkAdvancedTypefaceMetrics.cpp
+++ b/src/core/SkAdvancedTypefaceMetrics.cpp
@@ -148,7 +148,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
SkAutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<Data> > result;
SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* curRange;
- SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* prevRange = NULL;
+ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* prevRange = nullptr;
Data lastAdvance = kInvalidAdvance;
int repeatedAdvances = 0;
int wildCardsInRun = 0;
@@ -168,7 +168,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
for (int gId = firstIndex; gId <= lastIndex; gId++) {
Data advance = kInvalidAdvance;
if (gId < lastIndex) {
- // Get glyph id only when subset is NULL, or the id is in subset.
+ // Get glyph id only when subset is nullptr, or the id is in subset.
SkASSERT(!subsetGlyphIDs || (subsetIndex < subsetGlyphIDsLength &&
static_cast<uint32_t>(gId) <= subsetGlyphIDs[subsetIndex]));
if (!subsetGlyphIDs ||
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 44a6854bd5..b2c9ac3142 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -147,9 +147,9 @@ void finishRange(
@param num_glyphs Total number of glyphs in the given font.
@param glyphIDs For per-glyph info, specify subset of the font by
giving glyph ids. Each integer represents a glyph
- id. Passing NULL means all glyphs in the font.
+ id. Passing nullptr means all glyphs in the font.
@param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if
- glyphIDs is NULL.
+ glyphIDs is nullptr.
*/
template <typename Data, typename FontHandle>
SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
diff --git a/src/core/SkAnnotation.cpp b/src/core/SkAnnotation.cpp
index aa7a02af4f..84d41fc669 100644
--- a/src/core/SkAnnotation.cpp
+++ b/src/core/SkAnnotation.cpp
@@ -13,7 +13,7 @@
#include "SkWriteBuffer.h"
SkAnnotation::SkAnnotation(const char key[], SkData* value) : fKey(key) {
- if (NULL == value) {
+ if (nullptr == value) {
value = SkData::NewEmpty();
} else {
value->ref();
@@ -26,7 +26,7 @@ SkAnnotation::~SkAnnotation() {
}
SkData* SkAnnotation::find(const char key[]) const {
- return fKey.equals(key) ? fData : NULL;
+ return fKey.equals(key) ? fData : nullptr;
}
SkAnnotation::SkAnnotation(SkReadBuffer& buffer) {
@@ -60,7 +60,7 @@ static void annotate_paint(SkPaint& paint, const char* key, SkData* value) {
}
void SkAnnotateRectWithURL(SkCanvas* canvas, const SkRect& rect, SkData* value) {
- if (NULL == value) {
+ if (nullptr == value) {
return;
}
SkPaint paint;
@@ -69,7 +69,7 @@ void SkAnnotateRectWithURL(SkCanvas* canvas, const SkRect& rect, SkData* value)
}
void SkAnnotateNamedDestination(SkCanvas* canvas, const SkPoint& point, SkData* name) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
SkPaint paint;
@@ -78,7 +78,7 @@ void SkAnnotateNamedDestination(SkCanvas* canvas, const SkPoint& point, SkData*
}
void SkAnnotateLinkToDestination(SkCanvas* canvas, const SkRect& rect, SkData* name) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
SkPaint paint;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 03d1f4292b..7cc7344d2f 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -56,8 +56,8 @@ SkBitmap& SkBitmap::operator=(const SkBitmap& src) {
if (fPixelRef) {
// ignore the values from the memcpy
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
// Note that what to for genID is somewhat arbitrary. We have no
// way to track changes to raw pixels across multiple SkBitmaps.
// Would benefit from an SkRawPixelRef type created by
@@ -165,8 +165,8 @@ void SkBitmap::updatePixelsFromRef() const {
fColorTable = fPixelRef->colorTable();
} else {
SkASSERT(0 == fPixelLockCount);
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
}
}
}
@@ -207,7 +207,7 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, int dx, int dy) {
if (fPixelRef != pr) {
this->freePixels();
- SkASSERT(NULL == fPixelRef);
+ SkASSERT(nullptr == fPixelRef);
SkSafeRef(pr);
fPixelRef = pr;
@@ -227,7 +227,7 @@ void SkBitmap::lockPixels() const {
}
void SkBitmap::unlockPixels() const {
- SkASSERT(NULL == fPixelRef || fPixelLockCount > 0);
+ SkASSERT(nullptr == fPixelRef || fPixelLockCount > 0);
if (fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) {
fPixelRef->unlockPixels();
@@ -241,19 +241,19 @@ bool SkBitmap::lockPixelsAreWritable() const {
}
void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
- if (NULL == p) {
- this->setPixelRef(NULL);
+ if (nullptr == p) {
+ this->setPixelRef(nullptr);
return;
}
if (kUnknown_SkColorType == fInfo.colorType()) {
- this->setPixelRef(NULL);
+ this->setPixelRef(nullptr);
return;
}
SkPixelRef* pr = SkMallocPixelRef::NewDirect(fInfo, p, fRowBytes, ctable);
- if (NULL == pr) {
- this->setPixelRef(NULL);
+ if (nullptr == pr) {
+ this->setPixelRef(nullptr);
return;
}
@@ -267,7 +267,7 @@ void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
bool SkBitmap::tryAllocPixels(Allocator* allocator, SkColorTable* ctable) {
HeapAllocator stdalloc;
- if (NULL == allocator) {
+ if (nullptr == allocator) {
allocator = &stdalloc;
}
return allocator->allocPixelRef(this, ctable);
@@ -290,15 +290,15 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
SkMallocPixelRef::PRFactory defaultFactory;
- SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, NULL);
- if (NULL == pr) {
+ SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, nullptr);
+ if (nullptr == pr) {
return reset_return_false(this);
}
this->setPixelRef(pr)->unref();
- // TODO: lockPixels could/should return bool or void*/NULL
+ // TODO: lockPixels could/should return bool or void*/nullptr
this->lockPixels();
- if (NULL == this->getPixels()) {
+ if (nullptr == this->getPixels()) {
return reset_return_false(this);
}
return true;
@@ -306,7 +306,7 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactory* factory,
SkColorTable* ctable) {
- if (kIndex_8_SkColorType == requestedInfo.colorType() && NULL == ctable) {
+ if (kIndex_8_SkColorType == requestedInfo.colorType() && nullptr == ctable) {
return reset_return_false(this);
}
if (!this->setInfo(requestedInfo)) {
@@ -317,19 +317,19 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactor
const SkImageInfo& correctedInfo = this->info();
SkMallocPixelRef::PRFactory defaultFactory;
- if (NULL == factory) {
+ if (nullptr == factory) {
factory = &defaultFactory;
}
SkPixelRef* pr = factory->create(correctedInfo, correctedInfo.minRowBytes(), ctable);
- if (NULL == pr) {
+ if (nullptr == pr) {
return reset_return_false(this);
}
this->setPixelRef(pr)->unref();
- // TODO: lockPixels could/should return bool or void*/NULL
+ // TODO: lockPixels could/should return bool or void*/nullptr
this->lockPixels();
- if (NULL == this->getPixels()) {
+ if (nullptr == this->getPixels()) {
return reset_return_false(this);
}
return true;
@@ -349,7 +349,7 @@ bool SkBitmap::installPixels(const SkImageInfo& requestedInfo, void* pixels, siz
this->reset();
return false;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
invoke_release_proc(releaseProc, pixels, context);
return true; // we behaved as if they called setInfo()
}
@@ -390,12 +390,12 @@ void SkBitmap::freePixels() {
fPixelRef->unlockPixels();
}
fPixelRef->unref();
- fPixelRef = NULL;
+ fPixelRef = nullptr;
fPixelRefOrigin.setZero();
}
fPixelLockCount = 0;
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
}
uint32_t SkBitmap::getGenerationID() const {
@@ -410,7 +410,7 @@ void SkBitmap::notifyPixelsChanged() const {
}
GrTexture* SkBitmap::getTexture() const {
- return fPixelRef ? fPixelRef->getTexture() : NULL;
+ return fPixelRef ? fPixelRef->getTexture() : nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -427,7 +427,7 @@ bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst,
}
SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, dst->rowBytes(), ctable);
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
@@ -482,7 +482,7 @@ static bool copy_pixels_to(const SkPixmap& src, void* const dst, size_t dstSize,
}
bool SkBitmap::copyPixelsTo(void* dst, size_t dstSize, size_t dstRB, bool preserveDstPad) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
SkAutoPixmapUnlock result;
@@ -539,7 +539,7 @@ void* SkBitmap::getAddr(int x, int y) const {
break;
default:
SkDEBUGFAIL("Can't return addr for config");
- base = NULL;
+ base = nullptr;
break;
}
}
@@ -605,7 +605,7 @@ static bool compute_is_opaque(const SkPixmap& pmap) {
} break;
case kIndex_8_SkColorType: {
const SkColorTable* ctable = pmap.ctable();
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
const SkPMColor* table = ctable->readColors();
@@ -696,7 +696,7 @@ void SkBitmap::eraseColor(SkColor c) const {
bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
SkDEBUGCODE(this->validate();)
- if (NULL == result || NULL == fPixelRef) {
+ if (nullptr == result || nullptr == fPixelRef) {
return false; // no src pixels
}
@@ -706,10 +706,10 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
return false; // r is empty (i.e. no intersection)
}
- if (fPixelRef->getTexture() != NULL) {
+ if (fPixelRef->getTexture() != nullptr) {
// Do a deep copy
SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->profileType(), &subset);
- if (pixelRef != NULL) {
+ if (pixelRef != nullptr) {
SkBitmap dst;
dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(),
this->colorType(), this->alphaType()));
@@ -816,7 +816,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, Allocator* alloc)
SkASSERT(tmpSrc.height() == this->height());
// did we get lucky and we can just return tmpSrc?
- if (tmpSrc.colorType() == dstColorType && NULL == alloc) {
+ if (tmpSrc.colorType() == dstColorType && nullptr == alloc) {
dst->swap(tmpSrc);
// If the result is an exact copy, clone the gen ID.
if (dst->pixelRef() && dst->pixelRef()->info() == fPixelRef->info()) {
@@ -888,7 +888,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
// If we have a PixelRef, and it supports deep copy, use it.
// Currently supported only by texture-backed bitmaps.
if (fPixelRef) {
- SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstPT, NULL);
+ SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstPT, nullptr);
if (pixelRef) {
uint32_t rowBytes;
if (this->colorType() == dstCT && this->profileType() == dstPT) {
@@ -915,7 +915,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
if (this->getTexture()) {
return false;
} else {
- return this->copyTo(dst, dstCT, NULL);
+ return this->copyTo(dst, dstCT, nullptr);
}
}
@@ -978,7 +978,7 @@ static void get_bitmap_alpha(const SkPixmap& pmap, uint8_t* SK_RESTRICT alpha, i
}
static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, int alphaRowBytes) {
- SkASSERT(alpha != NULL);
+ SkASSERT(alpha != nullptr);
SkASSERT(alphaRowBytes >= src.width());
SkAutoPixmapUnlock apl;
@@ -1006,20 +1006,20 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
srcM.fRowBytes = SkAlign4(this->width());
srcM.fFormat = SkMask::kA8_Format;
- SkMaskFilter* filter = paint ? paint->getMaskFilter() : NULL;
+ SkMaskFilter* filter = paint ? paint->getMaskFilter() : nullptr;
// compute our (larger?) dst bounds if we have a filter
if (filter) {
identity.reset();
- srcM.fImage = NULL;
- if (!filter->filterMask(&dstM, srcM, identity, NULL)) {
+ srcM.fImage = nullptr;
+ if (!filter->filterMask(&dstM, srcM, identity, nullptr)) {
goto NO_FILTER_CASE;
}
dstM.fRowBytes = SkAlign4(dstM.fBounds.width());
} else {
NO_FILTER_CASE:
tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes);
- if (!tmpBitmap.tryAllocPixels(allocator, NULL)) {
+ if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
tmpBitmap.width(), tmpBitmap.height());
@@ -1036,14 +1036,14 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
SkAutoMaskFreeImage srcCleanup(srcM.fImage);
GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes);
- if (!filter->filterMask(&dstM, srcM, identity, NULL)) {
+ if (!filter->filterMask(&dstM, srcM, identity, nullptr)) {
goto NO_FILTER_CASE;
}
SkAutoMaskFreeImage dstCleanup(dstM.fImage);
tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
dstM.fRowBytes);
- if (!tmpBitmap.tryAllocPixels(allocator, NULL)) {
+ if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
tmpBitmap.width(), tmpBitmap.height());
@@ -1091,7 +1091,7 @@ static void write_raw_pixels(SkWriteBuffer* buffer, const SkPixmap& pmap) {
void SkBitmap::WriteRawPixels(SkWriteBuffer* buffer, const SkBitmap& bitmap) {
const SkImageInfo info = bitmap.info();
- if (0 == info.width() || 0 == info.height() || NULL == bitmap.pixelRef()) {
+ if (0 == info.width() || 0 == info.height() || nullptr == bitmap.pixelRef()) {
buffer->writeUInt(0); // instead of snugRB, signaling no pixels
return;
}
@@ -1210,7 +1210,7 @@ void SkBitmap::validate() const {
SkASSERT(fPixelRef->info().height() >= (int)this->height() + fPixelRefOrigin.fY);
SkASSERT(fPixelRef->rowBytes() >= fInfo.minRowBytes());
} else {
- SkASSERT(NULL == fColorTable);
+ SkASSERT(nullptr == fColorTable);
}
}
#endif
@@ -1240,7 +1240,7 @@ void SkBitmap::toString(SkString* str) const {
str->append(")");
SkPixelRef* pr = this->pixelRef();
- if (NULL == pr) {
+ if (nullptr == pr) {
// show null or the explicit pixel address (rare)
str->appendf(" pixels:%p", this->getPixels());
} else {
@@ -1262,7 +1262,7 @@ bool SkBitmap::requestLock(SkAutoPixmapUnlock* result) const {
SkASSERT(result);
SkPixelRef* pr = fPixelRef;
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp
index 66075d4eae..2b11b81fd7 100644
--- a/src/core/SkBitmapCache.cpp
+++ b/src/core/SkBitmapCache.cpp
@@ -202,7 +202,7 @@ struct MipMapRec : public SkResourceCache::Rec {
const SkMipMap* mm = SkRef(rec.fMipMap);
// the call to ref() above triggers a "lock" in the case of discardable memory,
// which means we can now check for null (in case the lock failed).
- if (NULL == mm->data()) {
+ if (nullptr == mm->data()) {
mm->unref(); // balance our call to ref()
return false;
}
@@ -222,7 +222,7 @@ const SkMipMap* SkMipMapCache::FindAndRef(const SkBitmap& src, SkResourceCache*
const SkMipMap* result;
if (!CHECK_LOCAL(localCache, find, Find, key, MipMapRec::Finder, &result)) {
- result = NULL;
+ result = nullptr;
}
return result;
}
diff --git a/src/core/SkBitmapCache.h b/src/core/SkBitmapCache.h
index c758942080..3e541eed2c 100644
--- a/src/core/SkBitmapCache.h
+++ b/src/core/SkBitmapCache.h
@@ -22,7 +22,7 @@ class SkBitmapCache {
public:
/**
* Use this allocator for bitmaps, so they can use ashmem when available.
- * Returns NULL if the ResourceCache has not been initialized with a DiscardableFactory.
+ * Returns nullptr if the ResourceCache has not been initialized with a DiscardableFactory.
*/
static SkBitmap::Allocator* GetAllocator();
@@ -31,37 +31,37 @@ public:
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, SkBitmap* result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/*
* result must be marked isImmutable()
*/
static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
- const SkBitmap& result, SkResourceCache* localCache = NULL);
+ const SkBitmap& result, SkResourceCache* localCache = nullptr);
/**
* Search based on the bitmap's genID and subset. If found, returns true and
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(uint32_t genID, const SkIRect& subset, SkBitmap* result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* The width and the height of the provided subset must be the same as the result bitmap ones.
* result must be marked isImmutable()
*/
static bool Add(SkPixelRef*, const SkIRect& subset, const SkBitmap& result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
- static bool Find(uint32_t genID, SkBitmap* result, SkResourceCache* localCache = NULL);
+ static bool Find(uint32_t genID, SkBitmap* result, SkResourceCache* localCache = nullptr);
// todo: eliminate the need to specify ID, since it should == the bitmap's
- static void Add(uint32_t genID, const SkBitmap&, SkResourceCache* localCache = NULL);
+ static void Add(uint32_t genID, const SkBitmap&, SkResourceCache* localCache = nullptr);
};
class SkMipMapCache {
public:
- static const SkMipMap* FindAndRef(const SkBitmap& src, SkResourceCache* localCache = NULL);
- static const SkMipMap* AddAndRef(const SkBitmap& src, SkResourceCache* localCache = NULL);
+ static const SkMipMap* FindAndRef(const SkBitmap& src, SkResourceCache* localCache = nullptr);
+ static const SkMipMap* AddAndRef(const SkBitmap& src, SkResourceCache* localCache = nullptr);
};
#endif
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index fb54388a7e..e4b4199c69 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -16,7 +16,7 @@ static bool valid_for_drawing(const SkBitmap& bm) {
if (0 == bm.width() || 0 == bm.height()) {
return false; // nothing to draw
}
- if (NULL == bm.pixelRef()) {
+ if (nullptr == bm.pixelRef()) {
return false; // no pixels to read
}
if (bm.getTexture()) {
@@ -38,14 +38,14 @@ SkBitmapController::State* SkBitmapController::requestBitmap(const SkBitmap& bm,
void* storage, size_t storageSize) {
if (!valid_for_drawing(bm)) {
- return NULL;
+ return nullptr;
}
State* state = this->onRequestBitmap(bm, inv, quality, storage, storageSize);
if (state) {
- if (NULL == state->fPixmap.addr()) {
+ if (nullptr == state->fPixmap.addr()) {
SkInPlaceDeleteCheck(state, storage);
- state = NULL;
+ state = nullptr;
}
}
return state;
@@ -161,21 +161,21 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmap& origBi
fQuality = kLow_SkFilterQuality;
SkSize invScaleSize;
- if (!fInvMatrix.decomposeScale(&invScaleSize, NULL)) {
+ if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) {
return false;
}
SkScalar invScale = SkScalarSqrt(invScaleSize.width() * invScaleSize.height());
if (invScale > SK_Scalar1) {
fCurrMip.reset(SkMipMapCache::FindAndRef(origBitmap));
- if (NULL == fCurrMip.get()) {
+ if (nullptr == fCurrMip.get()) {
fCurrMip.reset(SkMipMapCache::AddAndRef(origBitmap));
- if (NULL == fCurrMip.get()) {
+ if (nullptr == fCurrMip.get()) {
return false;
}
}
// diagnostic for a crasher...
- if (NULL == fCurrMip->data()) {
+ if (nullptr == fCurrMip->data()) {
sk_throw();
}
@@ -191,7 +191,7 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmap& origBi
return fResultBitmap.installPixels(info, level.fPixels, level.fRowBytes);
} else {
// failed to extract, so release the mipmap
- fCurrMip.reset(NULL);
+ fCurrMip.reset(nullptr);
}
}
return false;
@@ -213,7 +213,7 @@ SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmap& s
SkASSERT(fQuality <= kLow_SkFilterQuality);
// fResultBitmap.getPixels() may be null, but our caller knows to check fPixmap.addr()
- // and will destroy us if it is NULL.
+ // and will destroy us if it is nullptr.
fPixmap.reset(fResultBitmap.info(), fResultBitmap.getPixels(), fResultBitmap.rowBytes(),
fResultBitmap.getColorTable());
}
diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h
index ead4b783bd..aa663e85f7 100644
--- a/src/core/SkBitmapController.h
+++ b/src/core/SkBitmapController.h
@@ -40,7 +40,7 @@ public:
void* storage, size_t storageSize);
State* requestBitmap(const SkBitmap& bm, const SkMatrix& inverse, SkFilterQuality quality) {
- return this->requestBitmap(bm, inverse, quality, NULL, 0);
+ return this->requestBitmap(bm, inverse, quality, nullptr, 0);
}
protected:
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index d4445fae9b..b7df9a4c25 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -67,7 +67,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
: INHERITED(SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
, fBitmap(bitmap) {
- SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
+ SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
}
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
@@ -77,14 +77,14 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps)
: INHERITED(surfaceProps)
, fBitmap(bitmap) {
- SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
+ SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
}
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
const SkSurfaceProps& surfaceProps) {
SkAlphaType newAT = origInfo.alphaType();
if (!valid_for_bitmap_device(origInfo, &newAT)) {
- return NULL;
+ return nullptr;
}
const SkImageInfo info = origInfo.makeAlphaType(newAT);
@@ -92,11 +92,11 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
if (kUnknown_SkColorType == info.colorType()) {
if (!bitmap.setInfo(info)) {
- return NULL;
+ return nullptr;
}
} else {
if (!bitmap.tryAllocPixels(info)) {
- return NULL;
+ return nullptr;
}
if (!bitmap.info().isOpaque()) {
bitmap.eraseColor(SK_ColorTRANSPARENT);
@@ -142,7 +142,7 @@ bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
const SkImageInfo info = fBitmap.info();
if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) {
- SkColorTable* ctable = NULL;
+ SkColorTable* ctable = nullptr;
pmap->reset(fBitmap.info(), fBitmap.getPixels(), fBitmap.rowBytes(), ctable);
return true;
}
@@ -152,7 +152,7 @@ bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels,
size_t srcRowBytes, int x, int y) {
// since we don't stop creating un-pixeled devices yet, check for no pixels here
- if (NULL == fBitmap.getPixels()) {
+ if (nullptr == fBitmap.getPixels()) {
return false;
}
@@ -211,7 +211,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa
path.addOval(oval);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawOval.
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
@@ -223,7 +223,7 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
#else
draw.drawRRect(rrect, paint);
#endif
@@ -238,7 +238,7 @@ void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint& paint) {
- draw.drawBitmap(bitmap, matrix, NULL, paint);
+ draw.drawBitmap(bitmap, matrix, nullptr, paint);
}
void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
@@ -319,7 +319,7 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
&matrix);
- if (NULL == s) {
+ if (nullptr == s) {
return;
}
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index 4c1e9c68a3..55a7092ba7 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -35,6 +35,6 @@ SkBitmapFilter *SkBitmapFilter::Allocate() {
SkDEBUGFAIL("Unknown filter type");
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp
index 5b16d21e30..c65a704b5a 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -65,9 +65,9 @@ bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a,
SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
: INHERITED()
- , fExternalStorage(NULL)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fExternalStorage(nullptr)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(ownerCount)
, fBytesAllocated(0)
@@ -77,8 +77,8 @@ SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
SkBitmapHeap::SkBitmapHeap(ExternalStorage* storage, int32_t preferredSize)
: INHERITED()
, fExternalStorage(storage)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(IGNORE_OWNERS)
, fBytesAllocated(0)
@@ -111,39 +111,39 @@ SkBitmapHeap::~SkBitmapHeap() {
void SkBitmapHeap::removeFromLRU(SkBitmapHeap::LookupEntry* entry) {
if (fMostRecentlyUsed == entry) {
fMostRecentlyUsed = entry->fLessRecentlyUsed;
- if (NULL == fMostRecentlyUsed) {
+ if (nullptr == fMostRecentlyUsed) {
SkASSERT(fLeastRecentlyUsed == entry);
- fLeastRecentlyUsed = NULL;
+ fLeastRecentlyUsed = nullptr;
} else {
- fMostRecentlyUsed->fMoreRecentlyUsed = NULL;
+ fMostRecentlyUsed->fMoreRecentlyUsed = nullptr;
}
} else {
// Remove entry from its prior place, and make sure to cover the hole.
if (fLeastRecentlyUsed == entry) {
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
fLeastRecentlyUsed = entry->fMoreRecentlyUsed;
}
// Since we have already considered the case where entry is the most recently used, it must
// have a more recently used at this point.
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
entry->fMoreRecentlyUsed->fLessRecentlyUsed = entry->fLessRecentlyUsed;
- if (entry->fLessRecentlyUsed != NULL) {
+ if (entry->fLessRecentlyUsed != nullptr) {
SkASSERT(fLeastRecentlyUsed != entry);
entry->fLessRecentlyUsed->fMoreRecentlyUsed = entry->fMoreRecentlyUsed;
}
}
- entry->fMoreRecentlyUsed = NULL;
+ entry->fMoreRecentlyUsed = nullptr;
}
void SkBitmapHeap::appendToLRU(SkBitmapHeap::LookupEntry* entry) {
- if (fMostRecentlyUsed != NULL) {
- SkASSERT(NULL == fMostRecentlyUsed->fMoreRecentlyUsed);
+ if (fMostRecentlyUsed != nullptr) {
+ SkASSERT(nullptr == fMostRecentlyUsed->fMoreRecentlyUsed);
fMostRecentlyUsed->fMoreRecentlyUsed = entry;
entry->fLessRecentlyUsed = fMostRecentlyUsed;
}
fMostRecentlyUsed = entry;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
fLeastRecentlyUsed = entry;
}
}
@@ -154,13 +154,13 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
SkASSERT(fStorage.count() >= fPreferredCount);
SkBitmapHeap::LookupEntry* iter = fLeastRecentlyUsed;
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
// If the least recently used bitmap has not been unreferenced
// by its owner, then according to our LRU specifications a more
// recently used one can not have used all its references yet either.
- return NULL;
+ return nullptr;
}
if (replacement.getGenerationID() == iter->fGenerationId) {
// Do not replace a bitmap with a new one using the same
@@ -171,7 +171,7 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
return iter;
}
}
- return NULL;
+ return nullptr;
}
size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
@@ -182,7 +182,7 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
size_t origBytesAllocated = fBytesAllocated;
// Purge starting from LRU until a non-evictable bitmap is found or until
// everything is evicted.
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
break;
@@ -203,15 +203,15 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
if (fLeastRecentlyUsed != iter) {
// There was at least one eviction.
fLeastRecentlyUsed = iter;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
// Everything was evicted
- fMostRecentlyUsed = NULL;
+ fMostRecentlyUsed = nullptr;
fBytesAllocated -= (fStorage.count() * sizeof(SkBitmapHeapEntry));
fStorage.deleteAll();
fUnusedSlots.reset();
SkASSERT(0 == fBytesAllocated);
} else {
- fLeastRecentlyUsed->fLessRecentlyUsed = NULL;
+ fLeastRecentlyUsed->fLessRecentlyUsed = nullptr;
}
}
@@ -228,7 +228,7 @@ int SkBitmapHeap::findInLookupTable(const LookupEntry& indexEntry, SkBitmapHeapE
// insert ourselves into the bitmapIndex
index = ~index;
*fLookupTable.insert(index) = new LookupEntry(indexEntry);
- } else if (entry != NULL) {
+ } else if (entry != nullptr) {
// populate the entry if needed
*entry = fStorage[fLookupTable[index]->fStorageSlot];
}
@@ -244,7 +244,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
if (originalBitmap.isImmutable()) {
copiedBitmap = originalBitmap;
// TODO if we have the pixel ref in the heap we could pass it here to avoid a potential deep copy
-// else if (sharedPixelRef != NULL) {
+// else if (sharedPixelRef != nullptr) {
// copiedBitmap = orig;
// copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset());
} else if (originalBitmap.empty()) {
@@ -259,7 +259,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
// remove the bitmap index for the deleted entry
SkDEBUGCODE(int count = fLookupTable.count();)
- int index = this->findInLookupTable(*entry, NULL);
+ int index = this->findInLookupTable(*entry, nullptr);
// Verify that findInLookupTable found an existing entry rather than adding
// a new entry to the lookup table.
SkASSERT(count == fLookupTable.count());
@@ -270,7 +270,7 @@ int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
}
int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
- SkBitmapHeapEntry* entry = NULL;
+ SkBitmapHeapEntry* entry = nullptr;
int searchIndex = this->findInLookupTable(LookupEntry(originalBitmap), &entry);
if (entry) {
@@ -296,7 +296,7 @@ int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
if (fPreferredCount != UNLIMITED_SIZE && fStorage.count() >= fPreferredCount) {
// iterate through our LRU cache and try to find an entry to evict
LookupEntry* lookupEntry = this->findEntryToReplace(originalBitmap);
- if (lookupEntry != NULL) {
+ if (lookupEntry != nullptr) {
// we found an entry to evict
entry = fStorage[lookupEntry->fStorageSlot];
// Remove it from the LRU. The new entry will be added to the LRU later.
@@ -383,7 +383,7 @@ void SkBitmapHeap::endAddingOwnersDeferral(bool add) {
for (int i = 0; i < fDeferredEntries.count(); i++) {
SkASSERT(fOwnerCount != IGNORE_OWNERS);
SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]);
- SkASSERT(heapEntry != NULL);
+ SkASSERT(heapEntry != nullptr);
heapEntry->addReferences(fOwnerCount);
}
}
diff --git a/src/core/SkBitmapHeap.h b/src/core/SkBitmapHeap.h
index 1e1979fbf7..22c31a0b0b 100644
--- a/src/core/SkBitmapHeap.h
+++ b/src/core/SkBitmapHeap.h
@@ -116,24 +116,24 @@ public:
/**
* Retrieves the bitmap from the specified slot in the heap
*
- * @return The bitmap located at that slot or NULL if external storage is being used.
+ * @return The bitmap located at that slot or nullptr if external storage is being used.
*/
SkBitmap* getBitmap(int32_t slot) const override {
- SkASSERT(fExternalStorage == NULL);
+ SkASSERT(fExternalStorage == nullptr);
SkBitmapHeapEntry* entry = getEntry(slot);
if (entry) {
return &entry->fBitmap;
}
- return NULL;
+ return nullptr;
}
/**
* Retrieves the bitmap from the specified slot in the heap
*
- * @return The bitmap located at that slot or NULL if external storage is being used.
+ * @return The bitmap located at that slot or nullptr if external storage is being used.
*/
void releaseRef(int32_t slot) override {
- SkASSERT(fExternalStorage == NULL);
+ SkASSERT(fExternalStorage == nullptr);
if (fOwnerCount != IGNORE_OWNERS) {
SkBitmapHeapEntry* entry = getEntry(slot);
if (entry) {
@@ -158,12 +158,12 @@ public:
* Retrieves an entry from the heap at a given slot.
*
* @param slot the slot in the heap where a bitmap was stored.
- * @return a SkBitmapHeapEntry that wraps the bitmap or NULL if external storage is used.
+ * @return a SkBitmapHeapEntry that wraps the bitmap or nullptr if external storage is used.
*/
SkBitmapHeapEntry* getEntry(int32_t slot) const {
SkASSERT(slot <= fStorage.count());
- if (fExternalStorage != NULL) {
- return NULL;
+ if (fExternalStorage != nullptr) {
+ return nullptr;
}
return fStorage[slot];
}
@@ -172,7 +172,7 @@ public:
* Returns a count of the number of items currently in the heap
*/
int count() const {
- SkASSERT(fExternalStorage != NULL ||
+ SkASSERT(fExternalStorage != nullptr ||
fStorage.count() - fUnusedSlots.count() == fLookupTable.count());
return fLookupTable.count();
}
@@ -215,8 +215,8 @@ private:
, fPixelOrigin(bm.pixelRefOrigin())
, fWidth(bm.width())
, fHeight(bm.height())
- , fMoreRecentlyUsed(NULL)
- , fLessRecentlyUsed(NULL){}
+ , fMoreRecentlyUsed(nullptr)
+ , fLessRecentlyUsed(nullptr){}
const uint32_t fGenerationId; // SkPixelRef GenerationID.
const SkIPoint fPixelOrigin;
@@ -260,7 +260,7 @@ private:
/**
* Remove a LookupEntry from the LRU, in preparation for either deleting or appending as most
* recent. Points the LookupEntry's old neighbors at each other, and sets fLeastRecentlyUsed
- * (if there is still an entry left). Sets LookupEntry's fMoreRecentlyUsed to NULL and leaves
+ * (if there is still an entry left). Sets LookupEntry's fMoreRecentlyUsed to nullptr and leaves
* its fLessRecentlyUsed unmodified.
*/
void removeFromLRU(LookupEntry* entry);
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index ef9cfd4dc8..e382d09c99 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -47,7 +47,7 @@ SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) {
buffer.readMatrix(&lm);
SkBitmap bm;
if (!buffer.readBitmap(&bm)) {
- return NULL;
+ return nullptr;
}
bm.setImmutable();
TileMode mx = (TileMode)buffer.readUInt();
@@ -75,7 +75,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
SkMatrix totalInverse;
// Do this first, so we know the matrix can be inverted.
if (!this->computeTotalInverse(rec, &totalInverse)) {
- return NULL;
+ return nullptr;
}
void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
@@ -87,7 +87,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
state->fOrigBitmap = fRawBitmap;
if (!state->chooseProcs(totalInverse, *rec.fPaint)) {
state->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
return new (storage) BitmapProcShaderContext(*this, rec, state);
@@ -212,7 +212,7 @@ SkShader::Context::ShadeProc SkBitmapProcShader::BitmapProcShaderContext::asASha
*ctx = fState;
return (ShadeProc)fState->getShaderProc32();
}
- return NULL;
+ return nullptr;
}
void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan16(int x, int y, uint16_t dstC[],
@@ -301,19 +301,19 @@ SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
SkShader* shader;
SkColor color;
if (src.isNull() || bitmap_is_too_big(src)) {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkEmptyShader;
} else {
shader = allocator->createT<SkEmptyShader>();
}
} else if (can_use_color_shader(src, &color)) {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkColorShader(color);
} else {
shader = allocator->createT<SkColorShader>(color);
}
} else {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkBitmapProcShader(src, tmx, tmy, localMatrix);
} else {
shader = allocator->createT<SkBitmapProcShader>(src, tmx, tmy, localMatrix);
diff --git a/src/core/SkBitmapProcShader.h b/src/core/SkBitmapProcShader.h
index 5179ff8bf2..30f860a9bf 100644
--- a/src/core/SkBitmapProcShader.h
+++ b/src/core/SkBitmapProcShader.h
@@ -18,7 +18,7 @@ struct SkBitmapProcState;
class SkBitmapProcShader : public SkShader {
public:
SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty,
- const SkMatrix* localMatrix = NULL);
+ const SkMatrix* localMatrix = nullptr);
// overrides from SkShader
bool isOpaque() const override;
@@ -72,7 +72,7 @@ private:
// yet found a situation where the size below isn't big enough.
typedef SkSmallAllocator<3, 1152> SkTBlitterAllocator;
-// If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive
+// If alloc is non-nullptr, it will be used to allocate the returned SkShader, and MUST outlive
// the SkShader.
SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader::TileMode,
const SkMatrix* localMatrix, SkTBlitterAllocator* alloc);
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 2227010da3..31109aaee9 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -37,7 +37,7 @@ extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState&
#include "SkBitmapProcState_filter.h"
#include "SkBitmapProcState_procs.h"
-SkBitmapProcState::SkBitmapProcState() : fBMState(NULL) {}
+SkBitmapProcState::SkBitmapProcState() : fBMState(nullptr) {}
SkBitmapProcState::~SkBitmapProcState() {
SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get());
@@ -122,7 +122,7 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
fBMState = controller.requestBitmap(fOrigBitmap, inv, paint.getFilterQuality(),
fBMStateStorage.get(), fBMStateStorage.size());
// Note : we allow the controller to return an empty (zero-dimension) result. Should we?
- if (NULL == fBMState || fBMState->pixmap().info().isEmpty()) {
+ if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) {
return false;
}
fPixmap = fBMState->pixmap();
@@ -174,10 +174,10 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
fAlphaScale = SkAlpha255To256(paint.getAlpha());
- fShaderProc32 = NULL;
- fShaderProc16 = NULL;
- fSampleProc32 = NULL;
- fSampleProc16 = NULL;
+ fShaderProc32 = nullptr;
+ fShaderProc16 = nullptr;
+ fSampleProc32 = nullptr;
+ fSampleProc16 = nullptr;
// recompute the triviality of the matrix here because we may have
// changed it!
@@ -201,8 +201,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
const SkPaint& paint) {
fMatrixProc = this->chooseMatrixProc(trivialMatrix);
- // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never returns NULL.
- if (NULL == fMatrixProc) {
+ // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never returns nullptr.
+ if (nullptr == fMatrixProc) {
return false;
}
@@ -338,11 +338,11 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
SI8_D16_filter_DX,
// Don't support 4444 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support A8 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support G8 -> 565 (but we could)
- NULL, NULL, NULL, NULL
+ nullptr, nullptr, nullptr, nullptr
};
#endif
@@ -364,7 +364,7 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc;
}
- if (NULL == fShaderProc32) {
+ if (nullptr == fShaderProc32) {
fShaderProc32 = this->chooseShaderProc32();
}
}
@@ -381,7 +381,7 @@ static void Clamp_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const int maxX = s.fPixmap.width() - 1;
@@ -455,7 +455,7 @@ static void Repeat_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const int stopX = s.fPixmap.width();
@@ -495,7 +495,7 @@ static void S32_D32_constX_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(1 == s.fPixmap.width());
int iY0;
@@ -633,7 +633,7 @@ bool SkBitmapProcState::setupForTranslate() {
SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
if (kN32_SkColorType != fPixmap.colorType()) {
- return NULL;
+ return nullptr;
}
static const unsigned kMask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
@@ -648,13 +648,13 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
}
if (fAlphaScale < 256) {
- return NULL;
+ return nullptr;
}
if (fInvType > SkMatrix::kTranslate_Mask) {
- return NULL;
+ return nullptr;
}
if (kNone_SkFilterQuality != fFilterLevel) {
- return NULL;
+ return nullptr;
}
SkShader::TileMode tx = (SkShader::TileMode)fTileModeX;
@@ -672,7 +672,7 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
}
return DoNothing_shaderproc;
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 57fd2731b5..814c79a92c 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -123,7 +123,7 @@ private:
ShaderProc32 fShaderProc32; // chooseProcs
ShaderProc16 fShaderProc16; // chooseProcs
- // These are used if the shaderproc is NULL
+ // These are used if the shaderproc is nullptr
MatrixProc fMatrixProc; // chooseProcs
SampleProc32 fSampleProc32; // chooseProcs
SampleProc16 fSampleProc16; // chooseProcs
diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h
index 5322a3605c..f70b758ac2 100644
--- a/src/core/SkBitmapProcState_sample.h
+++ b/src/core/SkBitmapProcState_sample.h
@@ -41,7 +41,7 @@ void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -83,7 +83,7 @@ void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -138,7 +138,7 @@ void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -184,7 +184,7 @@ void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
diff --git a/src/core/SkBitmapProcState_shaderproc.h b/src/core/SkBitmapProcState_shaderproc.h
index 2708b012b5..94b2d3b48c 100644
--- a/src/core/SkBitmapProcState_shaderproc.h
+++ b/src/core/SkBitmapProcState_shaderproc.h
@@ -20,7 +20,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, int x, int y,
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
SkMatrix::kScale_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index be7985732f..ff053a9a41 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -251,7 +251,7 @@ static SkBitmapScaler::ResizeMethod ResizeMethodToAlgorithmMethod(
bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeMethod method,
float destWidth, float destHeight,
SkBitmap::Allocator* allocator) {
- if (NULL == source.addr() || source.colorType() != kN32_SkColorType ||
+ if (nullptr == source.addr() || source.colorType() != kN32_SkColorType ||
source.width() < 1 || source.height() < 1)
{
return false;
@@ -263,7 +263,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeM
return false;
}
- SkConvolutionProcs convolveProcs= { 0, NULL, NULL, NULL, NULL };
+ SkConvolutionProcs convolveProcs= { 0, nullptr, nullptr, nullptr, nullptr };
PlatformConvolutionProcs(&convolveProcs);
SkRect destSubset = { 0, 0, destWidth, destHeight };
@@ -293,7 +293,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeM
result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
SkScalarCeilToInt(destSubset.height()),
source.alphaType()));
- result.allocPixels(allocator, NULL);
+ result.allocPixels(allocator, nullptr);
if (!result.readyToDraw()) {
return false;
}
diff --git a/src/core/SkBitmapScaler.h b/src/core/SkBitmapScaler.h
index c4c7f0ad0b..1b7eef5952 100644
--- a/src/core/SkBitmapScaler.h
+++ b/src/core/SkBitmapScaler.h
@@ -80,7 +80,7 @@ public:
};
static bool Resize(SkBitmap* result, const SkPixmap& src, ResizeMethod method,
- float dest_width, float dest_height, SkBitmap::Allocator* = NULL);
+ float dest_width, float dest_height, SkBitmap::Allocator* = nullptr);
/** Platforms can also optionally overwrite the convolution functions
if we have SIMD versions of them.
diff --git a/src/core/SkBlitMask.h b/src/core/SkBlitMask.h
index d39c094cb6..f36f9f3d82 100644
--- a/src/core/SkBlitMask.h
+++ b/src/core/SkBlitMask.h
@@ -54,7 +54,7 @@ public:
/**
* Return either platform specific optimized blitcolor BlitLCD16RowProc,
- * or NULL if no optimized routine is available.
+ * or nullptr if no optimized routine is available.
*/
static BlitLCD16RowProc PlatformBlitRowProcs16(bool isOpaque);
@@ -64,13 +64,13 @@ public:
/**
* Public entry-point to return a blitmask RowProc.
- * May return NULL if config or format are not supported.
+ * May return nullptr if config or format are not supported.
*/
static RowProc RowFactory(SkColorType, SkMask::Format, RowFlags);
/**
* Return either platform specific optimized blitmask RowProc,
- * or NULL if no optimized routine is available.
+ * or nullptr if no optimized routine is available.
*/
static RowProc PlatformRowProcs(SkColorType, SkMask::Format, RowFlags);
};
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index fb2991c919..3cc791af4e 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -31,10 +31,10 @@ static void D32_LCD16_Proc(void* SK_RESTRICT dst, size_t dstRB,
const uint16_t* srcRow = (const uint16_t*)mask;
SkPMColor opaqueDst;
- SkBlitMask::BlitLCD16RowProc proc = NULL;
+ SkBlitMask::BlitLCD16RowProc proc = nullptr;
bool isOpaque = (0xFF == SkColorGetA(color));
proc = SkBlitMask::BlitLCD16RowFactory(isOpaque);
- SkASSERT(proc != NULL);
+ SkASSERT(proc != nullptr);
if (isOpaque) {
opaqueDst = SkPreMultiplyColor(color);
@@ -283,8 +283,8 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
static const RowProc gProcs[] = {
// need X coordinate to handle BW
- false ? (RowProc)BW_RowProc_Blend : NULL, // suppress unused warning
- false ? (RowProc)BW_RowProc_Opaque : NULL, // suppress unused warning
+ false ? (RowProc)BW_RowProc_Blend : nullptr, // suppress unused warning
+ false ? (RowProc)BW_RowProc_Opaque : nullptr, // suppress unused warning
(RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque,
(RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque,
};
@@ -297,7 +297,7 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
case SkMask::kA8_Format: index = 2; break;
case SkMask::kLCD16_Format: index = 4; break;
default:
- return NULL;
+ return nullptr;
}
if (flags & kSrcIsOpaque_RowFlag) {
index |= 1;
@@ -307,5 +307,5 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
default:
break;
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBlitRow_D16.cpp b/src/core/SkBlitRow_D16.cpp
index 5aaa7a5805..9ac84c672d 100644
--- a/src/core/SkBlitRow_D16.cpp
+++ b/src/core/SkBlitRow_D16.cpp
@@ -246,7 +246,7 @@ SkBlitRow::Proc16 SkBlitRow::Factory16(unsigned flags) {
flags &= kFlags16_Mask;
SkBlitRow::Proc16 proc = PlatformFactory565(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_565_Procs[flags];
}
return proc;
@@ -274,7 +274,7 @@ SkBlitRow::ColorProc16 SkBlitRow::ColorFactory16(unsigned flags) {
SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs));
SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_565_ColorProcs[flags];
}
return proc;
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp
index 559ee18c5e..0f8cbe8104 100644
--- a/src/core/SkBlitRow_D32.cpp
+++ b/src/core/SkBlitRow_D32.cpp
@@ -124,7 +124,7 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) {
flags &= kFlags32_Mask;
SkBlitRow::Proc32 proc = PlatformProcs32(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_Procs32[flags];
}
SkASSERT(proc);
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 62cd73ee24..1bc9963eeb 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -29,11 +29,11 @@ bool SkBlitter::resetShaderContext(const SkShader::ContextRec&) {
}
SkShader::Context* SkBlitter::getShaderContext() const {
- return NULL;
+ return nullptr;
}
const SkPixmap* SkBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
void SkBlitter::blitH(int x, int y, int width) {
@@ -243,7 +243,7 @@ void SkNullBlitter::blitRect(int x, int y, int width, int height) {}
void SkNullBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {}
const SkPixmap* SkNullBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
bool SkNullBlitter::isNullBlitter() const { return true; }
@@ -553,7 +553,7 @@ SkBlitter* SkBlitterClipper::apply(SkBlitter* blitter, const SkRegion* clip,
if (clip->isEmpty() || (ir && !SkIRect::Intersects(clipR, *ir))) {
blitter = &fNullBlitter;
} else if (clip->isRect()) {
- if (ir == NULL || !clipR.contains(*ir)) {
+ if (ir == nullptr || !clipR.contains(*ir)) {
fRectBlitter.init(blitter, clipR);
blitter = &fRectBlitter;
}
@@ -589,12 +589,12 @@ public:
}
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
- SkShader::Context* proxyContext = NULL;
+ SkShader::Context* proxyContext = nullptr;
if (fProxy) {
char* proxyContextStorage = (char*) storage + sizeof(Sk3DShaderContext);
proxyContext = fProxy->createContext(rec, proxyContextStorage);
if (!proxyContext) {
- return NULL;
+ return nullptr;
}
}
return new (storage) Sk3DShaderContext(*this, rec, proxyContext);
@@ -606,7 +606,7 @@ public:
Sk3DShaderContext(const Sk3DShader& shader, const ContextRec& rec,
SkShader::Context* proxyContext)
: INHERITED(shader, rec)
- , fMask(NULL)
+ , fMask(nullptr)
, fProxyContext(proxyContext)
{
if (!fProxyContext) {
@@ -627,8 +627,8 @@ public:
fProxyContext->shadeSpan(x, y, span, count);
}
- if (fMask == NULL) {
- if (fProxyContext == NULL) {
+ if (fMask == nullptr) {
+ if (fProxyContext == nullptr) {
sk_memset32(span, fPMColor, count);
}
return;
@@ -761,7 +761,7 @@ public:
fProxy->blitMask(mask, clip);
((SkMask*)&mask)->fFormat = SkMask::k3D_Format;
- fShaderContext->set3DMask(NULL);
+ fShaderContext->set3DMask(nullptr);
} else {
fProxy->blitMask(mask, clip);
}
@@ -782,7 +782,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
const SkPaint& origPaint,
SkTBlitterAllocator* allocator,
bool drawCoverage) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
// which check, in case we're being called by a client with a dummy device
// (e.g. they have a bounder that always aborts the draw)
@@ -794,11 +794,11 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkShader* shader = origPaint.getShader();
SkColorFilter* cf = origPaint.getColorFilter();
SkXfermode* mode = origPaint.getXfermode();
- Sk3DShader* shader3D = NULL;
+ Sk3DShader* shader3D = nullptr;
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
- if (origPaint.getMaskFilter() != NULL &&
+ if (origPaint.getMaskFilter() != nullptr &&
origPaint.getMaskFilter()->getFormat() == SkMask::k3D_Format) {
shader3D = new Sk3DShader(shader);
// we know we haven't initialized lazyPaint yet, so just do it
@@ -810,8 +810,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
bool deviceIsOpaque = kRGB_565_SkColorType == device.colorType();
switch (SkInterpretXfermode(*paint, deviceIsOpaque)) {
case kSrcOver_SkXfermodeInterpretation:
- mode = NULL;
- paint.writable()->setXfermode(NULL);
+ mode = nullptr;
+ paint.writable()->setXfermode(nullptr);
break;
case kSkipDrawing_SkXfermodeInterpretation:{
return allocator->createT<SkNullBlitter>();
@@ -828,13 +828,13 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
*/
if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
SkPaint* p = paint.writable();
- shader = p->setShader(NULL);
- cf = p->setColorFilter(NULL);
+ shader = p->setShader(nullptr);
+ cf = p->setColorFilter(nullptr);
mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
p->setColor(0);
}
- if (NULL == shader) {
+ if (nullptr == shader) {
if (mode) {
// xfermodes (and filters) require shaders for our current blitters
shader = new SkColorShader(paint->getColor());
@@ -845,8 +845,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
// our color and move on.
SkPaint* writablePaint = paint.writable();
writablePaint->setColor(cf->filterColor(paint->getColor()));
- writablePaint->setColorFilter(NULL);
- cf = NULL;
+ writablePaint->setColorFilter(nullptr);
+ cf = nullptr;
}
}
@@ -861,9 +861,9 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
/*
* We create a SkShader::Context object, and store it on the blitter.
*/
- SkShader::Context* shaderContext = NULL;
+ SkShader::Context* shaderContext = nullptr;
if (shader) {
- SkShader::ContextRec rec(*paint, matrix, NULL);
+ SkShader::ContextRec rec(*paint, matrix, nullptr);
size_t contextSize = shader->contextSize();
if (contextSize) {
// Try to create the ShaderContext
@@ -880,12 +880,12 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
}
}
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
switch (device.colorType()) {
case kAlpha_8_SkColorType:
if (drawCoverage) {
- SkASSERT(NULL == shader);
- SkASSERT(NULL == paint->getXfermode());
+ SkASSERT(nullptr == shader);
+ SkASSERT(nullptr == paint->getXfermode());
blitter = allocator->createT<SkA8_Coverage_Blitter>(device, *paint);
} else if (shader) {
blitter = allocator->createT<SkA8_Shader_Blitter>(device, *paint, shaderContext);
@@ -933,7 +933,7 @@ class SkZeroShaderContext : public SkShader::Context {
public:
SkZeroShaderContext(const SkShader& shader, const SkShader::ContextRec& rec)
// Override rec with the identity matrix, so it is guaranteed to be invertible.
- : INHERITED(shader, SkShader::ContextRec(*rec.fPaint, SkMatrix::I(), NULL)) {}
+ : INHERITED(shader, SkShader::ContextRec(*rec.fPaint, SkMatrix::I(), nullptr)) {}
void shadeSpan(int x, int y, SkPMColor colors[], int count) override {
sk_bzero(colors, count * sizeof(SkPMColor));
@@ -967,7 +967,7 @@ bool SkShaderBlitter::resetShaderContext(const SkShader::ContextRec& rec) {
// shader to create it. It is therefore safe to re-use the storage.
fShaderContext->~Context();
SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
- if (NULL == ctx) {
+ if (nullptr == ctx) {
// Need a valid context in fShaderContext's storage, so we can later (or our caller) call
// the in-place destructor.
new (fShaderContext) SkZeroShaderContext(*fShader, rec);
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index baa9ccc39f..5740a5eaed 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -50,7 +50,7 @@ public:
virtual void blitMask(const SkMask&, const SkIRect& clip);
/** If the blitter just sets a single value for each pixel, return the
- bitmap it draws into, and assign value. If not, return NULL and ignore
+ bitmap it draws into, and assign value. If not, return nullptr and ignore
the value parameter.
*/
virtual const SkPixmap* justAnOpaqueColor(uint32_t* value);
@@ -109,7 +109,7 @@ public:
* This function allocates memory for the blitter that the blitter then owns.
* The memory can be used by the calling function at will, but it will be
* released when the blitter's destructor is called. This function returns
- * NULL if no persistent memory is needed by the blitter.
+ * nullptr if no persistent memory is needed by the blitter.
*/
virtual void* allocBlitMemory(size_t sz) {
return fBlitMemory.reset(sz, SkAutoMalloc::kReuse_OnShrink);
@@ -229,7 +229,7 @@ private:
class SkBlitterClipper {
public:
SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip,
- const SkIRect* bounds = NULL);
+ const SkIRect* bounds = nullptr);
private:
SkNullBlitter fNullBlitter;
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index ce7d6e7ad2..51748b00e9 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -21,7 +21,7 @@ const SkPixmap* SkA8_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = 255;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
void SkA8_Blitter::blitH(int x, int y, int width) {
@@ -231,7 +231,7 @@ SkA8_Shader_Blitter::SkA8_Shader_Blitter(const SkPixmap& device, const SkPaint&
SkShader::Context* shaderContext)
: INHERITED(device, paint, shaderContext)
{
- if ((fXfermode = paint.getXfermode()) != NULL) {
+ if ((fXfermode = paint.getXfermode()) != nullptr) {
fXfermode->ref();
SkASSERT(fShaderContext);
}
@@ -260,7 +260,7 @@ void SkA8_Shader_Blitter::blitH(int x, int y, int width) {
shaderContext->shadeSpan(x, y, span, width);
if (fXfermode) {
- fXfermode->xferA8(device, span, width, NULL);
+ fXfermode->xferA8(device, span, width, nullptr);
} else {
for (int i = width - 1; i >= 0; --i) {
unsigned srcA = SkGetPackedA32(span[i]);
@@ -298,7 +298,7 @@ void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
}
int aa = *antialias;
if (aa) {
- if (opaque && aa == 255 && mode == NULL) {
+ if (opaque && aa == 255 && mode == nullptr) {
memset(device, 0xFF, count);
} else {
shaderContext->shadeSpan(x, y, span, count);
@@ -355,9 +355,9 @@ void SkA8_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkPixmap& device,
const SkPaint& paint) : SkRasterBlitter(device) {
- SkASSERT(NULL == paint.getShader());
- SkASSERT(NULL == paint.getXfermode());
- SkASSERT(NULL == paint.getColorFilter());
+ SkASSERT(nullptr == paint.getShader());
+ SkASSERT(nullptr == paint.getXfermode());
+ SkASSERT(nullptr == paint.getColorFilter());
}
void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
@@ -430,5 +430,5 @@ void SkA8_Coverage_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
}
const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index 683acf0aae..e44ad02da5 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -59,7 +59,7 @@ const SkPixmap* SkARGB32_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = fPMColor;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
#if defined _WIN32 && _MSC_VER >= 1300 // disable warning : local variable used without having been initialized
@@ -338,7 +338,7 @@ SkARGB32_Shader_Blitter::SkARGB32_Shader_Blitter(const SkPixmap& device,
fProc32Blend = SkBlitRow::Factory32(flags | SkBlitRow::kGlobalAlpha_Flag32);
fShadeDirectlyIntoDevice = false;
- if (fXfermode == NULL) {
+ if (fXfermode == nullptr) {
if (shaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) {
fShadeDirectlyIntoDevice = true;
}
@@ -371,7 +371,7 @@ void SkARGB32_Shader_Blitter::blitH(int x, int y, int width) {
SkPMColor* span = fBuffer;
fShaderContext->shadeSpan(x, y, span, width);
if (fXfermode) {
- fXfermode->xfer32(device, span, width, NULL);
+ fXfermode->xfer32(device, span, width, nullptr);
} else {
fProc32(device, span, width, 255);
}
@@ -401,7 +401,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
SkXfermode* xfer = fXfermode;
if (xfer) {
do {
- xfer->xfer32(device, span, width, NULL);
+ xfer->xfer32(device, span, width, nullptr);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -438,7 +438,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
if (xfer) {
do {
shaderContext->shadeSpan(x, y, span, width);
- xfer->xfer32(device, span, width, NULL);
+ xfer->xfer32(device, span, width, nullptr);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -471,7 +471,7 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
if (aa) {
shaderContext->shadeSpan(x, y, span, count);
if (aa == 255) {
- xfer->xfer32(device, span, count, NULL);
+ xfer->xfer32(device, span, count, nullptr);
} else {
// count is almost always 1
for (int i = count - 1; i >= 0; --i) {
@@ -539,7 +539,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
SkASSERT(mask.fBounds.contains(clip));
SkShader::Context* shaderContext = fShaderContext;
- SkBlitMask::RowProc proc = NULL;
+ SkBlitMask::RowProc proc = nullptr;
if (!fXfermode) {
unsigned flags = 0;
if (shaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) {
@@ -547,7 +547,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
}
proc = SkBlitMask::RowFactory(kN32_SkColorType, mask.fFormat,
(SkBlitMask::RowFlags)flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
this->INHERITED::blitMask(mask, clip);
return;
}
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index d87c636590..06dfeea1c1 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -172,9 +172,9 @@ private:
#ifdef USE_BLACK_BLITTER
SkRGB16_Black_Blitter::SkRGB16_Black_Blitter(const SkPixmap& device, const SkPaint& paint)
: INHERITED(device, paint) {
- SkASSERT(paint.getShader() == NULL);
- SkASSERT(paint.getColorFilter() == NULL);
- SkASSERT(paint.getXfermode() == NULL);
+ SkASSERT(paint.getShader() == nullptr);
+ SkASSERT(paint.getColorFilter() == nullptr);
+ SkASSERT(paint.getXfermode() == nullptr);
SkASSERT(paint.getColor() == SK_ColorBLACK);
}
@@ -568,7 +568,7 @@ const SkPixmap* SkRGB16_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = fRawColor16;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
void SkRGB16_Blitter::blitH(int x, int y, int width) {
@@ -822,7 +822,7 @@ SkRGB16_Shader_Blitter::SkRGB16_Shader_Blitter(const SkPixmap& device,
SkShader::Context* shaderContext)
: INHERITED(device, paint, shaderContext)
{
- SkASSERT(paint.getXfermode() == NULL);
+ SkASSERT(paint.getXfermode() == nullptr);
fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * sizeof(SkPMColor));
@@ -970,7 +970,7 @@ void SkRGB16_Shader_Xfermode_Blitter::blitH(int x, int y, int width) {
SkPMColor* span = fBuffer;
fShaderContext->shadeSpan(x, y, span, width);
- fXfermode->xfer16(device, span, width, NULL);
+ fXfermode->xfer16(device, span, width, nullptr);
}
void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
@@ -1006,7 +1006,7 @@ void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
SkPMColor* localSpan = span;
for (;;) {
if (aa == 0xFF) {
- mode->xfer16(device, localSpan, count, NULL);
+ mode->xfer16(device, localSpan, count, nullptr);
} else {
SkASSERT(aa);
memset(aaExpand, aa, count);
@@ -1033,17 +1033,17 @@ void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
SkBlitter* SkBlitter_ChooseD565(const SkPixmap& device, const SkPaint& paint,
SkShader::Context* shaderContext,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
SkBlitter* blitter;
SkShader* shader = paint.getShader();
SkXfermode* mode = paint.getXfermode();
// we require a shader if there is an xfermode, handled by our caller
- SkASSERT(NULL == mode || shader);
+ SkASSERT(nullptr == mode || shader);
if (shader) {
- SkASSERT(shaderContext != NULL);
+ SkASSERT(shaderContext != nullptr);
if (mode) {
blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device, paint,
shaderContext);
diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp
index 6dc5785cec..605fa43bf6 100644
--- a/src/core/SkBlitter_Sprite.cpp
+++ b/src/core/SkBlitter_Sprite.cpp
@@ -51,7 +51,7 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
paint and return null if it is set, forcing the client to take the slow shader case
(which does respect soft edges).
*/
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
SkSpriteBlitter* blitter;
@@ -63,7 +63,7 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator);
break;
default:
- blitter = NULL;
+ blitter = nullptr;
break;
}
diff --git a/src/core/SkBuffer.cpp b/src/core/SkBuffer.cpp
index 51c368abe8..86c3bed3f1 100644
--- a/src/core/SkBuffer.cpp
+++ b/src/core/SkBuffer.cpp
@@ -22,7 +22,7 @@ void SkRBuffer::readNoSizeCheck(void* buffer, size_t size)
const void* SkRBuffer::skip(size_t size)
{
const void* result = fPos;
- readNoSizeCheck(NULL, size);
+ readNoSizeCheck(nullptr, size);
return result;
}
@@ -45,8 +45,8 @@ bool SkRBufferWithSizeCheck::read(void* buffer, size_t size) {
void* SkWBuffer::skip(size_t size)
{
void* result = fPos;
- writeNoSizeCheck(NULL, size);
- return fData == NULL ? NULL : result;
+ writeNoSizeCheck(nullptr, size);
+ return fData == nullptr ? nullptr : result;
}
void SkWBuffer::writeNoSizeCheck(const void* buffer, size_t size)
diff --git a/src/core/SkCachedData.cpp b/src/core/SkCachedData.cpp
index 439c2ffe05..cfa4c6165f 100644
--- a/src/core/SkCachedData.cpp
+++ b/src/core/SkCachedData.cpp
@@ -151,7 +151,7 @@ void SkCachedData::inMutexLock() {
SkASSERT(ptr);
this->setData(ptr);
} else {
- this->setData(NULL); // signal failure to lock, contents are gone
+ this->setData(nullptr); // signal failure to lock, contents are gone
}
break;
}
@@ -173,7 +173,7 @@ void SkCachedData::inMutexUnlock() {
}
break;
}
- this->setData(NULL); // signal that we're in an unlocked state
+ this->setData(nullptr); // signal that we're in an unlocked state
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -192,7 +192,7 @@ void SkCachedData::validate() const {
}
} else {
SkASSERT((fInCache && 1 == fRefCnt) || (0 == fRefCnt));
- SkASSERT(NULL == fData);
+ SkASSERT(nullptr == fData);
}
}
#endif
diff --git a/src/core/SkCachedData.h b/src/core/SkCachedData.h
index d44fbc5895..739be72182 100644
--- a/src/core/SkCachedData.h
+++ b/src/core/SkCachedData.h
@@ -36,7 +36,7 @@ public:
}
protected:
- // called when fData changes. could be NULL.
+ // called when fData changes. could be nullptr.
virtual void onDataChange(void* oldData, void* newData) {}
private:
@@ -93,7 +93,7 @@ public:
* ref's the data (typically from a find(key, visitor) call).
*
* Thus the data will always be "locked" when a non-cache has a ref on it (whether or not
- * the lock succeeded to recover the memory -- check data() to see if it is NULL).
+ * the lock succeeded to recover the memory -- check data() to see if it is nullptr).
*/
/*
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 03c5173e10..7043ec3bc3 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -194,16 +194,16 @@ struct DeviceCM {
DeviceCM(SkBaseDevice* device, const SkPaint* paint, SkCanvas* canvas,
bool conservativeRasterClip, bool deviceIsBitmapDevice)
- : fNext(NULL)
+ : fNext(nullptr)
, fClip(conservativeRasterClip)
, fDeviceIsBitmapDevice(deviceIsBitmapDevice)
{
- if (NULL != device) {
+ if (nullptr != device) {
device->ref();
device->onAttachToCanvas(canvas);
}
fDevice = device;
- fPaint = paint ? new SkPaint(*paint) : NULL;
+ fPaint = paint ? new SkPaint(*paint) : nullptr;
}
~DeviceCM() {
@@ -284,9 +284,9 @@ public:
int fDeferredSaveCount;
MCRec(bool conservativeRasterClip) : fRasterClip(conservativeRasterClip) {
- fFilter = NULL;
- fLayer = NULL;
- fTopLayer = NULL;
+ fFilter = nullptr;
+ fLayer = nullptr;
+ fTopLayer = nullptr;
fMatrix.reset();
fDeferredSaveCount = 0;
@@ -295,7 +295,7 @@ public:
}
MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix) {
fFilter = SkSafeRef(prev.fFilter);
- fLayer = NULL;
+ fLayer = nullptr;
fTopLayer = prev.fTopLayer;
fDeferredSaveCount = 0;
@@ -346,13 +346,13 @@ public:
fRC = &rec->fClip;
fDevice = rec->fDevice;
if (!fDevice->accessPixels(&fDst)) {
- fDst.reset(fDevice->imageInfo(), NULL, 0);
+ fDst.reset(fDevice->imageInfo(), nullptr, 0);
}
fPaint = rec->fPaint;
SkDEBUGCODE(this->validate();)
fCurrLayer = rec->fNext;
- // fCurrLayer may be NULL now
+ // fCurrLayer may be nullptr now
return true;
}
@@ -383,21 +383,21 @@ static SkPaint* set_if_needed(SkLazyPaint* lazy, const SkPaint& orig) {
/**
* If the paint has an imagefilter, but it can be simplified to just a colorfilter, return that
- * colorfilter, else return NULL.
+ * colorfilter, else return nullptr.
*/
static SkColorFilter* image_to_color_filter(const SkPaint& paint) {
SkImageFilter* imgf = paint.getImageFilter();
if (!imgf) {
- return NULL;
+ return nullptr;
}
SkColorFilter* imgCF;
if (!imgf->asAColorFilter(&imgCF)) {
- return NULL;
+ return nullptr;
}
SkColorFilter* paintCF = paint.getColorFilter();
- if (NULL == paintCF) {
+ if (nullptr == paintCF) {
// there is no existing paint colorfilter, so we can just return the imagefilter's
return imgCF;
}
@@ -412,7 +412,7 @@ class AutoDrawLooper {
public:
AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint,
bool skipLayerForImageFilter = false,
- const SkRect* bounds = NULL) : fOrigPaint(paint) {
+ const SkRect* bounds = nullptr) : fOrigPaint(paint) {
fCanvas = canvas;
fFilter = canvas->getDrawFilter();
fPaint = &fOrigPaint;
@@ -424,7 +424,7 @@ public:
if (simplifiedCF) {
SkPaint* paint = set_if_needed(&fLazyPaintInit, fOrigPaint);
paint->setColorFilter(simplifiedCF)->unref();
- paint->setImageFilter(NULL);
+ paint->setImageFilter(nullptr);
fPaint = paint;
}
@@ -459,7 +459,7 @@ public:
fLooperContext = looper->createContext(canvas, buffer);
fIsSimple = false;
} else {
- fLooperContext = NULL;
+ fLooperContext = nullptr;
// can we be marked as simple?
fIsSimple = !fFilter && !fTempLayerForImageFilter;
}
@@ -516,7 +516,7 @@ private:
};
bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
- fPaint = NULL;
+ fPaint = nullptr;
SkASSERT(!fIsSimple);
SkASSERT(fLooperContext || fFilter || fTempLayerForImageFilter);
@@ -525,8 +525,8 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
paint->setFlags(fNewPaintFlags);
if (fTempLayerForImageFilter) {
- paint->setImageFilter(NULL);
- paint->setXfermode(NULL);
+ paint->setImageFilter(nullptr);
+ paint->setXfermode(nullptr);
}
if (fLooperContext && !fLooperContext->next(fCanvas, paint)) {
@@ -538,7 +538,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
fDone = true;
return false;
}
- if (NULL == fLooperContext) {
+ if (nullptr == fLooperContext) {
// no looper means we only draw once
fDone = true;
}
@@ -552,7 +552,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
// call this after any possible paint modifiers
if (fPaint->nothingToDraw()) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
return true;
@@ -602,7 +602,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
fAllowSimplifyClip = false;
fDeviceCMDirty = true;
fSaveCount = 1;
- fMetaData = NULL;
+ fMetaData = nullptr;
fClipStack.reset(new SkClipStack);
@@ -611,11 +611,11 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
SkASSERT(sizeof(DeviceCM) <= sizeof(fDeviceCMStorage));
fMCRec->fLayer = (DeviceCM*)fDeviceCMStorage;
- new (fDeviceCMStorage) DeviceCM(NULL, NULL, NULL, fConservativeRasterClip, false);
+ new (fDeviceCMStorage) DeviceCM(nullptr, nullptr, nullptr, fConservativeRasterClip, false);
fMCRec->fTopLayer = fMCRec->fLayer;
- fSurfaceBase = NULL;
+ fSurfaceBase = nullptr;
if (device) {
// The root device and the canvas should always have the same pixel geometry
@@ -636,7 +636,7 @@ SkCanvas::SkCanvas()
{
inc_canvas();
- this->init(NULL, kDefault_InitFlags);
+ this->init(nullptr, kDefault_InitFlags);
}
static SkBitmap make_nopixels(int width, int height) {
@@ -739,7 +739,7 @@ SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
SkMetaData& SkCanvas::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
- if (NULL == fMetaData) {
+ if (nullptr == fMetaData) {
fMetaData = new SkMetaData;
}
return *fMetaData;
@@ -789,7 +789,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
}
bool weAllocated = false;
- if (NULL == bitmap->pixelRef()) {
+ if (nullptr == bitmap->pixelRef()) {
if (!bitmap->tryAllocPixels()) {
return false;
}
@@ -805,7 +805,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
}
if (weAllocated) {
- bitmap->setPixelRef(NULL);
+ bitmap->setPixelRef(nullptr);
}
return false;
}
@@ -867,7 +867,7 @@ bool SkCanvas::writePixels(const SkImageInfo& origInfo, const void* pixels, size
default:
break;
}
- if (NULL == pixels || rowBytes < origInfo.minRowBytes()) {
+ if (nullptr == pixels || rowBytes < origInfo.minRowBytes()) {
return false;
}
@@ -915,13 +915,13 @@ void SkCanvas::updateDeviceCMCache() {
const SkRasterClip& totalClip = fMCRec->fRasterClip;
DeviceCM* layer = fMCRec->fTopLayer;
- if (NULL == layer->fNext) { // only one layer
- layer->updateMC(totalMatrix, totalClip, *fClipStack, NULL);
+ if (nullptr == layer->fNext) { // only one layer
+ layer->updateMC(totalMatrix, totalClip, *fClipStack, nullptr);
} else {
SkRasterClip clip(totalClip);
do {
layer->updateMC(totalMatrix, clip, *fClipStack, &clip);
- } while ((layer = layer->fNext) != NULL);
+ } while ((layer = layer->fNext) != nullptr);
}
fDeviceCMDirty = false;
}
@@ -1056,7 +1056,7 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
if (gIgnoreSaveLayerBounds) {
- bounds = NULL;
+ bounds = nullptr;
}
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag);
fSaveCount += 1;
@@ -1066,7 +1066,7 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) {
if (gIgnoreSaveLayerBounds) {
- bounds = NULL;
+ bounds = nullptr;
}
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
fSaveCount += 1;
@@ -1087,7 +1087,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
fDeviceCMDirty = true;
SkIRect ir;
- if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : NULL)) {
+ if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : nullptr)) {
return;
}
@@ -1110,7 +1110,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
SkBaseDevice* device = this->getTopDevice();
- if (NULL == device) {
+ if (nullptr == device) {
SkDebugf("Unable to find device for layer.");
return;
}
@@ -1120,11 +1120,11 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo);
SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint);
- if (NULL == newDev) {
+ if (nullptr == newDev) {
// If onCreateDevice didn't succeed, try raster (e.g. PDF couldn't handle the paint)
const SkSurfaceProps surfaceProps(fProps.flags(), createInfo.fPixelGeometry);
newDev = SkBitmapDevice::Create(createInfo.fInfo, surfaceProps);
- if (NULL == newDev) {
+ if (nullptr == newDev) {
SkErrorInternals::SetError(kInternalError_SkError,
"Unable to create device for layer.");
return;
@@ -1151,7 +1151,7 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
SaveFlags flags) {
if (0xFF == alpha) {
- return this->saveLayer(bounds, NULL, flags);
+ return this->saveLayer(bounds, nullptr, flags);
} else {
SkPaint tmpPaint;
tmpPaint.setAlpha(alpha);
@@ -1170,7 +1170,7 @@ void SkCanvas::internalRestore() {
// reserve our layer (if any)
DeviceCM* layer = fMCRec->fLayer; // may be null
// now detach it from fMCRec so we can pop(). Gets freed after its drawn
- fMCRec->fLayer = NULL;
+ fMCRec->fLayer = nullptr;
// now do the normal restore()
fMCRec->~MCRec(); // balanced in save()
@@ -1198,7 +1198,7 @@ void SkCanvas::internalRestore() {
}
SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) {
- if (NULL == props) {
+ if (nullptr == props) {
props = &fProps;
}
return this->onNewSurface(info, *props);
@@ -1206,7 +1206,7 @@ SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
SkBaseDevice* dev = this->getDevice();
- return dev ? dev->newSurface(info, props) : NULL;
+ return dev ? dev->newSurface(info, props) : nullptr;
}
SkImageInfo SkCanvas::imageInfo() const {
@@ -1221,7 +1221,7 @@ SkImageInfo SkCanvas::imageInfo() const {
const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) {
SkPixmap pmap;
if (!this->onPeekPixels(&pmap)) {
- return NULL;
+ return nullptr;
}
if (info) {
*info = pmap.info();
@@ -1240,7 +1240,7 @@ bool SkCanvas::onPeekPixels(SkPixmap* pmap) {
void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin) {
SkPixmap pmap;
if (!this->onAccessTopLayerPixels(&pmap)) {
- return NULL;
+ return nullptr;
}
if (info) {
*info = pmap.info();
@@ -1261,13 +1261,13 @@ bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) {
fAddr = canvas->peekPixels(&fInfo, &fRowBytes);
- if (NULL == fAddr) {
+ if (nullptr == fAddr) {
fInfo = canvas->imageInfo();
if (kUnknown_SkColorType == fInfo.colorType() || !fBitmap.tryAllocPixels(fInfo)) {
- return; // failure, fAddr is NULL
+ return; // failure, fAddr is nullptr
}
if (!canvas->readPixels(&fBitmap, 0, 0)) {
- return; // failure, fAddr is NULL
+ return; // failure, fAddr is nullptr
}
fAddr = fBitmap.getPixels();
fRowBytes = fBitmap.rowBytes();
@@ -1292,14 +1292,14 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
SkDEBUGCODE(bitmap.validate();)
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint && paint->canComputeFastBounds()) {
bitmap.getBounds(&storage);
matrix.mapRect(&storage);
@@ -1318,7 +1318,7 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
const SkPaint* paint, bool deviceIsBitmapDevice) {
SkPaint tmp;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &tmp;
}
@@ -1340,7 +1340,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
- tmpUnfiltered.setImageFilter(NULL);
+ tmpUnfiltered.setImageFilter(nullptr);
dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + offset.y(),
tmpUnfiltered);
}
@@ -1370,7 +1370,7 @@ void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint*
SkDEBUGCODE(bitmap.validate();)
SkPaint tmp;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &tmp;
}
@@ -1391,7 +1391,7 @@ void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint*
SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
- tmpUnfiltered.setImageFilter(NULL);
+ tmpUnfiltered.setImageFilter(nullptr);
iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + offset.y(),
tmpUnfiltered);
}
@@ -1648,7 +1648,7 @@ void SkCanvas::validateClip() const {
SkClipStack::B2TIter iter(*fClipStack);
const SkClipStack::Element* element;
- while ((element = iter.next()) != NULL) {
+ while ((element = iter.next()) != nullptr) {
switch (element->getType()) {
case SkClipStack::Element::kRect_Type:
element->getRect().round(&ir);
@@ -1672,7 +1672,7 @@ void SkCanvas::replayClips(ClipVisitor* visitor) const {
SkClipStack::B2TIter iter(*fClipStack);
const SkClipStack::Element* element;
- while ((element = iter.next()) != NULL) {
+ while ((element = iter.next()) != nullptr) {
element->replay(visitor);
}
}
@@ -1770,7 +1770,7 @@ const SkRegion& SkCanvas::internal_private_getTotalClip() const {
GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() {
SkBaseDevice* dev = this->getTopDevice();
- return dev ? dev->accessRenderTarget() : NULL;
+ return dev ? dev->accessRenderTarget() : nullptr;
}
GrContext* SkCanvas::getGrContext() {
@@ -1784,7 +1784,7 @@ GrContext* SkCanvas::getGrContext() {
}
#endif
- return NULL;
+ return nullptr;
}
@@ -1967,7 +1967,7 @@ void SkCanvas::onDrawPaint(const SkPaint& paint) {
}
void SkCanvas::internalDrawPaint(const SkPaint& paint) {
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, NULL, false)
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, nullptr, false)
while (iter.next()) {
iter.fDevice->drawPaint(iter, looper.paint());
@@ -1984,7 +1984,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
SkRect r, storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
// special-case 2 points (common for drawing a single line)
if (2 == count) {
@@ -1998,7 +1998,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
}
- SkASSERT(pts != NULL);
+ SkASSERT(pts != nullptr);
LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds)
@@ -2012,7 +2012,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
// Skia will draw an inverted rect, because it explicitly "sorts" it downstream.
// To prevent accidental rejecting at this stage, we have to sort it before we check.
@@ -2037,7 +2037,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(oval, &storage);
if (this->quickReject(*bounds)) {
@@ -2057,7 +2057,7 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(rrect.getBounds(), &storage);
if (this->quickReject(*bounds)) {
@@ -2087,7 +2087,7 @@ void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
const SkPaint& paint) {
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(outer.getBounds(), &storage);
if (this->quickReject(*bounds)) {
@@ -2111,7 +2111,7 @@ void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
}
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (!path.isInverseFillType() && paint.canComputeFastBounds()) {
const SkRect& pathBounds = path.getBounds();
bounds = &paint.computeFastBounds(pathBounds, &storage);
@@ -2141,7 +2141,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
SkRect bounds = SkRect::MakeXYWH(x, y,
SkIntToScalar(image->width()), SkIntToScalar(image->height()));
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
paint->computeFastBounds(bounds, &bounds);
}
@@ -2151,7 +2151,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2169,7 +2169,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2178,7 +2178,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
}
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2196,7 +2196,7 @@ void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
SkDEBUGCODE(bitmap.validate();)
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
SkRect bounds = {
x, y,
x + SkIntToScalar(bitmap.width()),
@@ -2225,7 +2225,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2235,7 +2235,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2262,7 +2262,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2272,7 +2272,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2292,7 +2292,7 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2302,7 +2302,7 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2349,12 +2349,12 @@ void SkCanvas::DrawRect(const SkDraw& draw, const SkPaint& paint,
void SkCanvas::DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0 ||
+ if (text == nullptr || byteLength == 0 ||
draw.fClip->isEmpty() ||
- (paint.getAlpha() == 0 && paint.getXfermode() == NULL)) {
+ (paint.getAlpha() == 0 && paint.getXfermode() == nullptr)) {
return;
}
@@ -2409,7 +2409,7 @@ void SkCanvas::DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2425,7 +2425,7 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
const SkPaint& paint) {
SkPoint textOffset = SkPoint::Make(0, 0);
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2441,7 +2441,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
SkPoint textOffset = SkPoint::Make(0, constY);
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2454,7 +2454,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawTextOnPath(iter, text, byteLength, path,
@@ -2468,7 +2468,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
storage = blob->bounds().makeOffset(x, y);
bounds = &paint.computeFastBounds(storage, &storage);
@@ -2481,7 +2481,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
// We cannot filter in the looper as we normally do, because the paint is
// incomplete at this point (text-related attributes are embedded within blob run paints).
SkDrawFilter* drawFilter = fMCRec->fFilter;
- fMCRec->fFilter = NULL;
+ fMCRec->fFilter = nullptr;
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
@@ -2530,7 +2530,7 @@ void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()");
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs,
@@ -2544,7 +2544,7 @@ void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPatch()");
- if (NULL == cubics) {
+ if (nullptr == cubics) {
return;
}
@@ -2562,7 +2562,7 @@ void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawPatch(iter, cubics, colors, texCoords, xmode, paint);
@@ -2577,7 +2577,7 @@ void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) {
SkMatrix matrix = SkMatrix::MakeTrans(x, y);
this->onDrawDrawable(dr, &matrix);
} else {
- this->onDrawDrawable(dr, NULL);
+ this->onDrawDrawable(dr, nullptr);
}
}
}
@@ -2585,7 +2585,7 @@ void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) {
void SkCanvas::drawDrawable(SkDrawable* dr, const SkMatrix* matrix) {
if (dr) {
if (matrix && matrix->isIdentity()) {
- matrix = NULL;
+ matrix = nullptr;
}
this->onDrawDrawable(dr, matrix);
}
@@ -2614,7 +2614,7 @@ void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const
pnt = *paint;
}
- LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pnt);
}
@@ -2761,7 +2761,7 @@ void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPicture()");
if (picture) {
if (matrix && matrix->isIdentity()) {
- matrix = NULL;
+ matrix = nullptr;
}
if (picture->approximateOpCount() <= kMaxPictureOpsToUnrollInsteadOfRef) {
SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
@@ -2830,7 +2830,7 @@ const SkMatrix& SkCanvas::LayerIter::matrix() const {
const SkPaint& SkCanvas::LayerIter::paint() const {
const SkPaint* paint = fImpl->getPaint();
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &fDefaultPaint;
}
return *paint;
@@ -2869,12 +2869,12 @@ static bool supported_for_raster_canvas(const SkImageInfo& info) {
SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes) {
if (!supported_for_raster_canvas(info)) {
- return NULL;
+ return nullptr;
}
SkBitmap bitmap;
if (!bitmap.installPixels(info, pixels, rowBytes)) {
- return NULL;
+ return nullptr;
}
return new SkCanvas(bitmap);
}
diff --git a/src/core/SkChunkAlloc.cpp b/src/core/SkChunkAlloc.cpp
index 4a71c2d2c4..3f30276f1b 100644
--- a/src/core/SkChunkAlloc.cpp
+++ b/src/core/SkChunkAlloc.cpp
@@ -30,7 +30,7 @@ struct SkChunkAlloc::Block {
}
void reset() {
- fNext = NULL;
+ fNext = nullptr;
fFreeSize = this->blockSize();
fFreePtr = this->startOfData();
}
@@ -60,7 +60,7 @@ SkChunkAlloc::SkChunkAlloc(size_t minSize) {
minSize = MIN_CHUNKALLOC_BLOCK_SIZE;
}
- fBlock = NULL;
+ fBlock = nullptr;
fMinSize = minSize;
fChunkSize = fMinSize;
fTotalCapacity = 0;
@@ -75,7 +75,7 @@ SkChunkAlloc::~SkChunkAlloc() {
void SkChunkAlloc::reset() {
Block::FreeChain(fBlock);
- fBlock = NULL;
+ fBlock = nullptr;
fChunkSize = fMinSize; // reset to our initial minSize
fTotalCapacity = 0;
fTotalUsed = 0;
@@ -142,7 +142,7 @@ SkChunkAlloc::Block* SkChunkAlloc::addBlockIfNecessary(size_t bytes, AllocFailTy
if (!fBlock || bytes > fBlock->fFreeSize) {
Block* block = this->newBlock(bytes, ftype);
if (!block) {
- return NULL;
+ return nullptr;
}
#ifdef SK_DEBUG
if (fBlock) {
@@ -164,7 +164,7 @@ void* SkChunkAlloc::alloc(size_t bytes, AllocFailType ftype) {
Block* block = this->addBlockIfNecessary(bytes, ftype);
if (!block) {
- return NULL;
+ return nullptr;
}
char* ptr = block->fFreePtr;
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 9541cc613f..f54d57fd0b 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -395,7 +395,7 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) {
fFiniteBoundType = kNormal_BoundsType;
if (SkRegion::kReplace_Op == fOp ||
- (SkRegion::kIntersect_Op == fOp && NULL == prior) ||
+ (SkRegion::kIntersect_Op == fOp && nullptr == prior) ||
(SkRegion::kIntersect_Op == fOp && prior->fIsIntersectionOfRects &&
prior->rectRectIntersectAllowed(this->getRect(), fDoAA))) {
fIsIntersectionOfRects = true;
@@ -431,7 +431,7 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) {
SkRect prevFinite;
SkClipStack::BoundsType prevType;
- if (NULL == prior) {
+ if (nullptr == prior) {
// no prior clip means the entire plane is writable
prevFinite.setEmpty(); // there are no pixels that cannot be drawn to
prevType = kInsideOut_BoundsType;
@@ -529,7 +529,7 @@ SkClipStack& SkClipStack::operator=(const SkClipStack& b) {
fSaveCount = b.fSaveCount;
SkDeque::F2BIter recIter(b.fDeque);
for (const Element* element = (const Element*)recIter.next();
- element != NULL;
+ element != nullptr;
element = (const Element*)recIter.next()) {
new (fDeque.push_back()) Element(*element);
}
@@ -550,14 +550,14 @@ bool SkClipStack::operator==(const SkClipStack& b) const {
const Element* myElement = (const Element*)myIter.next();
const Element* bElement = (const Element*)bIter.next();
- while (myElement != NULL && bElement != NULL) {
+ while (myElement != nullptr && bElement != nullptr) {
if (*myElement != *bElement) {
return false;
}
myElement = (const Element*)myIter.next();
bElement = (const Element*)bIter.next();
}
- return myElement == NULL && bElement == NULL;
+ return myElement == nullptr && bElement == nullptr;
}
void SkClipStack::reset() {
@@ -599,7 +599,7 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound,
Element* element = (Element*)fDeque.back();
- if (NULL == element) {
+ if (nullptr == element) {
// the clip is wide open - the infinite plane w/ no pixels un-writeable
canvFiniteBound->setEmpty();
*boundType = kInsideOut_BoundsType;
@@ -620,7 +620,7 @@ bool SkClipStack::quickContains(const SkRect& rect) const {
Iter iter(*this, Iter::kTop_IterStart);
const Element* element = iter.prev();
- while (element != NULL) {
+ while (element != nullptr) {
if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
return false;
if (element->isInverseFilled()) {
@@ -747,7 +747,7 @@ bool SkClipStack::isWideOpen() const {
///////////////////////////////////////////////////////////////////////////////
-SkClipStack::Iter::Iter() : fStack(NULL) {
+SkClipStack::Iter::Iter() : fStack(nullptr) {
}
SkClipStack::Iter::Iter(const SkClipStack& stack, IterStart startLoc)
@@ -765,13 +765,13 @@ const SkClipStack::Element* SkClipStack::Iter::prev() {
const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
- if (NULL == fStack) {
- return NULL;
+ if (nullptr == fStack) {
+ return nullptr;
}
fIter.reset(fStack->fDeque, SkDeque::Iter::kBack_IterStart);
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
for (element = (const SkClipStack::Element*) fIter.prev();
element;
@@ -784,7 +784,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
// return on the next "next" or "prev" call) the element
// in front of it in the deque. Bump the iterator forward a
// step so we get the expected result.
- if (NULL == fIter.next()) {
+ if (nullptr == fIter.next()) {
// The reverse iterator has run off the front of the deque
// (i.e., the "op" clip is the first clip) and can't
// recover. Reset the iterator to start at the front.
@@ -794,7 +794,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
}
}
- if (NULL == element) {
+ if (nullptr == element) {
// There were no "op" clips
fIter.reset(fStack->fDeque, SkDeque::Iter::kFront_IterStart);
}
@@ -899,7 +899,7 @@ void SkClipStack::Element::dump() const {
SkDebugf("\n");
break;
case kPath_Type:
- this->getPath().dump(NULL, true, false);
+ this->getPath().dump(nullptr, true, false);
break;
}
}
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index e1670b8e73..c67869fd65 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -130,7 +130,7 @@ SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorF
int count = inner->privateComposedFilterCount() + outer->privateComposedFilterCount();
if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
- return NULL;
+ return nullptr;
}
return new SkComposeColorFilter(outer, inner, count);
}
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 5a4e0a44e2..13c4795c3f 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -76,7 +76,7 @@ SkColorTable::SkColorTable(SkReadBuffer& buffer) {
SkDEBUGCODE(success =) buffer.readColorArray(fColors, fCount);
} else {
fCount = 0;
- fColors = NULL;
+ fColors = nullptr;
}
#ifdef SK_DEBUG
SkASSERT((unsigned)fCount <= 256);
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp
index 094dfdbc3d..853e157721 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -58,7 +58,7 @@ SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) {
SkAutoTUnref<SkShader> shaderB(buffer.readShader());
SkAutoTUnref<SkXfermode> mode(buffer.readXfermode());
if (!shaderA.get() || !shaderB.get()) {
- return NULL;
+ return nullptr;
}
return new SkComposeShader(shaderA, shaderB, mode);
}
@@ -99,7 +99,7 @@ SkShader::Context* SkComposeShader::onCreateContext(const ContextRec& rec, void*
if (!contextA || !contextB) {
safe_call_destructor(contextA);
safe_call_destructor(contextB);
- return NULL;
+ return nullptr;
}
return new (storage) ComposeShaderContext(*this, rec, contextA, contextB);
@@ -143,7 +143,7 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
SkPMColor tmp[TMP_COLOR_COUNT];
- if (NULL == mode) { // implied SRC_OVER
+ if (nullptr == mode) { // implied SRC_OVER
// TODO: when we have a good test-case, should use SkBlitRow::Proc32
// for these loops
do {
@@ -179,7 +179,7 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
shaderContextA->shadeSpan(x, y, result, n);
shaderContextB->shadeSpan(x, y, tmp, n);
- mode->xfer32(result, tmp, n, NULL);
+ mode->xfer32(result, tmp, n, nullptr);
if (256 != scale) {
for (int i = 0; i < n; i++) {
diff --git a/src/core/SkConfig8888.cpp b/src/core/SkConfig8888.cpp
index f49ab45c67..53f35c3737 100644
--- a/src/core/SkConfig8888.cpp
+++ b/src/core/SkConfig8888.cpp
@@ -237,9 +237,9 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
return false;
}
- const SkPMColor* table = NULL;
+ const SkPMColor* table = nullptr;
if (kIndex_8_SkColorType == srcInfo.colorType()) {
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
table = ctable->readColors();
@@ -276,11 +276,11 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
// TODO: switch the allocation of tmpDst to call sk_calloc_throw
{
SkBitmap bm;
- if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctable, NULL, NULL)) {
+ if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctable, nullptr, nullptr)) {
return false;
}
SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterDirect(dstInfo, dstPixels, dstRB));
- if (NULL == canvas.get()) {
+ if (nullptr == canvas.get()) {
return false;
}
diff --git a/src/core/SkConfig8888.h b/src/core/SkConfig8888.h
index 954f2b5387..ff287267aa 100644
--- a/src/core/SkConfig8888.h
+++ b/src/core/SkConfig8888.h
@@ -19,7 +19,7 @@ struct SkPixelInfo {
static bool CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRowBytes,
- SkColorTable* srcCTable = NULL);
+ SkColorTable* srcCTable = nullptr);
};
struct SkDstPixelInfo : SkPixelInfo {
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index bf00956b3a..3a088aa034 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -352,7 +352,7 @@ const SkConvolutionFilter1D::ConvolutionFixed* SkConvolutionFilter1D::GetSingleF
*filterLength = filter.fTrimmedLength;
*specifiedFilterlength = filter.fLength;
if (filter.fTrimmedLength == 0) {
- return NULL;
+ return nullptr;
}
return &fFilterValues[filter.fDataLocation];
diff --git a/src/core/SkConvolver.h b/src/core/SkConvolver.h
index 4beb7550f7..4e4d80692f 100644
--- a/src/core/SkConvolver.h
+++ b/src/core/SkConvolver.h
@@ -91,7 +91,7 @@ public:
*filterOffset = filter.fOffset;
*filterLength = filter.fTrimmedLength;
if (filter.fTrimmedLength == 0) {
- return NULL;
+ return nullptr;
}
return &fFilterValues[filter.fDataLocation];
}
@@ -102,7 +102,7 @@ public:
// |specifiedFilterLength| may be different if leading/trailing zeros of the
// original floating point form were clipped.
// There will be |filterLength| values in the return array.
- // Returns NULL if the filter is 0-length (for instance when all floating
+ // Returns nullptr if the filter is 0-length (for instance when all floating
// point values passed to AddFilter were clipped to 0).
SK_API const ConvolutionFixed* GetSingleFilter(int* specifiedFilterLength,
int* filterOffset,
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 4590e3bafe..9e65d2a32e 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -26,8 +26,8 @@ SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context) {
SkData::SkData(size_t size) {
fPtr = (char*)(this + 1); // contents are immediately after this
fSize = size;
- fReleaseProc = NULL;
- fReleaseProcContext = NULL;
+ fReleaseProc = nullptr;
+ fReleaseProcContext = nullptr;
}
SkData::~SkData() {
@@ -37,7 +37,7 @@ SkData::~SkData() {
}
bool SkData::equals(const SkData* other) const {
- if (NULL == other) {
+ if (nullptr == other) {
return false;
}
@@ -81,7 +81,7 @@ SkData* SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) {
///////////////////////////////////////////////////////////////////////////////
// As a template argument these must have external linkage.
-SkData* sk_new_empty_data() { return new SkData(NULL, 0, NULL, NULL); }
+SkData* sk_new_empty_data() { return new SkData(nullptr, 0, nullptr, nullptr); }
namespace { void sk_unref_data(SkData* ptr) { return SkSafeUnref(ptr); } }
SK_DECLARE_STATIC_LAZY_PTR(SkData, empty, sk_new_empty_data, sk_unref_data);
@@ -96,7 +96,7 @@ static void sk_free_releaseproc(const void* ptr, void*) {
}
SkData* SkData::NewFromMalloc(const void* data, size_t length) {
- return new SkData(data, length, sk_free_releaseproc, NULL);
+ return new SkData(data, length, sk_free_releaseproc, nullptr);
}
SkData* SkData::NewWithCopy(const void* src, size_t length) {
@@ -105,7 +105,7 @@ SkData* SkData::NewWithCopy(const void* src, size_t length) {
}
SkData* SkData::NewUninitialized(size_t length) {
- return PrivateNewWithCopy(NULL, length);
+ return PrivateNewWithCopy(nullptr, length);
}
SkData* SkData::NewWithProc(const void* ptr, size_t length, ReleaseProc proc, void* context) {
@@ -121,17 +121,17 @@ static void sk_mmap_releaseproc(const void* addr, void* ctx) {
SkData* SkData::NewFromFILE(SkFILE* f) {
size_t size;
void* addr = sk_fmmap(f, &size);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, reinterpret_cast<void*>(size));
}
SkData* SkData::NewFromFileName(const char path[]) {
- SkFILE* f = path ? sk_fopen(path, kRead_SkFILE_Flag) : NULL;
- if (NULL == f) {
- return NULL;
+ SkFILE* f = path ? sk_fopen(path, kRead_SkFILE_Flag) : nullptr;
+ if (nullptr == f) {
+ return nullptr;
}
SkData* data = NewFromFILE(f);
sk_fclose(f);
@@ -141,11 +141,11 @@ SkData* SkData::NewFromFileName(const char path[]) {
SkData* SkData::NewFromFD(int fd) {
size_t size;
void* addr = sk_fdmmap(fd, &size);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
- return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, NULL);
+ return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, nullptr);
}
// assumes context is a SkData
@@ -178,7 +178,7 @@ SkData* SkData::NewSubset(const SkData* src, size_t offset, size_t length) {
SkData* SkData::NewWithCString(const char cstr[]) {
size_t size;
- if (NULL == cstr) {
+ if (nullptr == cstr) {
cstr = "";
size = 1;
} else {
@@ -192,7 +192,7 @@ SkData* SkData::NewWithCString(const char cstr[]) {
SkData* SkData::NewFromStream(SkStream* stream, size_t size) {
SkAutoDataUnref data(SkData::NewUninitialized(size));
if (stream->read(data->writable_data(), size) != size) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
diff --git a/src/core/SkDataTable.cpp b/src/core/SkDataTable.cpp
index 20bc430853..32e30af64d 100644
--- a/src/core/SkDataTable.cpp
+++ b/src/core/SkDataTable.cpp
@@ -16,9 +16,9 @@ static void malloc_freeproc(void* context) {
SkDataTable::SkDataTable() {
fCount = 0;
fElemSize = 0; // 0 signals that we use fDir instead of fElems
- fU.fDir = NULL;
- fFreeProc = NULL;
- fFreeProcContext = NULL;
+ fU.fDir = nullptr;
+ fFreeProc = nullptr;
+ fFreeProcContext = nullptr;
}
SkDataTable::SkDataTable(const void* array, size_t elemSize, int count,
@@ -78,7 +78,7 @@ const void* SkDataTable::at(int index, size_t* size) const {
SkDataTable* SkDataTable::NewEmpty() {
static SkDataTable* gEmpty;
- if (NULL == gEmpty) {
+ if (nullptr == gEmpty) {
gEmpty = new SkDataTable;
}
gEmpty->ref();
@@ -137,7 +137,7 @@ SkDataTable* SkDataTable::NewArrayProc(const void* array, size_t elemSize,
static void chunkalloc_freeproc(void* context) { delete (SkChunkAlloc*)context; }
SkDataTableBuilder::SkDataTableBuilder(size_t minChunkSize)
- : fHeap(NULL)
+ : fHeap(nullptr)
, fMinChunkSize(minChunkSize) {}
SkDataTableBuilder::~SkDataTableBuilder() { this->reset(); }
@@ -147,12 +147,12 @@ void SkDataTableBuilder::reset(size_t minChunkSize) {
fDir.reset();
if (fHeap) {
delete fHeap;
- fHeap = NULL;
+ fHeap = nullptr;
}
}
void SkDataTableBuilder::append(const void* src, size_t size) {
- if (NULL == fHeap) {
+ if (nullptr == fHeap) {
fHeap = new SkChunkAlloc(fMinChunkSize);
}
@@ -177,7 +177,7 @@ SkDataTable* SkDataTableBuilder::detachDataTable() {
SkDataTable* table = new SkDataTable((SkDataTable::Dir*)dir, count, chunkalloc_freeproc, fHeap);
// we have to detach our fHeap, since we are giving that to the table
- fHeap = NULL;
+ fHeap = nullptr;
fDir.reset();
return table;
}
diff --git a/src/core/SkDeque.cpp b/src/core/SkDeque.cpp
index 27f3efcba4..2e469d1faf 100644
--- a/src/core/SkDeque.cpp
+++ b/src/core/SkDeque.cpp
@@ -20,20 +20,20 @@ struct SkDeque::Block {
const char* start() const { return (const char*)(this + 1); }
void init(size_t size) {
- fNext = fPrev = NULL;
- fBegin = fEnd = NULL;
+ fNext = fPrev = nullptr;
+ fBegin = fEnd = nullptr;
fStop = (char*)this + size;
}
};
SkDeque::SkDeque(size_t elemSize, int allocCount)
: fElemSize(elemSize)
- , fInitialStorage(NULL)
+ , fInitialStorage(nullptr)
, fCount(0)
, fAllocCount(allocCount) {
SkASSERT(allocCount >= 1);
- fFrontBlock = fBackBlock = NULL;
- fFront = fBack = NULL;
+ fFrontBlock = fBackBlock = nullptr;
+ fFront = fBack = nullptr;
}
SkDeque::SkDeque(size_t elemSize, void* storage, size_t storageSize, int allocCount)
@@ -41,17 +41,17 @@ SkDeque::SkDeque(size_t elemSize, void* storage, size_t storageSize, int allocCo
, fInitialStorage(storage)
, fCount(0)
, fAllocCount(allocCount) {
- SkASSERT(storageSize == 0 || storage != NULL);
+ SkASSERT(storageSize == 0 || storage != nullptr);
SkASSERT(allocCount >= 1);
if (storageSize >= sizeof(Block) + elemSize) {
fFrontBlock = (Block*)storage;
fFrontBlock->init(storageSize);
} else {
- fFrontBlock = NULL;
+ fFrontBlock = nullptr;
}
fBackBlock = fFrontBlock;
- fFront = fBack = NULL;
+ fFront = fBack = nullptr;
}
SkDeque::~SkDeque() {
@@ -70,7 +70,7 @@ SkDeque::~SkDeque() {
void* SkDeque::push_front() {
fCount += 1;
- if (NULL == fFrontBlock) {
+ if (nullptr == fFrontBlock) {
fFrontBlock = this->allocateBlock(fAllocCount);
fBackBlock = fFrontBlock; // update our linklist
}
@@ -78,7 +78,7 @@ void* SkDeque::push_front() {
Block* first = fFrontBlock;
char* begin;
- if (NULL == first->fBegin) {
+ if (nullptr == first->fBegin) {
INIT_CHUNK:
first->fEnd = first->fStop;
begin = first->fStop - fElemSize;
@@ -96,8 +96,8 @@ void* SkDeque::push_front() {
first->fBegin = begin;
- if (NULL == fFront) {
- SkASSERT(NULL == fBack);
+ if (nullptr == fFront) {
+ SkASSERT(nullptr == fBack);
fFront = fBack = begin;
} else {
SkASSERT(fBack);
@@ -110,7 +110,7 @@ void* SkDeque::push_front() {
void* SkDeque::push_back() {
fCount += 1;
- if (NULL == fBackBlock) {
+ if (nullptr == fBackBlock) {
fBackBlock = this->allocateBlock(fAllocCount);
fFrontBlock = fBackBlock; // update our linklist
}
@@ -118,7 +118,7 @@ void* SkDeque::push_back() {
Block* last = fBackBlock;
char* end;
- if (NULL == last->fBegin) {
+ if (nullptr == last->fBegin) {
INIT_CHUNK:
last->fBegin = last->start();
end = last->fBegin + fElemSize;
@@ -137,8 +137,8 @@ void* SkDeque::push_back() {
last->fEnd = end;
end -= fElemSize;
- if (NULL == fBack) {
- SkASSERT(NULL == fFront);
+ if (nullptr == fBack) {
+ SkASSERT(nullptr == fFront);
fFront = fBack = end;
} else {
SkASSERT(fFront);
@@ -154,14 +154,14 @@ void SkDeque::pop_front() {
Block* first = fFrontBlock;
- SkASSERT(first != NULL);
+ SkASSERT(first != nullptr);
- if (first->fBegin == NULL) { // we were marked empty from before
+ if (first->fBegin == nullptr) { // we were marked empty from before
first = first->fNext;
- first->fPrev = NULL;
+ first->fPrev = nullptr;
this->freeBlock(fFrontBlock);
fFrontBlock = first;
- SkASSERT(first != NULL); // else we popped too far
+ SkASSERT(first != nullptr); // else we popped too far
}
char* begin = first->fBegin + fElemSize;
@@ -172,9 +172,9 @@ void SkDeque::pop_front() {
SkASSERT(first->fBegin);
fFront = first->fBegin;
} else {
- first->fBegin = first->fEnd = NULL; // mark as empty
- if (NULL == first->fNext) {
- fFront = fBack = NULL;
+ first->fBegin = first->fEnd = nullptr; // mark as empty
+ if (nullptr == first->fNext) {
+ fFront = fBack = nullptr;
} else {
SkASSERT(first->fNext->fBegin);
fFront = first->fNext->fBegin;
@@ -188,14 +188,14 @@ void SkDeque::pop_back() {
Block* last = fBackBlock;
- SkASSERT(last != NULL);
+ SkASSERT(last != nullptr);
- if (last->fEnd == NULL) { // we were marked empty from before
+ if (last->fEnd == nullptr) { // we were marked empty from before
last = last->fPrev;
- last->fNext = NULL;
+ last->fNext = nullptr;
this->freeBlock(fBackBlock);
fBackBlock = last;
- SkASSERT(last != NULL); // else we popped too far
+ SkASSERT(last != nullptr); // else we popped too far
}
char* end = last->fEnd - fElemSize;
@@ -206,9 +206,9 @@ void SkDeque::pop_back() {
SkASSERT(last->fEnd);
fBack = last->fEnd - fElemSize;
} else {
- last->fBegin = last->fEnd = NULL; // mark as empty
- if (NULL == last->fPrev) {
- fFront = fBack = NULL;
+ last->fBegin = last->fEnd = nullptr; // mark as empty
+ if (nullptr == last->fPrev) {
+ fFront = fBack = nullptr;
} else {
SkASSERT(last->fPrev->fEnd);
fBack = last->fPrev->fEnd - fElemSize;
@@ -238,7 +238,7 @@ void SkDeque::freeBlock(Block* block) {
///////////////////////////////////////////////////////////////////////////////
-SkDeque::Iter::Iter() : fCurBlock(NULL), fPos(NULL), fElemSize(0) {}
+SkDeque::Iter::Iter() : fCurBlock(nullptr), fPos(nullptr), fElemSize(0) {}
SkDeque::Iter::Iter(const SkDeque& d, IterStart startLoc) {
this->reset(d, startLoc);
@@ -255,8 +255,8 @@ void* SkDeque::Iter::next() {
if (next == fCurBlock->fEnd) { // exhausted this chunk, move to next
do {
fCurBlock = fCurBlock->fNext;
- } while (fCurBlock != NULL && fCurBlock->fBegin == NULL);
- next = fCurBlock ? fCurBlock->fBegin : NULL;
+ } while (fCurBlock != nullptr && fCurBlock->fBegin == nullptr);
+ next = fCurBlock ? fCurBlock->fBegin : nullptr;
}
fPos = next;
}
@@ -274,8 +274,8 @@ void* SkDeque::Iter::prev() {
if (prev < fCurBlock->fBegin) { // exhausted this chunk, move to prior
do {
fCurBlock = fCurBlock->fPrev;
- } while (fCurBlock != NULL && fCurBlock->fEnd == NULL);
- prev = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL;
+ } while (fCurBlock != nullptr && fCurBlock->fEnd == nullptr);
+ prev = fCurBlock ? fCurBlock->fEnd - fElemSize : nullptr;
}
fPos = prev;
}
@@ -286,23 +286,23 @@ void* SkDeque::Iter::prev() {
// of the doubly linked list until a non-empty one is found. The fPos
// member is then set to the first (or last) element in the block. If
// there are no elements in the deque both fCurBlock and fPos will come
-// out of this routine NULL.
+// out of this routine nullptr.
void SkDeque::Iter::reset(const SkDeque& d, IterStart startLoc) {
fElemSize = d.fElemSize;
if (kFront_IterStart == startLoc) {
// initialize the iterator to start at the front
fCurBlock = d.fFrontBlock;
- while (fCurBlock && NULL == fCurBlock->fBegin) {
+ while (fCurBlock && nullptr == fCurBlock->fBegin) {
fCurBlock = fCurBlock->fNext;
}
- fPos = fCurBlock ? fCurBlock->fBegin : NULL;
+ fPos = fCurBlock ? fCurBlock->fBegin : nullptr;
} else {
// initialize the iterator to start at the back
fCurBlock = d.fBackBlock;
- while (fCurBlock && NULL == fCurBlock->fEnd) {
+ while (fCurBlock && nullptr == fCurBlock->fEnd) {
fCurBlock = fCurBlock->fPrev;
}
- fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL;
+ fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : nullptr;
}
}
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index e559215cb1..1f6f4a8657 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -37,10 +37,10 @@ public:
uint32_t getLength() const { return fLength; }
- void* addEntry(uint32_t tag, size_t length, const void* data = NULL) {
+ void* addEntry(uint32_t tag, size_t length, const void* data = nullptr) {
SkASSERT(tag);
SkASSERT(SkAlign4(length) == length);
- SkASSERT(this->findEntry(tag, NULL) == NULL);
+ SkASSERT(this->findEntry(tag, nullptr) == nullptr);
Entry* entry = (Entry*)((char*)this + fLength);
entry->fTag = tag;
@@ -77,7 +77,7 @@ public:
}
entry = (const Entry*)((const char*)(entry + 1) + entry->fLen);
}
- return NULL;
+ return nullptr;
}
SkDescriptor* copy() const {
@@ -134,9 +134,9 @@ private:
class SkAutoDescriptor : SkNoncopyable {
public:
- SkAutoDescriptor() : fDesc(NULL) {}
- SkAutoDescriptor(size_t size) : fDesc(NULL) { this->reset(size); }
- SkAutoDescriptor(const SkDescriptor& desc) : fDesc(NULL) {
+ SkAutoDescriptor() : fDesc(nullptr) {}
+ SkAutoDescriptor(size_t size) : fDesc(nullptr) { this->reset(size); }
+ SkAutoDescriptor(const SkDescriptor& desc) : fDesc(nullptr) {
size_t size = desc.getLength();
this->reset(size);
memcpy(fDesc, &desc, size);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index f8275fae93..a76a2ff0af 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -27,7 +27,7 @@ SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps)
#endif
{
fOrigin.setZero();
- fMetaData = NULL;
+ fMetaData = nullptr;
}
SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
@@ -35,7 +35,7 @@ SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
SkMetaData& SkBaseDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
- if (NULL == fMetaData) {
+ if (nullptr == fMetaData) {
fMetaData = new SkMetaData;
}
return *fMetaData;
@@ -78,7 +78,7 @@ void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- const SkMatrix* preMatrix = NULL;
+ const SkMatrix* preMatrix = nullptr;
const bool pathIsMutable = true;
this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
}
@@ -212,7 +212,7 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
- this->drawPath(draw, path, pnt, NULL, true);
+ this->drawPath(draw, path, pnt, nullptr, true);
}
}
@@ -263,7 +263,7 @@ bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
bool SkBaseDevice::accessPixels(SkPixmap* pmap) {
SkPixmap tempStorage;
- if (NULL == pmap) {
+ if (nullptr == pmap) {
pmap = &tempStorage;
}
return this->onAccessPixels(pmap);
@@ -271,7 +271,7 @@ bool SkBaseDevice::accessPixels(SkPixmap* pmap) {
bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
SkPixmap tempStorage;
- if (NULL == pmap) {
+ if (nullptr == pmap) {
pmap = &tempStorage;
}
return this->onPeekPixels(pmap);
@@ -357,10 +357,10 @@ static void morphpath(SkPath* dst, const SkPath& src, SkPathMeasure& meas,
void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t byteLength,
const SkPath& follow, const SkMatrix* matrix,
const SkPaint& paint) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0 || draw.fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || draw.fRC->isEmpty()) {
return;
}
@@ -395,7 +395,7 @@ void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t b
m.postConcat(*matrix);
}
morphpath(&tmp, *iterPath, meas, m);
- this->drawPath(draw, tmp, iter.getPaint(), NULL, true);
+ this->drawPath(draw, tmp, iter.getPaint(), nullptr, true);
}
}
}
diff --git a/src/core/SkDeviceLooper.cpp b/src/core/SkDeviceLooper.cpp
index 840a050436..c4e401361c 100644
--- a/src/core/SkDeviceLooper.cpp
+++ b/src/core/SkDeviceLooper.cpp
@@ -16,8 +16,8 @@ SkDeviceLooper::SkDeviceLooper(const SkPixmap& base, const SkRasterClip& rc, con
{
// sentinels that next() has not yet been called, and so our mapper functions
// should not be called either.
- fCurrDst = NULL;
- fCurrRC = NULL;
+ fCurrDst = nullptr;
+ fCurrRC = nullptr;
if (!rc.isEmpty()) {
// clip must be contained by the bitmap
@@ -102,7 +102,7 @@ bool SkDeviceLooper::next() {
case kSimple_State:
// first time for simple
- if (NULL == fCurrDst) {
+ if (nullptr == fCurrDst) {
fCurrDst = &fBaseDst;
fCurrRC = &fBaseRC;
fCurrOffset.set(0, 0);
diff --git a/src/core/SkDeviceProfile.cpp b/src/core/SkDeviceProfile.cpp
index 11d5c853f3..e1c10c87d7 100644
--- a/src/core/SkDeviceProfile.cpp
+++ b/src/core/SkDeviceProfile.cpp
@@ -51,7 +51,7 @@ static SkDeviceProfile* gGlobalProfile;
SkDeviceProfile* SkDeviceProfile::GetDefault() {
SkAutoMutexAcquire amc(gMutex);
- if (NULL == gDefaultProfile) {
+ if (nullptr == gDefaultProfile) {
gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP,
DEFAULT_CONTRASTSCALE,
DEFAULT_LCDCONFIG,
@@ -63,7 +63,7 @@ SkDeviceProfile* SkDeviceProfile::GetDefault() {
SkDeviceProfile* SkDeviceProfile::RefGlobal() {
SkAutoMutexAcquire amc(gMutex);
- if (NULL == gGlobalProfile) {
+ if (nullptr == gGlobalProfile) {
gGlobalProfile = SkDeviceProfile::GetDefault();
}
gGlobalProfile->ref();
diff --git a/src/core/SkDeviceProfile.h b/src/core/SkDeviceProfile.h
index d949444f8e..2872b13458 100644
--- a/src/core/SkDeviceProfile.h
+++ b/src/core/SkDeviceProfile.h
@@ -52,7 +52,7 @@ public:
/**
* Returns the global default profile, that is used if no global profile is
- * specified with SetGlobal(), or if NULL is specified to SetGlobal().
+ * specified with SetGlobal(), or if nullptr is specified to SetGlobal().
* The references count is *not* incremented, and the caller should not
* call unref().
*/
@@ -69,7 +69,7 @@ public:
* Make the specified profile be the global value for all subsequently
* instantiated devices. Does not affect any existing devices.
* Increments the reference count on the profile.
- * Specify NULL for the "identity" profile (where there is no gamma or
+ * Specify nullptr for the "identity" profile (where there is no gamma or
* contrast correction).
*/
static void SetGlobal(SkDeviceProfile*);
diff --git a/src/core/SkDiscardableMemory.h b/src/core/SkDiscardableMemory.h
index f3159fe2af..8952b8df7f 100644
--- a/src/core/SkDiscardableMemory.h
+++ b/src/core/SkDiscardableMemory.h
@@ -19,13 +19,13 @@ class SK_API SkDiscardableMemory {
public:
/**
* Factory method that creates, initializes and locks an SkDiscardableMemory
- * object. If either of these steps fails, a NULL pointer will be returned.
+ * object. If either of these steps fails, a nullptr pointer will be returned.
*/
static SkDiscardableMemory* Create(size_t bytes);
/**
* Factory class that creates, initializes and locks an SkDiscardableMemory
- * object. If either of these steps fails, a NULL pointer will be returned.
+ * object. If either of these steps fails, a nullptr pointer will be returned.
*/
class Factory : public SkRefCnt {
public:
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 6464d4a48c..8e1a132b4d 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -42,7 +42,7 @@
class SkAutoBlitterChoose : SkNoncopyable {
public:
SkAutoBlitterChoose() {
- fBlitter = NULL;
+ fBlitter = nullptr;
}
SkAutoBlitterChoose(const SkPixmap& dst, const SkMatrix& matrix,
const SkPaint& paint, bool drawCoverage = false) {
@@ -73,7 +73,7 @@ private:
class SkAutoBitmapShaderInstall : SkNoncopyable {
public:
SkAutoBitmapShaderInstall(const SkBitmap& src, const SkPaint& paint,
- const SkMatrix* localMatrix = NULL)
+ const SkMatrix* localMatrix = nullptr)
: fPaint(paint) /* makes a copy of the paint */ {
fPaint.setShader(SkCreateBitmapShader(src, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
@@ -86,7 +86,7 @@ public:
// since fAllocator will destroy shader, we insist that owners == 2
SkASSERT(2 == fPaint.getShader()->getRefCnt());
- fPaint.setShader(NULL); // unref the shader by 1
+ fPaint.setShader(nullptr); // unref the shader by 1
}
@@ -155,12 +155,12 @@ static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
// todo: we can apply colorfilter up front if no shader, so we wouldn't
// need to abort this fastpath
if (paint.getShader() || paint.getColorFilter()) {
- return NULL;
+ return nullptr;
}
SkXfermode::Mode mode;
if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) {
- return NULL;
+ return nullptr;
}
SkColor color = paint.getColor();
@@ -214,7 +214,7 @@ static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
default:
break;
}
- return NULL;
+ return nullptr;
}
static void CallBitmapXferProc(const SkPixmap& dst, const SkIRect& rect, BitmapXferProc proc,
@@ -451,7 +451,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
if (0 == width) {
fMode = mode;
fPaint = &paint;
- fClip = NULL;
+ fClip = nullptr;
fRC = rc;
fRadius = SK_FixedHalf;
return true;
@@ -467,7 +467,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
fMode = mode;
fPaint = &paint;
- fClip = NULL;
+ fClip = nullptr;
fRC = rc;
fRadius = SkScalarToFixed(SkScalarMul(width, sx)) >> 1;
return true;
@@ -477,7 +477,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
}
PtProcRec::Proc PtProcRec::chooseProc(SkBlitter** blitterPtr) {
- Proc proc = NULL;
+ Proc proc = nullptr;
SkBlitter* blitter = *blitterPtr;
if (fRC->isBW()) {
@@ -546,7 +546,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
return;
}
- SkASSERT(pts != NULL);
+ SkASSERT(pts != nullptr);
SkDEBUGCODE(this->validate();)
// nothing to draw
@@ -642,7 +642,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
// 'asPoints' managed to find some fast path
SkPaint newP(paint);
- newP.setPathEffect(NULL);
+ newP.setPathEffect(nullptr);
newP.setStyle(SkPaint::kFill_Style);
if (!pointData.fFirst.isEmpty()) {
@@ -720,9 +720,9 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
path.moveTo(pts[i]);
path.lineTo(pts[i+1]);
if (fDevice) {
- fDevice->drawPath(*this, path, p, NULL, true);
+ fDevice->drawPath(*this, path, p, nullptr, true);
} else {
- this->drawPath(path, p, NULL, true);
+ this->drawPath(path, p, nullptr, true);
}
path.rewind();
}
@@ -820,7 +820,7 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint,
SkPath tmp;
tmp.addRect(prePaintRect);
tmp.setFillType(SkPath::kWinding_FillType);
- draw.drawPath(tmp, paint, NULL, true);
+ draw.drawPath(tmp, paint, nullptr, true);
return;
}
@@ -901,10 +901,10 @@ void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const {
SkMask dstM;
if (paint.getMaskFilter() &&
- paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL)) {
+ paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, nullptr)) {
mask = &dstM;
} else {
- dstM.fImage = NULL;
+ dstM.fImage = nullptr;
}
SkAutoMaskFreeImage ami(dstM.fImage);
@@ -998,7 +998,7 @@ DRAW_PATH:
// Now fall back to the default case of using a path.
SkPath path;
path.addRRect(rrect);
- this->drawPath(path, paint, NULL, true);
+ this->drawPath(path, paint, nullptr, true);
}
static SkScalar compute_res_scale_for_stroking(const SkMatrix& matrix) {
@@ -1076,7 +1076,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) {
SkRect cullRect;
- const SkRect* cullRectPtr = NULL;
+ const SkRect* cullRectPtr = nullptr;
if (this->computeConservativeLocalClipBounds(&cullRect)) {
cullRectPtr = &cullRect;
}
@@ -1102,9 +1102,9 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
// transform the path into device space
pathPtr->transform(*matrix, devPathPtr);
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
SkAutoBlitterChoose blitterStorage;
- if (NULL == customBlitter) {
+ if (nullptr == customBlitter) {
blitterStorage.choose(fDst, *fMatrix, *paint, drawCoverage);
blitter = blitterStorage.get();
} else {
@@ -1333,7 +1333,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& ori
}
const SkPixmap& pmap = unlocker.pixmap();
- if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) {
+ if (nullptr == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) {
SkTBlitterAllocator allocator;
// blitter will be owned by the allocator.
SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, paint, pmap, x, y, &allocator);
@@ -1453,8 +1453,8 @@ static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy,
int left = Sk48Dot16FloorToInt(fx);
int top = Sk48Dot16FloorToInt(fy);
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
- SkASSERT((NULL == state.fClip && state.fAAClip) ||
- (state.fClip && NULL == state.fAAClip && state.fClip->isRect()));
+ SkASSERT((nullptr == state.fClip && state.fAAClip) ||
+ (state.fClip && nullptr == state.fAAClip && state.fClip->isRect()));
left += glyph.fLeft;
top += glyph.fTop;
@@ -1477,9 +1477,9 @@ static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy,
}
uint8_t* aa = (uint8_t*)glyph.fImage;
- if (NULL == aa) {
+ if (nullptr == aa) {
aa = (uint8_t*)state.fCache->findImage(glyph);
- if (NULL == aa) {
+ if (nullptr == aa) {
return; // can't rasterize glyph
}
}
@@ -1507,9 +1507,9 @@ static void D1G_RgnClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, c
if (!clipper.done()) {
const SkIRect& cr = clipper.rect();
const uint8_t* aa = (const uint8_t*)glyph.fImage;
- if (NULL == aa) {
+ if (nullptr == aa) {
aa = (uint8_t*)state.fCache->findImage(glyph);
- if (NULL == aa) {
+ if (nullptr == aa) {
return;
}
}
@@ -1553,7 +1553,7 @@ SkDraw1Glyph::Proc SkDraw1Glyph::init(const SkDraw* draw, SkBlitter* blitter, Sk
}
if (draw->fRC->isBW()) {
- fAAClip = NULL;
+ fAAClip = nullptr;
fClip = &draw->fRC->bwRgn();
fClipBounds = fClip->getBounds();
if (fClip->isRect()) {
@@ -1563,7 +1563,7 @@ SkDraw1Glyph::Proc SkDraw1Glyph::init(const SkDraw* draw, SkBlitter* blitter, Sk
}
} else { // aaclip
fAAClip = &draw->fRC->aaRgn();
- fClip = NULL;
+ fClip = nullptr;
fClipBounds = fAAClip->getBounds();
return D1G_RectClip;
}
@@ -1583,12 +1583,12 @@ void SkDraw1Glyph::blitMaskAsSprite(const SkMask& mask) const {
void SkDraw::drawText(const char text[], size_t byteLength,
SkScalar x, SkScalar y, const SkPaint& paint) const {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkDEBUGCODE(this->validate();)
// nothing to draw
- if (text == NULL || byteLength == 0 || fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || fRC->isEmpty()) {
return;
}
@@ -1633,7 +1633,7 @@ void SkDraw::drawText(const char text[], size_t byteLength,
SkAAClipBlitter aaBlitter;
SkAutoBlitterChoose blitterChooser;
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
if (needsRasterTextBlit(*this)) {
blitterChooser.choose(fDst, *fMatrix, paint);
blitter = blitterChooser.get();
@@ -1691,10 +1691,10 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
// Temporarily jam in kFill, so we only ever ask for the raw outline from the cache.
paint.setStyle(SkPaint::kFill_Style);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
- SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), NULL);
+ SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), nullptr);
SkGlyphCache* cache = autoCache.getCache();
const char* stop = text + byteLength;
@@ -1731,13 +1731,13 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
void SkDraw::drawPosText(const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkPaint& paint) const {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
SkDEBUGCODE(this->validate();)
// nothing to draw
- if (text == NULL || byteLength == 0 || fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || fRC->isEmpty()) {
return;
}
@@ -1752,7 +1752,7 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
SkAAClipBlitterWrapper wrapper;
SkAutoBlitterChoose blitterChooser;
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
if (needsRasterTextBlit(*this)) {
blitterChooser.choose(fDst, *fMatrix, paint);
blitter = blitterChooser.get();
@@ -1915,7 +1915,7 @@ public:
SK_TO_STRING_OVERRIDE()
// For serialization. This will never be called.
- Factory getFactory() const override { sk_throw(); return NULL; }
+ Factory getFactory() const override { sk_throw(); return nullptr; }
protected:
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
@@ -2053,26 +2053,26 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
SkPaint p(paint);
SkShader* shader = p.getShader();
- if (NULL == shader) {
+ if (nullptr == shader) {
// if we have no shader, we ignore the texture coordinates
- textures = NULL;
- } else if (NULL == textures) {
+ textures = nullptr;
+ } else if (nullptr == textures) {
// if we don't have texture coordinates, ignore the shader
- p.setShader(NULL);
- shader = NULL;
+ p.setShader(nullptr);
+ shader = nullptr;
}
// setup the custom shader (if needed)
SkAutoTUnref<SkComposeShader> composeShader;
if (colors) {
- if (NULL == textures) {
+ if (nullptr == textures) {
// just colors (no texture)
shader = p.setShader(&triShader);
} else {
// colors * texture
SkASSERT(shader);
bool releaseMode = false;
- if (NULL == xmode) {
+ if (nullptr == xmode) {
xmode = SkXfermode::Create(SkXfermode::kModulate_Mode);
releaseMode = true;
}
@@ -2155,9 +2155,9 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
#ifdef SK_DEBUG
void SkDraw::validate() const {
- SkASSERT(fMatrix != NULL);
- SkASSERT(fClip != NULL);
- SkASSERT(fRC != NULL);
+ SkASSERT(fMatrix != nullptr);
+ SkASSERT(fClip != nullptr);
+ SkASSERT(fRC != nullptr);
const SkIRect& cr = fRC->getBounds();
SkIRect br;
@@ -2193,7 +2193,7 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
srcM.fBounds = *bounds;
srcM.fFormat = SkMask::kA8_Format;
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin)) {
return false;
}
diff --git a/src/core/SkDrawLooper.cpp b/src/core/SkDrawLooper.cpp
index 1af68a2289..aa53f2e3a1 100644
--- a/src/core/SkDrawLooper.cpp
+++ b/src/core/SkDrawLooper.cpp
@@ -21,7 +21,7 @@ bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) const {
for (;;) {
SkPaint p(paint);
if (context->next(&canvas, &p)) {
- p.setLooper(NULL);
+ p.setLooper(nullptr);
if (!p.canComputeFastBounds()) {
return false;
}
@@ -48,7 +48,7 @@ void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& s,
if (context->next(&canvas, &p)) {
SkRect r(src);
- p.setLooper(NULL);
+ p.setLooper(nullptr);
p.computeFastBounds(r, &r);
canvas.getTotalMatrix().mapRect(&r);
diff --git a/src/core/SkDrawable.cpp b/src/core/SkDrawable.cpp
index 50522709e9..8fea38be34 100644
--- a/src/core/SkDrawable.cpp
+++ b/src/core/SkDrawable.cpp
@@ -76,7 +76,7 @@ SkPicture* SkDrawable::onNewPictureSnapshot() {
SkPictureRecorder recorder;
const SkRect bounds = this->getBounds();
- SkCanvas* canvas = recorder.beginRecording(bounds, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(bounds, nullptr, 0);
this->draw(canvas);
if (false) {
draw_bbox(canvas, bounds);
diff --git a/src/core/SkEdgeBuilder.cpp b/src/core/SkEdgeBuilder.cpp
index 43181fdbfc..92c8330c16 100644
--- a/src/core/SkEdgeBuilder.cpp
+++ b/src/core/SkEdgeBuilder.cpp
@@ -19,7 +19,7 @@ template <typename T> static T* typedAllocThrow(SkChunkAlloc& alloc) {
///////////////////////////////////////////////////////////////////////////////
SkEdgeBuilder::SkEdgeBuilder() : fAlloc(16*1024) {
- fEdgeList = NULL;
+ fEdgeList = nullptr;
}
void SkEdgeBuilder::addLine(const SkPoint pts[]) {
diff --git a/src/core/SkEmptyShader.h b/src/core/SkEmptyShader.h
index 7b87c284f7..6453e0e440 100644
--- a/src/core/SkEmptyShader.h
+++ b/src/core/SkEmptyShader.h
@@ -14,14 +14,14 @@
/**
* \class SkEmptyShader
- * A Shader that always draws nothing. Its createContext always returns NULL.
+ * A Shader that always draws nothing. Its createContext always returns nullptr.
*/
class SK_API SkEmptyShader : public SkShader {
public:
SkEmptyShader() {}
size_t contextSize() const override {
- // Even though createContext returns NULL we have to return a value of at least
+ // Even though createContext returns nullptr we have to return a value of at least
// sizeof(SkShader::Context) to satisfy SkSmallAllocator.
return sizeof(SkShader::Context);
}
@@ -31,7 +31,7 @@ public:
protected:
SkShader::Context* onCreateContext(const ContextRec&, void*) const override {
- return NULL;
+ return nullptr;
}
void flatten(SkWriteBuffer& buffer) const override {
diff --git a/src/core/SkEndian.h b/src/core/SkEndian.h
index 0955fcc505..954afb046d 100644
--- a/src/core/SkEndian.h
+++ b/src/core/SkEndian.h
@@ -39,7 +39,7 @@ template<uint16_t N> struct SkTEndianSwap16 {
low two bytes of each value in the array.
*/
static inline void SkEndianSwap16s(uint16_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap16(*array);
@@ -68,7 +68,7 @@ template<uint32_t N> struct SkTEndianSwap32 {
bytes of each value in the array.
*/
static inline void SkEndianSwap32s(uint32_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap32(*array);
@@ -104,7 +104,7 @@ template<uint64_t N> struct SkTEndianSwap64 {
bytes of each value in the array.
*/
static inline void SkEndianSwap64s(uint64_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap64(*array);
diff --git a/src/core/SkError.cpp b/src/core/SkError.cpp
index 23db8ac1e4..9e4385b489 100644
--- a/src/core/SkError.cpp
+++ b/src/core/SkError.cpp
@@ -31,7 +31,7 @@ void DeleteThreadError(void *v) { delete reinterpret_cast<SkError *>(v); }
*(reinterpret_cast<SkErrorCallbackFunction *>(SkTLS::Get(CreateThreadErrorCallback, \
DeleteThreadErrorCallback)))
- void *CreateThreadErrorContext() { return new void **(NULL); }
+ void *CreateThreadErrorContext() { return new void **(nullptr); }
void DeleteThreadErrorContext(void *v) { delete reinterpret_cast<void **>(v); }
#define THREAD_ERROR_CONTEXT \
(*reinterpret_cast<void **>(SkTLS::Get(CreateThreadErrorContext, DeleteThreadErrorContext)))
@@ -60,7 +60,7 @@ const char *SkGetLastErrorString() {
// ------------ Private Error functions ---------
void SkErrorInternals::SetErrorCallback(SkErrorCallbackFunction cb, void *context) {
- if (cb == NULL) {
+ if (cb == nullptr) {
THREAD_ERROR_CALLBACK = SkErrorInternals::DefaultErrorCallback;
} else {
THREAD_ERROR_CALLBACK = cb;
@@ -89,7 +89,7 @@ void SkErrorInternals::SetError(SkError code, const char *fmt, ...) {
va_list args;
char *str = THREAD_ERROR_STRING;
- const char *error_name = NULL;
+ const char *error_name = nullptr;
switch( code ) {
case kNoError_SkError:
error_name = "No Error";
diff --git a/src/core/SkFilterShader.cpp b/src/core/SkFilterShader.cpp
index d972489774..b52c2be8c4 100644
--- a/src/core/SkFilterShader.cpp
+++ b/src/core/SkFilterShader.cpp
@@ -30,7 +30,7 @@ SkFlattenable* SkFilterShader::CreateProc(SkReadBuffer& buffer) {
SkAutoTUnref<SkShader> shader(buffer.readShader());
SkAutoTUnref<SkColorFilter> filter(buffer.readColorFilter());
if (!shader.get() || !filter.get()) {
- return NULL;
+ return nullptr;
}
return new SkFilterShader(shader, filter);
}
@@ -59,8 +59,8 @@ uint32_t SkFilterShader::FilterShaderContext::getFlags() const {
SkShader::Context* SkFilterShader::onCreateContext(const ContextRec& rec, void* storage) const {
char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext);
SkShader::Context* shaderContext = fShader->createContext(rec, shaderContextStorage);
- if (NULL == shaderContext) {
- return NULL;
+ if (nullptr == shaderContext) {
+ return nullptr;
}
return new (storage) FilterShaderContext(*this, shaderContext, rec);
}
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp
index 27efe7ece3..87e720e95f 100644
--- a/src/core/SkFlattenable.cpp
+++ b/src/core/SkFlattenable.cpp
@@ -17,7 +17,7 @@ uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) {
return index;
}
const char* name = SkFlattenable::FactoryToName(factory);
- if (NULL == name) {
+ if (nullptr == name) {
return 0;
}
*fNames.append() = name;
@@ -28,7 +28,7 @@ const char* SkNamedFactorySet::getNextAddedFactoryName() {
if (fNextAddedFactory < fNames.count()) {
return fNames[fNextAddedFactory++];
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ SkFlattenable::Factory SkFlattenable::NameToFactory(const char name[]) {
return entries[i].fFactory;
}
}
- return NULL;
+ return nullptr;
}
bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) {
@@ -128,5 +128,5 @@ const char* SkFlattenable::FactoryToName(Factory fact) {
return entries[i].fName;
}
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index d6895a480b..c39cc185d3 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -31,13 +31,13 @@ SkFont::SkFont(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScalar skewX,
SkFont* SkFont::Create(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScalar skewX,
MaskType mt, uint32_t flags) {
if (size <= 0 || !SkScalarIsFinite(size)) {
- return NULL;
+ return nullptr;
}
if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) {
- return NULL;
+ return nullptr;
}
if (!SkScalarIsFinite(skewX)) {
- return NULL;
+ return nullptr;
}
flags &= kAllFlags;
return new SkFont(face, size, scaleX, skewX, mt, flags);
@@ -82,7 +82,7 @@ int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding enc
count = SkToInt(byteLength >> 1);
break;
}
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
return count;
}
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
index 933a36a095..21fecdc416 100644
--- a/src/core/SkFontDescriptor.h
+++ b/src/core/SkFontDescriptor.h
@@ -32,7 +32,7 @@ public:
fAxis[i] = that.fAxis[i];
}
}
- bool hasStream() const { return fStream.get() != NULL; }
+ bool hasStream() const { return fStream.get() != nullptr; }
SkStreamAsset* duplicateStream() const { return fStream->duplicate(); }
SkStreamAsset* detachStream() { return fStream.detach(); }
SkStreamAsset* getStream() { return fStream.get(); }
@@ -61,7 +61,7 @@ public:
const char* getFamilyName() const { return fFamilyName.c_str(); }
const char* getFullName() const { return fFullName.c_str(); }
const char* getPostscriptName() const { return fPostscriptName.c_str(); }
- bool hasFontData() const { return fFontData.get() != NULL; }
+ bool hasFontData() const { return fFontData.get() != nullptr; }
SkFontData* detachFontData() { return fFontData.detach(); }
void setFamilyName(const char* name) { fFamilyName.set(name); }
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 35ad6c39f7..7c06690d2e 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -22,10 +22,10 @@ public:
}
SkTypeface* createTypeface(int index) override {
SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set");
- return NULL;
+ return nullptr;
}
SkTypeface* matchStyle(const SkFontStyle&) override {
- return NULL;
+ return nullptr;
}
};
@@ -43,7 +43,7 @@ protected:
}
SkFontStyleSet* onCreateStyleSet(int index) const override {
SkDEBUGFAIL("onCreateStyleSet called with bad index");
- return NULL;
+ return nullptr;
}
SkFontStyleSet* onMatchFamily(const char[]) const override {
return SkFontStyleSet::CreateEmpty();
@@ -51,36 +51,36 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char[],
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
const SkFontStyle& style,
const char* bcp47[],
int bcp47Count,
SkUnichar character) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromData(SkData*, int) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const override {
delete stream;
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromFile(const char[], int) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override {
- return NULL;
+ return nullptr;
}
};
static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) {
- if (NULL == fsset) {
+ if (nullptr == fsset) {
fsset = SkFontStyleSet::CreateEmpty();
}
return fsset;
@@ -119,22 +119,22 @@ SkTypeface* SkFontMgr::matchFaceStyle(const SkTypeface* face,
}
SkTypeface* SkFontMgr::createFromData(SkData* data, int ttcIndex) const {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
return this->onCreateFromData(data, ttcIndex);
}
SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) const {
- if (NULL == stream) {
- return NULL;
+ if (nullptr == stream) {
+ return nullptr;
}
return this->onCreateFromStream(stream, ttcIndex);
}
SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
return this->onCreateFromFontData(data);
}
@@ -147,8 +147,8 @@ SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const {
}
SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
- if (NULL == path) {
- return NULL;
+ if (nullptr == path) {
+ return nullptr;
}
return this->onCreateFromFile(path, ttcIndex);
}
diff --git a/src/core/SkFontStream.cpp b/src/core/SkFontStream.cpp
index 580da37f43..b2ffe8deba 100644
--- a/src/core/SkFontStream.cpp
+++ b/src/core/SkFontStream.cpp
@@ -101,7 +101,7 @@ static int count_tables(SkStream* stream, int ttcIndex, size_t* offsetToDir) {
///////////////////////////////////////////////////////////////////////////////
struct SfntHeader {
- SfntHeader() : fCount(0), fDir(NULL) {}
+ SfntHeader() : fCount(0), fDir(nullptr) {}
~SfntHeader() { sk_free(fDir); }
/** If it returns true, then fCount and fDir are properly initialized.
diff --git a/src/core/SkFontStream.h b/src/core/SkFontStream.h
index 0f7a052e6a..0a2322fc06 100644
--- a/src/core/SkFontStream.h
+++ b/src/core/SkFontStream.h
@@ -42,7 +42,7 @@ public:
size_t offset, size_t length, void* data);
static size_t GetTableSize(SkStream* stream, int ttcIndex, SkFontTableTag tag) {
- return GetTableData(stream, ttcIndex, tag, 0, ~0U, NULL);
+ return GetTableData(stream, ttcIndex, tag, 0, ~0U, nullptr);
}
};
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 7462009479..01b618073a 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -912,7 +912,7 @@ int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13],
SkScalar tValues[3]) {
SkScalar t_storage[3];
- if (tValues == NULL) {
+ if (tValues == nullptr) {
tValues = t_storage;
}
diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h
index bd3abe1acf..79cad2eee0 100644
--- a/src/core/SkGeometry.h
+++ b/src/core/SkGeometry.h
@@ -39,7 +39,7 @@ SkPoint SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t);
/** Set pt to the point on the src quadratic specified by t. t must be
0 <= t <= 1.0
*/
-void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = NULL);
+void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = nullptr);
/**
* output is : eval(t) == coeff[0] * t^2 + coeff[1] * t + coeff[2]
@@ -164,7 +164,7 @@ int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10]);
int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]);
int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13],
- SkScalar tValues[3] = NULL);
+ SkScalar tValues[3] = nullptr);
bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar y, SkPoint dst[7]);
bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar x, SkPoint dst[7]);
@@ -239,7 +239,7 @@ struct SkConic {
* tangent value's length is arbitrary, and only its direction should
* be used.
*/
- void evalAt(SkScalar t, SkPoint* pos, SkVector* tangent = NULL) const;
+ void evalAt(SkScalar t, SkPoint* pos, SkVector* tangent = nullptr) const;
void chopAt(SkScalar t, SkConic dst[2]) const;
void chop(SkConic dst[2]) const;
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 469985959c..c747995ed0 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -131,8 +131,8 @@ class SkGlyph {
void initCommon(uint32_t id) {
fID = id;
- fImage = NULL;
- fPath = NULL;
+ fImage = nullptr;
+ fPath = nullptr;
fMaskFormat = MASK_FORMAT_UNKNOWN;
fForceBW = 0;
}
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index ff52004128..e6d66f0ac3 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -43,13 +43,13 @@ SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca
SkASSERT(desc);
SkASSERT(ctx);
- fPrev = fNext = NULL;
+ fPrev = fNext = nullptr;
fScalerContext->getFontMetrics(&fFontMetrics);
fMemoryUsed = sizeof(*this);
- fAuxProcList = NULL;
+ fAuxProcList = nullptr;
}
SkGlyphCache::~SkGlyphCache() {
@@ -60,7 +60,7 @@ SkGlyphCache::~SkGlyphCache() {
}
SkGlyphCache::CharGlyphRec* SkGlyphCache::getCharGlyphRec(PackedUnicharID packedUnicharID) {
- if (NULL == fPackedUnicharIDToPackedGlyphID.get()) {
+ if (nullptr == fPackedUnicharIDToPackedGlyphID.get()) {
// Allocate the array.
fPackedUnicharIDToPackedGlyphID.reset(kHashCount);
// Initialize array to map character and position with the impossible glyph ID. This
@@ -161,7 +161,7 @@ SkGlyph* SkGlyphCache::lookupByChar(SkUnichar charCode, MetricsType type, SkFixe
SkGlyph* SkGlyphCache::lookupByPackedGlyphID(PackedGlyphID packedGlyphID, MetricsType type) {
SkGlyph* glyph = fGlyphMap.find(packedGlyphID);
- if (NULL == glyph) {
+ if (nullptr == glyph) {
glyph = this->allocateNewGlyph(packedGlyphID, type);
} else {
if (type == kFull_MetricsType && glyph->isJustAdvance()) {
@@ -194,7 +194,7 @@ SkGlyph* SkGlyphCache::allocateNewGlyph(PackedGlyphID packedGlyphID, MetricsType
const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
if (glyph.fWidth > 0 && glyph.fWidth < kMaxGlyphWidth) {
- if (NULL == glyph.fImage) {
+ if (nullptr == glyph.fImage) {
size_t size = glyph.computeImageSize();
const_cast<SkGlyph&>(glyph).fImage = fGlyphAlloc.alloc(size,
SkChunkAlloc::kReturnNil_AllocFailType);
@@ -214,7 +214,7 @@ const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
if (glyph.fWidth) {
- if (glyph.fPath == NULL) {
+ if (glyph.fPath == nullptr) {
const_cast<SkGlyph&>(glyph).fPath = new SkPath;
fScalerContext->getPath(glyph, glyph.fPath);
fMemoryUsed += sizeof(SkPath) +
@@ -260,7 +260,7 @@ bool SkGlyphCache::getAuxProcData(void (*proc)(void*), void** dataPtr) const {
}
void SkGlyphCache::setAuxProc(void (*proc)(void*), void* data) {
- if (proc == NULL) {
+ if (proc == nullptr) {
return;
}
@@ -357,12 +357,12 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
globals.validate();
- for (cache = globals.internalGetHead(); cache != NULL; cache = cache->fNext) {
+ for (cache = globals.internalGetHead(); cache != nullptr; cache = cache->fNext) {
if (cache->fDesc->equals(*desc)) {
globals.internalDetachCache(cache);
if (!proc(cache, context)) {
globals.internalAttachCacheToHead(cache);
- cache = NULL;
+ cache = nullptr;
}
return cache;
}
@@ -388,14 +388,14 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
if (!proc(cache, context)) { // need to reattach
globals.attachCacheToHead(cache);
- cache = NULL;
+ cache = nullptr;
}
return cache;
}
void SkGlyphCache::AttachCache(SkGlyphCache* cache) {
SkASSERT(cache);
- SkASSERT(cache->fNext == NULL);
+ SkASSERT(cache->fNext == nullptr);
get_globals().attachCacheToHead(cache);
}
@@ -431,7 +431,7 @@ void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
globals.validate();
- for (cache = globals.internalGetHead(); cache != NULL; cache = cache->fNext) {
+ for (cache = globals.internalGetHead(); cache != nullptr; cache = cache->fNext) {
visitor(*cache, context);
}
}
@@ -489,7 +489,7 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) {
// we start at the tail and proceed backwards, as the linklist is in LRU
// order, with unimportant entries at the tail.
SkGlyphCache* cache = this->internalGetTail();
- while (cache != NULL &&
+ while (cache != nullptr &&
(bytesFreed < bytesNeeded || countFreed < countNeeded)) {
SkGlyphCache* prev = cache->fPrev;
bytesFreed += cache->fMemoryUsed;
@@ -513,7 +513,7 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) {
}
void SkGlyphCache_Globals::internalAttachCacheToHead(SkGlyphCache* cache) {
- SkASSERT(NULL == cache->fPrev && NULL == cache->fNext);
+ SkASSERT(nullptr == cache->fPrev && nullptr == cache->fNext);
if (fHead) {
fHead->fPrev = cache;
cache->fNext = fHead;
@@ -537,7 +537,7 @@ void SkGlyphCache_Globals::internalDetachCache(SkGlyphCache* cache) {
if (cache->fNext) {
cache->fNext->fPrev = cache->fPrev;
}
- cache->fPrev = cache->fNext = NULL;
+ cache->fPrev = cache->fNext = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -562,7 +562,7 @@ void SkGlyphCache_Globals::validate() const {
int computedCount = 0;
const SkGlyphCache* head = fHead;
- while (head != NULL) {
+ while (head != nullptr) {
computedBytes += head->fMemoryUsed;
computedCount += 1;
head = head->fNext;
diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h
index dc2aa579a7..706204173d 100644
--- a/src/core/SkGlyphCache.h
+++ b/src/core/SkGlyphCache.h
@@ -117,7 +117,7 @@ public:
/** Find a matching cache entry, and call proc() with it. If none is found create a new one.
If the proc() returns true, detach the cache and return it, otherwise leave it and return
- NULL.
+ nullptr.
*/
static SkGlyphCache* VisitCache(SkTypeface*, const SkDescriptor* desc,
bool (*proc)(const SkGlyphCache*, void*),
@@ -136,7 +136,7 @@ public:
win is that different thread will never block each other while a strike is being used.
*/
static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* desc) {
- return VisitCache(typeface, desc, DetachProc, NULL);
+ return VisitCache(typeface, desc, DetachProc, nullptr);
}
static void Dump();
@@ -163,7 +163,7 @@ public:
}
}
void forget() {
- fCache = NULL;
+ fCache = nullptr;
}
private:
const SkGlyphCache* fCache;
@@ -249,7 +249,7 @@ public:
void release() {
if (fCache) {
SkGlyphCache::AttachCache(fCache);
- fCache = NULL;
+ fCache = nullptr;
}
}
@@ -263,10 +263,10 @@ protected:
SkAutoGlyphCacheBase(const SkPaint& /*paint*/,
const SkSurfaceProps* /*surfaceProps*/,
const SkMatrix* /*matrix*/) {
- fCache = NULL;
+ fCache = nullptr;
}
SkAutoGlyphCacheBase() {
- fCache = NULL;
+ fCache = nullptr;
}
~SkAutoGlyphCacheBase() {
if (fCache) {
diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h
index 70d80208d4..e1825a2f0f 100644
--- a/src/core/SkGlyphCache_Globals.h
+++ b/src/core/SkGlyphCache_Globals.h
@@ -26,7 +26,7 @@
class SkGlyphCache_Globals {
public:
SkGlyphCache_Globals() {
- fHead = NULL;
+ fHead = nullptr;
fTotalMemoryUsed = 0;
fCacheSizeLimit = SK_DEFAULT_FONT_CACHE_LIMIT;
fCacheCount = 0;
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index c9aa121d26..dc6b0f2c1a 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -34,7 +34,7 @@ public:
/**
* Returns a ref() on the texture produced by this generator. The caller must call unref()
- * when it is done. Will return NULL on failure.
+ * when it is done. Will return nullptr on failure.
*
* The caller is responsible for calling texture->unref() when they are done.
*/
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 90f14c55dc..cda3e053b9 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -182,7 +182,7 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)),
fUniqueID(next_image_filter_unique_id()) {
for (int i = 0; i < inputCount; ++i) {
- if (NULL == inputs[i] || inputs[i]->usesSrcInput()) {
+ if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) {
fUsesSrcInput = true;
}
fInputs[i] = inputs[i];
@@ -207,13 +207,13 @@ SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer)
fInputs = new SkImageFilter* [fInputCount];
common.detachInputs(fInputs);
for (int i = 0; i < fInputCount; ++i) {
- if (NULL == fInputs[i] || fInputs[i]->usesSrcInput()) {
+ if (nullptr == fInputs[i] || fInputs[i]->usesSrcInput()) {
fUsesSrcInput = true;
}
}
} else {
fInputCount = 0;
- fInputs = NULL;
+ fInputs = nullptr;
}
}
@@ -221,8 +221,8 @@ void SkImageFilter::flatten(SkWriteBuffer& buffer) const {
buffer.writeInt(fInputCount);
for (int i = 0; i < fInputCount; i++) {
SkImageFilter* input = getInput(i);
- buffer.writeBool(input != NULL);
- if (input != NULL) {
+ buffer.writeBool(input != nullptr);
+ if (input != nullptr) {
buffer.writeFlattenable(input);
}
}
@@ -307,7 +307,7 @@ bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const Context&,
}
bool SkImageFilter::canFilterImageGPU() const {
- return this->asFragmentProcessor(NULL, NULL, NULL, SkMatrix::I(), SkIRect());
+ return this->asFragmentProcessor(nullptr, nullptr, nullptr, SkMatrix::I(), SkIRect());
}
bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
@@ -464,7 +464,7 @@ bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
- SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(context, *result, NULL));
+ SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(context, *result, nullptr));
result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
}
return true;
@@ -587,8 +587,8 @@ SkBaseDevice* SkImageFilter::Proxy::createDevice(int w, int h) {
SkBaseDevice::kNever_TileUsage,
kUnknown_SkPixelGeometry,
true /*forImageFilter*/);
- SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, NULL);
- if (NULL == dev) {
+ SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, nullptr);
+ if (nullptr == dev) {
const SkSurfaceProps surfaceProps(fDevice->fSurfaceProps.flags(),
kUnknown_SkPixelGeometry);
dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index ffccb611d8..33da50a41d 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -18,7 +18,7 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return false;
}
if (rowBytes < info.minRowBytes()) {
@@ -26,15 +26,15 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
}
if (kIndex_8_SkColorType == info.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return false;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
const bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount);
@@ -49,7 +49,7 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
if (kIndex_8_SkColorType == info.colorType()) {
return false;
}
- return this->getPixels(info, pixels, rowBytes, NULL, NULL);
+ return this->getPixels(info, pixels, rowBytes, nullptr, nullptr);
}
bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
@@ -62,9 +62,9 @@ bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t r
((planes[0]) && (planes[1]) && (planes[2]) &&
(0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2]));
bool isValidWithoutPlanes =
- ((NULL == planes) ||
- ((NULL == planes[0]) && (NULL == planes[1]) && (NULL == planes[2]))) &&
- ((NULL == rowBytes) ||
+ ((nullptr == planes) ||
+ ((nullptr == planes[0]) && (nullptr == planes[1]) && (nullptr == planes[2]))) &&
+ ((nullptr == rowBytes) ||
((0 == rowBytes[0]) && (0 == rowBytes[1]) && (0 == rowBytes[2])));
// Either we have all planes and rowBytes information or we have none of it
@@ -115,7 +115,7 @@ GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData() {
- return NULL;
+ return nullptr;
}
bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb,
@@ -138,8 +138,8 @@ SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory
}
SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
if (gFactory) {
if (SkImageGenerator* generator = gFactory(data)) {
diff --git a/src/core/SkImageGeneratorPriv.h b/src/core/SkImageGeneratorPriv.h
index 5d018bcb79..bf035967a2 100644
--- a/src/core/SkImageGeneratorPriv.h
+++ b/src/core/SkImageGeneratorPriv.h
@@ -17,7 +17,7 @@
* the generator. If it succeeds, it will modify destination
* bitmap.
*
- * If generator is NULL, will safely return false.
+ * If generator is nullptr, will safely return false.
*
* If this fails or when the SkDiscardablePixelRef that is
* installed into destination is destroyed, it will call
@@ -27,8 +27,8 @@
* @param destination Upon success, this bitmap will be
* configured and have a pixelref installed.
*
- * @param factory If not NULL, this object will be used as a
- * source of discardable memory when decoding. If NULL, then
+ * @param factory If not nullptr, this object will be used as a
+ * source of discardable memory when decoding. If nullptr, then
* SkDiscardableMemory::Create() will be called.
*
* @return true iff successful.
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 8429ef28c3..b90f858562 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -90,7 +90,7 @@ bool SkReadPixelsRec::trim(int srcWidth, int srcHeight) {
default:
break;
}
- if (NULL == fPixels || fRowBytes < fInfo.minRowBytes()) {
+ if (nullptr == fPixels || fRowBytes < fInfo.minRowBytes()) {
return false;
}
if (0 == fInfo.width() || 0 == fInfo.height()) {
diff --git a/src/core/SkLayerInfo.h b/src/core/SkLayerInfo.h
index 5d598ef50a..04ae1794a2 100644
--- a/src/core/SkLayerInfo.h
+++ b/src/core/SkLayerInfo.h
@@ -18,7 +18,7 @@ public:
// Information about a given saveLayer/restore block in an SkPicture
class BlockInfo {
public:
- BlockInfo() : fPicture(NULL), fPaint(NULL), fKey(NULL), fKeySize(0) {}
+ BlockInfo() : fPicture(nullptr), fPaint(nullptr), fKey(nullptr), fKeySize(0) {}
~BlockInfo() {
SkSafeUnref(fPicture);
delete fPaint;
@@ -27,8 +27,8 @@ public:
// The picture owning the layer. If the owning picture is the top-most
// one (i.e., the picture for which this SkLayerInfo was created) then
- // this pointer is NULL. If it is a nested picture then the pointer
- // is non-NULL and owns a ref on the picture.
+ // this pointer is nullptr. If it is a nested picture then the pointer
+ // is non-nullptr and owns a ref on the picture.
const SkPicture* fPicture;
// The device space bounds of this layer.
SkRect fBounds;
@@ -46,7 +46,7 @@ public:
// layer's top-left point to the origin (which must be part of the
// initial matrix).
SkMatrix fLocalMat;
- // The paint to use on restore. Can be NULL since it is optional.
+ // The paint to use on restore. Can be nullptr since it is optional.
const SkPaint* fPaint;
// The index of this saveLayer in the picture.
size_t fSaveLayerOpID;
diff --git a/src/core/SkLazyFnPtr.h b/src/core/SkLazyFnPtr.h
index 9e9bc1165c..153578201a 100644
--- a/src/core/SkLazyFnPtr.h
+++ b/src/core/SkLazyFnPtr.h
@@ -42,7 +42,7 @@ public:
F get() {
// First, try reading to see if it's already set.
F fn = (F)sk_atomic_load(&fPtr, sk_memory_order_relaxed);
- if (fn != NULL) {
+ if (fn != nullptr) {
return fn;
}
@@ -50,11 +50,11 @@ public:
fn = Choose();
// No particular memory barriers needed; we're not guarding anything but the pointer itself.
- F prev = (F)sk_atomic_cas(&fPtr, NULL, (void*)fn);
+ F prev = (F)sk_atomic_cas(&fPtr, nullptr, (void*)fn);
- // If prev != NULL, someone snuck in and set fPtr concurrently.
- // If prev == NULL, we did write fn to fPtr.
- return prev != NULL ? prev : fn;
+ // If prev != nullptr, someone snuck in and set fPtr concurrently.
+ // If prev == nullptr, we did write fn to fPtr.
+ return prev != nullptr ? prev : fn;
}
private:
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 0e20db44de..a8d346ab1e 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -176,22 +176,22 @@ public:
GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuilder();
// add uniforms
- const char* lightDirUniName = NULL;
+ const char* lightDirUniName = nullptr;
fLightDirUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"LightDir", &lightDirUniName);
- const char* lightColorUniName = NULL;
+ const char* lightColorUniName = nullptr;
fLightColorUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"LightColor", &lightColorUniName);
- const char* ambientColorUniName = NULL;
+ const char* ambientColorUniName = nullptr;
fAmbientColorUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"AmbientColor", &ambientColorUniName);
- const char* xformUniName = NULL;
+ const char* xformUniName = nullptr;
fXformUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"Xform", &xformUniName);
@@ -578,13 +578,13 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkBitmap diffuse;
if (!buf.readBitmap(&diffuse)) {
- return NULL;
+ return nullptr;
}
diffuse.setImmutable();
SkBitmap normal;
if (!buf.readBitmap(&normal)) {
- return NULL;
+ return nullptr;
}
normal.setImmutable();
@@ -597,7 +597,7 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkColor3f color;
if (!buf.readScalarArray(&color.fX, 3)) {
- return NULL;
+ return nullptr;
}
if (isAmbient) {
@@ -605,7 +605,7 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
} else {
SkVector3 dir;
if (!buf.readScalarArray(&dir.fX, 3)) {
- return NULL;
+ return nullptr;
}
builder.add(SkLight(color, dir));
}
@@ -665,7 +665,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
SkMatrix normTotalInv;
if (!this->computeNormTotalInverse(rec, &normTotalInv)) {
- return NULL;
+ return nullptr;
}
void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext);
@@ -677,7 +677,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
diffuseState->fOrigBitmap = fDiffuseMap;
if (!diffuseState->chooseProcs(diffTotalInv, *rec.fPaint)) {
diffuseState->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState);
@@ -690,7 +690,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
if (!normalState->chooseProcs(normTotalInv, *rec.fPaint)) {
diffuseState->~SkBitmapProcState();
normalState->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
return new (storage) LightingShaderContext(*this, rec, diffuseState, normalState);
diff --git a/src/core/SkLightingShader.h b/src/core/SkLightingShader.h
index d28648767d..f87db31edb 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -73,7 +73,7 @@ public:
@param ambient the linear (unpremul) ambient light color. Range is 0..1/channel.
@param localMatrix the matrix mapping the textures to the dest rect
- NULL will be returned if:
+ nullptr will be returned if:
either 'diffuse' or 'normal' are empty
either 'diffuse' or 'normal' are too big (> 65535 on a side)
'diffuse' and 'normal' aren't the same size
diff --git a/src/core/SkLocalMatrixShader.cpp b/src/core/SkLocalMatrixShader.cpp
index b9a0960873..ce5a7cad71 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -12,7 +12,7 @@ SkFlattenable* SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
buffer.readMatrix(&lm);
SkAutoTUnref<SkShader> shader(buffer.readShader());
if (!shader.get()) {
- return NULL;
+ return nullptr;
}
return SkShader::CreateLocalMatrixShader(shader, lm);
}
@@ -48,8 +48,8 @@ void SkLocalMatrixShader::toString(SkString* str) const {
#endif
SkShader* SkShader::CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) {
- if (NULL == proxy) {
- return NULL;
+ if (nullptr == proxy) {
+ return nullptr;
}
if (localMatrix.isIdentity()) {
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 491651080b..0196e046b1 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -27,7 +27,7 @@ static bool is_valid(const SkImageInfo& info, SkColorTable* ctable) {
// that expect the pixelref to succeed even when there is a mismatch
// with colortables. fix?
#if 0
- if (kIndex8_SkColorType == info.fColorType && NULL == ctable) {
+ if (kIndex8_SkColorType == info.fColorType && nullptr == ctable) {
return false;
}
if (kIndex8_SkColorType != info.fColorType && ctable) {
@@ -42,9 +42,9 @@ SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
size_t rowBytes,
SkColorTable* ctable) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
- return new SkMallocPixelRef(info, addr, rowBytes, ctable, NULL, NULL);
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, nullptr, nullptr);
}
@@ -52,16 +52,16 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
size_t requestedRowBytes,
SkColorTable* ctable) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
// only want to permit 31bits of rowBytes
int64_t minRB = (int64_t)info.minRowBytes64();
if (minRB < 0 || !sk_64_isS32(minRB)) {
- return NULL; // allocation will be too large
+ return nullptr; // allocation will be too large
}
if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) {
- return NULL; // cannot meet requested rowbytes
+ return nullptr; // cannot meet requested rowbytes
}
int32_t rowBytes;
@@ -73,17 +73,17 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
int64_t bigSize = (int64_t)info.height() * rowBytes;
if (!sk_64_isS32(bigSize)) {
- return NULL;
+ return nullptr;
}
size_t size = sk_64_asS32(bigSize);
SkASSERT(size >= info.getSafeSize(rowBytes));
void* addr = sk_malloc_flags(size, 0);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
- return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, NULL);
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, nullptr);
}
SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
@@ -93,7 +93,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
SkMallocPixelRef::ReleaseProc proc,
void* context) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
return new SkMallocPixelRef(info, addr, rowBytes, ctable, proc, context);
}
@@ -106,19 +106,19 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
size_t rowBytes,
SkColorTable* ctable,
SkData* data) {
- SkASSERT(data != NULL);
+ SkASSERT(data != nullptr);
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
if ((rowBytes < info.minRowBytes())
|| (data->size() < info.getSafeSize(rowBytes))) {
- return NULL;
+ return nullptr;
}
data->ref();
SkMallocPixelRef* pr =
new SkMallocPixelRef(info, const_cast<void*>(data->data()), rowBytes, ctable,
sk_data_releaseproc, static_cast<void*>(data));
- SkASSERT(pr != NULL);
+ SkASSERT(pr != nullptr);
// We rely on the immutability of the pixels to make the
// const_cast okay.
pr->setImmutable();
@@ -131,14 +131,14 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
size_t rowBytes, SkColorTable* ctable,
bool ownsPixels)
: INHERITED(info)
- , fReleaseProc(ownsPixels ? sk_free_releaseproc : NULL)
- , fReleaseProcContext(NULL) {
+ , fReleaseProc(ownsPixels ? sk_free_releaseproc : nullptr)
+ , fReleaseProcContext(nullptr) {
// This constructor is now DEPRICATED.
SkASSERT(is_valid(info, ctable));
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- ctable = NULL;
+ ctable = nullptr;
}
fStorage = storage;
@@ -161,7 +161,7 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- ctable = NULL;
+ ctable = nullptr;
}
fStorage = storage;
@@ -175,7 +175,7 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
SkMallocPixelRef::~SkMallocPixelRef() {
SkSafeUnref(fCTable);
- if (fReleaseProc != NULL) {
+ if (fReleaseProc != nullptr) {
fReleaseProc(fStorage, fReleaseProcContext);
}
}
diff --git a/src/core/SkMaskCache.cpp b/src/core/SkMaskCache.cpp
index cc729c3bbb..da7b538d3e 100644
--- a/src/core/SkMaskCache.cpp
+++ b/src/core/SkMaskCache.cpp
@@ -64,7 +64,7 @@ struct RRectBlurRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -79,7 +79,7 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
MaskValue result;
RRectBlurKey key(sigma, rrect, style, quality);
if (!CHECK_LOCAL(localCache, find, Find, key, RRectBlurRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*mask = result.fMask;
@@ -159,7 +159,7 @@ struct RectsBlurRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -175,7 +175,7 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
MaskValue result;
RectsBlurKey key(sigma, style, quality, rects, count);
if (!CHECK_LOCAL(localCache, find, Find, key, RectsBlurRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*mask = result.fMask;
diff --git a/src/core/SkMaskCache.h b/src/core/SkMaskCache.h
index f98387b206..9df1bf8601 100644
--- a/src/core/SkMaskCache.h
+++ b/src/core/SkMaskCache.h
@@ -21,24 +21,24 @@ public:
* On success, return a ref to the SkCachedData that holds the pixels, and have mask
* already point to that memory.
*
- * On failure, return NULL.
+ * On failure, return nullptr.
*/
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRRect& rrect, SkMask* mask,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRect rects[], int count, SkMask* mask,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* Add a mask and its pixel-data to the cache.
*/
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
};
#endif
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 5e7cee6bd6..7c48bcacb9 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -222,11 +222,11 @@ bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix,
// cannot be used, return false to allow our caller to recover and perform
// the drawing another way.
NinePatch patch;
- patch.fMask.fImage = NULL;
+ patch.fMask.fImage = nullptr;
if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
clip.getBounds(),
&patch)) {
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
return false;
}
draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
@@ -246,7 +246,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds(), &patch)) {
case kFalse_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
return false;
case kTrue_FilterReturn:
@@ -255,7 +255,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
return true;
case kUnimplemented_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
// fall through
break;
}
@@ -270,7 +270,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
}
SkAutoMaskFreeImage autoSrc(srcM.fImage);
- if (!this->filterMask(&dstM, srcM, matrix, NULL)) {
+ if (!this->filterMask(&dstM, srcM, matrix, nullptr)) {
return false;
}
SkAutoMaskFreeImage autoDst(dstM.fImage);
@@ -351,7 +351,7 @@ bool SkMaskFilter::filterMaskGPU(GrTexture* src,
void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
SkMask srcM, dstM;
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
srcM.fBounds = src.roundOut();
srcM.fRowBytes = 0;
srcM.fFormat = SkMask::kA8_Format;
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index be5d034c81..16ea47b1b0 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -168,7 +168,7 @@ private:
* convert a linear alpha value for a given channel to a gamma correcting alpha
* value for that channel. This class is immutable.
*
- * If fR, fG, or fB is NULL, all of them will be. This indicates that no mask
+ * If fR, fG, or fB is nullptr, all of them will be. This indicates that no mask
* pre blend should be applied. SkTMaskPreBlend::isApplicable() is provided as
* a convenience function to test for the absence of this case.
*/
@@ -182,7 +182,7 @@ private:
friend class SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>;
public:
/** Creates a non applicable SkTMaskPreBlend. */
- SkTMaskPreBlend() : fParent(), fR(NULL), fG(NULL), fB(NULL) { }
+ SkTMaskPreBlend() : fParent(), fR(nullptr), fG(nullptr), fB(nullptr) { }
/**
* This copy contructor exists for correctness, but should never be called
@@ -193,7 +193,7 @@ public:
~SkTMaskPreBlend() { }
- /** True if this PreBlend should be applied. When false, fR, fG, and fB are NULL. */
+ /** True if this PreBlend should be applied. When false, fR, fG, and fB are nullptr. */
bool isApplicable() const { return SkToBool(this->fG); }
const uint8_t* fR;
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index f5e4e803f2..13a9ac28f0 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -858,7 +858,7 @@ bool SkMatrix::invertNonIdentity(SkMatrix* inv) const {
// translate only
inv->setTranslate(-fMat[kMTransX], -fMat[kMTransY]);
}
- } else { // inv is NULL, just check if we're invertible
+ } else { // inv is nullptr, just check if we're invertible
if (!fMat[kMScaleX] || !fMat[kMScaleY]) {
invertible = false;
}
@@ -878,7 +878,7 @@ bool SkMatrix::invertNonIdentity(SkMatrix* inv) const {
SkMatrix* tmp = inv;
SkMatrix storage;
- if (applyingInPlace || NULL == tmp) {
+ if (applyingInPlace || nullptr == tmp) {
tmp = &storage; // we either need to avoid trampling memory or have no memory
}
diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp
index b6f6fc8a43..823647f3de 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -72,7 +72,7 @@ bool SkMatrixImageFilter::onFilterImage(Proxy* proxy,
dstRect.roundOut(&dstBounds);
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dstBounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
diff --git a/src/core/SkMatrixImageFilter.h b/src/core/SkMatrixImageFilter.h
index 83f2cfaf33..86734b629c 100644
--- a/src/core/SkMatrixImageFilter.h
+++ b/src/core/SkMatrixImageFilter.h
@@ -24,13 +24,13 @@ public:
/** Construct a 2D transformation image filter.
* @param transform The matrix to apply when drawing the src bitmap
* @param filterLevel The quality of filtering to apply when scaling.
- * @param input The input image filter. If NULL, the src bitmap
+ * @param input The input image filter. If nullptr, the src bitmap
* passed to filterImage() is used instead.
*/
static SkMatrixImageFilter* Create(const SkMatrix& transform,
SkFilterQuality,
- SkImageFilter* input = NULL);
+ SkImageFilter* input = nullptr);
virtual ~SkMatrixImageFilter();
void computeFastBounds(const SkRect&, SkRect*) const override;
diff --git a/src/core/SkMetaData.cpp b/src/core/SkMetaData.cpp
index dfc2a94901..dd6ed05571 100644
--- a/src/core/SkMetaData.cpp
+++ b/src/core/SkMetaData.cpp
@@ -27,11 +27,11 @@ void* SkMetaData::RefCntProc(void* ptr, bool doRef) {
return ptr;
}
-SkMetaData::SkMetaData() : fRec(NULL)
+SkMetaData::SkMetaData() : fRec(nullptr)
{
}
-SkMetaData::SkMetaData(const SkMetaData& src) : fRec(NULL)
+SkMetaData::SkMetaData(const SkMetaData& src) : fRec(nullptr)
{
*this = src;
}
@@ -55,7 +55,7 @@ void SkMetaData::reset()
Rec::Free(rec);
rec = next;
}
- fRec = NULL;
+ fRec = nullptr;
}
SkMetaData& SkMetaData::operator=(const SkMetaData& src)
@@ -86,7 +86,7 @@ SkScalar* SkMetaData::setScalars(const char name[], int count, const SkScalar va
SkASSERT(count > 0);
if (count > 0)
return (SkScalar*)this->set(name, values, sizeof(SkScalar), kScalar_Type, count);
- return NULL;
+ return nullptr;
}
void SkMetaData::setString(const char name[], const char value[])
@@ -179,7 +179,7 @@ const SkScalar* SkMetaData::findScalars(const char name[], int* count, SkScalar
memcpy(values, rec->data(), rec->fDataCount * rec->fDataLen);
return (const SkScalar*)rec->data();
}
- return NULL;
+ return nullptr;
}
bool SkMetaData::findPtr(const char name[], void** ptr, PtrProc* proc) const {
@@ -201,8 +201,8 @@ bool SkMetaData::findPtr(const char name[], void** ptr, PtrProc* proc) const {
const char* SkMetaData::findString(const char name[]) const
{
const Rec* rec = this->find(name, kString_Type);
- SkASSERT(rec == NULL || rec->fDataLen == sizeof(char));
- return rec ? (const char*)rec->data() : NULL;
+ SkASSERT(rec == nullptr || rec->fDataLen == sizeof(char));
+ return rec ? (const char*)rec->data() : nullptr;
}
bool SkMetaData::findBool(const char name[], bool* value) const
@@ -227,7 +227,7 @@ const void* SkMetaData::findData(const char name[], size_t* length) const {
}
return rec->data();
}
- return NULL;
+ return nullptr;
}
const SkMetaData::Rec* SkMetaData::find(const char name[], Type type) const
@@ -239,12 +239,12 @@ const SkMetaData::Rec* SkMetaData::find(const char name[], Type type) const
return rec;
rec = rec->fNext;
}
- return NULL;
+ return nullptr;
}
bool SkMetaData::remove(const char name[], Type type) {
Rec* rec = fRec;
- Rec* prev = NULL;
+ Rec* prev = nullptr;
while (rec) {
Rec* next = rec->fNext;
if (rec->fType == type && !strcmp(rec->name(), name)) {
@@ -309,7 +309,7 @@ void SkMetaData::Iter::reset(const SkMetaData& metadata) {
}
const char* SkMetaData::Iter::next(SkMetaData::Type* t, int* count) {
- const char* name = NULL;
+ const char* name = nullptr;
if (fRec) {
if (t) {
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 8a62f88ab2..6e0aaed697 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -206,7 +206,7 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
proc_nocheck = downsample8_nocheck;
break;
default:
- return NULL; // don't build mipmaps for any other colortypes (yet)
+ return nullptr; // don't build mipmaps for any other colortypes (yet)
}
// whip through our loop to compute the exact size needed
@@ -226,29 +226,29 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
}
}
if (0 == countLevels) {
- return NULL;
+ return nullptr;
}
size_t storageSize = SkMipMap::AllocLevelsSize(countLevels, size);
if (0 == storageSize) {
- return NULL;
+ return nullptr;
}
SkAutoPixmapUnlock srcUnlocker;
if (!src.requestLock(&srcUnlocker)) {
- return NULL;
+ return nullptr;
}
const SkPixmap& srcPixmap = srcUnlocker.pixmap();
- // Try to catch where we might have returned NULL for src crbug.com/492818
- if (NULL == srcPixmap.addr()) {
+ // Try to catch where we might have returned nullptr for src crbug.com/492818
+ if (nullptr == srcPixmap.addr()) {
sk_throw();
}
SkMipMap* mipmap;
if (fact) {
SkDiscardableMemory* dm = fact(storageSize);
- if (NULL == dm) {
- return NULL;
+ if (nullptr == dm) {
+ return nullptr;
}
mipmap = new SkMipMap(storageSize, dm);
} else {
@@ -321,7 +321,7 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
///////////////////////////////////////////////////////////////////////////////
bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
- if (NULL == fLevels) {
+ if (nullptr == fLevels) {
return false;
}
diff --git a/src/core/SkMipMap.h b/src/core/SkMipMap.h
index e22c0a2181..36c17ba91e 100644
--- a/src/core/SkMipMap.h
+++ b/src/core/SkMipMap.h
@@ -31,7 +31,7 @@ public:
protected:
void onDataChange(void* oldData, void* newData) override {
- fLevels = (Level*)newData; // could be NULL
+ fLevels = (Level*)newData; // could be nullptr
}
private:
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 8cbb9ca60f..4003808310 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -37,7 +37,7 @@ void SkMultiPictureDraw::DrawData::init(SkCanvas* canvas, const SkPicture* pictu
if (paint) {
fPaint = new SkPaint(*paint);
} else {
- fPaint = NULL;
+ fPaint = nullptr;
}
}
@@ -68,8 +68,8 @@ void SkMultiPictureDraw::add(SkCanvas* canvas,
const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) {
- if (NULL == canvas || NULL == picture) {
- SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-NULL");
+ if (nullptr == canvas || nullptr == picture) {
+ SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-nullptr");
return;
}
@@ -179,7 +179,7 @@ void SkMultiPictureDraw::draw(bool flush) {
// Render the entire picture using new layers
GrRecordReplaceDraw(picture, canvas, context->getLayerCache(),
- initialMatrix, NULL);
+ initialMatrix, nullptr);
GrLayerHoister::UnlockLayers(context, needRendering);
GrLayerHoister::UnlockLayers(context, recycled);
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 7fd0b9d227..c1097204c4 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -40,16 +40,16 @@
//#define SK_REPORT_API_RANGE_CHECK
SkPaint::SkPaint() {
- fTypeface = NULL;
- fPathEffect = NULL;
- fShader = NULL;
- fXfermode = NULL;
- fMaskFilter = NULL;
- fColorFilter = NULL;
- fRasterizer = NULL;
- fLooper = NULL;
- fImageFilter = NULL;
- fAnnotation = NULL;
+ fTypeface = nullptr;
+ fPathEffect = nullptr;
+ fShader = nullptr;
+ fXfermode = nullptr;
+ fMaskFilter = nullptr;
+ fColorFilter = nullptr;
+ fRasterizer = nullptr;
+ fLooper = nullptr;
+ fImageFilter = nullptr;
+ fAnnotation = nullptr;
fTextSize = SkPaintDefaults_TextSize;
fTextScaleX = SK_Scalar1;
@@ -398,9 +398,9 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return 0;
}
- SkASSERT(textData != NULL);
+ SkASSERT(textData != nullptr);
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
switch (this->getTextEncoding()) {
case kUTF8_TextEncoding:
return SkUTF8_CountUnichars((const char*)textData, byteLength);
@@ -425,7 +425,7 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return SkToInt(byteLength >> 1);
}
- SkAutoGlyphCache autoCache(*this, NULL, NULL);
+ SkAutoGlyphCache autoCache(*this, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
const char* text = (const char*)textData;
@@ -465,7 +465,7 @@ bool SkPaint::containsText(const void* textData, size_t byteLength) const {
return true;
}
- SkASSERT(textData != NULL);
+ SkASSERT(textData != nullptr);
// handle this encoding before the setup for the glyphcache
if (this->getTextEncoding() == kGlyphID_TextEncoding) {
@@ -479,7 +479,7 @@ bool SkPaint::containsText(const void* textData, size_t byteLength) const {
return true;
}
- SkAutoGlyphCache autoCache(*this, NULL, NULL);
+ SkAutoGlyphCache autoCache(*this, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
switch (this->getTextEncoding()) {
@@ -525,11 +525,11 @@ void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar tex
return;
}
- SkASSERT(glyphs != NULL);
- SkASSERT(textData != NULL);
+ SkASSERT(glyphs != nullptr);
+ SkASSERT(textData != nullptr);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- SkAutoGlyphCache autoCache(*this, &props, NULL);
+ SkAutoGlyphCache autoCache(*this, &props, nullptr);
SkGlyphCache* cache = autoCache.getCache();
for (int index = 0; index < count; index++) {
@@ -541,24 +541,24 @@ void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar tex
static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getMetrics_utf16_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -568,8 +568,8 @@ static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -580,24 +580,24 @@ static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache,
static const SkGlyph& sk_getAdvance_utf8_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharAdvance(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getAdvance_utf16_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharAdvance(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -607,8 +607,8 @@ static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache,
static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -644,32 +644,32 @@ SkMeasureCacheProc SkPaint::getMeasureCacheProc(bool needFullMetrics) const {
static const SkGlyph& sk_getMetrics_utf8_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getMetrics_utf8_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text), x, y);
}
static const SkGlyph& sk_getMetrics_utf16_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getMetrics_utf16_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text),
x, y);
@@ -677,8 +677,8 @@ static const SkGlyph& sk_getMetrics_utf16_xy(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_utf32_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -688,8 +688,8 @@ static const SkGlyph& sk_getMetrics_utf32_00(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_utf32_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -699,8 +699,8 @@ static const SkGlyph& sk_getMetrics_utf32_xy(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -711,8 +711,8 @@ static const SkGlyph& sk_getMetrics_glyph_00(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -835,7 +835,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
return 0;
}
- SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(NULL != bounds);
+ SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(nullptr != bounds);
int xyIndex;
JoinBoundsProc joinBoundsProc;
@@ -857,7 +857,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkAutoKern autokern;
- if (NULL == bounds) {
+ if (nullptr == bounds) {
if (this->isDevKernText()) {
int rsb;
for (; text < stop; n++) {
@@ -897,13 +897,13 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkScalar SkPaint::measureText(const void* textData, size_t length, SkRect* bounds) const {
const char* text = (const char*)textData;
- SkASSERT(text != NULL || length == 0);
+ SkASSERT(text != nullptr || length == 0);
SkCanonicalizePaint canon(*this);
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkScalar width = 0;
@@ -944,7 +944,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
return length;
}
- SkASSERT(textD != NULL);
+ SkASSERT(textD != nullptr);
const char* text = (const char*)textD;
const char* stop = text + length;
@@ -957,7 +957,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
maxWidth /= scale;
}
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc = paint.getMeasureCacheProc(false);
@@ -1022,18 +1022,18 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkMatrix zoomMatrix, *zoomPtr = NULL;
+ SkMatrix zoomMatrix, *zoomPtr = nullptr;
if (zoom) {
zoomMatrix.setScale(zoom, zoom);
zoomPtr = &zoomMatrix;
}
FontMetrics storage;
- if (NULL == metrics) {
+ if (nullptr == metrics) {
metrics = &storage;
}
- paint.descriptorProc(NULL, zoomPtr, FontMetricsDescProc, metrics, true);
+ paint.descriptorProc(nullptr, zoomPtr, FontMetricsDescProc, metrics, true);
if (scale) {
metrics->fTop = SkScalarMul(metrics->fTop, scale);
@@ -1068,7 +1068,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
SkASSERT(textData);
- if (NULL == widths && NULL == bounds) {
+ if (nullptr == widths && nullptr == bounds) {
return this->countText(textData, byteLength);
}
@@ -1076,10 +1076,10 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc;
- glyphCacheProc = paint.getMeasureCacheProc(NULL != bounds);
+ glyphCacheProc = paint.getMeasureCacheProc(nullptr != bounds);
const char* text = (const char*)textData;
const char* stop = text + byteLength;
@@ -1168,10 +1168,10 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
void SkPaint::getTextPath(const void* textData, size_t length,
SkScalar x, SkScalar y, SkPath* path) const {
- SkASSERT(length == 0 || textData != NULL);
+ SkASSERT(length == 0 || textData != nullptr);
const char* text = (const char*)textData;
- if (text == NULL || length == 0 || path == NULL) {
+ if (text == nullptr || length == 0 || path == nullptr) {
return;
}
@@ -1196,10 +1196,10 @@ void SkPaint::getTextPath(const void* textData, size_t length,
void SkPaint::getPosTextPath(const void* textData, size_t length,
const SkPoint pos[], SkPath* path) const {
- SkASSERT(length == 0 || textData != NULL);
+ SkASSERT(length == 0 || textData != nullptr);
const char* text = (const char*)textData;
- if (text == NULL || length == 0 || path == NULL) {
+ if (text == nullptr || length == 0 || path == nullptr) {
return;
}
@@ -1213,7 +1213,7 @@ void SkPaint::getPosTextPath(const void* textData, size_t length,
unsigned int i = 0;
const SkPath* iterPath;
- while (iter.next(&iterPath, NULL)) {
+ while (iter.next(&iterPath, nullptr)) {
matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
if (iterPath) {
path->addPath(*iterPath, matrix);
@@ -1229,7 +1229,7 @@ SkRect SkPaint::getFontBounds() const {
m.postSkew(fTextSkewX, 0);
SkTypeface* typeface = this->getTypeface();
- if (NULL == typeface) {
+ if (nullptr == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
}
@@ -1240,7 +1240,7 @@ SkRect SkPaint::getFontBounds() const {
static void add_flattenable(SkDescriptor* desc, uint32_t tag,
SkWriteBuffer* buffer) {
- buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL));
+ buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), nullptr));
}
static SkMask::Format compute_mask_format(const SkPaint& paint) {
@@ -1329,10 +1329,10 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
const SkSurfaceProps* surfaceProps,
const SkMatrix* deviceMatrix,
Rec* rec) {
- SkASSERT(deviceMatrix == NULL || !deviceMatrix->hasPerspective());
+ SkASSERT(deviceMatrix == nullptr || !deviceMatrix->hasPerspective());
SkTypeface* typeface = paint.getTypeface();
- if (NULL == typeface) {
+ if (nullptr == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
}
rec->fFontID = typeface->uniqueID();
@@ -1498,8 +1498,8 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
*/
SK_DECLARE_STATIC_MUTEX(gMaskGammaCacheMutex);
-static SkMaskGamma* gLinearMaskGamma = NULL;
-static SkMaskGamma* gMaskGamma = NULL;
+static SkMaskGamma* gLinearMaskGamma = nullptr;
+static SkMaskGamma* gMaskGamma = nullptr;
static SkScalar gContrast = SK_ScalarMin;
static SkScalar gPaintGamma = SK_ScalarMin;
static SkScalar gDeviceGamma = SK_ScalarMin;
@@ -1510,7 +1510,7 @@ static SkScalar gDeviceGamma = SK_ScalarMin;
static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma) {
gMaskGammaCacheMutex.assertHeld();
if (0 == contrast && SK_Scalar1 == paintGamma && SK_Scalar1 == deviceGamma) {
- if (NULL == gLinearMaskGamma) {
+ if (nullptr == gLinearMaskGamma) {
gLinearMaskGamma = new SkMaskGamma;
}
return *gLinearMaskGamma;
@@ -1529,9 +1529,9 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
SkSafeUnref(gLinearMaskGamma);
- gLinearMaskGamma = NULL;
+ gLinearMaskGamma = nullptr;
SkSafeUnref(gMaskGamma);
- gMaskGamma = NULL;
+ gMaskGamma = nullptr;
SkDEBUGCODE(gContrast = SK_ScalarMin;)
SkDEBUGCODE(gPaintGamma = SK_ScalarMin;)
SkDEBUGCODE(gDeviceGamma = SK_ScalarMin;)
@@ -1975,7 +1975,7 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
if (flatFlags & kHasTypeface_FlatFlag) {
this->setTypeface(buffer.readTypeface());
} else {
- this->setTypeface(NULL);
+ this->setTypeface(nullptr);
}
if (flatFlags & kHasEffects_FlatFlag) {
@@ -1992,14 +1992,14 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
this->setAnnotation(SkAnnotation::Create(buffer))->unref();
}
} else {
- this->setPathEffect(NULL);
- this->setShader(NULL);
- this->setXfermode(NULL);
- this->setMaskFilter(NULL);
- this->setColorFilter(NULL);
- this->setRasterizer(NULL);
- this->setLooper(NULL);
- this->setImageFilter(NULL);
+ this->setPathEffect(nullptr);
+ this->setShader(nullptr);
+ this->setXfermode(nullptr);
+ this->setMaskFilter(nullptr);
+ this->setColorFilter(nullptr);
+ this->setRasterizer(nullptr);
+ this->setLooper(nullptr);
+ this->setImageFilter(nullptr);
}
}
@@ -2303,14 +2303,14 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
fGlyphCacheProc = paint.getMeasureCacheProc(true);
fPaint.setLinearText(true);
- fPaint.setMaskFilter(NULL); // don't want this affecting our path-cache lookup
+ fPaint.setMaskFilter(nullptr); // don't want this affecting our path-cache lookup
- if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
+ if (fPaint.getPathEffect() == nullptr && !has_thick_frame(fPaint)) {
applyStrokeAndPathEffects = false;
}
// can't use our canonical size if we need to apply patheffects
- if (fPaint.getPathEffect() == NULL) {
+ if (fPaint.getPathEffect() == nullptr) {
fPaint.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
fScale = paint.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
if (has_thick_frame(fPaint)) {
@@ -2322,13 +2322,13 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
if (!applyStrokeAndPathEffects) {
fPaint.setStyle(SkPaint::kFill_Style);
- fPaint.setPathEffect(NULL);
+ fPaint.setPathEffect(nullptr);
}
- fCache = fPaint.detachCache(NULL, NULL, false);
+ fCache = fPaint.detachCache(nullptr, nullptr, false);
SkPaint::Style style = SkPaint::kFill_Style;
- SkPathEffect* pe = NULL;
+ SkPathEffect* pe = nullptr;
if (!applyStrokeAndPathEffects) {
style = paint.getStyle(); // restore
@@ -2344,7 +2344,7 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
if (paint.getTextAlign() != SkPaint::kLeft_Align) { // need to measure first
int count;
SkScalar width = SkScalarMul(fPaint.measure_text(fCache, text, length,
- &count, NULL), fScale);
+ &count, nullptr), fScale);
if (paint.getTextAlign() == SkPaint::kCenter_Align) {
width = SkScalarHalf(width);
}
@@ -2376,7 +2376,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) {
}
} else {
if (path) {
- *path = NULL;
+ *path = nullptr;
}
}
if (xpos) {
@@ -2398,7 +2398,7 @@ static bool affects_alpha(const SkColorFilter* cf) {
static bool affects_alpha(const SkImageFilter* imf) {
// TODO: check if we should allow imagefilters to broadcast that they don't affect alpha
// ala colorfilters
- return imf != NULL;
+ return imf != nullptr;
}
bool SkPaint::nothingToDraw() const {
diff --git a/src/core/SkPaintPriv.h b/src/core/SkPaintPriv.h
index 708f861b70..a03f9b3390 100644
--- a/src/core/SkPaintPriv.h
+++ b/src/core/SkPaintPriv.h
@@ -23,7 +23,7 @@ public:
};
/**
- * Returns true if drawing with this paint (or NULL) will ovewrite all affected pixels.
+ * Returns true if drawing with this paint (or nullptr) will ovewrite all affected pixels.
*
* Note: returns conservative true, meaning it may return false even though the paint might
* in fact overwrite its pixels.
@@ -35,13 +35,13 @@ public:
}
/**
- * Returns true if drawing this bitmap with this paint (or NULL) will ovewrite all affected
+ * Returns true if drawing this bitmap with this paint (or nullptr) will ovewrite all affected
* pixels.
*/
static bool Overwrites(const SkBitmap&, const SkPaint* paint);
/**
- * Returns true if drawing this image with this paint (or NULL) will ovewrite all affected
+ * Returns true if drawing this image with this paint (or nullptr) will ovewrite all affected
* pixels.
*/
static bool Overwrites(const SkImage*, const SkPaint* paint);
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 05fc7305ce..8da15804de 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -137,7 +137,7 @@ void SkPath::resetFields() {
fFirstDirection = SkPathPriv::kUnknown_FirstDirection;
// We don't touch Android's fSourcePath. It's used to track texture garbage collection, so we
- // don't want to muck with it if it's been set to something non-NULL.
+ // don't want to muck with it if it's been set to something non-nullptr.
}
SkPath::SkPath(const SkPath& that)
@@ -385,7 +385,7 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
int corners = 0;
SkPoint first, last;
const SkPoint* pts = *ptsPtr;
- const SkPoint* savePts = NULL;
+ const SkPoint* savePts = nullptr;
first.set(0, 0);
last.set(0, 0);
int firstDirection = 0;
@@ -531,7 +531,7 @@ bool SkPath::isNestedFillRects(SkRect rects[2], Direction dirs[2]) const {
const SkPoint* pts = fPathRef->points();
const SkPoint* first = pts;
Direction testDirs[2];
- if (!isRectContour(true, &currVerb, &pts, NULL, &testDirs[0])) {
+ if (!isRectContour(true, &currVerb, &pts, nullptr, &testDirs[0])) {
return false;
}
const SkPoint* last = pts;
@@ -1434,7 +1434,7 @@ static void subdivide_cubic_to(SkPath* path, const SkPoint pts[4],
void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
SkDEBUGCODE(this->validate();)
- if (dst == NULL) {
+ if (dst == nullptr) {
dst = (SkPath*)this;
}
@@ -1522,15 +1522,15 @@ enum SegmentState {
SkPath::Iter::Iter() {
#ifdef SK_DEBUG
- fPts = NULL;
- fConicWeights = NULL;
+ fPts = nullptr;
+ fConicWeights = nullptr;
fMoveTo.fX = fMoveTo.fY = fLastPt.fX = fLastPt.fY = 0;
fForceClose = fCloseLine = false;
fSegmentState = kEmptyContour_SegmentState;
#endif
// need to init enough to make next() harmlessly return kDone_Verb
- fVerbs = NULL;
- fVerbStop = NULL;
+ fVerbs = nullptr;
+ fVerbStop = nullptr;
fNeedClose = false;
}
@@ -1551,7 +1551,7 @@ void SkPath::Iter::setPath(const SkPath& path, bool forceClose) {
}
bool SkPath::Iter::isClosedContour() const {
- if (fVerbs == NULL || fVerbs == fVerbStop) {
+ if (fVerbs == nullptr || fVerbs == fVerbStop) {
return false;
}
if (fForceClose) {
@@ -1617,7 +1617,7 @@ void SkPath::Iter::consumeDegenerateSegments(bool exact) {
// forward before the next move is seen
const uint8_t* lastMoveVerb = 0;
const SkPoint* lastMovePt = 0;
- const SkScalar* lastMoveWeight = NULL;
+ const SkScalar* lastMoveWeight = nullptr;
SkPoint lastPt = fLastPt;
while (fVerbs != fVerbStop) {
unsigned verb = *(fVerbs - 1); // fVerbs is one beyond the current verb
@@ -1776,12 +1776,12 @@ SkPath::Verb SkPath::Iter::doNext(SkPoint ptsParam[4]) {
SkPath::RawIter::RawIter() {
#ifdef SK_DEBUG
- fPts = NULL;
- fConicWeights = NULL;
+ fPts = nullptr;
+ fConicWeights = nullptr;
#endif
// need to init enough to make next() harmlessly return kDone_Verb
- fVerbs = NULL;
- fVerbStop = NULL;
+ fVerbs = nullptr;
+ fVerbStop = nullptr;
}
SkPath::RawIter::RawIter(const SkPath& path) {
@@ -1850,7 +1850,7 @@ SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
size_t SkPath::writeToMemory(void* storage) const {
SkDEBUGCODE(this->validate();)
- if (NULL == storage) {
+ if (nullptr == storage) {
const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
return SkAlign4(byteCount);
}
@@ -1913,7 +1913,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
buffer.skipToAlign4();
sizeRead = buffer.pos();
} else if (pathRef) {
- // If the buffer is not valid, pathRef should be NULL
+ // If the buffer is not valid, pathRef should be nullptr
sk_throw();
}
return sizeRead;
@@ -2006,11 +2006,11 @@ void SkPath::dump(SkWStream* wStream, bool forceClose, bool dumpAsHex) const {
}
void SkPath::dump() const {
- this->dump(NULL, false, false);
+ this->dump(nullptr, false, false);
}
void SkPath::dumpHex() const {
- this->dump(NULL, false, true);
+ this->dump(nullptr, false, true);
}
#ifdef SK_DEBUG
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index 17ae95e801..caff6df399 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -297,7 +297,7 @@ static void compute_pos_tan(const SkPoint pts[], int segType,
}
} break;
case kCubic_SegType:
- SkEvalCubicAt(pts, t, pos, tangent, NULL);
+ SkEvalCubicAt(pts, t, pos, tangent, nullptr);
if (tangent) {
tangent->normalize();
}
@@ -402,7 +402,7 @@ static void seg_to(const SkPoint pts[], int segType,
////////////////////////////////////////////////////////////////////////////////
SkPathMeasure::SkPathMeasure() {
- fPath = NULL;
+ fPath = nullptr;
fLength = -1; // signal we need to compute it
fForceClosed = false;
fFirstPtIndex = -1;
@@ -435,7 +435,7 @@ void SkPathMeasure::setPath(const SkPath* path, bool forceClosed) {
}
SkScalar SkPathMeasure::getLength() {
- if (fPath == NULL) {
+ if (fPath == nullptr) {
return 0;
}
if (fLength < 0) {
@@ -452,7 +452,7 @@ int SkTKSearch(const T base[], int count, const K& key) {
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;
@@ -511,7 +511,7 @@ const SkPathMeasure::Segment* SkPathMeasure::distanceToSegment(
bool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* pos,
SkVector* tangent) {
- if (NULL == fPath) {
+ if (nullptr == fPath) {
return false;
}
@@ -538,7 +538,7 @@ bool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* pos,
bool SkPathMeasure::getMatrix(SkScalar distance, SkMatrix* matrix,
MatrixFlags flags) {
- if (NULL == fPath) {
+ if (nullptr == fPath) {
return false;
}
@@ -584,7 +584,7 @@ bool SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst,
SkASSERT(seg <= stopSeg);
if (startWithMoveTo) {
- compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, startT, &p, NULL);
+ compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, startT, &p, nullptr);
dst->moveTo(p);
}
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index e3317a6e75..be7c66cc4b 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -35,8 +35,8 @@ SkPathRef::~SkPathRef() {
SkDEBUGCODE(this->validate();)
sk_free(fPoints);
- SkDEBUGCODE(fPoints = NULL;)
- SkDEBUGCODE(fVerbs = NULL;)
+ SkDEBUGCODE(fPoints = nullptr;)
+ SkDEBUGCODE(fVerbs = nullptr;)
SkDEBUGCODE(fVerbCnt = 0x9999999;)
SkDEBUGCODE(fPointCnt = 0xAAAAAAA;)
SkDEBUGCODE(fPointCnt = 0xBBBBBBB;)
@@ -130,7 +130,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
int32_t packed;
if (!buffer->readS32(&packed)) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1;
@@ -143,7 +143,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->readS32(&pointCount) ||
!buffer->readS32(&conicCount)) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->resetToSize(verbCount, pointCount, conicCount);
@@ -156,7 +156,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->read(ref->fConicWeights.begin(), conicCount * sizeof(SkScalar)) ||
!buffer->read(&ref->fBounds, sizeof(SkRect))) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->fBoundsIsDirty = false;
@@ -443,7 +443,7 @@ uint32_t SkPathRef::genID() const {
}
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (NULL == listener || this == empty.get()) {
+ if (nullptr == listener || this == empty.get()) {
delete listener;
return;
}
@@ -465,11 +465,11 @@ void SkPathRef::validate() const {
this->INHERITED::validate();
SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0);
SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPoints) >= 0);
- SkASSERT((NULL == fPoints) == (NULL == fVerbs));
- SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
- SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
- SkASSERT(!(NULL == fPoints && fPointCnt));
- SkASSERT(!(NULL == fVerbs && fVerbCnt));
+ SkASSERT((nullptr == fPoints) == (nullptr == fVerbs));
+ SkASSERT(!(nullptr == fPoints && 0 != fFreeSpace));
+ SkASSERT(!(nullptr == fPoints && 0 != fFreeSpace));
+ SkASSERT(!(nullptr == fPoints && fPointCnt));
+ SkASSERT(!(nullptr == fVerbs && fVerbCnt));
SkASSERT(this->currSize() ==
fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVerbCnt);
diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp
index 9fa6a64c4e..42d42c408c 100644
--- a/src/core/SkPictureContentInfo.cpp
+++ b/src/core/SkPictureContentInfo.cpp
@@ -45,7 +45,7 @@ bool SkPictureContentInfo::suitableForGpuRasterization(GrContext* context, const
}
void SkPictureContentInfo::onDrawPoints(size_t count, const SkPaint& paint) {
- if (paint.getPathEffect() != NULL) {
+ if (paint.getPathEffect() != nullptr) {
SkPathEffect::DashInfo info;
SkPathEffect::DashType dashType = paint.getPathEffect()->asADash(&info);
if (2 == count && SkPaint::kRound_Cap != paint.getStrokeCap() &&
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index e70cd66de8..2cc28410fe 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -80,14 +80,14 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
}
void SkPictureData::init() {
- fPictureRefs = NULL;
+ fPictureRefs = nullptr;
fPictureCount = 0;
- fTextBlobRefs = NULL;
+ fTextBlobRefs = nullptr;
fTextBlobCount = 0;
- fImageRefs = NULL;
+ fImageRefs = nullptr;
fImageCount = 0;
- fOpData = NULL;
- fFactoryPlayback = NULL;
+ fOpData = nullptr;
+ fFactoryPlayback = nullptr;
}
SkPictureData::~SkPictureData() {
@@ -133,7 +133,7 @@ static size_t compute_chunk_size(SkFlattenable::Factory* array, int count) {
for (int i = 0; i < count; i++) {
const char* name = SkFlattenable::FactoryToName(array[i]);
- if (NULL == name || 0 == *name) {
+ if (nullptr == name || 0 == *name) {
size += SkWStream::SizeOfPackedUInt(0);
} else {
size_t len = strlen(name);
@@ -171,7 +171,7 @@ void SkPictureData::WriteFactories(SkWStream* stream, const SkFactorySet& rec) {
for (int i = 0; i < count; i++) {
const char* name = SkFlattenable::FactoryToName(array[i]);
- if (NULL == name || 0 == *name) {
+ if (nullptr == name || 0 == *name) {
stream->writePackedUInt(0);
} else {
size_t len = strlen(name);
@@ -355,7 +355,7 @@ bool SkPictureData::parseStreamTag(SkStream* stream,
switch (tag) {
case SK_PICT_READER_TAG:
- SkASSERT(NULL == fOpData);
+ SkASSERT(nullptr == fOpData);
fOpData = SkData::NewFromStream(stream, size);
if (!fOpData) {
return false;
@@ -443,7 +443,7 @@ static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) {
int height = buffer.read32();
if (width <= 0 || height <= 0) { // SkImage never has a zero dimension
buffer.validate(false);
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkData> encoded(buffer.readByteArrayAsData());
@@ -451,7 +451,7 @@ static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) {
int originY = buffer.read32();
if (0 == encoded->size() || originX < 0 || originY < 0) {
buffer.validate(false);
- return NULL;
+ return nullptr;
}
const SkIRect subset = SkIRect::MakeXYWH(originX, originY, width, height);
@@ -467,7 +467,7 @@ static const SkPicture* create_picture_from_buffer(SkReadBuffer& buffer) {
template <typename T>
bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
const T*** array, int* outCount, const T* (*factory)(SkReadBuffer&)) {
- if (!buffer.validate((0 == *outCount) && (NULL == *array))) {
+ if (!buffer.validate((0 == *outCount) && (nullptr == *array))) {
return false;
}
if (0 == inCount) {
@@ -479,7 +479,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
int i = 0;
for (; i < *outCount; i++) {
(*array)[i] = factory(buffer);
- if (NULL == (*array)[i]) {
+ if (nullptr == (*array)[i]) {
success = false;
break;
}
@@ -491,7 +491,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
}
// Delete the array
delete[] * array;
- *array = NULL;
+ *array = nullptr;
*outCount = 0;
return false;
}
@@ -542,10 +542,10 @@ bool SkPictureData::parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t
case SK_PICT_READER_TAG: {
SkAutoDataUnref data(SkData::NewUninitialized(size));
if (!buffer.readByteArray(data->writable_data(), size) ||
- !buffer.validate(NULL == fOpData)) {
+ !buffer.validate(nullptr == fOpData)) {
return false;
}
- SkASSERT(NULL == fOpData);
+ SkASSERT(nullptr == fOpData);
fOpData = data.detach();
} break;
case SK_PICT_PICTURE_TAG:
@@ -571,7 +571,7 @@ SkPictureData* SkPictureData::CreateFromStream(SkStream* stream,
}
if (!data->parseStream(stream, proc, topLevelTFPlayback)) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
@@ -582,7 +582,7 @@ SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
buffer.setVersion(info.fVersion);
if (!data->parseBuffer(buffer)) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
@@ -631,11 +631,11 @@ bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char **reason,
GrPixelConfig config, SkScalar dpi) const {
- if (context != NULL) {
+ if (context != nullptr) {
return this->suitableForGpuRasterization(context, reason,
context->getRecommendedSampleCount(config, dpi));
} else {
- return this->suitableForGpuRasterization(NULL, reason);
+ return this->suitableForGpuRasterization(nullptr, reason);
}
}
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index a68a8c8317..4e4deef55a 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -111,7 +111,7 @@ public:
const SkPaint* getPaint(SkReader32* reader) const {
int index = reader->readInt();
if (index == 0) {
- return NULL;
+ return nullptr;
}
return &fPaints[index - 1];
}
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index 3556004a96..02d8592830 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -18,10 +18,10 @@
///////////////////////////////////////////////////////////////////////////////
-SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(NULL) {}
+SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(nullptr) {}
SkTypefacePlayback::~SkTypefacePlayback() {
- this->reset(NULL);
+ this->reset(nullptr);
}
void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
@@ -31,7 +31,7 @@ void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
}
delete[] fArray;
- if (rec!= NULL && rec->count() > 0) {
+ if (rec!= nullptr && rec->count() > 0) {
fCount = rec->count();
fArray = new SkRefCnt* [fCount];
rec->copyToArray(fArray);
@@ -40,12 +40,12 @@ void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
}
} else {
fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
}
}
void SkTypefacePlayback::setCount(int count) {
- this->reset(NULL);
+ this->reset(nullptr);
fCount = count;
fArray = new SkRefCnt* [count];
@@ -61,10 +61,10 @@ SkRefCnt* SkTypefacePlayback::set(int index, SkRefCnt* obj) {
///////////////////////////////////////////////////////////////////////////////
SkFlatController::SkFlatController(uint32_t writeBufferFlags)
-: fBitmapHeap(NULL)
-, fTypefaceSet(NULL)
-, fTypefacePlayback(NULL)
-, fFactorySet(NULL)
+: fBitmapHeap(nullptr)
+, fTypefaceSet(nullptr)
+, fTypefacePlayback(nullptr)
+, fFactorySet(nullptr)
, fWriteBufferFlags(writeBufferFlags) {}
SkFlatController::~SkFlatController() {
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index 176f48625d..98a43ecb57 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -296,8 +296,8 @@ public:
// Unflatten this into result, using bitmapHeap and facePlayback for bitmaps and fonts if given
template <typename Traits, typename T>
void unflatten(T* result,
- SkBitmapHeap* bitmapHeap = NULL,
- SkTypefacePlayback* facePlayback = NULL) const {
+ SkBitmapHeap* bitmapHeap = nullptr,
+ SkTypefacePlayback* facePlayback = nullptr) const {
SkReadBuffer buffer(this->data(), fFlatSize);
if (bitmapHeap) {
@@ -411,28 +411,28 @@ public:
* Similar to find. Allows the caller to specify an SkFlatData to replace in
* the case of an add. Also tells the caller whether a new SkFlatData was
* added and whether the old one was replaced. The parameters added and
- * replaced are required to be non-NULL. Rather than returning the index of
+ * replaced are required to be non-nullptr. Rather than returning the index of
* the entry in the dictionary, it returns the actual SkFlatData.
*/
const SkFlatData* findAndReplace(const T& element,
const SkFlatData* toReplace,
bool* added,
bool* replaced) {
- SkASSERT(added != NULL && replaced != NULL);
+ SkASSERT(added != nullptr && replaced != nullptr);
const int oldCount = this->count();
SkFlatData* flat = this->findAndReturnMutableFlat(element);
*added = this->count() > oldCount;
// If we don't want to replace anything, we're done.
- if (!*added || toReplace == NULL) {
+ if (!*added || toReplace == nullptr) {
*replaced = false;
return flat;
}
// If we don't have the thing to replace, we're done.
const SkFlatData* found = fHash.find(*toReplace);
- if (found == NULL) {
+ if (found == nullptr) {
*replaced = false;
return flat;
}
@@ -469,7 +469,7 @@ public:
/**
* Find or insert a flattened version of element into the dictionary.
- * Caller does not take ownership of the result. This will not return NULL.
+ * Caller does not take ownership of the result. This will not return nullptr.
*/
const SkFlatData* findAndReturnFlat(const T& element) {
return this->findAndReturnMutableFlat(element);
@@ -484,7 +484,7 @@ private:
}
// Without a bitmap heap, we'll flatten bitmaps into paints. That's never what you want.
- SkASSERT(fController->getBitmapHeap() != NULL);
+ SkASSERT(fController->getBitmapHeap() != nullptr);
fScratch.setBitmapHeap(fController->getBitmapHeap());
fScratch.setTypefaceRecorder(fController->getTypefaceSet());
fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet());
@@ -497,7 +497,7 @@ private:
const SkFlatData& scratch = this->resetScratch(element, this->count()+1);
SkFlatData* candidate = fHash.find(scratch);
- if (candidate != NULL) {
+ if (candidate != nullptr) {
return candidate;
}
@@ -520,7 +520,7 @@ private:
// Reinterpret data in fScratch as an SkFlatData.
SkFlatData* scratch = (SkFlatData*)fScratch.getWriter32()->contiguousArray();
- SkASSERT(scratch != NULL);
+ SkASSERT(scratch != nullptr);
scratch->stampHeader(index, SkToS32(dataSize));
return *scratch;
}
@@ -534,7 +534,7 @@ private:
// Copy scratch into the new SkFlatData.
SkFlatData* scratch = (SkFlatData*)fScratch.getWriter32()->contiguousArray();
- SkASSERT(scratch != NULL);
+ SkASSERT(scratch != nullptr);
memcpy(detached, scratch, fScratch.bytesWritten());
// We can now reuse fScratch, and detached will live until fController dies.
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index eb7c476e96..b994071cbb 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -44,7 +44,7 @@ static const SkRect* get_rect_ptr(SkReader32* reader) {
if (reader->readBool()) {
return &reader->skipT<SkRect>();
} else {
- return NULL;
+ return nullptr;
}
}
@@ -164,13 +164,13 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const int count = reader->readU32();
const SkRSXform* xform = (const SkRSXform*)reader->skip(count * sizeof(SkRSXform));
const SkRect* tex = (const SkRect*)reader->skip(count * sizeof(SkRect));
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
SkXfermode::Mode mode = SkXfermode::kDst_Mode;
if (flags & DRAW_ATLAS_HAS_COLORS) {
colors = (const SkColor*)reader->skip(count * sizeof(SkColor));
mode = (SkXfermode::Mode)reader->readU32();
}
- const SkRect* cull = NULL;
+ const SkRect* cull = nullptr;
if (flags & DRAW_ATLAS_HAS_CULL) {
cull = (const SkRect*)reader->skip(sizeof(SkRect));
}
@@ -275,11 +275,11 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::kNumCtrlPts *
sizeof(SkPoint));
uint32_t flag = reader->readInt();
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
if (flag & DRAW_VERTICES_HAS_COLORS) {
colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor));
}
- const SkPoint* texCoords = NULL;
+ const SkPoint* texCoords = nullptr;
if (flag & DRAW_VERTICES_HAS_TEXS) {
texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorners *
sizeof(SkPoint));
@@ -418,9 +418,9 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
SkCanvas::VertexMode vmode = (SkCanvas::VertexMode)reader->readInt();
int vCount = reader->readInt();
const SkPoint* verts = (const SkPoint*)reader->skip(vCount * sizeof(SkPoint));
- const SkPoint* texs = NULL;
- const SkColor* colors = NULL;
- const uint16_t* indices = NULL;
+ const SkPoint* texs = nullptr;
+ const SkColor* colors = nullptr;
+ const uint16_t* indices = nullptr;
int iCount = 0;
if (flags & DRAW_VERTICES_HAS_TEXS) {
texs = (const SkPoint*)reader->skip(vCount * sizeof(SkPoint));
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 2281d16145..28561c7e3f 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -275,7 +275,7 @@ void SkPictureRecord::didConcat(const SkMatrix& matrix) {
void SkPictureRecord::recordConcat(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
// op + matrix
- size_t size = kUInt32Size + matrix.writeToMemory(NULL);
+ size_t size = kUInt32Size + matrix.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(CONCAT, &size);
this->addMatrix(matrix);
this->validate(initialOffset, size);
@@ -284,7 +284,7 @@ void SkPictureRecord::recordConcat(const SkMatrix& matrix) {
void SkPictureRecord::didSetMatrix(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
// op + matrix
- size_t size = kUInt32Size + matrix.writeToMemory(NULL);
+ size_t size = kUInt32Size + matrix.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
this->addMatrix(matrix);
this->validate(initialOffset, size);
@@ -440,7 +440,7 @@ void SkPictureRecord::onClipRegion(const SkRegion& region, SkRegion::Op op) {
size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) {
// op + clip params + region
- size_t size = 2 * kUInt32Size + region.writeToMemory(NULL);
+ size_t size = 2 * kUInt32Size + region.writeToMemory(nullptr);
// recordRestoreOffsetPlaceholder doesn't always write an offset
if (!fRestoreOffsetStack.isEmpty()) {
// + restore offset
@@ -694,7 +694,7 @@ void SkPictureRecord::onDrawTextOnPath(const void* text, size_t byteLength, cons
const SkMatrix* matrix, const SkPaint& paint) {
// op + paint index + length + 'length' worth of data + path index + matrix
const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
- size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(NULL);
+ size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
SkASSERT(initialOffset+get_paint_offset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten());
this->addPaint(paint);
@@ -726,12 +726,12 @@ void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma
size_t size = 2 * kUInt32Size;
size_t initialOffset;
- if (NULL == matrix && NULL == paint) {
+ if (nullptr == matrix && nullptr == paint) {
initialOffset = this->addDraw(DRAW_PICTURE, &size);
this->addPicture(picture);
} else {
const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
- size += m.writeToMemory(NULL) + kUInt32Size; // matrix + paint
+ size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint
initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size);
SkASSERT(initialOffset + get_paint_offset(DRAW_PICTURE_MATRIX_PAINT, size)
== fWriter.bytesWritten());
@@ -887,7 +887,7 @@ void SkPictureRecord::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[],
///////////////////////////////////////////////////////////////////////////////
SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) {
- return NULL;
+ return nullptr;
}
// If we already have a stored, can we reuse it instead of also storing b?
@@ -1028,7 +1028,7 @@ void SkPictureRecord::addRect(const SkRect& rect) {
}
void SkPictureRecord::addRectPtr(const SkRect* rect) {
- if (fWriter.writeBool(rect != NULL)) {
+ if (fWriter.writeBool(rect != nullptr)) {
fWriter.writeRect(*rect);
}
}
@@ -1038,7 +1038,7 @@ void SkPictureRecord::addIRect(const SkIRect& rect) {
}
void SkPictureRecord::addIRectPtr(const SkIRect* rect) {
- if (fWriter.writeBool(rect != NULL)) {
+ if (fWriter.writeBool(rect != nullptr)) {
*(SkIRect*)fWriter.reserve(sizeof(SkIRect)) = *rect;
}
}
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 8612aa77d3..6397ca00fa 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -25,7 +25,7 @@ SkPictureRecorder::SkPictureRecorder() {
SkPictureRecorder::~SkPictureRecorder() {}
SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect,
- SkBBHFactory* bbhFactory /* = NULL */,
+ SkBBHFactory* bbhFactory /* = nullptr */,
uint32_t recordFlags /* = 0 */) {
fCullRect = cullRect;
fFlags = recordFlags;
@@ -69,7 +69,7 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
SkDrawableList* drawableList = fRecorder->getDrawableList();
SkBigPicture::SnapshotArray* pictList =
- drawableList ? drawableList->newDrawableSnapshot() : NULL;
+ drawableList ? drawableList->newDrawableSnapshot() : nullptr;
if (fBBH.get()) {
if (saveLayerData) {
@@ -98,18 +98,18 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect) {
void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
- if (NULL == canvas) {
+ if (nullptr == canvas) {
return;
}
int drawableCount = 0;
- SkDrawable* const* drawables = NULL;
+ SkDrawable* const* drawables = nullptr;
SkDrawableList* drawableList = fRecorder->getDrawableList();
if (drawableList) {
drawableCount = drawableList->count();
drawables = drawableList->begin();
}
- SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, NULL/*bbh*/, NULL/*callback*/);
+ SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, nullptr/*bbh*/, nullptr/*callback*/);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -135,17 +135,17 @@ protected:
SkRect onGetBounds() override { return fBounds; }
void onDraw(SkCanvas* canvas) override {
- SkDrawable* const* drawables = NULL;
+ SkDrawable* const* drawables = nullptr;
int drawableCount = 0;
if (fDrawableList) {
drawables = fDrawableList->begin();
drawableCount = fDrawableList->count();
}
- SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, fBBH, NULL/*callback*/);
+ SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, fBBH, nullptr/*callback*/);
}
SkPicture* onNewPictureSnapshot() override {
- SkBigPicture::SnapshotArray* pictList = NULL;
+ SkBigPicture::SnapshotArray* pictList = nullptr;
if (fDrawableList) {
// TODO: should we plumb-down the BBHFactory and recordFlags from our host
// PictureRecorder?
@@ -157,7 +157,7 @@ protected:
if (fBBH && fDoSaveLayerInfo) {
saveLayerData.reset(new SkLayerInfo);
- SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor)
+ SkBBoxHierarchy* bbh = nullptr; // we've already computed fBBH (received in constructor)
// TODO: update saveLayer info computation to reuse the already computed
// bounds in 'fBBH'
SkRecordComputeLayers(fBounds, *fRecord, pictList, bbh, saveLayerData);
@@ -191,8 +191,8 @@ SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag));
// release our refs now, so only the drawable will be the owner.
- fRecord.reset(NULL);
- fBBH.reset(NULL);
+ fRecord.reset(nullptr);
+ fBBH.reset(nullptr);
return drawable;
}
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 569ef3d822..0b3c9e864b 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -85,12 +85,12 @@ struct BitmapShaderRec : public SkResourceCache::Rec {
result->reset(SkRef(rec.fShader.get()));
SkBitmap tile;
- if (rec.fShader.get()->isABitmap(&tile, NULL, NULL)) {
+ if (rec.fShader.get()->isABitmap(&tile, nullptr, nullptr)) {
// FIXME: this doesn't protect the pixels from being discarded as soon as we unlock.
// Should be handled via a pixel ref generator instead
// (https://code.google.com/p/skia/issues/detail?id=3220).
SkAutoLockPixels alp(tile, true);
- return tile.getPixels() != NULL;
+ return tile.getPixels() != nullptr;
}
return false;
}
@@ -99,8 +99,8 @@ struct BitmapShaderRec : public SkResourceCache::Rec {
static bool cache_try_alloc_pixels(SkBitmap* bitmap) {
SkBitmap::Allocator* allocator = SkResourceCache::GetAllocator();
- return NULL != allocator
- ? allocator->allocPixelRef(bitmap, NULL)
+ return nullptr != allocator
+ ? allocator->allocPixelRef(bitmap, nullptr)
: bitmap->tryAllocPixels();
}
@@ -141,7 +141,7 @@ SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Version)) {
// Older code blindly serialized pictures. We don't trust them.
buffer.validate(false);
- return NULL;
+ return nullptr;
}
// Newer code won't serialize pictures in disallow-cross-process-picture mode.
// Assert that they didn't serialize anything except a false here.
@@ -187,7 +187,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
//
// TODO: replace this with decomposeScale() -- but beware LayoutTest rebaselines!
//
- if (!SkDecomposeUpper2x2(m, NULL, &scale, NULL)) {
+ if (!SkDecomposeUpper2x2(m, nullptr, &scale, nullptr)) {
// Decomposition failed, use an approximation.
scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.getSkewX()),
SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.getSkewY()));
@@ -262,8 +262,8 @@ size_t SkPictureShader::contextSize() const {
SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const {
SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec.fLocalMatrix));
- if (NULL == bitmapShader.get()) {
- return NULL;
+ if (nullptr == bitmapShader.get()) {
+ return nullptr;
}
return PictureShaderContext::Create(storage, *this, rec, bitmapShader);
}
@@ -273,9 +273,9 @@ SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage,
const SkPictureShader& shader, const ContextRec& rec, SkShader* bitmapShader) {
PictureShaderContext* ctx = new (storage) PictureShaderContext(shader, rec, bitmapShader);
- if (NULL == ctx->fBitmapShaderContext) {
+ if (nullptr == ctx->fBitmapShaderContext) {
ctx->~PictureShaderContext();
- ctx = NULL;
+ ctx = nullptr;
}
return ctx;
}
@@ -349,7 +349,7 @@ bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai
if (!bitmapShader) {
return false;
}
- return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintColor,
+ return bitmapShader->asFragmentProcessor(context, paint, viewM, nullptr, paintColor,
procDataManager, fp);
}
#else
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 7bcaffe554..d7117617f6 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -95,7 +95,7 @@ static void validate_pixels_ctable(const SkImageInfo& info, const SkColorTable*
if (kIndex_8_SkColorType == info.colorType()) {
SkASSERT(ctable);
} else {
- SkASSERT(NULL == ctable);
+ SkASSERT(nullptr == ctable);
}
}
@@ -198,8 +198,8 @@ bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
}
if (fPreLocked) {
- result->fUnlockProc = NULL;
- result->fUnlockContext = NULL;
+ result->fUnlockProc = nullptr;
+ result->fUnlockContext = nullptr;
result->fCTable = fRec.fColorTable;
result->fPixels = fRec.fPixels;
result->fRowBytes = fRec.fRowBytes;
@@ -241,7 +241,7 @@ uint32_t SkPixelRef::getGenerationID() const {
}
void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (NULL == listener || !this->genIDIsUnique()) {
+ if (nullptr == listener || !this->genIDIsUnique()) {
// No point in tracking this if we're not going to call it.
delete listener;
return;
@@ -320,7 +320,7 @@ bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
void SkPixelRef::onNotifyPixelsChanged() { }
SkData* SkPixelRef::onRefEncodedData() {
- return NULL;
+ return nullptr;
}
bool SkPixelRef::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index 339dea0072..c63bef9c7d 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -12,7 +12,7 @@
#include "SkUtils.h"
void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx) {
- SkASSERT(pm.addr() != NULL);
+ SkASSERT(pm.addr() != nullptr);
this->unlock();
fPixmap = pm;
@@ -24,8 +24,8 @@ void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void*
/////////////////////////////////////////////////////////////////////////////////////////////////
void SkPixmap::reset() {
- fPixels = NULL;
- fCTable = NULL;
+ fPixels = nullptr;
+ fCTable = nullptr;
fRowBytes = 0;
fInfo = SkImageInfo::MakeUnknown();
}
@@ -43,7 +43,7 @@ void SkPixmap::reset(const SkImageInfo& info, const void* addr, size_t rowBytes,
bool SkPixmap::reset(const SkMask& src) {
if (SkMask::kA8_Format == src.fFormat) {
this->reset(SkImageInfo::MakeA8(src.fBounds.width(), src.fBounds.height()),
- src.fImage, src.fRowBytes, NULL);
+ src.fImage, src.fRowBytes, nullptr);
return true;
}
this->reset();
@@ -62,7 +62,7 @@ bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const {
SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width()));
SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height()));
- const void* pixels = NULL;
+ const void* pixels = nullptr;
if (fPixels) {
const size_t bpp = fInfo.bytesPerPixel();
pixels = (const uint8_t*)fPixels + r.fTop * fRowBytes + r.fLeft * bpp;
@@ -76,7 +76,7 @@ bool SkPixmap::readPixels(const SkImageInfo& requestedDstInfo, void* dstPixels,
if (kUnknown_SkColorType == requestedDstInfo.colorType()) {
return false;
}
- if (NULL == dstPixels || dstRB < requestedDstInfo.minRowBytes()) {
+ if (nullptr == dstPixels || dstRB < requestedDstInfo.minRowBytes()) {
return false;
}
if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) {
@@ -116,7 +116,7 @@ static uint16_t pack_8888_to_4444(unsigned a, unsigned r, unsigned g, unsigned b
}
bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const {
- if (NULL == fPixels) {
+ if (nullptr == fPixels) {
return false;
}
SkIRect area;
@@ -207,7 +207,7 @@ bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const {
//////////////////////////////////////////////////////////////////////////////////////////////////
-SkAutoPixmapStorage::SkAutoPixmapStorage() : fStorage(NULL) {}
+SkAutoPixmapStorage::SkAutoPixmapStorage() : fStorage(nullptr) {}
SkAutoPixmapStorage::~SkAutoPixmapStorage() {
this->freeStorage();
@@ -222,7 +222,7 @@ bool SkAutoPixmapStorage::tryAlloc(const SkImageInfo& info) {
return false;
}
void* pixels = sk_malloc_flags(size, 0);
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return false;
}
this->reset(info, pixels, rb);
diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp
index aae28d0e3f..be169d7b0d 100644
--- a/src/core/SkPtrRecorder.cpp
+++ b/src/core/SkPtrRecorder.cpp
@@ -23,7 +23,7 @@ bool SkPtrSet::Less(const Pair& a, const Pair& b) {
}
uint32_t SkPtrSet::find(void* ptr) const {
- if (NULL == ptr) {
+ if (nullptr == ptr) {
return 0;
}
@@ -39,7 +39,7 @@ uint32_t SkPtrSet::find(void* ptr) const {
}
uint32_t SkPtrSet::add(void* ptr) {
- if (NULL == ptr) {
+ if (nullptr == ptr) {
return 0;
}
diff --git a/src/core/SkPtrRecorder.h b/src/core/SkPtrRecorder.h
index 325471ea71..2d755e69e5 100644
--- a/src/core/SkPtrRecorder.h
+++ b/src/core/SkPtrRecorder.h
@@ -26,7 +26,7 @@ public:
/**
* Search for the specified ptr in the set. If it is found, return its
- * 32bit ID [1..N], or if not found, return 0. Always returns 0 for NULL.
+ * 32bit ID [1..N], or if not found, return 0. Always returns 0 for nullptr.
*/
uint32_t find(void*) const;
@@ -34,7 +34,7 @@ public:
* Add the specified ptr to the set, returning a unique 32bit ID for it
* [1...N]. Duplicate ptrs will return the same ID.
*
- * If the ptr is NULL, it is not added, and 0 is returned.
+ * If the ptr is nullptr, it is not added, and 0 is returned.
*/
uint32_t add(void*);
@@ -71,7 +71,7 @@ public:
* Return the next ptr in the set or null if the end was reached.
*/
void* next() {
- return fIndex < fSet.fList.count() ? fSet.fList[fIndex++].fPtr : NULL;
+ return fIndex < fSet.fList.count() ? fSet.fList[fIndex++].fPtr : nullptr;
}
private:
@@ -85,7 +85,7 @@ protected:
private:
struct Pair {
- void* fPtr; // never NULL
+ void* fPtr; // never nullptr
uint32_t fIndex; // 1...N
};
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index 0d1887d792..ef811215f4 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -359,7 +359,7 @@ static bool matrix_only_scale_and_translate(const SkMatrix& matrix) {
}
bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
diff --git a/src/core/SkRWBuffer.cpp b/src/core/SkRWBuffer.cpp
index 7c775135eb..e9147dc684 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -24,7 +24,7 @@ struct SkBufferBlock {
static SkBufferBlock* Alloc(size_t length) {
size_t capacity = LengthToCapacity(length);
SkBufferBlock* block = (SkBufferBlock*)sk_malloc_throw(sizeof(SkBufferBlock) + capacity);
- block->fNext = NULL;
+ block->fNext = nullptr;
block->fUsed = 0;
block->fCapacity = capacity;
return block;
@@ -68,7 +68,7 @@ struct SkBufferHead {
size_t size = sizeof(SkBufferHead) + capacity;
SkBufferHead* head = (SkBufferHead*)sk_malloc_throw(size);
head->fRefCnt = 1;
- head->fBlock.fNext = NULL;
+ head->fBlock.fNext = nullptr;
head->fBlock.fUsed = 0;
head->fBlock.fCapacity = capacity;
return head;
@@ -94,7 +94,7 @@ struct SkBufferHead {
}
}
- void validate(size_t minUsed, SkBufferBlock* tail = NULL) const {
+ void validate(size_t minUsed, SkBufferBlock* tail = nullptr) const {
#ifdef SK_DEBUG
SkASSERT(fRefCnt > 0);
size_t totalUsed = 0;
@@ -140,13 +140,13 @@ void SkROBuffer::Iter::reset(const SkROBuffer* buffer) {
fBlock = &buffer->fHead->fBlock;
fRemaining = buffer->fUsed;
} else {
- fBlock = NULL;
+ fBlock = nullptr;
fRemaining = 0;
}
}
const void* SkROBuffer::Iter::data() const {
- return fRemaining ? fBlock->startData() : NULL;
+ return fRemaining ? fBlock->startData() : nullptr;
}
size_t SkROBuffer::Iter::size() const {
@@ -161,7 +161,7 @@ bool SkROBuffer::Iter::next() {
return fRemaining != 0;
}
-SkRWBuffer::SkRWBuffer(size_t initialCapacity) : fHead(NULL), fTail(NULL), fTotalUsed(0) {}
+SkRWBuffer::SkRWBuffer(size_t initialCapacity) : fHead(nullptr), fTail(nullptr), fTotalUsed(0) {}
SkRWBuffer::~SkRWBuffer() {
this->validate();
@@ -176,7 +176,7 @@ void SkRWBuffer::append(const void* src, size_t length) {
fTotalUsed += length;
- if (NULL == fHead) {
+ if (nullptr == fHead) {
fHead = SkBufferHead::Alloc(length);
fTail = &fHead->fBlock;
}
@@ -199,12 +199,12 @@ void SkRWBuffer::append(const void* src, size_t length) {
void* SkRWBuffer::append(size_t length) {
this->validate();
if (0 == length) {
- return NULL;
+ return nullptr;
}
fTotalUsed += length;
- if (NULL == fHead) {
+ if (nullptr == fHead) {
fHead = SkBufferHead::Alloc(length);
fTail = &fHead->fBlock;
} else if (fTail->avail() < length) {
@@ -223,7 +223,7 @@ void SkRWBuffer::validate() const {
if (fHead) {
fHead->validate(fTotalUsed, fTail);
} else {
- SkASSERT(NULL == fTail);
+ SkASSERT(nullptr == fTail);
SkASSERT(0 == fTotalUsed);
}
}
diff --git a/src/core/SkRWBuffer.h b/src/core/SkRWBuffer.h
index 89cb425a7f..9d88a60203 100644
--- a/src/core/SkRWBuffer.h
+++ b/src/core/SkRWBuffer.h
@@ -34,7 +34,7 @@ public:
void reset(const SkROBuffer*);
/**
- * Return the current continuous block of memory, or NULL if the iterator is exhausted
+ * Return the current continuous block of memory, or nullptr if the iterator is exhausted
*/
const void* data() const;
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index 35197c1ad9..89c22e8601 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -313,7 +313,7 @@ bool SkRasterClip::op(const SkRect& r, const SkISize& size, SkRegion::Op op, boo
}
void SkRasterClip::translate(int dx, int dy, SkRasterClip* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return;
}
@@ -386,8 +386,8 @@ void SkRasterClip::validate() const {
///////////////////////////////////////////////////////////////////////////////
SkAAClipBlitterWrapper::SkAAClipBlitterWrapper() {
- SkDEBUGCODE(fClipRgn = NULL;)
- SkDEBUGCODE(fBlitter = NULL;)
+ SkDEBUGCODE(fClipRgn = nullptr;)
+ SkDEBUGCODE(fBlitter = nullptr;)
}
SkAAClipBlitterWrapper::SkAAClipBlitterWrapper(const SkRasterClip& clip,
diff --git a/src/core/SkRasterizer.cpp b/src/core/SkRasterizer.cpp
index ab9e011761..87b9caa242 100644
--- a/src/core/SkRasterizer.cpp
+++ b/src/core/SkRasterizer.cpp
@@ -23,7 +23,7 @@ bool SkRasterizer::rasterize(const SkPath& fillPath, const SkMatrix& matrix,
srcM.fFormat = SkMask::kA8_Format;
srcM.fBounds.set(0, 0, 1, 1);
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
if (!filter->filterMask(&dstM, srcM, matrix, &margin)) {
return false;
}
@@ -42,6 +42,6 @@ bool SkRasterizer::onRasterize(const SkPath& fillPath, const SkMatrix& matrix,
SkPath devPath;
fillPath.transform(matrix, &devPath);
- return SkDraw::DrawToMask(devPath, clipBounds, NULL, NULL, mask, mode,
+ return SkDraw::DrawToMask(devPath, clipBounds, nullptr, nullptr, mask, mode,
SkPaint::kFill_Style);
}
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 58a4ac42db..00e3e2c1ce 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -24,16 +24,16 @@ static uint32_t default_flags() {
SkReadBuffer::SkReadBuffer() {
fFlags = default_flags();
fVersion = 0;
- fMemoryPtr = NULL;
+ fMemoryPtr = nullptr;
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -43,16 +43,16 @@ SkReadBuffer::SkReadBuffer(const void* data, size_t size) {
fFlags = default_flags();
fVersion = 0;
fReader.setMemory(data, size);
- fMemoryPtr = NULL;
+ fMemoryPtr = nullptr;
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -66,14 +66,14 @@ SkReadBuffer::SkReadBuffer(SkStream* stream) {
stream->read(fMemoryPtr, length);
fReader.setMemory(fMemoryPtr, length);
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -223,7 +223,7 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
const void* data = this->skip(length);
const int32_t xOffset = this->readInt();
const int32_t yOffset = this->readInt();
- if (fBitmapDecoder != NULL && fBitmapDecoder(data, length, bitmap)) {
+ if (fBitmapDecoder != nullptr && fBitmapDecoder(data, length, bitmap)) {
if (bitmap->width() == width && bitmap->height() == height) {
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
if (0 != xOffset || 0 != yOffset) {
@@ -281,7 +281,7 @@ SkTypeface* SkReadBuffer::readTypeface() {
if (index) {
SkDebugf("====== typeface index %d\n", index);
}
- return NULL;
+ return nullptr;
} else {
SkASSERT(fTFArray);
return fTFArray[index - 1];
@@ -293,12 +293,12 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
// TODO: confirm that ft matches the factory we decide to use
//
- SkFlattenable::Factory factory = NULL;
+ SkFlattenable::Factory factory = nullptr;
if (fFactoryCount > 0) {
int32_t index = fReader.readU32();
if (0 == index) {
- return NULL; // writer failed to give us the flattenable
+ return nullptr; // writer failed to give us the flattenable
}
index -= 1; // we stored the index-base-1
SkASSERT(index < fFactoryCount);
@@ -306,20 +306,20 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
} else if (fFactoryTDArray) {
int32_t index = fReader.readU32();
if (0 == index) {
- return NULL; // writer failed to give us the flattenable
+ return nullptr; // writer failed to give us the flattenable
}
index -= 1; // we stored the index-base-1
factory = (*fFactoryTDArray)[index];
} else {
factory = (SkFlattenable::Factory)readFunctionPtr();
- if (NULL == factory) {
- return NULL; // writer failed to give us the flattenable
+ if (nullptr == factory) {
+ return nullptr; // writer failed to give us the flattenable
}
}
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t sizeRecorded = fReader.readU32();
if (factory) {
size_t offset = fReader.offset();
@@ -351,7 +351,7 @@ void SkReadBuffer::skipFlattenable() {
return;
}
} else {
- if (NULL == this->readFunctionPtr()) {
+ if (nullptr == this->readFunctionPtr()) {
return;
}
}
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index 25640519a3..06b5a77abd 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -185,7 +185,7 @@ public:
* were created/written by the writer. SkPicture uses this.
*/
void setFactoryPlayback(SkFlattenable::Factory array[], int count) {
- fFactoryTDArray = NULL;
+ fFactoryTDArray = nullptr;
fFactoryArray = array;
fFactoryCount = count;
}
@@ -197,7 +197,7 @@ public:
*/
void setFactoryArray(SkTDArray<SkFlattenable::Factory>* array) {
fFactoryTDArray = array;
- fFactoryArray = NULL;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
}
diff --git a/src/core/SkReader32.h b/src/core/SkReader32.h
index 3d874d170a..68dda23c6e 100644
--- a/src/core/SkReader32.h
+++ b/src/core/SkReader32.h
@@ -20,7 +20,7 @@ class SkString;
class SkReader32 : SkNoncopyable {
public:
- SkReader32() : fCurr(NULL), fStop(NULL), fBase(NULL) {}
+ SkReader32() : fCurr(nullptr), fStop(nullptr), fBase(nullptr) {}
SkReader32(const void* data, size_t size) {
this->setMemory(data, size);
}
@@ -94,7 +94,7 @@ public:
}
void read(void* dst, size_t size) {
- SkASSERT(0 == size || dst != NULL);
+ SkASSERT(0 == size || dst != nullptr);
SkASSERT(ptr_align_4(fCurr));
memcpy(dst, fCurr, size);
fCurr += SkAlign4(size);
@@ -124,10 +124,10 @@ public:
/**
* Read the length of a string (written by SkWriter32::writeString) into
- * len (if len is not NULL) and return the null-ternimated address of the
+ * len (if len is not nullptr) and return the null-ternimated address of the
* string within the reader's buffer.
*/
- const char* readString(size_t* len = NULL);
+ const char* readString(size_t* len = nullptr);
/**
* Read the string (written by SkWriter32::writeString) and return it in
@@ -152,7 +152,7 @@ private:
#ifdef SK_DEBUG
static bool ptr_align_4(const void* ptr) {
- return (((const char*)ptr - (const char*)NULL) & 3) == 0;
+ return (((const char*)ptr - (const char*)nullptr) & 3) == 0;
}
#endif
};
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index fe8f5f4933..1a033482e5 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -64,7 +64,7 @@ void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas,
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
stop = SkTMin(stop, record.count());
- SkRecords::Draw draw(canvas, drawablePicts, NULL, drawableCount, &initialCTM);
+ SkRecords::Draw draw(canvas, drawablePicts, nullptr, drawableCount, &initialCTM);
for (int i = start; i < stop; i++) {
record.visit<void>(i, draw);
}
@@ -123,10 +123,10 @@ template <> void Draw::draw(const DrawDrawable& r) {
SkASSERT(r.index >= 0);
SkASSERT(r.index < fDrawableCount);
if (fDrawables) {
- SkASSERT(NULL == fDrawablePicts);
+ SkASSERT(nullptr == fDrawablePicts);
fCanvas->drawDrawable(fDrawables[r.index], r.matrix);
} else {
- fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, NULL);
+ fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr);
}
}
@@ -280,7 +280,7 @@ private:
// The bounds of these ops must be calculated when we hit the Restore
// from the bounds of the ops in the same Save block.
- void trackBounds(const Save&) { this->pushSaveBlock(NULL); }
+ void trackBounds(const Save&) { this->pushSaveBlock(nullptr); }
void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); }
void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(); }
@@ -324,7 +324,7 @@ private:
// https://crbug.com/401593
SkXfermode* xfermode = paint->getXfermode();
SkXfermode::Mode mode;
- // SrcOver is ok, and is also the common case with a NULL xfermode.
+ // SrcOver is ok, and is also the common case with a nullptr xfermode.
// So we should make that the fast path and bypass the mode extraction
// and test.
if (xfermode && xfermode->asMode(&mode)) {
@@ -525,7 +525,7 @@ private:
}
Bounds bounds(const DrawDrawable& op) const {
- return this->adjustAndMap(op.worstCaseBounds, NULL);
+ return this->adjustAndMap(op.worstCaseBounds, nullptr);
}
static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
@@ -644,14 +644,14 @@ private:
template <typename T> void trackSaveLayers(const T& op) {
/* most ops aren't involved in saveLayers */
}
- void trackSaveLayers(const Save& s) { this->pushSaveLayerInfo(false, NULL, NULL); }
+ void trackSaveLayers(const Save& s) { this->pushSaveLayerInfo(false, nullptr, nullptr); }
void trackSaveLayers(const SaveLayer& sl) { this->pushSaveLayerInfo(true, sl.bounds, sl.paint); }
void trackSaveLayers(const Restore& r) { this->popSaveLayerInfo(); }
void trackSaveLayersForPicture(const SkPicture* picture, const SkPaint* paint) {
// For sub-pictures, we wrap their layer information within the parent
// picture's rendering hierarchy
- const SkLayerInfo* childData = NULL;
+ const SkLayerInfo* childData = nullptr;
if (const SkBigPicture* bp = picture->asSkBigPicture()) {
childData = static_cast<const SkLayerInfo*>(bp->accelData());
}
@@ -677,7 +677,7 @@ private:
SkLayerInfo::BlockInfo& dst = fAccelData->addBlock();
- // If src.fPicture is NULL the layer is in dp.picture; otherwise
+ // If src.fPicture is nullptr the layer is in dp.picture; otherwise
// it belongs to a sub-picture.
dst.fPicture = src.fPicture ? src.fPicture : picture;
dst.fPicture->ref();
@@ -710,7 +710,7 @@ private:
void trackSaveLayers(const DrawDrawable& dp) {
SkASSERT(fPictList);
SkASSERT(dp.index >= 0 && dp.index < fPictList->count());
- const SkPaint* paint = NULL; // drawables don't get a side-car paint
+ const SkPaint* paint = nullptr; // drawables don't get a side-car paint
this->trackSaveLayersForPicture(fPictList->begin()[dp.index], paint);
}
@@ -757,7 +757,7 @@ private:
SkLayerInfo::BlockInfo& block = fAccelData->addBlock();
- SkASSERT(NULL == block.fPicture); // This layer is in the top-most picture
+ SkASSERT(nullptr == block.fPicture); // This layer is in the top-most picture
block.fBounds = fFillBounds.getBounds(sli.fStartIndex);
block.fLocalMat = fFillBounds.ctm();
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index 5af74dc7db..c2db37aebd 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -45,7 +45,7 @@ class Draw : SkNoncopyable {
public:
explicit Draw(SkCanvas* canvas, SkPicture const* const drawablePicts[],
SkDrawable* const drawables[], int drawableCount,
- const SkMatrix* initialCTM = NULL)
+ const SkMatrix* initialCTM = nullptr)
: fInitialCTM(initialCTM ? *initialCTM : canvas->getTotalMatrix())
, fCanvas(canvas)
, fDrawablePicts(drawablePicts)
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 07aac3e467..8faa45ce56 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -151,13 +151,13 @@ struct SaveLayerDrawRestoreNooper {
bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
// A SaveLayer's bounds field is just a hint, so we should be free to ignore it.
SkPaint* layerPaint = pattern->first<SaveLayer>()->paint;
- if (NULL == layerPaint) {
+ if (nullptr == layerPaint) {
// There wasn't really any point to this SaveLayer at all.
return KillSaveLayerAndRestore(record, begin);
}
SkPaint* drawPaint = pattern->second<SkPaint>();
- if (drawPaint == NULL) {
+ if (drawPaint == nullptr) {
// We can just give the draw the SaveLayer's paint.
// TODO(mtklein): figure out how to do this clearly
return false;
@@ -197,7 +197,7 @@ struct SvgOpacityAndFilterLayerMergePass {
bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
SkPaint* opacityPaint = pattern->first<SaveLayer>()->paint;
- if (NULL == opacityPaint) {
+ if (nullptr == opacityPaint) {
// There wasn't really any point to this SaveLayer at all.
return KillSaveLayerAndRestore(record, begin);
}
@@ -205,7 +205,7 @@ struct SvgOpacityAndFilterLayerMergePass {
// This layer typically contains a filter, but this should work for layers with for other
// purposes too.
SkPaint* filterLayerPaint = pattern->fourth<SaveLayer>()->paint;
- if (filterLayerPaint == NULL) {
+ if (filterLayerPaint == nullptr) {
// We can just give the inner SaveLayer the paint of the outer SaveLayer.
// TODO(mtklein): figure out how to do this clearly
return false;
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index 174665afc3..ecc61b3aaa 100644
--- a/src/core/SkRecordPattern.h
+++ b/src/core/SkRecordPattern.h
@@ -19,7 +19,7 @@ namespace SkRecords {
template <typename T>
class Is {
public:
- Is() : fPtr(NULL) {}
+ Is() : fPtr(nullptr) {}
typedef T type;
type* get() { return fPtr; }
@@ -31,7 +31,7 @@ public:
template <typename U>
bool operator()(U*) {
- fPtr = NULL;
+ fPtr = nullptr;
return false;
}
@@ -43,7 +43,7 @@ private:
class IsDraw {
SK_CREATE_MEMBER_DETECTOR(paint);
public:
- IsDraw() : fPaint(NULL) {}
+ IsDraw() : fPaint(nullptr) {}
typedef SkPaint type;
type* get() { return fPaint; }
@@ -56,13 +56,13 @@ public:
template <typename T>
SK_WHEN(!HasMember_paint<T>, bool) operator()(T*) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
// SaveLayer has an SkPaint named paint, but it's not a draw.
bool operator()(SaveLayer*) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 0fe9e28848..9eccca164f 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -21,7 +21,7 @@ SkDrawableList::~SkDrawableList() {
SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
const int count = fArray.count();
if (0 == count) {
- return NULL;
+ return nullptr;
}
SkAutoTMalloc<const SkPicture*> pics(count);
for (int i = 0; i < count; ++i) {
@@ -60,9 +60,9 @@ void SkRecorder::reset(SkRecord* record, const SkRect& bounds,
}
void SkRecorder::forgetRecord() {
- fDrawableList.reset(NULL);
+ fDrawableList.reset(nullptr);
fApproxBytesUsedBySubPictures = 0;
- fRecord = NULL;
+ fRecord = nullptr;
}
// To make appending to fRecord a little less verbose.
@@ -82,8 +82,8 @@ void SkRecorder::forgetRecord() {
// (For most types we just pass by value and let copy constructors do their thing.)
template <typename T>
T* SkRecorder::copy(const T* src) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
return new (fRecord->alloc<T>()) T(*src);
}
@@ -92,8 +92,8 @@ T* SkRecorder::copy(const T* src) {
// It will work with POD or non-POD, though currently we only use it for POD.
template <typename T>
T* SkRecorder::copy(const T src[], size_t count) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
T* dst = fRecord->alloc<T>(count);
for (size_t i = 0; i < count; i++) {
@@ -107,8 +107,8 @@ T* SkRecorder::copy(const T src[], size_t count) {
// but I found no corresponding speedup for other arrays.
template <>
char* SkRecorder::copy(const char src[], size_t count) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
char* dst = fRecord->alloc<char>(count);
memcpy(dst, src, count);
@@ -302,8 +302,8 @@ void SkRecorder::onDrawVertices(VertexMode vmode,
vmode,
vertexCount,
this->copy(vertices, vertexCount),
- texs ? this->copy(texs, vertexCount) : NULL,
- colors ? this->copy(colors, vertexCount) : NULL,
+ texs ? this->copy(texs, vertexCount) : nullptr,
+ colors ? this->copy(colors, vertexCount) : nullptr,
xmode,
this->copy(indices, indexCount),
indexCount);
@@ -312,9 +312,9 @@ void SkRecorder::onDrawVertices(VertexMode vmode,
void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
APPEND(DrawPatch, paint,
- cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
- colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
- texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
+ cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : nullptr,
+ colors ? this->copy(colors, SkPatchUtils::kNumCorners) : nullptr,
+ texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : nullptr,
xmode);
}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 57b4568011..92197a0a3c 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -122,7 +122,7 @@ public:
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
- SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return NULL; }
+ SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return nullptr; }
void flushMiniRecorder();
diff --git a/src/core/SkRefDict.cpp b/src/core/SkRefDict.cpp
index 44eddf01a9..9364a39cc0 100644
--- a/src/core/SkRefDict.cpp
+++ b/src/core/SkRefDict.cpp
@@ -16,15 +16,15 @@ struct SkRefDict::Impl {
SkRefCnt* fData;
};
-SkRefDict::SkRefDict() : fImpl(NULL) {}
+SkRefDict::SkRefDict() : fImpl(nullptr) {}
SkRefDict::~SkRefDict() {
this->removeAll();
}
SkRefCnt* SkRefDict::find(const char name[]) const {
- if (NULL == name) {
- return NULL;
+ if (nullptr == name) {
+ return nullptr;
}
Impl* rec = fImpl;
@@ -34,16 +34,16 @@ SkRefCnt* SkRefDict::find(const char name[]) const {
}
rec = rec->fNext;
}
- return NULL;
+ return nullptr;
}
void SkRefDict::set(const char name[], SkRefCnt* data) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
Impl* rec = fImpl;
- Impl* prev = NULL;
+ Impl* prev = nullptr;
while (rec) {
if (rec->fName.equals(name)) {
if (data) {
@@ -85,5 +85,5 @@ void SkRefDict::removeAll() {
delete rec;
rec = next;
}
- fImpl = NULL;
+ fImpl = nullptr;
}
diff --git a/src/core/SkRefDict.h b/src/core/SkRefDict.h
index 55b9bfe0cf..9583df1f12 100644
--- a/src/core/SkRefDict.h
+++ b/src/core/SkRefDict.h
@@ -22,15 +22,15 @@ public:
~SkRefDict();
/**
- * Return the data associated with name[], or NULL if no matching entry
+ * Return the data associated with name[], or nullptr if no matching entry
* is found. The reference-count of the entry is not affected.
*/
SkRefCnt* find(const char name[]) const;
/**
- * If data is NULL, remove (if present) the entry matching name and call
+ * If data is nullptr, remove (if present) the entry matching name and call
* prev_data->unref() on the data for the matching entry.
- * If data is not-NULL, replace the existing entry matching name and
+ * If data is not-nullptr, replace the existing entry matching name and
* call (prev_data->unref()), or add a new one. In either case,
* data->ref() is called.
*/
@@ -39,7 +39,7 @@ public:
/**
* Remove the matching entry (if found) and unref its data.
*/
- void remove(const char name[]) { this->set(name, NULL); }
+ void remove(const char name[]) { this->set(name, nullptr); }
/**
* Remove all entries, and unref() their associated data.
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index b87fbc87b8..3a542c6169 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -194,8 +194,8 @@ char* SkRegion::toString() {
// 4 ints, up to 10 digits each plus sign, 3 commas, '(', ')', SkRegion() and '\0'
const int max = (count*((11*4)+5))+11+1;
char* result = (char*)sk_malloc_throw(max);
- if (result == NULL) {
- return NULL;
+ if (result == nullptr) {
+ return nullptr;
}
count = sprintf(result, "SkRegion(");
iter.reset(*this);
@@ -408,7 +408,7 @@ bool SkRegion::contains(const SkRegion& rgn) const {
* A contains B is equivalent to
* B - A == 0
*/
- return !Oper(rgn, *this, kDifference_Op, NULL);
+ return !Oper(rgn, *this, kDifference_Op, nullptr);
}
const SkRegion::RunType* SkRegion::getRuns(RunType tmpStorage[],
@@ -498,7 +498,7 @@ bool SkRegion::intersects(const SkRegion& rgn) const {
}
// both of us are complex
- return Oper(*this, rgn, kIntersect_Op, NULL);
+ return Oper(*this, rgn, kIntersect_Op, nullptr);
}
///////////////////////////////////////////////////////////////////////////////
@@ -533,7 +533,7 @@ bool SkRegion::operator==(const SkRegion& b) const {
void SkRegion::translate(int dx, int dy, SkRegion* dst) const {
SkDEBUGCODE(this->validate();)
- if (NULL == dst) {
+ if (nullptr == dst) {
return;
}
if (this->isEmpty()) {
@@ -1074,7 +1074,7 @@ bool SkRegion::Oper(const SkRegion& rgnaOrig, const SkRegion& rgnbOrig, Op op,
// sk_memset32((uint32_t*)array.get(), 0x7FFFFFFF, dstCount);
#endif
- int count = operate(a_runs, b_runs, array.get(), op, NULL == result);
+ int count = operate(a_runs, b_runs, array.get(), op, nullptr == result);
SkASSERT(count <= dstCount);
if (result) {
@@ -1095,7 +1095,7 @@ bool SkRegion::op(const SkRegion& rgna, const SkRegion& rgnb, Op op) {
#include "SkBuffer.h"
size_t SkRegion::writeToMemory(void* storage) const {
- if (NULL == storage) {
+ if (nullptr == storage) {
size_t size = sizeof(int32_t); // -1 (empty), 0 (rect), runCount
if (!this->isEmpty()) {
size += sizeof(fBounds);
@@ -1295,7 +1295,7 @@ void SkRegion::Iterator::reset(const SkRegion& rgn) {
fDone = false;
if (rgn.isRect()) {
fRect = rgn.fBounds;
- fRuns = NULL;
+ fRuns = nullptr;
} else {
fRuns = rgn.fRunHead->readonly_runs();
fRect.set(fRuns[3], fRuns[0], fRuns[4], fRuns[1]);
@@ -1310,7 +1310,7 @@ void SkRegion::Iterator::next() {
return;
}
- if (fRuns == NULL) { // rect case
+ if (fRuns == nullptr) { // rect case
fDone = true;
return;
}
@@ -1402,7 +1402,7 @@ SkRegion::Spanerator::Spanerator(const SkRegion& rgn, int y, int left,
}
fLeft = left;
fRight = right;
- fRuns = NULL; // means we're a rect, not a rgn
+ fRuns = nullptr; // means we're a rect, not a rgn
fDone = false;
} else {
const SkRegion::RunType* runs = rgn.fRunHead->findScanline(y);
@@ -1433,7 +1433,7 @@ bool SkRegion::Spanerator::next(int* left, int* right) {
return false;
}
- if (fRuns == NULL) { // we're a rect
+ if (fRuns == nullptr) { // we're a rect
fDone = true; // ok, now we're done
if (left) {
*left = fLeft;
diff --git a/src/core/SkRegionPriv.h b/src/core/SkRegionPriv.h
index 9ddefc06cc..160c55d555 100644
--- a/src/core/SkRegionPriv.h
+++ b/src/core/SkRegionPriv.h
@@ -142,7 +142,7 @@ public:
/**
* Return the scanline that contains the Y value. This requires that the Y
* value is already known to be contained within the bounds of the region,
- * and so this routine never returns NULL.
+ * and so this routine never returns nullptr.
*
* It returns the beginning of the scanline, starting with its Bottom value.
*/
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index b07d679aa1..9289641c69 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -32,7 +32,7 @@ public:
bool init(int maxHeight, int maxTransitions, bool pathIsInverse);
void done() {
- if (fCurrScanline != NULL) {
+ if (fCurrScanline != nullptr) {
fCurrScanline->fXCount = (SkRegion::RunType)((int)(fCurrXPtr - fCurrScanline->firstX()));
if (!this->collapsWithPrev()) { // flush the last line
fCurrScanline = fCurrScanline->nextScanline();
@@ -94,7 +94,7 @@ private:
int fStorageCount;
bool collapsWithPrev() {
- if (fPrevScanline != NULL &&
+ if (fPrevScanline != nullptr &&
fPrevScanline->fLastY + 1 == fCurrScanline->fLastY &&
fPrevScanline->fXCount == fCurrScanline->fXCount &&
sk_memeq32(fPrevScanline->firstX(), fCurrScanline->firstX(), fCurrScanline->fXCount))
@@ -108,7 +108,7 @@ private:
};
SkRgnBuilder::SkRgnBuilder()
- : fStorage(NULL) {
+ : fStorage(nullptr) {
}
SkRgnBuilder::~SkRgnBuilder() {
@@ -147,17 +147,17 @@ bool SkRgnBuilder::init(int maxHeight, int maxTransitions, bool pathIsInverse) {
}
fStorage = (SkRegion::RunType*)sk_malloc_flags(sk_64_asS32(size), 0);
- if (NULL == fStorage) {
+ if (nullptr == fStorage) {
return false;
}
- fCurrScanline = NULL; // signal empty collection
- fPrevScanline = NULL; // signal first scanline
+ fCurrScanline = nullptr; // signal empty collection
+ fPrevScanline = nullptr; // signal first scanline
return true;
}
void SkRgnBuilder::blitH(int x, int y, int width) {
- if (fCurrScanline == NULL) { // first time
+ if (fCurrScanline == nullptr) { // first time
fTop = (SkRegion::RunType)(y);
fCurrScanline = (Scanline*)fStorage;
fCurrScanline->fLastY = (SkRegion::RunType)(y);
@@ -197,7 +197,7 @@ void SkRgnBuilder::blitH(int x, int y, int width) {
}
int SkRgnBuilder::computeRunCount() const {
- if (fCurrScanline == NULL) {
+ if (fCurrScanline == nullptr) {
return 0;
}
@@ -208,7 +208,7 @@ int SkRgnBuilder::computeRunCount() const {
}
void SkRgnBuilder::copyToRect(SkIRect* r) const {
- SkASSERT(fCurrScanline != NULL);
+ SkASSERT(fCurrScanline != nullptr);
// A rect's scanline is [bottom intervals left right sentinel] == 5
SkASSERT((const SkRegion::RunType*)fCurrScanline - fStorage == 5);
@@ -219,7 +219,7 @@ void SkRgnBuilder::copyToRect(SkIRect* r) const {
}
void SkRgnBuilder::copyToRgn(SkRegion::RunType runs[]) const {
- SkASSERT(fCurrScanline != NULL);
+ SkASSERT(fCurrScanline != nullptr);
SkASSERT((const SkRegion::RunType*)fCurrScanline - fStorage > 4);
const Scanline* line = (const Scanline*)fStorage;
@@ -397,7 +397,7 @@ struct Edge {
fY0 = (SkRegion::RunType)(y0);
fY1 = (SkRegion::RunType)(y1);
fFlags = 0;
- SkDEBUGCODE(fNext = NULL;)
+ SkDEBUGCODE(fNext = nullptr;)
}
int top() const {
@@ -423,7 +423,7 @@ static void find_link(Edge* base, Edge* stop) {
for (;;) {
e += 1;
if ((e->fFlags & Edge::kY1Link) == 0 && y0 == e->fY1) {
- SkASSERT(NULL == e->fNext);
+ SkASSERT(nullptr == e->fNext);
e->fNext = base;
e->fFlags = SkToU8(e->fFlags | Edge::kY1Link);
break;
@@ -436,7 +436,7 @@ static void find_link(Edge* base, Edge* stop) {
for (;;) {
e += 1;
if ((e->fFlags & Edge::kY0Link) == 0 && y1 == e->fY0) {
- SkASSERT(NULL == base->fNext);
+ SkASSERT(nullptr == base->fNext);
base->fNext = e;
e->fFlags = SkToU8(e->fFlags | Edge::kY0Link);
break;
@@ -484,7 +484,7 @@ struct EdgeLT {
};
bool SkRegion::getBoundaryPath(SkPath* path) const {
- // path could safely be NULL if we're empty, but the caller shouldn't
+ // path could safely be nullptr if we're empty, but the caller shouldn't
// *know* that
SkASSERT(path);
@@ -522,7 +522,7 @@ bool SkRegion::getBoundaryPath(SkPath* path) const {
#ifdef SK_DEBUG
for (e = start; e != stop; e++) {
- SkASSERT(e->fNext != NULL);
+ SkASSERT(e->fNext != nullptr);
SkASSERT(e->fFlags == Edge::kCompleteLink);
}
#endif
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 911a09071e..4d2453c71e 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -59,17 +59,17 @@ class SkResourceCache::Hash :
///////////////////////////////////////////////////////////////////////////////
void SkResourceCache::init() {
- fHead = NULL;
- fTail = NULL;
+ fHead = nullptr;
+ fTail = nullptr;
fHash = new Hash;
fTotalBytesUsed = 0;
fCount = 0;
fSingleAllocationByteLimit = 0;
- fAllocator = NULL;
+ fAllocator = nullptr;
// One of these should be explicit set by the caller after we return.
fTotalByteLimit = 0;
- fDiscardableFactory = NULL;
+ fDiscardableFactory = nullptr;
}
#include "SkDiscardableMemory.h"
@@ -116,20 +116,20 @@ bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
}
// A previous call to onUnlock may have deleted our DM, so check for that
- if (NULL == fDM) {
+ if (nullptr == fDM) {
return false;
}
if (!fDM->lock()) {
// since it failed, we delete it now, to free-up the resource
delete fDM;
- fDM = NULL;
+ fDM = nullptr;
return false;
}
SUCCESS:
rec->fPixels = fDM->data();
- rec->fColorTable = NULL;
+ rec->fColorTable = nullptr;
rec->fRowBytes = fRB;
return true;
}
@@ -164,7 +164,7 @@ bool SkResourceCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap, SkColo
}
SkDiscardableMemory* dm = fFactory(size);
- if (NULL == dm) {
+ if (nullptr == dm) {
return false;
}
@@ -371,7 +371,7 @@ SkCachedData* SkResourceCache::newCachedData(size_t bytes) {
if (fDiscardableFactory) {
SkDiscardableMemory* dm = fDiscardableFactory(bytes);
- return dm ? new SkCachedData(bytes, dm) : NULL;
+ return dm ? new SkCachedData(bytes, dm) : nullptr;
} else {
return new SkCachedData(sk_malloc_throw(bytes), bytes);
}
@@ -396,7 +396,7 @@ void SkResourceCache::detach(Rec* rec) {
next->fPrev = prev;
}
- rec->fNext = rec->fPrev = NULL;
+ rec->fNext = rec->fPrev = nullptr;
}
void SkResourceCache::moveToHead(Rec* rec) {
@@ -421,7 +421,7 @@ void SkResourceCache::moveToHead(Rec* rec) {
void SkResourceCache::addToHead(Rec* rec) {
this->validate();
- rec->fPrev = NULL;
+ rec->fPrev = nullptr;
rec->fNext = fHead;
if (fHead) {
fHead->fPrev = rec;
@@ -440,22 +440,22 @@ void SkResourceCache::addToHead(Rec* rec) {
#ifdef SK_DEBUG
void SkResourceCache::validate() const {
- if (NULL == fHead) {
- SkASSERT(NULL == fTail);
+ if (nullptr == fHead) {
+ SkASSERT(nullptr == fTail);
SkASSERT(0 == fTotalBytesUsed);
return;
}
if (fHead == fTail) {
- SkASSERT(NULL == fHead->fPrev);
- SkASSERT(NULL == fHead->fNext);
+ SkASSERT(nullptr == fHead->fPrev);
+ SkASSERT(nullptr == fHead->fNext);
SkASSERT(fHead->bytesUsed() == fTotalBytesUsed);
return;
}
- SkASSERT(NULL == fHead->fPrev);
+ SkASSERT(nullptr == fHead->fPrev);
SkASSERT(fHead->fNext);
- SkASSERT(NULL == fTail->fNext);
+ SkASSERT(nullptr == fTail->fNext);
SkASSERT(fTail->fPrev);
size_t used = 0;
@@ -506,7 +506,7 @@ size_t SkResourceCache::getEffectiveSingleAllocationByteLimit() const {
// if we're not discardable (i.e. we are fixed-budget) then cap the single-limit
// to our budget.
- if (NULL == fDiscardableFactory) {
+ if (nullptr == fDiscardableFactory) {
if (0 == limit) {
limit = fTotalByteLimit;
} else {
@@ -527,7 +527,7 @@ void SkResourceCache::checkMessages() {
///////////////////////////////////////////////////////////////////////////////
SK_DECLARE_STATIC_MUTEX(gMutex);
-static SkResourceCache* gResourceCache = NULL;
+static SkResourceCache* gResourceCache = nullptr;
static void cleanup_gResourceCache() {
// We'll clean this up in our own tests, but disable for clients.
// Chrome seems to have funky multi-process things going on in unit tests that
@@ -542,7 +542,7 @@ static void cleanup_gResourceCache() {
static SkResourceCache* get_cache() {
// gMutex is always held when this is called, so we don't need to be fancy in here.
gMutex.assertHeld();
- if (NULL == gResourceCache) {
+ if (nullptr == gResourceCache) {
#ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE
gResourceCache = new SkResourceCache(SkDiscardableMemory::Create);
#else
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 7267c6739b..813e2ee185 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -79,7 +79,7 @@ public:
// for memory usage diagnostics
virtual const char* getCategory() const = 0;
- virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
+ virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return nullptr; }
// for SkTDynamicHash::Traits
static uint32_t Hash(const Key& key) { return key.hash(); }
@@ -115,7 +115,7 @@ public:
/**
* Returns a locked/pinned SkDiscardableMemory instance for the specified
- * number of bytes, or NULL on failure.
+ * number of bytes, or nullptr on failure.
*/
typedef SkDiscardableMemory* (*DiscardableFactory)(size_t bytes);
@@ -153,13 +153,13 @@ public:
static void TestDumpMemoryStatistics();
/**
- * Returns the DiscardableFactory used by the global cache, or NULL.
+ * Returns the DiscardableFactory used by the global cache, or nullptr.
*/
static DiscardableFactory GetDiscardableFactory();
/**
* Use this allocator for bitmaps, so they can use ashmem when available.
- * Returns NULL if the ResourceCache has not been initialized with a DiscardableFactory.
+ * Returns nullptr if the ResourceCache has not been initialized with a DiscardableFactory.
*/
static SkBitmap::Allocator* GetAllocator();
@@ -250,7 +250,7 @@ private:
Hash* fHash;
DiscardableFactory fDiscardableFactory;
- // the allocator is NULL or one that matches discardables
+ // the allocator is nullptr or one that matches discardables
SkBitmap::Allocator* fAllocator;
size_t fTotalBytesUsed;
diff --git a/src/core/SkScalar.cpp b/src/core/SkScalar.cpp
index e8f6e93348..7cb0a8b148 100644
--- a/src/core/SkScalar.cpp
+++ b/src/core/SkScalar.cpp
@@ -13,8 +13,8 @@
SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[],
const SkScalar values[], int length) {
SkASSERT(length > 0);
- SkASSERT(keys != NULL);
- SkASSERT(values != NULL);
+ SkASSERT(keys != nullptr);
+ SkASSERT(values != nullptr);
#ifdef SK_DEBUG
for (int i = 1; i < length; i++)
SkASSERT(keys[i] >= keys[i-1]);
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 5f0f653ec6..70a9c30e3a 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -63,7 +63,7 @@ void SkGlyph::zeroMetrics() {
static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag,
SkFlattenable::Type ft) {
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t len;
const void* data = desc->findEntry(tag, &len);
@@ -76,7 +76,7 @@ static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag,
}
SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
- : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, NULL)))
+ : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr)))
, fTypeface(SkRef(typeface))
, fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_SkDescriptorTag,
@@ -86,7 +86,7 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
, fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_SkDescriptorTag,
SkFlattenable::kSkRasterizer_Type)))
// Initialize based on our settings. Subclasses can also force this.
- , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != NULL || fRasterizer != NULL)
+ , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || fRasterizer != nullptr)
, fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMaskPreBlend(fRec))
, fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec)
@@ -103,8 +103,8 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill,
rec->fMaskFormat, rec->fStrokeJoin);
SkDebugf(" pathEffect %x maskFilter %x\n",
- desc->findEntry(kPathEffect_SkDescriptorTag, NULL),
- desc->findEntry(kMaskFilter_SkDescriptorTag, NULL));
+ desc->findEntry(kPathEffect_SkDescriptorTag, nullptr),
+ desc->findEntry(kMaskFilter_SkDescriptorTag, nullptr));
#endif
}
@@ -154,7 +154,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
if (fRasterizer) {
SkMask mask;
- if (fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL,
+ if (fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr,
fMaskFilter, &mask,
SkMask::kJustComputeBounds_CreateMode)) {
glyph->fLeft = mask.fBounds.fLeft;
@@ -206,12 +206,12 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
glyph->toMask(&src);
fRec.getMatrixFrom2x2(&matrix);
- src.fImage = NULL; // only want the bounds from the filter
- if (fMaskFilter->filterMask(&dst, src, matrix, NULL)) {
+ src.fImage = nullptr; // only want the bounds from the filter
+ if (fMaskFilter->filterMask(&dst, src, matrix, nullptr)) {
if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) {
goto SK_ERROR;
}
- SkASSERT(dst.fImage == NULL);
+ SkASSERT(dst.fImage == nullptr);
glyph->fLeft = dst.fBounds.fLeft;
glyph->fTop = dst.fBounds.fTop;
glyph->fWidth = SkToU16(dst.fBounds.width());
@@ -485,7 +485,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
// need the original bounds, sans our maskfilter
SkMaskFilter* mf = fMaskFilter;
- fMaskFilter = NULL; // temp disable
+ fMaskFilter = nullptr; // temp disable
this->getMetrics(&tmpGlyph);
fMaskFilter = mf; // restore
@@ -514,7 +514,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
mask.fFormat = SkMask::kA8_Format;
sk_bzero(glyph->fImage, mask.computeImageSize());
- if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL,
+ if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr,
fMaskFilter, &mask,
SkMask::kJustRenderImage_CreateMode)) {
return;
@@ -553,7 +553,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
fRec.getMatrixFrom2x2(&matrix);
- if (fMaskFilter->filterMask(&dstM, srcM, matrix, NULL)) {
+ if (fMaskFilter->filterMask(&dstM, srcM, matrix, nullptr)) {
int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width());
int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height());
int dstRB = origGlyph.rowBytes();
@@ -585,7 +585,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
}
void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) {
- this->internalGetPath(glyph, NULL, path, NULL);
+ this->internalGetPath(glyph, nullptr, path, nullptr);
}
void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) {
@@ -611,7 +611,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
}
}
- if (fRec.fFrameWidth > 0 || fPathEffect != NULL) {
+ if (fRec.fFrameWidth > 0 || fPathEffect != nullptr) {
// need the path in user-space, with only the point-size applied
// so that our stroking and effects will operate the same way they
// would if the user had extracted the path themself, and then
@@ -641,7 +641,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
if (fPathEffect) {
SkPath effectPath;
- if (fPathEffect->filterPath(&effectPath, localPath, &rec, NULL)) {
+ if (fPathEffect->filterPath(&effectPath, localPath, &rec, nullptr)) {
localPath.swap(effectPath);
}
}
@@ -668,7 +668,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
fillToDevMatrix->reset();
}
if (devPath) {
- if (fillPath == NULL) {
+ if (fillPath == nullptr) {
devPath->swap(path);
} else {
*devPath = path;
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 6addf736fc..302698ee4e 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -113,7 +113,7 @@ struct SkScalerContextRec {
* The 'total' matrix is also (optionally) available. This is useful in cases where the
* underlying library will not be used, often when working directly with font data.
*
- * The parameters 'scale' and 'remaining' are required, the other pointers may be NULL.
+ * The parameters 'scale' and 'remaining' are required, the other pointers may be nullptr.
*
* @param preMatrixScale the kind of scale to extract from the total matrix.
* @param scale the scale extracted from the total matrix (both values positive).
@@ -124,9 +124,9 @@ struct SkScalerContextRec {
*/
void computeMatrices(PreMatrixScale preMatrixScale,
SkVector* scale, SkMatrix* remaining,
- SkMatrix* remainingWithoutRotation = NULL,
- SkMatrix* remainingRotation = NULL,
- SkMatrix* total = NULL);
+ SkMatrix* remainingWithoutRotation = nullptr,
+ SkMatrix* remainingRotation = nullptr,
+ SkMatrix* total = nullptr);
inline SkPaint::Hinting getHinting() const;
inline void setHinting(SkPaint::Hinting);
@@ -319,7 +319,7 @@ private:
SkPath* devPath, SkMatrix* fillToDevMatrix);
// returns the right context from our link-list for this char. If no match
- // is found it returns NULL. If a match is found then the glyphID param is
+ // is found it returns nullptr. If a match is found then the glyphID param is
// set to the glyphID that maps to the provided char.
SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID);
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 3f95a6866c..6ea6b8b07e 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -686,7 +686,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
SkScanClipper clipper(blitter, clipRgn, ir);
const SkIRect* clipRect = clipper.getClipRect();
- if (clipper.getBlitter() == NULL) { // clipped out
+ if (clipper.getBlitter() == nullptr) { // clipped out
if (isInverse) {
blitter->blitRegion(*clipRgn);
}
@@ -700,7 +700,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
sk_blit_above(blitter, ir, *clipRgn);
}
- SkIRect superRect, *superClipRect = NULL;
+ SkIRect superRect, *superClipRect = nullptr;
if (clipRect) {
superRect.set( clipRect->fLeft << SHIFT, clipRect->fTop << SHIFT,
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 2bcb4c64c1..beddf63202 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -17,13 +17,13 @@
/* Our attempt to compute the worst case "bounds" for the horizontal and
vertical cases has some numerical bug in it, and we sometimes undervalue
our extends. The bug is that when this happens, we will set the clip to
- NULL (for speed), and thus draw outside of the clip by a pixel, which might
+ nullptr (for speed), and thus draw outside of the clip by a pixel, which might
only look bad, but it might also access memory outside of the valid range
allcoated for the device bitmap.
This define enables our fix to outset our "bounds" by 1, thus avoiding the
chance of the bug, but at the cost of sometimes taking the rectblitter
- case (i.e. not setting the clip to NULL) when we might not actually need
+ case (i.e. not setting the clip to nullptr) when we might not actually need
to. If we can improve/fix the actual calculations, then we can remove this
step.
*/
@@ -88,7 +88,7 @@ static void call_hline_blitter(SkBlitter* blitter, int x, int y, int count,
class SkAntiHairBlitter {
public:
- SkAntiHairBlitter() : fBlitter(NULL) {}
+ SkAntiHairBlitter() : fBlitter(nullptr) {}
virtual ~SkAntiHairBlitter() {}
SkBlitter* getBlitter() const { return fBlitter; }
@@ -340,7 +340,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
Horish_SkAntiHairBlitter horish_blitter;
VLine_SkAntiHairBlitter vline_blitter;
Vertish_SkAntiHairBlitter vertish_blitter;
- SkAntiHairBlitter* hairBlitter = NULL;
+ SkAntiHairBlitter* hairBlitter = nullptr;
if (SkAbs32(x1 - x0) > SkAbs32(y1 - y0)) { // mostly horizontal
if (x0 > x1) { // we want to go left-to-right
@@ -412,7 +412,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
return;
}
if (clip->fTop <= top && clip->fBottom >= bottom) {
- clip = NULL;
+ clip = nullptr;
}
}
} else { // mostly vertical
@@ -488,7 +488,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
return;
}
if (clip->fLeft <= left && clip->fRight >= right) {
- clip = NULL;
+ clip = nullptr;
}
}
}
@@ -526,7 +526,7 @@ void SkScan::AntiHairLineRgn(const SkPoint array[], int arrayCount, const SkRegi
return;
}
- SkASSERT(clip == NULL || !clip->getBounds().isEmpty());
+ SkASSERT(clip == nullptr || !clip->getBounds().isEmpty());
#ifdef TEST_GAMMA
build_gamma_table();
@@ -595,7 +595,7 @@ void SkScan::AntiHairLineRgn(const SkPoint array[], int arrayCount, const SkRegi
}
// fall through to no-clip case
}
- do_anti_hairline(x0, y0, x1, y1, NULL, blitter);
+ do_anti_hairline(x0, y0, x1, y1, nullptr, blitter);
}
}
@@ -699,7 +699,7 @@ static void antifillrect(const SkXRect& xr, SkBlitter* blitter) {
void SkScan::AntiFillXRect(const SkXRect& xr, const SkRegion* clip,
SkBlitter* blitter) {
- if (NULL == clip) {
+ if (nullptr == clip) {
antifillrect(xr, blitter);
} else {
SkIRect outerBounds;
@@ -745,7 +745,7 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip,
XRect_roundOut(xr, &outerBounds);
if (clip.quickContains(outerBounds)) {
- AntiFillXRect(xr, NULL, blitter);
+ AntiFillXRect(xr, nullptr, blitter);
} else {
SkAAClipBlitterWrapper wrapper(clip, blitter);
blitter = wrapper.getBlitter();
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index eeac5cdc2f..7a6e3ba187 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -355,7 +355,7 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
}
SkAAClipBlitterWrapper wrap;
- const SkRegion* clip = NULL;
+ const SkRegion* clip = nullptr;
{
const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1);
@@ -462,7 +462,7 @@ void SkScan::HairLine(const SkPoint pts[], int count, const SkRasterClip& clip,
if (clip.isBW()) {
HairLineRgn(pts, count, &clip.bwRgn(), blitter);
} else {
- const SkRegion* clipRgn = NULL;
+ const SkRegion* clipRgn = nullptr;
SkRect r;
r.set(pts, count);
@@ -483,7 +483,7 @@ void SkScan::AntiHairLine(const SkPoint pts[], int count, const SkRasterClip& cl
if (clip.isBW()) {
AntiHairLineRgn(pts, count, &clip.bwRgn(), blitter);
} else {
- const SkRegion* clipRgn = NULL;
+ const SkRegion* clipRgn = nullptr;
SkRect r;
r.set(pts, count);
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index b7db3b410d..fc79fc8537 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -346,7 +346,7 @@ public:
}
const SkPixmap* justAnOpaqueColor(uint32_t* value) override {
SkDEBUGFAIL("justAnOpaqueColor unexpected");
- return NULL;
+ return nullptr;
}
private:
@@ -437,14 +437,14 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
// this returns the first and last edge after they're sorted into a dlink list
SkEdge* edge = sort_edges(list, count, &last);
- headEdge.fPrev = NULL;
+ headEdge.fPrev = nullptr;
headEdge.fNext = edge;
headEdge.fFirstY = kEDGE_HEAD_Y;
headEdge.fX = SK_MinS32;
edge->fPrev = &headEdge;
tailEdge.fPrev = last;
- tailEdge.fNext = NULL;
+ tailEdge.fNext = nullptr;
tailEdge.fFirstY = kEDGE_TAIL_Y;
last->fNext = &tailEdge;
@@ -460,7 +460,7 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
}
InverseBlitter ib;
- PrePostProc proc = NULL;
+ PrePostProc proc = nullptr;
if (path.isInverseFillType()) {
ib.setBlitter(blitter, clipRgn.getBounds(), shiftEdgesUp);
@@ -468,9 +468,9 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
proc = PrePostInverseBlitterProc;
}
- if (path.isConvex() && (NULL == proc)) {
+ if (path.isConvex() && (nullptr == proc)) {
SkASSERT(count >= 2); // convex walker does not handle missing right edges
- walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, NULL);
+ walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, nullptr);
} else {
int rightEdge;
if (clipRect) {
@@ -518,8 +518,8 @@ void sk_blit_below(SkBlitter* blitter, const SkIRect& ir, const SkRegion& clip)
*/
SkScanClipper::SkScanClipper(SkBlitter* blitter, const SkRegion* clip,
const SkIRect& ir, bool skipRejectTest) {
- fBlitter = NULL; // null means blit nothing
- fClipRect = NULL;
+ fBlitter = nullptr; // null means blit nothing
+ fClipRect = nullptr;
if (clip) {
fClipRect = &clip->getBounds();
@@ -529,7 +529,7 @@ SkScanClipper::SkScanClipper(SkBlitter* blitter, const SkRegion* clip,
if (clip->isRect()) {
if (fClipRect->contains(ir)) {
- fClipRect = NULL;
+ fClipRect = nullptr;
} else {
// only need a wrapper blitter if we're horizontally clipped
if (fClipRect->fLeft > ir.fLeft || fClipRect->fRight < ir.fRight) {
@@ -653,14 +653,14 @@ static void sk_fill_triangle(const SkPoint pts[], const SkIRect* clipRect,
// this returns the first and last edge after they're sorted into a dlink list
SkEdge* edge = sort_edges(list, count, &last);
- headEdge.fPrev = NULL;
+ headEdge.fPrev = nullptr;
headEdge.fNext = edge;
headEdge.fFirstY = kEDGE_HEAD_Y;
headEdge.fX = SK_MinS32;
edge->fPrev = &headEdge;
tailEdge.fPrev = last;
- tailEdge.fNext = NULL;
+ tailEdge.fNext = nullptr;
tailEdge.fFirstY = kEDGE_TAIL_Y;
last->fNext = &tailEdge;
@@ -673,8 +673,8 @@ static void sk_fill_triangle(const SkPoint pts[], const SkIRect* clipRect,
if (clipRect && start_y < clipRect->fTop) {
start_y = clipRect->fTop;
}
- walk_convex_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, NULL);
-// walk_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, NULL);
+ walk_convex_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, nullptr);
+// walk_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, nullptr);
}
void SkScan::FillTriangle(const SkPoint pts[], const SkRasterClip& clip,
diff --git a/src/core/SkSemaphore.cpp b/src/core/SkSemaphore.cpp
index 29d0e0148a..5efdd2e94f 100644
--- a/src/core/SkSemaphore.cpp
+++ b/src/core/SkSemaphore.cpp
@@ -25,15 +25,15 @@
HANDLE fSemaphore;
OSSemaphore() {
- fSemaphore = CreateSemaphore(NULL /*security attributes, optional*/,
+ fSemaphore = CreateSemaphore(nullptr /*security attributes, optional*/,
0 /*initial count*/,
MAXLONG /*max count*/,
- NULL /*name, optional*/);
+ nullptr /*name, optional*/);
}
~OSSemaphore() { CloseHandle(fSemaphore); }
void signal(int n) {
- ReleaseSemaphore(fSemaphore, n, NULL/*returns previous count, optional*/);
+ ReleaseSemaphore(fSemaphore, n, nullptr/*returns previous count, optional*/);
}
void wait() { WaitForSingleObject(fSemaphore, INFINITE/*timeout in ms*/); }
};
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 6da73fc45f..51a8017b5e 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -75,7 +75,7 @@ bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse
bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
SkColor storage;
- if (NULL == colorPtr) {
+ if (nullptr == colorPtr) {
colorPtr = &storage;
}
if (this->onAsLuminanceColor(colorPtr)) {
@@ -86,14 +86,14 @@ bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
}
SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const {
- if (!this->computeTotalInverse(rec, NULL)) {
- return NULL;
+ if (!this->computeTotalInverse(rec, nullptr)) {
+ return nullptr;
}
return this->onCreateContext(rec, storage);
}
SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const {
- return NULL;
+ return nullptr;
}
size_t SkShader::contextSize() const {
@@ -114,7 +114,7 @@ SkShader::Context::Context(const SkShader& shader, const ContextRec& rec)
SkShader::Context::~Context() {}
SkShader::Context::ShadeProc SkShader::Context::asAShadeProc(void** ctx) {
- return NULL;
+ return nullptr;
}
#include "SkColorPriv.h"
@@ -195,7 +195,7 @@ SkShader::Context::MatrixClass SkShader::Context::ComputeMatrixClass(const SkMat
MatrixClass mc = kLinear_MatrixClass;
if (mat.hasPerspective()) {
- if (mat.fixedStepInX(0, NULL, NULL)) {
+ if (mat.fixedStepInX(0, nullptr, nullptr)) {
mc = kFixedStepInX_MatrixClass;
} else {
mc = kPerspective_MatrixClass;
@@ -221,7 +221,7 @@ bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
}
SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const {
- return NULL;
+ return nullptr;
}
SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; }
@@ -230,7 +230,7 @@ SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader(
SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix) {
- return SkCreateBitmapShader(src, tmx, tmy, localMatrix, NULL);
+ return SkCreateBitmapShader(src, tmx, tmy, localMatrix, nullptr);
}
SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, TileMode tmy,
@@ -339,7 +339,7 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix&,
const SkMatrix*, GrColor* paintColor,
GrProcessorDataManager*, GrFragmentProcessor** fp) const {
- *fp = NULL;
+ *fp = nullptr;
SkColor skColor = fColor;
U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha());
*paintColor = SkColor2GrColor(SkColorSetA(skColor, newA));
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index a2c132a50f..c7977d36a5 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -21,7 +21,7 @@ template<typename T> void destroyT(void* ptr) {
* Template class for allocating small objects without additional heap memory
* allocations. kMaxObjects is a hard limit on the number of objects that can
* be allocated using this class. After that, attempts to create more objects
- * with this class will assert and return NULL.
+ * with this class will assert and return nullptr.
* kTotalBytes is the total number of bytes provided for storage for all
* objects created by this allocator. If an object to be created is larger
* than the storage (minus storage already used), it will be allocated on the
@@ -44,7 +44,7 @@ public:
Rec* rec = &fRecs[fNumObjects];
rec->fKillProc(rec->fObj);
// Safe to do if fObj is in fStorage, since fHeapStorage will
- // point to NULL.
+ // point to nullptr.
sk_free(rec->fHeapStorage);
}
}
@@ -54,14 +54,14 @@ public:
* SkSmallAllocator.
* Each version behaves the same but takes a different number of
* arguments.
- * Note: If kMaxObjects have been created by this SkSmallAllocator, NULL
+ * Note: If kMaxObjects have been created by this SkSmallAllocator, nullptr
* will be returned.
*/
template<typename T>
T* createT() {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T;
return static_cast<T*>(buf);
@@ -69,8 +69,8 @@ public:
template<typename T, typename A1> T* createT(const A1& a1) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1);
return static_cast<T*>(buf);
@@ -79,8 +79,8 @@ public:
template<typename T, typename A1, typename A2>
T* createT(const A1& a1, const A2& a2) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2);
return static_cast<T*>(buf);
@@ -89,8 +89,8 @@ public:
template<typename T, typename A1, typename A2, typename A3>
T* createT(const A1& a1, const A2& a2, const A3& a3) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2, a3);
return static_cast<T*>(buf);
@@ -99,8 +99,8 @@ public:
template<typename T, typename A1, typename A2, typename A3, typename A4>
T* createT(const A1& a1, const A2& a2, const A3& a3, const A4& a4) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2, a3, a4);
return static_cast<T*>(buf);
@@ -117,7 +117,7 @@ public:
SkASSERT(fNumObjects < kMaxObjects);
SkASSERT(storageRequired >= sizeof(T));
if (kMaxObjects == fNumObjects) {
- return NULL;
+ return nullptr;
}
const size_t storageRemaining = SkAlign4(kTotalBytes) - fStorageUsed;
storageRequired = SkAlign4(storageRequired);
@@ -133,7 +133,7 @@ public:
} else {
// There is space in fStorage.
rec->fStorageSize = storageRequired;
- rec->fHeapStorage = NULL;
+ rec->fHeapStorage = nullptr;
SkASSERT(SkIsAlign4(fStorageUsed));
rec->fObj = static_cast<void*>(fStorage + (fStorageUsed / 4));
fStorageUsed += storageRequired;
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index 962e2ac651..9c47844082 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -69,7 +69,7 @@ public:
SkSafeRef(fXfermode);
fBufferSize = 0;
- fBuffer = NULL;
+ fBuffer = nullptr;
unsigned flags32 = 0;
if (255 != paint.getAlpha()) {
@@ -137,7 +137,7 @@ public:
}
if (xfermode) {
- xfermode->xfer32(dst, tmp, width, NULL);
+ xfermode->xfer32(dst, tmp, width, nullptr);
} else {
fProc32(dst, tmp, width, fAlpha);
}
@@ -182,7 +182,7 @@ public:
colorFilter->filterSpan(buffer, width, buffer);
}
if (xfermode) {
- xfermode->xfer32(dst, buffer, width, NULL);
+ xfermode->xfer32(dst, buffer, width, nullptr);
} else {
fProc32(dst, buffer, width, fAlpha);
}
@@ -258,21 +258,21 @@ public:
SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkPixmap& source, const SkPaint& paint,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
- if (paint.getMaskFilter() != NULL) {
- return NULL;
+ if (paint.getMaskFilter() != nullptr) {
+ return nullptr;
}
U8CPU alpha = paint.getAlpha();
SkXfermode* xfermode = paint.getXfermode();
SkColorFilter* filter = paint.getColorFilter();
- SkSpriteBlitter* blitter = NULL;
+ SkSpriteBlitter* blitter = nullptr;
switch (source.colorType()) {
case kARGB_4444_SkColorType:
if (alpha != 0xFF) {
- return NULL; // we only have opaque sprites
+ return nullptr; // we only have opaque sprites
}
if (xfermode || filter) {
blitter = allocator->createT<Sprite_D32_S4444_XferFilter>(source, paint);
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 677dbaa365..4dd4164423 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -299,21 +299,21 @@ private:
SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkPixmap& source, const SkPaint& paint,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
- if (paint.getMaskFilter() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getMaskFilter() != nullptr) { // may add cases for this
+ return nullptr;
}
- if (paint.getXfermode() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getXfermode() != nullptr) { // may add cases for this
+ return nullptr;
}
- if (paint.getColorFilter() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getColorFilter() != nullptr) { // may add cases for this
+ return nullptr;
}
const SkAlphaType at = source.alphaType();
- SkSpriteBlitter* blitter = NULL;
+ SkSpriteBlitter* blitter = nullptr;
unsigned alpha = paint.getAlpha();
switch (source.colorType()) {
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 8b2e8ab4ce..5a66399f5e 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -181,7 +181,7 @@ bool SkWStream::writeStream(SkStream* stream, size_t length) {
///////////////////////////////////////////////////////////////////////////////
SkFILEStream::SkFILEStream(const char file[]) : fName(file), fOwnership(kCallerPasses_Ownership) {
- fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : NULL;
+ fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : nullptr;
}
SkFILEStream::SkFILEStream(FILE* file, Ownership ownership)
@@ -199,7 +199,7 @@ void SkFILEStream::setPath(const char path[]) {
fName.set(path);
if (fFILE) {
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
}
if (path) {
fFILE = sk_fopen(fName.c_str(), kRead_SkFILE_Flag);
@@ -224,13 +224,13 @@ bool SkFILEStream::rewind() {
}
// we hit an error
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
}
return false;
}
SkStreamAsset* SkFILEStream::duplicate() const {
- if (NULL == fFILE) {
+ if (nullptr == fFILE) {
return new SkMemoryStream();
}
@@ -246,8 +246,8 @@ SkStreamAsset* SkFILEStream::duplicate() const {
}
fData.reset(SkData::NewFromFILE(fFILE));
- if (NULL == fData.get()) {
- return NULL;
+ if (nullptr == fData.get()) {
+ return nullptr;
}
return new SkMemoryStream(fData);
}
@@ -275,8 +275,8 @@ size_t SkFILEStream::getLength() const {
}
const void* SkFILEStream::getMemoryBase() {
- if (NULL == fData.get()) {
- return NULL;
+ if (nullptr == fData.get()) {
+ return nullptr;
}
return fData->data();
}
@@ -307,7 +307,7 @@ SkMemoryStream::SkMemoryStream(const void* src, size_t size, bool copyData) {
}
SkMemoryStream::SkMemoryStream(SkData* data) {
- if (NULL == data) {
+ if (nullptr == data) {
fData = SkData::NewEmpty();
} else {
fData = data;
@@ -339,7 +339,7 @@ SkData* SkMemoryStream::copyToData() const {
SkData* SkMemoryStream::setData(SkData* data) {
fData->unref();
- if (NULL == data) {
+ if (nullptr == data) {
fData = SkData::NewEmpty();
} else {
fData = data;
@@ -368,7 +368,7 @@ size_t SkMemoryStream::read(void* buffer, size_t size) {
}
bool SkMemoryStream::peek(void* buffer, size_t size) const {
- SkASSERT(buffer != NULL);
+ SkASSERT(buffer != nullptr);
const size_t position = fOffset;
if (size > fData->size() - position) {
// The stream is not large enough to satisfy this request.
@@ -446,7 +446,7 @@ size_t SkFILEWStream::bytesWritten() const {
bool SkFILEWStream::write(const void* buffer, size_t size)
{
- if (fFILE == NULL) {
+ if (fFILE == nullptr) {
return false;
}
@@ -454,7 +454,7 @@ bool SkFILEWStream::write(const void* buffer, size_t size)
{
SkDEBUGCODE(SkDebugf("SkFILEWStream failed writing %d bytes\n", size);)
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
return false;
}
return true;
@@ -500,7 +500,7 @@ struct SkDynamicMemoryWStream::Block {
void init(size_t size)
{
- fNext = NULL;
+ fNext = nullptr;
fCurr = this->start();
fStop = this->start() + size;
}
@@ -515,7 +515,7 @@ struct SkDynamicMemoryWStream::Block {
};
SkDynamicMemoryWStream::SkDynamicMemoryWStream()
- : fHead(NULL), fTail(NULL), fBytesWritten(0), fCopy(NULL)
+ : fHead(nullptr), fTail(nullptr), fBytesWritten(0), fCopy(nullptr)
{
}
@@ -530,12 +530,12 @@ void SkDynamicMemoryWStream::reset()
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
Block* next = block->fNext;
sk_free(block);
block = next;
}
- fHead = fTail = NULL;
+ fHead = fTail = nullptr;
fBytesWritten = 0;
}
@@ -548,7 +548,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t count)
size_t size;
- if (fTail != NULL && fTail->avail() > 0) {
+ if (fTail != nullptr && fTail->avail() > 0) {
size = SkTMin(fTail->avail(), count);
buffer = fTail->append(buffer, size);
SkASSERT(count >= size);
@@ -562,7 +562,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t count)
block->init(size);
block->append(buffer, count);
- if (fTail != NULL)
+ if (fTail != nullptr)
fTail->fNext = block;
else
fHead = fTail = block;
@@ -580,7 +580,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t offset, size_t cou
this->invalidateCopy();
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
if (offset < size) {
size_t part = offset + count > size ? size - offset : count;
@@ -601,7 +601,7 @@ bool SkDynamicMemoryWStream::read(void* buffer, size_t offset, size_t count)
if (offset + count > fBytesWritten)
return false; // test does not partially modify
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
if (offset < size) {
size_t part = offset + count > size ? size - offset : count;
@@ -624,7 +624,7 @@ void SkDynamicMemoryWStream::copyTo(void* dst) const
} else {
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
memcpy(dst, block->start(), size);
dst = (void*)((char*)dst + size);
@@ -634,7 +634,7 @@ void SkDynamicMemoryWStream::copyTo(void* dst) const
}
void SkDynamicMemoryWStream::writeToStream(SkWStream* dst) const {
- for (Block* block = fHead; block != NULL; block = block->fNext) {
+ for (Block* block = fHead; block != nullptr; block = block->fNext) {
dst->write(block->start(), block->written());
}
}
@@ -650,7 +650,7 @@ void SkDynamicMemoryWStream::padToAlign4()
}
SkData* SkDynamicMemoryWStream::copyToData() const {
- if (NULL == fCopy) {
+ if (nullptr == fCopy) {
SkData* data = SkData::NewUninitialized(fBytesWritten);
// be sure to call copyTo() before we assign to fCopy
this->copyTo(data->writable_data());
@@ -662,7 +662,7 @@ SkData* SkDynamicMemoryWStream::copyToData() const {
void SkDynamicMemoryWStream::invalidateCopy() {
if (fCopy) {
fCopy->unref();
- fCopy = NULL;
+ fCopy = nullptr;
}
}
@@ -672,7 +672,7 @@ public:
virtual ~SkBlockMemoryRefCnt() {
SkDynamicMemoryWStream::Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
SkDynamicMemoryWStream::Block* next = block->fNext;
sk_free(block);
block = next;
@@ -701,7 +701,7 @@ public:
count = fSize - fOffset;
}
size_t bytesLeftToRead = count;
- while (fCurrent != NULL) {
+ while (fCurrent != nullptr) {
size_t bytesLeftInCurrent = fCurrent->written() - fCurrentOffset;
size_t bytesFromCurrent = SkTMin(bytesLeftToRead, bytesLeftInCurrent);
if (buffer) {
@@ -726,7 +726,7 @@ public:
}
bool peek(void* buff, size_t size) const override {
- SkASSERT(buff != NULL);
+ SkASSERT(buff != nullptr);
if (fOffset + size > fSize) {
return false;
}
@@ -795,10 +795,10 @@ public:
}
const void* getMemoryBase() override {
- if (NULL == fBlockMemory->fHead->fNext) {
+ if (nullptr == fBlockMemory->fHead->fNext) {
return fBlockMemory->fHead->start();
}
- return NULL;
+ return nullptr;
}
private:
@@ -850,8 +850,8 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
static SkData* mmap_filename(const char path[]) {
SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag);
- if (NULL == file) {
- return NULL;
+ if (nullptr == file) {
+ return nullptr;
}
SkData* data = SkData::NewFromFILE(file);
@@ -870,15 +870,15 @@ SkStreamAsset* SkStream::NewFromFile(const char path[]) {
SkFILEStream* stream = new SkFILEStream(path);
if (!stream->isValid()) {
delete stream;
- stream = NULL;
+ stream = nullptr;
}
return stream;
}
// Declared in SkStreamPriv.h:
size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream) {
- SkASSERT(storage != NULL);
- SkASSERT(stream != NULL);
+ SkASSERT(storage != nullptr);
+ SkASSERT(stream != nullptr);
if (stream->hasLength()) {
const size_t length = stream->getLength();
@@ -908,7 +908,7 @@ size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream) {
// Declared in SkStreamPriv.h:
SkData* SkCopyStreamToData(SkStream* stream) {
- SkASSERT(stream != NULL);
+ SkASSERT(stream != nullptr);
if (stream->hasLength()) {
return SkData::NewFromStream(stream, stream->getLength());
@@ -926,7 +926,7 @@ SkData* SkCopyStreamToData(SkStream* stream) {
SkStreamRewindable* SkStreamRewindableFromSkStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStreamRewindable> dupStream(stream->duplicate());
if (dupStream) {
diff --git a/src/core/SkStreamPriv.h b/src/core/SkStreamPriv.h
index d1af117674..b82f7d84e9 100644
--- a/src/core/SkStreamPriv.h
+++ b/src/core/SkStreamPriv.h
@@ -31,7 +31,7 @@ size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream);
* @param stream SkStream to be copied into data.
* @return SkData* The resulting SkData after the copy. This data
* will have a ref count of one upon return and belongs to the
- * caller. Returns NULL on failure.
+ * caller. Returns nullptr on failure.
*/
SkData *SkCopyStreamToData(SkStream* stream);
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index 5c63a8b515..9110d80eb9 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -256,7 +256,7 @@ SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) {
}
SkString::SkString(size_t len) {
- fRec = AllocRec(NULL, len);
+ fRec = AllocRec(nullptr, len);
}
SkString::SkString(const char text[]) {
@@ -295,7 +295,7 @@ bool SkString::equals(const char text[]) const {
}
bool SkString::equals(const char text[], size_t len) const {
- SkASSERT(len == 0 || text != NULL);
+ SkASSERT(len == 0 || text != nullptr);
return fRec->fLength == len && !memcmp(fRec->data(), text, len);
}
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index 2db5bba524..1689f9730b 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -296,11 +296,11 @@ void SkPathStroker::finishContour(bool close, bool currIsLine) {
// cap the end
fInner.getLastPt(&pt);
fCapper(&fOuter, fPrevPt, fPrevNormal, pt,
- currIsLine ? &fInner : NULL);
+ currIsLine ? &fInner : nullptr);
fOuter.reversePathTo(fInner);
// cap the start
fCapper(&fOuter, fFirstPt, -fFirstNormal, fFirstOuterPt,
- fPrevIsLine ? &fInner : NULL);
+ fPrevIsLine ? &fInner : nullptr);
fOuter.close();
}
}
@@ -553,7 +553,7 @@ SkPathStroker::ReductionType SkPathStroker::CheckCubicLinear(const SkPoint cubic
}
for (int index = 0; index < count; ++index) {
SkScalar t = tValues[index];
- SkEvalCubicAt(cubic, t, &reduction[index], NULL, NULL);
+ SkEvalCubicAt(cubic, t, &reduction[index], nullptr, nullptr);
}
static_assert(kQuad_ReductionType + 1 == kDegenerate_ReductionType, "enum_out_of_whack");
static_assert(kQuad_ReductionType + 2 == kDegenerate2_ReductionType, "enum_out_of_whack");
@@ -589,7 +589,7 @@ SkPathStroker::ReductionType SkPathStroker::CheckConicLinear(const SkConic& coni
return kLine_ReductionType;
}
#endif
- conic.evalAt(t, reduction, NULL);
+ conic.evalAt(t, reduction, nullptr);
return kDegenerate_ReductionType;
}
@@ -738,7 +738,7 @@ void SkPathStroker::conicQuadEnds(const SkConic& conic, SkQuadConstruct* quadPts
bool SkPathStroker::cubicPerpRay(const SkPoint cubic[4], SkScalar t, SkPoint* tPt, SkPoint* onPt,
SkPoint* tangent) const {
SkVector dxy;
- SkEvalCubicAt(cubic, t, tPt, &dxy, NULL);
+ SkEvalCubicAt(cubic, t, tPt, &dxy, nullptr);
if (dxy.fX == 0 && dxy.fY == 0) {
if (SkScalarNearlyZero(t)) {
dxy = cubic[2] - cubic[0];
@@ -779,7 +779,7 @@ bool SkPathStroker::cubicQuadEnds(const SkPoint cubic[4], SkQuadConstruct* quadP
bool SkPathStroker::cubicQuadMid(const SkPoint cubic[4], const SkQuadConstruct* quadPts,
SkPoint* mid) const {
SkPoint cubicMidPt;
- return this->cubicPerpRay(cubic, quadPts->fMidT, &cubicMidPt, mid, NULL);
+ return this->cubicPerpRay(cubic, quadPts->fMidT, &cubicMidPt, mid, nullptr);
}
// Given a quad and t, return the point on curve, its perpendicular, and the perpendicular tangent.
@@ -976,7 +976,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadCubic(const SkPoint cubic[4]
}
// project a ray from the curve to the stroke
SkPoint ray[2]; // points near midpoint on quad, midpoint on cubic
- if (!this->cubicPerpRay(cubic, quadPts->fMidT, &ray[1], &ray[0], NULL)) {
+ if (!this->cubicPerpRay(cubic, quadPts->fMidT, &ray[1], &ray[0], nullptr)) {
return kNormalError_ResultType;
}
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
@@ -994,7 +994,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadConic(const SkConic& conic,
}
// project a ray from the curve to the stroke
SkPoint ray[2]; // points near midpoint on quad, midpoint on conic
- this->conicPerpRay(conic, quadPts->fMidT, &ray[1], &ray[0], NULL);
+ this->conicPerpRay(conic, quadPts->fMidT, &ray[1], &ray[0], nullptr);
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
STROKER_DEBUG_PARAMS(fRecursionDepth));
}
@@ -1021,7 +1021,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadQuad(const SkPoint quad[3],
}
// project a ray from the curve to the stroke
SkPoint ray[2];
- this->quadPerpRay(quad, quadPts->fMidT, &ray[1], &ray[0], NULL);
+ this->quadPerpRay(quad, quadPts->fMidT, &ray[1], &ray[0], nullptr);
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
STROKER_DEBUG_PARAMS(fRecursionDepth));
}
@@ -1429,7 +1429,7 @@ static void addBevel(SkPath* path, const SkRect& r, const SkRect& outer, SkPath:
void SkStroke::strokeRect(const SkRect& origRect, SkPath* dst,
SkPath::Direction dir) const {
- SkASSERT(dst != NULL);
+ SkASSERT(dst != nullptr);
dst->reset();
SkScalar radius = SkScalarHalf(fWidth);
diff --git a/src/core/SkTDPQueue.h b/src/core/SkTDPQueue.h
index a6784bb64b..1545f97995 100644
--- a/src/core/SkTDPQueue.h
+++ b/src/core/SkTDPQueue.h
@@ -15,7 +15,7 @@
* function that compares two Ts and returns true if the first is higher priority than the second.
*
* Optionally objects may know their index into the priority queue. The queue will update the index
- * as the objects move through the queue. This is enabled by using a non-NULL function for INDEX.
+ * as the objects move through the queue. This is enabled by using a non-nullptr function for INDEX.
* When an INDEX function is provided random deletes from the queue are allowed using remove().
* Additionally, the * priority is allowed to change as long as priorityDidChange() is called
* afterwards. In debug builds the index will be set to -1 before an element is removed from the
@@ -23,7 +23,7 @@
*/
template <typename T,
bool (*LESS)(const T&, const T&),
- int* (*INDEX)(const T&) = (int* (*)(const T&))NULL>
+ int* (*INDEX)(const T&) = (int* (*)(const T&))nullptr>
class SkTDPQueue : public SkNoncopyable {
public:
SkTDPQueue() {}
@@ -62,9 +62,9 @@ public:
this->validate();
}
- /** Random access removal. This requires that the INDEX function is non-NULL. */
+ /** Random access removal. This requires that the INDEX function is non-nullptr. */
void remove(T entry) {
- SkASSERT(NULL != INDEX);
+ SkASSERT(nullptr != INDEX);
int index = *INDEX(entry);
SkASSERT(index >= 0 && index < fArray.count());
this->validate();
@@ -84,7 +84,7 @@ public:
item's priority is changed to maintain correct ordering. Changing the priority is only
allowed if an INDEX function is provided. */
void priorityDidChange(T entry) {
- SkASSERT(NULL != INDEX);
+ SkASSERT(nullptr != INDEX);
int index = *INDEX(entry);
SkASSERT(index >= 0 && index < fArray.count());
this->validate(index);
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index 8def89b9ca..2fa37b54f7 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -22,7 +22,7 @@ template <typename T,
int kGrowPercent = 75> // Larger -> more memory efficient, but slower.
class SkTDynamicHash {
public:
- SkTDynamicHash() : fCount(0), fDeleted(0), fCapacity(0), fArray(NULL) {
+ SkTDynamicHash() : fCount(0), fDeleted(0), fCapacity(0), fArray(nullptr) {
SkASSERT(this->validate());
}
@@ -86,14 +86,14 @@ public:
int count() const { return fCount; }
- // Return the entry with this key if we have it, otherwise NULL.
+ // Return the entry with this key if we have it, otherwise nullptr.
T* find(const Key& key) const {
int index = this->firstIndex(key);
for (int round = 0; round < fCapacity; round++) {
SkASSERT(index >= 0 && index < fCapacity);
T* candidate = fArray[index];
if (Empty() == candidate) {
- return NULL;
+ return nullptr;
}
if (Deleted() != candidate && GetKey(*candidate) == key) {
return candidate;
@@ -101,12 +101,12 @@ public:
index = this->nextIndex(index, round);
}
SkASSERT(fCapacity == 0);
- return NULL;
+ return nullptr;
}
// Add an entry with this key. We require that no entry with newEntry's key is already present.
void add(T* newEntry) {
- SkASSERT(NULL == this->find(GetKey(*newEntry)));
+ SkASSERT(nullptr == this->find(GetKey(*newEntry)));
this->maybeGrow();
this->innerAdd(newEntry);
SkASSERT(this->validate());
@@ -132,7 +132,7 @@ public:
fDeleted = 0;
fCapacity = 0;
sk_free(fArray);
- fArray = NULL;
+ fArray = nullptr;
}
protected:
@@ -157,7 +157,7 @@ protected:
private:
// We have two special values to indicate an empty or deleted entry.
- static T* Empty() { return reinterpret_cast<T*>(0); } // i.e. NULL
+ static T* Empty() { return reinterpret_cast<T*>(0); } // i.e. nullptr
static T* Deleted() { return reinterpret_cast<T*>(1); } // Also an invalid pointer.
bool validate() const {
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index 3a91efeed5..ac7f0fa2ab 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -103,13 +103,13 @@ public:
}
/** Adds a new element to the list before the location indicated by the iterator. If the
- iterator refers to a NULL location then the new element is added at the tail */
+ iterator refers to a nullptr location then the new element is added at the tail */
T* addBefore(const T& t, const Iter& location) {
return new (this->internalAddBefore(location)) T(t);
}
/** Adds a new element to the list after the location indicated by the iterator. If the
- iterator refers to a NULL location then the new element is added at the head */
+ iterator refers to a nullptr location then the new element is added at the head */
T* addAfter(const T& t, const Iter& location) {
return new (this->internalAddAfter(location)) T(t);
}
@@ -222,7 +222,7 @@ public:
if (node) {
return reinterpret_cast<T*>(node->fObj);
} else {
- return NULL;
+ return nullptr;
}
}
};
diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp
index b22446bd98..a47dc14b5a 100755
--- a/src/core/SkTLS.cpp
+++ b/src/core/SkTLS.cpp
@@ -56,8 +56,8 @@ void SkTLS::Destructor(void* ptr) {
}
void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
- if (NULL == createProc) {
- return NULL;
+ if (nullptr == createProc) {
+ return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(true);
@@ -69,7 +69,7 @@ void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
SkASSERT(rec->fDeleteProc == deleteProc);
return rec->fData;
}
- } while ((rec = rec->fNext) != NULL);
+ } while ((rec = rec->fNext) != nullptr);
// not found, so create a new one
}
@@ -86,8 +86,8 @@ void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
}
void* SkTLS::Find(CreateProc createProc) {
- if (NULL == createProc) {
- return NULL;
+ if (nullptr == createProc) {
+ return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
@@ -98,20 +98,20 @@ void* SkTLS::Find(CreateProc createProc) {
if (rec->fCreateProc == createProc) {
return rec->fData;
}
- } while ((rec = rec->fNext) != NULL);
+ } while ((rec = rec->fNext) != nullptr);
}
- return NULL;
+ return nullptr;
}
void SkTLS::Delete(CreateProc createProc) {
- if (NULL == createProc) {
+ if (nullptr == createProc) {
return;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
SkTLSRec* curr = (SkTLSRec*)ptr;
- SkTLSRec* prev = NULL;
+ SkTLSRec* prev = nullptr;
while (curr) {
SkTLSRec* next = curr->fNext;
if (curr->fCreateProc == createProc) {
diff --git a/src/core/SkTLS.h b/src/core/SkTLS.h
index e94f835c55..ace2de59e6 100644
--- a/src/core/SkTLS.h
+++ b/src/core/SkTLS.h
@@ -20,7 +20,7 @@ public:
/**
* If Get() has previously been called with this CreateProc, then this
- * returns its cached data, otherwise it returns NULL. The CreateProc is
+ * returns its cached data, otherwise it returns nullptr. The CreateProc is
* never invoked in Find, it is only used as a key for searching the
* cache.
*/
@@ -52,8 +52,8 @@ private:
* Implemented by the platform, to return the value of our (one) slot per-thread
*
* If forceCreateTheSlot is true, then we must have created the "slot" for
- * our TLS, even though we know that the return value will be NULL in that
- * case (i.e. no-slot and first-time-slot both return NULL). This ensures
+ * our TLS, even though we know that the return value will be nullptr in that
+ * case (i.e. no-slot and first-time-slot both return nullptr). This ensures
* that after calling GetSpecific, we know that we can legally call
* SetSpecific.
*
diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h
index 5f8589d912..b0d04d5aa8 100644
--- a/src/core/SkTMultiMap.h
+++ b/src/core/SkTMultiMap.h
@@ -20,7 +20,7 @@ template <typename T,
typename HashTraits=T>
class SkTMultiMap {
struct ValueList {
- explicit ValueList(T* value) : fValue(value), fNext(NULL) {}
+ explicit ValueList(T* value) : fValue(value), fNext(nullptr) {}
static const Key& GetKey(const ValueList& e) { return HashTraits::GetKey(*e.fValue); }
static uint32_t Hash(const Key& key) { return HashTraits::Hash(key); }
@@ -58,7 +58,7 @@ public:
// Since we expect the caller to be fully aware of what is stored, just
// assert that the caller removes an existing value.
SkASSERT(list);
- ValueList* prev = NULL;
+ ValueList* prev = nullptr;
while (list->fValue != value) {
prev = list;
list = list->fNext;
@@ -70,7 +70,7 @@ public:
list->fNext = next->fNext;
delete next;
} else if (prev) {
- prev->fNext = NULL;
+ prev->fNext = nullptr;
delete list;
} else {
fHash.remove(key);
@@ -85,7 +85,7 @@ public:
if (list) {
return list->fValue;
}
- return NULL;
+ return nullptr;
}
template<class FindPredicate>
@@ -97,7 +97,7 @@ public:
}
list = list->fNext;
}
- return NULL;
+ return nullptr;
}
int count() const { return fCount; }
diff --git a/src/core/SkTSearch.cpp b/src/core/SkTSearch.cpp
index 64c70cb311..5b5f139042 100644
--- a/src/core/SkTSearch.cpp
+++ b/src/core/SkTSearch.cpp
@@ -22,7 +22,7 @@ int SkStrSearch(const char*const* base, int count, const char target[],
if (count <= 0)
return ~0;
- SkASSERT(base != NULL);
+ SkASSERT(base != nullptr);
int lo = 0;
int hi = count - 1;
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index 9462903427..97e3ff44a8 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -122,7 +122,7 @@ private:
// Send a poison pill to each thread.
SkAtomic<int> dummy(0);
for (int i = 0; i < fThreads.count(); i++) {
- this->add(NULL, NULL, &dummy);
+ this->add(nullptr, nullptr, &dummy);
}
// Wait for them all to swallow the pill and die.
for (int i = 0; i < fThreads.count(); i++) {
@@ -197,12 +197,12 @@ private:
friend struct SkTaskGroup::Enabler;
};
-ThreadPool* ThreadPool::gGlobal = NULL;
+ThreadPool* ThreadPool::gGlobal = nullptr;
} // namespace
SkTaskGroup::Enabler::Enabler(int threads) {
- SkASSERT(ThreadPool::gGlobal == NULL);
+ SkASSERT(ThreadPool::gGlobal == nullptr);
if (threads != 0) {
ThreadPool::gGlobal = new ThreadPool(threads);
}
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index d2b1605e95..68784f48b5 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -244,7 +244,7 @@ void SkTextBlob::flatten(SkWriteBuffer& buffer) const {
const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
int runCount = reader.read32();
if (runCount < 0) {
- return NULL;
+ return nullptr;
}
SkRect bounds;
@@ -255,7 +255,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
int glyphCount = reader.read32();
GlyphPositioning pos = static_cast<GlyphPositioning>(reader.read32());
if (glyphCount <= 0 || pos > kFull_Positioning) {
- return NULL;
+ return nullptr;
}
SkPoint offset;
@@ -263,7 +263,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
SkPaint font;
reader.readPaint(&font);
- const SkTextBlobBuilder::RunBuffer* buf = NULL;
+ const SkTextBlobBuilder::RunBuffer* buf = nullptr;
switch (pos) {
case kDefault_Positioning:
buf = &blobBuilder.allocRun(font, glyphCount, offset.x(), offset.y(), &bounds);
@@ -275,13 +275,13 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
buf = &blobBuilder.allocRunPos(font, glyphCount, &bounds);
break;
default:
- return NULL;
+ return nullptr;
}
if (!reader.readByteArray(buf->glyphs, glyphCount * sizeof(uint16_t)) ||
!reader.readByteArray(buf->pos,
glyphCount * sizeof(SkScalar) * ScalarsPerGlyph(pos))) {
- return NULL;
+ return nullptr;
}
}
@@ -359,7 +359,7 @@ SkTextBlobBuilder::SkTextBlobBuilder()
}
SkTextBlobBuilder::~SkTextBlobBuilder() {
- if (NULL != fStorage.get()) {
+ if (nullptr != fStorage.get()) {
// We are abandoning runs and must destruct the associated font data.
// The easiest way to accomplish that is to use the blob destructor.
build()->unref();
@@ -447,7 +447,7 @@ void SkTextBlobBuilder::reserve(size_t size) {
}
if (0 == fRunCount) {
- SkASSERT(NULL == fStorage.get());
+ SkASSERT(nullptr == fStorage.get());
SkASSERT(0 == fStorageSize);
SkASSERT(0 == fStorageUsed);
@@ -573,12 +573,12 @@ const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunPos(const SkPaint
}
const SkTextBlob* SkTextBlobBuilder::build() {
- SkASSERT((fRunCount > 0) == (NULL != fStorage.get()));
+ SkASSERT((fRunCount > 0) == (nullptr != fStorage.get()));
this->updateDeferredBounds();
if (0 == fRunCount) {
- SkASSERT(NULL == fStorage.get());
+ SkASSERT(nullptr == fStorage.get());
fStorageUsed = sizeof(SkTextBlob);
fStorage.realloc(fStorageUsed);
}
diff --git a/src/core/SkTraceEvent.h b/src/core/SkTraceEvent.h
index 96b6620b2c..05dc340fa2 100644
--- a/src/core/SkTraceEvent.h
+++ b/src/core/SkTraceEvent.h
@@ -395,7 +395,7 @@ AddTraceEvent(
unsigned char flags) {
return TRACE_EVENT_API_ADD_TRACE_EVENT(
phase, category_group_enabled, name, id,
- kZeroNumArgs, NULL, NULL, NULL, flags);
+ kZeroNumArgs, nullptr, nullptr, nullptr, flags);
}
template<class ARG1_TYPE>
@@ -444,7 +444,7 @@ AddTraceEvent(
class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
public:
// Note: members of data_ intentionally left uninitialized. See Initialize.
- ScopedTracer() : p_data_(NULL) {}
+ ScopedTracer() : p_data_(nullptr) {}
~ScopedTracer() {
if (p_data_ && *data_.category_group_enabled)
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 7da1118cd4..81daf2f610 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -21,7 +21,7 @@ SkTypeface::SkTypeface(const SkFontStyle& style, SkFontID fontID, bool isFixedPi
SkTypeface::~SkTypeface() { }
-SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) = NULL;
+SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) = nullptr;
///////////////////////////////////////////////////////////////////////////////
@@ -31,14 +31,14 @@ public:
protected:
SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { }
- SkStreamAsset* onOpenStream(int* ttcIndex) const override { return NULL; }
+ SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; }
SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override {
- return NULL;
+ return nullptr;
}
void onFilterRec(SkScalerContextRec*) const override { }
virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
PerGlyphInfo,
- const uint32_t*, uint32_t) const override { return NULL; }
+ const uint32_t*, uint32_t) const override { return nullptr; }
void onGetFontDescriptor(SkFontDescriptor*, bool*) const override { }
virtual int onCharsToGlyphs(const void* chars, Encoding encoding,
uint16_t glyphs[], int glyphCount) const override {
@@ -78,7 +78,7 @@ SkTypeface* sk_create_default_typeface(int style) {
SkAutoMutexAcquire lock(&gCreateDefaultMutex);
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
- SkTypeface* t = fm->legacyCreateTypeface(NULL, style);
+ SkTypeface* t = fm->legacyCreateTypeface(nullptr, style);
return t ? t : SkEmptyTypeface::Create();
}
@@ -99,7 +99,7 @@ SkTypeface* SkTypeface::RefDefault(Style style) {
}
uint32_t SkTypeface::UniqueID(const SkTypeface* face) {
- if (NULL == face) {
+ if (nullptr == face) {
face = GetDefaultTypeface();
}
return face->uniqueID();
@@ -118,7 +118,7 @@ SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
return result;
}
}
- if (NULL == name) {
+ if (nullptr == name) {
return RefDefault(style);
}
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
@@ -202,7 +202,7 @@ SkTypeface* SkTypeface::Deserialize(SkStream* stream) {
///////////////////////////////////////////////////////////////////////////////
int SkTypeface::countTables() const {
- return this->onGetTableTags(NULL);
+ return this->onGetTableTags(nullptr);
}
int SkTypeface::getTableTags(SkFontTableTag tags[]) const {
@@ -210,7 +210,7 @@ int SkTypeface::getTableTags(SkFontTableTag tags[]) const {
}
size_t SkTypeface::getTableSize(SkFontTableTag tag) const {
- return this->onGetTableData(tag, 0, ~0U, NULL);
+ return this->onGetTableData(tag, 0, ~0U, nullptr);
}
size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length,
@@ -220,7 +220,7 @@ size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length
SkStreamAsset* SkTypeface::openStream(int* ttcIndex) const {
int ttcIndexStorage;
- if (NULL == ttcIndex) {
+ if (nullptr == ttcIndex) {
// So our subclasses don't need to check for null param
ttcIndex = &ttcIndexStorage;
}
@@ -235,7 +235,7 @@ SkFontData* SkTypeface::createFontData() const {
SkFontData* SkTypeface::onCreateFontData() const {
int index;
SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index));
- return new SkFontData(stream.detach(), index, NULL, 0);
+ return new SkFontData(stream.detach(), index, nullptr, 0);
};
int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding,
@@ -243,7 +243,7 @@ int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding,
if (glyphCount <= 0) {
return 0;
}
- if (NULL == chars || (unsigned)encoding > kUTF32_Encoding) {
+ if (nullptr == chars || (unsigned)encoding > kUTF32_Encoding) {
if (glyphs) {
sk_bzero(glyphs, glyphCount * sizeof(glyphs[0]));
}
@@ -264,13 +264,13 @@ int SkTypeface::getUnitsPerEm() const {
bool SkTypeface::getKerningPairAdjustments(const uint16_t glyphs[], int count,
int32_t adjustments[]) const {
SkASSERT(count >= 0);
- // check for the only legal way to pass a NULL.. everything is 0
+ // check for the only legal way to pass a nullptr.. everything is 0
// in which case they just want to know if this face can possibly support
// kerning (true) or never (false).
- if (NULL == glyphs || NULL == adjustments) {
- SkASSERT(NULL == glyphs);
+ if (nullptr == glyphs || nullptr == adjustments) {
+ SkASSERT(nullptr == glyphs);
SkASSERT(0 == count);
- SkASSERT(NULL == adjustments);
+ SkASSERT(nullptr == adjustments);
}
return this->onGetKerningPairAdjustments(glyphs, count, adjustments);
}
@@ -352,7 +352,7 @@ bool SkTypeface::onComputeBounds(SkRect* bounds) const {
paint.setLinearText(true);
SkScalerContext::Rec rec;
- SkScalerContext::MakeRec(paint, NULL, NULL, &rec);
+ SkScalerContext::MakeRec(paint, nullptr, nullptr, &rec);
SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
SkDescriptor* desc = ad.getDesc();
diff --git a/src/core/SkTypefaceCache.cpp b/src/core/SkTypefaceCache.cpp
index 49779fcbe3..5fe080d05d 100644
--- a/src/core/SkTypefaceCache.cpp
+++ b/src/core/SkTypefaceCache.cpp
@@ -45,7 +45,7 @@ SkTypeface* SkTypefaceCache::findByProcAndRef(FindProc proc, void* ctx) const {
}
curr += 1;
}
- return NULL;
+ return nullptr;
}
void SkTypefaceCache::purge(int numToPurge) {
@@ -113,6 +113,6 @@ static bool DumpProc(SkTypeface* face, const SkFontStyle& s, void* ctx) {
void SkTypefaceCache::Dump() {
#ifdef SK_DEBUG
SkAutoMutexAcquire ama(gMutex);
- (void)Get().findByProcAndRef(DumpProc, NULL);
+ (void)Get().findByProcAndRef(DumpProc, nullptr);
#endif
}
diff --git a/src/core/SkTypefaceCache.h b/src/core/SkTypefaceCache.h
index 792958679c..f39b0d7a44 100644
--- a/src/core/SkTypefaceCache.h
+++ b/src/core/SkTypefaceCache.h
@@ -44,7 +44,7 @@ public:
/**
* Iterate through the cache, calling proc(typeface, ctx) with each
* typeface. If proc returns true, then we return that typeface (this
- * ref()s the typeface). If it never returns true, we return NULL.
+ * ref()s the typeface). If it never returns true, we return nullptr.
*/
SkTypeface* findByProcAndRef(FindProc proc, void* ctx) const;
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index eecf122100..b3f698b4e7 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -155,7 +155,7 @@ size_t SkUTF8_FromUnichar(SkUnichar uni, char utf8[]) {
*--utf8 = (char)(~(0xFF >> count) | uni);
}
- SkASSERT(utf8 == NULL || orig == SkUTF8_ToUnichar(utf8));
+ SkASSERT(utf8 == nullptr || orig == SkUTF8_ToUnichar(utf8));
return count;
}
@@ -260,14 +260,14 @@ size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues,
return 0;
}
- SkASSERT(utf16 != NULL);
+ SkASSERT(utf16 != nullptr);
const uint16_t* stop = utf16 + numberOf16BitValues;
size_t size = 0;
- if (utf8 == NULL) { // just count
+ if (utf8 == nullptr) { // just count
while (utf16 < stop) {
- size += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), NULL);
+ size += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), nullptr);
}
} else {
char* start = utf8;
diff --git a/src/core/SkUtilsArm.cpp b/src/core/SkUtilsArm.cpp
index 9fd19a56a7..9dc4e5472a 100644
--- a/src/core/SkUtilsArm.cpp
+++ b/src/core/SkUtilsArm.cpp
@@ -88,7 +88,7 @@ static bool sk_cpu_arm_check_neon(void) {
char* line = (char*) memmem(buffer, buffer_end - buffer,
features, features_len);
- if (line == NULL) { // Weird, no Features line, bad kernel?
+ if (line == nullptr) { // Weird, no Features line, bad kernel?
SkDebugf("Could not find a line starting with 'Features'"
"in /proc/cpuinfo ?\n");
break;
@@ -98,7 +98,7 @@ static bool sk_cpu_arm_check_neon(void) {
// Find the end of the current line
char* line_end = (char*) memchr(line, '\n', buffer_end - line);
- if (line_end == NULL)
+ if (line_end == nullptr)
line_end = buffer_end;
// Now find an instance of 'neon' in the flags list. We want to
@@ -108,7 +108,7 @@ static bool sk_cpu_arm_check_neon(void) {
const size_t neon_len = sizeof(neon)-1;
const char* flag = (const char*) memmem(line, line_end - line,
neon, neon_len);
- if (flag == NULL)
+ if (flag == nullptr)
break;
// Ensure it is followed by a space or a newline.
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index fd00e7d989..e00613b8b5 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -111,7 +111,7 @@ void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEnc
this->validate(encodingType == encoding);
*length = this->readInt();
const void* ptr = this->skip(SkAlign4(*length));
- void* data = NULL;
+ void* data = nullptr;
if (!fError) {
data = sk_malloc_throw(*length);
memcpy(data, ptr, *length);
@@ -214,7 +214,7 @@ uint32_t SkValidatingReadBuffer::getArrayCount() {
SkTypeface* SkValidatingReadBuffer::readTypeface() {
// TODO: Implement this (securely) when needed
- return NULL;
+ return nullptr;
}
bool SkValidatingReadBuffer::validateAvailable(size_t size) {
@@ -225,24 +225,24 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
SkString name;
this->readString(&name);
if (fError) {
- return NULL;
+ return nullptr;
}
// Is this the type we wanted ?
const char* cname = name.c_str();
SkFlattenable::Type baseType;
if (!SkFlattenable::NameToType(cname, &baseType) || (baseType != type)) {
- return NULL;
+ return nullptr;
}
SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
- if (NULL == factory) {
- return NULL; // writer failed to give us the flattenable
+ if (nullptr == factory) {
+ return nullptr; // writer failed to give us the flattenable
}
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t sizeRecorded = this->readUInt();
if (factory) {
size_t offset = fReader.offset();
@@ -253,7 +253,7 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
if (fError) {
// we could try to fix up the offset...
SkSafeUnref(obj);
- obj = NULL;
+ obj = nullptr;
}
} else {
// we must skip the remaining data
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index 5d395d4841..f95370585d 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -28,17 +28,17 @@ struct SkVarAlloc::Block {
SkVarAlloc::SkVarAlloc(size_t minLgSize)
: fBytesAllocated(0)
- , fByte(NULL)
+ , fByte(nullptr)
, fRemaining(0)
, fLgSize(minLgSize)
- , fBlock(NULL) {}
+ , fBlock(nullptr) {}
SkVarAlloc::SkVarAlloc(size_t minLgSize, char* storage, size_t len)
: fBytesAllocated(0)
, fByte(storage)
, fRemaining(len)
, fLgSize(minLgSize)
- , fBlock(NULL) {}
+ , fBlock(nullptr) {}
SkVarAlloc::~SkVarAlloc() {
Block* b = fBlock;
diff --git a/src/core/SkVertState.cpp b/src/core/SkVertState.cpp
index f23b1083fe..7c3047ec40 100644
--- a/src/core/SkVertState.cpp
+++ b/src/core/SkVertState.cpp
@@ -101,6 +101,6 @@ VertState::Proc VertState::chooseProc(SkCanvas::VertexMode mode) {
case SkCanvas::kTriangleFan_VertexMode:
return fIndices ? TriangleFanX : TriangleFan;
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/core/SkVertState.h b/src/core/SkVertState.h
index ecf1773dc7..ab794521b0 100644
--- a/src/core/SkVertState.h
+++ b/src/core/SkVertState.h
@@ -22,7 +22,7 @@ struct VertState {
/**
* Construct a VertState from a vertex count, index array, and index count.
- * If the vertices are unindexed pass NULL for indices.
+ * If the vertices are unindexed pass nullptr for indices.
*/
VertState(int vCount, const uint16_t indices[], int indexCount)
: fIndices(indices) {
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index faa7f00b08..7ddc77f93b 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -17,19 +17,19 @@
SkWriteBuffer::SkWriteBuffer(uint32_t flags)
: fFlags(flags)
- , fFactorySet(NULL)
- , fNamedFactorySet(NULL)
- , fBitmapHeap(NULL)
- , fTFSet(NULL) {
+ , fFactorySet(nullptr)
+ , fNamedFactorySet(nullptr)
+ , fBitmapHeap(nullptr)
+ , fTFSet(nullptr) {
}
SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags)
: fFlags(flags)
- , fFactorySet(NULL)
- , fNamedFactorySet(NULL)
+ , fFactorySet(nullptr)
+ , fNamedFactorySet(nullptr)
, fWriter(storage, storageSize)
- , fBitmapHeap(NULL)
- , fTFSet(NULL) {
+ , fBitmapHeap(nullptr)
+ , fTFSet(nullptr) {
}
SkWriteBuffer::~SkWriteBuffer() {
@@ -165,12 +165,12 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
// the size of the encoded data. A non-zero size signifies that encoded data was written.
// 3. Call SkBitmap::flatten. After writing a boolean value of false, signifying that a heap was
// not used, write a zero to signify that the data was not encoded.
- bool useBitmapHeap = fBitmapHeap != NULL;
+ bool useBitmapHeap = fBitmapHeap != nullptr;
// Write a bool: true if the SkBitmapHeap is to be used, in which case the reader must use an
// SkBitmapHeapReader to read the SkBitmap. False if the bitmap was serialized another way.
this->writeBool(useBitmapHeap);
if (useBitmapHeap) {
- SkASSERT(NULL == fPixelSerializer);
+ SkASSERT(nullptr == fPixelSerializer);
int32_t slot = fBitmapHeap->insert(bitmap);
fWriter.write32(slot);
// crbug.com/155875
@@ -187,7 +187,7 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
if (pixelRef) {
// see if the pixelref already has an encoded version
SkAutoDataUnref existingData(pixelRef->refEncodedData());
- if (existingData.get() != NULL) {
+ if (existingData.get() != nullptr) {
// Assumes that if the client did not set a serializer, they are
// happy to get the encoded data.
if (!fPixelSerializer || fPixelSerializer->useEncodedData(existingData->data(),
@@ -201,11 +201,11 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
SkAutoPixmapUnlock result;
if (fPixelSerializer && bitmap.requestLock(&result)) {
const SkPixmap& pmap = result.pixmap();
- SkASSERT(NULL == fBitmapHeap);
+ SkASSERT(nullptr == fBitmapHeap);
SkAutoDataUnref data(fPixelSerializer->encodePixels(pmap.info(),
pmap.addr(),
pmap.rowBytes()));
- if (data.get() != NULL) {
+ if (data.get() != nullptr) {
// if we have to "encode" the bitmap, then we assume there is no
// offset to share, since we are effectively creating a new pixelref
write_encoded_bitmap(this, data, SkIPoint::Make(0, 0));
@@ -247,7 +247,7 @@ void SkWriteBuffer::writeImage(const SkImage* image) {
}
void SkWriteBuffer::writeTypeface(SkTypeface* obj) {
- if (NULL == obj || NULL == fTFSet) {
+ if (nullptr == obj || nullptr == fTFSet) {
fWriter.write32(0);
} else {
fWriter.write32(fTFSet->add(obj));
@@ -256,18 +256,18 @@ void SkWriteBuffer::writeTypeface(SkTypeface* obj) {
SkFactorySet* SkWriteBuffer::setFactoryRecorder(SkFactorySet* rec) {
SkRefCnt_SafeAssign(fFactorySet, rec);
- if (fNamedFactorySet != NULL) {
+ if (fNamedFactorySet != nullptr) {
fNamedFactorySet->unref();
- fNamedFactorySet = NULL;
+ fNamedFactorySet = nullptr;
}
return rec;
}
SkNamedFactorySet* SkWriteBuffer::setNamedFactoryRecorder(SkNamedFactorySet* rec) {
SkRefCnt_SafeAssign(fNamedFactorySet, rec);
- if (fFactorySet != NULL) {
+ if (fFactorySet != nullptr) {
fFactorySet->unref();
- fFactorySet = NULL;
+ fFactorySet = nullptr;
}
return rec;
}
@@ -279,9 +279,9 @@ SkRefCntSet* SkWriteBuffer::setTypefaceRecorder(SkRefCntSet* rec) {
void SkWriteBuffer::setBitmapHeap(SkBitmapHeap* bitmapHeap) {
SkRefCnt_SafeAssign(fBitmapHeap, bitmapHeap);
- if (bitmapHeap != NULL) {
- SkASSERT(NULL == fPixelSerializer);
- fPixelSerializer.reset(NULL);
+ if (bitmapHeap != nullptr) {
+ SkASSERT(nullptr == fPixelSerializer);
+ fPixelSerializer.reset(nullptr);
}
}
@@ -289,9 +289,9 @@ void SkWriteBuffer::setPixelSerializer(SkPixelSerializer* serializer) {
fPixelSerializer.reset(serializer);
if (serializer) {
serializer->ref();
- SkASSERT(NULL == fBitmapHeap);
+ SkASSERT(nullptr == fBitmapHeap);
SkSafeUnref(fBitmapHeap);
- fBitmapHeap = NULL;
+ fBitmapHeap = nullptr;
}
}
@@ -306,19 +306,19 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
* The distinction is important, since 0-index is 32bits (always), but a
* 0-functionptr might be 32 or 64 bits.
*/
- if (NULL == flattenable) {
+ if (nullptr == flattenable) {
if (this->isValidating()) {
this->writeString("");
- } else if (fFactorySet != NULL || fNamedFactorySet != NULL) {
+ } else if (fFactorySet != nullptr || fNamedFactorySet != nullptr) {
this->write32(0);
} else {
- this->writeFunctionPtr(NULL);
+ this->writeFunctionPtr(nullptr);
}
return;
}
SkFlattenable::Factory factory = flattenable->getFactory();
- SkASSERT(factory != NULL);
+ SkASSERT(factory != nullptr);
/*
* We can write 1 of 3 versions of the flattenable:
diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp
index a1a8b8800a..457cff49ab 100644
--- a/src/core/SkWriter32.cpp
+++ b/src/core/SkWriter32.cpp
@@ -37,7 +37,7 @@ size_t SkReader32::readIntoString(SkString* copy) {
}
void SkWriter32::writeString(const char str[], size_t len) {
- if (NULL == str) {
+ if (nullptr == str) {
str = "";
len = 0;
}
@@ -64,7 +64,7 @@ size_t SkWriter32::WriteStringSize(const char* str, size_t len) {
}
void SkWriter32::growToAtLeast(size_t size) {
- const bool wasExternal = (fExternal != NULL) && (fData == fExternal);
+ const bool wasExternal = (fExternal != nullptr) && (fData == fExternal);
fCapacity = 4096 + SkTMax(size, fCapacity + (fCapacity / 2));
fInternal.realloc(fCapacity);
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 17ce215c7a..1d409866bb 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -666,7 +666,7 @@ bool SkXfermode::asXPFactory(GrXPFactory**) const {
#include "effects/GrPorterDuffXferProcessor.h"
bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) {
- if (NULL == xfermode) {
+ if (nullptr == xfermode) {
if (xpf) {
*xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode);
}
@@ -691,7 +691,7 @@ void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
dst[i] = this->xferColor(src[i], dst[i]);
}
@@ -715,7 +715,7 @@ void SkXfermode::xfer16(uint16_t* dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
dst[i] = SkPixel32ToPixel16_ToU16(this->xferColor(src[i], dstC));
@@ -740,7 +740,7 @@ void SkXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor res = this->xferColor(src[i], (dst[i] << SK_A32_SHIFT));
dst[i] = SkToU8(SkGetPackedA32(res));
@@ -775,7 +775,7 @@ bool SkXfermode::isOpaque(SkXfermode::SrcColorOpacity opacityType) const {
SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) {
uint32_t mode32 = buffer.read32();
if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) {
- return NULL;
+ return nullptr;
}
return SkXfermode::Create((SkXfermode::Mode)mode32);
}
@@ -840,7 +840,7 @@ void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
dst[i] = proc(src[i], dst[i]);
}
@@ -868,7 +868,7 @@ void SkProcCoeffXfermode::xfer16(uint16_t* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
dst[i] = SkPixel32ToPixel16_ToU16(proc(src[i], dstC));
@@ -897,7 +897,7 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor res = proc(src[i], dst[i] << SK_A32_SHIFT);
dst[i] = SkToU8(SkGetPackedA32(res));
@@ -1017,20 +1017,20 @@ SkXfermode* SkXfermode::Create(Mode mode) {
if ((unsigned)mode >= kModeCount) {
// report error
- return NULL;
+ return nullptr;
}
- // Skia's "default" mode is srcover. NULL in SkPaint is interpreted as srcover
- // so we can just return NULL from the factory.
+ // Skia's "default" mode is srcover. nullptr in SkPaint is interpreted as srcover
+ // so we can just return nullptr from the factory.
if (kSrcOver_Mode == mode) {
- return NULL;
+ return nullptr;
}
return SkSafeRef(cached[mode]);
}
SkXfermodeProc SkXfermode::GetProc(Mode mode) {
- SkXfermodeProc proc = NULL;
+ SkXfermodeProc proc = nullptr;
if ((unsigned)mode < kModeCount) {
proc = gProcCoeffs[mode].fProc;
}
@@ -1062,7 +1062,7 @@ bool SkXfermode::ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst) {
}
bool SkXfermode::AsMode(const SkXfermode* xfer, Mode* mode) {
- if (NULL == xfer) {
+ if (nullptr == xfer) {
if (mode) {
*mode = kSrcOver_Mode;
}
@@ -1081,7 +1081,7 @@ bool SkXfermode::IsMode(const SkXfermode* xfer, Mode mode) {
}
bool SkXfermode::SupportsCoverageAsAlpha(const SkXfermode* xfer) {
- // if xfer is NULL we treat it as srcOver which always supports coverageAsAlpha
+ // if xfer is nullptr we treat it as srcOver which always supports coverageAsAlpha
if (!xfer) {
return true;
}
@@ -1090,7 +1090,7 @@ bool SkXfermode::SupportsCoverageAsAlpha(const SkXfermode* xfer) {
}
bool SkXfermode::IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType) {
- // if xfer is NULL we treat it as srcOver which is opaque if our src is opaque
+ // if xfer is nullptr we treat it as srcOver which is opaque if our src is opaque
if (!xfer) {
return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
}
diff --git a/src/core/SkYUVPlanesCache.cpp b/src/core/SkYUVPlanesCache.cpp
index f013599cc5..336b581246 100644
--- a/src/core/SkYUVPlanesCache.cpp
+++ b/src/core/SkYUVPlanesCache.cpp
@@ -59,7 +59,7 @@ struct YUVPlanesRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -75,7 +75,7 @@ SkCachedData* SkYUVPlanesCache::FindAndRef(uint32_t genID, Info* info,
YUVValue result;
YUVPlanesKey key(genID);
if (!CHECK_LOCAL(localCache, find, Find, key, YUVPlanesRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*info = result.fInfo;
diff --git a/src/core/SkYUVPlanesCache.h b/src/core/SkYUVPlanesCache.h
index aa9b89e2a5..a024192d07 100644
--- a/src/core/SkYUVPlanesCache.h
+++ b/src/core/SkYUVPlanesCache.h
@@ -35,16 +35,16 @@ public:
/**
* On success, return a ref to the SkCachedData that holds the pixels.
*
- * On failure, return NULL.
+ * On failure, return nullptr.
*/
static SkCachedData* FindAndRef(uint32_t genID, Info* info,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* Add a pixelRef ID and its YUV planes data to the cache.
*/
static void Add(uint32_t genID, SkCachedData* data, Info* info,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
};
#endif