Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 5f204c0..5316b49 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -11,14 +11,14 @@
void SkEvent::initialize(const char* type, size_t typeLen,
SkEventSinkID targetID) {
- fType = NULL;
+ fType = nullptr;
setType(type, typeLen);
f32 = 0;
fTargetID = targetID;
- fTargetProc = NULL;
+ fTargetProc = nullptr;
#ifdef SK_DEBUG
fTime = 0;
- fNextEvent = NULL;
+ fNextEvent = nullptr;
#endif
}
@@ -128,7 +128,7 @@
this->setType(name);
const char* value;
- if ((value = dom.findAttr(node, "fast32")) != NULL)
+ if ((value = dom.findAttr(node, "fast32")) != nullptr)
{
int32_t n;
if (SkParse::FindS32(value, &n))
@@ -144,25 +144,25 @@
}
name = dom.findAttr(node, "name");
- if (name == NULL)
+ if (name == nullptr)
{
SkDEBUGCODE(SkDebugf("SkEvent::inflate missing required \"name\" attribute in <data> subelement\n");)
continue;
}
- if ((value = dom.findAttr(node, "s32")) != NULL)
+ if ((value = dom.findAttr(node, "s32")) != nullptr)
{
int32_t n;
if (SkParse::FindS32(value, &n))
this->setS32(name, n);
}
- else if ((value = dom.findAttr(node, "scalar")) != NULL)
+ else if ((value = dom.findAttr(node, "scalar")) != nullptr)
{
SkScalar x;
if (SkParse::FindScalar(value, &x))
this->setScalar(name, x);
}
- else if ((value = dom.findAttr(node, "string")) != NULL)
+ else if ((value = dom.findAttr(node, "string")) != nullptr)
this->setString(name, value);
#ifdef SK_DEBUG
else
@@ -194,7 +194,7 @@
int count;
const char* name;
- while ((name = iter.next(&mtype, &count)) != NULL)
+ while ((name = iter.next(&mtype, &count)) != nullptr)
{
SkASSERT(count > 0);
@@ -209,7 +209,7 @@
break;
case SkMetaData::kScalar_Type:
{
- const SkScalar* values = md.findScalars(name, &count, NULL);
+ const SkScalar* values = md.findScalars(name, &count, nullptr);
SkDebugf("%f", SkScalarToFloat(values[0]));
for (int i = 1; i < count; i++)
SkDebugf(", %f", SkScalarToFloat(values[i]));
@@ -271,9 +271,9 @@
class SkEvent_Globals {
public:
SkEvent_Globals() {
- fEventQHead = NULL;
- fEventQTail = NULL;
- fDelayQHead = NULL;
+ fEventQHead = nullptr;
+ fEventQTail = nullptr;
+ fDelayQHead = nullptr;
SkDEBUGCODE(fEventCounter = 0;)
}
@@ -338,14 +338,14 @@
SkASSERT(evt);
- bool wasEmpty = globals.fEventQHead == NULL;
+ bool wasEmpty = globals.fEventQHead == nullptr;
if (globals.fEventQTail)
globals.fEventQTail->fNextEvent = evt;
globals.fEventQTail = evt;
- if (globals.fEventQHead == NULL)
+ if (globals.fEventQHead == nullptr)
globals.fEventQHead = evt;
- evt->fNextEvent = NULL;
+ evt->fNextEvent = nullptr;
SkDEBUGCODE(++globals.fEventCounter);
@@ -361,8 +361,8 @@
SkDEBUGCODE(--globals.fEventCounter);
globals.fEventQHead = evt->fNextEvent;
- if (globals.fEventQHead == NULL) {
- globals.fEventQTail = NULL;
+ if (globals.fEventQHead == nullptr) {
+ globals.fEventQTail = nullptr;
}
}
globals.fEventMutex.release();
@@ -374,7 +374,7 @@
SkEvent_Globals& globals = getGlobals();
// this is not thread accurate, need a semaphore for that
- return globals.fEventQHead != NULL;
+ return globals.fEventQHead != nullptr;
}
#ifdef SK_TRACE_EVENTS
@@ -386,7 +386,7 @@
// gEventMutex acquired by caller
SkEvent* curr = globals.fDelayQHead;
- SkEvent* prev = NULL;
+ SkEvent* prev = nullptr;
while (curr) {
if (SkMSec_LT(time, curr->fTime)) {
@@ -398,7 +398,7 @@
evt->fTime = time;
evt->fNextEvent = curr;
- if (prev == NULL) {
+ if (prev == nullptr) {
globals.fDelayQHead = evt;
} else {
prev->fNextEvent = evt;
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 282f2b8..003bf8c 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -16,7 +16,7 @@
public:
SkEventSink_Globals() {
fNextSinkID = 0;
- fSinkHead = NULL;
+ fSinkHead = nullptr;
}
SkMutex fSinkMutex;
@@ -30,7 +30,7 @@
return *gGlobals;
}
-SkEventSink::SkEventSink() : fTagHead(NULL) {
+SkEventSink::SkEventSink() : fTagHead(nullptr) {
SkEventSink_Globals& globals = getGlobals();
globals.fSinkMutex.acquire();
@@ -51,7 +51,7 @@
globals.fSinkMutex.acquire();
SkEventSink* sink = globals.fSinkHead;
- SkEventSink* prev = NULL;
+ SkEventSink* prev = nullptr;
for (;;) {
SkEventSink* next = sink->fNextSink;
@@ -89,12 +89,12 @@
///////////////////////////////////////////////////////////////////////////////
SkTagList* SkEventSink::findTagList(U8CPU tag) const {
- return fTagHead ? SkTagList::Find(fTagHead, tag) : NULL;
+ return fTagHead ? SkTagList::Find(fTagHead, tag) : nullptr;
}
void SkEventSink::addTagList(SkTagList* rec) {
SkASSERT(rec);
- SkASSERT(fTagHead == NULL || SkTagList::Find(fTagHead, rec->fTag) == NULL);
+ SkASSERT(fTagHead == nullptr || SkTagList::Find(fTagHead, rec->fTag) == nullptr);
rec->fNext = fTagHead;
fTagHead = rec;
@@ -162,7 +162,7 @@
void SkEventSink::copyListeners(const SkEventSink& sink)
{
SkListenersTagList* sinkList = (SkListenersTagList*)sink.findTagList(kListeners_SkTagList);
- if (sinkList == NULL)
+ if (sinkList == nullptr)
return;
SkASSERT(sinkList->countListners() > 0);
const SkEventSinkID* iter = sinkList->fIDs;
@@ -178,7 +178,7 @@
SkListenersTagList* list = (SkListenersTagList*)this->findTagList(kListeners_SkTagList);
- if (list == NULL)
+ if (list == nullptr)
return;
int index = list->find(id);
@@ -199,7 +199,7 @@
bool SkEventSink::hasListeners() const
{
- return this->findTagList(kListeners_SkTagList) != NULL;
+ return this->findTagList(kListeners_SkTagList) != nullptr;
}
void SkEventSink::postToListeners(const SkEvent& evt, SkMSec delay) {
@@ -246,7 +246,7 @@
return sink;
sink = sink->fNextSink;
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index 8c2e476..ec92a7b 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -28,7 +28,7 @@
if (itemID == fItems[i]->getID())
return fItems[i];
}
- return NULL;
+ return nullptr;
}
void SkOSMenu::getItems(const SkOSMenu::Item* items[]) const {
@@ -155,7 +155,7 @@
SkString str(option);
va_start(args, option);
int count = 1;
- for (const char* arg = va_arg(args, const char*); arg != NULL; arg = va_arg(args, const char*)) {
+ for (const char* arg = va_arg(args, const char*); arg != nullptr; arg = va_arg(args, const char*)) {
str += gDelimiter;
str += arg;
++count;
@@ -206,13 +206,13 @@
bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) {
if (evt.isType(gMenuEventType) && items) {
const char* text = evt.findString(gList_Items_Str);
- if (text != NULL) {
+ if (text != nullptr) {
SkString temp(text);
char* token = strtok((char*)temp.c_str(), gDelimiter);
int index = 0;
- while (token != NULL) {
+ while (token != nullptr) {
items[index].set(token, strlen(token));
- token = strtok (NULL, gDelimiter);
+ token = strtok (nullptr, gDelimiter);
++index;
}
}
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
index 5b44764..1a1b706 100644
--- a/src/views/SkParsePaint.cpp
+++ b/src/views/SkParsePaint.cpp
@@ -13,8 +13,8 @@
static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
{
- if ((node = dom.getFirstChild(node, "shader")) == NULL)
- return NULL;
+ if ((node = dom.getFirstChild(node, "shader")) == nullptr)
+ return nullptr;
const char* str;
@@ -24,9 +24,9 @@
SkPoint pts[2];
colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
- if ((str = dom.findAttr(node, "c0")) != NULL &&
+ if ((str = dom.findAttr(node, "c0")) != nullptr &&
SkParse::FindColor(str, &colors[0]) &&
- (str = dom.findAttr(node, "c1")) != NULL &&
+ (str = dom.findAttr(node, "c1")) != nullptr &&
SkParse::FindColor(str, &colors[1]) &&
dom.findScalars(node, "p0", &pts[0].fX, 2) &&
dom.findScalars(node, "p1", &pts[1].fX, 2))
@@ -36,13 +36,13 @@
if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
mode = (SkShader::TileMode)index;
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, mode);
}
}
else if (dom.hasAttr(node, "type", "bitmap"))
{
- if ((str = dom.findAttr(node, "src")) == NULL)
- return NULL;
+ if ((str = dom.findAttr(node, "src")) == nullptr)
+ return nullptr;
SkBitmap bm;
@@ -57,7 +57,7 @@
return SkShader::CreateBitmapShader(bm, mode, mode);
}
}
- return NULL;
+ return nullptr;
}
void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
diff --git a/src/views/SkProgressView.cpp b/src/views/SkProgressView.cpp
index 03e28eb..7ce022d 100644
--- a/src/views/SkProgressView.cpp
+++ b/src/views/SkProgressView.cpp
@@ -12,11 +12,11 @@
#include "SkInterpolator.h"
#include "SkTime.h"
-SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(NULL), fOffShader(NULL)
+SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(nullptr), fOffShader(nullptr)
{
fValue = 0;
fMax = 0;
- fInterp = NULL;
+ fInterp = nullptr;
fDoInterp = false;
}
@@ -33,7 +33,7 @@
{
fMax = SkToU16(max);
if (fValue > 0)
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -52,7 +52,7 @@
fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
}
fValue = SkToU16(value);
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -69,12 +69,12 @@
if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
{
delete fInterp;
- fInterp = NULL;
+ fInterp = nullptr;
}
percent = (SkFixed)x; // now its 16.8
percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
- this->inval(NULL);
+ this->inval(nullptr);
}
else
{
@@ -112,7 +112,7 @@
return SkImageDecoder::DecodeFile(file, &bm) ?
SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
- NULL;
+ nullptr;
}
void SkProgressView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -121,12 +121,12 @@
const char* s;
- SkASSERT(fOnShader == NULL);
- SkASSERT(fOffShader == NULL);
+ SkASSERT(fOnShader == nullptr);
+ SkASSERT(fOffShader == nullptr);
- if ((s = dom.findAttr(node, "src-on")) != NULL)
+ if ((s = dom.findAttr(node, "src-on")) != nullptr)
fOnShader = inflate_shader(s);
- if ((s = dom.findAttr(node, "src-off")) != NULL)
+ if ((s = dom.findAttr(node, "src-off")) != nullptr)
fOffShader = inflate_shader(s);
(void)dom.findBool(node, "do-interp", &fDoInterp);
}
diff --git a/src/views/SkStackViewLayout.cpp b/src/views/SkStackViewLayout.cpp
index aba6f2e..b0c8c8c 100644
--- a/src/views/SkStackViewLayout.cpp
+++ b/src/views/SkStackViewLayout.cpp
@@ -79,7 +79,7 @@
SkScalar limit = 0;
int n = 0, flex = 0;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
n += 1;
if (child->getFlags() & flexMask)
@@ -145,7 +145,7 @@
}
crossLimit += (parent->*crossGetSizeP)();
if (fAlign != kStretch_Align)
- crossSetSizeP = NULL;
+ crossSetSizeP = nullptr;
int childCount, flexCount;
SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
@@ -164,7 +164,7 @@
if (flexCount > 0 && parentLimit > childLimit)
flexAmount = (parentLimit - childLimit) / flexCount;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
if (fRound)
pos = SkScalarRoundToScalar(pos);
@@ -258,7 +258,7 @@
SkView::B2FIter iter(parent);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
child->setLoc(fMargin.fLeft, fMargin.fTop);
child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
diff --git a/src/views/SkTagList.cpp b/src/views/SkTagList.cpp
index 8ede870..b1d6ff6 100644
--- a/src/views/SkTagList.cpp
+++ b/src/views/SkTagList.cpp
@@ -17,7 +17,7 @@
{
SkASSERT(tag < kSkTagListCount);
- while (rec != NULL)
+ while (rec != nullptr)
{
if (rec->fTag == tag)
break;
@@ -31,9 +31,9 @@
SkASSERT(tag < kSkTagListCount);
SkTagList* rec = *head;
- SkTagList* prev = NULL;
+ SkTagList* prev = nullptr;
- while (rec != NULL)
+ while (rec != nullptr)
{
SkTagList* next = rec->fNext;
diff --git a/src/views/SkTagList.h b/src/views/SkTagList.h
index 47294e3..1cff9ca 100644
--- a/src/views/SkTagList.h
+++ b/src/views/SkTagList.h
@@ -29,7 +29,7 @@
SkTagList(U8CPU tag) : fTag(SkToU8(tag))
{
SkASSERT(tag < kSkTagListCount);
- fNext = NULL;
+ fNext = nullptr;
fExtra16 = 0;
fExtra8 = 0;
}
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index 0070201..249737a 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -14,7 +14,7 @@
{
fWidth = fHeight = 0;
fLoc.set(0, 0);
- fParent = fFirstChild = fNextSibling = fPrevSibling = NULL;
+ fParent = fFirstChild = fNextSibling = fPrevSibling = nullptr;
fMatrix.setIdentity();
fContainsFocus = 0;
}
@@ -31,13 +31,13 @@
uint32_t diff = fFlags ^ flags;
if (diff & kVisible_Mask)
- this->inval(NULL);
+ this->inval(nullptr);
fFlags = SkToU8(flags);
if (diff & kVisible_Mask)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -67,10 +67,10 @@
if (fWidth != width || fHeight != height)
{
- this->inval(NULL);
+ this->inval(nullptr);
fWidth = width;
fHeight = height;
- this->inval(NULL);
+ this->inval(nullptr);
this->onSizeChange();
this->invokeLayout();
}
@@ -80,9 +80,9 @@
{
if (fLoc.fX != x || fLoc.fY != y)
{
- this->inval(NULL);
+ this->inval(nullptr);
fLoc.set(x, y);
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -94,9 +94,9 @@
void SkView::setLocalMatrix(const SkMatrix& matrix)
{
- this->inval(NULL);
+ this->inval(nullptr);
fMatrix = matrix;
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkView::draw(SkCanvas* canvas)
@@ -136,7 +136,7 @@
SkCanvas* childCanvas = this->beforeChildren(canvas);
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
child->draw(childCanvas);
this->afterChildren(canvas);
@@ -165,7 +165,7 @@
}
SkView* parent = view->fParent;
- if (parent == NULL) {
+ if (parent == nullptr) {
return;
}
@@ -185,18 +185,18 @@
do {
if (view->onSetFocusView(fv))
return true;
- } while ((view = view->fParent) != NULL);
+ } while ((view = view->fParent) != nullptr);
return false;
}
SkView* SkView::getFocusView() const
{
- SkView* focus = NULL;
+ SkView* focus = nullptr;
const SkView* view = this;
do {
if (view->onGetFocusView(&focus))
break;
- } while ((view = view->fParent) != NULL);
+ } while ((view = view->fParent) != nullptr);
return focus;
}
@@ -222,30 +222,30 @@
B2FIter iter(this);
SkView* child, *focus;
- while ((child = iter.next()) != NULL)
- if ((focus = child->acceptFocus(dir)) != NULL)
+ while ((child = iter.next()) != nullptr)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
}
else // prev
{
F2BIter iter(this);
SkView* child, *focus;
- while ((child = iter.next()) != NULL)
- if ((focus = child->acceptFocus(dir)) != NULL)
+ while ((child = iter.next()) != nullptr)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
if (this->acceptFocus())
return this;
}
- return NULL;
+ return nullptr;
}
SkView* SkView::moveFocus(FocusDirection dir)
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
{ // start with the root
focus = this;
while (focus->fParent)
@@ -267,19 +267,19 @@
while (child != parent->fFirstChild)
{
FIRST_CHILD:
- if ((focus = child->acceptFocus(dir)) != NULL)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
child = child->fNextSibling;
}
NEXT_SIB:
child = parent->fNextSibling;
parent = parent->fParent;
- } while (parent != NULL);
+ } while (parent != nullptr);
}
else // prevfocus
{
parent = focus->fParent;
- if (parent == NULL) // we're the root
+ if (parent == nullptr) // we're the root
return focus->acceptFocus(dir);
else
{
@@ -289,7 +289,7 @@
while (child != parent->fFirstChild)
{
child = child->fPrevSibling;
- if ((focus = child->acceptFocus(dir)) != NULL)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
}
if (parent->acceptFocus())
@@ -300,12 +300,12 @@
}
}
}
- return NULL;
+ return nullptr;
}
void SkView::onFocusChange(bool gainFocusP)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
////////////////////////////////////////////////////////////////////////////
@@ -314,9 +314,9 @@
{
SkASSERT(target);
fTargetID = target->getSinkID();
- fType = NULL;
+ fType = nullptr;
fWeOwnTheType = false;
- fOwner = NULL;
+ fOwner = nullptr;
}
SkView::Click::~Click()
@@ -331,7 +331,7 @@
sk_free(fType);
fWeOwnTheType = false;
}
- fType = NULL;
+ fType = nullptr;
}
bool SkView::Click::isType(const char type[]) const
@@ -341,9 +341,9 @@
if (type == t)
return true;
- if (type == NULL)
+ if (type == nullptr)
type = "";
- if (t == NULL)
+ if (t == nullptr)
t = "";
return !strcmp(t, type);
}
@@ -371,14 +371,14 @@
SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y, unsigned modi) {
if (x < 0 || y < 0 || x >= fWidth || y >= fHeight) {
- return NULL;
+ return nullptr;
}
if (this->onSendClickToChildren(x, y, modi)) {
F2BIter iter(this);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
SkPoint p;
if (!child->globalToLocal(x, y, &p)) {
@@ -401,7 +401,7 @@
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -425,7 +425,7 @@
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -449,7 +449,7 @@
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -493,7 +493,7 @@
}
SkView::Click* SkView::onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) {
- return NULL;
+ return nullptr;
}
bool SkView::onClick(Click*) {
@@ -517,17 +517,17 @@
void SkView::detachFromParent_NoLayout() {
this->validate();
- if (fParent == NULL) {
+ if (fParent == nullptr) {
return;
}
if (fContainsFocus) {
- (void)this->setFocusView(NULL);
+ (void)this->setFocusView(nullptr);
}
- this->inval(NULL);
+ this->inval(nullptr);
- SkView* next = NULL;
+ SkView* next = nullptr;
if (fNextSibling != this) { // do we have any siblings
fNextSibling->fPrevSibling = fPrevSibling;
@@ -539,7 +539,7 @@
fParent->fFirstChild = next;
}
- fParent = fNextSibling = fPrevSibling = NULL;
+ fParent = fNextSibling = fPrevSibling = nullptr;
this->validate();
this->unref();
@@ -559,13 +559,13 @@
this->validate();
SkASSERT(child != this);
- if (child == NULL || fFirstChild == child)
+ if (child == nullptr || fFirstChild == child)
goto DONE;
child->ref();
child->detachFromParent_NoLayout();
- if (fFirstChild == NULL) {
+ if (fFirstChild == nullptr) {
child->fNextSibling = child;
child->fPrevSibling = child;
} else {
@@ -577,7 +577,7 @@
fFirstChild = child;
child->fParent = this;
- child->inval(NULL);
+ child->inval(nullptr);
this->validate();
this->invokeLayout();
@@ -589,13 +589,13 @@
this->validate();
SkASSERT(child != this);
- if (child == NULL || (fFirstChild && fFirstChild->fPrevSibling == child))
+ if (child == nullptr || (fFirstChild && fFirstChild->fPrevSibling == child))
goto DONE;
child->ref();
child->detachFromParent_NoLayout();
- if (fFirstChild == NULL) {
+ if (fFirstChild == nullptr) {
fFirstChild = child;
child->fNextSibling = child;
child->fPrevSibling = child;
@@ -607,7 +607,7 @@
}
child->fParent = this;
- child->inval(NULL);
+ child->inval(nullptr);
this->validate();
this->invokeLayout();
@@ -699,7 +699,7 @@
B2FIter iter(this);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
child->postInflate(dict);
}
@@ -714,7 +714,7 @@
}
parent = parent->fParent;
}
- return NULL;
+ return nullptr;
}
SkView* SkView::sendQueryToParents(SkEvent* evt) {
@@ -726,15 +726,15 @@
}
parent = parent->fParent;
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
SkView::F2BIter::F2BIter(const SkView* parent) {
- fFirstChild = parent ? parent->fFirstChild : NULL;
- fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
+ fFirstChild = parent ? parent->fFirstChild : nullptr;
+ fChild = fFirstChild ? fFirstChild->fPrevSibling : nullptr;
}
SkView* SkView::F2BIter::next() {
@@ -742,7 +742,7 @@
if (fChild) {
if (fChild == fFirstChild) {
- fChild = NULL;
+ fChild = nullptr;
} else {
fChild = fChild->fPrevSibling;
}
@@ -751,7 +751,7 @@
}
SkView::B2FIter::B2FIter(const SkView* parent) {
- fFirstChild = parent ? parent->fFirstChild : NULL;
+ fFirstChild = parent ? parent->fFirstChild : nullptr;
fChild = fFirstChild;
}
@@ -761,7 +761,7 @@
if (fChild) {
SkView* next = fChild->fNextSibling;
if (next == fFirstChild)
- next = NULL;
+ next = nullptr;
fChild = next;
}
return curr;
@@ -778,8 +778,8 @@
SkASSERT(fNextSibling);
SkASSERT(fPrevSibling);
} else {
- bool nextNull = NULL == fNextSibling;
- bool prevNull = NULL == fNextSibling;
+ bool nextNull = nullptr == fNextSibling;
+ bool prevNull = nullptr == fNextSibling;
SkASSERT(nextNull == prevNull);
}
}
@@ -812,7 +812,7 @@
SkView* child;
bool noChildren = true;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
if (noChildren)
SkDebugf(">\n");
diff --git a/src/views/SkViewInflate.cpp b/src/views/SkViewInflate.cpp
index 59cc481..8418fb0 100644
--- a/src/views/SkViewInflate.cpp
+++ b/src/views/SkViewInflate.cpp
@@ -37,10 +37,10 @@
const char* name = dom.getName(child);
const char* target;
- if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
+ if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != nullptr)
this->addIDStr(&fListenTo, parent, target);
- if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
+ if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != nullptr)
this->addIDStr(&fBroadcastTo, parent, target);
}
child = dom.getNextSibling(child);
@@ -62,13 +62,13 @@
{
fIDs.reset();
- if (root == NULL)
+ if (root == nullptr)
{
root = this->createView(dom, node);
- if (root == NULL)
+ if (root == nullptr)
{
- printf("createView returned NULL on <%s>\n", dom.getName(node));
- return NULL;
+ printf("createView returned nullptr on <%s>\n", dom.getName(node));
+ return nullptr;
}
}
this->rInflate(dom, node, root);
@@ -103,21 +103,21 @@
SkDOM dom;
const SkDOM::Node* node = dom.build(xml, len);
- return node ? this->inflate(dom, node, root) : NULL;
+ return node ? this->inflate(dom, node, root) : nullptr;
}
SkView* SkViewInflate::findViewByID(const char id[]) const
{
SkASSERT(id);
SkView* view;
- return fIDs.find(id, &view) ? view : NULL;
+ return fIDs.find(id, &view) ? view : nullptr;
}
SkView* SkViewInflate::createView(const SkDOM& dom, const SkDOM::Node* node)
{
if (!strcmp(dom.getName(node), "view"))
return new SkView;
- return NULL;
+ return nullptr;
}
void SkViewInflate::addIDStr(SkTDArray<IDStr>* list, SkView* view, const char* str)
diff --git a/src/views/SkViewPriv.cpp b/src/views/SkViewPriv.cpp
index 6d90814..03541fd 100644
--- a/src/views/SkViewPriv.cpp
+++ b/src/views/SkViewPriv.cpp
@@ -29,14 +29,14 @@
SkView::Artist* SkView::getArtist() const
{
Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
- SkASSERT(rec == NULL || rec->fArtist != NULL);
+ SkASSERT(rec == nullptr || rec->fArtist != nullptr);
- return rec ? rec->fArtist : NULL;
+ return rec ? rec->fArtist : nullptr;
}
SkView::Artist* SkView::setArtist(Artist* obj)
{
- if (obj == NULL)
+ if (obj == nullptr)
{
this->removeTagList(kViewArtist_SkTagList);
}
@@ -75,14 +75,14 @@
SkView::Layout* SkView::getLayout() const
{
Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
- SkASSERT(rec == NULL || rec->fLayout != NULL);
+ SkASSERT(rec == nullptr || rec->fLayout != nullptr);
- return rec ? rec->fLayout : NULL;
+ return rec ? rec->fLayout : nullptr;
}
SkView::Layout* SkView::setLayout(Layout* obj, bool invokeLayoutNow)
{
- if (obj == NULL)
+ if (obj == nullptr)
{
this->removeTagList(kViewLayout_SkTagList);
}
diff --git a/src/views/SkWidgets.cpp b/src/views/SkWidgets.cpp
index cde2b42..fc0ffb8 100644
--- a/src/views/SkWidgets.cpp
+++ b/src/views/SkWidgets.cpp
@@ -72,7 +72,7 @@
if (!fAnimators[i]->decodeURI(path.c_str()))
{
delete fAnimators[i];
- fAnimators[i] = NULL;
+ fAnimators[i] = nullptr;
}
}
}
@@ -88,11 +88,11 @@
static SkAnimator* get_skin_animator(SkinType st)
{
#if 0
- if (gSkinSuite == NULL)
+ if (gSkinSuite == nullptr)
gSkinSuite = new SkinSuite;
return gSkinSuite->get(st);
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -109,7 +109,7 @@
void SkWidget::onEnabledChange()
{
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkWidget::postWidgetEvent()
@@ -130,7 +130,7 @@
{
this->INHERITED::onInflate(dom, node);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
+ if ((node = dom.getFirstChild(node, "event")) != nullptr)
fEvent.inflate(dom, node);
}
@@ -196,7 +196,7 @@
void SkButtonWidget::onButtonStateChange()
{
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkButtonWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -293,7 +293,7 @@
p.setColor(SK_ColorBLUE);
create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
- p.setMaskFilter(NULL);
+ p.setMaskFilter(nullptr);
p.setTextAlign(SkPaint::kCenter_Align);
@@ -351,7 +351,7 @@
{
if (fMode == kAutoWidth_Mode)
{
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), nullptr, nullptr);
this->setWidth(width + fMargin.fX * 2);
}
else if (fMode == kAutoHeight_Mode)
@@ -360,7 +360,7 @@
int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
SkScalar before, after;
- (void)fPaint.measureText(0, NULL, &before, &after);
+ (void)fPaint.measureText(0, nullptr, &before, &after);
this->setHeight(lines * (after - before) + fMargin.fY * 2);
}
@@ -380,7 +380,7 @@
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
@@ -395,7 +395,7 @@
{
fMargin.set(dx, dy);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -429,7 +429,7 @@
{
fText.set(text, len);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -445,7 +445,7 @@
{
fPaint = paint;
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -489,7 +489,7 @@
if (text)
this->setText(text);
- if ((node = dom.getFirstChild(node, "paint")) != NULL)
+ if ((node = dom.getFirstChild(node, "paint")) != nullptr)
SkPaint_Inflate(&fPaint, dom, node);
}
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 9eef023..9234ac1 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -16,7 +16,7 @@
SkWindow::SkWindow()
: fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
- , fFocusView(NULL)
+ , fFocusView(nullptr)
{
fClicks.reset();
fWaitingOnInval = false;
@@ -37,7 +37,7 @@
void SkWindow::setMatrix(const SkMatrix& matrix) {
if (fMatrix != matrix) {
fMatrix = matrix;
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -67,7 +67,7 @@
ct, kPremul_SkAlphaType));
this->setSize(SkIntToScalar(width), SkIntToScalar(height));
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -146,7 +146,7 @@
return true;
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
SkEvent evt(SK_EventType_Unichar);
@@ -164,7 +164,7 @@
// send an event to the focus-view
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
SkEvent evt(SK_EventType_Key);
@@ -174,8 +174,8 @@
}
if (key == kUp_SkKey || key == kDown_SkKey) {
- if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
- this->onSetFocusView(NULL);
+ if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == nullptr)
+ this->onSetFocusView(nullptr);
return true;
}
return false;
@@ -191,7 +191,7 @@
//send an event to the focus-view
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
//should this one be the same?
@@ -209,7 +209,7 @@
}
void SkWindow::setTitle(const char title[]) {
- if (NULL == title) {
+ if (nullptr == title) {
title = "";
}
fTitle.set(title);
diff --git a/src/views/animated/SkBorderView.cpp b/src/views/animated/SkBorderView.cpp
index 3eff605..88bff69 100644
--- a/src/views/animated/SkBorderView.cpp
+++ b/src/views/animated/SkBorderView.cpp
@@ -52,7 +52,7 @@
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -65,7 +65,7 @@
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkImageView.cpp b/src/views/animated/SkImageView.cpp
index 2956729..04b8258 100644
--- a/src/views/animated/SkImageView.cpp
+++ b/src/views/animated/SkImageView.cpp
@@ -16,10 +16,10 @@
SkImageView::SkImageView()
{
- fMatrix = NULL;
+ fMatrix = nullptr;
fScaleType = kMatrix_ScaleType;
- fData.fAnim = NULL; // handles initializing the other union values
+ fData.fAnim = nullptr; // handles initializing the other union values
fDataIsAnim = true;
fUriIsValid = false; // an empty string is not valid
@@ -65,7 +65,7 @@
{
fScaleType = SkToU8(st);
if (fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -92,7 +92,7 @@
if (matrix && !matrix->isIdentity())
{
- if (fMatrix == NULL)
+ if (fMatrix == nullptr)
fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
*fMatrix = *matrix;
changed = true;
@@ -103,14 +103,14 @@
{
SkASSERT(!fMatrix->isIdentity());
sk_free(fMatrix);
- fMatrix = NULL;
+ fMatrix = nullptr;
changed = true;
}
}
// only redraw if we changed our matrix and we're not in scaleToFit mode
if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -120,7 +120,7 @@
if (evt.isType(SK_EventType_Inval))
{
if (fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return this->INHERITED::onEvent(evt);
@@ -174,7 +174,7 @@
SkDEBUGF(("SkImageView : now = %X[%12.3f], diff = %d\n", now, now/1000., diff));
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -207,7 +207,7 @@
void SkImageView::onUriChange()
{
if (this->freeData())
- this->inval(NULL);
+ this->inval(nullptr);
fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
}
@@ -220,7 +220,7 @@
else
delete fData.fBitmap;
- fData.fAnim = NULL; // valid for all union values
+ fData.fAnim = nullptr; // valid for all union values
return true;
}
return false;
diff --git a/src/views/animated/SkProgressBarView.cpp b/src/views/animated/SkProgressBarView.cpp
index e7754eb..5ce944f 100644
--- a/src/views/animated/SkProgressBarView.cpp
+++ b/src/views/animated/SkProgressBarView.cpp
@@ -35,7 +35,7 @@
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -48,7 +48,7 @@
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkScrollBarView.cpp b/src/views/animated/SkScrollBarView.cpp
index d78cafa..9ba523e 100644
--- a/src/views/animated/SkScrollBarView.cpp
+++ b/src/views/animated/SkScrollBarView.cpp
@@ -89,7 +89,7 @@
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -102,7 +102,7 @@
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp
index 0e4cad6..4bec510 100644
--- a/src/views/animated/SkStaticTextView.cpp
+++ b/src/views/animated/SkStaticTextView.cpp
@@ -62,7 +62,7 @@
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
@@ -77,7 +77,7 @@
{
fMargin.set(dx, dy);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -102,7 +102,7 @@
void SkStaticTextView::setText(const char text[])
{
- if (text == NULL)
+ if (text == nullptr)
text = "";
this->setText(text, strlen(text));
}
@@ -113,7 +113,7 @@
{
fText.set(text, len);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -129,7 +129,7 @@
{
fPaint = paint;
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -178,8 +178,8 @@
this->setText(text);
}
- if ((node = dom.getFirstChild(node, "paint")) != NULL &&
- (node = dom.getFirstChild(node, "screenplay")) != NULL)
+ if ((node = dom.getFirstChild(node, "paint")) != nullptr &&
+ (node = dom.getFirstChild(node, "screenplay")) != nullptr)
{
// FIXME: Including inflate_paint causes Windows build to fail -- it complains
// that SKListView::SkListView is undefined.
diff --git a/src/views/animated/SkWidgetViews.cpp b/src/views/animated/SkWidgetViews.cpp
index cd22678..9d3c936 100644
--- a/src/views/animated/SkWidgetViews.cpp
+++ b/src/views/animated/SkWidgetViews.cpp
@@ -110,7 +110,7 @@
void SkWidgetView::setLabel(const char label[], size_t len)
{
- if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
+ if ((label == nullptr && fLabel.size() != 0) || !fLabel.equals(label, len))
{
SkString tmp(label, len);
@@ -153,13 +153,13 @@
if (label)
this->setLabel(label);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
+ if ((node = dom.getFirstChild(node, "event")) != nullptr)
fEvent.inflate(dom, node);
}
/*virtual*/ void SkWidgetView::onLabelChange(const char oldLabel[], const char newLabel[])
{
- this->inval(NULL);
+ this->inval(nullptr);
}
static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot";
@@ -208,7 +208,7 @@
/*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
/*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -296,7 +296,7 @@
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -309,7 +309,7 @@
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
@@ -346,8 +346,8 @@
SkView* SkWidgetFactory(const char name[])
{
- if (name == NULL)
- return NULL;
+ if (name == nullptr)
+ return nullptr;
// must be in the same order as the SkSkinWidgetEnum is declared
static const char* gNames[] = {
@@ -365,7 +365,7 @@
if (!strcmp(gNames[i], name))
return SkWidgetFactory((SkWidgetEnum)i);
- return NULL;
+ return nullptr;
}
#include "SkImageView.h"
@@ -394,5 +394,5 @@
SkDEBUGFAIL("unknown enum passed to SkWidgetFactory");
break;
}
- return NULL;
+ return nullptr;
}
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index 27783d4..1954015 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -17,8 +17,8 @@
evt.type = SDL_USEREVENT;
evt.user.type = SDL_USEREVENT;
evt.user.code = 0;
- evt.user.data1 = NULL;
- evt.user.data2 = NULL;
+ evt.user.data1 = nullptr;
+ evt.user.data2 = nullptr;
SDL_PushEvent(&evt);
}
@@ -52,11 +52,11 @@
uint32_t amask = SK_A32_MASK << SK_A32_SHIFT;
if (fScreen->flags & SDL_OPENGL) {
- fSurface = NULL;
+ fSurface = nullptr;
fGLCanvas = new SkGLCanvas;
fGLCanvas->setViewport(fScreen->w, fScreen->h);
} else {
- fGLCanvas = NULL;
+ fGLCanvas = nullptr;
fSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, fScreen->w, fScreen->h,
32, rmask, gmask, bmask, amask);
}
@@ -102,7 +102,7 @@
SDL_UnlockSurface(fSurface);
}
- int result = SDL_BlitSurface(fSurface, NULL, fScreen, NULL);
+ int result = SDL_BlitSurface(fSurface, nullptr, fScreen, nullptr);
if (result) {
SkDebugf("------- SDL_BlitSurface returned %d\n", result);
}
@@ -200,7 +200,7 @@
}
void SkOSWindow::onSetTitle(const char title[]) {
- SDL_WM_SetCaption(title, NULL);
+ SDL_WM_SetCaption(title, nullptr);
}
void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) {}
@@ -220,7 +220,7 @@
void SkEvent::SignalQueueTimer(SkMSec delay)
{
- SDL_SetTimer(0, NULL);
+ SDL_SetTimer(0, nullptr);
if (delay) {
SDL_SetTimer(delay, timer_callback);
}
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 79fd011..4d4b628 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -33,11 +33,11 @@
|ExposureMask|PointerMotionMask|KeyPressMask|KeyReleaseMask;
SkOSWindow::SkOSWindow(void*)
- : fVi(NULL)
+ : fVi(nullptr)
, fMSAASampleCount(0) {
- fUnixWindow.fDisplay = NULL;
- fUnixWindow.fGLContext = NULL;
- this->initWindow(0, NULL);
+ fUnixWindow.fDisplay = nullptr;
+ fUnixWindow.fGLContext = nullptr;
+ this->initWindow(0, nullptr);
this->resize(WIDTH, HEIGHT);
}
@@ -50,11 +50,11 @@
this->detach();
SkASSERT(fUnixWindow.fGc);
XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc);
- fUnixWindow.fGc = NULL;
+ fUnixWindow.fGc = nullptr;
XDestroyWindow(fUnixWindow.fDisplay, fUnixWindow.fWin);
- fVi = NULL;
+ fVi = nullptr;
XCloseDisplay(fUnixWindow.fDisplay);
- fUnixWindow.fDisplay = NULL;
+ fUnixWindow.fDisplay = nullptr;
fMSAASampleCount = 0;
}
}
@@ -76,9 +76,9 @@
}
return;
}
- fUnixWindow.fDisplay = XOpenDisplay(NULL);
+ fUnixWindow.fDisplay = XOpenDisplay(nullptr);
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
SkDebugf("Could not open an X Display");
return;
}
@@ -90,7 +90,7 @@
GLX_STENCIL_SIZE, 8,
None
};
- SkASSERT(NULL == fVi);
+ SkASSERT(nullptr == fVi);
if (requestedMSAASampleCount > 0) {
static const GLint kAttCount = SK_ARRAY_COUNT(att);
GLint msaaAtt[kAttCount + 4];
@@ -104,7 +104,7 @@
fVi = glXChooseVisual(dsp, DefaultScreen(dsp), msaaAtt);
fMSAASampleCount = requestedMSAASampleCount;
}
- if (NULL == fVi) {
+ if (nullptr == fVi) {
fVi = glXChooseVisual(dsp, DefaultScreen(dsp), att);
fMSAASampleCount = 0;
}
@@ -146,7 +146,7 @@
0); // background value
}
this->mapWindowAndWait();
- fUnixWindow.fGc = XCreateGC(dsp, fUnixWindow.fWin, 0, NULL);
+ fUnixWindow.fGc = XCreateGC(dsp, fUnixWindow.fWin, 0, nullptr);
}
static unsigned getModi(const XEvent& evt) {
@@ -190,7 +190,7 @@
tv.tv_sec = ms / 1000; // seconds
tv.tv_usec = (ms % 1000) * 1000; // microseconds
- if (!select(x11_fd + 1, &input_fds, NULL, NULL, &tv)) {
+ if (!select(x11_fd + 1, &input_fds, nullptr, nullptr, &tv)) {
if (!XPending(dsp)) {
return false;
}
@@ -222,16 +222,16 @@
case ButtonPress:
if (evt.xbutton.button == Button1)
this->handleClick(evt.xbutton.x, evt.xbutton.y,
- SkView::Click::kDown_State, NULL, getModi(evt));
+ SkView::Click::kDown_State, nullptr, getModi(evt));
break;
case ButtonRelease:
if (evt.xbutton.button == Button1)
this->handleClick(evt.xbutton.x, evt.xbutton.y,
- SkView::Click::kUp_State, NULL, getModi(evt));
+ SkView::Click::kUp_State, nullptr, getModi(evt));
break;
case MotionNotify:
this->handleClick(evt.xmotion.x, evt.xmotion.y,
- SkView::Click::kMoved_State, NULL, getModi(evt));
+ SkView::Click::kMoved_State, nullptr, getModi(evt));
break;
case KeyPress: {
int shiftLevel = (evt.xkey.state & ShiftMask) ? 1 : 0;
@@ -264,7 +264,7 @@
void SkOSWindow::loop() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return;
}
Window win = fUnixWindow.fWin;
@@ -298,7 +298,7 @@
case kPaintRequest_NextXEventResult:
sentExposeEvent = false;
if (this->isDirty()) {
- this->update(NULL);
+ this->update(nullptr);
}
this->doPaint();
break;
@@ -352,17 +352,17 @@
bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* info) {
this->initWindow(msaaSampleCount, info);
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return false;
}
- if (NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fGLContext) {
SkASSERT(fVi);
fUnixWindow.fGLContext = glXCreateContext(fUnixWindow.fDisplay,
fVi,
- NULL,
+ nullptr,
GL_TRUE);
- if (NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fGLContext) {
return false;
}
}
@@ -379,12 +379,12 @@
}
void SkOSWindow::detach() {
- if (NULL == fUnixWindow.fDisplay || NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fDisplay || nullptr == fUnixWindow.fGLContext) {
return;
}
- glXMakeCurrent(fUnixWindow.fDisplay, None, NULL);
+ glXMakeCurrent(fUnixWindow.fDisplay, None, nullptr);
glXDestroyContext(fUnixWindow.fDisplay, fUnixWindow.fGLContext);
- fUnixWindow.fGLContext = NULL;
+ fUnixWindow.fGLContext = nullptr;
}
void SkOSWindow::present() {
@@ -394,7 +394,7 @@
}
void SkOSWindow::onSetTitle(const char title[]) {
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return;
}
XTextProperty textProp;
@@ -424,7 +424,7 @@
}
void SkOSWindow::doPaint() {
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return;
}
// If we are drawing with GL, we don't need XPutImage.
@@ -458,7 +458,7 @@
bool SkOSWindow::makeFullscreen() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return false;
}
@@ -490,7 +490,7 @@
void SkOSWindow::closeWindow() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return;
}
diff --git a/src/views/unix/skia_unix.cpp b/src/views/unix/skia_unix.cpp
index 03a2915..58cc040 100644
--- a/src/views/unix/skia_unix.cpp
+++ b/src/views/unix/skia_unix.cpp
@@ -10,7 +10,7 @@
#include "SkWindow.h"
int main(int argc, char** argv){
- SkOSWindow* window = create_sk_window(NULL, argc, argv);
+ SkOSWindow* window = create_sk_window(nullptr, argc, argv);
// drain any events that occurred before |window| was assigned.
while (SkEvent::ProcessEvent());