diff options
author | halcanary <halcanary@google.com> | 2015-08-27 07:41:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 07:41:16 -0700 |
commit | 96fcdcc219d2a0d3579719b84b28bede76efba64 (patch) | |
tree | 0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /src/animator | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'src/animator')
60 files changed, 361 insertions, 361 deletions
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp index 8d8c268016..0dbe9c9f0f 100644 --- a/src/animator/SkAnimateActive.cpp +++ b/src/animator/SkAnimateActive.cpp @@ -152,7 +152,7 @@ void SkActive::calcDurations(int index) // SkScriptValue value; // value.fOperand = animate->getValues()[entries - 1]; // value.fType = animate->getValuesType(); -// bool result = SkScriptEngine::ConvertTo(NULL, SkType_Int, &value); +// bool result = SkScriptEngine::ConvertTo(nullptr, SkType_Int, &value); // SkASSERT(result); // duration = value.fOperand.fS32 * SK_MSec1; // break; @@ -174,7 +174,7 @@ void SkActive::create(SkADrawable* drawable, SkMSec time) { if (animate->formula.size() > 0) { SkTDOperandArray values; values.setCount(count); - SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL, + SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, nullptr, animate->getValuesType(), animate->formula); SkASSERT(success); fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time); @@ -212,7 +212,7 @@ bool SkActive::immediate(bool enable) { if (animate->formula.size() > 0) { SkTDOperandArray values; values.setCount(count); - SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL, + SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, nullptr, animate->getValuesType(), animate->formula); SkASSERT(success); fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time); @@ -368,7 +368,7 @@ void SkActive::saveInterpolatorValues(int index) { } void SkActive::setInterpolator(int index, SkOperand* from) { - if (from == NULL) // legitimate for set string + if (from == nullptr) // legitimate for set string return; SkAnimateBase* animate = fAnimators[index]; int entries = animate->entries(); diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp index 82f777ef39..a4b2c64d1e 100644 --- a/src/animator/SkAnimateBase.cpp +++ b/src/animator/SkAnimateBase.cpp @@ -39,7 +39,7 @@ const SkMemberInfo SkAnimateBase::fInfo[] = { DEFINE_GET_MEMBER(SkAnimateBase); SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1), - fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL), + fApply(nullptr), fFieldInfo(nullptr), fFieldOffset(0), fStart((SkMSec) -1), fTarget(nullptr), fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0), fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) { blend.setCount(1); @@ -116,7 +116,7 @@ returnBool: value->fType = SkType_Boolean; break; case SK_PROPERTY(step): - if (fApply == NULL) + if (fApply == nullptr) return false; // !!! notify there's an error? fApply->getStep(value); break; @@ -148,7 +148,7 @@ void SkAnimateBase::onEndElement(SkAnimateMaker& maker) { // lval must be of the form x[y] const char* lvalStr = lval.c_str(); const char* arrayEnd = strchr(lvalStr, '['); - if (arrayEnd == NULL) + if (arrayEnd == nullptr) return; //should this return an error? size_t arrayNameLen = arrayEnd - lvalStr; SkString arrayStr(lvalStr, arrayNameLen); diff --git a/src/animator/SkAnimateField.cpp b/src/animator/SkAnimateField.cpp index c6676e5be7..00113823ee 100644 --- a/src/animator/SkAnimateField.cpp +++ b/src/animator/SkAnimateField.cpp @@ -63,7 +63,7 @@ void SkAnimate::dump(SkAnimateMaker* maker) { #endif bool SkAnimate::resolveCommon(SkAnimateMaker& maker) { - if (fTarget == NULL) // if NULL, recall onEndElement after apply closes and sets target to scope + if (fTarget == nullptr) // if nullptr, recall onEndElement after apply closes and sets target to scope return false; INHERITED::onEndElement(maker); return maker.hasError() == false; @@ -71,16 +71,16 @@ bool SkAnimate::resolveCommon(SkAnimateMaker& maker) { void SkAnimate::onEndElement(SkAnimateMaker& maker) { bool resolved = resolveCommon(maker); - if (resolved && fFieldInfo == NULL) { + if (resolved && fFieldInfo == nullptr) { maker.setErrorNoun(field); maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget); } - if (resolved == false || fFieldInfo == NULL) + if (resolved == false || fFieldInfo == nullptr) return; SkDisplayTypes outType = fFieldInfo->getType(); if (fHasValues) { SkASSERT(to.size() > 0); - fFieldInfo->setValue(maker, &fValues, 0, 0, NULL, outType, to); + fFieldInfo->setValue(maker, &fValues, 0, 0, nullptr, outType, to); SkASSERT(0); // !!! this needs to set fComponents return; diff --git a/src/animator/SkAnimateMaker.cpp b/src/animator/SkAnimateMaker.cpp index 256576259e..0c28c7bd57 100644 --- a/src/animator/SkAnimateMaker.cpp +++ b/src/animator/SkAnimateMaker.cpp @@ -28,8 +28,8 @@ class DefaultTimeline : public SkAnimator::Timeline { } gDefaultTimeline; SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint) - : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0), - fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(NULL), + : fActiveEvent(nullptr), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0), + fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(nullptr), fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false), fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator) { @@ -66,8 +66,8 @@ void SkAnimateMaker::clearExtraPropertyCallBack(SkDisplayTypes type) { for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) { SkExtras* extra = *extraPtr; if (extra->definesType(type)) { - extra->fExtraCallBack = NULL; - extra->fExtraStorage = NULL; + extra->fExtraCallBack = nullptr; + extra->fExtraStorage = nullptr; break; } } @@ -84,7 +84,7 @@ SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) { SkDisplayTypes type = SkDisplayType::GetType(this, name, len ); if ((int)type >= 0) return SkDisplayType::CreateInstance(this, type); - return NULL; + return nullptr; } // differs from SkAnimator::decodeStream in that it does not reset error state @@ -181,7 +181,7 @@ void SkAnimateMaker::dump(const char* match) { SkTDict<SkDisplayable*>::Iter iter(fIDs); const char* name; SkDisplayable* result; - while ((name = iter.next(&result)) != NULL) { + while ((name = iter.next(&result)) != nullptr) { if (strcmp(match,name) == 0) result->dump(this); } @@ -213,7 +213,7 @@ SkAnimator* SkAnimateMaker::getRoot() SkAnimateMaker* maker = this; while (maker->fParentMaker) maker = maker->fParentMaker; - return maker == this ? NULL : maker->fAnimator; + return maker == this ? nullptr : maker->fAnimator; } #endif @@ -235,8 +235,8 @@ void SkAnimateMaker::loadMovies() { SkASSERT(displayable->getType() == SkType_Movie); SkDisplayMovie* movie = (SkDisplayMovie*) displayable; SkAnimateMaker* movieMaker = movie->fMovie.fMaker; - movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL); - movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL); + movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, nullptr); + movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr); movieMaker->loadMovies(); } } @@ -271,14 +271,14 @@ void SkAnimateMaker::reset() { } void SkAnimateMaker::removeActive(SkActive* active) { - if (active == NULL) + if (active == nullptr) return; fDisplayList.remove(active); } bool SkAnimateMaker::resolveID(SkDisplayable* displayable, SkDisplayable* original) { SkString newID; - bool success = computeID(original, NULL, &newID); + bool success = computeID(original, nullptr, &newID); if (success) setID(displayable, newID); return success; diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp index 6679a92fb5..c05e0299d8 100644 --- a/src/animator/SkAnimateSet.cpp +++ b/src/animator/SkAnimateSet.cpp @@ -48,14 +48,14 @@ void SkSet::dump(SkAnimateMaker* maker) { #endif void SkSet::refresh(SkAnimateMaker& maker) { - fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL, + fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, nullptr, fFieldInfo->getType(), to); } void SkSet::onEndElement(SkAnimateMaker& maker) { if (resolveCommon(maker) == false) return; - if (fFieldInfo == NULL) { + if (fFieldInfo == nullptr) { maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget); return; } diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp index 97f55af01a..ee75ab14af 100644 --- a/src/animator/SkAnimator.cpp +++ b/src/animator/SkAnimator.cpp @@ -42,7 +42,7 @@ _static const char gMathPrimerText[] = #define gMathPrimer gMathPrimerText -SkAnimator::SkAnimator() : fMaker(NULL) { +SkAnimator::SkAnimator() : fMaker(nullptr) { initialize(); } @@ -144,7 +144,7 @@ bool SkAnimator::doUserEvent(const SkEvent& evt) { } SkAnimator::DifferenceType SkAnimator::draw(SkCanvas* canvas, SkPaint* paint, SkMSec time) { - if (paint == NULL) + if (paint == nullptr) return draw(canvas, time); fMaker->fScreenplay.time = time; fMaker->fCanvas = canvas; @@ -179,7 +179,7 @@ bool SkAnimator::findClickEvent(SkScalar x, SkScalar y) { const SkAnimator* SkAnimator::getAnimator(const SkDisplayable* displayable) const { if (displayable->getType() != SkType_Movie) - return NULL; + return nullptr; const SkDisplayMovie* movie = (const SkDisplayMovie*) displayable; return movie->getAnimator(); } @@ -187,13 +187,13 @@ const SkAnimator* SkAnimator::getAnimator(const SkDisplayable* displayable) cons const SkDisplayable* SkAnimator::getElement(const char* id) { SkDisplayable* element; if (fMaker->find(id, &element) == false) - return NULL; + return nullptr; return (const SkDisplayable*) element; } SkElementType SkAnimator::getElementType(const SkDisplayable* ae) { SkDisplayable* element = (SkDisplayable*) ae; - const SkMemberInfo* info = SkDisplayType::GetMembers(fMaker, element->getType(), NULL); + const SkMemberInfo* info = SkDisplayType::GetMembers(fMaker, element->getType(), nullptr); return (SkElementType) SkDisplayType::Find(fMaker, info); } @@ -240,10 +240,10 @@ int32_t SkAnimator::getArrayInt(const SkDisplayable* ae, int32_t SkAnimator::getArrayInt(const char* id, const char* fieldID, int index) { const SkDisplayable* element = getElement(id); - if (element == NULL) + if (element == nullptr) return SK_NaN32; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return SK_NaN32; return getArrayInt(element, field, index); } @@ -257,10 +257,10 @@ SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae, SkScalar SkAnimator::getArrayScalar(const char* id, const char* fieldID, int index) { const SkDisplayable* element = getElement(id); - if (element == NULL) + if (element == nullptr) return SK_ScalarNaN; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return SK_ScalarNaN; return getArrayScalar(element, field, index); } @@ -269,16 +269,16 @@ const char* SkAnimator::getArrayString(const SkDisplayable* ae, const SkMemberInfo* ai, int index) { SkOperand operand; bool result = getArrayCommon(ae, ai, index, &operand); - return result ? operand.fString->c_str() : NULL; + return result ? operand.fString->c_str() : nullptr; } const char* SkAnimator::getArrayString(const char* id, const char* fieldID, int index) { const SkDisplayable* element = getElement(id); - if (element == NULL) - return NULL; + if (element == nullptr) + return nullptr; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) - return NULL; + if (field == nullptr) + return nullptr; return getArrayString(element, field, index); } @@ -326,10 +326,10 @@ int32_t SkAnimator::getInt(const SkDisplayable* element, const SkMemberInfo* inf int32_t SkAnimator::getInt(const char* id, const char* fieldID) { const SkDisplayable* element = getElement(id); - if (element == NULL) + if (element == nullptr) return SK_NaN32; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return SK_NaN32; return getInt(element, field); } @@ -352,10 +352,10 @@ SkScalar SkAnimator::getScalar(const SkDisplayable* element, const SkMemberInfo* SkScalar SkAnimator::getScalar(const char* id, const char* fieldID) { const SkDisplayable* element = getElement(id); - if (element == NULL) + if (element == nullptr) return SK_ScalarNaN; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return SK_ScalarNaN; return getScalar(element, field); } @@ -371,11 +371,11 @@ const char* SkAnimator::getString(const SkDisplayable* ae, const char* SkAnimator::getString(const char* id, const char* fieldID) { const SkDisplayable* element = getElement(id); - if (element == NULL) - return NULL; + if (element == nullptr) + return nullptr; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) - return NULL; + if (field == nullptr) + return nullptr; return getString(element, field); } @@ -385,7 +385,7 @@ const char* SkAnimator::getURIBase() { void SkAnimator::initialize() { delete fMaker; - fMaker = new SkAnimateMaker(this, NULL, NULL); + fMaker = new SkAnimateMaker(this, nullptr, nullptr); decodeMemory(gMathPrimer, sizeof(gMathPrimer)-1); #ifdef SK_BUILD_FOR_ANDROID InitializeSkExtraPathEffects(this); @@ -402,7 +402,7 @@ bool SkAnimator::isTrackingEvents() { bool SkAnimator::onEvent(const SkEvent& evt) { #ifdef SK_DEBUG SkAnimator* root = fMaker->getRoot(); - if (root == NULL) + if (root == nullptr) root = this; if (root->isTrackingEvents()) root->eventDone(evt); @@ -424,7 +424,7 @@ bool SkAnimator::onEvent(const SkEvent& evt) { } { const char* id = evt.findString("id"); - if (id == NULL) + if (id == nullptr) return false; SkDisplayable** firstMovie = fMaker->fMovies.begin(); SkDisplayable** endMovie = fMaker->fMovies.end(); @@ -555,11 +555,11 @@ bool SkAnimator::setArray(SkDisplayable* element, const SkMemberInfo* info, SkTy bool SkAnimator::setArray(const char* id, const char* fieldID, SkTypedArray array) { SkDisplayable* element = (SkDisplayable*) getElement(id); - //should I go ahead and change all 'NULL's to 'NULL'? - if (element == NULL) + //should I go ahead and change all 'nullptr's to 'nullptr'? + if (element == nullptr) return false; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return false; return setArray(element, field, array); } @@ -581,10 +581,10 @@ bool SkAnimator::setInt(SkDisplayable* element, const SkMemberInfo* info, int32_ bool SkAnimator::setInt(const char* id, const char* fieldID, int32_t s32) { SkDisplayable* element = (SkDisplayable*) getElement(id); - if (element == NULL) + if (element == nullptr) return false; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return false; return setInt(element, field, s32); } @@ -606,10 +606,10 @@ bool SkAnimator::setScalar(SkDisplayable* element, const SkMemberInfo* info, SkS bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar) { SkDisplayable* element = (SkDisplayable*) getElement(id); - if (element == NULL) + if (element == nullptr) return false; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return false; return setScalar(element, field, scalar); } @@ -617,16 +617,16 @@ bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar) bool SkAnimator::setString(SkDisplayable* element, const SkMemberInfo* info, const char* str) { // !!! until this is fixed, can't call script with global references from here - info->setValue(*fMaker, NULL, 0, info->fCount, element, info->getType(), str, strlen(str)); + info->setValue(*fMaker, nullptr, 0, info->fCount, element, info->getType(), str, strlen(str)); return true; } bool SkAnimator::setString(const char* id, const char* fieldID, const char* str) { SkDisplayable* element = (SkDisplayable*) getElement(id); - if (element == NULL) + if (element == nullptr) return false; const SkMemberInfo* field = getField(element, fieldID); - if (field == NULL) + if (field == nullptr) return false; return setString(element, field, str); } diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp index 051dc0d872..cbe1d04b1e 100644 --- a/src/animator/SkAnimatorScript.cpp +++ b/src/animator/SkAnimatorScript.cpp @@ -45,7 +45,7 @@ static const SkDisplayEnumMap gEnumMaps[] = { static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps); SkAnimatorScript::SkAnimatorScript(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type) - : SkScriptEngine(SkScriptEngine::ToOpType(type)), fMaker(maker), fParent(NULL), fWorking(working) + : SkScriptEngine(SkScriptEngine::ToOpType(type)), fMaker(maker), fParent(nullptr), fWorking(working) { memberCallBack(EvalMember, (void*) this); memberFunctionCallBack(EvalMemberFunction, (void*) this); @@ -165,7 +165,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip displayable = engine->fWorking; if (SK_LITERAL_STR_EQUAL("parent", token, len)) { SkDisplayable* parent = displayable->getParent(); - if (parent == NULL) + if (parent == nullptr) parent = engine->fParent; if (parent) { value->fOperand.fDisplayable = parent; @@ -175,7 +175,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip } if (displayable && EvalMember(token, len, displayable, engine, value)) return true; - value->fOperand.fString = NULL; + value->fOperand.fString = nullptr; value->fType = SkType_String; } else { SkDisplayable* working = engine->fWorking; @@ -194,7 +194,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip bool SkAnimatorScript::EvalNamedColor(const char* token, size_t len, void* callback, SkScriptValue* value) { value->fType = SkType_Int; - if (SkParse::FindNamedColor(token, len, (SkColor*) &value->fOperand.fS32) != NULL) + if (SkParse::FindNamedColor(token, len, (SkColor*) &value->fOperand.fS32) != nullptr) return true; return false; } @@ -281,7 +281,7 @@ bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object, return true; } const SkMemberInfo* info = displayable->getMember(name.c_str()); - if (info == NULL) + if (info == nullptr) return false; if (info->fType == SkType_MemberProperty) { if (displayable->getProperty(info->propertyIndex(), value) == false) { @@ -298,7 +298,7 @@ bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* SkDisplayable* displayable = (SkDisplayable*) object; SkString name(member, len); const SkMemberInfo* info = displayable->getMember(name.c_str()); - SkASSERT(info != NULL); /* !!! error handling unimplemented */ + SkASSERT(info != nullptr); /* !!! error handling unimplemented */ if (info->fType != SkType_MemberFunction) { SkASSERT(0); return false; @@ -401,7 +401,7 @@ bool SkAnimatorScript::MapEnums(const char* ptr, const char* match, size_t len, bool more = true; do { const char* last = strchr(ptr, '|'); - if (last == NULL) { + if (last == nullptr) { last = &ptr[strlen(ptr)]; more = false; } @@ -465,7 +465,7 @@ bool SkAnimatorScript::Unbox(void* m, SkScriptValue* scriptValue) { scriptValue->fOperand.fString = new SkString(boxedValue->value); } break; default: { - const char* id = NULL; + const char* id = nullptr; SkDEBUGCODE(bool success = ) maker->findKey(displayable, &id); SkASSERT(success); scriptValue->fOperand.fString = new SkString(id); @@ -562,7 +562,7 @@ void SkAnimatorScript::UnitTest() { animator.doUserEvent(evt); // set up animator with memory script above, then run value tests for (unsigned index = 0; index < SkScriptNAnswer_testCount; index++) { - SkAnimatorScript engine(*animator.fMaker, NULL, scriptTests[index].fType); + SkAnimatorScript engine(*animator.fMaker, nullptr, scriptTests[index].fType); SkScriptValue value; const char* script = scriptTests[index].fScript; bool success = engine.evaluateScript(&script, &value); diff --git a/src/animator/SkAnimatorScript2.cpp b/src/animator/SkAnimatorScript2.cpp index 700027aec0..d246130fbe 100644 --- a/src/animator/SkAnimatorScript2.cpp +++ b/src/animator/SkAnimatorScript2.cpp @@ -205,7 +205,7 @@ public: return true; } const SkMemberInfo* info = displayable->getMember(name.c_str()); - if (info == NULL) + if (info == nullptr) return false; // !!! add additional error info? ref->fType = SkAnimatorScript2::ToOpType(info->getType()); ref->fOperand.fObject = (void*) info; @@ -235,7 +235,7 @@ public: SkDisplayable* displayable = (SkDisplayable*) object; SkString name(member, len); const SkMemberInfo* info = displayable->getMember(name.c_str()); - if (info == NULL || info->fType != SkType_MemberFunction) + if (info == nullptr || info->fType != SkType_MemberFunction) return false; // !!! add additional error info? ref->fType = SkAnimatorScript2::ToOpType(info->getType()); ref->fOperand.fObject = (void*) info; @@ -264,7 +264,7 @@ public: class SkAnimatorScript_NamedColor : public SkScriptCallBackProperty { public: virtual bool getConstValue(const char* name, int len, SkOperand2* value) { - return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL; + return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != nullptr; } }; @@ -474,9 +474,9 @@ SkDisplayTypes SkAnimatorScript2::ToDisplayType(SkOperand2::OpType type) { } SkOperand2::OpType SkAnimatorScript2::ToOpType(SkDisplayTypes type) { - if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type)) + if (SkDisplayType::IsDisplayable(nullptr /* fMaker */, type)) return SkOperand2::kObject; - if (SkDisplayType::IsEnum(NULL /* fMaker */, type)) + if (SkDisplayType::IsEnum(nullptr /* fMaker */, type)) return SkOperand2::kS32; switch (type) { case SkType_ARGB: @@ -506,7 +506,7 @@ bool SkAnimatorScript2::MapEnums(const char* ptr, const char* match, size_t len, bool more = true; do { const char* last = strchr(ptr, '|'); - if (last == NULL) { + if (last == nullptr) { last = &ptr[strlen(ptr)]; more = false; } @@ -591,7 +591,7 @@ void SkAnimatorScript2::UnitTest() { animator.doUserEvent(evt); // set up animator with memory script above, then run value tests for (int index = 0; index < SkScriptNAnswer_testCount; index++) { - SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType); + SkAnimatorScript2 engine(*animator.fMaker, nullptr, scriptTests[index].fType); SkScriptValue2 value; const char* script = scriptTests[index].fScript; bool success = engine.evaluateScript(&script, &value); diff --git a/src/animator/SkBoundable.cpp b/src/animator/SkBoundable.cpp index abc4f40d6e..e784e9f6d0 100644 --- a/src/animator/SkBoundable.cpp +++ b/src/animator/SkBoundable.cpp @@ -50,6 +50,6 @@ SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable, SkBoundableAuto::~SkBoundableAuto() { if (fBoundable->hasBounds() == false) return; -// fMaker.fCanvas->setBounder(NULL); +// fMaker.fCanvas->setBounder(nullptr); fBoundable->setBounds(fMaker.fDisplayList.fBounds); } diff --git a/src/animator/SkBuildCondensedInfo.cpp b/src/animator/SkBuildCondensedInfo.cpp index 411be904fe..1ee1917d3c 100644 --- a/src/animator/SkBuildCondensedInfo.cpp +++ b/src/animator/SkBuildCondensedInfo.cpp @@ -27,7 +27,7 @@ SkTDMemberInfoArray gUnknowns; SkTDIntArray gUnknownsCounts; static void AddInfo(SkDisplayTypes type, const SkMemberInfo* info, int infoCount) { - SkASSERT(gInfos[type] == NULL); + SkASSERT(gInfos[type] == nullptr); gInfos[type] = info; gInfosCounts[type] = infoCount; *gInfosTypeIDs.append() = type; @@ -111,7 +111,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { int index, infoCount; for (index = 0; index < kTypeNamesSize; index++) { const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount); - if (info == NULL) + if (info == nullptr) continue; AddInfo(gTypeNames[index].fType, info, infoCount); } @@ -131,7 +131,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { int typeIndex = 0; for (; typeIndex < kNumberOfTypes; typeIndex++) { const SkMemberInfo* temp = SkDisplayType::GetMembers( - maker, (SkDisplayTypes) typeIndex, NULL); + maker, (SkDisplayTypes) typeIndex, nullptr); if (temp == info) break; } @@ -160,7 +160,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { int unknown = 1; for (index = 0; index < gInfos.count(); index++) { const SkMemberInfo* info = gInfos[index]; - if (info == NULL) + if (info == nullptr) continue; char scratch[64]; bool drawPrefix, displayPrefix; @@ -183,7 +183,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { unknown = 1; for (index = 0; index < gInfos.count(); index++) { const SkMemberInfo* info = gInfos[index]; - if (info == NULL) + if (info == nullptr) continue; char scratch[64]; bool drawPrefix, displayPrefix; @@ -229,7 +229,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { unknown = 1; for (index = 0; index < gInfosCounts.count(); index++) { const SkMemberInfo* info = gInfos[index]; - if (info == NULL) + if (info == nullptr) continue; typeIDCount++; char scratch[64]; @@ -251,7 +251,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) { written = 0; for (index = 0; index < gInfosCounts.count(); index++) { const SkMemberInfo* info = gInfos[index]; - if (info == NULL) + if (info == nullptr) continue; if (written > 0) putc(',', condensed); diff --git a/src/animator/SkDisplayAdd.cpp b/src/animator/SkDisplayAdd.cpp index ffc9ba4cfb..f5788a3869 100644 --- a/src/animator/SkDisplayAdd.cpp +++ b/src/animator/SkDisplayAdd.cpp @@ -34,14 +34,14 @@ const SkMemberInfo SkAdd::fInfo[] = { DEFINE_GET_MEMBER(SkAdd); SkAdd::SkAdd() : mode(kMode_indirect), - offset(SK_MaxS32), use(NULL), where(NULL) { + offset(SK_MaxS32), use(nullptr), where(nullptr) { } SkDisplayable* SkAdd::deepCopy(SkAnimateMaker* maker) { SkADrawable* saveUse = use; SkADrawable* saveWhere = where; - use = NULL; - where = NULL; + use = nullptr; + where = nullptr; SkAdd* copy = (SkAdd*) INHERITED::deepCopy(maker); copy->use = use = saveUse; copy->where = where = saveWhere; @@ -80,20 +80,20 @@ bool SkAdd::enable(SkAnimateMaker& maker ) { SkDisplayList& displayList = maker.fDisplayList; SkTDDrawableArray* parentList = displayList.getDrawList(); if (type == SkType_Add) { - if (use == NULL) // not set in apply yet + if (use == nullptr) // not set in apply yet return true; } bool skipAddToParent = true; SkASSERT(type != SkType_Replace || where); SkTDDrawableArray* grandList SK_INIT_TO_AVOID_WARNING; - SkGroup* parentGroup = NULL; - SkGroup* thisGroup = NULL; + SkGroup* parentGroup = nullptr; + SkGroup* thisGroup = nullptr; int index = where ? displayList.findGroup(where, &parentList, &parentGroup, &thisGroup, &grandList) : 0; if (index < 0) return true; int max = parentList->count(); - if (where == NULL && type == SkType_Move) + if (where == nullptr && type == SkType_Move) index = max; if (offset != SK_MaxS32) { index += offset; @@ -102,15 +102,15 @@ bool SkAdd::enable(SkAnimateMaker& maker ) { return true; // caller should not add } } - if (offset < 0 && where == NULL) + if (offset < 0 && where == nullptr) index += max + 1; switch (type) { case SkType_Add: - if (offset == SK_MaxS32 && where == NULL) { + if (offset == SK_MaxS32 && where == nullptr) { if (use->isDrawable()) { skipAddToParent = mode == kMode_immediate; if (skipAddToParent) { - if (where == NULL) { + if (where == nullptr) { SkTDDrawableArray* useParentList; index = displayList.findGroup(this, &useParentList, &parentGroup, &thisGroup, &grandList); @@ -194,7 +194,7 @@ void SkAdd::initialize() { bool SkAdd::isDrawable() const { return getType() == SkType_Add && mode == kMode_indirect && offset == SK_MaxS32 && - where == NULL && use != NULL && use->isDrawable(); + where == nullptr && use != nullptr && use->isDrawable(); } //SkDisplayable* SkAdd::resolveTarget(SkAnimateMaker& maker) { diff --git a/src/animator/SkDisplayAdd.h b/src/animator/SkDisplayAdd.h index c106d867b1..eb4610b39f 100644 --- a/src/animator/SkDisplayAdd.h +++ b/src/animator/SkDisplayAdd.h @@ -36,7 +36,7 @@ protected: Mode mode; int32_t offset; SkADrawable* use; - SkADrawable* where; // if NULL, offset becomes index + SkADrawable* where; // if nullptr, offset becomes index // } A; private: typedef SkADrawable INHERITED; diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp index 88f73eccab..0d5f09d342 100644 --- a/src/animator/SkDisplayApply.cpp +++ b/src/animator/SkDisplayApply.cpp @@ -56,7 +56,7 @@ const SkMemberInfo SkApply::fInfo[] = { DEFINE_GET_MEMBER(SkApply); SkApply::SkApply() : begin(0), dontDraw(false), interval((SkMSec) -1), mode((Mode) -1), /*pickup(false), */ - restore(false), scope(NULL), steps(-1), transition((Transition) -1), fActive(NULL), /*fCurrentScope(NULL),*/ + restore(false), scope(nullptr), steps(-1), transition((Transition) -1), fActive(nullptr), /*fCurrentScope(nullptr),*/ fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false), fEnabled(false), fEnabling(false) { } @@ -71,7 +71,7 @@ SkApply::~SkApply() { } void SkApply::activate(SkAnimateMaker& maker) { - if (fActive != NULL) { + if (fActive != nullptr) { if (fActive->fDrawIndex == 0 && fActive->fDrawMax == 0) return; // if only one use, nothing more to do if (restore == false) @@ -92,7 +92,7 @@ void SkApply::activate(SkAnimateMaker& maker) { } void SkApply::append(SkApply* apply) { - if (fActive == NULL) + if (fActive == nullptr) return; int oldCount = fActive->fAnimators.count(); fActive->append(apply); @@ -110,7 +110,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count, SkAnimateBase* animator = fActive->fAnimators[animatorIndex]; const SkMemberInfo * info = animator->fFieldInfo; SkASSERT(animator); - SkASSERT(info != NULL); + SkASSERT(info != nullptr); SkDisplayTypes type = (SkDisplayTypes) info->fType; SkDisplayable* target = getTarget(animator); if (animator->hasExecute() || type == SkType_MemberFunction || type == SkType_MemberProperty) { @@ -123,7 +123,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count, temp.fOperand = values[index]; *typedValues.append() = temp; } - executor->executeFunction(target, info->functionIndex(), typedValues, info->getType(), NULL); + executor->executeFunction(target, info->functionIndex(), typedValues, info->getType(), nullptr); } else { SkScriptValue scriptValue; scriptValue.fOperand = values[0]; @@ -162,7 +162,7 @@ bool SkApply::contains(SkDisplayable* child) { SkDisplayable* SkApply::deepCopy(SkAnimateMaker* maker) { SkADrawable* saveScope = scope; - scope = NULL; + scope = nullptr; SkApply* result = (SkApply*) INHERITED::deepCopy(maker); result->scope = scope = saveScope; SkAnimateBase** end = fAnimators.end(); @@ -184,7 +184,7 @@ void SkApply::disable() { } bool SkApply::draw(SkAnimateMaker& maker) { - if (scope ==NULL) + if (scope ==nullptr) return false; if (scope->isApply() || scope->isDrawable() == false) return false; @@ -262,7 +262,7 @@ void SkApply::dump(SkAnimateMaker* maker) { bool SkApply::enable(SkAnimateMaker& maker) { fEnabled = true; - bool initialized = fActive != NULL; + bool initialized = fActive != nullptr; if (dynamicScope.size() > 0) enableDynamic(maker); if (maker.fError.hasError()) @@ -284,14 +284,14 @@ bool SkApply::enable(SkAnimateMaker& maker) { } return true; }*/ - if ((mode == kMode_immediate || mode == kMode_create) && scope == NULL) + if ((mode == kMode_immediate || mode == kMode_create) && scope == nullptr) return false; // !!! error? bool enableMe = scope && (scope->hasEnable() || scope->isApply() || scope->isDrawable() == false); if ((mode == kMode_immediate && enableMe) || mode == kMode_create) activate(maker); // for non-drawables like post, prime them here if (mode == kMode_immediate && enableMe) fActive->enable(); - if (mode == kMode_create && scope != NULL) { + if (mode == kMode_create && scope != nullptr) { enableCreate(maker); return true; } @@ -311,7 +311,7 @@ bool SkApply::enable(SkAnimateMaker& maker) { debugOut.appendS32(maker.fEnableTime - maker.fDebugTimeBase); SkDebugf("%s\n", debugOut.c_str()); #endif - if (scope == NULL || scope->isApply() || scope->getType() == SkType_Movie || scope->isDrawable() == false) { + if (scope == nullptr || scope->isApply() || scope->getType() == SkType_Movie || scope->isDrawable() == false) { activate(maker); // for non-drawables like post, prime them here if (initialized) { append(this); @@ -319,7 +319,7 @@ bool SkApply::enable(SkAnimateMaker& maker) { fEnabling = true; interpolate(maker, maker.fEnableTime); fEnabling = false; - if (scope != NULL && dontDraw == false) + if (scope != nullptr && dontDraw == false) scope->enable(maker); return true; } else if (initialized && restore == false) @@ -365,10 +365,10 @@ append: SkASSERT(old < parentList->count()); if ((*parentList)[old]->isApply()) { SkApply* apply = (SkApply*) (*parentList)[old]; - if (apply != this && apply->fActive == NULL) + if (apply != this && apply->fActive == nullptr) apply->activate(maker); apply->append(this); - parentGroup = NULL; + parentGroup = nullptr; } else { if (parentGroup) parentGroup->markCopySize(old); @@ -377,7 +377,7 @@ append: int oldApply = displayList.findGroup(this, &parentList, &pGroup, &thisGroup, &grandList); if (oldApply >= 0) { (*parentList)[oldApply] = (SkADrawable*) SkDisplayType::CreateInstance(&maker, SkType_Apply); - parentGroup = NULL; + parentGroup = nullptr; fDeleteScope = true; } *newApplyLocation = this; @@ -397,7 +397,7 @@ void SkApply::enableCreate(SkAnimateMaker& maker) { bool success = maker.computeID(scope, this, &newID); if (success == false) return; - if (maker.find(newID.c_str(), NULL)) + if (maker.find(newID.c_str(), nullptr)) continue; SkApply* copy = (SkApply*) deepCopy(&maker); // work on copy of animator state if (mode == kMode_create) @@ -429,11 +429,11 @@ void SkApply::enableDynamic(SkAnimateMaker& maker) { &newScope); if (success && scope != newScope) { SkTDDrawableArray* pList, * gList; - SkGroup* pGroup = NULL, * found = NULL; + SkGroup* pGroup = nullptr, * found = nullptr; int old = maker.fDisplayList.findGroup(scope, &pList, &pGroup, &found, &gList); if (pList && old >= 0 && (*pList)[old]->isApply() && (*pList)[old] != this) { if (fAppended == false) { - if (found != NULL) { + if (found != nullptr) { SkDisplayable* oldChild = (*pList)[old]; if (oldChild->isApply() && found->copySet(old)) { found->markCopyClear(old); @@ -449,7 +449,7 @@ void SkApply::enableDynamic(SkAnimateMaker& maker) { } maker.removeActive(fActive); delete fActive; - fActive = NULL; + fActive = nullptr; } void SkApply::endSave(int index) { @@ -528,11 +528,11 @@ bool SkApply::hasEnable() const { } bool SkApply::inactivate(SkAnimateMaker& maker) { - if (fActive == NULL) + if (fActive == nullptr) return false; maker.removeActive(fActive); delete fActive; - fActive = NULL; + fActive = nullptr; return true; } @@ -541,14 +541,14 @@ SkMSec lastTime = (SkMSec) -1; #endif bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) { - if (fActive == NULL) + if (fActive == nullptr) return false; bool result = false; #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING SkMSec time = maker.getAppTime(); if (lastTime == (SkMSec) -1) lastTime = rawTime - 1; - if (fActive != NULL && + if (fActive != nullptr && strcmp(id, "a3") == 0 && rawTime > lastTime) { lastTime += 1000; SkString debugOut; @@ -629,7 +629,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) { fLastTime = animate->dur; SkTypedArray formulaValues; formulaValues.setCount(count); - SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL, + SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, nullptr, animate->getValuesType(), animate->formula); SkASSERT(success); if (restore) @@ -645,7 +645,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) { } void SkApply::initialize() { - if (scope == NULL) + if (scope == nullptr) return; if (scope->isApply() || scope->isDrawable() == false) return; @@ -665,12 +665,12 @@ void SkApply::onEndElement(SkAnimateMaker& maker) } if (mode == kMode_create) return; - if (scope != NULL && steps >= 0 && scope->isApply() == false && scope->isDrawable()) + if (scope != nullptr && steps >= 0 && scope->isApply() == false && scope->isDrawable()) scope->setSteps(steps); for (SkAnimateBase** animPtr = fAnimators.begin(); animPtr < fAnimators.end(); animPtr++) { SkAnimateBase* anim = *animPtr; //for reusing apply statements with dynamic scope - if (anim->fTarget == NULL || anim->fTargetIsScope) { + if (anim->fTarget == nullptr || anim->fTargetIsScope) { anim->fTargetIsScope = true; if (scope) anim->fTarget = scope; @@ -678,7 +678,7 @@ void SkApply::onEndElement(SkAnimateMaker& maker) anim->setTarget(maker); anim->onEndElement(maker); // allows animate->fFieldInfo to be set } - if (scope != NULL && steps >= 0 && anim->fTarget != scope && anim->fTarget->isDrawable()) + if (scope != nullptr && steps >= 0 && anim->fTarget != scope && anim->fTarget->isDrawable()) anim->fTarget->setSteps(steps); } } @@ -748,7 +748,7 @@ void SkApply::save(int index) { // !!! this all may be unneeded, at least in the dynamic case ?? int activeIndex = fActive->fDrawIndex + index; SkTDOperandArray last; - if (fActive->fSaveRestore[activeIndex] == NULL) { + if (fActive->fSaveRestore[activeIndex] == nullptr) { fActive->fSaveRestore[activeIndex] = new SkOperand[count]; useLast = false; } else { diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp index b5dc8145ae..746780df1c 100644 --- a/src/animator/SkDisplayEvent.cpp +++ b/src/animator/SkDisplayEvent.cpp @@ -45,7 +45,7 @@ const SkMemberInfo SkDisplayEvent::fInfo[] = { DEFINE_GET_MEMBER(SkDisplayEvent); SkDisplayEvent::SkDisplayEvent() : code((SkKey) -1), disable(false), - kind(kUser), x(0), y(0), fLastCode((SkKey) -1), fMax((SkKey) -1), fTarget(NULL) { + kind(kUser), x(0), y(0), fLastCode((SkKey) -1), fMax((SkKey) -1), fTarget(nullptr) { } SkDisplayEvent::~SkDisplayEvent() { @@ -71,7 +71,7 @@ SkDisplayable* SkDisplayEvent::contains(const SkString& match) { if (child->contains(match)) return child; } - return NULL; + return nullptr; } void SkDisplayEvent::deleteMembers() { @@ -100,7 +100,7 @@ void SkDisplayEvent::dumpEvent(SkAnimateMaker* maker) { else SkDebugf("key=\"%c\" ", code); } - if (fTarget != NULL) { + if (fTarget != nullptr) { SkDebugf("target=\"%s\" ", fTarget->id); } if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kMouseUp) { @@ -188,7 +188,7 @@ void SkDisplayEvent::populateInput(SkAnimateMaker& maker, const SkEvent& fEvent) SkMetaData::Type type; int number; const char* name; - while ((name = iter.next(&type, &number)) != NULL) { + while ((name = iter.next(&type, &number)) != nullptr) { if (name[0] == '\0') continue; SkDisplayable* displayable; diff --git a/src/animator/SkDisplayEvents.cpp b/src/animator/SkDisplayEvents.cpp index 3c3791de75..d367cf11c3 100644 --- a/src/animator/SkDisplayEvents.cpp +++ b/src/animator/SkDisplayEvents.cpp @@ -47,7 +47,7 @@ bool SkEvents::doEvent(SkAnimateMaker& maker, SkDisplayEvent::Kind kind, SkEvent if (kind != SkDisplayEvent::kOnload) movie->doEvent(kind, state); } - SkDisplayable* displayable = state ? state->fDisplayable : NULL; + SkDisplayable* displayable = state ? state->fDisplayable : nullptr; int keyCode = state ? state->fCode : 0; int count = fEvents.count(); for (int index = 0; index < count; index++) { @@ -61,9 +61,9 @@ bool SkEvents::doEvent(SkAnimateMaker& maker, SkDisplayEvent::Kind kind, SkEvent continue; evt->fLastCode = (SkKey) keyCode; } - if (evt->fTarget != NULL && evt->fTarget != displayable) + if (evt->fTarget != nullptr && evt->fTarget != displayable) continue; - if (state == NULL || state->fDisable == 0) { + if (state == nullptr || state->fDisable == 0) { if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kMouseUp) { evt->x = state->fX; evt->y = state->fY; @@ -96,7 +96,7 @@ void SkEvents::dump(SkAnimateMaker& maker) { // currently this only removes onLoad events void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) { int keyCode = state ? state->fCode : 0; - SkDisplayable* displayable = state ? state->fDisplayable : NULL; + SkDisplayable* displayable = state ? state->fDisplayable : nullptr; for (SkDisplayEvent** evtPtr = fEvents.begin(); evtPtr < fEvents.end(); evtPtr++) { SkDisplayEvent* evt = *evtPtr; if (evt->kind != kind) @@ -105,7 +105,7 @@ void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) { if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? evt->fMax : evt->code) < keyCode) continue; } - if (evt->fTarget != NULL && evt->fTarget != displayable) + if (evt->fTarget != nullptr && evt->fTarget != displayable) continue; int index = fEvents.find(evt); fEvents.remove(index); diff --git a/src/animator/SkDisplayInput.cpp b/src/animator/SkDisplayInput.cpp index 7061aa8ea9..facc703976 100644 --- a/src/animator/SkDisplayInput.cpp +++ b/src/animator/SkDisplayInput.cpp @@ -30,7 +30,7 @@ DEFINE_GET_MEMBER(SkInput); SkInput::SkInput() : fInt((int) SK_NaN32), fFloat(SK_ScalarNaN) {} SkDisplayable* SkInput::contains(const SkString& string) { - return string.equals(name) ? this : NULL; + return string.equals(name) ? this : nullptr; } bool SkInput::enable(SkAnimateMaker & ) { diff --git a/src/animator/SkDisplayList.cpp b/src/animator/SkDisplayList.cpp index f5f2c7fbae..fbba83f4f0 100644 --- a/src/animator/SkDisplayList.cpp +++ b/src/animator/SkDisplayList.cpp @@ -52,7 +52,7 @@ bool SkDisplayList::draw(SkAnimateMaker& maker, SkMSec inTime) { int SkDisplayList::findGroup(SkADrawable* match, SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) { - *parent = NULL; + *parent = nullptr; *list = &fDrawList; *grandList = &fDrawList; return SearchForMatch(match, list, parent, found, grandList); @@ -70,7 +70,7 @@ bool SkDisplayList::onIRect(const SkIRect& r) { int SkDisplayList::SearchForMatch(SkADrawable* match, SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) { - *found = NULL; + *found = nullptr; for (int index = 0; index < (*list)->count(); index++) { SkADrawable* draw = (**list)[index]; if (draw == match) diff --git a/src/animator/SkDisplayMath.cpp b/src/animator/SkDisplayMath.cpp index 7f406c1f65..f52cf19371 100644 --- a/src/animator/SkDisplayMath.cpp +++ b/src/animator/SkDisplayMath.cpp @@ -131,7 +131,7 @@ DEFINE_GET_MEMBER(SkDisplayMath); void SkDisplayMath::executeFunction(SkDisplayable* target, int index, SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, SkScriptValue* scriptValue) { - if (scriptValue == NULL) + if (scriptValue == nullptr) return; SkASSERT(target == this); SkScriptValue* array = parameters.begin(); diff --git a/src/animator/SkDisplayMovie.cpp b/src/animator/SkDisplayMovie.cpp index ea832dcb4c..797d853be6 100644 --- a/src/animator/SkDisplayMovie.cpp +++ b/src/animator/SkDisplayMovie.cpp @@ -34,7 +34,7 @@ void SkDisplayMovie::buildMovie() { return; SkAnimateMaker* movieMaker = fMovie.fMaker; SkAnimateMaker* parentMaker = movieMaker->fParentMaker; - if (src.size() == 0 || parentMaker == NULL) + if (src.size() == 0 || parentMaker == nullptr) return; movieMaker->fPrefix.set(parentMaker->fPrefix); fDecodedSuccessfully = fMovie.fMaker->decodeURI(src.c_str()); @@ -105,8 +105,8 @@ bool SkDisplayMovie::enable(SkAnimateMaker&) { if (fDecodedSuccessfully == false) return false; SkAnimateMaker* movieMaker = fMovie.fMaker; - movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL); - movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL); + movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, nullptr); + movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr); fLoaded = true; movieMaker->fLoaded = true; return false; diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp index 0fd4a06753..a30fd4442f 100644 --- a/src/animator/SkDisplayPost.cpp +++ b/src/animator/SkDisplayPost.cpp @@ -38,8 +38,8 @@ const SkMemberInfo SkPost::fInfo[] = { DEFINE_GET_MEMBER(SkPost); -SkPost::SkPost() : delay(0), /*initialized(SkBool(-1)), */ mode(kImmediate), fMaker(NULL), - fSinkID(0), fTargetMaker(NULL), fChildHasID(false), fDirty(false) { +SkPost::SkPost() : delay(0), /*initialized(SkBool(-1)), */ mode(kImmediate), fMaker(nullptr), + fSinkID(0), fTargetMaker(nullptr), fChildHasID(false), fDirty(false) { } SkPost::~SkPost() { @@ -104,7 +104,7 @@ void SkPost::dump(SkAnimateMaker* maker) { //SkDataInput** ptr = fParts.end(); //SkDataInput* data; //const char* ID; - while ((name = iter.next(&type, &number)) != NULL) { + while ((name = iter.next(&type, &number)) != nullptr) { //ptr--; if (strcmp(name, "id") == 0) continue; @@ -210,7 +210,7 @@ bool SkPost::enable(SkAnimateMaker& maker ) { bool isAnimatorEvent = true; SkAnimator* anim = maker.getAnimator(); if (targetID == 0) { - isAnimatorEvent = fEvent.findString("id") != NULL; + isAnimatorEvent = fEvent.findString("id") != nullptr; if (isAnimatorEvent) targetID = anim->getSinkID(); else if (maker.fHostEventSinkID) @@ -236,7 +236,7 @@ void SkPost::findSinkID() { do { const char* end = strchr(ch, '.'); size_t len = end ? (size_t) (end - ch) : strlen(ch); - SkDisplayable* displayable = NULL; + SkDisplayable* displayable = nullptr; if (SK_LITERAL_STR_EQUAL("parent", ch, len)) { if (fTargetMaker->fParentMaker) fTargetMaker = fTargetMaker->fParentMaker; @@ -246,14 +246,14 @@ void SkPost::findSinkID() { } } else { fTargetMaker->find(ch, len, &displayable); - if (displayable == NULL || displayable->getType() != SkType_Movie) { + if (displayable == nullptr || displayable->getType() != SkType_Movie) { fTargetMaker->setErrorCode(SkDisplayXMLParserError::kExpectedMovie); return; } SkDisplayMovie* movie = (SkDisplayMovie*) displayable; fTargetMaker = movie->fMovie.fMaker; } - if (end == NULL) + if (end == nullptr) break; ch = ++end; } while (true); diff --git a/src/animator/SkDisplayType.cpp b/src/animator/SkDisplayType.cpp index 87ea560d80..7ee8dab5a4 100644 --- a/src/animator/SkDisplayType.cpp +++ b/src/animator/SkDisplayType.cpp @@ -62,7 +62,7 @@ case SkType_##_class: result = new SkDisplay##_class(); break #ifdef SK_DEBUG #define CASE_DEBUG_RETURN_NIL(_class) \ - case SkType_##_class: return NULL + case SkType_##_class: return nullptr #else #define CASE_DEBUG_RETURN_NIL(_class) #endif @@ -71,7 +71,7 @@ SkDisplayTypes SkDisplayType::gNewTypes = kNumberOfTypes; SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTypes type) { - SkDisplayable* result = NULL; + SkDisplayable* result = nullptr; switch (type) { // unknown CASE_DISPLAY_NEW(Math); @@ -200,7 +200,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp default: SkExtras** end = maker->fExtras.end(); for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) { - if ((result = (*extraPtr)->createInstance(type)) != NULL) + if ((result = (*extraPtr)->createInstance(type)) != nullptr) return result; } SkASSERT(0); @@ -224,7 +224,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker, SkDisplayTypes type, int* infoCountPtr) { - const SkMemberInfo* info = NULL; + const SkMemberInfo* info = nullptr; int infoCount = 0; switch (type) { // unknown @@ -356,11 +356,11 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker, if (maker) { SkExtras** end = maker->fExtras.end(); for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) { - if ((info = (*extraPtr)->getMembers(type, infoCountPtr)) != NULL) + if ((info = (*extraPtr)->getMembers(type, infoCountPtr)) != nullptr) return info; } } - return NULL; + return nullptr; } if (infoCountPtr) *infoCountPtr = infoCount; @@ -525,7 +525,7 @@ const int kTypeNamesSize = SK_ARRAY_COUNT(gTypeNames); SkDisplayTypes SkDisplayType::Find(SkAnimateMaker* maker, const SkMemberInfo* match) { for (int index = 0; index < kTypeNamesSize; index++) { SkDisplayTypes type = gTypeNames[index].fType; - const SkMemberInfo* info = SkDisplayType::GetMembers(maker, type, NULL); + const SkMemberInfo* info = SkDisplayType::GetMembers(maker, type, nullptr); if (info == match) return type; } @@ -538,7 +538,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba return SkType_Displayable; if (base == SkType_Set) return SkType_Animate; // another cheat until we have a lookup table - const SkMemberInfo* info = GetMembers(maker, base, NULL); // get info for this type + const SkMemberInfo* info = GetMembers(maker, base, nullptr); // get info for this type SkASSERT(info); if (info->fType != SkType_BaseClassInfo) return SkType_Unknown; // if no base, done @@ -547,7 +547,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba const SkMemberInfo* inherited = info->getInherited(); SkDisplayTypes result = (SkDisplayTypes) (SkType_Unknown + 1); for (; result <= SkType_Xfermode; result = (SkDisplayTypes) (result + 1)) { - const SkMemberInfo* match = GetMembers(maker, result, NULL); + const SkMemberInfo* match = GetMembers(maker, result, nullptr); if (match == inherited) break; } @@ -710,10 +710,10 @@ const char* SkDisplayType::GetName(SkAnimateMaker* maker, SkDisplayTypes type) { SkExtras** end = maker->fExtras.end(); for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) { const char* result = (*extraPtr)->getName(type); - if (result != NULL) + if (result != nullptr) return result; } - return NULL; + return nullptr; } #endif @@ -728,7 +728,7 @@ void SkDisplayType::UnitTest() { } for (index = 0; index < kTypeNamesSize; index++) { SkDisplayable* test = CreateInstance(maker, gTypeNames[index].fType); - if (test == NULL) + if (test == nullptr) continue; #if defined _WIN32 && _MSC_VER >= 1300 && defined _INC_CRTDBG // only on windows, only if using "crtdbg.h" // we know that crtdbg puts 0xfdfdfdfd at the end of the block @@ -744,7 +744,7 @@ void SkDisplayType::UnitTest() { for (index = 0; index < kTypeNamesSize; index++) { int infoCount; const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount); - if (info == NULL) + if (info == nullptr) continue; #if SK_USE_CONDENSED_INFO == 0 for (int inner = 0; inner < infoCount - 1; inner++) { diff --git a/src/animator/SkDisplayTypes.cpp b/src/animator/SkDisplayTypes.cpp index 287ca6e4d4..d3d8c68146 100644 --- a/src/animator/SkDisplayTypes.cpp +++ b/src/animator/SkDisplayTypes.cpp @@ -121,7 +121,7 @@ SkDisplayString::SkDisplayString(SkString& copyFrom) : value(copyFrom) { void SkDisplayString::executeFunction(SkDisplayable* target, int index, SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, SkScriptValue* scriptValue) { - if (scriptValue == NULL) + if (scriptValue == nullptr) return; SkASSERT(target == this); switch (index) { diff --git a/src/animator/SkDisplayXMLParser.cpp b/src/animator/SkDisplayXMLParser.cpp index 3ebf9dc4fe..1c8b67b6af 100644 --- a/src/animator/SkDisplayXMLParser.cpp +++ b/src/animator/SkDisplayXMLParser.cpp @@ -71,7 +71,7 @@ void SkDisplayXMLParserError::setInnerError(SkAnimateMaker* parent, const SkStri SkDisplayXMLParser::SkDisplayXMLParser(SkAnimateMaker& maker) : INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude), - fInSkia(maker.fInInclude), fCurrDisplayable(NULL) + fInSkia(maker.fInInclude), fCurrDisplayable(nullptr) { } @@ -97,13 +97,13 @@ bool SkDisplayXMLParser::onAddAttribute(const char name[], const char value[]) { bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[], size_t attrValueLen) { - if (fCurrDisplayable == NULL) // this signals we should ignore attributes for this element + if (fCurrDisplayable == nullptr) // this signals we should ignore attributes for this element return strncmp(attrName, "xmlns", sizeof("xmlns") - 1) != 0; SkDisplayable* displayable = fCurrDisplayable; SkDisplayTypes type = fCurrType; if (strcmp(attrName, "id") == 0) { - if (fMaker.find(attrValue, attrValueLen, NULL)) { + if (fMaker.find(attrValue, attrValueLen, nullptr)) { fError->setNoun(attrValue, attrValueLen); fError->setCode(SkXMLParserError::kDuplicateIDs); return true; @@ -122,22 +122,22 @@ bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char att } const char* name = attrName; const SkMemberInfo* info = SkDisplayType::GetMember(&fMaker, type, &name); - if (info == NULL) { + if (info == nullptr) { fError->setNoun(name); fError->setCode(SkXMLParserError::kUnknownAttributeName); return true; } - if (info->setValue(fMaker, NULL, 0, info->getCount(), displayable, info->getType(), attrValue, + if (info->setValue(fMaker, nullptr, 0, info->getCount(), displayable, info->getType(), attrValue, attrValueLen)) return false; if (fMaker.fError.hasError()) { fError->setNoun(attrValue, attrValueLen); return true; } - SkDisplayable* ref = NULL; + SkDisplayable* ref = nullptr; if (fMaker.find(attrValue, attrValueLen, &ref) == false) { ref = fMaker.createInstance(attrValue, attrValueLen); - if (ref == NULL) { + if (ref == nullptr) { fError->setNoun(attrValue, attrValueLen); fError->setCode(SkXMLParserError::kErrorInAttributeValue); return true; @@ -184,7 +184,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[]) const SkMemberInfo* info = SkDisplayType::GetMembers(&fMaker, fParents[parentIndex - 1].fType, &infoCount); const SkMemberInfo* foundInfo; - if ((foundInfo = searchContainer(info, infoCount)) != NULL) { + if ((foundInfo = searchContainer(info, infoCount)) != nullptr) { parent->setReference(foundInfo, displayable); // if (displayable->isHelper() == false) fMaker.helperAdd(displayable); @@ -198,7 +198,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[]) } fParents.remove(parentIndex); } - fCurrDisplayable = NULL; + fCurrDisplayable = nullptr; if (fInInclude == false && SK_strcasecmp(elem, "screenplay") == 0) { if (fMaker.fInMovie == false) { fMaker.fEnableTime = fMaker.getAppTime(); @@ -212,10 +212,10 @@ bool SkDisplayXMLParser::onEndElement(const char elem[]) debugOut.appendS32(fMaker.fEnableTime - fMaker.fDebugTimeBase); SkDebugf("%s\n", debugOut.c_str()); #endif - fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, NULL); + fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, nullptr); if (fMaker.fError.hasError()) return true; - fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, NULL); + fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr); } fInSkia = false; @@ -229,7 +229,7 @@ bool SkDisplayXMLParser::onStartElement(const char name[]) } bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) { - fCurrDisplayable = NULL; // init so we'll ignore attributes if we exit early + fCurrDisplayable = nullptr; // init so we'll ignore attributes if we exit early if (SK_strncasecmp(name, "screenplay", len) == 0) { fInSkia = true; @@ -241,7 +241,7 @@ bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) { return false; SkDisplayable* displayable = fMaker.createInstance(name, len); - if (displayable == NULL) { + if (displayable == nullptr) { fError->setNoun(name, len); fError->setCode(SkXMLParserError::kUnknownElement); return true; @@ -268,14 +268,14 @@ bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) { const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* infoBase, int infoCount) { - const SkMemberInfo* bestDisplayable = NULL; - const SkMemberInfo* lastResort = NULL; + const SkMemberInfo* bestDisplayable = nullptr; + const SkMemberInfo* lastResort = nullptr; for (int index = 0; index < infoCount; index++) { const SkMemberInfo* info = &infoBase[index]; if (info->fType == SkType_BaseClassInfo) { const SkMemberInfo* inherited = info->getInherited(); const SkMemberInfo* result = searchContainer(inherited, info->fCount); - if (result != NULL) + if (result != nullptr) return result; continue; } @@ -312,5 +312,5 @@ rectNext: return bestDisplayable; if (lastResort) return lastResort; - return NULL; + return nullptr; } diff --git a/src/animator/SkDisplayable.cpp b/src/animator/SkDisplayable.cpp index 52532fedcd..dc3cecfdba 100644 --- a/src/animator/SkDisplayable.cpp +++ b/src/animator/SkDisplayable.cpp @@ -64,14 +64,14 @@ bool SkDisplayable::contains(SkDisplayable* ) { } SkDisplayable* SkDisplayable::contains(const SkString& ) { - return NULL; + return nullptr; } SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { SkDisplayTypes type = getType(); if (type == SkType_Unknown) { SkASSERT(0); - return NULL; + return nullptr; } SkDisplayable* copy = SkDisplayType::CreateInstance(maker, type); int index = -1; @@ -79,7 +79,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { const SkMemberInfo* info; do { info = copy->getMember(++index); - if (info == NULL) + if (info == nullptr) break; if (info->fType == SkType_MemberProperty) { SkScriptValue value; @@ -93,7 +93,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { if (info->fType == SkType_Array) { SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this); int arrayCount; - if (array == NULL || (arrayCount = array->count()) == 0) + if (array == nullptr || (arrayCount = array->count()) == 0) continue; SkTDOperandArray* copyArray = (SkTDOperandArray*) info->memberData(copy); copyArray->setCount(arrayCount); @@ -110,7 +110,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { } if (SkDisplayType::IsDisplayable(maker, info->fType)) { SkDisplayable** displayable = (SkDisplayable**) info->memberData(this); - if (*displayable == NULL || *displayable == (SkDisplayable*) -1) + if (*displayable == nullptr || *displayable == (SkDisplayable*) -1) continue; SkDisplayable* deeper = (*displayable)->deepCopy(maker); info->setMemberData(copy, deeper, sizeof(deeper)); @@ -160,7 +160,7 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) { SkOperand blankValues[2]; do { info = this->getMember(++index); - if (NULL == info) { + if (nullptr == info) { //SkDebugf("\n"); break; } @@ -185,7 +185,7 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) { if (info->fType == SkType_Array) { SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this); int arrayCount; - if (array == NULL || (arrayCount = array->count()) == 0) + if (array == nullptr || (arrayCount = array->count()) == 0) continue; SkDisplayTypes elementType; if (type == SkType_Array) { @@ -259,12 +259,12 @@ void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) { SkDisplayList::fIndent += 4; do { info = this->getMember(++index); - if (NULL == info) { + if (nullptr == info) { break; } if (SkDisplayType::IsDisplayable(maker, info->fType)) { SkDisplayable** displayable = (SkDisplayable**) info->memberData(this); - if (*displayable == NULL || *displayable == (SkDisplayable*) -1) + if (*displayable == nullptr || *displayable == (SkDisplayable*) -1) continue; if (closedAngle == false) { SkDebugf(">\n"); @@ -422,21 +422,21 @@ void SkDisplayable::getBounds(SkRect* rect) { } const SkFunctionParamType* SkDisplayable::getFunctionsParameters() { - return NULL; + return nullptr; } const SkMemberInfo* SkDisplayable::getMember(int index) { - return NULL; + return nullptr; } const SkMemberInfo* SkDisplayable::getMember(const char name[]) { - return NULL; + return nullptr; } const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info, int* paramCount) { const SkFunctionParamType* params = getFunctionsParameters(); - SkASSERT(params != NULL); + SkASSERT(params != nullptr); int funcIndex = info->functionIndex(); // !!! eventually break traversing params into an external function (maybe this whole function) int index = funcIndex; @@ -456,7 +456,7 @@ const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info } SkDisplayable* SkDisplayable::getParent() const { - return NULL; + return nullptr; } bool SkDisplayable::getProperty(int index, SkScriptValue* ) const { @@ -484,7 +484,7 @@ bool SkDisplayable::isDrawable() const { void SkDisplayable::onEndElement(SkAnimateMaker& ) {} const SkMemberInfo* SkDisplayable::preferredChild(SkDisplayTypes type) { - return NULL; + return nullptr; } bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* apply) { diff --git a/src/animator/SkDraw3D.cpp b/src/animator/SkDraw3D.cpp index 9e1c2cc0a6..e7e92df3e3 100644 --- a/src/animator/SkDraw3D.cpp +++ b/src/animator/SkDraw3D.cpp @@ -44,7 +44,7 @@ const SkMemberInfo Sk3D_Camera::fInfo[] = { DEFINE_GET_MEMBER(Sk3D_Camera); -Sk3D_Camera::Sk3D_Camera() : hackWidth(0), hackHeight(0), patch(NULL) { +Sk3D_Camera::Sk3D_Camera() : hackWidth(0), hackHeight(0), patch(nullptr) { } Sk3D_Camera::~Sk3D_Camera() { diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp index f41c152a32..ce7464d702 100644 --- a/src/animator/SkDrawBitmap.cpp +++ b/src/animator/SkDrawBitmap.cpp @@ -130,8 +130,8 @@ const SkMemberInfo SkImageBaseBitmap::fInfo[] = { DEFINE_GET_MEMBER(SkImageBaseBitmap); -SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(NULL) { - base64.fData = NULL; +SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(nullptr) { + base64.fData = nullptr; base64.fLength = 0; } diff --git a/src/animator/SkDrawBlur.cpp b/src/animator/SkDrawBlur.cpp index 36d645286f..14f34acf9b 100644 --- a/src/animator/SkDrawBlur.cpp +++ b/src/animator/SkDrawBlur.cpp @@ -27,7 +27,7 @@ SkDrawBlur::SkDrawBlur() SkMaskFilter* SkDrawBlur::getMaskFilter() { if (fSigma <= 0) { - return NULL; + return nullptr; } return SkBlurMaskFilter::Create((SkBlurStyle)fBlurStyle, fSigma); } diff --git a/src/animator/SkDrawClip.cpp b/src/animator/SkDrawClip.cpp index e26a1bf410..bca816f637 100644 --- a/src/animator/SkDrawClip.cpp +++ b/src/animator/SkDrawClip.cpp @@ -25,14 +25,14 @@ const SkMemberInfo SkDrawClip::fInfo[] = { DEFINE_GET_MEMBER(SkDrawClip); -SkDrawClip::SkDrawClip() : rect(NULL), path(NULL) { +SkDrawClip::SkDrawClip() : rect(nullptr), path(nullptr) { } bool SkDrawClip::draw(SkAnimateMaker& maker ) { - if (rect != NULL) + if (rect != nullptr) maker.fCanvas->clipRect(rect->fRect); else { - SkASSERT(path != NULL); + SkASSERT(path != nullptr); maker.fCanvas->clipPath(path->fPath); } return false; diff --git a/src/animator/SkDrawColor.cpp b/src/animator/SkDrawColor.cpp index d86a2e93e7..c2d0dae8fe 100644 --- a/src/animator/SkDrawColor.cpp +++ b/src/animator/SkDrawColor.cpp @@ -126,7 +126,7 @@ SkDrawColor::SkDrawColor() : fDirty(false) { } bool SkDrawColor::add() { - if (fPaint->color != NULL) + if (fPaint->color != nullptr) return true; // error (probably color in paint as attribute as well) fPaint->color = this; fPaint->fOwnsColor = true; @@ -211,7 +211,7 @@ void SkDrawColor::onEndElement(SkAnimateMaker&) { } bool SkDrawColor::setParent(SkDisplayable* parent) { - SkASSERT(parent != NULL); + SkASSERT(parent != nullptr); if (parent->getType() == SkType_DrawLinearGradient || parent->getType() == SkType_DrawRadialGradient) return false; if (parent->isPaint() == false) diff --git a/src/animator/SkDrawDash.cpp b/src/animator/SkDrawDash.cpp index cfef30335b..d47db416fb 100644 --- a/src/animator/SkDrawDash.cpp +++ b/src/animator/SkDrawDash.cpp @@ -30,6 +30,6 @@ SkDash::~SkDash() { SkPathEffect* SkDash::getPathEffect() { int count = intervals.count(); if (count == 0) - return NULL; + return nullptr; return SkDashPathEffect::Create(intervals.begin(), count, phase); } diff --git a/src/animator/SkDrawDiscrete.cpp b/src/animator/SkDrawDiscrete.cpp index 9376435950..14917839b2 100644 --- a/src/animator/SkDrawDiscrete.cpp +++ b/src/animator/SkDrawDiscrete.cpp @@ -28,7 +28,7 @@ SkDiscrete::SkDiscrete() : deviation(0), segLength(0) { SkPathEffect* SkDiscrete::getPathEffect() { if (deviation <= 0 || segLength <= 0) - return NULL; + return nullptr; else return SkDiscretePathEffect::Create(segLength, deviation); } diff --git a/src/animator/SkDrawEmboss.cpp b/src/animator/SkDrawEmboss.cpp index 70a2826d3e..a1cd4dcd16 100644 --- a/src/animator/SkDrawEmboss.cpp +++ b/src/animator/SkDrawEmboss.cpp @@ -28,7 +28,7 @@ SkDrawEmboss::SkDrawEmboss() : fSigma(-1) { SkMaskFilter* SkDrawEmboss::getMaskFilter() { if (fSigma < 0 || fDirection.count() !=3) - return NULL; + return nullptr; return SkBlurMaskFilter::CreateEmboss(fSigma, fDirection.begin(), fAmbient, fSpecular); } diff --git a/src/animator/SkDrawExtraPathEffect.cpp b/src/animator/SkDrawExtraPathEffect.cpp index 68b5006ed3..4fa76c65c9 100644 --- a/src/animator/SkDrawExtraPathEffect.cpp +++ b/src/animator/SkDrawExtraPathEffect.cpp @@ -90,12 +90,12 @@ public: } // For serialization. This will never be called. - Factory getFactory() const override { sk_throw(); return NULL; } + Factory getFactory() const override { sk_throw(); return nullptr; } protected: SkScalar begin(SkScalar contourLength) const override { SkScriptValue value; - SkAnimatorScript engine(*fMaker, NULL, SkType_Float); + SkAnimatorScript engine(*fMaker, nullptr, SkType_Float); engine.propertyCallBack(GetContourLength, &contourLength); value.fOperand.fScalar = 0; engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float); @@ -104,7 +104,7 @@ protected: SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) const override { fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance); - SkDrawPath* drawPath = NULL; + SkDrawPath* drawPath = nullptr; if (fDraw->addPath->isPath()) { drawPath = (SkDrawPath*) fDraw->addPath; } else { @@ -132,7 +132,7 @@ protected: } } SkScalar result = 0; - SkAnimatorScript::EvaluateFloat(*fMaker, NULL, fDraw->spacing.c_str(), &result); + SkAnimatorScript::EvaluateFloat(*fMaker, nullptr, fDraw->spacing.c_str(), &result); if (drawPath) dst->addPath(drawPath->getPath(), m); fMaker->clearExtraPropertyCallBack(fDraw->fType); @@ -185,7 +185,7 @@ const SkMemberInfo SkDrawShapePathEffect::fInfo[] = { DEFINE_GET_MEMBER(SkDrawShapePathEffect); SkDrawShapePathEffect::SkDrawShapePathEffect() : - addPath(NULL), addMatrix(NULL), path(NULL), fPathEffect(NULL) { + addPath(nullptr), addMatrix(nullptr), path(nullptr), fPathEffect(nullptr) { } SkDrawShapePathEffect::~SkDrawShapePathEffect() { @@ -223,7 +223,7 @@ SkDrawShape1DPathEffect::~SkDrawShape1DPathEffect() { } void SkDrawShape1DPathEffect::onEndElement(SkAnimateMaker& maker) { - if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() == false)) + if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply() == false)) maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add error else fPathEffect = new SkShape1DPathEffect(this, &maker); @@ -238,7 +238,7 @@ public: } // For serialization. This will never be called. - Factory getFactory() const override { sk_throw(); return NULL; } + Factory getFactory() const override { sk_throw(); return nullptr; } protected: void begin(const SkIRect& uvBounds, SkPath*) const override { @@ -270,7 +270,7 @@ private: apply->interpolate(*fMaker, v); drawPath = (SkDrawPath*) apply->getScope(); } - if (drawPath == NULL) + if (drawPath == nullptr) goto clearCallBack; if (fDraw->matrix) { SkDrawMatrix* matrix; @@ -341,8 +341,8 @@ SkDrawShape2DPathEffect::~SkDrawShape2DPathEffect() { } void SkDrawShape2DPathEffect::onEndElement(SkAnimateMaker& maker) { - if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() == false) || - matrix == NULL) + if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply() == false) || + matrix == nullptr) maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add error else fPathEffect = new SkShape2DPathEffect(this, &maker, matrix->getMatrix()); @@ -362,7 +362,7 @@ const SkMemberInfo SkDrawComposePathEffect::fInfo[] = { DEFINE_GET_MEMBER(SkDrawComposePathEffect); SkDrawComposePathEffect::SkDrawComposePathEffect(SkDisplayTypes type) : fType(type), - effect1(NULL), effect2(NULL) { + effect1(nullptr), effect2(nullptr) { } SkDrawComposePathEffect::~SkDrawComposePathEffect() { @@ -371,7 +371,7 @@ SkDrawComposePathEffect::~SkDrawComposePathEffect() { } bool SkDrawComposePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) { - if (effect1 == NULL) + if (effect1 == nullptr) effect1 = (SkDrawPathEffect*) child; else effect2 = (SkDrawPathEffect*) child; @@ -433,7 +433,7 @@ public: } virtual SkDisplayable* createInstance(SkDisplayTypes type) { - SkDisplayable* result = NULL; + SkDisplayable* result = nullptr; if (skDrawShape1DPathEffectType == type) result = new SkDrawShape1DPathEffect(type); else if (skDrawShape2DPathEffectType == type) @@ -454,7 +454,7 @@ public: #if SK_USE_CONDENSED_INFO == 0 virtual const SkMemberInfo* getMembers(SkDisplayTypes type, int* infoCountPtr) { - const SkMemberInfo* info = NULL; + const SkMemberInfo* info = nullptr; int infoCount = 0; if (skDrawShape1DPathEffectType == type) { info = SkDrawShape1DPathEffect::fInfo; @@ -485,12 +485,12 @@ public: return kDrawComposePathEffectName; else if (skDrawCornerPathEffectType == type) return kDrawCornerPathEffectName; - return NULL; + return nullptr; } #endif virtual SkDisplayTypes getType(const char name[], size_t len ) { - SkDisplayTypes* type = NULL; + SkDisplayTypes* type = nullptr; if (SK_LITERAL_STR_EQUAL(kDrawShape1DPathEffectName, name, len)) type = &skDrawShape1DPathEffectType; else if (SK_LITERAL_STR_EQUAL(kDrawShape2DPathEffectName, name, len)) @@ -521,5 +521,5 @@ void InitializeSkExtraPathEffects(SkAnimator* animator) { //////////////// -SkExtras::SkExtras() : fExtraCallBack(NULL), fExtraStorage(NULL) { +SkExtras::SkExtras() : fExtraCallBack(nullptr), fExtraStorage(nullptr) { } diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp index 70e5e4493e..4aecbc3936 100644 --- a/src/animator/SkDrawGradient.cpp +++ b/src/animator/SkDrawGradient.cpp @@ -127,7 +127,7 @@ void SkDrawLinearGradient::dump(SkAnimateMaker* maker) { SkShader* SkDrawLinearGradient::getShader() { if (addPrelude() == 0 || points.count() != 4) - return NULL; + return nullptr; SkShader* shader = SkGradientShader::CreateLinear((SkPoint*)points.begin(), fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode, 0, getMatrix()); @@ -162,7 +162,7 @@ void SkDrawRadialGradient::dump(SkAnimateMaker* maker) { SkShader* SkDrawRadialGradient::getShader() { if (addPrelude() == 0) - return NULL; + return nullptr; SkShader* shader = SkGradientShader::CreateRadial(center, radius, fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode, 0, getMatrix()); diff --git a/src/animator/SkDrawGroup.cpp b/src/animator/SkDrawGroup.cpp index b1b7f0a429..76807bf591 100644 --- a/src/animator/SkDrawGroup.cpp +++ b/src/animator/SkDrawGroup.cpp @@ -28,7 +28,7 @@ const SkMemberInfo SkGroup::fInfo[] = { DEFINE_GET_MEMBER(SkGroup); -SkGroup::SkGroup() : fParentList(NULL), fOriginal(NULL) { +SkGroup::SkGroup() : fParentList(nullptr), fOriginal(nullptr) { } SkGroup::~SkGroup() { @@ -55,7 +55,7 @@ bool SkGroup::addChild(SkAnimateMaker& , SkDisplayable* child) { *fChildren.append() = (SkADrawable*) child; if (child->isGroup()) { SkGroup* groupie = (SkGroup*) child; - SkASSERT(groupie->fParentList == NULL); + SkASSERT(groupie->fParentList == nullptr); groupie->fParentList = &fChildren; } return true; diff --git a/src/animator/SkDrawGroup.h b/src/animator/SkDrawGroup.h index 83e6771d2d..f1b7bb6e28 100644 --- a/src/animator/SkDrawGroup.h +++ b/src/animator/SkDrawGroup.h @@ -38,7 +38,7 @@ public: SkGroup* getOriginal() { return fOriginal; } bool hasEnable() const override; void initialize() override; - SkBool isACopy() { return fOriginal != NULL; } + SkBool isACopy() { return fOriginal != nullptr; } void markCopyClear(int index); void markCopySet(int index); void markCopySize(int index); diff --git a/src/animator/SkDrawPaint.cpp b/src/animator/SkDrawPaint.cpp index f5d33881a0..d1af4f42ff 100644 --- a/src/animator/SkDrawPaint.cpp +++ b/src/animator/SkDrawPaint.cpp @@ -64,7 +64,7 @@ const SkMemberInfo SkDrawPaint::fInfo[] = { DEFINE_GET_MEMBER(SkDrawPaint); -SkDrawPaint::SkDrawPaint() : antiAlias(-1), color(NULL), fakeBold(-1), filterBitmap(-1), +SkDrawPaint::SkDrawPaint() : antiAlias(-1), color(nullptr), fakeBold(-1), filterBitmap(-1), linearText(-1), maskFilter((SkDrawMaskFilter*) -1), pathEffect((SkDrawPathEffect*) -1), shader((SkDrawShader*) -1), strikeThru(-1), stroke(-1), strokeCap((SkPaint::Cap) -1), strokeJoin((SkPaint::Join) -1), strokeMiter(SK_ScalarNaN), @@ -98,7 +98,7 @@ bool SkDrawPaint::add(SkAnimateMaker* maker, SkDisplayable* child) { SkDisplayable* SkDrawPaint::deepCopy(SkAnimateMaker* maker) { SkDrawColor* tempColor = color; - color = NULL; + color = nullptr; SkDrawPaint* copy = (SkDrawPaint*) INHERITED::deepCopy(maker); color = tempColor; tempColor = (SkDrawColor*) color->deepCopy(maker); @@ -148,7 +148,7 @@ void SkDrawPaint::dump(SkAnimateMaker* maker) { void SkDrawPaint::executeFunction(SkDisplayable* target, int index, SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, SkScriptValue* scriptValue) { - if (scriptValue == NULL) + if (scriptValue == nullptr) return; SkASSERT(target == this); switch (index) { @@ -213,7 +213,7 @@ bool SkDrawPaint::resolveIDs(SkAnimateMaker& maker, SkDisplayable* origDisp, SkA void SkDrawPaint::setupPaint(SkPaint* paint) const { if (antiAlias != -1) paint->setAntiAlias(SkToBool(antiAlias)); - if (color != NULL) + if (color != nullptr) paint->setColor(color->getColor()); if (fakeBold != -1) paint->setFakeBoldText(SkToBool(fakeBold)); @@ -226,16 +226,16 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const { paint->setStyle((SkPaint::Style) style); if (linearText != -1) paint->setLinearText(SkToBool(linearText)); - if (maskFilter == NULL) - paint->setMaskFilter(NULL); + if (maskFilter == nullptr) + paint->setMaskFilter(nullptr); else if (maskFilter != (SkDrawMaskFilter*) -1) SkSafeUnref(paint->setMaskFilter(maskFilter->getMaskFilter())); - if (pathEffect == NULL) - paint->setPathEffect(NULL); + if (pathEffect == nullptr) + paint->setPathEffect(nullptr); else if (pathEffect != (SkDrawPathEffect*) -1) SkSafeUnref(paint->setPathEffect(pathEffect->getPathEffect())); - if (shader == NULL) - paint->setShader(NULL); + if (shader == nullptr) + paint->setShader(nullptr); else if (shader != (SkDrawShader*) -1) SkSafeUnref(paint->setShader(shader->getShader())); if (strikeThru != -1) @@ -256,8 +256,8 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const { paint->setTextSize(textSize); if (SkScalarIsNaN(textSkewX) == false) paint->setTextSkewX(textSkewX); - if (typeface == NULL) - paint->setTypeface(NULL); + if (typeface == nullptr) + paint->setTypeface(nullptr); else if (typeface != (SkDrawTypeface*) -1) SkSafeUnref(paint->setTypeface(typeface->getTypeface())); if (underline != -1) diff --git a/src/animator/SkDrawPath.cpp b/src/animator/SkDrawPath.cpp index f62f7c04dd..c4c6f5caf5 100644 --- a/src/animator/SkDrawPath.cpp +++ b/src/animator/SkDrawPath.cpp @@ -34,7 +34,7 @@ DEFINE_GET_MEMBER(SkDrawPath); SkDrawPath::SkDrawPath() { - fParent = NULL; + fParent = nullptr; fLength = SK_ScalarNaN; fChildHasID = false; fDirty = false; diff --git a/src/animator/SkDrawRectangle.cpp b/src/animator/SkDrawRectangle.cpp index c3fb7ff705..a89b67cfdf 100644 --- a/src/animator/SkDrawRectangle.cpp +++ b/src/animator/SkDrawRectangle.cpp @@ -36,7 +36,7 @@ const SkMemberInfo SkDrawRect::fInfo[] = { DEFINE_GET_MEMBER(SkDrawRect); -SkDrawRect::SkDrawRect() : fParent(NULL) { +SkDrawRect::SkDrawRect() : fParent(nullptr) { fRect.setEmpty(); } diff --git a/src/animator/SkDrawSaveLayer.cpp b/src/animator/SkDrawSaveLayer.cpp index 9623c905c9..c9a4d9fead 100644 --- a/src/animator/SkDrawSaveLayer.cpp +++ b/src/animator/SkDrawSaveLayer.cpp @@ -24,7 +24,7 @@ const SkMemberInfo SkSaveLayer::fInfo[] = { DEFINE_GET_MEMBER(SkSaveLayer); -SkSaveLayer::SkSaveLayer() : paint(NULL), bounds(NULL) { +SkSaveLayer::SkSaveLayer() : paint(nullptr), bounds(nullptr) { } SkSaveLayer::~SkSaveLayer(){ diff --git a/src/animator/SkDrawShader.cpp b/src/animator/SkDrawShader.cpp index 29e5251e22..9e3becc48b 100644 --- a/src/animator/SkDrawShader.cpp +++ b/src/animator/SkDrawShader.cpp @@ -23,7 +23,7 @@ const SkMemberInfo SkDrawShader::fInfo[] = { DEFINE_GET_MEMBER(SkDrawShader); -SkDrawShader::SkDrawShader() : matrix(NULL), +SkDrawShader::SkDrawShader() : matrix(nullptr), tileMode(SkShader::kClamp_TileMode) { } @@ -36,7 +36,7 @@ bool SkDrawShader::add() { } SkMatrix* SkDrawShader::getMatrix() { - return matrix ? &matrix->getMatrix() : NULL; + return matrix ? &matrix->getMatrix() : nullptr; } #if SK_USE_CONDENSED_INFO == 0 @@ -51,7 +51,7 @@ const SkMemberInfo SkDrawBitmapShader::fInfo[] = { DEFINE_GET_MEMBER(SkDrawBitmapShader); -SkDrawBitmapShader::SkDrawBitmapShader() : filterBitmap(-1), image(NULL) {} +SkDrawBitmapShader::SkDrawBitmapShader() : filterBitmap(-1), image(nullptr) {} bool SkDrawBitmapShader::add() { if (fPaint->shader != (SkDrawShader*) -1) @@ -62,8 +62,8 @@ bool SkDrawBitmapShader::add() { } SkShader* SkDrawBitmapShader::getShader() { - if (image == NULL) - return NULL; + if (image == nullptr) + return nullptr; // note: bitmap shader now supports independent tile modes for X and Y // we pass the same to both, but later we should extend this flexibility diff --git a/src/animator/SkDrawTo.cpp b/src/animator/SkDrawTo.cpp index ef084d12d0..7ae9ca58d4 100644 --- a/src/animator/SkDrawTo.cpp +++ b/src/animator/SkDrawTo.cpp @@ -23,7 +23,7 @@ const SkMemberInfo SkDrawTo::fInfo[] = { DEFINE_GET_MEMBER(SkDrawTo); -SkDrawTo::SkDrawTo() : drawOnce(false), use(NULL), fDrawnOnce(false) { +SkDrawTo::SkDrawTo() : drawOnce(false), use(nullptr), fDrawnOnce(false) { } #if 0 diff --git a/src/animator/SkDump.cpp b/src/animator/SkDump.cpp index 9f297e9d58..346b30daf7 100644 --- a/src/animator/SkDump.cpp +++ b/src/animator/SkDump.cpp @@ -56,7 +56,7 @@ bool SkDump::enable(SkAnimateMaker& maker ) { } bool SkDump::evaluate(SkAnimateMaker &maker) { - SkAnimatorScript scriptEngine(maker, NULL, SkType_Int); + SkAnimatorScript scriptEngine(maker, nullptr, SkType_Int); SkScriptValue value; const char* cScript = script.c_str(); bool success = scriptEngine.evaluateScript(&cScript, &value); @@ -91,7 +91,7 @@ void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) { const char* str = map.fValues; while (--index >= 0) { str = strchr(str, '|'); - if (str == NULL) { + if (str == nullptr) { result->reset(); result->appendS32(badEnum); return; @@ -99,7 +99,7 @@ void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) { str += 1; } const char* end = strchr(str, '|'); - if (end == NULL) + if (end == nullptr) end = str + strlen(str); result->set(str, end - str); } diff --git a/src/animator/SkGetCondensedInfo.cpp b/src/animator/SkGetCondensedInfo.cpp index f2471bbed9..de6fa184b5 100644 --- a/src/animator/SkGetCondensedInfo.cpp +++ b/src/animator/SkGetCondensedInfo.cpp @@ -53,7 +53,7 @@ static int _searchByType(SkDisplayTypes type) { const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* , SkDisplayTypes type, int* infoCountPtr) { int lookup = _searchByType(type); if (lookup < 0) - return NULL; + return nullptr; if (infoCountPtr) *infoCountPtr = gInfoCounts[lookup]; return gInfoTables[lookup]; @@ -72,10 +72,10 @@ static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) { if (info->fType == SkType_BaseClassInfo) { int baseTypeLookup = info->fOffset; const SkMemberInfo* result = _lookup(baseTypeLookup, matchPtr); - if (result != NULL) + if (result != nullptr) return result; if (--count == 0) - return NULL; + return nullptr; info++; } SkASSERT(info->fType != SkType_BaseClassInfo); @@ -83,7 +83,7 @@ static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) { const char* strings = gInfoNames[lookup]; int index = _searchByName(&info->fName, count, strings, match); if (index < 0) - return NULL; + return nullptr; return &info[index]; } @@ -93,16 +93,16 @@ const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, int* index) { if (info->fType == SkType_BaseClassInfo) { int baseTypeLookup = info->fOffset; const SkMemberInfo* result = Find(baseTypeLookup, index); - if (result != NULL) + if (result != nullptr) return result; if (--count == 0) - return NULL; + return nullptr; info++; } SkASSERT(info->fType != SkType_BaseClassInfo); if (*index >= count) { *index -= count; - return NULL; + return nullptr; } return &info[index]; } diff --git a/src/animator/SkMatrixParts.cpp b/src/animator/SkMatrixParts.cpp index a2f3a9a524..c607f2523f 100644 --- a/src/animator/SkMatrixParts.cpp +++ b/src/animator/SkMatrixParts.cpp @@ -13,7 +13,7 @@ #include "SkDrawRectangle.h" #include "SkDrawPath.h" -SkMatrixPart::SkMatrixPart() : fMatrix(NULL) { +SkMatrixPart::SkMatrixPart() : fMatrix(nullptr) { } void SkMatrixPart::dirty() { @@ -25,7 +25,7 @@ SkDisplayable* SkMatrixPart::getParent() const { } bool SkMatrixPart::setParent(SkDisplayable* parent) { - SkASSERT(parent != NULL); + SkASSERT(parent != nullptr); if (parent->isMatrix() == false) return true; fMatrix = (SkDrawMatrix*) parent; @@ -131,14 +131,14 @@ const SkMemberInfo SkFromPath::fInfo[] = { DEFINE_GET_MEMBER(SkFromPath); SkFromPath::SkFromPath() : - mode(0), offset(0), path(NULL) { + mode(0), offset(0), path(nullptr) { } SkFromPath::~SkFromPath() { } bool SkFromPath::add() { - if (path == NULL) + if (path == nullptr) return true; static const uint8_t gFlags[] = { SkPathMeasure::kGetPosAndTan_MatrixFlag, // normal @@ -167,14 +167,14 @@ const SkMemberInfo SkRectToRect::fInfo[] = { DEFINE_GET_MEMBER(SkRectToRect); SkRectToRect::SkRectToRect() : - source(NULL), destination(NULL) { + source(nullptr), destination(nullptr) { } SkRectToRect::~SkRectToRect() { } bool SkRectToRect::add() { - if (source == NULL || destination == NULL) + if (source == nullptr || destination == nullptr) return true; SkMatrix temp; temp.setRectToRect(source->fRect, destination->fRect, @@ -208,10 +208,10 @@ void SkRectToRect::dump(SkAnimateMaker* maker) { #endif const SkMemberInfo* SkRectToRect::preferredChild(SkDisplayTypes ) { - if (source == NULL) + if (source == nullptr) return getMember("source"); // !!! cwap! need to refer to member through enum like kScope instead else { - SkASSERT(destination == NULL); + SkASSERT(destination == nullptr); return getMember("destination"); } } @@ -228,7 +228,7 @@ const SkMemberInfo SkPolyToPoly::fInfo[] = { DEFINE_GET_MEMBER(SkPolyToPoly); -SkPolyToPoly::SkPolyToPoly() : source(NULL), destination(NULL) { +SkPolyToPoly::SkPolyToPoly() : source(nullptr), destination(nullptr) { } SkPolyToPoly::~SkPolyToPoly() { @@ -283,10 +283,10 @@ void SkPolyToPoly::onEndElement(SkAnimateMaker& ) { } const SkMemberInfo* SkPolyToPoly::preferredChild(SkDisplayTypes ) { - if (source == NULL) + if (source == nullptr) return getMember("source"); // !!! cwap! need to refer to member through enum like kScope instead else { - SkASSERT(destination == NULL); + SkASSERT(destination == nullptr); return getMember("destination"); } } diff --git a/src/animator/SkMemberInfo.cpp b/src/animator/SkMemberInfo.cpp index 5cdc8d0de6..ea4c257b10 100644 --- a/src/animator/SkMemberInfo.cpp +++ b/src/animator/SkMemberInfo.cpp @@ -105,7 +105,7 @@ size_t SkMemberInfo::getSize(const SkDisplayable* displayable) const { break; case SkType_Array: { SkDisplayTypes type; - if (displayable == NULL) + if (displayable == nullptr) return sizeof(int); if (displayable->getType() == SkType_Array) { SkDisplayArray* dispArray = (SkDisplayArray*) displayable; @@ -191,9 +191,9 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag SkDisplayTypes type = getType(); SkAnimatorScript engine(maker, displayable, type); if (arrayStorage) - displayable = NULL; + displayable = nullptr; bool success = true; - void* untypedStorage = NULL; + void* untypedStorage = nullptr; if (displayable && fType != SkType_MemberProperty && fType != SkType_MemberFunction) untypedStorage = (SkTDOperandArray*) memberData(displayable); @@ -201,7 +201,7 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag // for both SpiderMonkey and SkiaScript, substitute any #xyz or #xxyyzz first // it's enough to expand the colors into 0xFFxxyyzz const char* poundPos; - while ((poundPos = strchr(valueStr.c_str(), '#')) != NULL) { + while ((poundPos = strchr(valueStr.c_str(), '#')) != nullptr) { size_t offset = poundPos - valueStr.c_str(); if (valueStr.size() - offset < 4) break; @@ -258,7 +258,7 @@ scriptCommon: { SkASSERT(success); if (scriptValue.fType == SkType_Displayable) { if (type == SkType_String) { - const char* charPtr = NULL; + const char* charPtr = nullptr; maker.findKey(scriptValue.fOperand.fDisplayable, &charPtr); scriptValue.fOperand.fString = new SkString(charPtr); scriptValue.fType = SkType_String; @@ -358,7 +358,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra SkScriptValue& scriptValue) const { SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ? - arrayStorage->begin() : NULL; + arrayStorage->begin() : nullptr; if (storage) storage += storageOffset; SkDisplayTypes type = getType(); @@ -386,7 +386,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra } else if (fType == SkType_MemberFunction) { SkASSERT(scriptValue.fType == SkType_Array); if (displayable) - displayable->executeFunction(displayable, this, scriptValue.fOperand.fArray, NULL); + displayable->executeFunction(displayable, this, scriptValue.fOperand.fArray, nullptr); else { int count = scriptValue.fOperand.fArray->count(); // SkASSERT(maxStorage == 0 || count == maxStorage); @@ -426,7 +426,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra SkTypedArray* array = scriptValue.fOperand.fArray; SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB || scriptValue.fType == SkType_Array); - SkASSERT(scriptValue.fType != SkType_Array || (array != NULL && + SkASSERT(scriptValue.fType != SkType_Array || (array != nullptr && array->getType() == SkType_Int)); int numberOfColors = scriptValue.fType == SkType_Array ? array->count() : 1; int numberOfComponents = numberOfColors * 4; @@ -442,7 +442,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra storage[3].fScalar = SkIntToScalar(SkColorGetB(color)); storage += 4; } - } else if (SkDisplayType::IsStruct(NULL /* !!! maker*/, type)) { + } else if (SkDisplayType::IsStruct(nullptr /* !!! maker*/, type)) { if (scriptValue.fType != SkType_Array) return true; // error SkASSERT(sizeof(SkScalar) == sizeof(SkOperand)); // !!! no 64 bit pointer support yet @@ -486,17 +486,17 @@ const SkMemberInfo* SkMemberInfo::Find(const SkMemberInfo info[], int count, int if (info->fType == SkType_BaseClassInfo) { const SkMemberInfo* inherited = (SkMemberInfo*) info->fName; const SkMemberInfo* result = SkMemberInfo::Find(inherited, info->fCount, index); - if (result != NULL) + if (result != nullptr) return result; if (--count == 0) - return NULL; + return nullptr; info++; } SkASSERT(info->fName); SkASSERT(info->fType != SkType_BaseClassInfo); if (*index >= count) { *index -= count; - return NULL; + return nullptr; } return &info[*index]; } @@ -507,17 +507,17 @@ const SkMemberInfo* SkMemberInfo::Find(const SkMemberInfo info[], int count, con if (info->fType == SkType_BaseClassInfo) { const SkMemberInfo* inherited = (SkMemberInfo*) info->fName; const SkMemberInfo* result = SkMemberInfo::Find(inherited, info->fCount, matchPtr); - if (result != NULL) + if (result != nullptr) return result; if (--count == 0) - return NULL; + return nullptr; info++; } SkASSERT(info->fName); SkASSERT(info->fType != SkType_BaseClassInfo); int index = SkStrSearch(&info->fName, count, match, sizeof(*info)); if (index < 0 || index >= count) - return NULL; + return nullptr; return &info[index]; } diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h index 3588da2515..b62de663d4 100644 --- a/src/animator/SkMemberInfo.h +++ b/src/animator/SkMemberInfo.h @@ -32,7 +32,7 @@ struct SkMemberInfo { // if fCount == 0, record is member property // then fType can be type, so caller doesn't have to check #if SK_USE_CONDENSED_INFO == 0 - const char* fName; // may be NULL for anonymous functions + const char* fName; // may be nullptr for anonymous functions size_t fOffset; // if negative, is index into member pointer table (for properties and functions) SkDisplayTypes fType; int fCount; // for properties, actual type (count is always assumed to be 1) @@ -229,36 +229,36 @@ public: \ #define DECLARE_MEMBER_INFO(_type) \ public: \ virtual const SkMemberInfo* getMember(int index) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \ virtual const SkMemberInfo* getMember(const char name[]) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \ virtual SkDisplayTypes getType() const { return SkType_##_type; } \ typedef Sk##_type BASE_CLASS #define DECLARE_DRAW_MEMBER_INFO(_type) \ public: \ virtual const SkMemberInfo* getMember(int index) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \ virtual const SkMemberInfo* getMember(const char name[]) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \ virtual SkDisplayTypes getType() const { return SkType_##_type; } \ typedef SkDraw##_type BASE_CLASS #define DECLARE_DISPLAY_MEMBER_INFO(_type) \ public: \ virtual const SkMemberInfo* getMember(int index) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \ virtual const SkMemberInfo* getMember(const char name[]) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \ virtual SkDisplayTypes getType() const { return SkType_##_type; } \ typedef SkDisplay##_type BASE_CLASS #define DECLARE_EXTRAS_MEMBER_INFO(_type) \ public: \ virtual const SkMemberInfo* getMember(int index) { \ - return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \ + return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \ virtual const SkMemberInfo* getMember(const char name[]) { \ - return SkDisplayType::GetMember(NULL, fType, &name); } \ + return SkDisplayType::GetMember(nullptr, fType, &name); } \ SkDisplayTypes fType; \ virtual SkDisplayTypes getType() const { return fType; } \ typedef _type BASE_CLASS diff --git a/src/animator/SkOperandIterpolator.cpp b/src/animator/SkOperandIterpolator.cpp index 84b32823e1..e6973e29f7 100644 --- a/src/animator/SkOperandIterpolator.cpp +++ b/src/animator/SkOperandIterpolator.cpp @@ -38,7 +38,7 @@ void SkOperandInterpolator::reset(int elemCount, int frameCount, SkDisplayTypes bool SkOperandInterpolator::setKeyFrame(int index, SkMSec time, const SkOperand values[], SkScalar blend) { - SkASSERT(values != NULL); + SkASSERT(values != nullptr); blend = SkScalarPin(blend, 0, SK_Scalar1); bool success = ~index == SkTSearch<SkMSec>(&fTimes->fTime, index, time, sizeof(SkTimeCode)); diff --git a/src/animator/SkPaintPart.cpp b/src/animator/SkPaintPart.cpp index 285b564c93..842dbc9752 100644 --- a/src/animator/SkPaintPart.cpp +++ b/src/animator/SkPaintPart.cpp @@ -12,7 +12,7 @@ #include "SkDump.h" #endif -SkPaintPart::SkPaintPart() : fPaint(NULL) { +SkPaintPart::SkPaintPart() : fPaint(nullptr) { } SkDisplayable* SkPaintPart::getParent() const { @@ -20,7 +20,7 @@ SkDisplayable* SkPaintPart::getParent() const { } bool SkPaintPart::setParent(SkDisplayable* parent) { - SkASSERT(parent != NULL); + SkASSERT(parent != nullptr); if (parent->isPaint() == false) return true; fPaint = (SkDrawPaint*) parent; @@ -38,7 +38,7 @@ bool SkDrawMaskFilter::add() { } SkMaskFilter* SkDrawMaskFilter::getMaskFilter() { - return NULL; + return nullptr; } @@ -51,18 +51,18 @@ bool SkDrawPathEffect::add() { fPaint->fOwnsPathEffect = true; return false; } - fPaint->add(NULL, this); + fPaint->add(nullptr, this); return false; } SkPathEffect* SkDrawPathEffect::getPathEffect() { - return NULL; + return nullptr; } // SkDrawShader SkShader* SkDrawShader::getShader() { - return NULL; + return nullptr; } diff --git a/src/animator/SkPaintPart.h b/src/animator/SkPaintPart.h index 2907d81615..a7e28ed3e2 100644 --- a/src/animator/SkPaintPart.h +++ b/src/animator/SkPaintPart.h @@ -51,7 +51,7 @@ class SkDrawShader : public SkPaintPart { virtual SkShader* getShader(); protected: bool add() override; - SkMatrix* getMatrix(); // returns NULL if matrix is NULL + SkMatrix* getMatrix(); // returns nullptr if matrix is nullptr SkDrawMatrix* matrix; int /*SkShader::TileMode*/ tileMode; }; diff --git a/src/animator/SkParseSVGPath.cpp b/src/animator/SkParseSVGPath.cpp index 4b548e28be..7050f7c1e0 100644 --- a/src/animator/SkParseSVGPath.cpp +++ b/src/animator/SkParseSVGPath.cpp @@ -218,7 +218,7 @@ void SkDrawPath::parseSVG() { break; case '~': { SkPoint args[2]; - data = find_points(data, args, 2, false, NULL); + data = find_points(data, args, 2, false, nullptr); fPath.moveTo(args[0].fX, args[0].fY); fPath.lineTo(args[1].fX, args[1].fY); } diff --git a/src/animator/SkPathParts.cpp b/src/animator/SkPathParts.cpp index efc7c3355d..b5407ceeb5 100644 --- a/src/animator/SkPathParts.cpp +++ b/src/animator/SkPathParts.cpp @@ -13,7 +13,7 @@ #include "SkDrawRectangle.h" #include "SkDrawPath.h" -SkPathPart::SkPathPart() : fPath(NULL) { +SkPathPart::SkPathPart() : fPath(nullptr) { } void SkPathPart::dirty() { @@ -25,7 +25,7 @@ SkDisplayable* SkPathPart::getParent() const { } bool SkPathPart::setParent(SkDisplayable* parent) { - SkASSERT(parent != NULL); + SkASSERT(parent != nullptr); if (parent->isPath() == false) return true; fPath = (SkDrawPath*) parent; @@ -305,11 +305,11 @@ const SkMemberInfo SkAddPath::fInfo[] = { DEFINE_GET_MEMBER(SkAddPath); -SkAddPath::SkAddPath() : matrix(NULL), path(NULL) { +SkAddPath::SkAddPath() : matrix(nullptr), path(nullptr) { } bool SkAddPath::add() { - SkASSERT (path != NULL); + SkASSERT (path != nullptr); if (matrix) fPath->fPath.addPath(path->fPath, matrix->getMatrix()); else diff --git a/src/animator/SkPostParts.cpp b/src/animator/SkPostParts.cpp index 7c0931eaa0..bfd5385532 100644 --- a/src/animator/SkPostParts.cpp +++ b/src/animator/SkPostParts.cpp @@ -20,7 +20,7 @@ const SkMemberInfo SkDataInput::fInfo[] = { DEFINE_GET_MEMBER(SkDataInput); -SkDataInput::SkDataInput() : fParent(NULL) {} +SkDataInput::SkDataInput() : fParent(nullptr) {} bool SkDataInput::add() { SkASSERT(name.size() > 0); diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp index 0694fc4a84..cd864146f7 100644 --- a/src/animator/SkScript.cpp +++ b/src/animator/SkScript.cpp @@ -386,7 +386,7 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed, const char* field, size_t fieldLength) { void* object; if (suppressed) - object = NULL; + object = nullptr; else { if (fTypeStack.top() != kObject) { fError = kDotOperatorExpectsObject; @@ -492,7 +492,7 @@ bool SkScriptEngine::functionParams(const char** scriptPtr, SkTDArray<SkScriptVa SkBool suppressed = fSuppressStack.top().fSuppress; do { SkScriptValue value; - bool success = innerScript(scriptPtr, suppressed ? NULL : &value); + bool success = innerScript(scriptPtr, suppressed ? nullptr : &value); if (success == false) { fError = kErrorInFunctionParameters; return false; @@ -559,7 +559,7 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) { if (convertTo(tokenInfo->getType(), &tokenValue) == false) return false; } - tokenInfo->writeValue(fDisplayable, NULL, 0, 0, + tokenInfo->writeValue(fDisplayable, nullptr, 0, 0, (void*) ((char*) fInfo->memberData(fDisplayable) + tokenInfo->fOffset + fArrayOffset), tokenInfo->getType(), tokenValue); } @@ -635,7 +635,7 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) { } script += 2; script = SkParse::FindHex(script, (uint32_t*)&operand.fS32); - if (script == NULL) { + if (script == nullptr) { fError = kExpectedHex; return false; } @@ -711,7 +711,7 @@ scalarCommon: if (ch == '.') { if (fTokenLength == 0) { SkScriptValue scriptValue; - SkDEBUGCODE(scriptValue.fOperand.fObject = NULL); + SkDEBUGCODE(scriptValue.fOperand.fObject = nullptr); int tokenLength = token_length(++script); const char* token = script; script += tokenLength; @@ -880,7 +880,7 @@ bool SkScriptEngine::handleArrayIndexer(const char** scriptPtr, bool suppressed) *fBraceStack.push() = kArrayBrace; SkOpType saveType = fReturnType; fReturnType = kInt; - bool success = innerScript(scriptPtr, suppressed == false ? &scriptValue : NULL); + bool success = innerScript(scriptPtr, suppressed == false ? &scriptValue : nullptr); if (success == false) return false; fReturnType = saveType; @@ -1037,7 +1037,7 @@ bool SkScriptEngine::handleProperty(bool suppressed) { success = (*callBack->fPropertyCallBack)(fToken, fTokenLength, callBack->fUserStorage, &callbackResult); if (success) { - if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == NULL) { + if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == nullptr) { callbackResult.fOperand.fString = new SkString(fToken, fTokenLength); track(callbackResult.fOperand.fString); } @@ -1317,7 +1317,7 @@ bool SkScriptEngine::processOp() { if ((type1 & attributes->fLeftType) == 0 || type1 != type2) { if (type1 == kString) { const char* result = SkParse::FindScalar(operand1.fString->c_str(), &operand1.fScalar); - if (result == NULL) { + if (result == nullptr) { fError = kExpectedNumber; return false; } @@ -1332,7 +1332,7 @@ bool SkScriptEngine::processOp() { if ((type2 & attributes->fRightType) == 0 || type1 != type2) { if (type2 == kString) { const char* result = SkParse::FindScalar(operand2.fString->c_str(), &operand2.fScalar); - if (result == NULL) { + if (result == nullptr) { fError = kExpectedNumber; return false; } @@ -1487,7 +1487,7 @@ void SkScriptEngine::unboxCallBack(_unboxCallBack func, void* userStorage) { bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, SkScriptValue* value ) { SkASSERT(value); - if (SkDisplayType::IsEnum(NULL /* fMaker */, toType)) + if (SkDisplayType::IsEnum(nullptr /* fMaker */, toType)) toType = SkType_Int; if (toType == SkType_Point || toType == SkType_3D_Point) toType = SkType_Float; @@ -1509,7 +1509,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk success = false; break; // error } - success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != NULL; + success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != nullptr; } break; case SkType_Float: @@ -1525,7 +1525,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk success = false; break; // error } - success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != NULL; + success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != nullptr; } break; case SkType_String: { @@ -1595,9 +1595,9 @@ SkDisplayTypes SkScriptEngine::ToDisplayType(SkOpType type) { } SkScriptEngine::SkOpType SkScriptEngine::ToOpType(SkDisplayTypes type) { - if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type)) + if (SkDisplayType::IsDisplayable(nullptr /* fMaker */, type)) return (SkOpType) kObject; - if (SkDisplayType::IsEnum(NULL /* fMaker */, type)) + if (SkDisplayType::IsEnum(nullptr /* fMaker */, type)) return kInt; switch (type) { case SkType_ARGB: @@ -1647,7 +1647,7 @@ bool SkScriptEngine::ValueToString(SkScriptValue value, SkString* string) { #include "SkFloatingPoint.h" #define DEF_SCALAR_ANSWER 0 -#define DEF_STRING_ANSWER NULL +#define DEF_STRING_ANSWER nullptr #define testInt(expression) { #expression, SkType_Int, expression, DEF_SCALAR_ANSWER, DEF_STRING_ANSWER } #define testScalar(expression) { #expression, SkType_Float, 0, (float) expression, DEF_STRING_ANSWER } diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp index 5517b5142a..7cb35a69db 100644 --- a/src/animator/SkScriptRuntime.cpp +++ b/src/animator/SkScriptRuntime.cpp @@ -200,13 +200,13 @@ bool SkScriptRuntime::executeTokens(unsigned char* opCode) { operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32); break; case SkScriptEngine2::kStringToInt: - if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == NULL) + if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == nullptr) return false; break; case SkScriptEngine2::kStringToScalar: case SkScriptEngine2::kStringToScalar2: if (SkParse::FindScalar(operand[0].fString->c_str(), - &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == NULL) + &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == nullptr) return false; break; case SkScriptEngine2::kScalarToInt: @@ -341,11 +341,11 @@ void SkScriptRuntime::track(SkString* string) { void SkScriptRuntime::untrack(SkOpArray* array) { int index = fTrackArray.find(array); SkASSERT(index >= 0); - fTrackArray.begin()[index] = NULL; + fTrackArray.begin()[index] = nullptr; } void SkScriptRuntime::untrack(SkString* string) { int index = fTrackString.find(string); SkASSERT(index >= 0); - fTrackString.begin()[index] = NULL; + fTrackString.begin()[index] = nullptr; } diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp index 03ffaa4a72..4ab7584f7a 100644 --- a/src/animator/SkScriptTokenizer.cpp +++ b/src/animator/SkScriptTokenizer.cpp @@ -815,7 +815,7 @@ bool SkScriptEngine2::handleFunction(const char** scriptPtr) { SkScriptValue2 callbackResult; success = (*callBack)->getReference(functionName, functionNameLen, &callbackResult); if (success) { - callbackResult.fType = (*callBack)->getReturnType(callbackResult.fOperand.fReference, NULL); + callbackResult.fType = (*callBack)->getReturnType(callbackResult.fOperand.fReference, nullptr); callbackResult.fIsConstant = SkScriptValue2::kVariable; fValueStack.push(callbackResult); goto done; @@ -877,7 +877,7 @@ bool SkScriptEngine2::handleProperty() { SkScriptValue2 callbackResult; success = (*callBack)->getReference(fToken, fTokenLength, &callbackResult); if (success) { - if (callbackResult.fType == SkOperand2::kString && callbackResult.fOperand.fString == NULL) { + if (callbackResult.fType == SkOperand2::kString && callbackResult.fOperand.fString == nullptr) { callbackResult.fOperand.fString = new SkString(fToken, fTokenLength); track(callbackResult.fOperand.fString); } @@ -1203,7 +1203,7 @@ bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toTy operand.fS32 = SkScalarFloorToInt(operand.fScalar); else { SkASSERT(type == SkOperand2::kString); - success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != NULL; + success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != nullptr; } break; case SkOperand2::kScalar: @@ -1211,7 +1211,7 @@ bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toTy operand.fScalar = IntToScalar(operand.fS32); else { SkASSERT(type == SkOperand2::kString); - success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != NULL; + success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != nullptr; } break; case SkOperand2::kString: { @@ -1273,11 +1273,11 @@ bool SkScriptEngine2::ValueToString(const SkScriptValue2& value, SkString* strin #ifdef SK_DEBUG #if defined(SK_SUPPORT_UNITTEST) -#define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, NULL } -#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (expression), NULL } -#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf((float) exp1, (float) exp2), NULL } -#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL } -#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL } +#define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, nullptr } +#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (expression), nullptr } +#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf((float) exp1, (float) exp2), nullptr } +#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, nullptr } +#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, nullptr } static const SkScriptNAnswer2 scriptTests[] = { testInt(1||(0&&3)), @@ -1308,12 +1308,12 @@ static const SkScriptNAnswer2 scriptTests[] = { { "'123'+\"456\"", SkOperand2::kString, 0, 0, "123456" }, { "123+\"456\"", SkOperand2::kString, 0, 0, "123456" }, { "'123'+456", SkOperand2::kString, 0, 0, "123456" }, - { "'123'|\"456\"", SkOperand2::kS32, 123|456, 0, NULL }, - { "123|\"456\"", SkOperand2::kS32, 123|456, 0, NULL }, - { "'123'|456", SkOperand2::kS32, 123|456, 0, NULL }, - { "'2'<11", SkOperand2::kS32, 1, 0, NULL }, - { "2<'11'", SkOperand2::kS32, 1, 0, NULL }, - { "'2'<'11'", SkOperand2::kS32, 0, 0, NULL }, + { "'123'|\"456\"", SkOperand2::kS32, 123|456, 0, nullptr }, + { "123|\"456\"", SkOperand2::kS32, 123|456, 0, nullptr }, + { "'123'|456", SkOperand2::kS32, 123|456, 0, nullptr }, + { "'2'<11", SkOperand2::kS32, 1, 0, nullptr }, + { "2<'11'", SkOperand2::kS32, 1, 0, nullptr }, + { "'2'<'11'", SkOperand2::kS32, 0, 0, nullptr }, testInt(123), testInt(-345), testInt(+678), @@ -1465,7 +1465,7 @@ static const SkScriptNAnswer2 scriptTests[] = { testInt(0||(0&&3)), testInt(0||(1&&3)), testInt(0&&1?2:3) - , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, NULL } + , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, nullptr } }; #define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests) diff --git a/src/animator/SkTDArray_Experimental.h b/src/animator/SkTDArray_Experimental.h index 4b3970fde0..ff693ac39b 100644 --- a/src/animator/SkTDArray_Experimental.h +++ b/src/animator/SkTDArray_Experimental.h @@ -35,8 +35,8 @@ protected: SkDS32Array(const int32_t src[], U16CPU count); SkDS32Array& operator=(const SkDS32Array& src); friend int operator==(const SkDS32Array& a, const SkDS32Array& b); - int32_t* append() { return this->append(1, NULL); } - int32_t* append(U16CPU count, const int32_t* src = NULL); + int32_t* append() { return this->append(1, nullptr); } + int32_t* append(U16CPU count, const int32_t* src = nullptr); int32_t* appendClear() { @@ -65,9 +65,9 @@ public: if (fArray) { sk_free(fArray); - fArray = NULL; + fArray = nullptr; #ifdef SK_DEBUG - fData = NULL; + fData = nullptr; #endif fReserve = fCount = 0; } @@ -104,7 +104,7 @@ protected: template <typename T> class SkTDS32Array : public SkDS32Array { public: - SkTDS32Array() { SkDEBUGCODE(fTData=NULL); SkASSERT(sizeof(T) == sizeof(int32_t)); } + SkTDS32Array() { SkDEBUGCODE(fTData=nullptr); SkASSERT(sizeof(T) == sizeof(int32_t)); } SkTDS32Array(const SkTDS32Array<T>& src) : SkDS32Array(src) {} ~SkTDS32Array() { sk_free(fArray); } T& operator[](int index) const { SYNC(); SkASSERT((unsigned)index < fCount); return ((T*) fArray)[index]; } @@ -114,12 +114,12 @@ public: return operator==((const SkDS32Array&) a, (const SkDS32Array&) b); } T* append() { return (T*) SkDS32Array::append(); } T* appendClear() { return (T*) SkDS32Array::appendClear(); } - T* append(U16CPU count, const T* src = NULL) { return (T*) SkDS32Array::append(count, (const int32_t*) src); } + T* append(U16CPU count, const T* src = nullptr) { return (T*) SkDS32Array::append(count, (const int32_t*) src); } T* begin() const { SYNC(); return (T*) fArray; } - T* end() const { return (T*) (fArray ? fArray + fCount : NULL); } + T* end() const { return (T*) (fArray ? fArray + fCount : nullptr); } int find(const T& elem) const { return SkDS32Array::find((const int32_t&) elem); } - T* insert(U16CPU index) { return this->insert(index, 1, NULL); } - T* insert(U16CPU index, U16CPU count, const T* src = NULL) { + T* insert(U16CPU index) { return this->insert(index, 1, nullptr); } + T* insert(U16CPU index, U16CPU count, const T* src = nullptr) { return (T*) SkDS32Array::insert(index, count, (const int32_t*) src); } int rfind(const T& elem) const { return SkDS32Array::rfind((const int32_t&) elem); } T* push() { return this->append(); } diff --git a/src/animator/SkTextOnPath.cpp b/src/animator/SkTextOnPath.cpp index 7bdb7fd977..864741619b 100644 --- a/src/animator/SkTextOnPath.cpp +++ b/src/animator/SkTextOnPath.cpp @@ -26,7 +26,7 @@ const SkMemberInfo SkTextOnPath::fInfo[] = { DEFINE_GET_MEMBER(SkTextOnPath); -SkTextOnPath::SkTextOnPath() : offset(0), path(NULL), text(NULL) { +SkTextOnPath::SkTextOnPath() : offset(0), path(nullptr), text(nullptr) { } bool SkTextOnPath::draw(SkAnimateMaker& maker) { diff --git a/src/animator/SkTextToPath.cpp b/src/animator/SkTextToPath.cpp index 0c1b0e42e4..d4b525b9af 100644 --- a/src/animator/SkTextToPath.cpp +++ b/src/animator/SkTextToPath.cpp @@ -26,7 +26,7 @@ const SkMemberInfo SkTextToPath::fInfo[] = { DEFINE_GET_MEMBER(SkTextToPath); -SkTextToPath::SkTextToPath() : paint(NULL), path(NULL), text(NULL) { +SkTextToPath::SkTextToPath() : paint(nullptr), path(nullptr), text(nullptr) { } bool SkTextToPath::draw(SkAnimateMaker& maker) { @@ -35,7 +35,7 @@ bool SkTextToPath::draw(SkAnimateMaker& maker) { } void SkTextToPath::onEndElement(SkAnimateMaker& maker) { - if (paint == NULL || path == NULL || text == NULL) { + if (paint == nullptr || path == nullptr || text == nullptr) { // !!! add error message here maker.setErrorCode(SkDisplayXMLParserError::kErrorInAttributeValue); return; diff --git a/src/animator/SkTypedArray.cpp b/src/animator/SkTypedArray.cpp index e94e57dca7..d9e2bc7f73 100644 --- a/src/animator/SkTypedArray.cpp +++ b/src/animator/SkTypedArray.cpp @@ -29,18 +29,18 @@ bool SkTypedArray::getIndex(int index, SkOperand* operand) { SkDS32Array::SkDS32Array() { fReserve = fCount = 0; - fArray = NULL; + fArray = nullptr; #ifdef SK_DEBUG - fData = NULL; + fData = nullptr; #endif } SkDS32Array::SkDS32Array(const SkDS32Array& src) { fReserve = fCount = 0; - fArray = NULL; + fArray = nullptr; #ifdef SK_DEBUG - fData = NULL; + fData = nullptr; #endif SkDS32Array tmp(src.fArray, src.fCount); this->swap(tmp); @@ -51,9 +51,9 @@ SkDS32Array::SkDS32Array(const int32_t src[], U16CPU count) SkASSERT(src || count == 0); fReserve = fCount = 0; - fArray = NULL; + fArray = nullptr; #ifdef SK_DEBUG - fData = NULL; + fData = nullptr; #endif if (count) { @@ -105,7 +105,7 @@ int32_t* SkDS32Array::append(U16CPU count, const int32_t* src) unsigned oldCount = fCount; if (count) { - SkASSERT(src == NULL || fArray == NULL || + SkASSERT(src == nullptr || fArray == nullptr || src + count <= fArray || fArray + count <= src); this->growBy(count); |