From 1599a4332adfd0421e38d4bafafbeac0e6f86fc1 Mon Sep 17 00:00:00 2001 From: "deanm@chromium.org" Date: Thu, 4 Jun 2009 15:37:11 +0000 Subject: [PATCH] Replace nil -> NULL in the views code. Review URL: http://codereview.appspot.com/67139 git-svn-id: http://skia.googlecode.com/svn/trunk@200 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/views/SkBorderView.cpp | 4 +- src/views/SkImageView.cpp | 20 ++++----- src/views/SkListView.cpp | 72 ++++++++++++++++----------------- src/views/SkListWidget.cpp | 32 +++++++-------- src/views/SkOSSound.cpp | 18 ++++----- src/views/SkParsePaint.cpp | 16 ++++---- src/views/SkProgressBarView.cpp | 4 +- src/views/SkWidget.cpp | 20 ++++----- src/views/SkWidgetViews.cpp | 34 ++++++++-------- src/views/SkWidgets.cpp | 28 ++++++------- 10 files changed, 124 insertions(+), 124 deletions(-) diff --git a/src/views/SkBorderView.cpp b/src/views/SkBorderView.cpp index 3356782326..3a9c4492b7 100644 --- a/src/views/SkBorderView.cpp +++ b/src/views/SkBorderView.cpp @@ -43,7 +43,7 @@ void SkBorderView::setSkin(const char skin[]) SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs()); if (diff == SkAnimator::kDifferent) - this->inval(nil); + this->inval(NULL); else if (diff == SkAnimator::kPartiallyDifferent) { SkRect bounds; @@ -56,7 +56,7 @@ void SkBorderView::setSkin(const char skin[]) { if (evt.isType(SK_EventType_Inval)) { - this->inval(nil); + this->inval(NULL); return true; } if (evt.isType("recommendDim")) diff --git a/src/views/SkImageView.cpp b/src/views/SkImageView.cpp index f19e913789..9c358c7e26 100644 --- a/src/views/SkImageView.cpp +++ b/src/views/SkImageView.cpp @@ -9,10 +9,10 @@ SkImageView::SkImageView() { - fMatrix = nil; + fMatrix = NULL; fScaleType = kMatrix_ScaleType; - fData.fAnim = nil; // handles initializing the other union values + fData.fAnim = NULL; // handles initializing the other union values fDataIsAnim = true; fUriIsValid = false; // an empty string is not valid @@ -58,7 +58,7 @@ void SkImageView::setScaleType(ScaleType st) { fScaleType = SkToU8(st); if (fUriIsValid) - this->inval(nil); + this->inval(NULL); } } @@ -85,7 +85,7 @@ void SkImageView::setImageMatrix(const SkMatrix* matrix) if (matrix && !matrix->isIdentity()) { - if (fMatrix == nil) + if (fMatrix == NULL) fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix)); *fMatrix = *matrix; changed = true; @@ -96,14 +96,14 @@ void SkImageView::setImageMatrix(const SkMatrix* matrix) { SkASSERT(!fMatrix->isIdentity()); sk_free(fMatrix); - fMatrix = nil; + fMatrix = NULL; 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(nil); + this->inval(NULL); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ bool SkImageView::onEvent(const SkEvent& evt) if (evt.isType(SK_EventType_Inval)) { if (fUriIsValid) - this->inval(nil); + this->inval(NULL); return true; } return this->INHERITED::onEvent(evt); @@ -167,7 +167,7 @@ void SkImageView::onDraw(SkCanvas* canvas) SkDEBUGF(("SkImageView : now = %X[%12.3f], diff = %d\n", now, now/1000., diff)); if (diff == SkAnimator::kDifferent) - this->inval(nil); + this->inval(NULL); else if (diff == SkAnimator::kPartiallyDifferent) { SkRect bounds; @@ -200,7 +200,7 @@ void SkImageView::onInflate(const SkDOM& dom, const SkDOMNode* node) void SkImageView::onUriChange() { if (this->freeData()) - this->inval(nil); + this->inval(NULL); fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri } @@ -213,7 +213,7 @@ bool SkImageView::freeData() else delete fData.fBitmap; - fData.fAnim = nil; // valid for all union values + fData.fAnim = NULL; // valid for all union values return true; } return false; diff --git a/src/views/SkListView.cpp b/src/views/SkListView.cpp index 27218a9d67..ba4f02afc9 100644 --- a/src/views/SkListView.cpp +++ b/src/views/SkListView.cpp @@ -9,7 +9,7 @@ SkEvent* SkListSource::getEvent(int index) { - return nil; + return NULL; } #include "SkOSFile.h" @@ -27,7 +27,7 @@ public: { fCount = 0; fIter.reset(fPath.c_str(), fSuffix.c_str()); - while (fIter.next(nil)) + while (fIter.next(NULL)) fCount += 1; fIter.reset(fPath.c_str(), fSuffix.c_str()); fIndex = 0; @@ -47,7 +47,7 @@ public: while (fIndex < index) { - fIter.next(nil); + fIter.next(NULL); fIndex += 1; } @@ -73,7 +73,7 @@ public: SkEvent* evt = new SkEvent(); SkString label; - this->getRow(index, &label, nil); + this->getRow(index, &label, NULL); evt->setString("name", label.c_str()); int c = fPath.c_str()[fPath.size() - 1]; @@ -129,7 +129,7 @@ public: } fCount = count; - fList = nil; + fList = NULL; if (count) { ItemRec* rec = fList = new ItemRec[count]; @@ -183,7 +183,7 @@ public: if (fList[index].fType == kToggle_Type) fList[index].fTail.swap(fList[index].fAltTail); - return nil; + return NULL; } private: @@ -202,12 +202,12 @@ SkListSource* SkListSource::CreateFromDOM(const SkDOM& dom, const SkDOM::Node* n SkListView::SkListView(U32 flags) : SkWidgetView(flags) { - fSource = nil; + fSource = NULL; fScrollIndex = 0; fCurrIndex = -1; fRowHeight = SkIntToScalar(16); fVisibleRowCount = 0; - fStrCache = nil; + fStrCache = NULL; fPaint[kBG_Attr].setColor(0); fPaint[kNormalText_Attr].setTextSize(SkIntToScalar(14)); @@ -229,7 +229,7 @@ void SkListView::setRowHeight(SkScalar height) if (fRowHeight != height) { fRowHeight = height; - this->inval(nil); + this->inval(NULL); this->onSizeChange(); } } @@ -287,7 +287,7 @@ void SkListView::invalSelection() void SkListView::ensureSelectionIsVisible() { - if (fSource == nil) + if (fSource == NULL) return; if ((unsigned)fCurrIndex < (unsigned)fSource->countRows()) @@ -303,7 +303,7 @@ void SkListView::ensureSelectionIsVisible() SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows()); this->dirtyStrCache(); - this->inval(nil); + this->inval(NULL); } } } @@ -339,7 +339,7 @@ SkListSource* SkListView::setListSource(SkListSource* src) SkRefCnt_SafeAssign(fSource, src); this->dirtyStrCache(); this->ensureSelectionIsVisible(); - this->inval(nil); + this->inval(NULL); } return src; } @@ -373,7 +373,7 @@ void SkListView::onDraw(SkCanvas* canvas) { SkScalar ascent, descent; - fPaint[kNormalText_Attr].measureText(0, nil, &ascent, &descent); + fPaint[kNormalText_Attr].measureText(0, NULL, &ascent, &descent); y = SkScalarHalf(fRowHeight - descent + ascent) - ascent; } @@ -414,13 +414,13 @@ void SkListView::dirtyStrCache() if (fStrCache) { delete[] fStrCache; - fStrCache = nil; + fStrCache = NULL; } } void SkListView::ensureStrCache(int count) { - if (fStrCache == nil) + if (fStrCache == NULL) { fStrCache = new SkString[count << 1]; @@ -450,12 +450,12 @@ bool SkListView::onEvent(const SkEvent& evt) { SkView* view = this->sendEventToParents(*evt); delete evt; - return view != nil; + return view != NULL; } else // hack to make toggle work { this->dirtyStrCache(); - this->inval(nil); + this->inval(NULL); } } break; @@ -474,14 +474,14 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node) if (dom.findScalar(node, "row-height", &x)) this->setRowHeight(x); - if ((child = dom.getFirstChild(node, "hilite-paint")) != nil) + if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL) SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child); // look for a listsource { - SkListSource* src = nil; + SkListSource* src = NULL; - if ((child = dom.getFirstChild(node, "file-listsource")) != nil) + if ((child = dom.getFirstChild(node, "file-listsource")) != NULL) { const char* path = dom.findAttr(child, "path"); if (path) @@ -489,7 +489,7 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node) dom.findAttr(child, "filter"), dom.findAttr(child, "target")); } - else if ((child = dom.getFirstChild(node, "xml-listsource")) != nil) + else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL) { src = SkListSource::CreateFromDOM(dom, child); } @@ -526,7 +526,7 @@ public: protected: virtual void onDraw(SkCanvas* canvas) { - if (fBGRef == nil) return; + if (fBGRef == NULL) return; SkPaint paint; @@ -541,7 +541,7 @@ private: SkGridView::SkGridView(U32 flags) : SkWidgetView(flags) { - fSource = nil; + fSource = NULL; fCurrIndex = -1; fVisibleCount.set(0, 0); @@ -574,7 +574,7 @@ void SkGridView::setCellSize(SkScalar x, SkScalar y) if (!fCellSize.equals(x, y)) { fCellSize.set(x, y); - this->inval(nil); + this->inval(NULL); } } @@ -640,7 +640,7 @@ void SkGridView::invalSelection() void SkGridView::ensureSelectionIsVisible() { - if (fSource == nil) + if (fSource == NULL) return; #if 0 if ((unsigned)fCurrIndex < (unsigned)fSource->countRows()) @@ -656,7 +656,7 @@ void SkGridView::ensureSelectionIsVisible() SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows()); this->dirtyStrCache(); - this->inval(nil); + this->inval(NULL); } } #endif @@ -701,7 +701,7 @@ SkListSource* SkGridView::setListSource(SkListSource* src) SkRefCnt_SafeAssign(fSource, src); // this->dirtyStrCache(); this->ensureSelectionIsVisible(); - this->inval(nil); + this->inval(NULL); } return src; } @@ -733,7 +733,7 @@ void SkGridView::onDraw(SkCanvas* canvas) canvas->drawPaint(fPaint[kBG_Attr]); - if (fSource == nil) + if (fSource == NULL) return; #if 0 @@ -755,7 +755,7 @@ void SkGridView::onDraw(SkCanvas* canvas) delete evt; SkBitmapRef* bmr = SkBitmapRef::Decode(path.c_str(), false); - if (bmr == nil) + if (bmr == NULL) { bmr = SkBitmapRef::Decode(path.c_str(), true); if (bmr) @@ -773,7 +773,7 @@ void SkGridView::onDraw(SkCanvas* canvas) // only draw one forced bitmap at a time if (forced) { - this->inval(nil); // could inval only the remaining visible cells... + this->inval(NULL); // could inval only the remaining visible cells... break; } } @@ -840,11 +840,11 @@ bool SkGridView::onEvent(const SkEvent& evt) if (evt) { // augment the event with our local rect - (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, nil)); + (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL)); SkView* view = this->sendEventToParents(*evt); delete evt; - return view != nil; + return view != NULL; } } break; @@ -863,14 +863,14 @@ void SkGridView::onInflate(const SkDOM& dom, const SkDOM::Node* node) if (dom.findScalars(node, "cell-size", x, 2)) this->setCellSize(x[0], x[1]); - if ((child = dom.getFirstChild(node, "hilite-paint")) != nil) + if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL) SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child); // look for a listsource { - SkListSource* src = nil; + SkListSource* src = NULL; - if ((child = dom.getFirstChild(node, "file-listsource")) != nil) + if ((child = dom.getFirstChild(node, "file-listsource")) != NULL) { const char* path = dom.findAttr(child, "path"); if (path) @@ -878,7 +878,7 @@ void SkGridView::onInflate(const SkDOM& dom, const SkDOM::Node* node) dom.findAttr(child, "filter"), dom.findAttr(child, "target")); } - else if ((child = dom.getFirstChild(node, "xml-listsource")) != nil) + else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL) { src = SkListSource::CreateFromDOM(dom, child); } diff --git a/src/views/SkListWidget.cpp b/src/views/SkListWidget.cpp index 82e5d7813e..f693ebe464 100644 --- a/src/views/SkListWidget.cpp +++ b/src/views/SkListWidget.cpp @@ -12,10 +12,10 @@ struct SkListView::BindingRec { SkListView::SkListView() { - fSource = nil; // our list-source - fScrollBar = nil; - fAnims = nil; // array of animators[fVisibleRowCount] - fBindings = nil; // our fields->slot array + fSource = NULL; // our list-source + fScrollBar = NULL; + fAnims = NULL; // array of animators[fVisibleRowCount] + fBindings = NULL; // our fields->slot array fBindingCount = 0; // number of entries in fSlots array fScrollIndex = 0; // number of cells to skip before first visible cell fCurrIndex = -1; // index of "selected" cell @@ -43,7 +43,7 @@ void SkListView::setHasScrollBar(bool hasSB) { if (hasSB) { - SkASSERT(fScrollBar == nil); + SkASSERT(fScrollBar == NULL); fScrollBar = (SkScrollBarView*)SkWidgetFactory(kScroll_WidgetEnum); fScrollBar->setVisibleP(true); this->attachChildToFront(fScrollBar); @@ -56,7 +56,7 @@ void SkListView::setHasScrollBar(bool hasSB) SkASSERT(fScrollBar); fScrollBar->detachFromParent(); fScrollBar->unref(); - fScrollBar = nil; + fScrollBar = NULL; } this->dirtyCache(kAnimContent_DirtyFlag); } @@ -67,7 +67,7 @@ void SkListView::setSelection(int index) if (fCurrIndex != index) { fAnimFocusDirty = true; - this->inval(nil); + this->inval(NULL); this->invalSelection(); fCurrIndex = index; @@ -136,7 +136,7 @@ void SkListView::ensureSelectionIsVisible() else newIndex = fCurrIndex - fVisibleRowCount + 1; SkASSERT((unsigned)newIndex < (unsigned)fSource->countRecords()); - this->inval(nil); + this->inval(NULL); if (fScrollIndex != newIndex) { @@ -193,7 +193,7 @@ SkListSource* SkListView::setListSource(SkListSource* src) { SkRefCnt_SafeAssign(fSource, src); this->ensureSelectionIsVisible(); - this->inval(nil); + this->inval(NULL); if (fScrollBar) fScrollBar->setTotal(fSource->countRecords()); @@ -206,7 +206,7 @@ void SkListView::dirtyCache(unsigned dirtyFlags) if (dirtyFlags & kAnimCount_DirtyFlag) { delete fAnims; - fAnims = nil; + fAnims = NULL; fAnimContentDirty = true; fAnimFocusDirty = true; } @@ -214,7 +214,7 @@ void SkListView::dirtyCache(unsigned dirtyFlags) { if (!fAnimContentDirty) { - this->inval(nil); + this->inval(NULL); fAnimContentDirty = true; } fAnimFocusDirty = true; @@ -226,7 +226,7 @@ bool SkListView::ensureCache() if (fSkinName.size() == 0) return false; - if (fAnims == nil) + if (fAnims == NULL) { int n = SkMax32(1, fVisibleRowCount); @@ -437,10 +437,10 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node) const SkDOM::Node* child; - if ((child = dom.getFirstChild(node, "bindings")) != nil) + if ((child = dom.getFirstChild(node, "bindings")) != NULL) { delete[] fBindings; - fBindings = nil; + fBindings = NULL; fBindingCount = 0; SkListSource* listSrc = SkListSource::Factory(dom.findAttr(child, "data-fields")); @@ -467,7 +467,7 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node) if (fBindings[count].fFieldIndex >= 0) fBindings[count++].fSlotName.set(slotName); } - } while ((child = dom.getNextSibling(child, "bind")) != nil); + } while ((child = dom.getNextSibling(child, "bind")) != NULL); fBindingCount = SkToU16(count); if (count == 0) @@ -538,7 +538,7 @@ private: SkXMLListSource::SkXMLListSource(const char doc[], size_t len) { fFieldCount = fRecordCount = 0; - fFields = fRecords = nil; + fFields = fRecords = NULL; SkDOM dom; diff --git a/src/views/SkOSSound.cpp b/src/views/SkOSSound.cpp index 13cd037756..209a736a50 100644 --- a/src/views/SkOSSound.cpp +++ b/src/views/SkOSSound.cpp @@ -119,7 +119,7 @@ static void init_wave() { if (gInited == false) { - gWave.hwo = nil; + gWave.hwo = NULL; gWavePaused = false; gVolume = 0x80; gInited = true; @@ -137,7 +137,7 @@ void SkOSSound::Play(const char path[]) { init_wave(); - if (gWave.hwo != nil) + if (gWave.hwo != NULL) SkOSSound::Stop(); U32 v32 = (gVolume << 8) | gVolume; // fill it out to 16bits @@ -163,7 +163,7 @@ void SkOSSound::Pause() { init_wave(); - if (gWave.hwo == nil || (gWave.whdr.dwFlags & WHDR_DONE)) + if (gWave.hwo == NULL || (gWave.whdr.dwFlags & WHDR_DONE)) return; waveOutPause(gWave.hwo); gWavePaused = true; @@ -173,7 +173,7 @@ void SkOSSound::Resume() { init_wave(); - if (gWave.hwo == nil || (gWave.whdr.dwFlags & WHDR_DONE)) + if (gWave.hwo == NULL || (gWave.whdr.dwFlags & WHDR_DONE)) return; waveOutRestart(gWave.hwo); gWavePaused = false; @@ -183,13 +183,13 @@ void SkOSSound::Stop() { init_wave(); -// if (gWave.hwo == nil || (gWave.whdr.dwFlags & WHDR_DONE)) - if (gWave.hwo == nil) +// if (gWave.hwo == NULL || (gWave.whdr.dwFlags & WHDR_DONE)) + if (gWave.hwo == NULL) return; waveOutReset(gWave.hwo); EndWave(&gWave); gWavePaused = false; - gWave.hwo = nil; + gWave.hwo = NULL; } U8 SkOSSound::GetVolume() @@ -219,7 +219,7 @@ void SkOSSound::SetVolume(U8CPU vol) #if 0 unsigned long SoundManager::GetPosition() { - if (fWave.hwo == nil) + if (fWave.hwo == NULL) return 0; MMTIME time; time.wType = TIME_MS; @@ -234,7 +234,7 @@ unsigned long SoundManager::GetPosition() MMRESULT StartWave(const char path[], SkOSSoundWave* wave, U32 vol) { - HWAVEOUT hwo = nil; + HWAVEOUT hwo = NULL; // WAVEHDR whdr; MMRESULT mmres = 0; // CWaveFile waveFile; diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp index 7bf02440f1..a79f30c150 100644 --- a/src/views/SkParsePaint.cpp +++ b/src/views/SkParsePaint.cpp @@ -6,8 +6,8 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node) { - if ((node = dom.getFirstChild(node, "shader")) == nil) - return nil; + if ((node = dom.getFirstChild(node, "shader")) == NULL) + return NULL; const char* str; @@ -17,9 +17,9 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node) 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")) != nil && + if ((str = dom.findAttr(node, "c0")) != NULL && SkParse::FindColor(str, &colors[0]) && - (str = dom.findAttr(node, "c1")) != nil && + (str = dom.findAttr(node, "c1")) != NULL && SkParse::FindColor(str, &colors[1]) && dom.findScalars(node, "p0", &pts[0].fX, 2) && dom.findScalars(node, "p1", &pts[1].fX, 2)) @@ -29,13 +29,13 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node) if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0) mode = (SkShader::TileMode)index; - return SkGradientShader::CreateLinear(pts, colors, nil, 2, mode); + return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode); } } else if (dom.hasAttr(node, "type", "bitmap")) { - if ((str = dom.findAttr(node, "src")) == nil) - return nil; + if ((str = dom.findAttr(node, "src")) == NULL) + return NULL; SkBitmap bm; @@ -50,7 +50,7 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node) return SkShader::CreateBitmapShader(bm, mode, mode); } } - return nil; + return NULL; } void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node) diff --git a/src/views/SkProgressBarView.cpp b/src/views/SkProgressBarView.cpp index 21349a5500..a9fd516458 100644 --- a/src/views/SkProgressBarView.cpp +++ b/src/views/SkProgressBarView.cpp @@ -28,7 +28,7 @@ void SkProgressBarView::changeProgress(int diff) SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs()); if (diff == SkAnimator::kDifferent) - this->inval(nil); + this->inval(NULL); else if (diff == SkAnimator::kPartiallyDifferent) { SkRect bounds; @@ -41,7 +41,7 @@ void SkProgressBarView::changeProgress(int diff) { if (evt.isType(SK_EventType_Inval)) { - this->inval(nil); + this->inval(NULL); return true; } if (evt.isType("recommendDim")) diff --git a/src/views/SkWidget.cpp b/src/views/SkWidget.cpp index 8d945f171a..4d055c43ec 100644 --- a/src/views/SkWidget.cpp +++ b/src/views/SkWidget.cpp @@ -45,7 +45,7 @@ public: { U8 alpha = paint.getAlpha(); SkScalar above, below; - (void)paint.measureText(nil, 0, &above, &below); + (void)paint.measureText(NULL, 0, &above, &below); SkScalar height = below - above; SkScalar dy = SkScalarMul(height, scale); if (scale < 0) @@ -68,7 +68,7 @@ private: SkInterpolator fInterp; }; -SkTextView::SkTextView(U32 flags) : SkView(flags), fInterp(nil), fDoInterp(false) +SkTextView::SkTextView(U32 flags) : SkView(flags), fInterp(NULL), fDoInterp(false) { fMargin.set(0, 0); } @@ -119,7 +119,7 @@ void SkTextView::privSetText(const SkString& src, AnimaDir dir) fInterp = new Interp(fText, SkTime::GetMSecs(), 500, dir); } fText = src; - this->inval(nil); + this->inval(NULL); } ///////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ void SkTextView::setMargin(const SkPoint& margin) if (fMargin != margin) { fMargin = margin; - this->inval(nil); + this->inval(NULL); } } @@ -162,17 +162,17 @@ void SkTextView::onDraw(SkCanvas* canvas) break; } - fPaint.measureText(nil, 0, &y, nil); + fPaint.measureText(NULL, 0, &y, NULL); y = fMargin.fY - y; if (fInterp) { if (fInterp->draw(canvas, fText, x, y, fPaint)) - this->inval(nil); + this->inval(NULL); else { delete fInterp; - fInterp = nil; + fInterp = NULL; } } else @@ -216,7 +216,7 @@ void SkSliderView::setMax(U16CPU max) { fMax = SkToU16(max); if (fValue > 0) - this->inval(nil); + this->inval(NULL); } } @@ -230,7 +230,7 @@ void SkSliderView::setValue(U16CPU value) fValue = SkToU16(value); if (prev != next) { - this->inval(nil); + this->inval(NULL); if (this->hasListeners()) { @@ -262,7 +262,7 @@ static void setgrad(SkPaint* paint, const SkRect& r) colors[0] = SK_ColorBLUE; colors[1] = SK_ColorWHITE; - paint->setShader(SkGradientShader::CreateLinear(pts, colors, nil, 2, SkShader::kMirror_TileMode))->unref(); + paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kMirror_TileMode))->unref(); } void SkSliderView::onDraw(SkCanvas* canvas) diff --git a/src/views/SkWidgetViews.cpp b/src/views/SkWidgetViews.cpp index e7eb772577..ed81649711 100644 --- a/src/views/SkWidgetViews.cpp +++ b/src/views/SkWidgetViews.cpp @@ -117,7 +117,7 @@ void SkWidgetView::setLabel(const char label[]) void SkWidgetView::setLabel(const char label[], size_t len) { - if (label == nil && fLabel.size() != 0 || !fLabel.equals(label, len)) + if (label == NULL && fLabel.size() != 0 || !fLabel.equals(label, len)) { SkString tmp(label, len); @@ -160,13 +160,13 @@ bool SkWidgetView::postWidgetEvent() if (label) this->setLabel(label); - if ((node = dom.getFirstChild(node, "event")) != nil) + if ((node = dom.getFirstChild(node, "event")) != NULL) fEvent.inflate(dom, node); } /*virtual*/ void SkWidgetView::onLabelChange(const char oldLabel[], const char newLabel[]) { - this->inval(nil); + this->inval(NULL); } static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot"; @@ -215,7 +215,7 @@ void SkCheckButtonView::setCheckState(CheckState state) /*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState) { - this->inval(nil); + this->inval(NULL); } /*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node) @@ -303,7 +303,7 @@ protected: SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs()); if (diff == SkAnimator::kDifferent) - this->inval(nil); + this->inval(NULL); else if (diff == SkAnimator::kPartiallyDifferent) { SkRect bounds; @@ -316,7 +316,7 @@ protected: { if (evt.isType(SK_EventType_Inval)) { - this->inval(nil); + this->inval(NULL); return true; } if (evt.isType("recommendDim")) @@ -395,7 +395,7 @@ void SkStaticTextView::setMode(Mode mode) void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align) { fSpacingAlign = SkToU8(align); - this->inval(nil); + this->inval(NULL); } void SkStaticTextView::getMargin(SkPoint* margin) const @@ -410,7 +410,7 @@ void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy) { fMargin.set(dx, dy); this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -435,7 +435,7 @@ void SkStaticTextView::setText(const SkString& text) void SkStaticTextView::setText(const char text[]) { - if (text == nil) + if (text == NULL) text = ""; this->setText(text, strlen(text)); } @@ -446,7 +446,7 @@ void SkStaticTextView::setText(const char text[], size_t len) { fText.set(text, len); this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -462,7 +462,7 @@ void SkStaticTextView::setPaint(const SkPaint& paint) { fPaint = paint; this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -506,8 +506,8 @@ void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node) if (text) this->setText(text); - if ((node = dom.getFirstChild(node, "paint")) != nil && - (node = dom.getFirstChild(node, "screenplay")) != nil) + if ((node = dom.getFirstChild(node, "paint")) != NULL && + (node = dom.getFirstChild(node, "screenplay")) != NULL) { inflate_paint(dom, node, &fPaint); } @@ -518,8 +518,8 @@ void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node) SkView* SkWidgetFactory(const char name[]) { - if (name == nil) - return nil; + if (name == NULL) + return NULL; // must be in the same order as the SkSkinWidgetEnum is declared static const char* gNames[] = { @@ -537,7 +537,7 @@ SkView* SkWidgetFactory(const char name[]) if (!strcmp(gNames[i], name)) return SkWidgetFactory((SkWidgetEnum)i); - return nil; + return NULL; } #include "SkImageView.h" @@ -566,5 +566,5 @@ SkView* SkWidgetFactory(SkWidgetEnum sw) SkASSERT(!"unknown enum passed to SkWidgetFactory"); break; } - return nil; + return NULL; } diff --git a/src/views/SkWidgets.cpp b/src/views/SkWidgets.cpp index fe87cd6e19..dba9ab354e 100644 --- a/src/views/SkWidgets.cpp +++ b/src/views/SkWidgets.cpp @@ -65,7 +65,7 @@ SkinSuite::SkinSuite() if (!fAnimators[i]->decodeURI(path.c_str())) { delete fAnimators[i]; - fAnimators[i] = nil; + fAnimators[i] = NULL; } } } @@ -81,11 +81,11 @@ static SkinSuite* gSkinSuite; static SkAnimator* get_skin_animator(SkinType st) { #if 0 - if (gSkinSuite == nil) + if (gSkinSuite == NULL) gSkinSuite = new SkinSuite; return gSkinSuite->get(st); #else - return nil; + return NULL; #endif } @@ -102,7 +102,7 @@ void SkWidget::Term() void SkWidget::onEnabledChange() { - this->inval(nil); + this->inval(NULL); } void SkWidget::postWidgetEvent() @@ -123,7 +123,7 @@ void SkWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node) { this->INHERITED::onInflate(dom, node); - if ((node = dom.getFirstChild(node, "event")) != nil) + if ((node = dom.getFirstChild(node, "event")) != NULL) fEvent.inflate(dom, node); } @@ -189,7 +189,7 @@ void SkButtonWidget::setButtonState(State state) void SkButtonWidget::onButtonStateChange() { - this->inval(nil); + this->inval(NULL); } void SkButtonWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node) @@ -284,7 +284,7 @@ void SkPushButtonWidget::onDraw(SkCanvas* canvas) 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(nil); + p.setMaskFilter(NULL); p.setTextAlign(SkPaint::kCenter_Align); @@ -342,7 +342,7 @@ void SkStaticTextView::computeSize() { if (fMode == kAutoWidth_Mode) { - SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), nil, nil); + SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL); this->setWidth(width + fMargin.fX * 2); } else if (fMode == kAutoHeight_Mode) @@ -351,7 +351,7 @@ void SkStaticTextView::computeSize() int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0; SkScalar before, after; - (void)fPaint.measureText(0, nil, &before, &after); + (void)fPaint.measureText(0, NULL, &before, &after); this->setHeight(lines * (after - before) + fMargin.fY * 2); } @@ -371,7 +371,7 @@ void SkStaticTextView::setMode(Mode mode) void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align) { fSpacingAlign = SkToU8(align); - this->inval(nil); + this->inval(NULL); } void SkStaticTextView::getMargin(SkPoint* margin) const @@ -386,7 +386,7 @@ void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy) { fMargin.set(dx, dy); this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -420,7 +420,7 @@ void SkStaticTextView::setText(const char text[], size_t len) { fText.set(text, len); this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -436,7 +436,7 @@ void SkStaticTextView::setPaint(const SkPaint& paint) { fPaint = paint; this->computeSize(); - this->inval(nil); + this->inval(NULL); } } @@ -480,7 +480,7 @@ void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node) if (text) this->setText(text); - if ((node = dom.getFirstChild(node, "paint")) != nil) + if ((node = dom.getFirstChild(node, "paint")) != NULL) SkPaint_Inflate(&fPaint, dom, node); }