"NULL !=" = NULL
R=reed@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/544233002
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index cb69b4e..b46e92a 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -46,7 +46,7 @@
if (shader && !shader->asAGradient(NULL)) {
SkBitmap bm;
if (shader->asABitmap(&bm, NULL, NULL) &&
- NULL != bm.getTexture()) {
+ bm.getTexture()) {
return true;
}
}
@@ -336,11 +336,11 @@
void SkDeferredDevice::aboutToDraw()
{
- if (NULL != fNotificationClient) {
+ if (fNotificationClient) {
fNotificationClient->prepareForDraw();
}
if (fCanDiscardCanvasContents) {
- if (NULL != fSurface) {
+ if (fSurface) {
fSurface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
}
fCanDiscardCanvasContents = false;
@@ -604,7 +604,7 @@
SkSurface* SkDeferredCanvas::setSurface(SkSurface* surface) {
SkDeferredDevice* deferredDevice = this->getDeferredDevice();
- SkASSERT(NULL != deferredDevice);
+ SkASSERT(deferredDevice);
// By swapping the surface into the existing device, we preserve
// all pending commands, which can help to seamlessly recover from
// a lost accelerated graphics context.
diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp
index 65e8372..694becf 100644
--- a/src/utils/SkEventTracer.cpp
+++ b/src/utils/SkEventTracer.cpp
@@ -54,6 +54,6 @@
SkEventTracer* SkEventTracer::GetInstance() {
SK_DECLARE_STATIC_ONCE(once);
SkOnce(&once, intialize_default_tracer, SkEventTracer::gInstance);
- SkASSERT(NULL != SkEventTracer::gInstance);
+ SkASSERT(SkEventTracer::gInstance);
return SkEventTracer::gInstance;
}
diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h
index 5d980aa..e1e5ccd 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -103,7 +103,7 @@
}
SkRect pathBounds = path.getBounds();
- if (NULL != prePathMatrix) {
+ if (prePathMatrix) {
prePathMatrix->mapRect(&pathBounds);
}
@@ -295,7 +295,7 @@
static bool GetBitmapFromPaint(const SkPaint &paint, SkBitmap* bitmap) {
SkShader* shader = paint.getShader();
- if (NULL != shader) {
+ if (shader) {
if (SkShader::kNone_GradientType == shader->asAGradient(NULL)) {
return SkShader::kNone_BitmapType != shader->asABitmap(bitmap, NULL, NULL);
}
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 773af54..48493b8 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -317,7 +317,7 @@
SkClipStack::B2TIter iter(stack);
const SkClipStack::Element* element;
int i = 0;
- while (NULL != (element = iter.next())) {
+ while ((element = iter.next())) {
this->pushClipStackElement(*element);
lua_rawseti(fL, -2, ++i);
}
@@ -521,7 +521,7 @@
GrReducedClip::ElementList::Iter iter(elements);
int i = 0;
lua_newtable(L);
- while(NULL != iter.get()) {
+ while(iter.get()) {
SkLua(L).pushClipStackElement(*iter.get());
iter.next();
lua_rawseti(L, -2, ++i);
diff --git a/src/utils/SkPatchGrid.cpp b/src/utils/SkPatchGrid.cpp
index a0809f3..96e3c8f 100644
--- a/src/utils/SkPatchGrid.cpp
+++ b/src/utils/SkPatchGrid.cpp
@@ -59,14 +59,14 @@
fVrtCtrlPts[vrtPos + (fCols + 1) + 1] = cubics[SkPatchUtils::kRightP2_CubicCtrlPts];
// set optional values (colors and texture coordinates)
- if ((fModeFlags & kColors_VertexType) && NULL != colors) {
+ if ((fModeFlags & kColors_VertexType) && colors) {
fCornerColors[cornerPos] = colors[0];
fCornerColors[cornerPos + 1] = colors[1];
fCornerColors[cornerPos + (fCols + 1)] = colors[3];
fCornerColors[cornerPos + (fCols + 1) + 1] = colors[2];
}
- if ((fModeFlags & kTexs_VertexType) && NULL != texCoords) {
+ if ((fModeFlags & kTexs_VertexType) && texCoords) {
fTexCoords[cornerPos] = texCoords[0];
fTexCoords[cornerPos + 1] = texCoords[1];
fTexCoords[cornerPos + (fCols + 1)] = texCoords[3];
@@ -102,14 +102,14 @@
cubics[SkPatchUtils::kLeftP2_CubicCtrlPts] = fVrtCtrlPts[vrtPos + (fCols + 1)];
cubics[SkPatchUtils::kRightP2_CubicCtrlPts] = fVrtCtrlPts[vrtPos + (fCols + 1) + 1];
- if ((fModeFlags & kColors_VertexType) && NULL != colors) {
+ if ((fModeFlags & kColors_VertexType) && colors) {
colors[0] = fCornerColors[cornerPos];
colors[1] = fCornerColors[cornerPos + 1];
colors[3] = fCornerColors[cornerPos + (fCols + 1)];
colors[2] = fCornerColors[cornerPos + (fCols + 1) + 1];
}
- if ((fModeFlags & kTexs_VertexType) && NULL != texCoords) {
+ if ((fModeFlags & kTexs_VertexType) && texCoords) {
texCoords[0] = fTexCoords[cornerPos];
texCoords[1] = fTexCoords[cornerPos + 1];
texCoords[3] = fTexCoords[cornerPos + (fCols + 1)];
diff --git a/src/utils/SkPatchUtils.cpp b/src/utils/SkPatchUtils.cpp
index a0be328..c9c526e 100644
--- a/src/utils/SkPatchUtils.cpp
+++ b/src/utils/SkPatchUtils.cpp
@@ -233,7 +233,7 @@
// if colors is not null then create array for colors
SkPMColor colorsPM[kNumCorners];
- if (NULL != colors) {
+ if (colors) {
// premultiply colors to avoid color bleeding.
for (int i = 0; i < kNumCorners; i++) {
colorsPM[i] = SkPreMultiplyColor(colors[i]);
@@ -242,7 +242,7 @@
}
// if texture coordinates are not null then create array for them
- if (NULL != texCoords) {
+ if (texCoords) {
data->fTexCoords = SkNEW_ARRAY(SkPoint, data->fVertexCount);
}
@@ -286,7 +286,7 @@
+ u * fBottom.getCtrlPoints()[3].y()));
data->fPoints[dataIndex] = s0 + s1 - s2;
- if (NULL != colors) {
+ if (colors) {
uint8_t a = uint8_t(bilerp(u, v,
SkScalar(SkColorGetA(colorsPM[kTopLeft_Corner])),
SkScalar(SkColorGetA(colorsPM[kTopRight_Corner])),
@@ -310,7 +310,7 @@
data->fColors[dataIndex] = SkPackARGB32(a,r,g,b);
}
- if (NULL != texCoords) {
+ if (texCoords) {
data->fTexCoords[dataIndex] = SkPoint::Make(
bilerp(u, v, texCoords[kTopLeft_Corner].x(),
texCoords[kTopRight_Corner].x(),
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index 8ca9981..20b8b43 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -28,7 +28,7 @@
if (commentptr == line) {
continue;
}
- if (NULL != commentptr) {
+ if (commentptr) {
*commentptr = '\0';
}
@@ -99,7 +99,7 @@
void SkRTConfRegistry::printAll(const char *fname) const {
SkWStream *o;
- if (NULL != fname) {
+ if (fname) {
o = new SkFILEWStream(fname);
} else {
o = new SkDebugWStream();
@@ -133,7 +133,7 @@
void SkRTConfRegistry::printNonDefault(const char *fname) const {
SkWStream *o;
- if (NULL != fname) {
+ if (fname) {
o = new SkFILEWStream(fname);
} else {
o = new SkDebugWStream();
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index 0dfc229..07b58c5 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -166,7 +166,7 @@
}
}
- if (NULL != proc) {
+ if (proc) {
return proc(dst, src, width, height, rowBytes);
}
diff --git a/src/utils/SkTextureCompressor_Blitter.h b/src/utils/SkTextureCompressor_Blitter.h
index beffbfc..3d30501 100644
--- a/src/utils/SkTextureCompressor_Blitter.h
+++ b/src/utils/SkTextureCompressor_Blitter.h
@@ -440,7 +440,7 @@
typedef uint32_t Block[BlockDim][BlockDim/4];
inline void updateBlockColumns(Block block, const int col,
const int colsLeft, const Column curAlphai) {
- SkASSERT(NULL != block);
+ SkASSERT(block);
SkASSERT(col + colsLeft <= BlockDim);
for (int i = col; i < (col + colsLeft); ++i) {
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 4bb33b7..c61627d 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -208,7 +208,7 @@
virtual bool isClipEmpty() const SK_OVERRIDE { return false; }
virtual bool isClipRect() const SK_OVERRIDE { return true; }
virtual bool getClipBounds(SkRect* bounds) const SK_OVERRIDE {
- if (NULL != bounds) {
+ if (bounds) {
bounds->setXYWH(0, 0,
SkIntToScalar(this->imageInfo().width()),
SkIntToScalar(this->imageInfo().height()));
@@ -216,7 +216,7 @@
return true;
}
virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
- if (NULL != bounds) {
+ if (bounds) {
bounds->setLargest();
}
return true;
@@ -308,7 +308,7 @@
size_t getOpID() const {
#if 0
- if (NULL != fPicture) {
+ if (fPicture) {
return fPicture->EXPERIMENTAL_curOpID();
}
#endif
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index b9742c3..0da8f98 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -148,7 +148,7 @@
canvas->clear(0xFFFFFFFF);
canvas->drawBitmapRect(input, NULL, dst);
- if (NULL != srcRect) {
+ if (srcRect) {
SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1,
srcRect->fTop * yScale + SK_Scalar1,
srcRect->fRight * xScale + SK_Scalar1,
@@ -281,7 +281,7 @@
fBitmap = bitmap;
fLeft = left;
fTop = top;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -291,7 +291,7 @@
fInfo.push(SkObjectParser::BitmapToString(bitmap));
fInfo.push(SkObjectParser::ScalarToString(left, "SkScalar left: "));
fInfo.push(SkObjectParser::ScalarToString(top, "SkScalar top: "));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -311,7 +311,7 @@
: INHERITED(DRAW_BITMAP_MATRIX) {
fBitmap = bitmap;
fMatrix = matrix;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -320,7 +320,7 @@
fInfo.push(SkObjectParser::BitmapToString(bitmap));
fInfo.push(SkObjectParser::MatrixToString(matrix));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -340,7 +340,7 @@
fBitmap = bitmap;
fCenter = center;
fDst = dst;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -350,7 +350,7 @@
fInfo.push(SkObjectParser::BitmapToString(bitmap));
fInfo.push(SkObjectParser::IRectToString(center));
fInfo.push(SkObjectParser::RectToString(dst, "Dst: "));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -369,14 +369,14 @@
SkCanvas::DrawBitmapRectFlags flags)
: INHERITED(DRAW_BITMAP_RECT_TO_RECT) {
fBitmap = bitmap;
- if (NULL != src) {
+ if (src) {
fSrc = *src;
} else {
fSrc.setEmpty();
}
fDst = dst;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -385,11 +385,11 @@
fFlags = flags;
fInfo.push(SkObjectParser::BitmapToString(bitmap));
- if (NULL != src) {
+ if (src) {
fInfo.push(SkObjectParser::RectToString(*src, "Src: "));
}
fInfo.push(SkObjectParser::RectToString(dst, "Dst: "));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: "));
@@ -513,11 +513,11 @@
, fMatrixPtr(NULL)
, fPaintPtr(NULL) {
- if (NULL != matrix) {
+ if (matrix) {
fMatrix = *matrix;
fMatrixPtr = &fMatrix;
}
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
}
@@ -527,10 +527,10 @@
picture->cullRect().fLeft, picture->cullRect().fTop,
picture->cullRect().fRight, picture->cullRect().fBottom);
fInfo.push(temp);
- if (NULL != matrix) {
+ if (matrix) {
fInfo.push(SkObjectParser::MatrixToString(*matrix));
}
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -739,7 +739,7 @@
fBitmap = bitmap;
fLeft = left;
fTop = top;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -749,7 +749,7 @@
fInfo.push(SkObjectParser::BitmapToString(bitmap));
fInfo.push(SkObjectParser::IntToString(left, "Left: "));
fInfo.push(SkObjectParser::IntToString(top, "Top: "));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -791,7 +791,7 @@
memcpy(fText, text, byteLength);
fByteLength = byteLength;
fPath = path;
- if (NULL != matrix) {
+ if (matrix) {
fMatrix = *matrix;
} else {
fMatrix.setIdentity();
@@ -800,7 +800,7 @@
fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncoding()));
fInfo.push(SkObjectParser::PathToString(path));
- if (NULL != matrix) {
+ if (matrix) {
fInfo.push(SkObjectParser::MatrixToString(*matrix));
}
fInfo.push(SkObjectParser::PaintToString(paint));
@@ -825,14 +825,14 @@
fVertices = new SkPoint[vertexCount];
memcpy(fVertices, vertices, vertexCount * sizeof(SkPoint));
- if (NULL != texs) {
+ if (texs) {
fTexs = new SkPoint[vertexCount];
memcpy(fTexs, texs, vertexCount * sizeof(SkPoint));
} else {
fTexs = NULL;
}
- if (NULL != colors) {
+ if (colors) {
fColors = new SkColor[vertexCount];
memcpy(fColors, colors, vertexCount * sizeof(SkColor));
} else {
@@ -840,7 +840,7 @@
}
fXfermode = xfermode;
- if (NULL != fXfermode) {
+ if (fXfermode) {
fXfermode->ref();
}
@@ -912,13 +912,13 @@
SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint,
SkCanvas::SaveFlags flags)
: INHERITED(SAVE_LAYER) {
- if (NULL != bounds) {
+ if (bounds) {
fBounds = *bounds;
} else {
fBounds.setEmpty();
}
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -926,10 +926,10 @@
}
fFlags = flags;
- if (NULL != bounds) {
+ if (bounds) {
fInfo.push(SkObjectParser::RectToString(*bounds, "Bounds: "));
}
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
fInfo.push(SkObjectParser::SaveFlagsToString(flags));
diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp
index a9bad40..798db95 100644
--- a/src/utils/debugger/SkObjectParser.cpp
+++ b/src/utils/debugger/SkObjectParser.cpp
@@ -174,7 +174,7 @@
SkString* boundStr = SkObjectParser::RectToString(path.getBounds(), " Bound: ");
- if (NULL != boundStr) {
+ if (boundStr) {
mPath->append(*boundStr);
SkDELETE(boundStr);
}
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index c7dc3b2..0f0c628 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -188,7 +188,7 @@
}
const void* data = fStream->getMemoryBase();
- if (NULL != data) {
+ if (data) {
*fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fileOffset);
*fragmentContext = NULL;
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 495f074..0aea4a6 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -10,7 +10,7 @@
#include "SkHRESULT.h"
void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg) {
- if (NULL != msg) {
+ if (msg) {
SkDebugf("%s\n", msg);
}
SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr);
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index 74d814c..6274e71 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -113,7 +113,7 @@
}
SkIStream::~SkIStream() {
- if (NULL != this->fSkStream && fUnrefOnRelease) {
+ if (this->fSkStream && fUnrefOnRelease) {
this->fSkStream->unref();
}
}
@@ -196,7 +196,7 @@
break;
}
- if (NULL != lpNewFilePointer) {
+ if (lpNewFilePointer) {
lpNewFilePointer->QuadPart = this->fLocation.QuadPart;
}
return hr;
@@ -228,7 +228,7 @@
{ }
SkWIStream::~SkWIStream() {
- if (NULL != this->fSkWStream) {
+ if (this->fSkWStream) {
this->fSkWStream->flush();
}
}
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 9c0c2d4..5c46138 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -367,7 +367,7 @@
coreProfileAttribs[1] = kCoreGLVersions[2 * v];
coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs);
- if (NULL != glrc) {
+ if (glrc) {
break;
}
}
@@ -429,9 +429,9 @@
HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, NULL);
if (0 != pbuf) {
HDC dc = extensions.getPbufferDC(pbuf);
- if (NULL != dc) {
+ if (dc) {
HGLRC glrc = create_gl_context(dc, extensions, contextType);
- if (NULL != glrc) {
+ if (glrc) {
return SkNEW_ARGS(SkWGLPbufferContext, (pbuf, dc, glrc));
}
extensions.releasePbufferDC(pbuf, dc);