aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-05 13:34:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-05 13:34:00 -0700
commit49f085dddff10473b6ebf832a974288300224e60 (patch)
tree308a3cac5e1fb053c9e27e7d07213d72eaa05409
parent7260d7292bde966f038b8e166f3fe41ddd8f2099 (diff)
"NULL !=" = NULL
R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
-rw-r--r--bench/ChartBench.cpp2
-rw-r--r--bench/ETCBitmapBench.cpp2
-rw-r--r--bench/GrResourceCacheBench.cpp4
-rw-r--r--bench/HairlinePathBench.cpp2
-rw-r--r--bench/ResultsWriter.h4
-rw-r--r--bench/XfermodeBench.cpp4
-rw-r--r--bench/nanobench.cpp2
-rw-r--r--debugger/QT/SkDebuggerGUI.cpp2
-rw-r--r--debugger/SkDebugger.cpp4
-rw-r--r--debugger/SkDebugger.h8
-rw-r--r--gm/beziereffects.cpp6
-rw-r--r--gm/bleed.cpp4
-rw-r--r--gm/convexpolyclip.cpp2
-rw-r--r--gm/convexpolyeffect.cpp4
-rw-r--r--gm/factory.cpp2
-rw-r--r--gm/gmmain.cpp12
-rw-r--r--gm/image.cpp2
-rw-r--r--gm/imagefiltersgraph.cpp2
-rw-r--r--gm/samplerstress.cpp4
-rw-r--r--gm/xfermodes3.cpp4
-rw-r--r--include/core/SkBitmap.h2
-rw-r--r--include/core/SkCanvas.h4
-rw-r--r--include/core/SkMatrix.h2
-rw-r--r--include/core/SkMetaData.h2
-rw-r--r--include/core/SkPathRef.h2
-rw-r--r--include/core/SkRefCnt.h2
-rw-r--r--include/core/SkTArray.h4
-rw-r--r--include/core/SkTInternalLList.h18
-rw-r--r--include/core/SkTLazy.h4
-rw-r--r--include/core/SkTemplates.h2
-rw-r--r--include/core/SkTypes.h6
-rw-r--r--include/gpu/GrClipData.h2
-rw-r--r--include/gpu/GrContext.h24
-rw-r--r--include/gpu/GrContextFactory.h6
-rw-r--r--include/gpu/GrCoordTransform.h6
-rw-r--r--include/gpu/GrDrawEffect.h4
-rw-r--r--include/gpu/GrEffectStage.h4
-rw-r--r--include/gpu/GrGpuResource.h2
-rw-r--r--include/gpu/GrPaint.h4
-rw-r--r--include/gpu/GrProgramElementRef.h2
-rw-r--r--include/gpu/GrRenderTarget.h2
-rw-r--r--include/gpu/GrSurface.h4
-rw-r--r--include/gpu/gl/SkGLContextHelper.h2
-rw-r--r--include/pipe/SkGPipe.h2
-rw-r--r--include/utils/win/SkTScopedComPtr.h2
-rw-r--r--include/views/SkView.h2
-rw-r--r--samplecode/SampleApp.cpp4
-rw-r--r--samplecode/SampleChart.cpp2
-rw-r--r--samplecode/SampleFilterFuzz.cpp2
-rw-r--r--samplecode/SampleTiling.cpp8
-rw-r--r--src/core/SkBBoxHierarchyRecord.cpp6
-rw-r--r--src/core/SkBitmap.cpp14
-rw-r--r--src/core/SkBitmapProcState.cpp4
-rw-r--r--src/core/SkBitmapScaler.cpp2
-rw-r--r--src/core/SkBitmap_scroll.cpp6
-rw-r--r--src/core/SkBlitter.cpp4
-rw-r--r--src/core/SkBlitter_RGB16.cpp2
-rw-r--r--src/core/SkCanvas.cpp36
-rw-r--r--src/core/SkClipStack.cpp14
-rw-r--r--src/core/SkColorTable.cpp2
-rw-r--r--src/core/SkDeque.cpp16
-rwxr-xr-xsrc/core/SkDistanceFieldGen.cpp12
-rw-r--r--src/core/SkDraw.cpp14
-rw-r--r--src/core/SkEdge.cpp2
-rw-r--r--src/core/SkFlattenable.cpp2
-rwxr-xr-xsrc/core/SkGlyphCache.cpp6
-rw-r--r--src/core/SkImageGenerator.cpp6
-rw-r--r--src/core/SkMallocPixelRef.cpp2
-rw-r--r--src/core/SkMaskGamma.h4
-rw-r--r--src/core/SkMatrix.cpp6
-rw-r--r--src/core/SkMessageBus.h2
-rw-r--r--src/core/SkMultiPictureDraw.cpp4
-rw-r--r--src/core/SkPaint.cpp26
-rw-r--r--src/core/SkPath.cpp4
-rw-r--r--src/core/SkPathRef.cpp2
-rw-r--r--src/core/SkPicture.cpp28
-rw-r--r--src/core/SkPictureContentInfo.cpp4
-rw-r--r--src/core/SkPictureData.cpp4
-rw-r--r--src/core/SkPictureData.h2
-rw-r--r--src/core/SkPicturePlayback.cpp4
-rw-r--r--src/core/SkPicturePlayback.h2
-rw-r--r--src/core/SkPictureRecord.cpp22
-rw-r--r--src/core/SkPictureRecorder.cpp20
-rw-r--r--src/core/SkPictureShader.cpp4
-rw-r--r--src/core/SkPictureStateTree.cpp4
-rw-r--r--src/core/SkPoint.cpp2
-rw-r--r--src/core/SkRTree.cpp4
-rw-r--r--src/core/SkRecordDraw.cpp8
-rw-r--r--src/core/SkResourceCache.cpp8
-rw-r--r--src/core/SkScan_Path.cpp2
-rw-r--r--src/core/SkSpriteBlitter_ARGB32.cpp8
-rw-r--r--src/core/SkStream.cpp2
-rw-r--r--src/core/SkTDynamicHash.h6
-rw-r--r--src/core/SkTLList.h16
-rwxr-xr-xsrc/core/SkTLS.cpp2
-rw-r--r--src/core/SkTMultiMap.h12
-rw-r--r--src/core/SkTextBlob.cpp10
-rw-r--r--src/core/SkUtils.cpp8
-rw-r--r--src/core/SkXfermode.cpp16
-rw-r--r--src/device/xps/SkXPSDevice.cpp24
-rw-r--r--src/effects/SkArithmeticMode.cpp2
-rw-r--r--src/effects/SkAvoidXfermode.cpp4
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp2
-rw-r--r--src/effects/SkColorMatrixFilter.cpp2
-rw-r--r--src/effects/SkDashPathEffect.cpp4
-rw-r--r--src/effects/SkGpuBlurUtils.cpp2
-rw-r--r--src/effects/SkLayerDrawLooper.cpp2
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp2
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp8
-rw-r--r--src/effects/SkPictureImageFilter.cpp2
-rw-r--r--src/effects/SkTableColorFilter.cpp2
-rw-r--r--src/effects/gradients/SkGradientShader.cpp4
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp2
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointRadialGradient.cpp2
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp8
-rw-r--r--src/gpu/GrAARectRenderer.cpp6
-rw-r--r--src/gpu/GrAllocPool.cpp2
-rw-r--r--src/gpu/GrAllocator.h4
-rw-r--r--src/gpu/GrAtlas.cpp14
-rwxr-xr-xsrc/gpu/GrBitmapTextContext.cpp2
-rw-r--r--src/gpu/GrBlend.cpp2
-rw-r--r--src/gpu/GrBufferAllocPool.cpp36
-rw-r--r--src/gpu/GrClipMaskManager.cpp28
-rwxr-xr-xsrc/gpu/GrContext.cpp78
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp8
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp2
-rw-r--r--src/gpu/GrDrawState.cpp6
-rw-r--r--src/gpu/GrDrawState.h8
-rw-r--r--src/gpu/GrDrawTarget.cpp66
-rw-r--r--src/gpu/GrDrawTarget.h10
-rw-r--r--src/gpu/GrGeometryBuffer.h4
-rw-r--r--src/gpu/GrGpu.cpp20
-rw-r--r--src/gpu/GrGpuResource.cpp14
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp46
-rw-r--r--src/gpu/GrLayerCache.cpp30
-rw-r--r--src/gpu/GrLayerCache.h4
-rw-r--r--src/gpu/GrLayerHoister.cpp2
-rw-r--r--src/gpu/GrMemoryPool.cpp2
-rw-r--r--src/gpu/GrOvalRenderer.cpp2
-rw-r--r--src/gpu/GrPaint.cpp2
-rw-r--r--src/gpu/GrPathRenderer.h2
-rw-r--r--src/gpu/GrPathRendererChain.cpp2
-rw-r--r--src/gpu/GrPictureUtils.cpp4
-rw-r--r--src/gpu/GrProgramResource.cpp10
-rw-r--r--src/gpu/GrRODrawState.cpp2
-rw-r--r--src/gpu/GrRODrawState.h2
-rw-r--r--src/gpu/GrRecordReplaceDraw.cpp10
-rw-r--r--src/gpu/GrRedBlackTree.h106
-rw-r--r--src/gpu/GrReducedClip.cpp24
-rw-r--r--src/gpu/GrRenderTarget.cpp2
-rw-r--r--src/gpu/GrResourceCache.cpp16
-rw-r--r--src/gpu/GrResourceCache.h2
-rw-r--r--src/gpu/GrResourceCache2.cpp2
-rw-r--r--src/gpu/GrSWMaskHelper.cpp10
-rw-r--r--src/gpu/GrStencilAndCoverPathRenderer.cpp6
-rw-r--r--src/gpu/GrStrokeInfo.h2
-rw-r--r--src/gpu/GrTemplates.h6
-rw-r--r--src/gpu/GrTextStrike.cpp6
-rw-r--r--src/gpu/GrTexture.cpp12
-rw-r--r--src/gpu/GrTextureAccess.cpp8
-rw-r--r--src/gpu/SkGpuDevice.cpp42
-rw-r--r--src/gpu/SkGr.cpp30
-rw-r--r--src/gpu/SkGrPixelRef.cpp6
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp2
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp12
-rw-r--r--src/gpu/gl/GrGLBufferImpl.cpp8
-rw-r--r--src/gpu/gl/GrGLCaps.cpp4
-rw-r--r--src/gpu/gl/GrGLContext.cpp4
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp4
-rw-r--r--src/gpu/gl/GrGLInterface.cpp2
-rw-r--r--src/gpu/gl/GrGLPathRange.cpp2
-rw-r--r--src/gpu/gl/GrGLPathRendering.cpp22
-rw-r--r--src/gpu/gl/GrGLProgram.cpp8
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp4
-rw-r--r--src/gpu/gl/GrGLProgramEffects.cpp4
-rw-r--r--src/gpu/gl/GrGLRenderTarget.cpp6
-rw-r--r--src/gpu/gl/GrGLSL.cpp2
-rw-r--r--src/gpu/gl/GrGLTexture.cpp4
-rw-r--r--src/gpu/gl/GrGLTexture.h2
-rw-r--r--src/gpu/gl/GrGLUtil.cpp8
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp2
-rw-r--r--src/gpu/gl/GrGpuGL.cpp48
-rw-r--r--src/gpu/gl/GrGpuGL.h6
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp22
-rw-r--r--src/gpu/gl/SkGLContextHelper.cpp2
-rw-r--r--src/gpu/gl/android/SkNativeGLContext_android.cpp2
-rw-r--r--src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp2
-rw-r--r--src/gpu/gl/angle/SkANGLEGLContext.cpp2
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp8
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h4
-rw-r--r--src/gpu/gl/builders/GrGLShaderBuilder.cpp2
-rw-r--r--src/gpu/gl/builders/GrGLShaderBuilder.h2
-rw-r--r--src/gpu/gl/debug/GrDebugGL.cpp2
-rw-r--r--src/gpu/gl/debug/GrGLCreateDebugInterface.cpp30
-rw-r--r--src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp4
-rw-r--r--src/gpu/gl/iOS/SkNativeGLContext_iOS.mm2
-rw-r--r--src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp4
-rw-r--r--src/gpu/gl/mac/SkNativeGLContext_mac.cpp2
-rw-r--r--src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp2
-rw-r--r--src/gpu/gl/mesa/SkMesaGLContext.cpp4
-rw-r--r--src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp2
-rw-r--r--src/gpu/gl/unix/SkNativeGLContext_unix.cpp2
-rw-r--r--src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp12
-rw-r--r--src/image/SkImage_Gpu.cpp2
-rw-r--r--src/image/SkSurface.cpp2
-rw-r--r--src/image/SkSurface_Base.h2
-rw-r--r--src/image/SkSurface_Gpu.cpp4
-rw-r--r--src/image/SkSurface_Raster.cpp4
-rw-r--r--src/images/SkImageDecoder.cpp2
-rw-r--r--src/images/SkImageDecoder_ktx.cpp2
-rw-r--r--src/images/SkImageDecoder_libgif.cpp2
-rw-r--r--src/images/SkImageDecoder_libpng.cpp4
-rw-r--r--src/lazy/SkDiscardableMemoryPool.cpp2
-rw-r--r--src/pipe/SkGPipeWrite.cpp10
-rw-r--r--src/ports/SkFontConfigParser_android.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType.cpp10
-rw-r--r--src/ports/SkFontHost_fontconfig.cpp2
-rw-r--r--src/ports/SkFontHost_linux.cpp2
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp2
-rw-r--r--src/ports/SkFontMgr_android.cpp2
-rw-r--r--src/ports/SkFontMgr_fontconfig.cpp2
-rw-r--r--src/ports/SkOSFile_win.cpp2
-rw-r--r--src/ports/SkScalerContext_win_dw.cpp2
-rw-r--r--src/ports/SkTypeface_win_dw.cpp2
-rw-r--r--src/utils/SkDeferredCanvas.cpp8
-rw-r--r--src/utils/SkEventTracer.cpp2
-rw-r--r--src/utils/SkGatherPixelRefsAndRects.h4
-rw-r--r--src/utils/SkLua.cpp4
-rw-r--r--src/utils/SkPatchGrid.cpp8
-rw-r--r--src/utils/SkPatchUtils.cpp8
-rw-r--r--src/utils/SkRTConf.cpp6
-rw-r--r--src/utils/SkTextureCompressor.cpp2
-rw-r--r--src/utils/SkTextureCompressor_Blitter.h2
-rw-r--r--src/utils/debugger/SkDebugCanvas.h6
-rw-r--r--src/utils/debugger/SkDrawCommand.cpp52
-rw-r--r--src/utils/debugger/SkObjectParser.cpp2
-rw-r--r--src/utils/win/SkDWriteFontFileStream.cpp2
-rw-r--r--src/utils/win/SkHRESULT.cpp2
-rw-r--r--src/utils/win/SkIStream.cpp6
-rw-r--r--src/utils/win/SkWGL_win.cpp6
-rw-r--r--src/views/SkOSMenu.cpp4
-rw-r--r--src/views/SkView.cpp2
-rw-r--r--src/views/mac/SkNSView.mm19
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp22
-rw-r--r--src/views/win/SkOSWindow_win.cpp2
-rw-r--r--tests/BBoxHierarchyTest.cpp2
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp12
-rw-r--r--tests/CanvasStateTest.cpp2
-rw-r--r--tests/ClipStackTest.cpp6
-rw-r--r--tests/DeferredCanvasTest.cpp10
-rw-r--r--tests/DequeTest.cpp12
-rw-r--r--tests/FontMgrTest.cpp2
-rwxr-xr-xtests/GLInterfaceValidationTest.cpp6
-rw-r--r--tests/GLProgramsTest.cpp6
-rw-r--r--tests/GpuLayerCacheTest.cpp20
-rw-r--r--tests/GrAllocatorTest.cpp2
-rw-r--r--tests/GrSurfaceTest.cpp2
-rw-r--r--tests/ImageCacheTest.cpp6
-rw-r--r--tests/ImageDecodingTest.cpp6
-rw-r--r--tests/ImageFilterTest.cpp2
-rw-r--r--tests/KtxTest.cpp16
-rw-r--r--tests/LListTest.cpp20
-rw-r--r--tests/MallocPixelRefTest.cpp2
-rw-r--r--tests/PathTest.cpp2
-rw-r--r--tests/PictureTest.cpp6
-rw-r--r--tests/RTreeTest.cpp2
-rw-r--r--tests/RecordTestUtils.h2
-rw-r--r--tests/ResourceCacheTest.cpp4
-rw-r--r--tests/SListTest.cpp4
-rw-r--r--tests/SerializationTest.cpp4
-rw-r--r--tests/SkResourceCacheTest.cpp2
-rw-r--r--tests/SurfaceTest.cpp10
-rw-r--r--tests/TextBlobTest.cpp6
-rw-r--r--tests/TextureCompressionTest.cpp12
-rw-r--r--third_party/ktx/ktx.cpp2
-rw-r--r--tools/PictureBenchmark.cpp2
-rw-r--r--tools/PictureRenderer.cpp26
-rw-r--r--tools/filtermain.cpp22
-rw-r--r--tools/flags/SkCommandLineFlags.h2
-rw-r--r--tools/picture_utils.cpp2
-rw-r--r--tools/render_pictures_main.cpp14
-rw-r--r--tools/skdiff_image.cpp4
-rw-r--r--tools/skdiff_main.cpp4
-rw-r--r--tools/skdiff_utils.cpp2
-rw-r--r--tools/skimage_main.cpp4
-rw-r--r--tools/skpdiff/SkDiffContext.cpp12
-rw-r--r--tools/skpdiff/skpdiff_main.cpp2
-rw-r--r--tools/skpdiff/skpdiff_util.cpp2
292 files changed, 1087 insertions, 1094 deletions
diff --git a/bench/ChartBench.cpp b/bench/ChartBench.cpp
index f33d2da398..8d05ef179a 100644
--- a/bench/ChartBench.cpp
+++ b/bench/ChartBench.cpp
@@ -64,7 +64,7 @@ static void gen_paths(const SkTDArray<SkScalar>& topData,
x += xDelta;
}
- if (NULL != bottomData) {
+ if (bottomData) {
SkASSERT(bottomData->count() == topData.count());
// iterate backwards over the previous graph's data to generate the bottom of the filled
// area (and account for leftShift).
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp
index 529f5f69da..36573c8245 100644
--- a/bench/ETCBitmapBench.cpp
+++ b/bench/ETCBitmapBench.cpp
@@ -21,7 +21,7 @@
// This takes the etc1 data pointed to by orig, and copies it `factor` times in each
// dimension. The return value is the new data or NULL on error.
static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
- SkASSERT(NULL != orig);
+ SkASSERT(orig);
SkASSERT(factor > 1);
const etc1_byte* origData = reinterpret_cast<const etc1_byte*>(orig);
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index 068aff22d4..d86ccf4b0b 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -146,7 +146,7 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) {
desc.fHeight |= 1;
GrResourceKey key = TextureResource::ComputeKey(desc);
GrGpuResource* item = cache->find(key);
- if (NULL != item) {
+ if (item) {
SkFAIL("cache add does not work as expected");
return;
}
@@ -157,7 +157,7 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) {
h |= 1;
GrResourceKey key = StencilResource::ComputeKey(w, h, s);
GrGpuResource* item = cache->find(key);
- if (NULL != item) {
+ if (item) {
SkFAIL("cache add does not work as expected");
return;
}
diff --git a/bench/HairlinePathBench.cpp b/bench/HairlinePathBench.cpp
index e7e2b428e8..7b413c4677 100644
--- a/bench/HairlinePathBench.cpp
+++ b/bench/HairlinePathBench.cpp
@@ -181,7 +181,7 @@ public:
#if SK_SUPPORT_GPU
GrContext* context = canvas->getGrContext();
// This is a workaround for skbug.com/2078. See also skbug.com/2033.
- if (NULL != context) {
+ if (context) {
GrTestTarget tt;
context->getTestTarget(&tt);
if (tt.target()->caps()->pathRenderingSupport()) {
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index 56283732ec..f17bce3d93 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -98,7 +98,7 @@ public:
fBench = &fResults[id.c_str()];
}
virtual void config(const char name[]) {
- SkASSERT(NULL != fBench);
+ SkASSERT(fBench);
fConfig = &(*fBench)[name];
}
virtual void configOption(const char name[], const char* value) {
@@ -109,7 +109,7 @@ public:
if (sk_double_isnan(ms)) {
return;
}
- SkASSERT(NULL != fConfig);
+ SkASSERT(fConfig);
(*fConfig)[name] = ms;
}
diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp
index f73943bcf7..54272daf9b 100644
--- a/bench/XfermodeBench.cpp
+++ b/bench/XfermodeBench.cpp
@@ -18,12 +18,12 @@ class XfermodeBench : public Benchmark {
public:
XfermodeBench(SkXfermode::Mode mode) {
fXfermode.reset(SkXfermode::Create(mode));
- SkASSERT(NULL != fXfermode.get() || SkXfermode::kSrcOver_Mode == mode);
+ SkASSERT(fXfermode.get() || SkXfermode::kSrcOver_Mode == mode);
fName.printf("Xfermode_%s", SkXfermode::ModeName(mode));
}
XfermodeBench(SkXfermode* xferMode, const char* name) {
- SkASSERT(NULL != xferMode);
+ SkASSERT(xferMode);
fXfermode.reset(xferMode);
fName.printf("Xfermode_%s", name);
}
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ea62570ea0..452da1f083 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -619,7 +619,7 @@ int nanobench_main() {
#endif
cpu_bench( overhead, bench.get(), canvas, samples.get());
- if (canvas && !FLAGS_writePath.isEmpty() && NULL != FLAGS_writePath[0]) {
+ if (canvas && !FLAGS_writePath.isEmpty() && FLAGS_writePath[0]) {
SkString pngFilename = SkOSPath::Join(FLAGS_writePath[0], config);
pngFilename = SkOSPath::Join(pngFilename.c_str(), bench->getName());
pngFilename.append(".png");
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 1a324fd08b..b03b8f3b16 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -186,7 +186,7 @@ public:
int opIndex = -1;
while (!reader.eof()) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index 8833df3e7b..b2200433b2 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -98,7 +98,7 @@ void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
overview->append(SkDrawCommand::GetCommandString((DrawType) i));
overview->append(": ");
overview->appendS32(counts[i]);
- if (NULL != typeTimes && totTime >= 0.0) {
+ if (typeTimes && totTime >= 0.0) {
overview->append(" - ");
overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns);
overview->append("ms");
@@ -115,7 +115,7 @@ void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
total += counts[i];
}
#ifdef SK_DEBUG
- if (NULL != typeTimes) {
+ if (typeTimes) {
SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(totPercent),
SkDoubleToScalar(100.0)));
SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(tempSum),
diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h
index 9ad21e2450..53b480a28d 100644
--- a/debugger/SkDebugger.h
+++ b/debugger/SkDebugger.h
@@ -100,25 +100,25 @@ public:
}
void setOverdrawViz(bool overDrawViz) {
- if (NULL != fDebugCanvas) {
+ if (fDebugCanvas) {
fDebugCanvas->setOverdrawViz(overDrawViz);
}
}
void setPathOps(bool pathOps) {
- if (NULL != fDebugCanvas) {
+ if (fDebugCanvas) {
fDebugCanvas->setAllowSimplifyClip(pathOps);
}
}
void setMegaViz(bool megaViz) {
- if (NULL != fDebugCanvas) {
+ if (fDebugCanvas) {
fDebugCanvas->setMegaVizMode(megaViz);
}
}
void setTexFilterOverride(bool texFilterOverride, SkPaint::FilterLevel level) {
- if (NULL != fDebugCanvas) {
+ if (fDebugCanvas) {
fDebugCanvas->overrideTexFiltering(texFilterOverride, level);
}
}
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index f150b7c9df..f2e09b028f 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -166,7 +166,7 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- SkASSERT(NULL != tt.target());
+ SkASSERT(tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
@@ -321,7 +321,7 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- SkASSERT(NULL != tt.target());
+ SkASSERT(tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
@@ -505,7 +505,7 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- SkASSERT(NULL != tt.target());
+ SkASSERT(tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index 99dba70d52..aa2b0df8c4 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -212,7 +212,7 @@ protected:
#if SK_SUPPORT_GPU
GrContext* ctx = canvas->getGrContext();
int oldMaxTextureSize = 0;
- if (NULL != ctx) {
+ if (ctx) {
// shrink the max texture size so all our textures can be reasonably sized
oldMaxTextureSize = ctx->getMaxTextureSize();
ctx->setMaxTextureSizeOverride(kMaxTextureSize);
@@ -244,7 +244,7 @@ protected:
this->drawCase4(canvas, kCol6X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel);
#if SK_SUPPORT_GPU
- if (NULL != ctx) {
+ if (ctx) {
ctx->setMaxTextureSizeOverride(oldMaxTextureSize);
}
#endif
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index 35c4426f36..328cdb5207 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -158,7 +158,7 @@ protected:
int testLayers = kBench_Mode != this->getMode();
for (int doLayer = 0; doLayer <= testLayers; ++doLayer) {
for (SkTLList<Clip>::Iter iter(fClips, SkTLList<Clip>::Iter::kHead_IterStart);
- NULL != iter.get();
+ iter.get();
iter.next()) {
const Clip* clip = iter.get();
SkScalar x = startX;
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 275193f326..8d73da5e4d 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -114,7 +114,7 @@ protected:
SkScalar y = 0;
for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_IterStart);
- NULL != iter.get();
+ iter.get();
iter.next()) {
const SkPath* path = iter.get();
SkScalar x = 0;
@@ -172,7 +172,7 @@ protected:
}
for (SkTLList<SkRect>::Iter iter(fRects, SkTLList<SkRect>::Iter::kHead_IterStart);
- NULL != iter.get();
+ iter.get();
iter.next()) {
SkScalar x = 0;
diff --git a/gm/factory.cpp b/gm/factory.cpp
index 608c049dc3..a9bf519c00 100644
--- a/gm/factory.cpp
+++ b/gm/factory.cpp
@@ -32,7 +32,7 @@ protected:
// Copyright-free file from http://openclipart.org/detail/29213/paper-plane-by-ddoo
SkString pngFilename = GetResourcePath("plane.png");
SkAutoDataUnref data(SkData::NewFromFileName(pngFilename.c_str()));
- if (NULL != data.get()) {
+ if (data.get()) {
// Create a cache which will boot the pixels out anytime the
// bitmap is unlocked.
SkAutoTUnref<SkDiscardableMemoryPool> pool(
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 40d616e9f4..94df02ce4d 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -849,7 +849,7 @@ public:
// If we have access to a single expected bitmap, log more
// detail about the mismatch.
const SkBitmap *expectedBitmapPtr = expectations.asBitmap();
- if (NULL != expectedBitmapPtr) {
+ if (expectedBitmapPtr) {
report_bitmap_diffs(*expectedBitmapPtr, actualBitmapAndDigest.fBitmap,
completeName);
}
@@ -1762,7 +1762,7 @@ ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
desc.fHeight = gm->getISize().height();
desc.fSampleCnt = config.fSampleCnt;
auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0));
- if (NULL != auGpuTarget) {
+ if (auGpuTarget) {
gpuTarget = auGpuTarget;
grSuccess = true;
// Set the user specified cache limits if non-default.
@@ -2297,10 +2297,10 @@ int tool_main(int argc, char** argv) {
if (FLAGS_writePath.count() == 1) {
SkDebugf("writing to %s\n", FLAGS_writePath[0]);
}
- if (NULL != gmmain.fMismatchPath) {
+ if (gmmain.fMismatchPath) {
SkDebugf("writing mismatches to %s\n", gmmain.fMismatchPath);
}
- if (NULL != gmmain.fMissingExpectationsPath) {
+ if (gmmain.fMissingExpectationsPath) {
SkDebugf("writing images without expectations to %s\n",
gmmain.fMissingExpectationsPath);
}
@@ -2324,13 +2324,13 @@ int tool_main(int argc, char** argv) {
return -1;
}
}
- if (NULL != gmmain.fMismatchPath) {
+ if (gmmain.fMismatchPath) {
if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarchy,
configs, pdfRasterizers)) {
return -1;
}
}
- if (NULL != gmmain.fMissingExpectationsPath) {
+ if (gmmain.fMissingExpectationsPath) {
if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUseFileHierarchy,
configs, pdfRasterizers)) {
return -1;
diff --git a/gm/image.cpp b/gm/image.cpp
index ff184d18b3..e405a053b2 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -192,7 +192,7 @@ protected:
canvas->translate(80, 0);
test_surface(canvas, surf1, true);
#if SK_SUPPORT_GPU
- if (NULL != ctx) {
+ if (ctx) {
canvas->translate(80, 0);
test_surface(canvas, surf4, true);
}
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 37ed885dd7..8af268e568 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -46,7 +46,7 @@ public:
SkBitmap source = src;
SkImageFilter* input = getInput(0);
SkIPoint srcOffset = SkIPoint::Make(0, 0);
- if (NULL != input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) {
+ if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) {
return false;
}
diff --git a/gm/samplerstress.cpp b/gm/samplerstress.cpp
index c395b08ba1..29be6843f9 100644
--- a/gm/samplerstress.cpp
+++ b/gm/samplerstress.cpp
@@ -71,7 +71,7 @@ protected:
}
void createShader() {
- if (NULL != fShader.get()) {
+ if (fShader.get()) {
return;
}
@@ -83,7 +83,7 @@ protected:
}
void createMaskFilter() {
- if (NULL != fMaskFilter.get()) {
+ if (fMaskFilter.get()) {
return;
}
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index e3e1629298..74ca643b23 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -125,7 +125,7 @@ private:
SkCanvas* tempCanvas = NULL;
#if SK_SUPPORT_GPU
GrContext* context = baseCanvas->getGrContext();
- if (NULL != context) {
+ if (context) {
GrTextureDesc desc;
desc.fWidth = w;
desc.fHeight = h;
@@ -133,7 +133,7 @@ private:
desc.fFlags = kRenderTarget_GrTextureFlagBit;
SkAutoTUnref<GrSurface> surface(context->createUncachedTexture(desc, NULL, 0));
SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(surface.get()));
- if (NULL != device.get()) {
+ if (device.get()) {
tempCanvas = SkNEW_ARGS(SkCanvas, (device.get()));
}
}
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 4e512c0535..b36a1fd3fd 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -444,7 +444,7 @@ public:
*/
bool readyToDraw() const {
return this->getPixels() != NULL &&
- (this->colorType() != kIndex_8_SkColorType || NULL != fColorTable);
+ (this->colorType() != kIndex_8_SkColorType || fColorTable);
}
/** Returns the pixelRef's texture, or NULL
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 6b2266a00e..f514d18b5e 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1442,13 +1442,13 @@ class SkAutoCommentBlock : SkNoncopyable {
public:
SkAutoCommentBlock(SkCanvas* canvas, const char* description) {
fCanvas = canvas;
- if (NULL != fCanvas) {
+ if (fCanvas) {
fCanvas->beginCommentGroup(description);
}
}
~SkAutoCommentBlock() {
- if (NULL != fCanvas) {
+ if (fCanvas) {
fCanvas->endCommentGroup();
}
}
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index d2fb737eb6..9f44bed9c4 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -349,7 +349,7 @@ public:
bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const {
// Allow the trivial case to be inlined.
if (this->isIdentity()) {
- if (NULL != inverse) {
+ if (inverse) {
inverse->reset();
}
return true;
diff --git a/include/core/SkMetaData.h b/include/core/SkMetaData.h
index 5db437c980..c8ca7f1419 100644
--- a/include/core/SkMetaData.h
+++ b/include/core/SkMetaData.h
@@ -81,7 +81,7 @@ public:
bool hasData(const char name[], const void* data, size_t byteCount) const {
size_t len;
const void* ptr = this->findData(name, &len);
- return NULL != ptr && len == byteCount && !memcmp(ptr, data, len);
+ return ptr && len == byteCount && !memcmp(ptr, data, len);
}
void setS32(const char name[], int32_t value);
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h
index ba68fcba3c..0b661b44cb 100644
--- a/include/core/SkPathRef.h
+++ b/include/core/SkPathRef.h
@@ -144,7 +144,7 @@ public:
* fact ovals can report false.
*/
bool isOval(SkRect* rect) const {
- if (fIsOval && NULL != rect) {
+ if (fIsOval && rect) {
*rect = getBounds();
}
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index ce38c67bd5..f092e778f3 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -168,7 +168,7 @@ template <typename T> static inline void SkSafeUnref(T* obj) {
}
template<typename T> static inline void SkSafeSetNull(T*& obj) {
- if (NULL != obj) {
+ if (obj) {
obj->unref();
obj = NULL;
}
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h
index 6c76c78094..06a85bc439 100644
--- a/include/core/SkTArray.h
+++ b/include/core/SkTArray.h
@@ -384,7 +384,7 @@ protected:
gMIN_ALLOC_COUNT;
fPreAllocMemArray = preAllocStorage;
if (fReserveCount >= fCount &&
- NULL != preAllocStorage) {
+ preAllocStorage) {
fAllocCount = fReserveCount;
fMemArray = preAllocStorage;
} else {
@@ -427,7 +427,7 @@ private:
fAllocCount = newAllocCount;
char* newMemArray;
- if (fAllocCount == fReserveCount && NULL != fPreAllocMemArray) {
+ if (fAllocCount == fReserveCount && fPreAllocMemArray) {
newMemArray = (char*) fPreAllocMemArray;
} else {
newMemArray = (char*) sk_malloc_throw(fAllocCount*sizeof(T));
diff --git a/include/core/SkTInternalLList.h b/include/core/SkTInternalLList.h
index 1c82a71cda..1aa1a12209 100644
--- a/include/core/SkTInternalLList.h
+++ b/include/core/SkTInternalLList.h
@@ -46,18 +46,18 @@ public:
}
void remove(T* entry) {
- SkASSERT(NULL != fHead && NULL != fTail);
+ SkASSERT(fHead && fTail);
SkASSERT(this->isInList(entry));
T* prev = entry->fPrev;
T* next = entry->fNext;
- if (NULL != prev) {
+ if (prev) {
prev->fNext = next;
} else {
fHead = next;
}
- if (NULL != next) {
+ if (next) {
next->fPrev = prev;
} else {
fTail = prev;
@@ -77,7 +77,7 @@ public:
entry->fPrev = NULL;
entry->fNext = fHead;
- if (NULL != fHead) {
+ if (fHead) {
fHead->fPrev = entry;
}
fHead = entry;
@@ -96,7 +96,7 @@ public:
entry->fPrev = fTail;
entry->fNext = NULL;
- if (NULL != fTail) {
+ if (fTail) {
fTail->fNext = entry;
}
fTail = entry;
@@ -115,7 +115,7 @@ public:
* at the tail.
*/
void addBefore(T* newEntry, T* existingEntry) {
- SkASSERT(NULL != newEntry);
+ SkASSERT(newEntry);
if (NULL == existingEntry) {
this->addToTail(newEntry);
@@ -144,7 +144,7 @@ public:
* at the head.
*/
void addAfter(T* newEntry, T* existingEntry) {
- SkASSERT(NULL != newEntry);
+ SkASSERT(newEntry);
if (NULL == existingEntry) {
this->addToHead(newEntry);
@@ -227,7 +227,7 @@ public:
void validate() const {
SkASSERT(!fHead == !fTail);
Iter iter;
- for (T* item = iter.init(*this, Iter::kHead_IterStart); NULL != item; item = iter.next()) {
+ for (T* item = iter.init(*this, Iter::kHead_IterStart); item; item = iter.next()) {
SkASSERT(this->isInList(item));
if (NULL == item->fPrev) {
SkASSERT(fHead == item);
@@ -255,7 +255,7 @@ public:
*/
int countEntries() const {
int count = 0;
- for (T* entry = fHead; NULL != entry; entry = entry->fNext) {
+ for (T* entry = fHead; entry; entry = entry->fNext) {
++count;
}
return count;
diff --git a/include/core/SkTLazy.h b/include/core/SkTLazy.h
index a291e22a13..a1dc0013fc 100644
--- a/include/core/SkTLazy.h
+++ b/include/core/SkTLazy.h
@@ -88,7 +88,7 @@ public:
* Returns true if a valid object has been initialized in the SkTLazy,
* false otherwise.
*/
- bool isValid() const { return NULL != fPtr; }
+ bool isValid() const { return SkToBool(fPtr); }
/**
* Returns the object. This version should only be called when the caller
@@ -166,7 +166,7 @@ public:
* Returns a writable T*. The first time this is called the initial object is cloned.
*/
T* writable() {
- SkASSERT(NULL != fObj);
+ SkASSERT(fObj);
if (!fLazy.isValid()) {
fLazy.set(*fObj);
fObj = fLazy.get();
diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h
index f561f4616c..5ef28ea4e5 100644
--- a/include/core/SkTemplates.h
+++ b/include/core/SkTemplates.h
@@ -170,7 +170,7 @@ template <typename T> class SkAutoTDestroy : SkNoncopyable {
public:
SkAutoTDestroy(T* obj = NULL) : fObj(obj) {}
~SkAutoTDestroy() {
- if (NULL != fObj) {
+ if (fObj) {
fObj->~T();
}
}
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index bdd2e930ae..0e9e230349 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -539,7 +539,7 @@ public:
*/
void* reset(size_t size, OnShrink shrink = kAlloc_OnShrink, bool* didChangeAlloc = NULL) {
if (size == fSize || (kReuse_OnShrink == shrink && size < fSize)) {
- if (NULL != didChangeAlloc) {
+ if (didChangeAlloc) {
*didChangeAlloc = false;
}
return fPtr;
@@ -548,7 +548,7 @@ public:
sk_free(fPtr);
fPtr = size ? sk_malloc_throw(size) : NULL;
fSize = size;
- if (NULL != didChangeAlloc) {
+ if (didChangeAlloc) {
*didChangeAlloc = true;
}
@@ -643,7 +643,7 @@ public:
bool* didChangeAlloc = NULL) {
size = (size < kSize) ? kSize : size;
bool alloc = size != fSize && (SkAutoMalloc::kAlloc_OnShrink == shrink || size > fSize);
- if (NULL != didChangeAlloc) {
+ if (didChangeAlloc) {
*didChangeAlloc = alloc;
}
if (alloc) {
diff --git a/include/gpu/GrClipData.h b/include/gpu/GrClipData.h
index 1dc4b0d5f8..12a23b3348 100644
--- a/include/gpu/GrClipData.h
+++ b/include/gpu/GrClipData.h
@@ -35,7 +35,7 @@ public:
return false;
}
- if (NULL != fClipStack && NULL != other.fClipStack) {
+ if (fClipStack && other.fClipStack) {
return *fClipStack == *other.fClipStack;
}
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 4f9b642b23..4172543b5e 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -745,7 +745,7 @@ public:
fContext = context;
}
~AutoRenderTarget() {
- if (NULL != fContext) {
+ if (fContext) {
fContext->setRenderTarget(fPrevTarget);
}
SkSafeUnref(fPrevTarget);
@@ -779,7 +779,7 @@ public:
* Initializes by pre-concat'ing the context's current matrix with the preConcat param.
*/
void setPreConcat(GrContext* context, const SkMatrix& preConcat, GrPaint* paint = NULL) {
- SkASSERT(NULL != context);
+ SkASSERT(context);
this->restore();
@@ -793,11 +793,11 @@ public:
* update a paint but the matrix cannot be inverted.
*/
bool setIdentity(GrContext* context, GrPaint* paint = NULL) {
- SkASSERT(NULL != context);
+ SkASSERT(context);
this->restore();
- if (NULL != paint) {
+ if (paint) {
if (!paint->localCoordChangeInverse(context->getMatrix())) {
return false;
}
@@ -813,7 +813,7 @@ public:
* required to update a paint but the matrix cannot be inverted.
*/
bool set(GrContext* context, const SkMatrix& newMatrix, GrPaint* paint = NULL) {
- if (NULL != paint) {
+ if (paint) {
if (!this->setIdentity(context, paint)) {
return false;
}
@@ -835,7 +835,7 @@ public:
* performs an incremental update of the paint.
*/
void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) {
- if (NULL != paint) {
+ if (paint) {
paint->localCoordChange(preConcat);
}
fContext->concatMatrix(preConcat);
@@ -845,13 +845,13 @@ public:
* Returns false if never initialized or the inverse matrix was required to update a paint
* but the matrix could not be inverted.
*/
- bool succeeded() const { return NULL != fContext; }
+ bool succeeded() const { return SkToBool(fContext); }
/**
* If this has been initialized then the context's original matrix is restored.
*/
void restore() {
- if (NULL != fContext) {
+ if (fContext) {
fContext->setMatrix(fMatrix);
fContext = NULL;
}
@@ -890,7 +890,7 @@ public:
}
~AutoClip() {
- if (NULL != fContext) {
+ if (fContext) {
fContext->setClip(fOldClip);
}
}
@@ -1091,7 +1091,7 @@ public:
}
void reset() {
- if (NULL != fContext && NULL != fTexture) {
+ if (fContext && fTexture) {
fContext->unlockScratchTexture(fTexture);
fTexture->unref();
fTexture = NULL;
@@ -1124,7 +1124,7 @@ public:
SkASSERT(!texture->unique());
texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit);
texture->unref();
- SkASSERT(NULL != texture->getCacheEntry());
+ SkASSERT(texture->getCacheEntry());
return texture;
}
@@ -1135,7 +1135,7 @@ public:
this->reset();
fContext = context;
- if (NULL != fContext) {
+ if (fContext) {
fTexture = fContext->lockAndRefScratchTexture(desc, match);
if (NULL == fTexture) {
fContext = NULL;
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index bc06594c80..d78120ccb0 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -95,11 +95,11 @@ public:
void destroyContexts() {
for (int i = 0; i < fContexts.count(); ++i) {
- if (NULL != fContexts[i].fGLContext) { // could be abandoned.
+ if (fContexts[i].fGLContext) { // could be abandoned.
fContexts[i].fGLContext->makeCurrent();
}
fContexts[i].fGrContext->unref();
- if (NULL != fContexts[i].fGLContext) {
+ if (fContexts[i].fGLContext) {
fContexts[i].fGLContext->unref();
}
}
@@ -108,7 +108,7 @@ public:
void abandonContexts() {
for (int i = 0; i < fContexts.count(); ++i) {
- if (NULL != fContexts[i].fGLContext) {
+ if (fContexts[i].fGLContext) {
fContexts[i].fGLContext->testAbandon();
SkSafeSetNull(fContexts[i].fGLContext);
}
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h
index 0bd7da0a0d..734c26fae9 100644
--- a/include/gpu/GrCoordTransform.h
+++ b/include/gpu/GrCoordTransform.h
@@ -63,7 +63,7 @@ public:
void reset(GrCoordSet sourceCoords, const GrTexture* texture) {
SkASSERT(!fInEffect);
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
this->reset(sourceCoords, MakeDivByTextureWHMatrix(texture), texture);
}
@@ -71,7 +71,7 @@ public:
SkASSERT(!fInEffect);
fSourceCoords = sourceCoords;
fMatrix = m;
- fReverseY = NULL != texture && kBottomLeft_GrSurfaceOrigin == texture->origin();
+ fReverseY = texture && kBottomLeft_GrSurfaceOrigin == texture->origin();
}
GrCoordTransform& operator= (const GrCoordTransform& other) {
@@ -104,7 +104,7 @@ public:
/** Useful for effects that want to insert a texture matrix that is implied by the texture
dimensions */
static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
SkMatrix mat;
mat.setIDiv(texture->width(), texture->height());
return mat;
diff --git a/include/gpu/GrDrawEffect.h b/include/gpu/GrDrawEffect.h
index 6aff82ef50..2bf17d86d1 100644
--- a/include/gpu/GrDrawEffect.h
+++ b/include/gpu/GrDrawEffect.h
@@ -21,8 +21,8 @@ public:
GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
: fEffectStage(&stage)
, fExplicitLocalCoords(explicitLocalCoords) {
- SkASSERT(NULL != fEffectStage);
- SkASSERT(NULL != fEffectStage->getEffect());
+ SkASSERT(fEffectStage);
+ SkASSERT(fEffectStage->getEffect());
}
const GrEffect* effect() const { return fEffectStage->getEffect(); }
diff --git a/include/gpu/GrEffectStage.h b/include/gpu/GrEffectStage.h
index 65c7bebdc7..f4cee51417 100644
--- a/include/gpu/GrEffectStage.h
+++ b/include/gpu/GrEffectStage.h
@@ -43,8 +43,8 @@ public:
static bool AreCompatible(const GrEffectStage& a, const GrEffectStage& b,
bool usingExplicitLocalCoords) {
- SkASSERT(NULL != a.fEffect.get());
- SkASSERT(NULL != b.fEffect.get());
+ SkASSERT(a.fEffect.get());
+ SkASSERT(b.fEffect.get());
if (!a.getEffect()->isEqual(*b.getEffect())) {
return false;
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index c81e022618..626f027ff3 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -186,7 +186,7 @@ protected:
GrGpuResource(GrGpu*, bool isWrapped);
virtual ~GrGpuResource();
- bool isInCache() const { return NULL != fCacheEntry; }
+ bool isInCache() const { return SkToBool(fCacheEntry); }
GrGpu* getGpu() const { return fGpu; }
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 20dec35b5b..900ab4c407 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -88,7 +88,7 @@ public:
* Appends an additional color effect to the color computation.
*/
const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) {
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
if (!effect->willUseInputColor()) {
fColorStages.reset();
}
@@ -100,7 +100,7 @@ public:
* Appends an additional coverage effect to the coverage computation.
*/
const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) {
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
if (!effect->willUseInputColor()) {
fCoverageStages.reset();
}
diff --git a/include/gpu/GrProgramElementRef.h b/include/gpu/GrProgramElementRef.h
index ea11f4446c..1e3b4f8ebe 100644
--- a/include/gpu/GrProgramElementRef.h
+++ b/include/gpu/GrProgramElementRef.h
@@ -55,7 +55,7 @@ public:
}
~GrProgramElementRef() {
- if (NULL != fObj) {
+ if (fObj) {
if (fOwnPendingExec) {
fObj->completedExecution();
} else {
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index 6a3f26fe70..4c5ec18211 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -162,7 +162,7 @@ private:
friend class GrTexture;
// called by ~GrTexture to remove the non-ref'ed back ptr.
void owningTextureDestroyed() {
- SkASSERT(NULL != fTexture);
+ SkASSERT(fTexture);
fTexture = NULL;
}
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 6087ef44b3..8315c63fbf 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -80,11 +80,11 @@ public:
*/
bool isSameAs(const GrSurface* other) const {
const GrRenderTarget* thisRT = this->asRenderTarget();
- if (NULL != thisRT) {
+ if (thisRT) {
return thisRT == other->asRenderTarget();
} else {
const GrTexture* thisTex = this->asTexture();
- SkASSERT(NULL != thisTex); // We must be one or the other
+ SkASSERT(thisTex); // We must be one or the other
return thisTex == other->asTexture();
}
}
diff --git a/include/gpu/gl/SkGLContextHelper.h b/include/gpu/gl/SkGLContextHelper.h
index 8eab62e52c..c4d9bdf997 100644
--- a/include/gpu/gl/SkGLContextHelper.h
+++ b/include/gpu/gl/SkGLContextHelper.h
@@ -46,7 +46,7 @@ public:
virtual void swapBuffers() const = 0;
bool hasExtension(const char* extensionName) const {
- SkASSERT(NULL != fGL);
+ SkASSERT(fGL);
return fGL->hasExtension(extensionName);
}
diff --git a/include/pipe/SkGPipe.h b/include/pipe/SkGPipe.h
index 879ab043ff..98e081da5e 100644
--- a/include/pipe/SkGPipe.h
+++ b/include/pipe/SkGPipe.h
@@ -99,7 +99,7 @@ public:
SkGPipeWriter();
~SkGPipeWriter();
- bool isRecording() const { return NULL != fCanvas; }
+ bool isRecording() const { return SkToBool(fCanvas); }
enum Flags {
/**
diff --git a/include/utils/win/SkTScopedComPtr.h b/include/utils/win/SkTScopedComPtr.h
index 8f18a42481..38d104878b 100644
--- a/include/utils/win/SkTScopedComPtr.h
+++ b/include/utils/win/SkTScopedComPtr.h
@@ -54,7 +54,7 @@ public:
T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; }
T *get() const { return fPtr; }
void reset() {
- if (NULL != this->fPtr) {
+ if (this->fPtr) {
this->fPtr->Release();
this->fPtr = NULL;
}
diff --git a/include/views/SkView.h b/include/views/SkView.h
index d03c7415eb..c083cf1bb8 100644
--- a/include/views/SkView.h
+++ b/include/views/SkView.h
@@ -210,7 +210,7 @@ public:
* Return true on success; false on failure
*/
bool globalToLocal(SkPoint* pt) const {
- if (NULL != pt) {
+ if (pt) {
return this->globalToLocal(pt->fX, pt->fY, pt);
}
return true; // nothing to do so return true
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 9c9b34384c..9d7e727ce5 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -274,7 +274,7 @@ public:
virtual SkCanvas* createCanvas(SampleWindow::DeviceType dType,
SampleWindow* win) {
#if SK_SUPPORT_GPU
- if (IsGpuDeviceType(dType) && NULL != fCurContext) {
+ if (IsGpuDeviceType(dType) && fCurContext) {
SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(fCurRenderTarget));
return new SkCanvas(device);
} else
@@ -2053,7 +2053,7 @@ void SampleWindow::updateTitle() {
#if SK_SUPPORT_GPU
if (IsGpuDeviceType(fDeviceType) &&
- NULL != fDevManager &&
+ fDevManager &&
fDevManager->getGrRenderTarget() &&
fDevManager->getGrRenderTarget()->numSamples() > 0) {
title.appendf(" [MSAA: %d]",
diff --git a/samplecode/SampleChart.cpp b/samplecode/SampleChart.cpp
index 630ff6edc3..12a6afe0e3 100644
--- a/samplecode/SampleChart.cpp
+++ b/samplecode/SampleChart.cpp
@@ -60,7 +60,7 @@ static void gen_paths(const SkTDArray<SkScalar>& topData,
x += xDelta;
}
- if (NULL != bottomData) {
+ if (bottomData) {
SkASSERT(bottomData->count() == topData.count());
// iterate backwards over the previous graph's data to generate the bottom of the filled
// area (and account for leftShift).
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index f4157cd6b5..a996a4bc27 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -435,7 +435,7 @@ static void do_fuzz(SkCanvas* canvas) {
printf("Fuzzing with %u\n", kSeed);
}
numFilters++;
- if (NULL != filter) {
+ if (filter) {
numValidFilters++;
}
printf("Filter no : %u. Valid filters so far : %u\r", numFilters, numValidFilters);
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index 6bb9c74346..4f073bdd5e 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -102,7 +102,7 @@ protected:
textCanvas = recorder.beginRecording(1000, 1000, NULL, 0);
}
- if (NULL != textCanvas) {
+ if (textCanvas) {
for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
SkPaint p;
@@ -139,7 +139,7 @@ protected:
x += r.width() * 4 / 3;
}
}
- if (NULL != textCanvas) {
+ if (textCanvas) {
SkPaint p;
SkString str;
p.setAntiAlias(true);
@@ -152,12 +152,12 @@ protected:
}
}
- if (NULL != textCanvas) {
+ if (textCanvas) {
SkASSERT(NULL == fTextPicture);
fTextPicture.reset(recorder.endRecording());
}
- SkASSERT(NULL != fTextPicture);
+ SkASSERT(fTextPicture);
canvas->drawPicture(fTextPicture);
}
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index f4e79fa828..4712abb2b2 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -34,9 +34,9 @@ SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* b
SaveFlags flags) {
// For now, assume all filters affect transparent black.
// FIXME: This could be made less conservative as an optimization.
- bool paintAffectsTransparentBlack = NULL != paint &&
- ((NULL != paint->getImageFilter()) ||
- (NULL != paint->getColorFilter()));
+ bool paintAffectsTransparentBlack = paint &&
+ ((paint->getImageFilter()) ||
+ (paint->getColorFilter()));
SkRect drawBounds;
if (paintAffectsTransparentBlack) {
SkIRect deviceBounds;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index adb69da1de..e28c6fdc34 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -153,12 +153,12 @@ bool SkBitmap::setAlphaType(SkAlphaType newAlphaType) {
}
void SkBitmap::updatePixelsFromRef() const {
- if (NULL != fPixelRef) {
+ if (fPixelRef) {
if (fPixelLockCount > 0) {
SkASSERT(fPixelRef->isLocked());
void* p = fPixelRef->pixels();
- if (NULL != p) {
+ if (p) {
p = (char*)p
+ fPixelRefOrigin.fY * fRowBytes
+ fPixelRefOrigin.fX * fInfo.bytesPerPixel();
@@ -221,7 +221,7 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, int dx, int dy) {
}
void SkBitmap::lockPixels() const {
- if (NULL != fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) {
+ if (fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) {
fPixelRef->lockPixels();
this->updatePixelsFromRef();
}
@@ -231,7 +231,7 @@ void SkBitmap::lockPixels() const {
void SkBitmap::unlockPixels() const {
SkASSERT(NULL == fPixelRef || fPixelLockCount > 0);
- if (NULL != fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) {
+ if (fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) {
fPixelRef->unlockPixels();
this->updatePixelsFromRef();
}
@@ -376,7 +376,7 @@ bool SkBitmap::installMaskPixels(const SkMask& mask) {
///////////////////////////////////////////////////////////////////////////////
void SkBitmap::freePixels() {
- if (NULL != fPixelRef) {
+ if (fPixelRef) {
if (fPixelLockCount > 0) {
fPixelRef->unlockPixels();
}
@@ -1103,7 +1103,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
SkMaskFilter* filter = paint ? paint->getMaskFilter() : NULL;
// compute our (larger?) dst bounds if we have a filter
- if (NULL != filter) {
+ if (filter) {
identity.reset();
srcM.fImage = NULL;
if (!filter->filterMask(&dstM, srcM, identity, NULL)) {
@@ -1366,7 +1366,7 @@ void SkBitmap::toString(SkString* str) const {
str->appendf(" pixels:%p", this->getPixels());
} else {
const char* uri = pr->getURI();
- if (NULL != uri) {
+ if (uri) {
str->appendf(" uri:\"%s\"", uri);
} else {
str->appendf(" pixelref:%p", pr);
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 068a107153..6c1dc30449 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -188,12 +188,12 @@ bool SkBitmapProcState::possiblyScaleImage() {
}
- SkASSERT(NULL != fScaledBitmap.getPixels());
+ SkASSERT(fScaledBitmap.getPixels());
fScaledBitmap.setImmutable();
SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight, fScaledBitmap);
}
- SkASSERT(NULL != fScaledBitmap.getPixels());
+ SkASSERT(fScaledBitmap.getPixels());
fBitmap = &fScaledBitmap;
// set the inv matrix type to translate-only;
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index 0fd2c7baf3..3501ac8a87 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -315,7 +315,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
*resultPtr = result;
resultPtr->lockPixels();
- SkASSERT(NULL != resultPtr->getPixels());
+ SkASSERT(resultPtr->getPixels());
return true;
}
diff --git a/src/core/SkBitmap_scroll.cpp b/src/core/SkBitmap_scroll.cpp
index 00a72aa1ca..54158c2bec 100644
--- a/src/core/SkBitmap_scroll.cpp
+++ b/src/core/SkBitmap_scroll.cpp
@@ -15,7 +15,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
return false;
}
- if (NULL != subset) {
+ if (subset) {
SkBitmap tmp;
return this->extractSubset(&tmp, *subset) &&
@@ -29,14 +29,14 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
// check if there's nothing to do
if ((dx | dy) == 0 || width <= 0 || height <= 0) {
- if (NULL != inval) {
+ if (inval) {
inval->setEmpty();
}
return true;
}
// compute the inval region now, before we see if there are any pixels
- if (NULL != inval) {
+ if (inval) {
SkIRect r;
r.set(0, 0, width, height);
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index b2da6aec6a..b9e9917891 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -700,7 +700,7 @@ public:
virtual void toString(SkString* str) const SK_OVERRIDE {
str->append("Sk3DShader: (");
- if (NULL != fProxy) {
+ if (fProxy) {
str->append("Proxy: ");
fProxy->toString(str);
}
@@ -875,7 +875,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
shader = shader3D;
}
- if (NULL != mode) {
+ if (mode) {
switch (interpret_xfermode(*paint, mode, device.colorType())) {
case kSrcOver_XferInterp:
mode = NULL;
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index a91c0df0de..8771c199ef 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -1037,7 +1037,7 @@ SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
SkXfermode* mode = paint.getXfermode();
// we require a shader if there is an xfermode, handled by our caller
- SkASSERT(NULL == mode || NULL != shader);
+ SkASSERT(NULL == mode || shader);
if (shader) {
SkASSERT(shaderContext != NULL);
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 87cadf4bba..cdc9489afc 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -83,7 +83,7 @@ struct DeviceCM {
DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
: fNext(NULL) {
- if (NULL != device) {
+ if (device) {
device->ref();
device->onAttachToCanvas(canvas);
}
@@ -92,7 +92,7 @@ struct DeviceCM {
}
~DeviceCM() {
- if (NULL != fDevice) {
+ if (fDevice) {
fDevice->onDetachFromCanvas();
fDevice->unref();
}
@@ -165,7 +165,7 @@ public:
DeviceCM* fTopLayer;
MCRec(const MCRec* prev) {
- if (NULL != prev) {
+ if (prev) {
fMatrix = prev->fMatrix;
fRasterClip = prev->fRasterClip;
@@ -769,7 +769,7 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
op = SkRegion::kReplace_Op;
}
SkIRect ir;
- if (NULL != bounds) {
+ if (bounds) {
SkRect r;
this->getTotalMatrix().mapRect(&r, *bounds);
@@ -923,7 +923,7 @@ void SkCanvas::internalRestore() {
since if we're being recorded, we don't want to record this (the
recorder will have already recorded the restore).
*/
- if (NULL != layer) {
+ if (layer) {
if (layer->fNext) {
const SkIPoint& origin = layer->fDevice->getOrigin();
this->internalDrawDevice(layer->fDevice, origin.x(), origin.y(),
@@ -1647,7 +1647,7 @@ bool SkCanvas::getClipBounds(SkRect* bounds) const {
return false;
}
- if (NULL != bounds) {
+ if (bounds) {
SkRect r;
// adjust it outwards in case we are antialiasing
const int inset = 1;
@@ -1668,7 +1668,7 @@ bool SkCanvas::getClipDeviceBounds(SkIRect* bounds) const {
return false;
}
- if (NULL != bounds) {
+ if (bounds) {
*bounds = clip.getBounds();
}
return true;
@@ -1695,9 +1695,9 @@ SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) {
GrContext* SkCanvas::getGrContext() {
#if SK_SUPPORT_GPU
SkBaseDevice* device = this->getTopDevice();
- if (NULL != device) {
+ if (device) {
GrRenderTarget* renderTarget = device->accessRenderTarget();
- if (NULL != renderTarget) {
+ if (renderTarget) {
return renderTarget->getContext();
}
}
@@ -1740,7 +1740,7 @@ void SkCanvas::clear(SkColor color) {
}
void SkCanvas::onDiscard() {
- if (NULL != fSurfaceBase) {
+ if (fSurfaceBase) {
fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode);
}
}
@@ -2244,7 +2244,7 @@ void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath&
}
void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
- if (NULL != blob) {
+ if (blob) {
this->onDrawTextBlob(blob, x, y, paint);
}
}
@@ -2412,19 +2412,19 @@ void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
///////////////////////////////////////////////////////////////////////////////
void SkCanvas::EXPERIMENTAL_optimize(const SkPicture* picture) {
SkBaseDevice* device = this->getDevice();
- if (NULL != device) {
+ if (device) {
device->EXPERIMENTAL_optimize(picture);
}
}
void SkCanvas::drawPicture(const SkPicture* picture) {
- if (NULL != picture) {
+ if (picture) {
this->onDrawPicture(picture, NULL, NULL);
}
}
void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {
- if (NULL != picture) {
+ if (picture) {
if (matrix && matrix->isIdentity()) {
matrix = NULL;
}
@@ -2435,7 +2435,7 @@ void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con
void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
const SkPaint* paint) {
SkBaseDevice* device = this->getTopDevice();
- if (NULL != device) {
+ if (device) {
// Canvas has to first give the device the opportunity to render
// the picture itself.
if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) {
@@ -2551,17 +2551,17 @@ SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri
: fCanvas(canvas)
, fSaveCount(canvas->getSaveCount())
{
- if (NULL != paint) {
+ if (paint) {
SkRect newBounds = bounds;
if (matrix) {
matrix->mapRect(&newBounds);
}
canvas->saveLayer(&newBounds, paint);
- } else if (NULL != matrix) {
+ } else if (matrix) {
canvas->save();
}
- if (NULL != matrix) {
+ if (matrix) {
canvas->concat(*matrix);
}
}
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 85746b2eaf..3093c314f4 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -597,7 +597,7 @@ void SkClipStack::restoreTo(int saveCount) {
void SkClipStack::getBounds(SkRect* canvFiniteBound,
BoundsType* boundType,
bool* isIntersectionOfRects) const {
- SkASSERT(NULL != canvFiniteBound && NULL != boundType);
+ SkASSERT(canvFiniteBound && boundType);
Element* element = (Element*)fDeque.back();
@@ -605,7 +605,7 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound,
// the clip is wide open - the infinite plane w/ no pixels un-writeable
canvFiniteBound->setEmpty();
*boundType = kInsideOut_BoundsType;
- if (NULL != isIntersectionOfRects) {
+ if (isIntersectionOfRects) {
*isIntersectionOfRects = false;
}
return;
@@ -613,13 +613,13 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound,
*canvFiniteBound = element->fFiniteBound;
*boundType = element->fFiniteBoundType;
- if (NULL != isIntersectionOfRects) {
+ if (isIntersectionOfRects) {
*isIntersectionOfRects = element->fIsIntersectionOfRects;
}
}
bool SkClipStack::intersectRectWithClip(SkRect* rect) const {
- SkASSERT(NULL != rect);
+ SkASSERT(rect);
SkRect bounds;
SkClipStack::BoundsType bt;
@@ -667,7 +667,7 @@ void SkClipStack::pushElement(const Element& element) {
SkDeque::Iter iter(fDeque, SkDeque::Iter::kBack_IterStart);
Element* prior = (Element*) iter.prev();
- if (NULL != prior) {
+ if (prior) {
if (prior->canBeIntersectedInPlace(fSaveCount, element.getOp())) {
switch (prior->fType) {
case Element::kEmpty_Type:
@@ -766,7 +766,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
const SkClipStack::Element* element = NULL;
for (element = (const SkClipStack::Element*) fIter.prev();
- NULL != element;
+ element;
element = (const SkClipStack::Element*) fIter.prev()) {
if (op == element->fOp) {
@@ -806,7 +806,7 @@ void SkClipStack::getConservativeBounds(int offsetX,
int maxHeight,
SkRect* devBounds,
bool* isIntersectionOfRects) const {
- SkASSERT(NULL != devBounds);
+ SkASSERT(devBounds);
devBounds->setLTRB(0, 0,
SkIntToScalar(maxWidth), SkIntToScalar(maxHeight));
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index b8e7b059e8..4d0a7950b2 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -31,7 +31,7 @@ SkColorTable::SkColorTable(const SkColorTable& src) : INHERITED() {
SkColorTable::SkColorTable(const SkPMColor colors[], int count, SkAlphaType at)
: f16BitCache(NULL), fAlphaType(SkToU8(at))
{
- SkASSERT(0 == count || NULL != colors);
+ SkASSERT(0 == count || colors);
if (count < 0) {
count = 0;
diff --git a/src/core/SkDeque.cpp b/src/core/SkDeque.cpp
index d210dcf20b..27f3efcba4 100644
--- a/src/core/SkDeque.cpp
+++ b/src/core/SkDeque.cpp
@@ -100,7 +100,7 @@ void* SkDeque::push_front() {
SkASSERT(NULL == fBack);
fFront = fBack = begin;
} else {
- SkASSERT(NULL != fBack);
+ SkASSERT(fBack);
fFront = begin;
}
@@ -141,7 +141,7 @@ void* SkDeque::push_back() {
SkASSERT(NULL == fFront);
fFront = fBack = end;
} else {
- SkASSERT(NULL != fFront);
+ SkASSERT(fFront);
fBack = end;
}
@@ -169,14 +169,14 @@ void SkDeque::pop_front() {
if (begin < fFrontBlock->fEnd) {
first->fBegin = begin;
- SkASSERT(NULL != first->fBegin);
+ SkASSERT(first->fBegin);
fFront = first->fBegin;
} else {
first->fBegin = first->fEnd = NULL; // mark as empty
if (NULL == first->fNext) {
fFront = fBack = NULL;
} else {
- SkASSERT(NULL != first->fNext->fBegin);
+ SkASSERT(first->fNext->fBegin);
fFront = first->fNext->fBegin;
}
}
@@ -203,14 +203,14 @@ void SkDeque::pop_back() {
if (end > last->fBegin) {
last->fEnd = end;
- SkASSERT(NULL != last->fEnd);
+ SkASSERT(last->fEnd);
fBack = last->fEnd - fElemSize;
} else {
last->fBegin = last->fEnd = NULL; // mark as empty
if (NULL == last->fPrev) {
fFront = fBack = NULL;
} else {
- SkASSERT(NULL != last->fPrev->fEnd);
+ SkASSERT(last->fPrev->fEnd);
fBack = last->fPrev->fEnd - fElemSize;
}
}
@@ -293,14 +293,14 @@ void SkDeque::Iter::reset(const SkDeque& d, IterStart startLoc) {
if (kFront_IterStart == startLoc) {
// initialize the iterator to start at the front
fCurBlock = d.fFrontBlock;
- while (NULL != fCurBlock && NULL == fCurBlock->fBegin) {
+ while (fCurBlock && NULL == fCurBlock->fBegin) {
fCurBlock = fCurBlock->fNext;
}
fPos = fCurBlock ? fCurBlock->fBegin : NULL;
} else {
// initialize the iterator to start at the back
fCurBlock = d.fBackBlock;
- while (NULL != fCurBlock && NULL == fCurBlock->fEnd) {
+ while (fCurBlock && NULL == fCurBlock->fEnd) {
fCurBlock = fCurBlock->fPrev;
}
fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL;
diff --git a/src/core/SkDistanceFieldGen.cpp b/src/core/SkDistanceFieldGen.cpp
index ef0ee86d59..92cf1af20d 100755
--- a/src/core/SkDistanceFieldGen.cpp
+++ b/src/core/SkDistanceFieldGen.cpp
@@ -332,8 +332,8 @@ static unsigned char pack_distance_field_val(float dist, float distanceMagnitude
static bool generate_distance_field_from_image(unsigned char* distanceField,
const unsigned char* copyPtr,
int width, int height) {
- SkASSERT(NULL != distanceField);
- SkASSERT(NULL != copyPtr);
+ SkASSERT(distanceField);
+ SkASSERT(copyPtr);
// we expand our temp data by one more on each side to simplify
// the scanning code -- will always be treated as infinitely far away
@@ -462,8 +462,8 @@ static bool generate_distance_field_from_image(unsigned char* distanceField,
bool SkGenerateDistanceFieldFromA8Image(unsigned char* distanceField,
const unsigned char* image,
int width, int height, int rowBytes) {
- SkASSERT(NULL != distanceField);
- SkASSERT(NULL != image);
+ SkASSERT(distanceField);
+ SkASSERT(image);
// create temp data
SkAutoSMalloc<1024> copyStorage((width+2)*(height+2)*sizeof(char));
@@ -490,8 +490,8 @@ bool SkGenerateDistanceFieldFromA8Image(unsigned char* distanceField,
bool SkGenerateDistanceFieldFromBWImage(unsigned char* distanceField,
const unsigned char* image,
int width, int height, int rowBytes) {
- SkASSERT(NULL != distanceField);
- SkASSERT(NULL != image);
+ SkASSERT(distanceField);
+ SkASSERT(image);
// create temp data
SkAutoSMalloc<1024> copyStorage((width+2)*(height+2)*sizeof(char));
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index d0d4f0718a..3532efd7e5 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -628,7 +628,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
}
case SkCanvas::kLines_PointMode:
#ifndef SK_DISABLE_DASHING_OPTIMIZATION
- if (2 == count && NULL != paint.getPathEffect()) {
+ if (2 == count && paint.getPathEffect()) {
// most likely a dashed line - see if it is one of the ones
// we can accelerate
SkStrokeRec rec(paint);
@@ -939,7 +939,7 @@ bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix& matrix,
SkScalar len0 = fast_len(dst[0]);
SkScalar len1 = fast_len(dst[1]);
if (len0 <= SK_Scalar1 && len1 <= SK_Scalar1) {
- if (NULL != coverage) {
+ if (coverage) {
*coverage = SkScalarAve(len0, len1);
}
return true;
@@ -2130,7 +2130,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) const {
- SkASSERT(0 == count || NULL != vertices);
+ SkASSERT(0 == count || vertices);
// abort early if there is nothing to draw
if (count < 3 || (indices && indexCount < 3) || fRC->isEmpty()) {
@@ -2168,7 +2168,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
// setup the custom shader (if needed)
SkAutoTUnref<SkComposeShader> composeShader;
- if (NULL != colors) {
+ if (colors) {
if (NULL == textures) {
// just colors (no texture)
shader = p.setShader(&triShader);
@@ -2198,9 +2198,9 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
VertState state(count, indices, indexCount);
VertState::Proc vertProc = state.chooseProc(vmode);
- if (NULL != textures || NULL != colors) {
+ if (textures || colors) {
while (vertProc(&state)) {
- if (NULL != textures) {
+ if (textures) {
SkMatrix tempM;
if (texture_to_matrix(state, vertices, textures, &tempM)) {
SkShader::ContextRec rec(*fBitmap, p, *fMatrix);
@@ -2210,7 +2210,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
}
}
}
- if (NULL != colors) {
+ if (colors) {
// Find the context for triShader.
SkTriColorShader::TriColorShaderContext* triColorShaderContext;
diff --git a/src/core/SkEdge.cpp b/src/core/SkEdge.cpp
index dd5ab5fbc6..ac0ca58c22 100644
--- a/src/core/SkEdge.cpp
+++ b/src/core/SkEdge.cpp
@@ -66,7 +66,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
return 0;
}
// are we completely above or below the clip?
- if (NULL != clip && (top >= clip->fBottom || bot <= clip->fTop)) {
+ if (clip && (top >= clip->fBottom || bot <= clip->fTop)) {
return 0;
}
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp
index ae17be5a02..b0c1697d2b 100644
--- a/src/core/SkFlattenable.cpp
+++ b/src/core/SkFlattenable.cpp
@@ -114,7 +114,7 @@ SkFlattenable::Factory SkFlattenable::NameToFactory(const char name[]) {
}
bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) {
- SkASSERT(NULL != type);
+ SkASSERT(type);
InitializeFlattenablesIfNeeded();
#ifdef SK_DEBUG
report_no_entries(__FUNCTION__);
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index 3d29f9f38b..ab816f9407 100755
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -339,7 +339,7 @@ const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
const_cast<SkGlyph&>(glyph).fImage = fGlyphAlloc.alloc(size,
SkChunkAlloc::kReturnNil_AllocFailType);
// check that alloc() actually succeeded
- if (NULL != glyph.fImage) {
+ if (glyph.fImage) {
fScalerContext->getImage(glyph);
// TODO: the scaler may have changed the maskformat during
// getImage (e.g. from AA or LCD to BW) which means we may have
@@ -373,10 +373,10 @@ const void* SkGlyphCache::findDistanceField(const SkGlyph& glyph) {
}
const void* image = this->findImage(glyph);
// now generate the distance field
- if (NULL != image) {
+ if (image) {
const_cast<SkGlyph&>(glyph).fDistanceField = fGlyphAlloc.alloc(size,
SkChunkAlloc::kReturnNil_AllocFailType);
- if (NULL != glyph.fDistanceField) {
+ if (glyph.fDistanceField) {
SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
if (SkMask::kA8_Format == maskFormat) {
// make the distance field from the image
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 551d8f78dc..7008e7b42f 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -60,10 +60,10 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) {
#ifdef SK_DEBUG
// In all cases, we need the sizes array
- SkASSERT(NULL != sizes);
+ SkASSERT(sizes);
- bool isValidWithPlanes = (NULL != planes) && (NULL != rowBytes) &&
- ((NULL != planes[0]) && (NULL != planes[1]) && (NULL != planes[2]) &&
+ bool isValidWithPlanes = (planes) && (rowBytes) &&
+ ((planes[0]) && (planes[1]) && (planes[2]) &&
(0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2]));
bool isValidWithoutPlanes =
((NULL == planes) ||
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index ae29310aea..f4ba969662 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -30,7 +30,7 @@ static bool is_valid(const SkImageInfo& info, SkColorTable* ctable) {
if (kIndex8_SkColorType == info.fColorType && NULL == ctable) {
return false;
}
- if (kIndex8_SkColorType != info.fColorType && NULL != ctable) {
+ if (kIndex8_SkColorType != info.fColorType && ctable) {
return false;
}
#endif
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index 08ed97f913..fb67c1abc0 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -194,9 +194,7 @@ public:
~SkTMaskPreBlend() { }
/** True if this PreBlend should be applied. When false, fR, fG, and fB are NULL. */
- bool isApplicable() const {
- return NULL != this->fG;
- }
+ bool isApplicable() const { return SkToBool(this->fG); }
const uint8_t* fR;
const uint8_t* fG;
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 814f16a5ea..2a295870dd 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1766,15 +1766,15 @@ bool SkDecomposeUpper2x2(const SkMatrix& matrix,
sin1 = -sin1;
}
- if (NULL != scale) {
+ if (scale) {
scale->fX = SkDoubleToScalar(w1);
scale->fY = SkDoubleToScalar(w2);
}
- if (NULL != rotation1) {
+ if (rotation1) {
rotation1->fX = cos1;
rotation1->fY = sin1;
}
- if (NULL != rotation2) {
+ if (rotation2) {
rotation2->fX = cos2;
rotation2->fY = sin2;
}
diff --git a/src/core/SkMessageBus.h b/src/core/SkMessageBus.h
index f36c42b4c7..1290ea965f 100644
--- a/src/core/SkMessageBus.h
+++ b/src/core/SkMessageBus.h
@@ -85,7 +85,7 @@ void SkMessageBus<Message>::Inbox::receive(const Message& m) {
template<typename Message>
void SkMessageBus<Message>::Inbox::poll(SkTDArray<Message>* messages) {
- SkASSERT(NULL != messages);
+ SkASSERT(messages);
messages->reset();
SkAutoMutexAcquire lock(fMessagesMutex);
messages->swap(fMessages);
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 50af2b717e..eb1e55e550 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -38,12 +38,12 @@ void SkMultiPictureDraw::add(SkCanvas* canvas,
data->picture = SkRef(picture);
data->canvas = SkRef(canvas);
- if (NULL != matrix) {
+ if (matrix) {
data->matrix = *matrix;
} else {
data->matrix.setIdentity();
}
- if (NULL != paint) {
+ if (paint) {
data->paint = SkNEW_ARGS(SkPaint, (*paint));
} else {
data->paint = NULL;
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index d19efb0aa4..5d7c2cc3eb 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1040,7 +1040,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkMeasureCacheProc glyphCacheProc;
glyphCacheProc = this->getMeasureCacheProc(kForward_TextBufferDirection,
- NULL != bounds);
+ bounds);
int xyIndex;
JoinBoundsProc joinBoundsProc;
@@ -1298,7 +1298,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
return 0;
}
- SkASSERT(NULL != textData);
+ SkASSERT(textData);
if (NULL == widths && NULL == bounds) {
return this->countText(textData, byteLength);
@@ -1312,7 +1312,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc;
glyphCacheProc = paint.getMeasureCacheProc(kForward_TextBufferDirection,
- NULL != bounds);
+ bounds);
const char* text = (const char*)textData;
const char* stop = text + byteLength;
@@ -2311,7 +2311,7 @@ void SkPaint::toString(SkString* str) const {
str->append("<dl><dt>SkPaint:</dt><dd><dl>");
SkTypeface* typeface = this->getTypeface();
- if (NULL != typeface) {
+ if (typeface) {
SkDynamicMemoryWStream ostream;
typeface->serialize(&ostream);
SkAutoTUnref<SkData> data(ostream.copyToData());
@@ -2343,60 +2343,60 @@ void SkPaint::toString(SkString* str) const {
str->append("</dd>");
SkPathEffect* pathEffect = this->getPathEffect();
- if (NULL != pathEffect) {
+ if (pathEffect) {
str->append("<dt>PathEffect:</dt><dd>");
str->append("</dd>");
}
SkShader* shader = this->getShader();
- if (NULL != shader) {
+ if (shader) {
str->append("<dt>Shader:</dt><dd>");
shader->toString(str);
str->append("</dd>");
}
SkXfermode* xfer = this->getXfermode();
- if (NULL != xfer) {
+ if (xfer) {
str->append("<dt>Xfermode:</dt><dd>");
xfer->toString(str);
str->append("</dd>");
}
SkMaskFilter* maskFilter = this->getMaskFilter();
- if (NULL != maskFilter) {
+ if (maskFilter) {
str->append("<dt>MaskFilter:</dt><dd>");
maskFilter->toString(str);
str->append("</dd>");
}
SkColorFilter* colorFilter = this->getColorFilter();
- if (NULL != colorFilter) {
+ if (colorFilter) {
str->append("<dt>ColorFilter:</dt><dd>");
colorFilter->toString(str);
str->append("</dd>");
}
SkRasterizer* rasterizer = this->getRasterizer();
- if (NULL != rasterizer) {
+ if (rasterizer) {
str->append("<dt>Rasterizer:</dt><dd>");
str->append("</dd>");
}
SkDrawLooper* looper = this->getLooper();
- if (NULL != looper) {
+ if (looper) {
str->append("<dt>DrawLooper:</dt><dd>");
looper->toString(str);
str->append("</dd>");
}
SkImageFilter* imageFilter = this->getImageFilter();
- if (NULL != imageFilter) {
+ if (imageFilter) {
str->append("<dt>ImageFilter:</dt><dd>");
str->append("</dd>");
}
SkAnnotation* annotation = this->getAnnotation();
- if (NULL != annotation) {
+ if (annotation) {
str->append("<dt>Annotation:</dt><dd>");
str->append("</dd>");
}
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index c0049cad55..b89aec31fa 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1914,7 +1914,7 @@ void SkPath::RawIter::setPath(const SkPath& path) {
}
SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
- SkASSERT(NULL != pts);
+ SkASSERT(pts);
if (fVerbs == fVerbStop) {
return kDone_Verb;
}
@@ -2007,7 +2007,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
SkDEBUGCODE(this->validate();)
buffer.skipToAlign4();
sizeRead = buffer.pos();
- } else if (NULL != pathRef) {
+ } else if (pathRef) {
// If the buffer is not valid, pathRef should be NULL
sk_throw();
}
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index e60f618b4f..64f6fb86da 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -343,7 +343,7 @@ SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb,
}
if (SkPath::kConic_Verb == verb) {
- SkASSERT(NULL != weights);
+ SkASSERT(weights);
*weights = fConicWeights.append(numVbs);
}
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index e80a17bd22..9cfa6a062e 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -234,7 +234,7 @@ bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason,
(fNumAAConcavePaths - fNumAAHairlineConcavePaths)
< kNumAAConcavePathsTol;
- if (!ret && NULL != reason) {
+ if (!ret && reason) {
if (!suitableForDash) {
if (0 != sampleCount) {
*reason = "Can't use multisample on dash effect.";
@@ -296,7 +296,7 @@ void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons
// fRecord OK
const SkPicture::AccelData* SkPicture::EXPERIMENTAL_getAccelData(
SkPicture::AccelData::Key key) const {
- if (NULL != fAccelData.get() && fAccelData->getKey() == key) {
+ if (fAccelData.get() && fAccelData->getKey() == key) {
return fAccelData.get();
}
return NULL;
@@ -328,20 +328,20 @@ const SkMatrix& SkPicture::OperationList::matrix(int index) const {
// fRecord OK
void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) const {
- SkASSERT(NULL != canvas);
- SkASSERT(NULL != fData.get() || NULL != fRecord.get());
+ SkASSERT(canvas);
+ SkASSERT(fData.get() || fRecord.get());
// If the query contains the whole picture, don't bother with the BBH.
SkRect clipBounds = { 0, 0, 0, 0 };
(void)canvas->getClipBounds(&clipBounds);
const bool useBBH = !clipBounds.contains(this->cullRect());
- if (NULL != fData.get()) {
+ if (fData.get()) {
SkPicturePlayback playback(this);
playback.setUseBBH(useBBH);
playback.draw(canvas, callback);
}
- if (NULL != fRecord.get()) {
+ if (fRecord.get()) {
SkRecordDraw(*fRecord, canvas, useBBH ? fBBH.get() : NULL, callback);
}
}
@@ -531,10 +531,10 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
// If we're a new-format picture, backport to old format for serialization.
SkAutoTDelete<SkPicture> oldFormat;
- if (NULL == data && NULL != fRecord.get()) {
+ if (NULL == data && fRecord.get()) {
oldFormat.reset(backport(*fRecord, this->cullRect()));
data = oldFormat->fData.get();
- SkASSERT(NULL != data);
+ SkASSERT(data);
}
SkPictInfo info;
@@ -542,7 +542,7 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
SkASSERT(sizeof(SkPictInfo) == 32);
stream->write(&info, sizeof(info));
- if (NULL != data) {
+ if (data) {
stream->writeBool(true);
data->serialize(stream, encoder);
} else {
@@ -556,10 +556,10 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const {
// If we're a new-format picture, backport to old format for serialization.
SkAutoTDelete<SkPicture> oldFormat;
- if (NULL == data && NULL != fRecord.get()) {
+ if (NULL == data && fRecord.get()) {
oldFormat.reset(backport(*fRecord, this->cullRect()));
data = oldFormat->fData.get();
- SkASSERT(NULL != data);
+ SkASSERT(data);
}
SkPictInfo info;
@@ -569,7 +569,7 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const {
buffer.writeRect(info.fCullRect);
buffer.writeUInt(info.fFlags);
- if (NULL != data) {
+ if (data) {
buffer.writeBool(true);
data->flatten(buffer);
} else {
@@ -584,7 +584,7 @@ bool SkPicture::suitableForGpuRasterization(GrContext* context, const char **rea
return fAnalysis.suitableForGpuRasterization(reason, 0);
}
if (NULL == fData.get()) {
- if (NULL != reason) {
+ if (reason) {
*reason = "Missing internal data.";
}
return false;
@@ -657,7 +657,7 @@ SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHi
// SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single
// thread.
void SkPicture::addDeletionListener(DeletionListener* listener) const {
- SkASSERT(NULL != listener);
+ SkASSERT(listener);
*fDeletionListeners.append() = SkRef(listener);
}
diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp
index 1d19f352f4..937173c519 100644
--- a/src/core/SkPictureContentInfo.cpp
+++ b/src/core/SkPictureContentInfo.cpp
@@ -27,7 +27,7 @@ bool SkPictureContentInfo::suitableForGpuRasterization(GrContext* context, const
bool ret = suitableForDash &&
(fNumAAConcavePaths - fNumAAHairlineConcavePaths)
< kNumAAConcavePaths;
- if (!ret && NULL != reason) {
+ if (!ret && reason) {
if (!suitableForDash) {
if (0 != sampleCount) {
*reason = "Can't use multisample on dash effect.";
@@ -66,7 +66,7 @@ void SkPictureContentInfo::onDrawPath(const SkPath& path, const SkPaint& paint)
}
void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) {
- if (NULL != paint && NULL != paint->getPathEffect()) {
+ if (paint && paint->getPathEffect()) {
++fNumPaintWithPathEffectUses;
}
}
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index e5a004ef3a..a2d10e3b9b 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -30,7 +30,7 @@ SkPictureData::SkPictureData(const SkPictInfo& info)
void SkPictureData::initForPlayback() const {
// ensure that the paths bounds are pre-computed
- if (NULL != fPathHeap.get()) {
+ if (fPathHeap.get()) {
for (int i = 0; i < fPathHeap->count(); i++) {
(*fPathHeap.get())[i].updateBoundsCache();
}
@@ -53,7 +53,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
SkSafeRef(fStateTree);
fContentInfo.set(record.fContentInfo);
- if (NULL != fBoundingHierarchy) {
+ if (fBoundingHierarchy) {
fBoundingHierarchy->flushDeferredInserts();
}
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index 019bfb2f9a..d2b5b4af67 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -142,7 +142,7 @@ public:
void initIterator(SkPictureStateTree::Iterator* iter,
const SkTDArray<void*>& draws,
SkCanvas* canvas) const {
- if (NULL != fStateTree) {
+ if (fStateTree) {
fStateTree->initIterator(iter, draws, canvas);
}
}
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 78b65d6d7b..308ce9ec3f 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -83,7 +83,7 @@ bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter,
SkCanvas* canvas,
const SkPicture::OperationList *activeOpsList) {
- if (NULL != activeOpsList) {
+ if (activeOpsList) {
if (0 == activeOpsList->numOps()) {
return false; // nothing to draw
}
@@ -150,7 +150,7 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback)
SkAutoCanvasRestore acr(canvas, false);
while (!reader.eof()) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h
index 6114fee5e7..cdfa8efe18 100644
--- a/src/core/SkPicturePlayback.h
+++ b/src/core/SkPicturePlayback.h
@@ -68,7 +68,7 @@ protected:
public:
AutoResetOpID(SkPicturePlayback* playback) : fPlayback(playback) { }
~AutoResetOpID() {
- if (NULL != fPlayback) {
+ if (fPlayback) {
fPlayback->resetOpID();
}
}
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 67bd9a548b..a6b6f61393 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -190,7 +190,7 @@ void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint
// op + bool for 'bounds'
size_t size = 2 * kUInt32Size;
- if (NULL != bounds) {
+ if (bounds) {
size += sizeof(*bounds); // + rect
}
// + paint index + flags
@@ -558,12 +558,12 @@ static void apply_optimization_to_bbh(PictureRecordOptType opt, SkPictureStateTr
SkBBoxHierarchy* boundingHierarchy) {
switch (opt) {
case kCollapseSaveLayer_OptType:
- if (NULL != stateTree) {
+ if (stateTree) {
stateTree->saveCollapsed();
}
break;
case kRewind_OptType:
- if (NULL != boundingHierarchy) {
+ if (boundingHierarchy) {
boundingHierarchy->rewindInserts();
}
// Note: No need to touch the state tree for this to work correctly.
@@ -596,7 +596,7 @@ void SkPictureRecord::willRestore() {
if (fOptsEnabled) {
for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) {
if (0 != (gPictureRecordOpts[opt].fFlags & kSkipIfBBoxHierarchy_Flag)
- && NULL != fBoundingHierarchy) {
+ && fBoundingHierarchy) {
continue;
}
if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) {
@@ -972,7 +972,7 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
// id + paint index + bitmap index + bool for 'src' + flags
size_t size = 5 * kUInt32Size;
- if (NULL != src) {
+ if (src) {
size += sizeof(*src); // + rect
}
size += sizeof(dst); // + rect
@@ -1264,7 +1264,7 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
if (indexCount > 0) {
flags |= DRAW_VERTICES_HAS_INDICES;
}
- if (NULL != xfer) {
+ if (xfer) {
SkXfermode::Mode mode;
if (xfer->asMode(&mode) && SkXfermode::kModulate_Mode != mode) {
flags |= DRAW_VERTICES_HAS_XFER;
@@ -1318,15 +1318,15 @@ void SkPictureRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors
// op + paint index + patch 12 control points + flag + patch 4 colors + 4 texture coordinates
size_t size = 2 * kUInt32Size + SkPatchUtils::kNumCtrlPts * sizeof(SkPoint) + kUInt32Size;
uint32_t flag = 0;
- if (NULL != colors) {
+ if (colors) {
flag |= DRAW_VERTICES_HAS_COLORS;
size += SkPatchUtils::kNumCorners * sizeof(SkColor);
}
- if (NULL != texCoords) {
+ if (texCoords) {
flag |= DRAW_VERTICES_HAS_TEXS;
size += SkPatchUtils::kNumCorners * sizeof(SkPoint);
}
- if (NULL != xmode) {
+ if (xmode) {
SkXfermode::Mode mode;
if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) {
flag |= DRAW_VERTICES_HAS_XFER;
@@ -1341,10 +1341,10 @@ void SkPictureRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors
this->addInt(flag);
// write optional parameters
- if (NULL != colors) {
+ if (colors) {
fWriter.write(colors, SkPatchUtils::kNumCorners * sizeof(SkColor));
}
- if (NULL != texCoords) {
+ if (texCoords) {
fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint));
}
if (flag & DRAW_VERTICES_HAS_XFER) {
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 92deac36d2..77274e675e 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -35,11 +35,11 @@ SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar
const SkISize size = SkISize::Make(width, height);
- if (NULL != bbhFactory) {
+ if (bbhFactory) {
// We don't need to hold a ref on the BBH ourselves, but might as well for
// consistency with EXPERIMENTAL_beginRecording(), which does need to.
fBBH.reset((*bbhFactory)(width, height));
- SkASSERT(NULL != fBBH.get());
+ SkASSERT(fBBH.get());
fPictureRecord.reset(SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordFlags, fBBH.get())));
} else {
fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (size, recordFlags)));
@@ -54,9 +54,9 @@ SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala
fCullWidth = width;
fCullHeight = height;
- if (NULL != bbhFactory) {
+ if (bbhFactory) {
fBBH.reset((*bbhFactory)(width, height));
- SkASSERT(NULL != fBBH.get());
+ SkASSERT(fBBH.get());
}
fRecord.reset(SkNEW(SkRecord));
@@ -65,7 +65,7 @@ SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala
}
SkCanvas* SkPictureRecorder::getRecordingCanvas() {
- if (NULL != fRecorder.get()) {
+ if (fRecorder.get()) {
return fRecorder.get();
}
return fPictureRecord.get();
@@ -74,12 +74,12 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() {
SkPicture* SkPictureRecorder::endRecording() {
SkPicture* picture = NULL;
- if (NULL != fRecord.get()) {
+ if (fRecord.get()) {
picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
fRecord.detach(), fBBH.get()));
}
- if (NULL != fPictureRecord.get()) {
+ if (fPictureRecord.get()) {
fPictureRecord->endRecording();
const bool deepCopyOps = false;
picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
@@ -90,7 +90,7 @@ SkPicture* SkPictureRecorder::endRecording() {
}
void SkPictureRecorder::internalOnly_EnableOpts(bool enableOpts) {
- if (NULL != fPictureRecord.get()) {
+ if (fPictureRecord.get()) {
fPictureRecord->internalOnly_EnableOpts(enableOpts);
}
}
@@ -100,11 +100,11 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
return;
}
- if (NULL != fRecord.get()) {
+ if (fRecord.get()) {
SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
}
- if (NULL != fPictureRecord.get()) {
+ if (fPictureRecord.get()) {
const bool deepCopyOps = true;
SkPicture picture(fCullWidth, fCullHeight,
*fPictureRecord.get(), deepCopyOps);
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index a7b5412b5a..03eeb74c52 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -22,7 +22,7 @@ SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod
const SkMatrix* localMatrix, const SkRect* tile)
: INHERITED(localMatrix)
, fPicture(SkRef(picture))
- , fTile(NULL != tile ? *tile : picture->cullRect())
+ , fTile(tile ? *tile : picture->cullRect())
, fTmx(tmx)
, fTmy(tmy) {
}
@@ -42,7 +42,7 @@ SkPictureShader::~SkPictureShader() {
SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix, const SkRect* tile) {
- if (!picture || picture->cullRect().isEmpty() || (NULL != tile && tile->isEmpty())) {
+ if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) {
return NULL;
}
return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
diff --git a/src/core/SkPictureStateTree.cpp b/src/core/SkPictureStateTree.cpp
index d2f0e6efcd..704a04ebee 100644
--- a/src/core/SkPictureStateTree.cpp
+++ b/src/core/SkPictureStateTree.cpp
@@ -46,7 +46,7 @@ void SkPictureStateTree::appendSaveLayer(size_t offset) {
}
void SkPictureStateTree::saveCollapsed() {
- SkASSERT(NULL != fLastRestoredNode);
+ SkASSERT(fLastRestoredNode);
SkASSERT(SkToBool(fLastRestoredNode->fFlags & \
(Node::kSaveLayer_Flag | Node::kSave_Flag)));
SkASSERT(fLastRestoredNode->fParent == fCurrentState.fNode);
@@ -102,7 +102,7 @@ void SkPictureStateTree::Iterator::init(const SkTDArray<void*>& draws, SkCanvas*
}
void SkPictureStateTree::Iterator::setCurrentMatrix(const SkMatrix* matrix) {
- SkASSERT(NULL != matrix);
+ SkASSERT(matrix);
if (matrix == fCurrentMatrix) {
return;
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp
index 8a6d0564af..5fee0e80c2 100644
--- a/src/core/SkPoint.cpp
+++ b/src/core/SkPoint.cpp
@@ -224,7 +224,7 @@ SkScalar SkPoint::distanceToLineBetweenSqd(const SkPoint& a,
SkScalar uLengthSqd = u.lengthSqd();
SkScalar det = u.cross(v);
- if (NULL != side) {
+ if (side) {
SkASSERT(-1 == SkPoint::kLeft_Side &&
0 == SkPoint::kOn_Side &&
1 == kRight_Side);
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index 77f94e2eed..17872badc3 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -75,7 +75,7 @@ void SkRTree::insert(void* data, const SkRect& fbounds, bool defer) {
Branch* newSibling = insert(fRoot.fChild.subtree, &newBranch);
fRoot.fBounds = this->computeBounds(fRoot.fChild.subtree);
- if (NULL != newSibling) {
+ if (newSibling) {
Node* oldRoot = fRoot.fChild.subtree;
Node* newRoot = this->allocateNode(oldRoot->fLevel + 1);
newRoot->fNumChildren = 2;
@@ -143,7 +143,7 @@ SkRTree::Branch* SkRTree::insert(Node* root, Branch* branch, uint16_t level) {
root->child(childIndex)->fBounds = this->computeBounds(
root->child(childIndex)->fChild.subtree);
}
- if (NULL != toInsert) {
+ if (toInsert) {
if (root->fNumChildren == fMaxChildren) {
// handle overflow by splitting. TODO: opportunistic reinsertion
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 3845a5c3dc..ac1e429f12 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -14,7 +14,7 @@ void SkRecordDraw(const SkRecord& record,
SkDrawPictureCallback* callback) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
- if (NULL != bbh) {
+ if (bbh) {
// Draw only ops that affect pixels in the canvas's current clip.
// The SkRecord and BBH were recorded in identity space. This canvas
// is not necessarily in that same space. getClipBounds() returns us
@@ -28,7 +28,7 @@ void SkRecordDraw(const SkRecord& record,
SkRecords::Draw draw(canvas);
for (int i = 0; i < ops.count(); i++) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds below.
@@ -37,7 +37,7 @@ void SkRecordDraw(const SkRecord& record,
// Draw all ops.
SkRecords::Draw draw(canvas);
for (unsigned i = 0; i < record.count(); i++) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
record.visit<void>(i, draw);
@@ -154,7 +154,7 @@ public:
}
// Finally feed all stored bounds into the BBH. They'll be returned in this order.
- SkASSERT(NULL != bbh);
+ SkASSERT(bbh);
for (uintptr_t i = 0; i < record.count(); i++) {
if (!fBounds[i].isEmpty()) {
bbh->insert((void*)i, fBounds[i], true/*ok to defer*/);
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 7ffdfffbaf..73f788cd17 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -222,7 +222,7 @@ const SkResourceCache::Rec* SkResourceCache::addAndLock(Rec* rec) {
SkASSERT(rec);
// See if we already have this key (racy inserts, etc.)
const Rec* existing = this->findAndLock(rec->getKey());
- if (NULL != existing) {
+ if (existing) {
SkDELETE(rec);
return existing;
}
@@ -242,7 +242,7 @@ void SkResourceCache::add(Rec* rec) {
SkASSERT(rec);
// See if we already have this key (racy inserts, etc.)
const Rec* existing = this->findAndLock(rec->getKey());
- if (NULL != existing) {
+ if (existing) {
SkDELETE(rec);
this->unlock(existing);
return;
@@ -414,9 +414,9 @@ void SkResourceCache::validate() const {
}
SkASSERT(NULL == fHead->fPrev);
- SkASSERT(NULL != fHead->fNext);
+ SkASSERT(fHead->fNext);
SkASSERT(NULL == fTail->fNext);
- SkASSERT(NULL != fTail->fPrev);
+ SkASSERT(fTail->fPrev);
size_t used = 0;
int count = 0;
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index b32d68e734..0d95061b6b 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -727,7 +727,7 @@ void SkScan::FillTriangle(const SkPoint pts[], const SkRasterClip& clip,
SkScanClipper clipper(blitter, clipRgn, ir);
blitter = clipper.getBlitter();
- if (NULL != blitter) {
+ if (blitter) {
sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir);
}
}
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index a4ae41c689..142d6ca299 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -135,12 +135,12 @@ public:
do {
const SkPMColor* tmp = src;
- if (NULL != colorFilter) {
+ if (colorFilter) {
colorFilter->filterSpan(src, width, fBuffer);
tmp = fBuffer;
}
- if (NULL != xfermode) {
+ if (xfermode) {
xfermode->xfer32(dst, tmp, width, NULL);
} else {
fProc32(dst, tmp, width, fAlpha);
@@ -183,10 +183,10 @@ public:
do {
fillbuffer(buffer, src, width);
- if (NULL != colorFilter) {
+ if (colorFilter) {
colorFilter->filterSpan(buffer, width, buffer);
}
- if (NULL != xfermode) {
+ if (xfermode) {
xfermode->xfer32(dst, buffer, width, NULL);
} else {
fProc32(dst, buffer, width, fAlpha);
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 5069bb0a7e..ca9f51f061 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -255,7 +255,7 @@ SkStreamAsset* SkFILEStream::duplicate() const {
return new SkMemoryStream();
}
- if (NULL != fData.get()) {
+ if (fData.get()) {
return new SkMemoryStream(fData);
}
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index 496dc8d141..23544c8b86 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -114,13 +114,13 @@ public:
// Remove the entry with this key. We require that an entry with this key is present.
void remove(const Key& key) {
- SkASSERT(NULL != this->find(key));
+ SkASSERT(this->find(key));
this->innerRemove(key);
SkASSERT(this->validate());
}
void rewind() {
- if (NULL != fArray) {
+ if (fArray) {
sk_bzero(fArray, sizeof(T*)* fCapacity);
}
fCount = 0;
@@ -177,7 +177,7 @@ private:
deleted++;
} else if (Empty() != fArray[i]) {
count++;
- SKTDYNAMICHASH_CHECK(NULL != this->find(GetKey(*fArray[i])));
+ SKTDYNAMICHASH_CHECK(this->find(GetKey(*fArray[i])));
}
}
SKTDYNAMICHASH_CHECK(count == fCount);
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index e2b9691430..5cb74cf72b 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -53,7 +53,7 @@ public:
this->validate();
typename NodeList::Iter iter;
Node* node = iter.init(fList, Iter::kHead_IterStart);
- while (NULL != node) {
+ while (node) {
SkTCast<T*>(node->fObj)->~T();
Block* block = node->fBlock;
node = iter.next();
@@ -126,7 +126,7 @@ public:
void popHead() {
this->validate();
Node* node = fList.head();
- if (NULL != node) {
+ if (node) {
this->removeNode(node);
}
this->validate();
@@ -135,7 +135,7 @@ public:
void popTail() {
this->validate();
Node* node = fList.head();
- if (NULL != node) {
+ if (node) {
this->removeNode(node);
}
this->validate();
@@ -175,7 +175,7 @@ public:
for (Iter a(*this, Iter::kHead_IterStart), b(list, Iter::kHead_IterStart);
a.get();
a.next(), b.next()) {
- SkASSERT(NULL != b.get()); // already checked that counts match.
+ SkASSERT(b.get()); // already checked that counts match.
if (!(*a.get() == *b.get())) {
return false;
}
@@ -219,7 +219,7 @@ public:
Node* getNode() { return INHERITED::get(); }
T* nodeToObj(Node* node) {
- if (NULL != node) {
+ if (node) {
return reinterpret_cast<T*>(node->fObj);
} else {
return NULL;
@@ -243,7 +243,7 @@ private:
Node* createNode() {
Node* node = fFreeList.head();
- if (NULL != node) {
+ if (node) {
fFreeList.remove(node);
++node->fBlock->fNodesInUse;
} else {
@@ -263,7 +263,7 @@ private:
}
void removeNode(Node* node) {
- SkASSERT(NULL != node);
+ SkASSERT(node);
fList.remove(node);
SkTCast<T*>(node->fObj)->~T();
if (0 == --node->fBlock->fNodesInUse) {
@@ -369,7 +369,7 @@ template <typename T>
void *operator new(size_t, SkTLList<T>* list,
typename SkTLList<T>::Placement placement,
const typename SkTLList<T>::Iter& location) {
- SkASSERT(NULL != list);
+ SkASSERT(list);
if (SkTLList<T>::kBefore_Placement == placement) {
return list->internalAddBefore(location);
} else {
diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp
index f7bf3048c3..3f78a2434c 100755
--- a/src/core/SkTLS.cpp
+++ b/src/core/SkTLS.cpp
@@ -45,7 +45,7 @@ void SkTLS::Destructor(void* ptr) {
SkTLSRec* next = rec->fNext;
SkDELETE(rec);
rec = next;
- } while (NULL != rec);
+ } while (rec);
}
void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h
index c0b59ba0b9..70076f0cad 100644
--- a/src/core/SkTMultiMap.h
+++ b/src/core/SkTMultiMap.h
@@ -37,7 +37,7 @@ public:
void insert(const Key& key, T* value) {
ValueList* list = fHash.find(key);
- if (NULL != list) {
+ if (list) {
// The new ValueList entry is inserted as the second element in the
// linked list, and it will contain the value of the first element.
ValueList* newEntry = SkNEW_ARGS(ValueList, (list->fValue));
@@ -57,19 +57,19 @@ public:
ValueList* list = fHash.find(key);
// Since we expect the caller to be fully aware of what is stored, just
// assert that the caller removes an existing value.
- SkASSERT(NULL != list);
+ SkASSERT(list);
ValueList* prev = NULL;
while (list->fValue != value) {
prev = list;
list = list->fNext;
}
- if (NULL != list->fNext) {
+ if (list->fNext) {
ValueList* next = list->fNext;
list->fValue = next->fValue;
list->fNext = next->fNext;
SkDELETE(next);
- } else if (NULL != prev) {
+ } else if (prev) {
prev->fNext = NULL;
SkDELETE(list);
} else {
@@ -82,7 +82,7 @@ public:
T* find(const Key& key) const {
ValueList* list = fHash.find(key);
- if (NULL != list) {
+ if (list) {
return list->fValue;
}
return NULL;
@@ -91,7 +91,7 @@ public:
template<class FindPredicate>
T* find(const Key& key, const FindPredicate f) {
ValueList* list = fHash.find(key);
- while (NULL != list) {
+ while (list) {
if (f(list->fValue)){
return list->fValue;
}
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index d928d7bc25..ee110c7d07 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -112,7 +112,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
SkTextBlob::RunIterator::RunIterator(const SkTextBlob* blob)
: fBlob(blob)
, fIndex(0) {
- SkASSERT(NULL != blob);
+ SkASSERT(blob);
}
bool SkTextBlob::RunIterator::done() const {
@@ -194,7 +194,7 @@ SkTextBlobBuilder::~SkTextBlobBuilder() {
}
void SkTextBlobBuilder::updateDeferredBounds() {
- SkASSERT(!fDeferredBounds || (NULL != fRuns && !fRuns->empty()));
+ SkASSERT(!fDeferredBounds || (fRuns && !fRuns->empty()));
if (!fDeferredBounds) {
return;
@@ -249,7 +249,7 @@ void SkTextBlobBuilder::allocInternal(const SkPaint &font,
fGlyphBuffer.append(count);
fPosBuffer.append(count * posScalarsPerGlyph);
- SkASSERT(NULL != fRuns && !fRuns->empty());
+ SkASSERT(fRuns && !fRuns->empty());
SkTextBlob::Run& run = fRuns->back();
run.count += count;
@@ -264,7 +264,7 @@ void SkTextBlobBuilder::allocInternal(const SkPaint &font,
SkASSERT(NULL == fCurrentRunBuffer.pos || fCurrentRunBuffer.pos >= fPosBuffer.begin());
if (!fDeferredBounds) {
- if (NULL != bounds) {
+ if (bounds) {
fBounds.join(*bounds);
} else {
fDeferredBounds = true;
@@ -301,7 +301,7 @@ const SkTextBlob* SkTextBlobBuilder::build() {
if (fGlyphBuffer.count() > 0) {
// we have some glyphs, construct a real blob
- SkASSERT(NULL != fRuns && !fRuns->empty());
+ SkASSERT(fRuns && !fRuns->empty());
this->updateDeferredBounds();
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index eff718b20f..b063071932 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -193,7 +193,7 @@ int SkUTF8_CountUnichars(const char utf8[]) {
}
int SkUTF8_CountUnichars(const char utf8[], size_t byteLength) {
- SkASSERT(NULL != utf8 || 0 == byteLength);
+ SkASSERT(utf8 || 0 == byteLength);
int count = 0;
const char* stop = utf8 + byteLength;
@@ -206,7 +206,7 @@ int SkUTF8_CountUnichars(const char utf8[], size_t byteLength) {
}
SkUnichar SkUTF8_ToUnichar(const char utf8[]) {
- SkASSERT(NULL != utf8);
+ SkASSERT(utf8);
const uint8_t* p = (const uint8_t*)utf8;
int c = *p;
@@ -227,7 +227,7 @@ SkUnichar SkUTF8_ToUnichar(const char utf8[]) {
}
SkUnichar SkUTF8_NextUnichar(const char** ptr) {
- SkASSERT(NULL != ptr && NULL != *ptr);
+ SkASSERT(ptr && *ptr);
const uint8_t* p = (const uint8_t*)*ptr;
int c = *p;
@@ -249,7 +249,7 @@ SkUnichar SkUTF8_NextUnichar(const char** ptr) {
}
SkUnichar SkUTF8_PrevUnichar(const char** ptr) {
- SkASSERT(NULL != ptr && NULL != *ptr);
+ SkASSERT(ptr && *ptr);
const char* p = *ptr;
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index b10b5e1328..91aa84706b 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -840,7 +840,7 @@ public:
} else {
dstColor = fsBuilder->dstColor();
}
- SkASSERT(NULL != dstColor);
+ SkASSERT(dstColor);
// We don't try to optimize for this case at all
if (NULL == inputColor) {
@@ -1298,7 +1298,7 @@ void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
- if (NULL != proc) {
+ if (proc) {
if (NULL == aa) {
for (int i = count - 1; i >= 0; --i) {
dst[i] = proc(src[i], dst[i]);
@@ -1326,7 +1326,7 @@ void SkProcCoeffXfermode::xfer16(uint16_t* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
- if (NULL != proc) {
+ if (proc) {
if (NULL == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
@@ -1355,7 +1355,7 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
- if (NULL != proc) {
+ if (proc) {
if (NULL == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor res = proc(src[i], dst[i] << SK_A32_SHIFT);
@@ -1381,9 +1381,9 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
#if SK_SUPPORT_GPU
bool SkProcCoeffXfermode::asNewEffect(GrEffect** effect, GrTexture* background) const {
if (XferEffect::IsSupportedMode(fMode)) {
- if (NULL != effect) {
+ if (effect) {
*effect = XferEffect::Create(fMode, background);
- SkASSERT(NULL != *effect);
+ SkASSERT(*effect);
}
return true;
}
@@ -1594,7 +1594,7 @@ void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
if (count <= 0) {
return;
}
- if (NULL != aa) {
+ if (aa) {
return this->INHERITED::xfer32(dst, src, count, aa);
}
@@ -1641,7 +1641,7 @@ void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
if (count <= 0) {
return;
}
- if (NULL != aa) {
+ if (aa) {
return this->INHERITED::xfer32(dst, src, count, aa);
}
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 194d23a7e7..1a1215343a 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -809,7 +809,7 @@ HRESULT SkXPSDevice::createXpsImageBrush(
SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse;
HR(this->createXpsTransform(localMatrix, &xpsMatrixToUse));
- if (NULL != xpsMatrixToUse.get()) {
+ if (xpsMatrixToUse.get()) {
HRM((*xpsBrush)->SetTransformLocal(xpsMatrixToUse.get()),
"Could not set transform for image brush.");
} else {
@@ -838,7 +838,7 @@ HRESULT SkXPSDevice::createXpsLinearGradient(SkShader::GradientInfo info,
IXpsOMBrush** xpsBrush) {
XPS_POINT startPoint;
XPS_POINT endPoint;
- if (NULL != xpsMatrix) {
+ if (xpsMatrix) {
startPoint = xps_point(info.fPoint[0]);
endPoint = xps_point(info.fPoint[1]);
} else {
@@ -866,7 +866,7 @@ HRESULT SkXPSDevice::createXpsLinearGradient(SkShader::GradientInfo info,
&endPoint,
&gradientBrush),
"Could not create linear gradient brush.");
- if (NULL != xpsMatrix) {
+ if (xpsMatrix) {
HRM(gradientBrush->SetTransformLocal(xpsMatrix),
"Could not set transform on linear gradient brush.");
}
@@ -912,7 +912,7 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info,
XPS_POINT centerPoint;
XPS_POINT gradientOrigin;
XPS_SIZE radiiSizes;
- if (NULL != xpsMatrix) {
+ if (xpsMatrix) {
centerPoint = xps_point(info.fPoint[0]);
gradientOrigin = xps_point(info.fPoint[0]);
radiiSizes.width = SkScalarToFLOAT(info.fRadius[0]);
@@ -943,7 +943,7 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info,
&radiiSizes,
&gradientBrush),
"Could not create radial gradient brush.");
- if (NULL != xpsMatrix) {
+ if (xpsMatrix) {
HRM(gradientBrush->SetTransformLocal(xpsMatrix),
"Could not set transform on radial gradient brush.");
}
@@ -1019,7 +1019,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
}
SkMatrix localMatrix = shader->getLocalMatrix();
- if (NULL != parentTransform) {
+ if (parentTransform) {
localMatrix.preConcat(*parentTransform);
}
SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse;
@@ -1065,7 +1065,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
case SkShader::kDefault_BitmapType: {
//TODO: outMatrix??
SkMatrix localMatrix = shader->getLocalMatrix();
- if (NULL != parentTransform) {
+ if (parentTransform) {
localMatrix.preConcat(*parentTransform);
}
@@ -1327,7 +1327,7 @@ HRESULT SkXPSDevice::addXpsPathGeometry(
while ((verb = iter.next(points)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb: {
- if (NULL != xpsFigure.get()) {
+ if (xpsFigure.get()) {
HR(close_figure(segmentTypes, segmentStrokes, segmentData,
stroke, fill,
xpsFigure.get() , xpsFigures));
@@ -1378,7 +1378,7 @@ HRESULT SkXPSDevice::addXpsPathGeometry(
break;
}
}
- if (NULL != xpsFigure.get()) {
+ if (xpsFigure.get()) {
HR(close_figure(segmentTypes, segmentStrokes, segmentData,
stroke, fill,
xpsFigure.get(), xpsFigures));
@@ -1834,7 +1834,7 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap,
}
SkTScopedComPtr<IXpsOMGeometryFigure> rectFigure;
- if (NULL != xpsTransform.get()) {
+ if (xpsTransform.get()) {
const SkShader::TileMode xy[2] = {
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
@@ -1979,12 +1979,12 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d,
SkTScopedComPtr<IXpsOMGlyphsEditor> glyphsEditor;
HRM(glyphs->GetGlyphsEditor(&glyphsEditor), "Could not get glyph editor.");
- if (NULL != text) {
+ if (text) {
HRM(glyphsEditor->SetUnicodeString(text),
"Could not set unicode string.");
}
- if (NULL != xpsGlyphs) {
+ if (xpsGlyphs) {
HRM(glyphsEditor->SetGlyphIndices(xpsGlyphsLen, xpsGlyphs),
"Could not set glyphs.");
}
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index be636c5bbf..22f464cb49 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -379,7 +379,7 @@ void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder,
dstColor = fsBuilder->dstColor();
}
- SkASSERT(NULL != dstColor);
+ SkASSERT(dstColor);
fKUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, "k");
const char* kUni = builder->getUniformCStr(fKUni);
diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp
index aae6ba5f11..b596bfdb73 100644
--- a/src/effects/SkAvoidXfermode.cpp
+++ b/src/effects/SkAvoidXfermode.cpp
@@ -108,7 +108,7 @@ void SkAvoidXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count,
SkASSERT(d <= 256);
if (d > 0) {
- if (NULL != aa) {
+ if (aa) {
d = SkAlphaMul(d, Accurate255To256(*aa++));
if (0 == d) {
continue;
@@ -157,7 +157,7 @@ void SkAvoidXfermode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
SkASSERT(d <= 32);
if (d > 0) {
- if (NULL != aa) {
+ if (aa) {
d = SkAlphaMul(d, Accurate255To256(*aa++));
if (0 == d) {
continue;
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 7c3e9e884e..2a8df5c672 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -64,7 +64,7 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf,
SkColorFilter* inputColorFilter;
if (input && cf->asColorMatrix(colorMatrix)
&& input->asColorFilter(&inputColorFilter)
- && (NULL != inputColorFilter)) {
+ && (inputColorFilter)) {
SkAutoUnref autoUnref(inputColorFilter);
if (inputColorFilter->asColorMatrix(inputMatrix) && !matrix_needs_clamping(inputMatrix)) {
SkScalar combinedMatrix[20];
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index beed67efcf..566704849b 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -186,7 +186,7 @@ void SkColorMatrixFilter::initState(const SkScalar* SK_RESTRICT src) {
analyze the array, so we don't miss the case where the caller has zeros
which could make us accidentally take the General or Add case.
*/
- if (NULL != fProc) {
+ if (fProc) {
int32_t add = 1 << (fState.fShift - 1);
array[4] += add;
array[9] += add;
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 66462af85b..f9a56d0ff4 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -104,7 +104,7 @@ bool SkDashPathEffect::asPoints(PointData* results,
return false;
}
- if (NULL != results) {
+ if (results) {
results->fFlags = 0;
SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLength);
@@ -229,7 +229,7 @@ bool SkDashPathEffect::asPoints(PointData* results,
SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const {
if (info) {
- if (info->fCount >= fCount && NULL != info->fIntervals) {
+ if (info->fCount >= fCount && info->fIntervals) {
memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar));
}
info->fCount = fCount;
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index aa7f9952f9..a9a53f2acf 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -146,7 +146,7 @@ GrTexture* GaussianBlur(GrContext* context,
bool cropToRect,
float sigmaX,
float sigmaY) {
- SkASSERT(NULL != context);
+ SkASSERT(context);
GrContext::AutoRenderTarget art(context);
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index 19525eca51..30709c4f1c 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -337,7 +337,7 @@ SkPaint* SkLayerDrawLooper::Builder::addLayerOnTop(const LayerInfo& info) {
if (NULL == fRecs) {
fRecs = rec;
} else {
- SkASSERT(NULL != fTopRec);
+ SkASSERT(fTopRec);
fTopRec->fNext = rec;
}
fTopRec = rec;
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 9293f7fc2a..45e966f097 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -205,7 +205,7 @@ GrEffect* GrMagnifierEffect::TestCreate(SkRandom* random,
texture->height() / (float) y,
(float) inset / texture->width(),
(float) inset / texture->height());
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
return effect;
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index c6c470c390..df04cb170d 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -502,7 +502,7 @@ bool apply_morphology(const SkBitmap& input,
SkISize radius,
SkBitmap* dst) {
GrTexture* srcTexture = input.getTexture();
- SkASSERT(NULL != srcTexture);
+ SkASSERT(srcTexture);
GrContext* context = srcTexture->getContext();
srcTexture->ref();
SkAutoTUnref<GrTexture> src(srcTexture);
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index b0ebb39342..0247ed9e1b 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -966,7 +966,7 @@ void GrGLPerlinNoise::setData(const GrGLProgramDataManager& pdman, const GrDrawE
bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* externalLocalMatrix, GrColor* paintColor,
GrEffect** effect) const {
- SkASSERT(NULL != context);
+ SkASSERT(context);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
@@ -1001,7 +1001,7 @@ bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint,
SkMatrix m = context->getMatrix();
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
- if ((NULL != permutationsTexture) && (NULL != noiseTexture)) {
+ if ((permutationsTexture) && (noiseTexture)) {
*effect = GrPerlinNoiseEffect::Create(fType,
fNumOctaves,
fStitchTiles,
@@ -1016,10 +1016,10 @@ bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint,
// Unlock immediately, this is not great, but we don't have a way of
// knowing when else to unlock it currently. TODO: Remove this when
// unref becomes the unlock replacement for all types of textures.
- if (NULL != permutationsTexture) {
+ if (permutationsTexture) {
GrUnlockAndUnrefCachedBitmapTexture(permutationsTexture);
}
- if (NULL != noiseTexture) {
+ if (noiseTexture) {
GrUnlockAndUnrefCachedBitmapTexture(noiseTexture);
}
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp
index 3ca0c099b7..bed19ef89d 100644
--- a/src/effects/SkPictureImageFilter.cpp
+++ b/src/effects/SkPictureImageFilter.cpp
@@ -15,7 +15,7 @@
SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, uint32_t uniqueID)
: INHERITED(0, 0, NULL, uniqueID)
, fPicture(SkSafeRef(picture))
- , fCropRect(NULL != picture ? picture->cullRect() : SkRect::MakeEmpty()) {
+ , fCropRect(picture ? picture->cullRect() : SkRect::MakeEmpty()) {
}
SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect,
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 8b391eebf4..3cab107373 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -438,7 +438,7 @@ GrEffect* SkTable_ColorFilter::asNewEffect(GrContext* context) const {
this->asComponentTable(&bitmap);
// passing NULL because this effect does no tiling or filtering.
GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, bitmap, NULL);
- if (NULL != texture) {
+ if (texture) {
effect = ColorTableEffect::Create(texture, fFlags);
// Unlock immediately, this is not great, but we don't have a way of
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 3ac363568c..23c473fa9c 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1150,7 +1150,7 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
desc.fContext = ctx;
desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info());
fAtlas = GrTextureStripAtlas::GetAtlas(desc);
- SkASSERT(NULL != fAtlas);
+ SkASSERT(fAtlas);
// We always filter the gradient table. Each table is one row of a texture, always y-clamp.
GrTextureParams params;
@@ -1239,7 +1239,7 @@ int GrGradientEffect::RandomGradientParams(SkRandom* random,
SkScalar stop = 0.f;
for (int i = 0; i < outColors; ++i) {
colors[i] = random->nextU();
- if (NULL != *stops) {
+ if (*stops) {
(*stops)[i] = stop;
stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - stop) : 1.f;
}
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 551afaab02..b26d60626b 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -569,7 +569,7 @@ void GrGLLinearGradient::emitCode(GrGLProgramBuilder* builder,
bool SkLinearGradient::asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrix, GrColor* paintColor,
GrEffect** effect) const {
- SkASSERT(NULL != context);
+ SkASSERT(context);
SkMatrix matrix;
if (!this->getLocalMatrix().invert(&matrix)) {
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index aeae24a0af..895dbb99ca 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -579,7 +579,7 @@ void GrGLRadialGradient::emitCode(GrGLProgramBuilder* builder,
bool SkRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrix, GrColor* paintColor,
GrEffect** effect) const {
- SkASSERT(NULL != context);
+ SkASSERT(context);
SkMatrix matrix;
if (!this->getLocalMatrix().invert(&matrix)) {
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 9284e7cb09..0ecad3a051 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -423,7 +423,7 @@ void SkTwoPointConicalGradient::flatten(SkWriteBuffer& buffer) const {
bool SkTwoPointConicalGradient::asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrix, GrColor* paintColor,
GrEffect** effect) const {
- SkASSERT(NULL != context);
+ SkASSERT(context);
SkASSERT(fPtsToUnit.isIdentity());
*effect = Gr2PtConicalGradientEffect::Create(context, *this, fTileMode, localMatrix);
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index bb5ec04bfd..75b1e79d7a 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -687,7 +687,7 @@ void GrGLRadial2Gradient::GenKey(const GrDrawEffect& drawEffect,
bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrix, GrColor* paintColor,
GrEffect** effect) const {
- SkASSERT(NULL != context);
+ SkASSERT(context);
// invert the localM, translate to center1 (fPtsToUni), rotate so center2 is on x axis.
SkMatrix matrix;
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 9986ac87f0..0b3b87811c 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -684,7 +684,7 @@ void add_line(const SkPoint p[2],
(*vert)[5].fPos = b + vec - ortho;
(*vert)[5].fCoverage = 0;
- if (NULL != toSrc) {
+ if (toSrc) {
toSrc->mapPointsWithStride(&(*vert)->fPos,
sizeof(LineVertex),
kVertsPerLineSeg);
@@ -808,7 +808,7 @@ bool GrAAHairLinePathRenderer::createBezierGeom(
seedPts[0] = conics[0];
seedPts[1] = conics[2];
}
- if (NULL != toDevice) {
+ if (toDevice) {
toDevice->mapPoints(seedPts, 2);
}
devBounds->set(seedPts[0], seedPts[1]);
@@ -999,7 +999,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
if (quadCnt > 0) {
GrEffect* hairQuadEffect = GrQuadEffect::Create(kHairlineAA_GrEffectEdgeType,
*target->caps());
- SkASSERT(NULL != hairQuadEffect);
+ SkASSERT(hairQuadEffect);
GrDrawState::AutoRestoreEffects are(drawState);
target->setIndexSourceToBuffer(fQuadsIndexBuffer);
drawState->setGeometryProcessor(hairQuadEffect, kEdgeAttrIndex)->unref();
@@ -1020,7 +1020,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
GrDrawState::AutoRestoreEffects are(drawState);
GrEffect* hairConicEffect = GrConicEffect::Create(kHairlineAA_GrEffectEdgeType,
*target->caps());
- SkASSERT(NULL != hairConicEffect);
+ SkASSERT(hairConicEffect);
drawState->setGeometryProcessor(hairConicEffect, 1, 2)->unref();
int conics = 0;
while (conics < conicCnt) {
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 9384457a1e..d19e26d766 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -315,7 +315,7 @@ GrIndexBuffer* GrAARectRenderer::aaFillRectIndexBuffer(GrGpu* gpu) {
if (NULL == fAAFillRectIndexBuffer) {
fAAFillRectIndexBuffer = gpu->createIndexBuffer(kAAFillRectIndexBufferSize, false);
- if (NULL != fAAFillRectIndexBuffer) {
+ if (fAAFillRectIndexBuffer) {
uint16_t* data = (uint16_t*) fAAFillRectIndexBuffer->map();
bool useTempData = (NULL == data);
if (useTempData) {
@@ -428,7 +428,7 @@ GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu, bool miterS
if (NULL == fAAMiterStrokeRectIndexBuffer) {
fAAMiterStrokeRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gMiterStrokeAARectIdx), false);
- if (NULL != fAAMiterStrokeRectIndexBuffer) {
+ if (fAAMiterStrokeRectIndexBuffer) {
#ifdef SK_DEBUG
bool updated =
#endif
@@ -442,7 +442,7 @@ GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu, bool miterS
if (NULL == fAABevelStrokeRectIndexBuffer) {
fAABevelStrokeRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gBevelStrokeAARectIdx), false);
- if (NULL != fAABevelStrokeRectIndexBuffer) {
+ if (fAABevelStrokeRectIndexBuffer) {
#ifdef SK_DEBUG
bool updated =
#endif
diff --git a/src/gpu/GrAllocPool.cpp b/src/gpu/GrAllocPool.cpp
index c92ebbd121..9594c94057 100644
--- a/src/gpu/GrAllocPool.cpp
+++ b/src/gpu/GrAllocPool.cpp
@@ -90,7 +90,7 @@ void* GrAllocPool::alloc(size_t size) {
void GrAllocPool::release(size_t bytes) {
this->validate();
- while (bytes && NULL != fBlock) {
+ while (bytes && fBlock) {
bytes = fBlock->release(bytes);
if (fBlock->empty()) {
Block* next = fBlock->fNext;
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 37c123f793..fd45e8ad68 100644
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -244,14 +244,14 @@ public:
*/
T& push_back() {
void* item = fAllocator.push_back();
- SkASSERT(NULL != item);
+ SkASSERT(item);
SkNEW_PLACEMENT(item, T);
return *(T*)item;
}
T& push_back(const T& t) {
void* item = fAllocator.push_back();
- SkASSERT(NULL != item);
+ SkASSERT(item);
SkNEW_PLACEMENT_ARGS(item, T, (t));
return *(T*)item;
}
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 353bf55f55..e75f859fec 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -73,7 +73,7 @@ bool GrPlot::addSubImage(int width, int height, const void* image, SkIPoint16* l
}
// if we have backing memory, copy to the memory and set for future upload
- if (NULL != fPlotData) {
+ if (fPlotData) {
const unsigned char* imagePtr = (const unsigned char*) image;
// point ourselves at the right starting spot
unsigned char* dataPtr = fPlotData;
@@ -90,7 +90,7 @@ bool GrPlot::addSubImage(int width, int height, const void* image, SkIPoint16* l
adjust_for_offset(loc, fOffset);
fDirty = true;
// otherwise, just upload the image directly
- } else if (NULL != image) {
+ } else if (image) {
adjust_for_offset(loc, fOffset);
GrContext* context = fTexture->getContext();
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrPlot::uploadToTexture");
@@ -117,7 +117,7 @@ void GrPlot::uploadToTexture() {
if (fDirty) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrPlot::uploadToTexture");
- SkASSERT(NULL != fTexture);
+ SkASSERT(fTexture);
GrContext* context = fTexture->getContext();
// We pass the flag that does not force a flush. We assume our caller is
// smart and hasn't referenced the part of the texture we're about to update
@@ -144,7 +144,7 @@ void GrPlot::uploadToTexture() {
}
void GrPlot::resetRects() {
- SkASSERT(NULL != fRects);
+ SkASSERT(fRects);
fRects->reset();
}
@@ -241,7 +241,7 @@ GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage,
GrPlotList::Iter plotIter;
plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart);
GrPlot* plot;
- while (NULL != (plot = plotIter.get())) {
+ while ((plot = plotIter.get())) {
// make sure texture is set for quick lookup
plot->fTexture = fTexture;
if (plot->addSubImage(width, height, image, loc)) {
@@ -270,7 +270,7 @@ GrPlot* GrAtlas::getUnusedPlot() {
GrPlotList::Iter plotIter;
plotIter.init(fPlotList, GrPlotList::Iter::kTail_IterStart);
GrPlot* plot;
- while (NULL != (plot = plotIter.get())) {
+ while ((plot = plotIter.get())) {
if (plot->drawToken().isIssued()) {
return plot;
}
@@ -285,7 +285,7 @@ void GrAtlas::uploadPlotsToTexture() {
GrPlotList::Iter plotIter;
plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart);
GrPlot* plot;
- while (NULL != (plot = plotIter.get())) {
+ while ((plot = plotIter.get())) {
plot->uploadToTexture();
plotIter.next();
}
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index ac4c078275..70785a65d7 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -109,7 +109,7 @@ void GrBitmapTextContext::flushGlyphs() {
int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithColorAttributeIndex :
kGlyphCoordsNoColorAttributeIndex;
drawState->setGeometryProcessor(fCachedEffect.get(), coordsIdx);
- SkASSERT(NULL != fStrike);
+ SkASSERT(fStrike);
switch (fStrike->getMaskFormat()) {
// Color bitmap text
case kARGB_GrMaskFormat:
diff --git a/src/gpu/GrBlend.cpp b/src/gpu/GrBlend.cpp
index c8631c42ef..52e335e9b0 100644
--- a/src/gpu/GrBlend.cpp
+++ b/src/gpu/GrBlend.cpp
@@ -59,7 +59,7 @@ static GrColor simplify_blend_term(GrBlendCoeff* srcCoeff,
GrColor constantColor) {
SkASSERT(!GrBlendCoeffRefsSrc(*srcCoeff));
- SkASSERT(NULL != srcCoeff);
+ SkASSERT(srcCoeff);
// Check whether srcCoeff can be reduced to kOne or kZero based on known color inputs.
// We could pick out the coeff r,g,b,a values here and use them to compute the blend term color,
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index a197a6719f..226f45196e 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -42,7 +42,7 @@ GrBufferAllocPool::GrBufferAllocPool(GrGpu* gpu,
int preallocBufferCnt) :
fBlocks(SkTMax(8, 2*preallocBufferCnt)) {
- SkASSERT(NULL != gpu);
+ SkASSERT(gpu);
fGpu = gpu;
fGpu->ref();
fGpuIsReffed = true;
@@ -58,7 +58,7 @@ GrBufferAllocPool::GrBufferAllocPool(GrGpu* gpu,
fPreallocBufferStartIdx = 0;
for (int i = 0; i < preallocBufferCnt; ++i) {
GrGeometryBuffer* buffer = this->createBuffer(fMinBlockSize);
- if (NULL != buffer) {
+ if (buffer) {
*fPreallocBuffers.append() = buffer;
}
}
@@ -116,7 +116,7 @@ void GrBufferAllocPool::reset() {
void GrBufferAllocPool::unmap() {
VALIDATE();
- if (NULL != fBufferPtr) {
+ if (fBufferPtr) {
BufferBlock& block = fBlocks.back();
if (block.fBuffer->isMapped()) {
UNMAP_BUFFER(block);
@@ -131,7 +131,7 @@ void GrBufferAllocPool::unmap() {
#ifdef SK_DEBUG
void GrBufferAllocPool::validate(bool unusedBlockAllowed) const {
- if (NULL != fBufferPtr) {
+ if (fBufferPtr) {
SkASSERT(!fBlocks.empty());
if (fBlocks.back().fBuffer->isMapped()) {
GrGeometryBuffer* buf = fBlocks.back().fBuffer;
@@ -168,10 +168,10 @@ void* GrBufferAllocPool::makeSpace(size_t size,
size_t* offset) {
VALIDATE();
- SkASSERT(NULL != buffer);
- SkASSERT(NULL != offset);
+ SkASSERT(buffer);
+ SkASSERT(offset);
- if (NULL != fBufferPtr) {
+ if (fBufferPtr) {
BufferBlock& back = fBlocks.back();
size_t usedBytes = back.fBuffer->gpuMemorySize() - back.fBytesFree;
size_t pad = GrSizeAlignUpPad(usedBytes,
@@ -198,7 +198,7 @@ void* GrBufferAllocPool::makeSpace(size_t size,
if (!createBlock(size)) {
return NULL;
}
- SkASSERT(NULL != fBufferPtr);
+ SkASSERT(fBufferPtr);
*offset = 0;
BufferBlock& back = fBlocks.back();
@@ -211,7 +211,7 @@ void* GrBufferAllocPool::makeSpace(size_t size,
int GrBufferAllocPool::currentBufferItems(size_t itemSize) const {
VALIDATE();
- if (NULL != fBufferPtr) {
+ if (fBufferPtr) {
const BufferBlock& back = fBlocks.back();
size_t usedBytes = back.fBuffer->gpuMemorySize() - back.fBytesFree;
size_t pad = GrSizeAlignUpPad(usedBytes, itemSize);
@@ -295,7 +295,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) {
}
block.fBytesFree = size;
- if (NULL != fBufferPtr) {
+ if (fBufferPtr) {
SkASSERT(fBlocks.count() > 1);
BufferBlock& prev = fBlocks.fromBack(1);
if (prev.fBuffer->isMapped()) {
@@ -356,7 +356,7 @@ void GrBufferAllocPool::destroyBlock() {
void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize) {
GrGeometryBuffer* buffer = block.fBuffer;
- SkASSERT(NULL != buffer);
+ SkASSERT(buffer);
SkASSERT(!buffer->isMapped());
SkASSERT(fCpuData.get() == fBufferPtr);
SkASSERT(flushSize <= buffer->gpuMemorySize());
@@ -365,7 +365,7 @@ void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize)
if (GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() &&
flushSize > GR_GEOM_BUFFER_MAP_THRESHOLD) {
void* data = buffer->map();
- if (NULL != data) {
+ if (data) {
memcpy(data, fBufferPtr, flushSize);
UNMAP_BUFFER(block);
return;
@@ -403,8 +403,8 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
int* startVertex) {
SkASSERT(vertexCount >= 0);
- SkASSERT(NULL != buffer);
- SkASSERT(NULL != startVertex);
+ SkASSERT(buffer);
+ SkASSERT(startVertex);
size_t offset = 0; // assign to suppress warning
const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning
@@ -425,7 +425,7 @@ bool GrVertexBufferAllocPool::appendVertices(size_t vertexSize,
const GrVertexBuffer** buffer,
int* startVertex) {
void* space = makeSpace(vertexSize, vertexCount, buffer, startVertex);
- if (NULL != space) {
+ if (space) {
memcpy(space,
vertices,
vertexSize * vertexCount);
@@ -461,8 +461,8 @@ void* GrIndexBufferAllocPool::makeSpace(int indexCount,
int* startIndex) {
SkASSERT(indexCount >= 0);
- SkASSERT(NULL != buffer);
- SkASSERT(NULL != startIndex);
+ SkASSERT(buffer);
+ SkASSERT(startIndex);
size_t offset = 0; // assign to suppress warning
const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning
@@ -482,7 +482,7 @@ bool GrIndexBufferAllocPool::appendIndices(int indexCount,
const GrIndexBuffer** buffer,
int* startIndex) {
void* space = makeSpace(indexCount, buffer, startIndex);
- if (NULL != space) {
+ if (space) {
memcpy(space, indices, sizeof(uint16_t) * indexCount);
return true;
} else {
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index a0c49b5244..2cc764f270 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -114,7 +114,7 @@ bool GrClipMaskManager::installClipEffects(const ElementList& elements,
GrDrawState* drawState = fGpu->drawState();
SkRect boundsInClipSpace;
- if (NULL != drawBounds) {
+ if (drawBounds) {
boundsInClipSpace = *drawBounds;
boundsInClipSpace.offset(-clipToRTOffset.fX, -clipToRTOffset.fY);
}
@@ -126,7 +126,7 @@ bool GrClipMaskManager::installClipEffects(const ElementList& elements,
bool setARE = false;
bool failed = false;
- while (NULL != iter.get()) {
+ while (iter.get()) {
SkRegion::Op op = iter.get()->getOp();
bool invert;
bool skip = false;
@@ -136,7 +136,7 @@ bool GrClipMaskManager::installClipEffects(const ElementList& elements,
// Fallthrough, handled same as intersect.
case SkRegion::kIntersect_Op:
invert = false;
- if (NULL != drawBounds && iter.get()->contains(boundsInClipSpace)) {
+ if (drawBounds && iter.get()->contains(boundsInClipSpace)) {
skip = true;
}
break;
@@ -225,7 +225,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
const GrRenderTarget* rt = drawState->getRenderTarget();
// GrDrawTarget should have filtered this for us
- SkASSERT(NULL != rt);
+ SkASSERT(rt);
bool ignoreClip = !drawState->isClipState() || clipDataIn->fClipStack->isWideOpen();
@@ -299,7 +299,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
clipSpaceIBounds);
}
- if (NULL != result) {
+ if (result) {
// The mask's top left coord should be pinned to the rounded-out top left corner of
// clipSpace bounds. We determine the mask's position WRT to the render target here.
SkIRect rtSpaceMaskBounds = clipSpaceIBounds;
@@ -453,7 +453,7 @@ bool GrClipMaskManager::canStencilAndDrawElement(GrTexture* target,
GrPathRendererChain::kStencilAndColorAntiAlias_DrawType :
GrPathRendererChain::kStencilAndColor_DrawType;
*pr = this->getContext()->getPathRenderer(path, stroke, fGpu, false, type);
- return NULL != *pr;
+ return SkToBool(*pr);
}
}
@@ -486,7 +486,7 @@ void GrClipMaskManager::mergeMask(GrTexture* dstMask,
// get a texture to act as a temporary buffer for AA clip boolean operations
// TODO: given the expense of createTexture we may want to just cache this too
void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* temp) {
- if (NULL != temp->texture()) {
+ if (temp->texture()) {
// we've already allocated the temp texture
return;
}
@@ -546,7 +546,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
// First, check for cached texture
GrTexture* result = this->getCachedMaskTexture(elementsGenID, clipSpaceIBounds);
- if (NULL != result) {
+ if (result) {
fCurrClipMaskType = kAlpha_ClipMaskType;
return result;
}
@@ -701,7 +701,7 @@ bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID,
SkASSERT(drawState->isClipState());
GrRenderTarget* rt = drawState->getRenderTarget();
- SkASSERT(NULL != rt);
+ SkASSERT(rt);
// TODO: dynamically attach a SB when needed.
GrStencilBuffer* stencilBuffer = rt->getStencilBuffer();
@@ -743,7 +743,7 @@ bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID,
// walk through each clip element and perform its set op
// with the existing clip.
- for (ElementList::Iter iter(elements.headIter()); NULL != iter.get(); iter.next()) {
+ for (ElementList::Iter iter(elements.headIter()); iter.get(); iter.next()) {
const Element* element = iter.get();
bool fillInverted = false;
// enabled at bottom of loop
@@ -946,7 +946,7 @@ void GrClipMaskManager::setGpuStencil() {
int stencilBits = 0;
GrStencilBuffer* stencilBuffer =
drawState.getRenderTarget()->getStencilBuffer();
- if (NULL != stencilBuffer) {
+ if (stencilBuffer) {
stencilBits = stencilBuffer->bits();
}
@@ -1045,7 +1045,7 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
GrTexture* result = this->getCachedMaskTexture(elementsGenID, clipSpaceIBounds);
- if (NULL != result) {
+ if (result) {
return result;
}
@@ -1064,7 +1064,7 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
- for (ElementList::Iter iter(elements.headIter()) ; NULL != iter.get(); iter.next()) {
+ for (ElementList::Iter iter(elements.headIter()) ; iter.get(); iter.next()) {
const Element* element = iter.get();
SkRegion::Op op = element->getOp();
@@ -1140,7 +1140,7 @@ void GrClipMaskManager::adjustPathStencilParams(GrStencilSettings* settings) {
int stencilBits = 0;
GrStencilBuffer* stencilBuffer =
drawState.getRenderTarget()->getStencilBuffer();
- if (NULL != stencilBuffer) {
+ if (stencilBuffer) {
stencilBits = stencilBuffer->bits();
this->adjustStencilParams(settings, clipMode, stencilBits);
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 85d53119b6..8d515bf09c 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -73,7 +73,7 @@ class GrContext::AutoRestoreEffects : public GrDrawState::AutoRestoreEffects {};
class GrContext::AutoCheckFlush {
public:
- AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(NULL != context); }
+ AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(context); }
~AutoCheckFlush() {
if (fContext->fFlushToReduceCacheSize) {
@@ -220,7 +220,7 @@ void GrContext::freeGpuResources() {
this->flush();
fGpu->purgeResources();
- if (NULL != fDrawBuffer) {
+ if (fDrawBuffer) {
fDrawBuffer->purgeResources();
}
@@ -236,10 +236,10 @@ void GrContext::freeGpuResources() {
}
void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
- if (NULL != resourceCount) {
+ if (resourceCount) {
*resourceCount = fResourceCache->getCachedResourceCount();
}
- if (NULL != resourceBytes) {
+ if (resourceBytes) {
*resourceBytes = fResourceCache->getCachedResourceBytes();
}
}
@@ -353,7 +353,7 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
GrTexture* texture = fGpu->createTexture(rtDesc, NULL, 0);
- if (NULL != texture) {
+ if (texture) {
GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
GrDrawState* drawState = fGpu->drawState();
drawState->setRenderTarget(texture->asRenderTarget());
@@ -398,7 +398,7 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
size_t stretchedRowBytes = rtDesc.fWidth * bpp;
texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRowBytes);
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
}
return texture;
@@ -424,13 +424,13 @@ GrTexture* GrContext::createTexture(const GrTextureParams* params,
texture = fGpu->createTexture(desc, srcData, rowBytes);
}
- if (NULL != texture) {
+ if (texture) {
// Adding a resource could put us overbudget. Try to free up the
// necessary space before adding it.
fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize());
fResourceCache->addResource(resourceKey, texture);
- if (NULL != cacheKey) {
+ if (cacheKey) {
*cacheKey = resourceKey;
}
}
@@ -442,7 +442,7 @@ static GrTexture* create_scratch_texture(GrGpu* gpu,
GrResourceCache* resourceCache,
const GrTextureDesc& desc) {
GrTexture* texture = gpu->createTexture(desc, NULL, 0);
- if (NULL != texture) {
+ if (texture) {
GrResourceKey key = GrTextureImpl::ComputeScratchKey(texture->desc());
// Adding a resource could put us overbudget. Try to free up the
// necessary space before adding it.
@@ -486,7 +486,7 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
GrResourceKey key = GrTextureImpl::ComputeScratchKey(desc);
// Ensure we have exclusive access to the texture so future 'find' calls don't return it
resource = fResourceCache->find(key, GrResourceCache::kHide_OwnershipFlag);
- if (NULL != resource) {
+ if (resource) {
resource->ref();
break;
}
@@ -524,7 +524,7 @@ void GrContext::addExistingTextureToCache(GrTexture* texture) {
// This texture should already have a cache entry since it was once
// attached
- SkASSERT(NULL != texture->getCacheEntry());
+ SkASSERT(texture->getCacheEntry());
// Conceptually, the cache entry is going to assume responsibility
// for the creation ref. Assert refcnt == 1.
@@ -532,7 +532,7 @@ void GrContext::addExistingTextureToCache(GrTexture* texture) {
// abandoned. In that case the ref count may be > 1.
// SkASSERT(texture->unique());
- if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
+ if (fGpu->caps()->reuseScratchTextures() || texture->asRenderTarget()) {
// Since this texture came from an AutoScratchTexture it should
// still be in the exclusive pile. Recycle it.
fResourceCache->makeNonExclusive(texture->getCacheEntry());
@@ -557,13 +557,13 @@ void GrContext::unlockScratchTexture(GrTexture* texture) {
}
ASSERT_OWNED_RESOURCE(texture);
- SkASSERT(NULL != texture->getCacheEntry());
+ SkASSERT(texture->getCacheEntry());
// If this is a scratch texture we detached it from the cache
// while it was locked (to avoid two callers simultaneously getting
// the same texture).
if (texture->getCacheEntry()->key().isScratch()) {
- if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
+ if (fGpu->caps()->reuseScratchTextures() || texture->asRenderTarget()) {
fResourceCache->makeNonExclusive(texture->getCacheEntry());
this->purgeCache();
} else if (texture->unique()) {
@@ -586,13 +586,13 @@ void GrContext::unlockScratchTexture(GrTexture* texture) {
}
void GrContext::purgeCache() {
- if (NULL != fResourceCache) {
+ if (fResourceCache) {
fResourceCache->purgeAsNeeded();
}
}
bool GrContext::OverbudgetCB(void* data) {
- SkASSERT(NULL != data);
+ SkASSERT(data);
GrContext* context = reinterpret_cast<GrContext*>(data);
@@ -652,7 +652,7 @@ bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params,
bool isPow2 = SkIsPow2(width) && SkIsPow2(height);
if (!isPow2) {
- bool tiled = NULL != params && params->isTiled();
+ bool tiled = params && params->isTiled();
if (tiled && !caps->npotTextureTileSupport()) {
return false;
}
@@ -795,7 +795,7 @@ static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
void GrContext::drawRect(const GrPaint& paint,
const SkRect& rect,
const GrStrokeInfo* strokeInfo) {
- if (NULL != strokeInfo && strokeInfo->isDashed()) {
+ if (strokeInfo && strokeInfo->isDashed()) {
SkPath path;
path.addRect(rect);
this->drawPath(paint, path, *strokeInfo);
@@ -820,7 +820,7 @@ void GrContext::drawRect(const GrPaint& paint,
target->getDrawState().getRenderTarget()->getBoundsRect(&rtRect);
SkRect clipSpaceRTRect = rtRect;
bool checkClip = false;
- if (NULL != this->getClip()) {
+ if (this->getClip()) {
checkClip = true;
clipSpaceRTRect.offset(SkIntToScalar(this->getClip()->fOrigin.fX),
SkIntToScalar(this->getClip()->fOrigin.fY));
@@ -955,14 +955,14 @@ static void set_vertex_attributes(GrDrawState* drawState,
*texOffset = -1;
*colorOffset = -1;
- if (NULL != texCoords && NULL != colors) {
+ if (texCoords && colors) {
*texOffset = sizeof(SkPoint);
*colorOffset = 2*sizeof(SkPoint);
drawState->setVertexAttribs<gPosUVColorAttribs>(3, kPosUVColorAttribsSize);
- } else if (NULL != texCoords) {
+ } else if (texCoords) {
*texOffset = sizeof(SkPoint);
drawState->setVertexAttribs<gPosUVColorAttribs>(2, kPosUVAttribsSize);
- } else if (NULL != colors) {
+ } else if (colors) {
*colorOffset = sizeof(SkPoint);
drawState->setVertexAttribs<gPosColorAttribs>(2, kPosColorAttribsSize);
} else {
@@ -1021,7 +1021,7 @@ void GrContext::drawVertices(const GrPaint& paint,
// we don't currently apply offscreen AA to this path. Need improved
// management of GrDrawTarget's geometry to avoid copying points per-tile.
- if (NULL != indices) {
+ if (indices) {
target->setIndexSourceToArray(indices, indexCount);
target->drawIndexed(primitiveType, 0, 0, vertexCount, indexCount);
target->resetIndexSource();
@@ -1338,7 +1338,7 @@ bool GrContext::writeTexturePixels(GrTexture* texture,
ASSERT_OWNED_RESOURCE(texture);
if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture, config)) {
- if (NULL != texture->asRenderTarget()) {
+ if (texture->asRenderTarget()) {
return this->writeRenderTargetPixels(texture->asRenderTarget(),
left, top, width, height,
config, buffer, rowBytes, flags);
@@ -1362,7 +1362,7 @@ bool GrContext::readTexturePixels(GrTexture* texture,
ASSERT_OWNED_RESOURCE(texture);
GrRenderTarget* target = texture->asRenderTarget();
- if (NULL != target) {
+ if (target) {
return this->readRenderTargetPixels(target,
left, top, width, height,
config, buffer, rowBytes,
@@ -1381,7 +1381,7 @@ bool GrContext::readTexturePixels(GrTexture* texture,
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
ast.set(this, desc, kExact_ScratchTexMatch);
GrTexture* dst = ast.texture();
- if (NULL != dst && NULL != (target = dst->asRenderTarget())) {
+ if (dst && (target = dst->asRenderTarget())) {
this->copyTexture(texture, target, NULL);
return this->readRenderTargetPixels(target,
left, top, width, height,
@@ -1455,7 +1455,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
// on the read back pixels.
GrTexture* src = target->asTexture();
GrAutoScratchTexture ast;
- if (NULL != src && (swapRAndB || unpremul || flipY)) {
+ if (src && (swapRAndB || unpremul || flipY)) {
// Make the scratch a render target because we don't have a robust readTexturePixels as of
// yet. It calls this function.
GrTextureDesc desc;
@@ -1488,13 +1488,13 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
SkAutoTUnref<const GrEffect> effect;
if (unpremul) {
effect.reset(this->createPMToUPMEffect(src, swapRAndB, textureMatrix));
- if (NULL != effect) {
+ if (effect) {
unpremul = false; // we no longer need to do this on CPU after the read back.
}
}
// If we failed to create a PM->UPM effect and have no other conversions to perform then
// there is no longer any point to using the scratch.
- if (NULL != effect || flipY || swapRAndB) {
+ if (effect || flipY || swapRAndB) {
if (!effect) {
effect.reset(GrConfigConversionEffect::Create(
src,
@@ -1555,7 +1555,7 @@ void GrContext::resolveRenderTarget(GrRenderTarget* target) {
// target. We don't today so we always perform a flush. We don't promise
// this to our clients, though.
this->flush();
- if (NULL != fGpu) {
+ if (fGpu) {
fGpu->resolveRenderTarget(target);
}
}
@@ -1590,7 +1590,7 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
SkMatrix sampleM;
sampleM.setIDiv(src->width(), src->height());
SkIRect srcRect = SkIRect::MakeWH(dst->width(), dst->height());
- if (NULL != topLeft) {
+ if (topLeft) {
srcRect.offset(*topLeft);
}
SkIRect srcBounds = SkIRect::MakeWH(src->width(), src->height());
@@ -1633,7 +1633,7 @@ bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
// At least some drivers on the Mac get confused when glTexImage2D is called on a texture
// attached to an FBO. The FBO still sees the old image. TODO: determine what OS versions and/or
// HW is affected.
- if (NULL != target->asTexture() && !(kUnpremul_PixelOpsFlag & flags) &&
+ if (target->asTexture() && !(kUnpremul_PixelOpsFlag & flags) &&
fGpu->canWriteTexturePixels(target->asTexture(), srcConfig)) {
return this->writeTexturePixels(target->asTexture(),
left, top, width, height,
@@ -1750,9 +1750,9 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint,
fLastDrawWasBuffered = kNo_BufferedDraw;
}
ASSERT_OWNED_RESOURCE(fRenderTarget.get());
- if (NULL != paint) {
- SkASSERT(NULL != are);
- SkASSERT(NULL != acf);
+ if (paint) {
+ SkASSERT(are);
+ SkASSERT(acf);
are->set(fDrawState);
fDrawState->setFromPaint(*paint, fViewMatrix, fRenderTarget.get());
#if GR_DEBUG_PARTIAL_COVERAGE_CHECK
@@ -1777,7 +1777,7 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint,
fLastDrawWasBuffered = kNo_BufferedDraw;
target = fGpu;
}
- fDrawState->setState(GrDrawState::kClip_StateBit, NULL != fClip &&
+ fDrawState->setState(GrDrawState::kClip_StateBit, fClip &&
!fClip->fClipStack->isWideOpen());
target->setClip(fClip);
SkASSERT(fDrawState == target->drawState());
@@ -1916,7 +1916,7 @@ GrPath* GrContext::createPath(const SkPath& inPath, const SkStrokeRec& stroke) {
// TODO: now we add to fResourceCache. This should change to fResourceCache.
GrResourceKey resourceKey = GrPath::ComputeKey(inPath, stroke);
GrPath* path = static_cast<GrPath*>(fResourceCache->find(resourceKey));
- if (NULL != path && path->isEqualTo(inPath, stroke)) {
+ if (path && path->isEqualTo(inPath, stroke)) {
path->ref();
} else {
path = fGpu->createPath(inPath, stroke);
@@ -1939,14 +1939,14 @@ GrGpuResource* GrContext::findAndRefCachedResource(const GrResourceKey& resource
void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) {
fGpu->addGpuTraceMarker(marker);
- if (NULL != fDrawBuffer) {
+ if (fDrawBuffer) {
fDrawBuffer->addGpuTraceMarker(marker);
}
}
void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
fGpu->removeGpuTraceMarker(marker);
- if (NULL != fDrawBuffer) {
+ if (fDrawBuffer) {
fDrawBuffer->removeGpuTraceMarker(marker);
}
}
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index dd6ae9d025..9d08997fd4 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -240,7 +240,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
uint16_t subpathIdxStart = 0;
SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices());
- SkASSERT(NULL != base);
+ SkASSERT(base);
SkPoint* vert = base;
SkPoint pts[4];
@@ -361,7 +361,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
return false;
}
- SkASSERT(NULL != target);
+ SkASSERT(target);
GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit);
GrDrawState* drawState = target->drawState();
bool colorWritesWereDisabled = drawState->isColorWriteDisabled();
@@ -465,7 +465,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
for (int p = 0; p < passCount; ++p) {
drawState->setDrawFace(drawFace[p]);
- if (NULL != passes[p]) {
+ if (passes[p]) {
*drawState->stencil() = *passes[p];
}
@@ -476,7 +476,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
SkRect bounds;
GrDrawState::AutoViewMatrixRestore avmr;
if (reverse) {
- SkASSERT(NULL != drawState->getRenderTarget());
+ SkASSERT(drawState->getRenderTarget());
// draw over the dev bounds (which will be the whole dst surface for inv fill).
bounds = devBounds;
SkMatrix vmi;
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index dc0ea954ec..0aafc544d7 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -188,7 +188,7 @@ void GrDistanceFieldTextContext::flushGlyphs() {
// get our current color
SkColor filteredColor;
SkColorFilter* colorFilter = fSkPaint.getColorFilter();
- if (NULL != colorFilter) {
+ if (colorFilter) {
filteredColor = colorFilter->filterColor(fSkPaint.getColor());
} else {
filteredColor = fSkPaint.getColor();
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index f2028eaf94..4834811a87 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -287,7 +287,7 @@ bool GrDrawState::couldApplyCoverage(const GrDrawTargetCaps& caps) const {
GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(
GrDrawState* drawState) {
- SkASSERT(NULL != drawState);
+ SkASSERT(drawState);
fDrawState = drawState;
fVAPtr = drawState->fVAPtr;
fVACount = drawState->fVACount;
@@ -298,7 +298,7 @@ GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(
//////////////////////////////////////////////////////////////////////////////s
void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
- if (NULL != fDrawState) {
+ if (fDrawState) {
// See the big comment on the class definition about GPs.
if (SK_InvalidUniqueID == fOriginalGPID) {
fDrawState->fGeometryProcessor.reset(NULL);
@@ -447,7 +447,7 @@ GrRODrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
////////////////////////////////////////////////////////////////////////////////
void GrDrawState::AutoViewMatrixRestore::restore() {
- if (NULL != fDrawState) {
+ if (fDrawState) {
SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
fDrawState->fViewMatrix = fViewMatrix;
SkASSERT(fDrawState->numColorStages() >= fNumColorStages);
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 6223f5388b..f7dc69f0a1 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -172,7 +172,7 @@ public:
*/
const GrEffect* setGeometryProcessor(const GrEffect* effect, int attr0 = -1, int attr1 = -1) {
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
SkASSERT(!this->hasGeometryProcessor());
fGeometryProcessor.reset(new GrEffectStage(effect, attr0, attr1));
this->invalidateBlendOptFlags();
@@ -200,14 +200,14 @@ public:
////
const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) {
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, attr1));
this->invalidateBlendOptFlags();
return effect;
}
const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) {
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1));
this->invalidateBlendOptFlags();
return effect;
@@ -272,7 +272,7 @@ public:
void set(GrDrawState* ds);
- bool isSet() const { return NULL != fDrawState; }
+ bool isSet() const { return SkToBool(fDrawState); }
private:
GrDrawState* fDrawState;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 191194eb50..3f1d1c806d 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,7 +32,7 @@ GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) {
fVerticesPerInstance = di.fVerticesPerInstance;
fIndicesPerInstance = di.fIndicesPerInstance;
- if (NULL != di.fDevBounds) {
+ if (di.fDevBounds) {
SkASSERT(di.fDevBounds == &di.fDevBoundsStorage);
fDevBoundsStorage = di.fDevBoundsStorage;
fDevBounds = &fDevBoundsStorage;
@@ -91,7 +91,7 @@ GrDrawTarget::GrDrawTarget(GrContext* context)
: fClip(NULL)
, fContext(context)
, fGpuTraceMarkerCount(0) {
- SkASSERT(NULL != context);
+ SkASSERT(context);
fDrawState = &fDefaultDrawState;
// We assume that fDrawState always owns a ref to the object it points at.
@@ -135,7 +135,7 @@ const GrClipData* GrDrawTarget::getClip() const {
}
void GrDrawTarget::setDrawState(GrDrawState* drawState) {
- SkASSERT(NULL != fDrawState);
+ SkASSERT(fDrawState);
if (NULL == drawState) {
drawState = &fDefaultDrawState;
}
@@ -152,7 +152,7 @@ bool GrDrawTarget::reserveVertexSpace(size_t vertexSize,
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
bool acquired = false;
if (vertexCount > 0) {
- SkASSERT(NULL != vertices);
+ SkASSERT(vertices);
this->releasePreviousVertexSource();
geoSrc.fVertexSrc = kNone_GeometrySrcType;
@@ -164,7 +164,7 @@ bool GrDrawTarget::reserveVertexSpace(size_t vertexSize,
geoSrc.fVertexSrc = kReserved_GeometrySrcType;
geoSrc.fVertexCount = vertexCount;
geoSrc.fVertexSize = vertexSize;
- } else if (NULL != vertices) {
+ } else if (vertices) {
*vertices = NULL;
}
return acquired;
@@ -175,7 +175,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
bool acquired = false;
if (indexCount > 0) {
- SkASSERT(NULL != indices);
+ SkASSERT(indices);
this->releasePreviousIndexSource();
geoSrc.fIndexSrc = kNone_GeometrySrcType;
@@ -184,7 +184,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
if (acquired) {
geoSrc.fIndexSrc = kReserved_GeometrySrcType;
geoSrc.fIndexCount = indexCount;
- } else if (NULL != indices) {
+ } else if (indices) {
*indices = NULL;
}
return acquired;
@@ -218,10 +218,10 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(int vertexCount,
bool GrDrawTarget::geometryHints(int32_t* vertexCount,
int32_t* indexCount) const {
- if (NULL != vertexCount) {
+ if (vertexCount) {
*vertexCount = -1;
}
- if (NULL != indexCount) {
+ if (indexCount) {
*indexCount = -1;
}
return false;
@@ -387,7 +387,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex,
}
}
- SkASSERT(NULL != drawState.getRenderTarget());
+ SkASSERT(drawState.getRenderTarget());
if (drawState.hasGeometryProcessor()) {
const GrEffect* effect = drawState.getGeometryProcessor()->getEffect();
@@ -432,7 +432,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(GrDeviceCoordTexture* dstCopy, const
const GrClipData* clip = this->getClip();
clip->getConservativeBounds(rt, &copyRect);
- if (NULL != drawBounds) {
+ if (drawBounds) {
SkIRect drawIBounds;
drawBounds->roundOut(&drawIBounds);
if (!copyRect.intersect(drawIBounds)) {
@@ -488,7 +488,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type,
info.fVerticesPerInstance = 0;
info.fIndicesPerInstance = 0;
- if (NULL != devBounds) {
+ if (devBounds) {
info.setDevBounds(*devBounds);
}
// TODO: We should continue with incorrect blending.
@@ -515,7 +515,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
info.fVerticesPerInstance = 0;
info.fIndicesPerInstance = 0;
- if (NULL != devBounds) {
+ if (devBounds) {
info.setDevBounds(*devBounds);
}
// TODO: We should continue with incorrect blending.
@@ -528,7 +528,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path stenciling.
- SkASSERT(NULL != path);
+ SkASSERT(path);
SkASSERT(this->caps()->pathRenderingSupport());
SkASSERT(!SkPath::IsInverseFillType(fill));
this->onStencilPath(path, fill);
@@ -536,7 +536,7 @@ void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) {
void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path rendering.
- SkASSERT(NULL != path);
+ SkASSERT(path);
SkASSERT(this->caps()->pathRenderingSupport());
const GrDrawState* drawState = &getDrawState();
@@ -563,9 +563,9 @@ void GrDrawTarget::drawPaths(const GrPathRange* pathRange,
const float transforms[], PathTransformType transformsType,
SkPath::FillType fill) {
SkASSERT(this->caps()->pathRenderingSupport());
- SkASSERT(NULL != pathRange);
- SkASSERT(NULL != indices);
- SkASSERT(NULL != transforms);
+ SkASSERT(pathRange);
+ SkASSERT(indices);
+ SkASSERT(transforms);
// Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt
// instead for it to just copy the entire dst. Realistically this is a moot
@@ -645,7 +645,7 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
info.fVerticesPerInstance = verticesPerInstance;
// Set the same bounds for all the draws.
- if (NULL != devBounds) {
+ if (devBounds) {
info.setDevBounds(*devBounds);
}
// TODO: We should continue with incorrect blending.
@@ -694,7 +694,7 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
- set_vertex_attributes(this->drawState(), NULL != localRect);
+ set_vertex_attributes(this->drawState(), SkToBool(localRect));
AutoReleaseGeometry geo(this, 4, 0);
if (!geo.succeeded()) {
@@ -704,13 +704,13 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
size_t vstride = this->drawState()->getVertexStride();
geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
- if (NULL != localRect) {
+ if (localRect) {
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) +
sizeof(SkPoint));
coords->setRectFan(localRect->fLeft, localRect->fTop,
localRect->fRight, localRect->fBottom,
vstride);
- if (NULL != localMatrix) {
+ if (localMatrix) {
localMatrix->mapPointsWithStride(coords, vstride, 4);
}
}
@@ -737,7 +737,7 @@ GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target,
}
GrDrawTarget::AutoStateRestore::~AutoStateRestore() {
- if (NULL != fDrawTarget) {
+ if (fDrawTarget) {
fDrawTarget->setDrawState(fSavedState);
fSavedState->unref();
}
@@ -817,7 +817,7 @@ bool GrDrawTarget::AutoReleaseGeometry::set(GrDrawTarget* target,
this->reset();
fTarget = target;
bool success = true;
- if (NULL != fTarget) {
+ if (fTarget) {
fTarget = target;
success = target->reserveVertexAndIndexSpace(vertexCount,
indexCount,
@@ -828,16 +828,16 @@ bool GrDrawTarget::AutoReleaseGeometry::set(GrDrawTarget* target,
this->reset();
}
}
- SkASSERT(success == (NULL != fTarget));
+ SkASSERT(success == SkToBool(fTarget));
return success;
}
void GrDrawTarget::AutoReleaseGeometry::reset() {
- if (NULL != fTarget) {
- if (NULL != fVertices) {
+ if (fTarget) {
+ if (fVertices) {
fTarget->resetVertexSource();
}
- if (NULL != fIndices) {
+ if (fIndices) {
fTarget->resetIndexSource();
}
fTarget = NULL;
@@ -912,8 +912,8 @@ bool GrDrawTarget::copySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(NULL != dst);
- SkASSERT(NULL != src);
+ SkASSERT(dst);
+ SkASSERT(src);
SkIRect clippedSrcRect;
SkIPoint clippedDstPoint;
@@ -937,8 +937,8 @@ bool GrDrawTarget::canCopySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(NULL != dst);
- SkASSERT(NULL != src);
+ SkASSERT(dst);
+ SkASSERT(src);
SkIRect clippedSrcRect;
SkIPoint clippedDstPoint;
@@ -965,7 +965,7 @@ bool GrDrawTarget::onCanCopySurface(GrSurface* dst,
SkASSERT(dstPoint.fX + srcRect.width() <= dst->width() &&
dstPoint.fY + srcRect.height() <= dst->height());
- return !dst->isSameAs(src) && NULL != dst->asRenderTarget() && NULL != src->asTexture();
+ return !dst->isSameAs(src) && dst->asRenderTarget() && src->asTexture();
}
bool GrDrawTarget::onCopySurface(GrSurface* dst,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 998f41282d..814d57f326 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -593,7 +593,7 @@ public:
bool set(GrDrawTarget* target,
int vertexCount,
int indexCount);
- bool succeeded() const { return NULL != fTarget; }
+ bool succeeded() const { return SkToBool(fTarget); }
void* vertices() const { SkASSERT(this->succeeded()); return fVertices; }
void* indices() const { SkASSERT(this->succeeded()); return fIndices; }
SkPoint* positions() const {
@@ -639,7 +639,7 @@ public:
public:
AutoGeometryPush(GrDrawTarget* target)
: fAttribRestore(target->drawState()) {
- SkASSERT(NULL != target);
+ SkASSERT(target);
fTarget = target;
target->pushGeometrySource();
}
@@ -661,7 +661,7 @@ public:
ASRInit init,
const SkMatrix* viewMatrix = NULL)
: fState(target, init, viewMatrix) {
- SkASSERT(NULL != target);
+ SkASSERT(target);
fTarget = target;
target->pushGeometrySource();
if (kPreserve_ASRInit == init) {
@@ -683,7 +683,7 @@ public:
DrawToken(GrDrawTarget* drawTarget, uint32_t drawID) :
fDrawTarget(drawTarget), fDrawID(drawID) {}
- bool isIssued() { return NULL != fDrawTarget && fDrawTarget->isIssued(fDrawID); }
+ bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID); }
private:
GrDrawTarget* fDrawTarget;
@@ -822,7 +822,7 @@ protected:
// NULL if no copy of the dst is needed for the draw.
const GrDeviceCoordTexture* getDstCopy() const {
- if (NULL != fDstCopy.texture()) {
+ if (fDstCopy.texture()) {
return &fDstCopy;
} else {
return NULL;
diff --git a/src/gpu/GrGeometryBuffer.h b/src/gpu/GrGeometryBuffer.h
index 3d57f1dbec..c3e1c65252 100644
--- a/src/gpu/GrGeometryBuffer.h
+++ b/src/gpu/GrGeometryBuffer.h
@@ -58,7 +58,7 @@ public:
* The pointer returned by the previous map call will no longer be valid.
*/
void unmap() {
- SkASSERT(NULL != fMapPtr);
+ SkASSERT(fMapPtr);
this->onUnmap();
fMapPtr = NULL;
}
@@ -76,7 +76,7 @@ public:
@return true if the buffer is mapped, false otherwise.
*/
- bool isMapped() const { return NULL != fMapPtr; }
+ bool isMapped() const { return SkToBool(fMapPtr); }
/**
* Updates the buffer data.
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 2ceef609e8..667cae9c44 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -87,10 +87,10 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
} else {
this->handleDirtyContext();
tex = this->onCreateTexture(desc, srcData, rowBytes);
- if (NULL != tex &&
+ if (tex &&
(kRenderTarget_GrTextureFlagBit & desc.fFlags) &&
!(kNoStencil_GrTextureFlagBit & desc.fFlags)) {
- SkASSERT(NULL != tex->asRenderTarget());
+ SkASSERT(tex->asRenderTarget());
// TODO: defer this and attach dynamically
if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) {
tex->unref();
@@ -107,7 +107,7 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
this->getContext()->findStencilBuffer(rt->width(),
rt->height(),
rt->numSamples());
- if (NULL != sb) {
+ if (sb) {
rt->setStencilBuffer(sb);
bool attached = this->attachStencilBufferToRenderTarget(sb, rt);
if (!attached) {
@@ -140,7 +140,7 @@ GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) {
}
// TODO: defer this and attach dynamically
GrRenderTarget* tgt = tex->asRenderTarget();
- if (NULL != tgt &&
+ if (tgt &&
!this->attachStencilBufferToRenderTarget(tgt)) {
tex->unref();
return NULL;
@@ -274,9 +274,9 @@ const GrIndexBuffer* GrGpu::getQuadIndexBuffer() const {
static const int SIZE = sizeof(uint16_t) * 6 * MAX_QUADS;
GrGpu* me = const_cast<GrGpu*>(this);
fQuadIndexBuffer = me->createIndexBuffer(SIZE, false);
- if (NULL != fQuadIndexBuffer) {
+ if (fQuadIndexBuffer) {
uint16_t* indices = (uint16_t*)fQuadIndexBuffer->map();
- if (NULL != indices) {
+ if (indices) {
fill_indices(indices, MAX_QUADS);
fQuadIndexBuffer->unmap();
} else {
@@ -393,12 +393,12 @@ void GrGpu::onDrawPaths(const GrPathRange* pathRange,
}
void GrGpu::finalizeReservedVertices() {
- SkASSERT(NULL != fVertexPool);
+ SkASSERT(fVertexPool);
fVertexPool->unmap();
}
void GrGpu::finalizeReservedIndices() {
- SkASSERT(NULL != fIndexPool);
+ SkASSERT(fIndexPool);
fIndexPool->unmap();
}
@@ -434,7 +434,7 @@ bool GrGpu::onReserveVertexSpace(size_t vertexSize,
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
SkASSERT(vertexCount > 0);
- SkASSERT(NULL != vertices);
+ SkASSERT(vertices);
this->prepareVertexPool();
@@ -453,7 +453,7 @@ bool GrGpu::onReserveIndexSpace(int indexCount, void** indices) {
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
SkASSERT(indexCount > 0);
- SkASSERT(NULL != indices);
+ SkASSERT(indices);
this->prepareIndexPool();
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index d29ab6d486..a8d7bbf9f5 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -22,9 +22,9 @@ GrGpuRef::~GrGpuRef() {
///////////////////////////////////////////////////////////////////////////////
static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
- SkASSERT(NULL != gpu);
- SkASSERT(NULL != gpu->getContext());
- SkASSERT(NULL != gpu->getContext()->getResourceCache2());
+ SkASSERT(gpu);
+ SkASSERT(gpu->getContext());
+ SkASSERT(gpu->getContext()->getResourceCache2());
return gpu->getContext()->getResourceCache2();
}
@@ -50,7 +50,7 @@ GrGpuResource::~GrGpuResource() {
}
void GrGpuResource::release() {
- if (NULL != fGpu) {
+ if (fGpu) {
this->onRelease();
get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
@@ -58,7 +58,7 @@ void GrGpuResource::release() {
}
void GrGpuResource::abandon() {
- if (NULL != fGpu) {
+ if (fGpu) {
this->onAbandon();
get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
@@ -66,7 +66,7 @@ void GrGpuResource::abandon() {
}
const GrContext* GrGpuResource::getContext() const {
- if (NULL != fGpu) {
+ if (fGpu) {
return fGpu->getContext();
} else {
return NULL;
@@ -74,7 +74,7 @@ const GrContext* GrGpuResource::getContext() const {
}
GrContext* GrGpuResource::getContext() {
- if (NULL != fGpu) {
+ if (fGpu) {
return fGpu->getContext();
} else {
return NULL;
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 4fd6b4e331..b7180da45c 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -34,8 +34,8 @@ GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrGpu* gpu,
fDstGpu->ref();
fCaps.reset(SkRef(fDstGpu->caps()));
- SkASSERT(NULL != vertexPool);
- SkASSERT(NULL != indexPool);
+ SkASSERT(vertexPool);
+ SkASSERT(indexPool);
GeometryPoolState& poolState = fGeoPoolStateStack.push_back();
poolState.fUsedPoolVertexBytes = 0;
@@ -124,7 +124,7 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
GrColor color = drawState->getColor();
- set_vertex_attributes(drawState, NULL != localRect, color);
+ set_vertex_attributes(drawState, SkToBool(localRect), color);
AutoReleaseGeometry geo(this, 4, 0);
if (!geo.succeeded()) {
@@ -153,13 +153,13 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
// unnecessary clipping in our onDraw().
get_vertex_bounds(geo.vertices(), vstride, 4, &devBounds);
- if (NULL != localRect) {
+ if (localRect) {
static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor);
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + kLocalOffset);
coords->setRectFan(localRect->fLeft, localRect->fTop,
localRect->fRight, localRect->fBottom,
vstride);
- if (NULL != localMatrix) {
+ if (localMatrix) {
localMatrix->mapPointsWithStride(coords, vstride, 4);
}
}
@@ -288,7 +288,7 @@ class AutoClipReenable {
public:
AutoClipReenable() : fDrawState(NULL) {}
~AutoClipReenable() {
- if (NULL != fDrawState) {
+ if (fDrawState) {
fDrawState->enableState(GrDrawState::kClip_StateBit);
}
}
@@ -309,7 +309,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
AutoClipReenable acr;
if (drawState.isClipState() &&
- NULL != info.getDevBounds() &&
+ info.getDevBounds() &&
this->quickInsideClip(*info.getDevBounds())) {
acr.set(this->drawState());
}
@@ -407,7 +407,7 @@ void GrInOrderDrawBuffer::onDrawPath(const GrPath* path,
cp->fPath.reset(path);
path->ref();
cp->fFill = fill;
- if (NULL != dstCopy) {
+ if (dstCopy) {
cp->fDstCopy = *dstCopy;
}
}
@@ -416,9 +416,9 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrPathRange* pathRange,
const uint32_t indices[], int count,
const float transforms[], PathTransformType transformsType,
SkPath::FillType fill, const GrDeviceCoordTexture* dstCopy) {
- SkASSERT(NULL != pathRange);
- SkASSERT(NULL != indices);
- SkASSERT(NULL != transforms);
+ SkASSERT(pathRange);
+ SkASSERT(indices);
+ SkASSERT(transforms);
if (this->needsNewClip()) {
this->recordClip();
@@ -437,7 +437,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrPathRange* pathRange,
dp->fFill = fill;
- if (NULL != dstCopy) {
+ if (dstCopy) {
dp->fDstCopy = *dstCopy;
}
}
@@ -447,7 +447,7 @@ void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color,
SkIRect r;
if (NULL == renderTarget) {
renderTarget = this->drawState()->getRenderTarget();
- SkASSERT(NULL != renderTarget);
+ SkASSERT(renderTarget);
}
if (NULL == rect) {
// We could do something smart and remove previous draws and clears to
@@ -471,7 +471,7 @@ void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) {
}
if (NULL == renderTarget) {
renderTarget = this->drawState()->getRenderTarget();
- SkASSERT(NULL != renderTarget);
+ SkASSERT(renderTarget);
}
Clear* clr = this->recordClear();
clr->fColor = GrColor_ILLEGAL;
@@ -487,7 +487,7 @@ void GrInOrderDrawBuffer::reset() {
DrawAllocator::Iter drawIter(&fDraws);
while (drawIter.next()) {
// we always have a VB, but not always an IB
- SkASSERT(NULL != drawIter->fVertexBuffer);
+ SkASSERT(drawIter->fVertexBuffer);
drawIter->fVertexBuffer->unref();
SkSafeUnref(drawIter->fIndexBuffer);
}
@@ -576,7 +576,7 @@ void GrInOrderDrawBuffer::flush() {
SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(drawPathIter.next());
fDstGpu->executeDrawPath(drawPathIter->fPath.get(), drawPathIter->fFill,
- NULL != drawPathIter->fDstCopy.texture() ?
+ drawPathIter->fDstCopy.texture() ?
&drawPathIter->fDstCopy :
NULL);
break;
@@ -585,7 +585,7 @@ void GrInOrderDrawBuffer::flush() {
SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(drawPathsIter.next());
const GrDeviceCoordTexture* dstCopy =
- NULL !=drawPathsIter->fDstCopy.texture() ? &drawPathsIter->fDstCopy : NULL;
+ drawPathsIter->fDstCopy.texture() ? &drawPathsIter->fDstCopy : NULL;
fDstGpu->executeDrawPaths(drawPathsIter->fPathRange.get(),
drawPathsIter->fIndices,
drawPathsIter->fCount,
@@ -715,7 +715,7 @@ bool GrInOrderDrawBuffer::geometryHints(int* vertexCount,
// preallocated buffer but none are left and it can't fit
// in the current buffer (which may not be prealloced).
bool flush = false;
- if (NULL != indexCount) {
+ if (indexCount) {
int32_t currIndices = fIndexPool.currentBufferIndices();
if (*indexCount > currIndices &&
(!fIndexPool.preallocatedBuffersRemaining() &&
@@ -725,7 +725,7 @@ bool GrInOrderDrawBuffer::geometryHints(int* vertexCount,
}
*indexCount = currIndices;
}
- if (NULL != vertexCount) {
+ if (vertexCount) {
size_t vertexStride = this->getDrawState().getVertexStride();
int32_t currVertices = fVertexPool.currentBufferVertices(vertexStride);
if (*vertexCount > currVertices &&
@@ -744,26 +744,26 @@ bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize,
void** vertices) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
SkASSERT(vertexCount > 0);
- SkASSERT(NULL != vertices);
+ SkASSERT(vertices);
SkASSERT(0 == poolState.fUsedPoolVertexBytes);
*vertices = fVertexPool.makeSpace(vertexSize,
vertexCount,
&poolState.fPoolVertexBuffer,
&poolState.fPoolStartVertex);
- return NULL != *vertices;
+ return SkToBool(*vertices);
}
bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
SkASSERT(indexCount > 0);
- SkASSERT(NULL != indices);
+ SkASSERT(indices);
SkASSERT(0 == poolState.fUsedPoolIndexBytes);
*indices = fIndexPool.makeSpace(indexCount,
&poolState.fPoolIndexBuffer,
&poolState.fPoolStartIndex);
- return NULL != *indices;
+ return SkToBool(*indices);
}
void GrInOrderDrawBuffer::releaseReservedVertexSpace() {
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 9325497997..0c2e6b0a4d 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -17,7 +17,7 @@ void GrCachedLayer::validate(const GrTexture* backingTexture) const {
SkASSERT(fKey.start() > 0 && fKey.stop() > 0);
- if (NULL != fTexture) {
+ if (fTexture) {
// If the layer is in some texture then it must occupy some rectangle
SkASSERT(!fRect.isEmpty());
if (!this->isAtlased()) {
@@ -30,17 +30,17 @@ void GrCachedLayer::validate(const GrTexture* backingTexture) const {
SkASSERT(!fLocked); // layers without a texture cannot be locked
}
- if (NULL != fPlot) {
+ if (fPlot) {
// If a layer has a plot (i.e., is atlased) then it must point to
// the backing texture. Additionally, its rect should be non-empty.
- SkASSERT(NULL != fTexture && backingTexture == fTexture);
+ SkASSERT(fTexture && backingTexture == fTexture);
SkASSERT(!fRect.isEmpty());
}
if (fLocked) {
// If a layer is locked it must have a texture (though it need not be
// the atlas-backing texture) and occupy some space.
- SkASSERT(NULL != fTexture);
+ SkASSERT(fTexture);
SkASSERT(!fRect.isEmpty());
}
}
@@ -50,12 +50,12 @@ public:
GrAutoValidateLayer(GrTexture* backingTexture, const GrCachedLayer* layer)
: fBackingTexture(backingTexture)
, fLayer(layer) {
- if (NULL != fLayer) {
+ if (fLayer) {
fLayer->validate(backingTexture);
}
}
~GrAutoValidateLayer() {
- if (NULL != fLayer) {
+ if (fLayer) {
fLayer->validate(fBackingTexture);
}
}
@@ -183,7 +183,7 @@ bool GrLayerCache::lock(GrCachedLayer* layer, const GrTextureDesc& desc, bool do
NULL, &loc);
// addToAtlas can allocate the backing texture
SkDEBUGCODE(avl.setBackingTexture(fAtlas->getTexture()));
- if (NULL != plot) {
+ if (plot) {
// The layer was successfully added to the atlas
GrIRect16 bounds = GrIRect16::MakeXYWH(loc.fX, loc.fY,
SkToS16(desc.fWidth),
@@ -234,7 +234,7 @@ void GrLayerCache::unlock(GrCachedLayer* layer) {
// can be used to separate the performance contribution of less
// render target pingponging from that due to the re-use of cached layers
GrPictureInfo* pictInfo = fPictureHash.find(layer->pictureID());
- SkASSERT(NULL != pictInfo);
+ SkASSERT(pictInfo);
GrAtlas::RemovePlot(&pictInfo->fPlotUsage, layer->plot());
@@ -262,7 +262,7 @@ void GrLayerCache::validate() const {
layer->validate(fAtlas->getTexture());
const GrPictureInfo* pictInfo = fPictureHash.find(layer->pictureID());
- if (NULL != pictInfo) {
+ if (pictInfo) {
// In aggressive cleanup mode a picture info should only exist if
// it has some atlased layers
#if !DISABLE_CACHING
@@ -274,8 +274,8 @@ void GrLayerCache::validate() const {
SkASSERT(!layer->isAtlased());
}
- if (NULL != layer->plot()) {
- SkASSERT(NULL != pictInfo);
+ if (layer->plot()) {
+ SkASSERT(pictInfo);
SkASSERT(pictInfo->fPictureID == layer->pictureID());
SkASSERT(pictInfo->fPlotUsage.contains(layer->plot()));
@@ -326,7 +326,7 @@ void GrLayerCache::purge(uint32_t pictureID) {
}
GrPictureInfo* pictInfo = fPictureHash.find(pictureID);
- if (NULL != pictInfo) {
+ if (pictInfo) {
fPictureHash.remove(pictureID);
SkDELETE(pictInfo);
}
@@ -338,7 +338,7 @@ bool GrLayerCache::purgePlot() {
GrAtlas::PlotIter iter;
GrPlot* plot;
for (plot = fAtlas->iterInit(&iter, GrAtlas::kLRUFirst_IterOrder);
- NULL != plot;
+ plot;
plot = iter.prev()) {
if (fPlotLocks[plot->id()] > 0) {
continue;
@@ -368,7 +368,7 @@ void GrLayerCache::purgePlot(GrPlot* plot) {
SkASSERT(!toBeRemoved[i]->locked());
GrPictureInfo* pictInfo = fPictureHash.find(toBeRemoved[i]->pictureID());
- SkASSERT(NULL != pictInfo);
+ SkASSERT(pictInfo);
GrAtlas::RemovePlot(&pictInfo->fPlotUsage, plot);
@@ -389,7 +389,7 @@ void GrLayerCache::purgeAll() {
GrAtlas::PlotIter iter;
GrPlot* plot;
for (plot = fAtlas->iterInit(&iter, GrAtlas::kLRUFirst_IterOrder);
- NULL != plot;
+ plot;
plot = iter.prev()) {
SkASSERT(0 == fPlotLocks[plot->id()]);
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index fcf62f9c3a..fc1467e120 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -122,7 +122,7 @@ public:
}
GrPlot* plot() { return fPlot; }
- bool isAtlased() const { return NULL != fPlot; }
+ bool isAtlased() const { return SkToBool(fPlot); }
void setLocked(bool locked) { fLocked = locked; }
bool locked() const { return fLocked; }
@@ -146,7 +146,7 @@ private:
// It is always NULL for non-atlased layers.
GrPlot* fPlot;
- // For non-atlased layers 'fLocked' should always match "NULL != fTexture".
+ // For non-atlased layers 'fLocked' should always match "fTexture".
// (i.e., if there is a texture it is locked).
// For atlased layers, 'fLocked' is true if the layer is in a plot and
// actively required for rendering. If the layer is in a plot but not
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 2ed5b0ae80..ac09df825b 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -139,7 +139,7 @@ void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache, const SkPicture* pic
SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
- SkASSERT(NULL != data);
+ SkASSERT(data);
const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
SkASSERT(0 != gpuData->numSaveLayers());
diff --git a/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index 8839c66d07..5009f20152 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -127,7 +127,7 @@ void GrMemoryPool::validate() {
do {
allocCount += block->fLiveCount;
SkASSERT(prev == block->fPrev);
- if (NULL != prev) {
+ if (prev) {
SkASSERT(prev->fNext == block);
}
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 330d4e9289..f694678e9d 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -881,7 +881,7 @@ GrIndexBuffer* GrOvalRenderer::rRectIndexBuffer(GrGpu* gpu) {
if (NULL == fRRectIndexBuffer) {
fRRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gRRectIndices), false);
- if (NULL != fRRectIndexBuffer) {
+ if (fRRectIndexBuffer) {
#ifdef SK_DEBUG
bool updated =
#endif
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index 328484bd2d..0e5b2ccdd5 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -76,7 +76,7 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0);
bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoeff);
- if (NULL != solidColor) {
+ if (solidColor) {
if (opaque) {
switch (srcCoeff) {
case kZero_GrBlendCoeff:
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 88665c1d42..1099b2be39 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -143,7 +143,7 @@ public:
static bool IsStrokeHairlineOrEquivalent(const SkStrokeRec& stroke, const SkMatrix& matrix,
SkScalar* outCoverage) {
if (stroke.isHairlineStyle()) {
- if (NULL != outCoverage) {
+ if (outCoverage) {
*outCoverage = SK_Scalar1;
}
return true;
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index cac0475bbf..81085728dd 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -65,7 +65,7 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const SkPath& path,
target);
if (support < minStencilSupport) {
continue;
- } else if (NULL != stencilSupport) {
+ } else if (stencilSupport) {
*stencilSupport = support;
}
}
diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp
index 4b0f77f386..8810eb8a07 100644
--- a/src/gpu/GrPictureUtils.cpp
+++ b/src/gpu/GrPictureUtils.cpp
@@ -89,7 +89,7 @@ private:
void updateClipBounds(const SkRecords::ClipRect& op) { fCurrentClipBounds = op.devBounds; }
void updateClipBounds(const SkRecords::ClipRegion& op) { fCurrentClipBounds = op.devBounds; }
void updateClipBounds(const SkRecords::SaveLayer& op) {
- if (NULL != op.bounds) {
+ if (op.bounds) {
fCurrentClipBounds.intersect(this->adjustAndMap(*op.bounds, op.paint));
}
}
@@ -264,7 +264,7 @@ const GrAccelData* GPUOptimize(const SkPicture* pict) {
const GrAccelData* existing =
static_cast<const GrAccelData*>(pict->EXPERIMENTAL_getAccelData(key));
- if (NULL != existing) {
+ if (existing) {
return existing;
}
diff --git a/src/gpu/GrProgramResource.cpp b/src/gpu/GrProgramResource.cpp
index 3bf25a1137..482caff7ee 100644
--- a/src/gpu/GrProgramResource.cpp
+++ b/src/gpu/GrProgramResource.cpp
@@ -24,7 +24,7 @@ GrProgramResource::GrProgramResource(GrGpuResource* resource, IOType ioType) {
GrProgramResource::~GrProgramResource() {
if (fOwnRef) {
- SkASSERT(NULL != fResource);
+ SkASSERT(fResource);
fResource->unref();
}
if (fPendingIO) {
@@ -48,7 +48,7 @@ GrProgramResource::~GrProgramResource() {
void GrProgramResource::reset() {
SkASSERT(!fPendingIO);
- SkASSERT((NULL != fResource) == fOwnRef);
+ SkASSERT(SkToBool(fResource) == fOwnRef);
if (fOwnRef) {
fResource->unref();
fOwnRef = false;
@@ -59,7 +59,7 @@ void GrProgramResource::reset() {
void GrProgramResource::setResource(GrGpuResource* resource, IOType ioType) {
SkASSERT(!fPendingIO);
- SkASSERT((NULL != fResource) == fOwnRef);
+ SkASSERT(SkToBool(fResource) == fOwnRef);
SkSafeUnref(fResource);
if (NULL == resource) {
fResource = NULL;
@@ -77,7 +77,7 @@ void GrProgramResource::markPendingIO() const {
// This should only be called when the owning GrProgramElement gets its first
// pendingExecution ref.
SkASSERT(!fPendingIO);
- SkASSERT(NULL != fResource);
+ SkASSERT(fResource);
fPendingIO = true;
switch (fIOType) {
case kNone_IOType:
@@ -127,7 +127,7 @@ void GrProgramResource::removeRef() const {
SkASSERT(fOwnRef);
SkASSERT(fPendingIO);
SkASSERT(kNone_IOType != fIOType);
- SkASSERT(NULL != fResource);
+ SkASSERT(fResource);
fResource->unref();
fOwnRef = false;
}
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp
index 2f02482258..f2ac34b388 100644
--- a/src/gpu/GrRODrawState.cpp
+++ b/src/gpu/GrRODrawState.cpp
@@ -82,7 +82,7 @@ bool GrRODrawState::validateVertexAttribs() const {
if (this->hasGeometryProcessor()) {
const GrEffectStage& stage = *this->getGeometryProcessor();
const GrEffect* effect = stage.getEffect();
- SkASSERT(NULL != effect);
+ SkASSERT(effect);
// make sure that any attribute indices have the correct binding type, that the attrib
// type and effect's shader lang type are compatible, and that attributes shared by
// multiple effects use the same shader lang type.
diff --git a/src/gpu/GrRODrawState.h b/src/gpu/GrRODrawState.h
index 88392ba35f..19bbfc160d 100644
--- a/src/gpu/GrRODrawState.h
+++ b/src/gpu/GrRODrawState.h
@@ -126,7 +126,7 @@ public:
(this->hasGeometryProcessor() ? 1 : 0);
}
- bool hasGeometryProcessor() const { return NULL != fGeometryProcessor.get(); }
+ bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get()); }
const GrEffectStage* getGeometryProcessor() const { return fGeometryProcessor.get(); }
const GrEffectStage& getColorStage(int stageIdx) const { return fColorStages[stageIdx]; }
const GrEffectStage& getCoverageStage(int stageIdx) const { return fCoverageStages[stageIdx]; }
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index ab5192680d..f0abd6481e 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -71,7 +71,7 @@ void GrRecordReplaceDraw(const SkRecord& record,
const GrReplacements::ReplacementInfo* ri = NULL;
int searchStart = 0;
- if (NULL != bbh) {
+ if (bbh) {
// Draw only ops that affect pixels in the canvas's current clip.
// The SkRecord and BBH were recorded in identity space. This canvas
// is not necessarily in that same space. getClipBounds() returns us
@@ -84,11 +84,11 @@ void GrRecordReplaceDraw(const SkRecord& record,
bbh->search(query, &ops);
for (int i = 0; i < ops.count(); i++) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
ri = replacements->lookupByStart((uintptr_t)ops[i], &searchStart);
- if (NULL != ri) {
+ if (ri) {
draw_replacement_bitmap(ri, canvas);
while ((uintptr_t)ops[i] < ri->fStop) {
@@ -102,11 +102,11 @@ void GrRecordReplaceDraw(const SkRecord& record,
}
} else {
for (unsigned int i = 0; i < record.count(); ++i) {
- if (NULL != callback && callback->abortDrawing()) {
+ if (callback && callback->abortDrawing()) {
return;
}
ri = replacements->lookupByStart(i, &searchStart);
- if (NULL != ri) {
+ if (ri) {
draw_replacement_bitmap(ri, canvas);
i = ri->fStop;
diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h
index d9b1a049bd..c58ae27900 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -204,7 +204,7 @@ public:
}
Iter& operator --() {
SkASSERT(*this != fTree->begin());
- if (NULL != fN) {
+ if (fN) {
fN = PredecessorNode(fN);
} else {
*this = fTree->last();
@@ -254,7 +254,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::last() {
template <typename T, typename C>
typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::find(const T& t) {
Node* n = fRoot;
- while (NULL != n) {
+ while (n) {
if (fComp(t, n->fItem)) {
n = n->fChildren[kLeft_Child];
} else {
@@ -271,7 +271,7 @@ template <typename T, typename C>
typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::findFirst(const T& t) {
Node* n = fRoot;
Node* leftMost = NULL;
- while (NULL != n) {
+ while (n) {
if (fComp(t, n->fItem)) {
n = n->fChildren[kLeft_Child];
} else {
@@ -291,7 +291,7 @@ template <typename T, typename C>
typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::findLast(const T& t) {
Node* n = fRoot;
Node* rightMost = NULL;
- while (NULL != n) {
+ while (n) {
if (fComp(t, n->fItem)) {
n = n->fChildren[kLeft_Child];
} else {
@@ -313,7 +313,7 @@ int GrRedBlackTree<T,C>::countOf(const T& t) const {
template <typename T, typename C>
int GrRedBlackTree<T,C>::onCountOf(const Node* n, const T& t) const {
// this is count*log(n) :(
- while (NULL != n) {
+ while (n) {
if (fComp(t, n->fItem)) {
n = n->fChildren[kLeft_Child];
} else {
@@ -360,7 +360,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
bool first = true;
bool last = true;
- while (NULL != n) {
+ while (n) {
gpc = pc;
pc = fComp(x->fItem, n->fItem) ? kLeft_Child : kRight_Child;
first = first && kLeft_Child == pc;
@@ -389,10 +389,10 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
do {
// assumptions at loop start.
- SkASSERT(NULL != x);
+ SkASSERT(x);
SkASSERT(kRed_Color == x->fColor);
// can't have a grandparent but no parent.
- SkASSERT(!(NULL != gp && NULL == p));
+ SkASSERT(!(gp && NULL == p));
// make sure pc and gpc are correct
SkASSERT(NULL == p || p->fChildren[pc] == x);
SkASSERT(NULL == gp || gp->fChildren[gpc] == p);
@@ -403,7 +403,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
return Iter(returnNode, this);
}
// gp must be valid because if p was the root then it is black
- SkASSERT(NULL != gp);
+ SkASSERT(gp);
// gp must be black since it's child, p, is red.
SkASSERT(kBlack_Color == gp->fColor);
@@ -413,7 +413,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
// if x's uncle (p's sibling) is also red then we can flip
// p and u to black and make gp red. But then we have to recurse
// up to gp since it's parent may also be red.
- if (NULL != u && kRed_Color == u->fColor) {
+ if (u && kRed_Color == u->fColor) {
p->fColor = kBlack_Color;
u->fColor = kBlack_Color;
gp->fColor = kRed_Color;
@@ -429,7 +429,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
gp = p->fParent;
pc = (p->fChildren[kLeft_Child] == x) ? kLeft_Child :
kRight_Child;
- if (NULL != gp) {
+ if (gp) {
gpc = (gp->fChildren[kLeft_Child] == p) ? kLeft_Child :
kRight_Child;
}
@@ -493,10 +493,10 @@ void GrRedBlackTree<T,C>::rotateRight(Node* n) {
*/
Node* d = n->fParent;
Node* s = n->fChildren[kLeft_Child];
- SkASSERT(NULL != s);
+ SkASSERT(s);
Node* b = s->fChildren[kRight_Child];
- if (NULL != d) {
+ if (d) {
Child c = d->fChildren[kLeft_Child] == n ? kLeft_Child :
kRight_Child;
d->fChildren[c] = s;
@@ -508,7 +508,7 @@ void GrRedBlackTree<T,C>::rotateRight(Node* n) {
s->fChildren[kRight_Child] = n;
n->fParent = s;
n->fChildren[kLeft_Child] = b;
- if (NULL != b) {
+ if (b) {
b->fParent = n;
}
@@ -525,10 +525,10 @@ void GrRedBlackTree<T,C>::rotateLeft(Node* n) {
Node* d = n->fParent;
Node* s = n->fChildren[kRight_Child];
- SkASSERT(NULL != s);
+ SkASSERT(s);
Node* b = s->fChildren[kLeft_Child];
- if (NULL != d) {
+ if (d) {
Child c = d->fChildren[kRight_Child] == n ? kRight_Child :
kLeft_Child;
d->fChildren[c] = s;
@@ -540,7 +540,7 @@ void GrRedBlackTree<T,C>::rotateLeft(Node* n) {
s->fChildren[kLeft_Child] = n;
n->fParent = s;
n->fChildren[kRight_Child] = b;
- if (NULL != b) {
+ if (b) {
b->fParent = n;
}
@@ -554,15 +554,15 @@ void GrRedBlackTree<T,C>::rotateLeft(Node* n) {
template <typename T, typename C>
typename GrRedBlackTree<T,C>::Node* GrRedBlackTree<T,C>::SuccessorNode(Node* x) {
- SkASSERT(NULL != x);
- if (NULL != x->fChildren[kRight_Child]) {
+ SkASSERT(x);
+ if (x->fChildren[kRight_Child]) {
x = x->fChildren[kRight_Child];
- while (NULL != x->fChildren[kLeft_Child]) {
+ while (x->fChildren[kLeft_Child]) {
x = x->fChildren[kLeft_Child];
}
return x;
}
- while (NULL != x->fParent && x == x->fParent->fChildren[kRight_Child]) {
+ while (x->fParent && x == x->fParent->fChildren[kRight_Child]) {
x = x->fParent;
}
return x->fParent;
@@ -570,15 +570,15 @@ typename GrRedBlackTree<T,C>::Node* GrRedBlackTree<T,C>::SuccessorNode(Node* x)
template <typename T, typename C>
typename GrRedBlackTree<T,C>::Node* GrRedBlackTree<T,C>::PredecessorNode(Node* x) {
- SkASSERT(NULL != x);
- if (NULL != x->fChildren[kLeft_Child]) {
+ SkASSERT(x);
+ if (x->fChildren[kLeft_Child]) {
x = x->fChildren[kLeft_Child];
- while (NULL != x->fChildren[kRight_Child]) {
+ while (x->fChildren[kRight_Child]) {
x = x->fChildren[kRight_Child];
}
return x;
}
- while (NULL != x->fParent && x == x->fParent->fChildren[kLeft_Child]) {
+ while (x->fParent && x == x->fParent->fChildren[kLeft_Child]) {
x = x->fParent;
}
return x->fParent;
@@ -586,12 +586,12 @@ typename GrRedBlackTree<T,C>::Node* GrRedBlackTree<T,C>::PredecessorNode(Node* x
template <typename T, typename C>
void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
- SkASSERT(NULL != x);
+ SkASSERT(x);
validate();
--fCount;
- bool hasLeft = NULL != x->fChildren[kLeft_Child];
- bool hasRight = NULL != x->fChildren[kRight_Child];
+ bool hasLeft = SkToBool(x->fChildren[kLeft_Child]);
+ bool hasRight = SkToBool(x->fChildren[kRight_Child]);
Child c = hasLeft ? kLeft_Child : kRight_Child;
if (hasLeft && hasRight) {
@@ -601,10 +601,10 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
// if x is an interior node then we find it's successor
// and swap them.
Node* s = x->fChildren[kRight_Child];
- while (NULL != s->fChildren[kLeft_Child]) {
+ while (s->fChildren[kLeft_Child]) {
s = s->fChildren[kLeft_Child];
}
- SkASSERT(NULL != s);
+ SkASSERT(s);
// this might be expensive relative to swapping node ptrs around.
// depends on T.
x->fItem = s->fItem;
@@ -615,7 +615,7 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
// the new root (if the tree is not empty) black.
SkASSERT(fRoot == x);
fRoot = x->fChildren[c];
- if (NULL != fRoot) {
+ if (fRoot) {
fRoot->fParent = NULL;
fRoot->fColor = kBlack_Color;
if (x == fLast) {
@@ -665,7 +665,7 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
//s cannot be an implicit black node because the original
// black-height at x was >= 2 and s's black-height must equal the
// initial black height of x.
- SkASSERT(NULL != s);
+ SkASSERT(s);
SkASSERT(p == s->fParent);
// assigned in loop
@@ -682,7 +682,7 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
// be real nodes.
// The x side of p has a black-height that is one less than the
// s side. It must be rebalanced.
- SkASSERT(NULL != s);
+ SkASSERT(s);
SkASSERT(p == s->fParent);
SkASSERT(NULL == x || x->fParent == p);
@@ -697,8 +697,8 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
SkASSERT(kBlack_Color == p->fColor);
// s's children must also be black since s is red. They can't
// be implicit since s is red and it's black-height is >= 2.
- SkASSERT(NULL != sl && kBlack_Color == sl->fColor);
- SkASSERT(NULL != sr && kBlack_Color == sr->fColor);
+ SkASSERT(sl && kBlack_Color == sl->fColor);
+ SkASSERT(sr && kBlack_Color == sr->fColor);
p->fColor = kRed_Color;
s->fColor = kBlack_Color;
if (kLeft_Child == pc) {
@@ -718,8 +718,8 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
SkASSERT(NULL == x || p == x->fParent);
// when x is deleted its subtree will have reduced black-height.
- slRed = (NULL != sl && kRed_Color == sl->fColor);
- srRed = (NULL != sr && kRed_Color == sr->fColor);
+ slRed = (sl && kRed_Color == sl->fColor);
+ srRed = (sr && kRed_Color == sr->fColor);
if (!slRed && !srRed) {
// if s can be made red that will balance out x's removal
// to make both subtrees of p have the same black-height.
@@ -744,7 +744,7 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
}
s = p->fChildren[1-pc];
- SkASSERT(NULL != s);
+ SkASSERT(s);
SkASSERT(p == s->fParent);
continue;
} else if (kRed_Color == p->fColor) {
@@ -789,11 +789,11 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
s->fColor = p->fColor;
p->fColor = kBlack_Color;
if (kLeft_Child == pc) {
- SkASSERT(NULL != sr && kRed_Color == sr->fColor);
+ SkASSERT(sr && kRed_Color == sr->fColor);
sr->fColor = kBlack_Color;
rotateLeft(p);
} else {
- SkASSERT(NULL != sl && kRed_Color == sl->fColor);
+ SkASSERT(sl && kRed_Color == sl->fColor);
sl->fColor = kBlack_Color;
rotateRight(p);
}
@@ -815,14 +815,14 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
if (x == fFirst) {
SkASSERT(c == kRight_Child);
fFirst = c1;
- while (NULL != fFirst->fChildren[kLeft_Child]) {
+ while (fFirst->fChildren[kLeft_Child]) {
fFirst = fFirst->fChildren[kLeft_Child];
}
SkASSERT(fFirst == SuccessorNode(x));
} else if (x == fLast) {
SkASSERT(c == kLeft_Child);
fLast = c1;
- while (NULL != fLast->fChildren[kRight_Child]) {
+ while (fLast->fChildren[kRight_Child]) {
fLast = fLast->fChildren[kRight_Child];
}
SkASSERT(fLast == PredecessorNode(x));
@@ -838,7 +838,7 @@ void GrRedBlackTree<T,C>::deleteAtNode(Node* x) {
template <typename T, typename C>
void GrRedBlackTree<T,C>::RecursiveDelete(Node* x) {
- if (NULL != x) {
+ if (x) {
RecursiveDelete(x->fChildren[kLeft_Child]);
RecursiveDelete(x->fChildren[kRight_Child]);
delete x;
@@ -850,8 +850,8 @@ template <typename T, typename C>
void GrRedBlackTree<T,C>::validate() const {
if (fCount) {
SkASSERT(NULL == fRoot->fParent);
- SkASSERT(NULL != fFirst);
- SkASSERT(NULL != fLast);
+ SkASSERT(fFirst);
+ SkASSERT(fLast);
SkASSERT(kBlack_Color == fRoot->fColor);
if (1 == fCount) {
@@ -874,7 +874,7 @@ void GrRedBlackTree<T,C>::validate() const {
template <typename T, typename C>
int GrRedBlackTree<T,C>::checkNode(Node* n, int* bh) const {
- if (NULL != n) {
+ if (n) {
SkASSERT(validateChildRelations(n, false));
if (kBlack_Color == n->fColor) {
*bh += 1;
@@ -895,21 +895,21 @@ int GrRedBlackTree<T,C>::checkNode(Node* n, int* bh) const {
template <typename T, typename C>
bool GrRedBlackTree<T,C>::validateChildRelations(const Node* n,
bool allowRedRed) const {
- if (NULL != n) {
- if (NULL != n->fChildren[kLeft_Child] ||
- NULL != n->fChildren[kRight_Child]) {
+ if (n) {
+ if (n->fChildren[kLeft_Child] ||
+ n->fChildren[kRight_Child]) {
if (n->fChildren[kLeft_Child] == n->fChildren[kRight_Child]) {
return validateChildRelationsFailed();
}
if (n->fChildren[kLeft_Child] == n->fParent &&
- NULL != n->fParent) {
+ n->fParent) {
return validateChildRelationsFailed();
}
if (n->fChildren[kRight_Child] == n->fParent &&
- NULL != n->fParent) {
+ n->fParent) {
return validateChildRelationsFailed();
}
- if (NULL != n->fChildren[kLeft_Child]) {
+ if (n->fChildren[kLeft_Child]) {
if (!allowRedRed &&
kRed_Color == n->fChildren[kLeft_Child]->fColor &&
kRed_Color == n->fColor) {
@@ -924,7 +924,7 @@ bool GrRedBlackTree<T,C>::validateChildRelations(const Node* n,
return validateChildRelationsFailed();
}
}
- if (NULL != n->fChildren[kRight_Child]) {
+ if (n->fChildren[kRight_Child]) {
if (!allowRedRed &&
kRed_Color == n->fChildren[kRight_Child]->fColor &&
kRed_Color == n->fColor) {
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 6ad9cc6d8b..2083af907e 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -65,21 +65,21 @@ void ReduceClipStack(const SkClipStack& stack,
SkRect isectRect;
if (stackBounds.contains(scalarQueryBounds)) {
*initialState = kAllIn_InitialState;
- if (NULL != tighterBounds) {
+ if (tighterBounds) {
*tighterBounds = queryBounds;
}
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = false;
}
} else if (isectRect.intersect(stackBounds, scalarQueryBounds)) {
// If the caller asked for tighter integer bounds we may be able to
// return kAllIn and give the bounds with no elements
- if (NULL != tighterBounds) {
+ if (tighterBounds) {
isectRect.roundOut(tighterBounds);
SkRect scalarTighterBounds = SkRect::Make(*tighterBounds);
if (scalarTighterBounds == isectRect) {
// the round-out didn't add any area outside the clip rect.
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = false;
}
*initialState = kAllIn_InitialState;
@@ -91,12 +91,12 @@ void ReduceClipStack(const SkClipStack& stack,
SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
bool doAA = iter.prev()->isAA();
SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kReplace_Op, doAA));
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = doAA;
}
} else {
*initialState = kAllOut_InitialState;
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = false;
}
}
@@ -105,12 +105,12 @@ void ReduceClipStack(const SkClipStack& stack,
if (SkClipStack::kNormal_BoundsType == stackBoundsType) {
if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) {
*initialState = kAllOut_InitialState;
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = false;
}
return;
}
- if (NULL != tighterBounds) {
+ if (tighterBounds) {
SkIRect stackIBounds;
stackBounds.roundOut(&stackIBounds);
tighterBounds->intersect(queryBounds, stackIBounds);
@@ -119,12 +119,12 @@ void ReduceClipStack(const SkClipStack& stack,
} else {
if (stackBounds.contains(scalarQueryBounds)) {
*initialState = kAllOut_InitialState;
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = false;
}
return;
}
- if (NULL != tighterBounds) {
+ if (tighterBounds) {
*tighterBounds = queryBounds;
}
}
@@ -367,7 +367,7 @@ void reduced_stack_walker(const SkClipStack& stack,
result->reset();
} else {
Element* element = result->headIter().get();
- while (NULL != element) {
+ while (element) {
bool skippable = false;
switch (element->getOp()) {
case SkRegion::kDifference_Op:
@@ -435,7 +435,7 @@ void reduced_stack_walker(const SkClipStack& stack,
}
}
}
- if (NULL != requiresAA) {
+ if (requiresAA) {
*requiresAA = numAAElements > 0;
}
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 505cc78dce..b9763325d8 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -79,7 +79,7 @@ size_t GrRenderTarget::gpuMemorySize() const {
void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) {
if (kCanResolve_ResolveType == getResolveType()) {
- if (NULL != rect) {
+ if (rect) {
fResolveRect.join(*rect);
if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
fResolveRect.setEmpty();
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 8a21002e1c..e9be509569 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -117,10 +117,10 @@ GrResourceCache::~GrResourceCache() {
}
void GrResourceCache::getLimits(int* maxResources, size_t* maxResourceBytes) const{
- if (NULL != maxResources) {
+ if (maxResources) {
*maxResources = fMaxCount;
}
- if (NULL != maxResourceBytes) {
+ if (maxResourceBytes) {
*maxResourceBytes = fMaxBytes;
}
}
@@ -343,7 +343,7 @@ void GrResourceCache::purgeAsNeeded(int extraCount, size_t extraBytes) {
this->internalPurge(extraCount, extraBytes);
if (((fEntryCount+extraCount) > fMaxCount ||
(fEntryBytes+extraBytes) > fMaxBytes) &&
- NULL != fOverbudgetCB) {
+ fOverbudgetCB) {
// Despite the purge we're still over budget. See if Ganesh can
// release some resources and purge again.
if ((*fOverbudgetCB)(fOverbudgetData)) {
@@ -402,7 +402,7 @@ void GrResourceCache::internalPurge(int extraCount, size_t extraBytes) {
// in internalDetach)
GrResourceCacheEntry* entry = iter.init(fList, EntryList::Iter::kTail_IterStart);
- while (NULL != entry) {
+ while (entry) {
GrAutoResourceCacheValidate atcv(this);
if ((fEntryCount+extraCount) <= fMaxCount &&
@@ -462,7 +462,7 @@ size_t GrResourceCache::countBytes(const EntryList& list) {
const GrResourceCacheEntry* entry = iter.init(const_cast<EntryList&>(list),
EntryList::Iter::kTail_IterStart);
- for ( ; NULL != entry; entry = iter.prev()) {
+ for ( ; entry; entry = iter.prev()) {
bytes += entry->resource()->gpuMemorySize();
}
return bytes;
@@ -487,7 +487,7 @@ void GrResourceCache::validate() const {
const GrResourceCacheEntry* entry = iter.init(const_cast<EntryList&>(fExclusiveList),
EntryList::Iter::kHead_IterStart);
- for ( ; NULL != entry; entry = iter.next()) {
+ for ( ; entry; entry = iter.next()) {
entry->validate();
}
@@ -495,7 +495,7 @@ void GrResourceCache::validate() const {
entry = iter.init(const_cast<EntryList&>(fList), EntryList::Iter::kHead_IterStart);
int count = 0;
- for ( ; NULL != entry; entry = iter.next()) {
+ for ( ; entry; entry = iter.next()) {
entry->validate();
SkASSERT(fCache.find(entry->key()));
count += 1;
@@ -523,7 +523,7 @@ void GrResourceCache::printStats() {
GrResourceCacheEntry* entry = iter.init(fList, EntryList::Iter::kTail_IterStart);
- for ( ; NULL != entry; entry = iter.prev()) {
+ for ( ; entry; entry = iter.prev()) {
if (entry->fResource->getRefCnt() > 1) {
++locked;
}
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 460387f5f8..83337805a4 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -181,7 +181,7 @@ public:
* Determines if the cache contains an entry matching a key. If a matching
* entry exists but was detached then it will not be found.
*/
- bool hasKey(const GrResourceKey& key) const { return NULL != fCache.find(key); }
+ bool hasKey(const GrResourceKey& key) const { return SkToBool(fCache.find(key)); }
/**
* Hide 'entry' so that future searches will not find it. Such
diff --git a/src/gpu/GrResourceCache2.cpp b/src/gpu/GrResourceCache2.cpp
index a5732f786e..e0ba26ae83 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -15,7 +15,7 @@ GrResourceCache2::~GrResourceCache2() {
}
void GrResourceCache2::insertResource(GrGpuResource* resource) {
- SkASSERT(NULL != resource);
+ SkASSERT(resource);
SkASSERT(!resource->wasDestroyed());
SkASSERT(!this->isInCache(resource));
fResources.addToHead(resource);
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index b51bae4370..d3d4648838 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -142,7 +142,7 @@ void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegio
SkTBlitterAllocator allocator;
SkBlitter* blitter = NULL;
if (kBlitter_CompressionMode == fCompressionMode) {
- SkASSERT(NULL != fCompressedBuffer.get());
+ SkASSERT(fCompressedBuffer.get());
blitter = SkTextureCompressor::CreateBlitterForFormat(
fBM.width(), fBM.height(), fCompressedBuffer.get(), &allocator, fCompressedFormat);
}
@@ -160,7 +160,7 @@ void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegio
bool GrSWMaskHelper::init(const SkIRect& resultBounds,
const SkMatrix* matrix,
bool allowCompression) {
- if (NULL != matrix) {
+ if (matrix) {
fMatrix = *matrix;
} else {
fMatrix.setIdentity();
@@ -249,7 +249,7 @@ bool GrSWMaskHelper::getTexture(GrAutoScratchTexture* texture) {
}
texture->set(fContext, desc);
- return NULL != texture->texture();
+ return SkToBool(texture->texture());
}
void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrTextureDesc& desc,
@@ -273,7 +273,7 @@ void GrSWMaskHelper::compressTextureData(GrTexture *texture, const GrTextureDesc
SkASSERT(fmt_to_config(fCompressedFormat) == desc.fConfig);
SkAutoDataUnref cmpData(SkTextureCompressor::CompressBitmapToFormat(fBM, fCompressedFormat));
- SkASSERT(NULL != cmpData);
+ SkASSERT(cmpData);
this->sendTextureData(texture, desc, cmpData->data(), 0);
}
@@ -300,7 +300,7 @@ void GrSWMaskHelper::toTexture(GrTexture *texture) {
break;
case kBlitter_CompressionMode:
- SkASSERT(NULL != fCompressedBuffer.get());
+ SkASSERT(fCompressedBuffer.get());
this->sendTextureData(texture, desc, fCompressedBuffer.get(), 0);
break;
}
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 273c01b861..5548790532 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -15,8 +15,8 @@
#include "SkStrokeRec.h"
GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) {
- SkASSERT(NULL != context);
- SkASSERT(NULL != context->getGpu());
+ SkASSERT(context);
+ SkASSERT(context->getGpu());
if (context->getGpu()->caps()->pathRenderingSupport()) {
return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu()));
} else {
@@ -40,7 +40,7 @@ bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path,
bool antiAlias) const {
return !stroke.isHairlineStyle() &&
!antiAlias && // doesn't do per-path AA, relies on the target having MSAA
- NULL != target->getDrawState().getRenderTarget()->getStencilBuffer() &&
+ target->getDrawState().getRenderTarget()->getStencilBuffer() &&
target->getDrawState().getStencil().isDisabled();
}
diff --git a/src/gpu/GrStrokeInfo.h b/src/gpu/GrStrokeInfo.h
index b9ba5eada1..2bd056ea3c 100644
--- a/src/gpu/GrStrokeInfo.h
+++ b/src/gpu/GrStrokeInfo.h
@@ -56,7 +56,7 @@ public:
* dashed effect and we are stroking, otherwise it retruns false.
*/
bool setDashInfo(const SkPathEffect* pe) {
- if (NULL != pe && !fStroke.isFillStyle()) {
+ if (pe && !fStroke.isFillStyle()) {
fDashInfo.fIntervals = NULL;
fDashType = pe->asADash(&fDashInfo);
if (SkPathEffect::kDash_DashType == fDashType) {
diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h
index 2cab132783..8e43a15f7b 100644
--- a/src/gpu/GrTemplates.h
+++ b/src/gpu/GrTemplates.h
@@ -41,20 +41,20 @@ public:
GrAutoTRestore(T* ptr) {
fPtr = ptr;
- if (NULL != ptr) {
+ if (ptr) {
fVal = *ptr;
}
}
~GrAutoTRestore() {
- if (NULL != fPtr) {
+ if (fPtr) {
*fPtr = fVal;
}
}
// restores previously saved value (if any) and saves value for passed T*
void reset(T* ptr) {
- if (NULL != fPtr) {
+ if (fPtr) {
*fPtr = fVal;
}
fPtr = ptr;
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 5606fe3bcc..24fa707548 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -130,7 +130,7 @@ void GrFontCache::purgeStrike(GrTextStrike* strike) {
}
bool GrFontCache::freeUnusedPlot(GrTextStrike* preserveStrike) {
- SkASSERT(NULL != preserveStrike);
+ SkASSERT(preserveStrike);
GrAtlas* atlas = preserveStrike->fAtlas;
GrPlot* plot = atlas->getUnusedPlot();
@@ -197,9 +197,9 @@ void GrFontCache::validate() const {
void GrFontCache::dump() const {
static int gDumpCount = 0;
for (int i = 0; i < kAtlasCount; ++i) {
- if (NULL != fAtlases[i]) {
+ if (fAtlases[i]) {
GrTexture* texture = fAtlases[i]->getTexture();
- if (NULL != texture) {
+ if (texture) {
SkString filename;
#ifdef SK_BUILD_FOR_ANDROID
filename.printf("/sdcard/fontcache_%d%d.png", gDumpCount, i);
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index bcff356e93..667ddd1e51 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -16,7 +16,7 @@
#include "GrResourceCache.h"
GrTexture::~GrTexture() {
- if (NULL != fRenderTarget.get()) {
+ if (fRenderTarget.get()) {
fRenderTarget.get()->owningTextureDestroyed();
}
}
@@ -27,7 +27,7 @@ GrTexture::~GrTexture() {
*/
void GrTexture::internal_dispose() const {
if (this->impl()->isSetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit) &&
- NULL != this->INHERITED::getContext()) {
+ this->INHERITED::getContext()) {
GrTexture* nonConstThis = const_cast<GrTexture *>(this);
this->ref(); // restore ref count to initial setting
@@ -123,18 +123,18 @@ void GrTexture::onRelease() {
void GrTexture::onAbandon() {
this->abandonReleaseCommon();
- if (NULL != fRenderTarget.get()) {
+ if (fRenderTarget.get()) {
fRenderTarget->abandon();
}
INHERITED::onAbandon();
}
void GrTexture::validateDesc() const {
- if (NULL != this->asRenderTarget()) {
+ if (this->asRenderTarget()) {
// This texture has a render target
SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrTextureFlagBit));
- if (NULL != this->asRenderTarget()->getStencilBuffer()) {
+ if (this->asRenderTarget()->getStencilBuffer()) {
SkASSERT(0 != (fDesc.fFlags & kNoStencil_GrTextureFlagBit));
} else {
SkASSERT(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit));
@@ -170,7 +170,7 @@ GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu,
const GrTextureParams* params,
const GrTextureDesc& desc) {
GrResourceKey::ResourceFlags flags = 0;
- bool tiled = NULL != params && params->isTiled();
+ bool tiled = params && params->isTiled();
if (tiled && !gpu->caps()->npotTextureTileSupport()) {
if (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight)) {
flags |= kStretchToPOT_TextureFlag;
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
index 91db08bea5..b0c760f054 100644
--- a/src/gpu/GrTextureAccess.cpp
+++ b/src/gpu/GrTextureAccess.cpp
@@ -42,7 +42,7 @@ GrTextureAccess::GrTextureAccess(GrTexture* texture,
void GrTextureAccess::reset(GrTexture* texture,
const char* swizzle,
const GrTextureParams& params) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
SkASSERT(strlen(swizzle) >= 1 && strlen(swizzle) <= 4);
fParams = params;
@@ -54,7 +54,7 @@ void GrTextureAccess::reset(GrTexture* texture,
const char* swizzle,
GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
SkASSERT(strlen(swizzle) >= 1 && strlen(swizzle) <= 4);
fParams.reset(tileXAndY, filterMode);
@@ -64,7 +64,7 @@ void GrTextureAccess::reset(GrTexture* texture,
void GrTextureAccess::reset(GrTexture* texture,
const GrTextureParams& params) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
fTexture.reset(SkRef(texture));
fParams = params;
memcpy(fSwizzle, "rgba", 5);
@@ -74,7 +74,7 @@ void GrTextureAccess::reset(GrTexture* texture,
void GrTextureAccess::reset(GrTexture* texture,
GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
fTexture.reset(SkRef(texture));
fParams.reset(tileXAndY, filterMode);
memcpy(fSwizzle, "rgba", 5);
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 375d0e68b3..122af65ff9 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -90,12 +90,12 @@ public:
GrTexture** texture)
: fDevice(NULL)
, fTexture(NULL) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
*texture = this->set(device, bitmap, params);
}
~SkAutoCachedTexture() {
- if (NULL != fTexture) {
+ if (fTexture) {
GrUnlockAndUnrefCachedBitmapTexture(fTexture);
}
}
@@ -103,7 +103,7 @@ public:
GrTexture* set(SkGpuDevice* device,
const SkBitmap& bitmap,
const GrTextureParams* params) {
- if (NULL != fTexture) {
+ if (fTexture) {
GrUnlockAndUnrefCachedBitmapTexture(fTexture);
fTexture = NULL;
}
@@ -134,7 +134,7 @@ public:
///////////////////////////////////////////////////////////////////////////////
SkGpuDevice* SkGpuDevice::Create(GrSurface* surface, unsigned flags) {
- SkASSERT(NULL != surface);
+ SkASSERT(surface);
if (NULL == surface->asRenderTarget() || surface->wasDestroyed()) {
return NULL;
}
@@ -278,7 +278,7 @@ void SkGpuDevice::onDetachFromCanvas() {
// call this every draw call, to ensure that the context reflects our state,
// and not the state from some other canvas/device
void SkGpuDevice::prepareDraw(const SkDraw& draw, bool forceIdentity) {
- SkASSERT(NULL != fClipData.fClipStack);
+ SkASSERT(fClipData.fClipStack);
fContext->setRenderTarget(fRenderTarget);
@@ -425,7 +425,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
GrStrokeInfo strokeInfo(paint);
const SkPathEffect* pe = paint.getPathEffect();
- if (!usePath && NULL != pe && !strokeInfo.isDashed()) {
+ if (!usePath && pe && !strokeInfo.isDashed()) {
usePath = true;
}
@@ -489,7 +489,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
usePath = true;
} else {
const SkPathEffect* pe = paint.getPathEffect();
- if (NULL != pe && !strokeInfo.isDashed()) {
+ if (pe && !strokeInfo.isDashed()) {
usePath = true;
}
}
@@ -547,7 +547,7 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval,
usePath = true;
} else {
const SkPathEffect* pe = paint.getPathEffect();
- if (NULL != pe && !strokeInfo.isDashed()) {
+ if (pe && !strokeInfo.isDashed()) {
usePath = true;
}
}
@@ -859,7 +859,7 @@ static void determine_clipped_src_rect(const GrContext* context,
}
SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect);
inv.mapRect(&clippedSrcRect);
- if (NULL != srcRectPtr) {
+ if (srcRectPtr) {
// we've setup src space 0,0 to map to the top left of the src rect.
clippedSrcRect.offset(srcRectPtr->fLeft, srcRectPtr->fTop);
if (!clippedSrcRect.intersect(*srcRectPtr)) {
@@ -881,7 +881,7 @@ bool SkGpuDevice::shouldTileBitmap(const SkBitmap& bitmap,
int* tileSize,
SkIRect* clippedSrcRect) const {
// if bitmap is explictly texture backed then just use the texture
- if (NULL != bitmap.getTexture()) {
+ if (bitmap.getTexture()) {
return false;
}
@@ -1058,7 +1058,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
srcRect.set(0, 0, w, h);
flags = (SkCanvas::DrawBitmapRectFlags) (flags | SkCanvas::kBleed_DrawBitmapRectFlag);
} else {
- SkASSERT(NULL != dstSizePtr);
+ SkASSERT(dstSizePtr);
srcRect = *srcRectPtr;
dstSize = *dstSizePtr;
if (srcRect.fLeft <= 0 && srcRect.fTop <= 0 &&
@@ -1073,7 +1073,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
SkBitmap tmp; // subset of bitmap, if necessary
const SkBitmap* bitmapPtr = &bitmap;
SkMatrix localM;
- if (NULL != srcRectPtr) {
+ if (srcRectPtr) {
localM.setTranslate(-srcRectPtr->fLeft, -srcRectPtr->fTop);
localM.postScale(dstSize.fWidth / srcRectPtr->width(),
dstSize.fHeight / srcRectPtr->height());
@@ -1392,7 +1392,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
// This bitmap will own the filtered result as a texture.
SkBitmap filteredBitmap;
- if (NULL != filter) {
+ if (filter) {
SkIPoint offset = SkIPoint::Make(0, 0);
SkMatrix matrix(*draw.fMatrix);
matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
@@ -1442,7 +1442,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap,
SkIntToScalar(bitmap.height()));
// Compute matrix from the two rectangles
- if (NULL != src) {
+ if (src) {
tmpSrc = *src;
} else {
tmpSrc = bitmapBounds;
@@ -1451,7 +1451,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap,
matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
// clip the tmpSrc to the bounds of the bitmap. No check needed if src==null.
- if (NULL != src) {
+ if (src) {
if (!bitmapBounds.contains(tmpSrc)) {
if (!tmpSrc.intersect(bitmapBounds)) {
return; // nothing to draw
@@ -1503,7 +1503,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
// This bitmap will own the filtered result as a texture.
SkBitmap filteredBitmap;
- if (NULL != filter) {
+ if (filter) {
SkIPoint offset = SkIPoint::Make(0, 0);
SkMatrix matrix(*draw.fMatrix);
matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
@@ -1651,7 +1651,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
}
#if 0
- if (NULL != xmode && NULL != texs && NULL != colors) {
+ if (xmode && texs && colors) {
if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) {
SkDebugf("Unsupported vertex-color/texture xfer mode.\n");
return;
@@ -1660,7 +1660,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
#endif
SkAutoSTMalloc<128, GrColor> convertedColors(0);
- if (NULL != colors) {
+ if (colors) {
// need to convert byte order and from non-PM to PM
convertedColors.reset(vertexCount);
SkColor color;
@@ -1804,7 +1804,7 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const SkImageInfo& info, Usage usage)
#else
texture.reset(fContext->createUncachedTexture(desc, NULL, 0));
#endif
- if (NULL != texture.get()) {
+ if (texture.get()) {
return SkGpuDevice::Create(texture, flags);
} else {
GrPrintf("---- failed to create compatible device texture [%d %d]\n",
@@ -1820,14 +1820,14 @@ SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
fContext->getLayerCache()->processDeletedPictures();
- if (NULL != picture->fData.get() && !picture->fData->suitableForLayerOptimization()) {
+ if (picture->fData.get() && !picture->fData->suitableForLayerOptimization()) {
return;
}
SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(key);
- if (NULL != existing) {
+ if (existing) {
return;
}
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 085ad2bf8a..f1fd407599 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -131,7 +131,7 @@ private:
} // namespace
static void add_genID_listener(GrResourceKey key, SkPixelRef* pixelRef) {
- SkASSERT(NULL != pixelRef);
+ SkASSERT(pixelRef);
pixelRef->addGenIDChangeListener(SkNEW_ARGS(GrResourceInvalidator, (key)));
}
@@ -188,7 +188,7 @@ static GrTexture *load_etc1_texture(GrContext* ctx,
GrResourceKey key;
GrTexture* result = ctx->createTexture(params, desc, cacheID, bytes, 0, &key);
- if (NULL != result) {
+ if (result) {
add_genID_listener(key, bm.pixelRef());
}
return result;
@@ -250,7 +250,7 @@ static GrTexture *load_yuv_texture(GrContext* ctx, const GrTextureParams* params
GrResourceKey key;
result = ctx->createTexture(params, rtDesc, cacheID, NULL, 0, &key);
GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL;
- if (NULL != renderTarget) {
+ if (renderTarget) {
add_genID_listener(key, bm.pixelRef());
SkAutoTUnref<GrEffect> yuvToRgbEffect(GrYUVtoRGBEffect::Create(
yuvTextures[0].texture(), yuvTextures[1].texture(), yuvTextures[2].texture()));
@@ -301,7 +301,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
GrResourceKey key;
GrTexture* result = ctx->createTexture(params, desc, cacheID,
storage.get(), bitmap->width(), &key);
- if (NULL != result) {
+ if (result) {
add_genID_listener(key, origBitmap.pixelRef());
}
return result;
@@ -336,7 +336,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
// data is.
&& !(bitmap->readyToDraw())) {
GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc);
- if (NULL != texture) {
+ if (texture) {
return texture;
}
}
@@ -344,7 +344,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
else {
GrTexture *texture = load_yuv_texture(ctx, params, *bitmap, desc);
- if (NULL != texture) {
+ if (texture) {
return texture;
}
}
@@ -360,7 +360,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
GrResourceKey key;
GrTexture* result = ctx->createTexture(params, desc, cacheID,
bitmap->getPixels(), bitmap->rowBytes(), &key);
- if (NULL != result) {
+ if (result) {
add_genID_listener(key, origBitmap.pixelRef());
}
return result;
@@ -420,7 +420,7 @@ GrTexture* GrLockAndRefCachedBitmapTexture(GrContext* ctx,
}
void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) {
- SkASSERT(NULL != texture->getContext());
+ SkASSERT(texture->getContext());
texture->getContext()->unlockScratchTexture(texture);
texture->unref();
@@ -495,7 +495,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
SkXfermode* mode = skPaint.getXfermode();
GrEffect* xferEffect = NULL;
if (SkXfermode::AsNewEffectOrCoeff(mode, &xferEffect, &sm, &dm)) {
- if (NULL != xferEffect) {
+ if (xferEffect) {
grPaint->addColorEffect(xferEffect)->unref();
sm = SkXfermode::kOne_Coeff;
dm = SkXfermode::kZero_Coeff;
@@ -512,7 +512,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
grPaint->setColor(paintColor);
SkColorFilter* colorFilter = skPaint.getColorFilter();
- if (NULL != colorFilter) {
+ if (colorFilter) {
// if the source color is a constant then apply the filter here once rather than per pixel
// in a shader.
if (constantColor) {
@@ -520,7 +520,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
grPaint->setColor(SkColor2GrColor(filtered));
} else {
SkAutoTUnref<GrEffect> effect(colorFilter->asNewEffect(context));
- if (NULL != effect.get()) {
+ if (effect.get()) {
grPaint->addColorEffect(effect);
}
}
@@ -532,7 +532,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
if (skPaint.isDither() && grPaint->numColorStages() > 0) {
// What are we rendering into?
const GrRenderTarget *target = context->getRenderTarget();
- SkASSERT(NULL != target);
+ SkASSERT(target);
// Suspect the dithering flag has no effect on these configs, otherwise
// fall back on setting the appropriate state.
@@ -541,7 +541,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
// The dither flag is set and the target is likely
// not going to be dithered by the GPU.
SkAutoTUnref<GrEffect> effect(GrDitherEffect::Create());
- if (NULL != effect.get()) {
+ if (effect.get()) {
grPaint->addColorEffect(effect);
grPaint->setDither(false);
}
@@ -562,7 +562,7 @@ public:
fContext = context;
}
~AutoMatrix() {
- SkASSERT(NULL != fContext);
+ SkASSERT(fContext);
fContext->setMatrix(fMatrix);
}
private:
@@ -595,7 +595,7 @@ void SkPaint2GrPaintShader(GrContext* context, const SkPaint& skPaint,
// Allow the shader to modify paintColor and also create an effect to be installed as
// the first color effect on the GrPaint.
GrEffect* effect = NULL;
- if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && NULL != effect) {
+ if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && effect) {
grPaint->addColorEffect(effect)->unref();
constantColor = false;
}
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index f56c3b6390..d5be965c7f 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -125,7 +125,7 @@ SkGrPixelRef::~SkGrPixelRef() {
if (fUnlock) {
GrContext* context = fSurface->getContext();
GrTexture* texture = fSurface->asTexture();
- if (NULL != context && NULL != texture) {
+ if (context && texture) {
context->unlockScratchTexture(texture);
}
}
@@ -133,7 +133,7 @@ SkGrPixelRef::~SkGrPixelRef() {
}
GrTexture* SkGrPixelRef::getTexture() {
- if (NULL != fSurface) {
+ if (fSurface) {
return fSurface->asTexture();
}
return NULL;
@@ -159,7 +159,7 @@ bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
}
int left, top, width, height;
- if (NULL != subset) {
+ if (subset) {
left = subset->fLeft;
width = subset->width();
top = subset->fTop;
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index ba9f8146c8..90a655c920 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -158,7 +158,7 @@ GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
float bounds[2])
: Gr1DKernelEffect(texture, direction, radius), fUseBounds(useBounds) {
SkASSERT(radius <= kMaxKernelRadius);
- SkASSERT(NULL != kernel);
+ SkASSERT(kernel);
int width = this->width();
for (int i = 0; i < width; i++) {
fKernel[i] = kernel[i];
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index e3927c0d1f..91df897eb8 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -35,7 +35,7 @@ GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() {
// Remove the specified atlas from the cache
void GrTextureStripAtlas::CleanUp(const GrContext*, void* info) {
- SkASSERT(NULL != info);
+ SkASSERT(info);
AtlasEntry* entry = static_cast<AtlasEntry*>(info);
@@ -209,11 +209,11 @@ void GrTextureStripAtlas::lockTexture() {
this->initLRU();
fKeyTable.rewind();
}
- SkASSERT(NULL != fTexture);
+ SkASSERT(fTexture);
}
void GrTextureStripAtlas::unlockTexture() {
- SkASSERT(NULL != fTexture && 0 == fLockedRows);
+ SkASSERT(fTexture && 0 == fLockedRows);
fTexture->unref();
fTexture = NULL;
fDesc.fContext->purgeCache();
@@ -246,8 +246,8 @@ void GrTextureStripAtlas::appendLRU(AtlasRow* row) {
}
void GrTextureStripAtlas::removeFromLRU(AtlasRow* row) {
- SkASSERT(NULL != row);
- if (NULL != row->fNext && NULL != row->fPrev) {
+ SkASSERT(row);
+ if (row->fNext && row->fPrev) {
row->fPrev->fNext = row->fNext;
row->fNext->fPrev = row->fPrev;
} else {
@@ -342,7 +342,7 @@ void GrTextureStripAtlas::validate() {
if (fLockedRows == 0) {
SkASSERT(NULL == fTexture);
} else {
- SkASSERT(NULL != fTexture);
+ SkASSERT(fTexture);
}
}
#endif
diff --git a/src/gpu/gl/GrGLBufferImpl.cpp b/src/gpu/gl/GrGLBufferImpl.cpp
index ae578a20fa..8b5eda58ef 100644
--- a/src/gpu/gl/GrGLBufferImpl.cpp
+++ b/src/gpu/gl/GrGLBufferImpl.cpp
@@ -38,7 +38,7 @@ GrGLBufferImpl::GrGLBufferImpl(GrGpuGL* gpu, const Desc& desc, GrGLenum bufferTy
void GrGLBufferImpl::release(GrGpuGL* gpu) {
VALIDATE();
// make sure we've not been abandoned or already released
- if (NULL != fCPUData) {
+ if (fCPUData) {
sk_free(fCPUData);
fCPUData = NULL;
} else if (fDesc.fID && !fDesc.fIsWrapped) {
@@ -157,7 +157,7 @@ void GrGLBufferImpl::unmap(GrGpuGL* gpu) {
bool GrGLBufferImpl::isMapped() const {
VALIDATE();
- return NULL != fMapPtr;
+ return SkToBool(fMapPtr);
}
bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInBytes) {
@@ -218,9 +218,9 @@ bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInB
void GrGLBufferImpl::validate() const {
SkASSERT(GR_GL_ARRAY_BUFFER == fBufferType || GR_GL_ELEMENT_ARRAY_BUFFER == fBufferType);
// The following assert isn't valid when the buffer has been abandoned:
- // SkASSERT((0 == fDesc.fID) == (NULL != fCPUData));
+ // SkASSERT((0 == fDesc.fID) == (fCPUData));
SkASSERT(0 != fDesc.fID || !fDesc.fIsWrapped);
SkASSERT(NULL == fCPUData || 0 == fGLSizeInBytes);
- SkASSERT(NULL == fMapPtr || NULL != fCPUData || fGLSizeInBytes == fDesc.fSizeInBytes);
+ SkASSERT(NULL == fMapPtr || fCPUData || fGLSizeInBytes == fDesc.fSizeInBytes);
SkASSERT(NULL == fCPUData || NULL == fMapPtr || fCPUData == fMapPtr);
}
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 5acb92254c..dc4ef4c160 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -342,7 +342,7 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
(fMaxFixedFunctionTextureCoords > 0 ||
((ctxInfo.version() >= GR_GL_VER(4,3) ||
ctxInfo.hasExtension("GL_ARB_program_interface_query")) &&
- NULL != gli->fFunctions.fProgramPathFragmentInputGen));
+ gli->fFunctions.fProgramPathFragmentInputGen));
} else {
fPathRenderingSupport = ctxInfo.version() >= GR_GL_VER(3,1);
}
@@ -519,7 +519,7 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VER(1, 3));
fCompressedTexSubImageSupport =
- hasCompressTex2D && (NULL != gli->fFunctions.fCompressedTexSubImage2D);
+ hasCompressTex2D && (gli->fFunctions.fCompressedTexSubImage2D);
// Check for ETC1
bool hasETC1 = false;
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 5bc5b6f031..537363493f 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -62,9 +62,7 @@ bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
return false;
}
-bool GrGLContextInfo::isInitialized() const {
- return NULL != fInterface.get();
-}
+bool GrGLContextInfo::isInitialized() const { return SkToBool(fInterface.get()); }
void GrGLContextInfo::reset() {
fInterface.reset(NULL);
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 8b6d9a6748..9cac1c675a 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -21,7 +21,7 @@ public:
~BufferObj() { SkDELETE_ARRAY(fDataPtr); }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
- if (NULL != fDataPtr) {
+ if (fDataPtr) {
SkASSERT(0 != fSize);
SkDELETE_ARRAY(fDataPtr);
}
@@ -65,7 +65,7 @@ public:
BufferObj* lookUp(GrGLuint id) {
BufferObj* buffer = fBuffers[id];
- SkASSERT(NULL != buffer && buffer->id() == id);
+ SkASSERT(buffer && buffer->id() == id);
return buffer;
}
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index c192611f50..4c2713d334 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -74,7 +74,7 @@ GrGLInterface::GrGLInterface() {
}
GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
- SkASSERT(NULL != interface);
+ SkASSERT(interface);
GrGLInterface* clone = SkNEW(GrGLInterface);
clone->fStandard = interface->fStandard;
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
index 5295207710..48a073c096 100644
--- a/src/gpu/gl/GrGLPathRange.cpp
+++ b/src/gpu/gl/GrGLPathRange.cpp
@@ -39,7 +39,7 @@ void GrGLPathRange::initAt(size_t index, const SkPath& skPath) {
}
void GrGLPathRange::onRelease() {
- SkASSERT(NULL != this->getGpu());
+ SkASSERT(this->getGpu());
if (0 != fBasePathID && !this->isWrapped()) {
static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID, fSize);
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 337e83e811..f524ff2aca 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -49,13 +49,13 @@ GrGLPathRendering::GrGLPathRendering(GrGpuGL* gpu)
: fGpu(gpu) {
const GrGLInterface* glInterface = gpu->glInterface();
fCaps.stencilThenCoverSupport =
- NULL != glInterface->fFunctions.fStencilThenCoverFillPath &&
- NULL != glInterface->fFunctions.fStencilThenCoverStrokePath &&
- NULL != glInterface->fFunctions.fStencilThenCoverFillPathInstanced &&
- NULL != glInterface->fFunctions.fStencilThenCoverStrokePathInstanced;
+ glInterface->fFunctions.fStencilThenCoverFillPath &&
+ glInterface->fFunctions.fStencilThenCoverStrokePath &&
+ glInterface->fFunctions.fStencilThenCoverFillPathInstanced &&
+ glInterface->fFunctions.fStencilThenCoverStrokePathInstanced;
fCaps.fragmentInputGenSupport =
kGLES_GrGLStandard == glInterface->fStandard &&
- NULL != glInterface->fFunctions.fProgramPathFragmentInputGen;
+ glInterface->fFunctions.fProgramPathFragmentInputGen;
if (!fCaps.fragmentInputGenSupport) {
fHWPathTexGenSettings.reset(fGpu->glCaps().maxFixedFunctionTextureCoords());
@@ -97,8 +97,8 @@ GrPathRange* GrGLPathRendering::createPathRange(size_t size, const SkStrokeRec&
void GrGLPathRendering::stencilPath(const GrPath* path, SkPath::FillType fill) {
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
+ SkASSERT(fGpu->drawState()->getRenderTarget());
+ SkASSERT(fGpu->drawState()->getRenderTarget()->getStencilBuffer());
this->flushPathStencilSettings(fill);
SkASSERT(!fHWPathStencilSettings.isTwoSided());
@@ -111,8 +111,8 @@ void GrGLPathRendering::stencilPath(const GrPath* path, SkPath::FillType fill) {
void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
+ SkASSERT(fGpu->drawState()->getRenderTarget());
+ SkASSERT(fGpu->drawState()->getRenderTarget()->getStencilBuffer());
this->flushPathStencilSettings(fill);
SkASSERT(!fHWPathStencilSettings.isTwoSided());
@@ -167,8 +167,8 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
const float transforms[], PathTransformType transformsType,
SkPath::FillType fill) {
SkASSERT(fGpu->caps()->pathRenderingSupport());
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
- SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
+ SkASSERT(fGpu->drawState()->getRenderTarget());
+ SkASSERT(fGpu->drawState()->getRenderTarget()->getStencilBuffer());
GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID();
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 7b5dbb4c94..916c31ccbe 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -100,7 +100,7 @@ void GrGLProgram::initSamplerUniforms() {
fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni, texUnitIdx);
fDstCopyTexUnit = texUnitIdx++;
}
- if (NULL != fGeometryProcessor.get()) {
+ if (fGeometryProcessor.get()) {
fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx);
}
fColorEffects->initSamplers(fProgramDataManager, &texUnitIdx);
@@ -135,7 +135,7 @@ void GrGLProgram::setData(GrGpu::DrawType drawType,
this->setCoverage(drawState, coverage, sharedState);
this->setMatrixAndRenderTargetHeight(drawType, drawState);
- if (NULL != dstCopy) {
+ if (dstCopy) {
if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
static_cast<GrGLfloat>(dstCopy->offset().fX),
@@ -156,8 +156,8 @@ void GrGLProgram::setData(GrGpu::DrawType drawType,
SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
}
- if (NULL != fGeometryProcessor.get()) {
- SkASSERT(NULL != geometryProcessor);
+ if (fGeometryProcessor.get()) {
+ SkASSERT(geometryProcessor);
fGeometryProcessor->setData(fGpu, drawType,fProgramDataManager, geometryProcessor);
}
fColorEffects->setData(fGpu, drawType,fProgramDataManager, colorStages);
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 8d0ea3d6b3..d7ba287cfa 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -243,9 +243,9 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
}
if (readsDst) {
- SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport());
+ SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport());
const GrTexture* dstCopyTexture = NULL;
- if (NULL != dstCopy) {
+ if (dstCopy) {
dstCopyTexture = dstCopy->texture();
}
header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTexture,
diff --git a/src/gpu/gl/GrGLProgramEffects.cpp b/src/gpu/gl/GrGLProgramEffects.cpp
index 45edca8106..98e813835a 100644
--- a/src/gpu/gl/GrGLProgramEffects.cpp
+++ b/src/gpu/gl/GrGLProgramEffects.cpp
@@ -461,7 +461,7 @@ void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage,
const char* outColor,
const char* inColor,
int stageIndex) {
- SkASSERT(NULL != fProgramEffects.get());
+ SkASSERT(fProgramEffects.get());
fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIndex);
}
@@ -570,7 +570,7 @@ void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage,
const char* outColor,
const char* inColor,
int stageIndex) {
- SkASSERT(NULL != fProgramEffects.get());
+ SkASSERT(fProgramEffects.get());
fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIndex);
}
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 6143f34b95..49186bf3b3 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -53,8 +53,8 @@ GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
viewport.fWidth, viewport.fHeight,
desc.fConfig, desc.fSampleCnt,
desc.fOrigin)) {
- SkASSERT(NULL != texID);
- SkASSERT(NULL != texture);
+ SkASSERT(texID);
+ SkASSERT(texture);
// FBO 0 can't also be a texture, right?
SkASSERT(0 != desc.fRTFBOID);
SkASSERT(0 != desc.fTexFBOID);
@@ -102,7 +102,7 @@ void GrGLRenderTarget::onAbandon() {
fRTFBOID = 0;
fTexFBOID = 0;
fMSColorRenderbufferID = 0;
- if (NULL != fTexIDObj.get()) {
+ if (fTexIDObj.get()) {
fTexIDObj->abandon();
fTexIDObj.reset(NULL);
}
diff --git a/src/gpu/gl/GrGLSL.cpp b/src/gpu/gl/GrGLSL.cpp
index 468b13b138..6c8f88360c 100644
--- a/src/gpu/gl/GrGLSL.cpp
+++ b/src/gpu/gl/GrGLSL.cpp
@@ -10,7 +10,7 @@
#include "SkString.h"
bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) {
- SkASSERT(NULL != generation);
+ SkASSERT(generation);
GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
if (GR_GLSL_INVALID_VER == ver) {
return false;
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index bc013bc0ec..202fc426ba 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -24,7 +24,7 @@ void GrGLTexture::init(GrGpuGL* gpu,
textureDesc.fTextureID,
textureDesc.fIsWrapped)));
- if (NULL != rtDesc) {
+ if (rtDesc) {
GrGLIRect vp;
vp.fLeft = 0;
vp.fWidth = textureDesc.fWidth;
@@ -55,7 +55,7 @@ void GrGLTexture::onRelease() {
}
void GrGLTexture::onAbandon() {
- if (NULL != fTexIDObj.get()) {
+ if (fTexIDObj.get()) {
fTexIDObj->abandon();
fTexIDObj.reset(NULL);
}
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index a8800fab55..23ae3fa31f 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -89,7 +89,7 @@ public:
fTexParamsTimestamp = timestamp;
}
- GrGLuint textureID() const { return (NULL != fTexIDObj.get()) ? fTexIDObj->id() : 0; }
+ GrGLuint textureID() const { return (fTexIDObj.get()) ? fTexIDObj->id() : 0; }
protected:
// overrides of GrTexture
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 9bc2c5d67a..1ef66e05d1 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -40,10 +40,10 @@ void GrGLCheckErr(const GrGLInterface* gl,
uint32_t err = GR_GL_GET_ERROR(gl);
if (GR_GL_NO_ERROR != err) {
GrPrintf("---- glGetError 0x%x(%s)", err, get_error_string(err));
- if (NULL != location) {
+ if (location) {
GrPrintf(" at\n\t%s", location);
}
- if (NULL != call) {
+ if (call) {
GrPrintf("\n\t\t%s", call);
}
GrPrintf("\n");
@@ -167,7 +167,7 @@ GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) {
}
GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
- if (NULL != vendorString) {
+ if (vendorString) {
if (0 == strcmp(vendorString, "ARM")) {
return kARM_GrGLVendor;
}
@@ -188,7 +188,7 @@ GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
}
GrGLRenderer GrGLGetRendererFromString(const char* rendererString) {
- if (NULL != rendererString) {
+ if (rendererString) {
if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) {
return kTegra3_GrGLRenderer;
} else if (0 == strcmp(rendererString, "NVIDIA Tegra")) {
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index 39fd48cb89..4acf29235d 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -100,7 +100,7 @@ GrGLAttribArrayState* GrGLVertexArray::bind() {
GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(const GrGLIndexBuffer* buffer) {
GrGLAttribArrayState* state = this->bind();
- if (NULL != state && NULL != buffer) {
+ if (state && buffer) {
GrGLuint bufferID = buffer->bufferID();
if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) {
GL_CALL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, bufferID));
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index f5802ef958..39cb84ecfe 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -542,7 +542,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
GrPixelConfig dataConfig,
const void* data,
size_t rowBytes) {
- SkASSERT(NULL != data || isNewTexture);
+ SkASSERT(data || isNewTexture);
// If we're uploading compressed data then we should be using uploadCompressedTexData
SkASSERT(!GrPixelConfigIsCompressed(dataConfig));
@@ -602,7 +602,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
bool restoreGLRowLength = false;
bool swFlipY = false;
bool glFlipY = false;
- if (NULL != data) {
+ if (data) {
if (kBottomLeft_GrSurfaceOrigin == desc.fOrigin) {
if (this->glCaps().unpackFlipYSupport()) {
glFlipY = true;
@@ -673,7 +673,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
} else {
// if we have data and we used TexStorage to create the texture, we
// now upload with TexSubImage.
- if (NULL != data && useTexStorage) {
+ if (data && useTexStorage) {
GL_CALL(TexSubImage2D(GR_GL_TEXTURE_2D,
0, // level
left, top,
@@ -712,7 +712,7 @@ bool GrGpuGL::uploadCompressedTexData(const GrGLTexture::Desc& desc,
const void* data,
bool isNewTexture,
int left, int top, int width, int height) {
- SkASSERT(NULL != data || isNewTexture);
+ SkASSERT(data || isNewTexture);
// No support for software flip y, yet...
SkASSERT(kBottomLeft_GrSurfaceOrigin != desc.fOrigin);
@@ -1225,7 +1225,7 @@ bool GrGpuGL::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
GrGLuint fbo = glrt->renderFBOID();
if (NULL == sb) {
- if (NULL != rt->getStencilBuffer()) {
+ if (rt->getStencilBuffer()) {
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
@@ -1382,7 +1382,7 @@ void GrGpuGL::flushScissor(const GrGLIRect& rtViewport, GrSurfaceOrigin rtOrigin
void GrGpuGL::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color,
bool canIgnoreRect) {
// parent class should never let us get here with no RT
- SkASSERT(NULL != target);
+ SkASSERT(target);
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
if (canIgnoreRect && this->glCaps().fullClearIsFree()) {
@@ -1390,7 +1390,7 @@ void GrGpuGL::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color
}
SkIRect clippedRect;
- if (NULL != rect) {
+ if (rect) {
// flushScissor expects rect to be clipped to the target.
clippedRect = *rect;
SkIRect rtRect = SkIRect::MakeWH(target->width(), target->height());
@@ -1403,7 +1403,7 @@ void GrGpuGL::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color
this->flushRenderTarget(glRT, rect);
GrAutoTRestore<ScissorState> asr(&fScissorState);
- fScissorState.fEnabled = (NULL != rect);
+ fScissorState.fEnabled = SkToBool(rect);
if (fScissorState.fEnabled) {
fScissorState.fRect = *rect;
}
@@ -1495,11 +1495,11 @@ void GrGpuGL::clearStencil(GrRenderTarget* target) {
}
void GrGpuGL::clearStencilClip(GrRenderTarget* target, const SkIRect& rect, bool insideClip) {
- SkASSERT(NULL != target);
+ SkASSERT(target);
// this should only be called internally when we know we have a
// stencil buffer.
- SkASSERT(NULL != target->getStencilBuffer());
+ SkASSERT(target->getStencilBuffer());
GrGLint stencilBitCount = target->getStencilBuffer()->bits();
#if 0
SkASSERT(stencilBitCount > 0);
@@ -1693,7 +1693,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) {
- SkASSERT(NULL != target);
+ SkASSERT(target);
uint32_t rtID = target->getUniqueID();
if (fHWBoundRenderTargetUniqueID != rtID) {
@@ -1723,7 +1723,7 @@ void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
}
GrTexture *texture = target->asTexture();
- if (NULL != texture) {
+ if (texture) {
texture->impl()->dirtyMipMaps(true);
}
}
@@ -2006,13 +2006,13 @@ static inline GrGLenum tile_to_gl_wrap(SkShader::TileMode tm) {
}
void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* texture) {
- SkASSERT(NULL != texture);
+ SkASSERT(texture);
// If we created a rt/tex and rendered to it without using a texture and now we're texturing
// from the rt it will still be the last bound texture, but it needs resolving. So keep this
// out of the "last != next" check.
GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTarget());
- if (NULL != texRT) {
+ if (texRT) {
this->onResolveRenderTarget(texRT);
}
@@ -2318,7 +2318,7 @@ inline bool can_blit_framebuffer(const GrSurface* dst,
(src->desc().fSampleCnt > 0 || src->config() != dst->config())) {
return false;
}
- if (NULL != wouldNeedTempFBO) {
+ if (wouldNeedTempFBO) {
*wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->asRenderTarget();
}
return true;
@@ -2341,20 +2341,20 @@ inline bool can_copy_texsubimage(const GrSurface* dst,
const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->asRenderTarget());
// If dst is multisampled (and uses an extension where there is a separate MSAA renderbuffer)
// then we don't want to copy to the texture but to the MSAA buffer.
- if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) {
+ if (dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) {
return false;
}
const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->asRenderTarget());
// If the src is multisampled (and uses an extension where there is a separate MSAA
// renderbuffer) then it is an invalid operation to call CopyTexSubImage
- if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
+ if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
return false;
}
if (gpu->glCaps().isConfigRenderable(src->config(), src->desc().fSampleCnt > 0) &&
- NULL != dst->asTexture() &&
+ dst->asTexture() &&
dst->origin() == src->origin() &&
!GrPixelConfigIsCompressed(src->config())) {
- if (NULL != wouldNeedTempFBO) {
+ if (wouldNeedTempFBO) {
*wouldNeedTempFBO = NULL == src->asRenderTarget();
}
return true;
@@ -2372,7 +2372,7 @@ inline GrGLuint bind_surface_as_fbo(const GrGLInterface* gl,
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(surface->asRenderTarget());
GrGLuint tempFBOID;
if (NULL == rt) {
- SkASSERT(NULL != surface->asTexture());
+ SkASSERT(surface->asTexture());
GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textureID();
GR_GL_CALL(gl, GenFramebuffers(1, &tempFBOID));
GR_GL_CALL(gl, BindFramebuffer(fboTarget, tempFBOID));
@@ -2411,7 +2411,7 @@ void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc)
}
const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->asRenderTarget());
- if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
+ if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
// It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer.
INHERITED::initCopySurfaceDstDesc(src, desc);
} else {
@@ -2434,7 +2434,7 @@ bool GrGpuGL::onCopySurface(GrSurface* dst,
GrGLIRect srcVP;
srcFBO = bind_surface_as_fbo(this->glInterface(), src, GR_GL_FRAMEBUFFER, &srcVP);
GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture());
- SkASSERT(NULL != dstTex);
+ SkASSERT(dstTex);
// We modified the bound FBO
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
GrGLIRect srcGLRect;
@@ -2577,7 +2577,7 @@ GrGLAttribArrayState* GrGpuGL::HWGeometryState::bindArrayAndBuffersToDraw(
GrGpuGL* gpu,
const GrGLVertexBuffer* vbuffer,
const GrGLIndexBuffer* ibuffer) {
- SkASSERT(NULL != vbuffer);
+ SkASSERT(vbuffer);
GrGLAttribArrayState* attribState;
// We use a vertex array if we're on a core profile and the verts are in a VBO.
@@ -2591,7 +2591,7 @@ GrGLAttribArrayState* GrGpuGL::HWGeometryState::bindArrayAndBuffersToDraw(
}
attribState = fVBOVertexArray->bindWithIndexBuffer(ibuffer);
} else {
- if (NULL != ibuffer) {
+ if (ibuffer) {
this->setIndexBufferIDOnDefaultVertexArray(gpu, ibuffer->bufferID());
} else {
this->setVertexArrayID(gpu, 0);
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 004ce254bf..2859b43b31 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -314,7 +314,7 @@ private:
fDefaultVertexArrayBoundIndexBufferID = false;
fDefaultVertexArrayBoundIndexBufferIDIsValid = false;
fDefaultVertexArrayAttribState.invalidate();
- if (NULL != fVBOVertexArray) {
+ if (fVBOVertexArray) {
fVBOVertexArray->invalidateCachedState();
}
}
@@ -342,7 +342,7 @@ private:
if (fBoundVertexBufferIDIsValid && id == fBoundVertexBufferID) {
fBoundVertexBufferID = 0;
}
- if (NULL != fVBOVertexArray) {
+ if (fVBOVertexArray) {
fVBOVertexArray->notifyVertexBufferDelete(id);
}
fDefaultVertexArrayAttribState.notifyVertexBufferDelete(id);
@@ -353,7 +353,7 @@ private:
id == fDefaultVertexArrayBoundIndexBufferID) {
fDefaultVertexArrayBoundIndexBufferID = 0;
}
- if (NULL != fVBOVertexArray) {
+ if (fVBOVertexArray) {
fVBOVertexArray->notifyIndexBufferDelete(id);
}
}
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 67c0cd3a47..be21abf3e9 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -30,12 +30,12 @@ struct GrGpuGL::ProgramCache::Entry {
struct GrGpuGL::ProgramCache::ProgDescLess {
bool operator() (const GrGLProgramDesc& desc, const Entry* entry) {
- SkASSERT(NULL != entry->fProgram.get());
+ SkASSERT(entry->fProgram.get());
return GrGLProgramDesc::Less(desc, entry->fProgram->getDesc());
}
bool operator() (const Entry* entry, const GrGLProgramDesc& desc) {
- SkASSERT(NULL != entry->fProgram.get());
+ SkASSERT(entry->fProgram.get());
return GrGLProgramDesc::Less(entry->fProgram->getDesc(), desc);
}
};
@@ -77,7 +77,7 @@ GrGpuGL::ProgramCache::~ProgramCache() {
void GrGpuGL::ProgramCache::abandon() {
for (int i = 0; i < fCount; ++i) {
- SkASSERT(NULL != fEntries[i]->fProgram.get());
+ SkASSERT(fEntries[i]->fProgram.get());
fEntries[i]->fProgram->abandon();
SkDELETE(fEntries[i]);
}
@@ -106,8 +106,8 @@ GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrGLProgramDesc& desc,
}
hashIdx &=((1 << kHashBits) - 1);
Entry* hashedEntry = fHashTable[hashIdx];
- if (NULL != hashedEntry && hashedEntry->fProgram->getDesc() == desc) {
- SkASSERT(NULL != hashedEntry->fProgram);
+ if (hashedEntry && hashedEntry->fProgram->getDesc() == desc) {
+ SkASSERT(hashedEntry->fProgram);
entry = hashedEntry;
}
@@ -175,9 +175,9 @@ GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrGLProgramDesc& desc,
fEntries[entryIdx - 1] = entry;
}
#ifdef SK_DEBUG
- SkASSERT(NULL != fEntries[0]->fProgram.get());
+ SkASSERT(fEntries[0]->fProgram.get());
for (int i = 0; i < fCount - 1; ++i) {
- SkASSERT(NULL != fEntries[i + 1]->fProgram.get());
+ SkASSERT(fEntries[i + 1]->fProgram.get());
const GrGLProgramDesc& a = fEntries[i]->fProgram->getDesc();
const GrGLProgramDesc& b = fEntries[i + 1]->fProgram->getDesc();
SkASSERT(GrGLProgramDesc::Less(a, b));
@@ -207,7 +207,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
const GrDrawState& drawState = this->getDrawState();
// GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
- SkASSERT(NULL != drawState.getRenderTarget());
+ SkASSERT(drawState.getRenderTarget());
if (kStencilPath_DrawType == type) {
const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
@@ -314,13 +314,13 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
SkFAIL("Unknown geometry src type!");
}
- SkASSERT(NULL != vbuf);
+ SkASSERT(vbuf);
SkASSERT(!vbuf->isMapped());
vertexOffsetInBytes += vbuf->baseOffset();
GrGLIndexBuffer* ibuf = NULL;
if (info.isIndexed()) {
- SkASSERT(NULL != indexOffsetInBytes);
+ SkASSERT(indexOffsetInBytes);
switch (this->getGeomSrc().fIndexSrc) {
case kBuffer_GeometrySrcType:
@@ -338,7 +338,7 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
SkFAIL("Unknown geometry src type!");
}
- SkASSERT(NULL != ibuf);
+ SkASSERT(ibuf);
SkASSERT(!ibuf->isMapped());
*indexOffsetInBytes += ibuf->baseOffset();
}
diff --git a/src/gpu/gl/SkGLContextHelper.cpp b/src/gpu/gl/SkGLContextHelper.cpp
index 411e1de01e..03b70c38f7 100644
--- a/src/gpu/gl/SkGLContextHelper.cpp
+++ b/src/gpu/gl/SkGLContextHelper.cpp
@@ -136,7 +136,7 @@ bool SkGLContextHelper::init(GrGLStandard forcedGpuAPI, int width,
}
void SkGLContextHelper::testAbandon() {
- if (NULL != fGL) {
+ if (fGL) {
fGL->abandon();
}
}
diff --git a/src/gpu/gl/android/SkNativeGLContext_android.cpp b/src/gpu/gl/android/SkNativeGLContext_android.cpp
index 705bd8f49c..2e605c79db 100644
--- a/src/gpu/gl/android/SkNativeGLContext_android.cpp
+++ b/src/gpu/gl/android/SkNativeGLContext_android.cpp
@@ -15,7 +15,7 @@ SkNativeGLContext::AutoContextRestore::AutoContextRestore() {
}
SkNativeGLContext::AutoContextRestore::~AutoContextRestore() {
- if (NULL != fOldDisplay) {
+ if (fOldDisplay) {
eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext);
}
}
diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
index 0d06b2d600..e4f5467842 100644
--- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
+++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
@@ -16,7 +16,7 @@
static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name);
- if (NULL != proc) {
+ if (proc) {
return proc;
}
return eglGetProcAddress(name);
diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp
index 884fe7ca11..81fccebba0 100644
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp
@@ -16,7 +16,7 @@ SkANGLEGLContext::AutoContextRestore::AutoContextRestore() {
}
SkANGLEGLContext::AutoContextRestore::~AutoContextRestore() {
- if (NULL != fOldDisplay) {
+ if (fOldDisplay) {
eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext);
}
}
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index fef3691cd3..6c92684203 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -48,7 +48,7 @@ GrGLFragmentShaderBuilder::DstReadKey GrGLFragmentShaderBuilder::KeyForDstRead(
if (caps.fbFetchSupport()) {
return key;
}
- SkASSERT(NULL != dstCopy);
+ SkASSERT(dstCopy);
if (!caps.textureSwizzleSupport() && GrPixelConfigIsAlphaOnly(dstCopy->config())) {
// The fact that the config is alpha-only must be considered when generating code.
key |= kUseAlphaConfig_DstReadKeyBit;
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index ab64e28a78..3844a30f92 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -156,7 +156,7 @@ GrGLProgramDataManager::UniformHandle GrGLProgramBuilder::addUniformArray(uint32
uni.fVariable.setPrecision(kDefaultFragmentPrecision);
}
- if (NULL != outName) {
+ if (outName) {
*outName = uni.fVariable.c_str();
}
return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex(fUniforms.count() - 1);
@@ -190,7 +190,7 @@ void GrGLProgramBuilder::createAndEmitEffects(GrGLProgramEffectsBuilder* program
GrGLSLExpr4 outColor;
for (int e = 0; e < effectCnt; ++e) {
- SkASSERT(NULL != effectStages[e] && NULL != effectStages[e]->getEffect());
+ SkASSERT(effectStages[e] && effectStages[e]->getEffect());
const GrEffectStage& stage = *effectStages[e];
CodeStage::AutoStageRestore csar(&fCodeStage, &stage);
@@ -344,7 +344,7 @@ void GrGLFullProgramBuilder::emitCodeBeforeEffects(GrGLSLExpr4* color,
void GrGLFullProgramBuilder::emitGeometryProcessor(const GrEffectStage* geometryProcessor,
GrGLSLExpr4* coverage) {
- if (NULL != geometryProcessor) {
+ if (geometryProcessor) {
GrGLProgramDesc::EffectKeyProvider geometryProcessorKeyProvider(
&this->desc(), GrGLProgramDesc::EffectKeyProvider::kGeometryProcessor_EffectType);
fGeometryProcessor.reset(this->createAndEmitEffect(
@@ -411,7 +411,7 @@ void GrGLFullProgramBuilder::createAndEmitEffect(GrGLProgramEffectsBuilder* prog
GrGLSLExpr4 inColor = *fsInOutColor;
GrGLSLExpr4 outColor;
- SkASSERT(NULL != effectStages && NULL != effectStages->getEffect());
+ SkASSERT(effectStages && effectStages->getEffect());
const GrEffectStage& stage = *effectStages;
// Using scope to force ASR destructor to be triggered
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index deb3708bd1..01269aa5ea 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -184,7 +184,7 @@ protected:
bool inStageCode() const {
this->validate();
- return NULL != fEffectStage;
+ return SkToBool(fEffectStage);
}
const GrEffectStage* effectStage() const {
@@ -200,7 +200,7 @@ protected:
class AutoStageRestore : SkNoncopyable {
public:
AutoStageRestore(CodeStage* codeStage, const GrEffectStage* newStage) {
- SkASSERT(NULL != codeStage);
+ SkASSERT(codeStage);
fSavedIndex = codeStage->fCurrentIndex;
fSavedEffectStage = codeStage->fEffectStage;
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.cpp b/src/gpu/gl/builders/GrGLShaderBuilder.cpp
index 6b3e1d12dd..b7c7bbf532 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLShaderBuilder.cpp
@@ -26,7 +26,7 @@ void append_texture_lookup(SkString* out,
uint32_t configComponentMask,
const char* swizzle,
GrSLType varyingType = kVec2f_GrSLType) {
- SkASSERT(NULL != coordName);
+ SkASSERT(coordName);
out->appendf("%s(%s, %s)",
sample_function_name(varyingType, gpu->glslGeneration()),
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.h b/src/gpu/gl/builders/GrGLShaderBuilder.h
index ffb324773a..4921fd32bd 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.h
+++ b/src/gpu/gl/builders/GrGLShaderBuilder.h
@@ -118,7 +118,7 @@ public:
class ShaderBlock {
public:
ShaderBlock(GrGLShaderBuilder* builder) : fBuilder(builder) {
- SkASSERT(NULL != builder);
+ SkASSERT(builder);
fBuilder->codeAppend("{");
}
diff --git a/src/gpu/gl/debug/GrDebugGL.cpp b/src/gpu/gl/debug/GrDebugGL.cpp
index 71607c8b0d..e5b00c10c1 100644
--- a/src/gpu/gl/debug/GrDebugGL.cpp
+++ b/src/gpu/gl/debug/GrDebugGL.cpp
@@ -112,7 +112,7 @@ void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) {
}
void GrDebugGL::setVertexArray(GrVertexArrayObj* vertexArray) {
- if (NULL != vertexArray) {
+ if (vertexArray) {
SkASSERT(!vertexArray->getDeleted());
}
SkRefCnt_SafeAssign(fVertexArray, vertexArray);
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 0279427d3b..4bd8f99e22 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -256,15 +256,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
for (int i = 0; i < n; ++i) {
- if (NULL != frameBuffer->getColor() &&
+ if (frameBuffer->getColor() &&
textures[i] == frameBuffer->getColor()->getID()) {
frameBuffer->setColor(NULL);
}
- if (NULL != frameBuffer->getDepth() &&
+ if (frameBuffer->getDepth() &&
textures[i] == frameBuffer->getDepth()->getID()) {
frameBuffer->setDepth(NULL);
}
- if (NULL != frameBuffer->getStencil() &&
+ if (frameBuffer->getStencil() &&
textures[i] == frameBuffer->getStencil()->getID()) {
frameBuffer->setStencil(NULL);
}
@@ -341,15 +341,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
for (int i = 0; i < n; ++i) {
- if (NULL != frameBuffer->getColor() &&
+ if (frameBuffer->getColor() &&
renderBuffers[i] == frameBuffer->getColor()->getID()) {
frameBuffer->setColor(NULL);
}
- if (NULL != frameBuffer->getDepth() &&
+ if (frameBuffer->getDepth() &&
renderBuffers[i] == frameBuffer->getDepth()->getID()) {
frameBuffer->setDepth(NULL);
}
- if (NULL != frameBuffer->getStencil() &&
+ if (frameBuffer->getStencil() &&
renderBuffers[i] == frameBuffer->getStencil()->getID()) {
frameBuffer->setStencil(NULL);
}
@@ -390,7 +390,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
GrFrameBufferObj *framebuffer = GrDebugGL::getInstance()->getFrameBuffer();
// A render buffer cannot be attached to the default framebuffer
- GrAlwaysAssert(NULL != framebuffer);
+ GrAlwaysAssert(framebuffer);
// a renderBufferID of 0 is acceptable - it unbinds the current
// render buffer
@@ -430,7 +430,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
GrFrameBufferObj *framebuffer = GrDebugGL::getInstance()->getFrameBuffer();
// A texture cannot be attached to the default framebuffer
- GrAlwaysAssert(NULL != framebuffer);
+ GrAlwaysAssert(framebuffer);
// A textureID of 0 is allowed - it unbinds the currently bound texture
GrTextureObj *texture = GR_FIND(textureID, GrTextureObj,
@@ -566,7 +566,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLui
GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindVertexArray(GrGLuint id) {
GrVertexArrayObj* array = GR_FIND(id, GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes);
- GrAlwaysAssert((0 == id) || NULL != array);
+ GrAlwaysAssert((0 == id) || array);
GrDebugGL::getInstance()->setVertexArray(array);
}
@@ -644,7 +644,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
break;
}
- if (NULL != buffer) {
+ if (buffer) {
GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize());
GrAlwaysAssert(!buffer->getMapped());
buffer->setMapped(offset, length);
@@ -695,7 +695,7 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
break;
}
- if (NULL != buffer) {
+ if (buffer) {
GrAlwaysAssert(buffer->getMapped());
buffer->resetMapped();
return GR_GL_TRUE;
@@ -724,7 +724,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target,
break;
}
- if (NULL != buffer) {
+ if (buffer) {
GrAlwaysAssert(buffer->getMapped());
GrAlwaysAssert(offset >= 0 && (offset + length) <= buffer->getMappedLength());
} else {
@@ -757,17 +757,17 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
switch (value) {
case GR_GL_BUFFER_MAPPED:
*params = GR_GL_FALSE;
- if (NULL != buffer)
+ if (buffer)
*params = buffer->getMapped() ? GR_GL_TRUE : GR_GL_FALSE;
break;
case GR_GL_BUFFER_SIZE:
*params = 0;
- if (NULL != buffer)
+ if (buffer)
*params = SkToInt(buffer->getSize());
break;
case GR_GL_BUFFER_USAGE:
*params = GR_GL_STATIC_DRAW;
- if (NULL != buffer)
+ if (buffer)
*params = buffer->getUsage();
break;
default:
diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
index 024a631acc..ccbc50f5ee 100644
--- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
+++ b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
@@ -19,7 +19,7 @@ public:
}
~GLLoader() {
- if (NULL != fLibrary) {
+ if (fLibrary) {
dlclose(fLibrary);
}
}
@@ -45,7 +45,7 @@ private:
};
static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) {
- SkASSERT(NULL != ctx);
+ SkASSERT(ctx);
const GLProcGetter* getter = (const GLProcGetter*) ctx;
return getter->getProc(name);
}
diff --git a/src/gpu/gl/iOS/SkNativeGLContext_iOS.mm b/src/gpu/gl/iOS/SkNativeGLContext_iOS.mm
index f04229f16e..1bdaf70f1c 100644
--- a/src/gpu/gl/iOS/SkNativeGLContext_iOS.mm
+++ b/src/gpu/gl/iOS/SkNativeGLContext_iOS.mm
@@ -36,7 +36,7 @@ SkNativeGLContext::~SkNativeGLContext() {
}
void SkNativeGLContext::destroyGLContext() {
- if (NULL != fEAGLContext) {
+ if (fEAGLContext) {
if ([EAGLContext currentContext] == EAGLCTX) {
[EAGLContext setCurrentContext:nil];
}
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index ab3f0ad241..a0c50c7409 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -21,7 +21,7 @@ public:
}
~GLLoader() {
- if (NULL != fLibrary) {
+ if (fLibrary) {
dlclose(fLibrary);
}
}
@@ -47,7 +47,7 @@ private:
};
static GrGLFuncPtr mac_get_gl_proc(void* ctx, const char name[]) {
- SkASSERT(NULL != ctx);
+ SkASSERT(ctx);
const GLProcGetter* getter = (const GLProcGetter*) ctx;
return getter->getProc(name);
}
diff --git a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
index fefbb4c12b..f63471c16a 100644
--- a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
@@ -27,7 +27,7 @@ SkNativeGLContext::~SkNativeGLContext() {
}
void SkNativeGLContext::destroyGLContext() {
- if (NULL != fContext) {
+ if (fContext) {
CGLReleaseContext(fContext);
}
}
diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
index b914b0be9c..ab48718f6d 100644
--- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
+++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
@@ -13,7 +13,7 @@
static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) {
SkASSERT(NULL == ctx);
- SkASSERT(NULL != OSMesaGetCurrentContext());
+ SkASSERT(OSMesaGetCurrentContext());
return OSMesaGetProcAddress(name);
}
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp
index 58e325dfeb..31402c5a3c 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.cpp
+++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp
@@ -13,7 +13,7 @@
SkMesaGLContext::AutoContextRestore::AutoContextRestore() {
fOldContext = (Context)OSMesaGetCurrentContext();
- if (NULL != (OSMesaContext)fOldContext) {
+ if (fOldContext) {
OSMesaGetColorBuffer((OSMesaContext)fOldContext,
&fOldWidth, &fOldHeight,
&fOldFormat, &fOldImage);
@@ -21,7 +21,7 @@ SkMesaGLContext::AutoContextRestore::AutoContextRestore() {
}
SkMesaGLContext::AutoContextRestore::~AutoContextRestore() {
- if (NULL != (OSMesaContext)fOldContext) {
+ if (fOldContext) {
OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage,
fOldFormat, fOldWidth, fOldHeight);
}
diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
index 45c8dc748e..19eec7e8ac 100644
--- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
+++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
@@ -14,7 +14,7 @@
static GrGLFuncPtr glx_get(void* ctx, const char name[]) {
SkASSERT(NULL == ctx);
- SkASSERT(NULL != glXGetCurrentContext());
+ SkASSERT(glXGetCurrentContext());
return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
}
diff --git a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
index 4910057c97..bd130b545c 100644
--- a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
+++ b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
@@ -18,7 +18,7 @@ SkNativeGLContext::AutoContextRestore::AutoContextRestore() {
}
SkNativeGLContext::AutoContextRestore::~AutoContextRestore() {
- if (NULL != fOldDisplay) {
+ if (fOldDisplay) {
glXMakeCurrent(fOldDisplay, fOldDrawable, fOldGLXContext);
}
}
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index 3aab86d28d..cba380b74d 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -18,7 +18,7 @@ public:
fModule = LoadLibrary(moduleName);
}
~AutoLibraryUnload() {
- if (NULL != fModule) {
+ if (fModule) {
FreeLibrary(fModule);
}
}
@@ -32,14 +32,14 @@ class GLProcGetter {
public:
GLProcGetter() : fGLLib("opengl32.dll") {}
- bool isInitialized() const { return NULL != fGLLib.get(); }
+ bool isInitialized() const { return SkToBool(fGLLib.get()); }
GrGLFuncPtr getProc(const char name[]) const {
GrGLFuncPtr proc;
- if (NULL != (proc = (GrGLFuncPtr) GetProcAddress(fGLLib.get(), name))) {
+ if ((proc = (GrGLFuncPtr) GetProcAddress(fGLLib.get(), name))) {
return proc;
}
- if (NULL != (proc = (GrGLFuncPtr) wglGetProcAddress(name))) {
+ if ((proc = (GrGLFuncPtr) wglGetProcAddress(name))) {
return proc;
}
return NULL;
@@ -50,8 +50,8 @@ private:
};
static GrGLFuncPtr win_get_gl_proc(void* ctx, const char name[]) {
- SkASSERT(NULL != ctx);
- SkASSERT(NULL != wglGetCurrentContext());
+ SkASSERT(ctx);
+ SkASSERT(wglGetCurrentContext());
const GLProcGetter* getter = (const GLProcGetter*) ctx;
return getter->getProc(name);
}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d98a5367a6..5733a89de3 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -45,7 +45,7 @@ private:
SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap)
: INHERITED(bitmap.width(), bitmap.height())
, fBitmap(bitmap) {
- SkASSERT(NULL != fBitmap.getTexture());
+ SkASSERT(fBitmap.getTexture());
}
SkImage_Gpu::~SkImage_Gpu() {
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 9f24e97c50..3a28e421a8 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -45,7 +45,7 @@ void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
- if (NULL != fCachedImage) {
+ if (fCachedImage) {
// the surface may need to fork its backend, if its sharing it with
// the cached image. Note: we only call if there is an outstanding owner
// on the image (besides us).
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 2314341f21..e7fa57af0d 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -79,7 +79,7 @@ private:
SkCanvas* SkSurface_Base::getCachedCanvas() {
if (NULL == fCachedCanvas) {
fCachedCanvas = this->onNewCanvas();
- if (NULL != fCachedCanvas) {
+ if (fCachedCanvas) {
fCachedCanvas->setSurfaceBase(this);
}
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index fab130cdde..f94dc5bd70 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -77,7 +77,7 @@ void SkSurface_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
GrRenderTarget* rt = fDevice->accessRenderTarget();
// are we sharing our render target with the image?
- SkASSERT(NULL != this->getCachedImage());
+ SkASSERT(this->getCachedImage());
if (rt->asTexture() == SkTextureImageGetTexture(this->getCachedImage())) {
// We call createCompatibleDevice because it uses the texture cache. This isn't
// necessarily correct (http://skbug.com/2252), but never using the cache causes
@@ -88,7 +88,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
if (kRetain_ContentChangeMode == mode) {
fDevice->context()->copyTexture(rt->asTexture(), newDevice->accessRenderTarget());
}
- SkASSERT(NULL != this->getCachedCanvas());
+ SkASSERT(this->getCachedCanvas());
SkASSERT(this->getCachedCanvas()->getDevice() == fDevice);
this->getCachedCanvas()->setRootDevice(newDevice);
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 167f7733db..13f215589f 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -118,7 +118,7 @@ SkImage* SkSurface_Raster::onNewImageSnapshot() {
void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
// are we sharing pixelrefs with the image?
- SkASSERT(NULL != this->getCachedImage());
+ SkASSERT(this->getCachedImage());
if (SkBitmapImageGetPixelRef(this->getCachedImage()) == fBitmap.pixelRef()) {
SkASSERT(fWeOwnThePixels);
if (kDiscard_ContentChangeMode == mode) {
@@ -131,7 +131,7 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
// Now fBitmap is a deep copy of itself (and therefore different from
// what is being used by the image. Next we update the canvas to use
// this as its backend, so we can't modify the image's pixels anymore.
- SkASSERT(NULL != this->getCachedCanvas());
+ SkASSERT(this->getCachedCanvas());
this->getCachedCanvas()->getDevice()->replaceBitmapBackendForRasterSurface(fBitmap);
}
}
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 4a5e734628..b25e7dbbab 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -271,7 +271,7 @@ bool SkImageDecoder::DecodeStream(SkStreamRewindable* stream, SkBitmap* bm, SkCo
bool success = false;
SkImageDecoder* codec = SkImageDecoder::Factory(stream);
- if (NULL != codec) {
+ if (codec) {
success = codec->decode(stream, bm, pref, mode);
if (success && format) {
*format = codec->getFormat();
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index 64a37d9e9b..20c8bbc00b 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -272,7 +272,7 @@ bool SkKTXImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int)
SkAutoDataUnref data(bitmap.pixelRef()->refEncodedData());
// Is this even encoded data?
- if (NULL != data) {
+ if (data) {
const uint8_t *bytes = data->bytes();
if (etc1_pkm_is_valid(bytes)) {
return this->encodePKM(stream, data);
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 0c8461f893..745f4e11f1 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -194,7 +194,7 @@ static bool skip_src_rows(GifFileType* gif, uint8_t* dst, int width, int rowsToS
static void sanitize_indexed_bitmap(SkBitmap* bm) {
if ((kIndex_8_SkColorType == bm->colorType()) && !(bm->empty())) {
SkAutoLockPixels alp(*bm);
- if (NULL != bm->getPixels()) {
+ if (bm->getPixels()) {
SkColorTable* ct = bm->getColorTable(); // Index8 must have it.
SkASSERT(ct != NULL);
uint32_t count = ct->count();
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index b69f87996c..dd1d1c8a98 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -62,7 +62,7 @@ public:
stream->ref();
}
~SkPNGImageIndex() {
- if (NULL != fPng_ptr) {
+ if (fPng_ptr) {
png_destroy_read_struct(&fPng_ptr, &fInfo_ptr, png_infopp_NULL);
}
}
@@ -1161,7 +1161,7 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int
// we must do this after we have locked the pixels
SkColorTable* ctable = bitmap.getColorTable();
- if (NULL != ctable) {
+ if (ctable) {
if (ctable->count() == 0) {
return false;
}
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 6c13951aa8..f8f44d0c07 100644
--- a/src/lazy/SkDiscardableMemoryPool.cpp
+++ b/src/lazy/SkDiscardableMemoryPool.cpp
@@ -155,7 +155,7 @@ void DiscardableMemoryPool::dumpDownTo(size_t budget) {
typedef SkTInternalLList<PoolDiscardableMemory>::Iter Iter;
Iter iter;
PoolDiscardableMemory* cur = iter.init(fList, Iter::kTail_IterStart);
- while ((fUsed > budget) && (NULL != cur)) {
+ while ((fUsed > budget) && (cur)) {
if (!cur->fLocked) {
PoolDiscardableMemory* dm = cur;
SkASSERT(dm->fPointer != NULL);
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index b5d2522348..f361e5ed67 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -1035,15 +1035,15 @@ void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
size_t size = SkPatchUtils::kNumCtrlPts * sizeof(SkPoint);
unsigned flags = 0;
- if (NULL != colors) {
+ if (colors) {
flags |= kDrawVertices_HasColors_DrawOpFlag;
size += SkPatchUtils::kNumCorners * sizeof(SkColor);
}
- if (NULL != texCoords) {
+ if (texCoords) {
flags |= kDrawVertices_HasTexs_DrawOpFlag;
size += SkPatchUtils::kNumCorners * sizeof(SkPoint);
}
- if (NULL != xmode) {
+ if (xmode) {
SkXfermode::Mode mode;
if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) {
flags |= kDrawVertices_HasXfermode_DrawOpFlag;
@@ -1057,11 +1057,11 @@ void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
fWriter.write(cubics, SkPatchUtils::kNumCtrlPts * sizeof(SkPoint));
- if (NULL != colors) {
+ if (colors) {
fWriter.write(colors, SkPatchUtils::kNumCorners * sizeof(SkColor));
}
- if (NULL != texCoords) {
+ if (texCoords) {
fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint));
}
diff --git a/src/ports/SkFontConfigParser_android.cpp b/src/ports/SkFontConfigParser_android.cpp
index b38ec8cc4c..41f5c4aac9 100644
--- a/src/ports/SkFontConfigParser_android.cpp
+++ b/src/ports/SkFontConfigParser_android.cpp
@@ -587,7 +587,7 @@ void SkFontConfigParser::GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilie
parseConfigFile(testMainConfigFile, fontFamilies);
SkTDArray<FontFamily*> fallbackFonts;
- if (NULL != testFallbackConfigFile) {
+ if (testFallbackConfigFile) {
parseConfigFile(testFallbackConfigFile, fallbackFonts);
}
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 0307d36271..98a4454376 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -143,13 +143,13 @@ static bool InitFreetype() {
#elif defined(SK_CAN_USE_DLOPEN) && SK_CAN_USE_DLOPEN == 1
//The FreeType library is already loaded, so symbols are available in process.
void* self = dlopen(NULL, RTLD_LAZY);
- if (NULL != self) {
+ if (self) {
FT_Library_SetLcdFilterWeightsProc setLcdFilterWeights;
//The following cast is non-standard, but safe for POSIX.
*reinterpret_cast<void**>(&setLcdFilterWeights) = dlsym(self, "FT_Library_SetLcdFilterWeights");
dlclose(self);
- if (NULL != setLcdFilterWeights) {
+ if (setLcdFilterWeights) {
err = setLcdFilterWeights(gFTLibrary, gGaussianLikeHeavyWeights);
}
}
@@ -316,7 +316,7 @@ static SkFaceRec* ref_ft_face(const SkTypeface* typeface) {
memset(&args, 0, sizeof(args));
const void* memoryBase = strm->getMemoryBase();
- if (NULL != memoryBase) {
+ if (memoryBase) {
//printf("mmap(%s)\n", keyString.c_str());
args.flags = FT_OPEN_MEMORY;
args.memory_base = (const FT_Byte*)memoryBase;
@@ -1654,7 +1654,7 @@ size_t SkTypeface_FreeType::onGetTableData(SkFontTableTag tag, size_t offset,
return 0;
}
FT_ULong size = SkTMin((FT_ULong)length, tableLength - (FT_ULong)offset);
- if (NULL != data) {
+ if (data) {
error = FT_Load_Sfnt_Table(face, tag, offset, reinterpret_cast<FT_Byte*>(data), &size);
if (error) {
return 0;
@@ -1681,7 +1681,7 @@ size_t SkTypeface_FreeType::onGetTableData(SkFontTableTag tag, size_t offset,
const void* memoryBase = stream->getMemoryBase();
FT_StreamRec streamRec;
- if (NULL != memoryBase) {
+ if (memoryBase) {
args.flags = FT_OPEN_MEMORY;
args.memory_base = (const FT_Byte*)memoryBase;
args.memory_size = stream->getLength();
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index b1a512b0ce..ace7058714 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -137,7 +137,7 @@ SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
size_t length = stream->getLength();
const void* memory = stream->getMemoryBase();
- if (NULL != memory) {
+ if (memory) {
return new SkMemoryStream(memory, length, true);
}
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index 891e4617f3..72a6399612 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -293,7 +293,7 @@ protected:
: SkFontStyle::kUpright_Slant);
SkTypeface* tf = NULL;
- if (NULL != familyName) {
+ if (familyName) {
tf = this->onMatchFamilyStyle(familyName, style);
}
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 72a32742dc..3c73493b41 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -897,7 +897,7 @@ uint16_t SkScalerContext_Mac::getFBoundingBoxesGlyphOffset() {
bool SkScalerContext_Mac::generateBBoxes() {
if (fGeneratedFBoundingBoxes) {
- return NULL != fFBoundingBoxes.get();
+ return SkToBool(fFBoundingBoxes.get());
}
fGeneratedFBoundingBoxes = true;
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index e966c84f1f..bcf544cd43 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -422,7 +422,7 @@ protected:
? SkFontStyle::kItalic_Slant
: SkFontStyle::kUpright_Slant);
- if (NULL != familyName) {
+ if (familyName) {
// On Android, we must return NULL when we can't find the requested
// named typeface so that the system/app can provide their own recovery
// mechanism. On other platforms we'd provide a typeface from the
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index b54835d1be..8dec85f6d5 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -796,7 +796,7 @@ protected:
italic ? SkFontStyle::kItalic_Slant
: SkFontStyle::kUpright_Slant);
SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
- if (NULL != typeface.get()) {
+ if (typeface.get()) {
return typeface.detach();
}
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp
index 1430d7f03b..ded58586b0 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -66,7 +66,7 @@ public:
SkAutoNullKernelHandle(const HANDLE handle) : fHandle(handle) { }
~SkAutoNullKernelHandle() { CloseHandle(fHandle); }
operator HANDLE() const { return fHandle; }
- bool isValid() const { return NULL != fHandle; }
+ bool isValid() const { return SkToBool(fHandle); }
private:
HANDLE fHandle;
};
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 33ef0d55ec..e72746a520 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -524,7 +524,7 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
- if (NULL != fTypeface->fDWriteFontFace1.get()) {
+ if (fTypeface->fDWriteFontFace1.get()) {
DWRITE_FONT_METRICS1 dwfm1;
fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1);
metrics->fTop = -fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxTop) / upem;
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 7b6b522cea..9c727e715e 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -199,7 +199,7 @@ size_t DWriteFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
return 0;
}
size_t size = SkTMin(length, table.fSize - offset);
- if (NULL != data) {
+ if (data) {
memcpy(data, table.fData + offset, size);
}
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index cb69b4e282..b46e92a4a0 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -46,7 +46,7 @@ static bool should_draw_immediately(const SkBitmap* bitmap, const SkPaint* paint
if (shader && !shader->asAGradient(NULL)) {
SkBitmap bm;
if (shader->asABitmap(&bm, NULL, NULL) &&
- NULL != bm.getTexture()) {
+ bm.getTexture()) {
return true;
}
}
@@ -336,11 +336,11 @@ bool SkDeferredDevice::hasPendingCommands() {
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 @@ SkDeferredCanvas::~SkDeferredCanvas() {
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 65e8372395..694becf518 100644
--- a/src/utils/SkEventTracer.cpp
+++ b/src/utils/SkEventTracer.cpp
@@ -54,6 +54,6 @@ static void intialize_default_tracer(SkEventTracer* current_instance) {
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 5d980aaf5f..e1e5ccd92e 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -103,7 +103,7 @@ protected:
}
SkRect pathBounds = path.getBounds();
- if (NULL != prePathMatrix) {
+ if (prePathMatrix) {
prePathMatrix->mapRect(&pathBounds);
}
@@ -295,7 +295,7 @@ private:
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 773af54dfd..48493b88a8 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -317,7 +317,7 @@ void SkLua::pushClipStack(const SkClipStack& stack, const char* key) {
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 @@ int SkLua::lcanvas_getReducedClipStack(lua_State* L) {
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 a0809f3594..96e3c8f25e 100644
--- a/src/utils/SkPatchGrid.cpp
+++ b/src/utils/SkPatchGrid.cpp
@@ -59,14 +59,14 @@ bool SkPatchGrid::setPatch(int x, int y, const SkPoint cubics[12], const SkColor
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 @@ bool SkPatchGrid::getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4],
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 a0be328f6c..c9c526e456 100644
--- a/src/utils/SkPatchUtils.cpp
+++ b/src/utils/SkPatchUtils.cpp
@@ -233,7 +233,7 @@ bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint c
// 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 @@ bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint c
}
// 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 @@ bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint c
+ 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 @@ bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint c
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 8ca9981094..20b8b43b89 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -28,7 +28,7 @@ SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) {
if (commentptr == line) {
continue;
}
- if (NULL != commentptr) {
+ if (commentptr) {
*commentptr = '\0';
}
@@ -99,7 +99,7 @@ void SkRTConfRegistry::validate() const {
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 @@ bool SkRTConfRegistry::hasNonDefault() const {
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 0dfc229193..07b58c5a60 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -166,7 +166,7 @@ bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcCol
}
}
- 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 beffbfca52..3d305017e2 100644
--- a/src/utils/SkTextureCompressor_Blitter.h
+++ b/src/utils/SkTextureCompressor_Blitter.h
@@ -440,7 +440,7 @@ private:
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 4bb33b7475..c61627d71d 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -208,7 +208,7 @@ public:
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 @@ public:
return true;
}
virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
- if (NULL != bounds) {
+ if (bounds) {
bounds->setLargest();
}
return true;
@@ -308,7 +308,7 @@ private:
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 b9742c3535..0da8f98954 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -148,7 +148,7 @@ void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRec
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 @@ SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left,
fBitmap = bitmap;
fLeft = left;
fTop = top;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -291,7 +291,7 @@ SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left,
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 @@ SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap,
: INHERITED(DRAW_BITMAP_MATRIX) {
fBitmap = bitmap;
fMatrix = matrix;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -320,7 +320,7 @@ SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap,
fInfo.push(SkObjectParser::BitmapToString(bitmap));
fInfo.push(SkObjectParser::MatrixToString(matrix));
- if (NULL != paint) {
+ if (paint) {
fInfo.push(SkObjectParser::PaintToString(*paint));
}
}
@@ -340,7 +340,7 @@ SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S
fBitmap = bitmap;
fCenter = center;
fDst = dst;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -350,7 +350,7 @@ SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S
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 @@ SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
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 @@ SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
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 @@ SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture,
, 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 @@ SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture,
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 @@ SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t
fBitmap = bitmap;
fLeft = left;
fTop = top;
- if (NULL != paint) {
+ if (paint) {
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
@@ -749,7 +749,7 @@ SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t
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 @@ SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe
memcpy(fText, text, byteLength);
fByteLength = byteLength;
fPath = path;
- if (NULL != matrix) {
+ if (matrix) {
fMatrix = *matrix;
} else {
fMatrix.setIdentity();
@@ -800,7 +800,7 @@ SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe
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 @@ SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver
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 @@ SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver
}
fXfermode = xfermode;
- if (NULL != fXfermode) {
+ if (fXfermode) {
fXfermode->ref();
}
@@ -912,13 +912,13 @@ void SkSaveCommand::trackSaveState(int* state) {
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 @@ SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain
}
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 a9bad40f71..798db95223 100644
--- a/src/utils/debugger/SkObjectParser.cpp
+++ b/src/utils/debugger/SkObjectParser.cpp
@@ -174,7 +174,7 @@ SkString* SkObjectParser::PathToString(const SkPath& path) {
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 c7dc3b2128..0f0c628f9a 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -188,7 +188,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment(
}
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 495f074eb2..0aea4a622e 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 74d814ccb1..6274e717a2 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -113,7 +113,7 @@ SkIStream::SkIStream(SkStream* stream, bool unrefOnRelease)
}
SkIStream::~SkIStream() {
- if (NULL != this->fSkStream && fUnrefOnRelease) {
+ if (this->fSkStream && fUnrefOnRelease) {
this->fSkStream->unref();
}
}
@@ -196,7 +196,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
break;
}
- if (NULL != lpNewFilePointer) {
+ if (lpNewFilePointer) {
lpNewFilePointer->QuadPart = this->fLocation.QuadPart;
}
return hr;
@@ -228,7 +228,7 @@ SkWIStream::SkWIStream(SkWStream* stream)
{ }
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 9c0c2d4bbb..5c461385a4 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -367,7 +367,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
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 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou
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);
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index 3de0a9eb77..ad0c73f80d 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -32,7 +32,7 @@ const SkOSMenu::Item* SkOSMenu::getItemByID(int itemID) const {
}
void SkOSMenu::getItems(const SkOSMenu::Item* items[]) const {
- if (NULL != items) {
+ if (items) {
for (int i = 0; i < fItems.count(); ++i) {
items[i] = fItems[i];
}
@@ -204,7 +204,7 @@ bool SkOSMenu::FindListItemCount(const SkEvent& evt, int* count) {
}
bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) {
- if (evt.isType(gMenuEventType) && NULL != items) {
+ if (evt.isType(gMenuEventType) && items) {
const char* text = evt.findString(gList_Items_Str);
if (text != NULL) {
SkString temp(text);
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index f211ad9693..00702012d9 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -637,7 +637,7 @@ bool SkView::globalToLocal(SkScalar x, SkScalar y, SkPoint* local) const
{
SkASSERT(this);
- if (NULL != local) {
+ if (local) {
SkMatrix m;
this->localToGlobal(&m);
if (!m.invert(&m)) {
diff --git a/src/views/mac/SkNSView.mm b/src/views/mac/SkNSView.mm
index 80bfd670ef..6347d46408 100644
--- a/src/views/mac/SkNSView.mm
+++ b/src/views/mac/SkNSView.mm
@@ -50,7 +50,7 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
selector:@selector(backingPropertiesChanged:)
name:@"NSWindowDidChangeBackingPropertiesNotification"
object:[self window]];
- if (NULL != fWind) {
+ if (fWind) {
fWind->setVisibleP(true);
NSSize size = self.frame.size;
#if RETINA_API_AVAILABLE
@@ -103,12 +103,9 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
#if RETINA_API_AVAILABLE
newSize = [self convertSizeToBacking:newSize];
#endif
- if (NULL != fWind &&
- (fWind->width() != newSize.width ||
- fWind->height() != newSize.height))
- {
+ if (fWind && (fWind->width() != newSize.width || fWind->height() != newSize.height)) {
fWind->resize((int) newSize.width, (int) newSize.height);
- if (NULL != fGLContext) {
+ if (fGLContext) {
glClear(GL_STENCIL_BUFFER_BIT);
[fGLContext update];
}
@@ -131,7 +128,7 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
- (void)drawSkia {
fRedrawRequestPending = false;
- if (NULL != fWind) {
+ if (fWind) {
SkAutoTUnref<SkCanvas> canvas(fWind->createCanvas());
fWind->draw(canvas);
#ifdef FORCE_REDRAW
@@ -268,7 +265,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
@@ -283,7 +280,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
@@ -298,7 +295,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
@@ -313,7 +310,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index fad5922517..e22377a264 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -46,9 +46,9 @@ SkOSWindow::~SkOSWindow() {
}
void SkOSWindow::closeWindow() {
- if (NULL != fUnixWindow.fDisplay) {
+ if (fUnixWindow.fDisplay) {
this->detach();
- SkASSERT(NULL != fUnixWindow.fGc);
+ SkASSERT(fUnixWindow.fGc);
XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc);
fUnixWindow.fGc = NULL;
XDestroyWindow(fUnixWindow.fDisplay, fUnixWindow.fWin);
@@ -64,9 +64,9 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
this->closeWindow();
}
// presence of fDisplay means we already have a window
- if (NULL != fUnixWindow.fDisplay) {
- if (NULL != info) {
- if (NULL != fVi) {
+ if (fUnixWindow.fDisplay) {
+ if (info) {
+ if (fVi) {
glXGetConfig(fUnixWindow.fDisplay, fVi, GLX_SAMPLES_ARB, &info->fSampleCount);
glXGetConfig(fUnixWindow.fDisplay, fVi, GLX_STENCIL_SIZE, &info->fStencilBits);
} else {
@@ -110,7 +110,7 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
}
if (fVi) {
- if (NULL != info) {
+ if (info) {
glXGetConfig(dsp, fVi, GLX_SAMPLES_ARB, &info->fSampleCount);
glXGetConfig(dsp, fVi, GLX_STENCIL_SIZE, &info->fStencilBits);
}
@@ -132,7 +132,7 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
CWEventMask | CWColormap,
&swa);
} else {
- if (NULL != info) {
+ if (info) {
info->fSampleCount = 0;
info->fStencilBits = 0;
}
@@ -310,7 +310,7 @@ void SkOSWindow::loop() {
}
void SkOSWindow::mapWindowAndWait() {
- SkASSERT(NULL != fUnixWindow.fDisplay);
+ SkASSERT(fUnixWindow.fDisplay);
Display* dsp = fUnixWindow.fDisplay;
Window win = fUnixWindow.fWin;
XMapWindow(dsp, win);
@@ -333,7 +333,7 @@ bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* inf
return false;
}
if (NULL == fUnixWindow.fGLContext) {
- SkASSERT(NULL != fVi);
+ SkASSERT(fVi);
fUnixWindow.fGLContext = glXCreateContext(fUnixWindow.fDisplay,
fVi,
@@ -365,7 +365,7 @@ void SkOSWindow::detach() {
}
void SkOSWindow::present() {
- if (NULL != fUnixWindow.fDisplay && NULL != fUnixWindow.fGLContext) {
+ if (fUnixWindow.fDisplay && fUnixWindow.fGLContext) {
glXSwapBuffers(fUnixWindow.fDisplay, fUnixWindow.fWin);
}
}
@@ -405,7 +405,7 @@ void SkOSWindow::doPaint() {
return;
}
// If we are drawing with GL, we don't need XPutImage.
- if (NULL != fUnixWindow.fGLContext) {
+ if (fUnixWindow.fGLContext) {
return;
}
// Draw the bitmap to the screen.
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index 1b47dea329..447a5af6cc 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -60,7 +60,7 @@ SkOSWindow::SkOSWindow(void* hWnd) {
SkOSWindow::~SkOSWindow() {
#if SK_SUPPORT_GPU
- if (NULL != fHGLRC) {
+ if (fHGLRC) {
wglDeleteContext((HGLRC)fHGLRC);
}
#if SK_ANGLE
diff --git a/tests/BBoxHierarchyTest.cpp b/tests/BBoxHierarchyTest.cpp
index b9cbbc4f9a..71b96994f2 100644
--- a/tests/BBoxHierarchyTest.cpp
+++ b/tests/BBoxHierarchyTest.cpp
@@ -86,7 +86,7 @@ static void tree_test_main(SkBBoxHierarchy* tree, int minChildren, int maxChildr
skiatest::Reporter* reporter) {
DataRect rects[NUM_RECTS];
SkRandom rand;
- REPORTER_ASSERT(reporter, NULL != tree);
+ REPORTER_ASSERT(reporter, tree);
int expectedDepthMin = -1;
int expectedDepthMax = -1;
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 82789a1bfb..92e9d78549 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -63,8 +63,8 @@ static void compare_bitmaps(skiatest::Reporter* reporter,
if (b1.isNull() || b1.empty()) {
return;
}
- REPORTER_ASSERT(reporter, NULL != b1.getPixels());
- REPORTER_ASSERT(reporter, NULL != b2.getPixels());
+ REPORTER_ASSERT(reporter, b1.getPixels());
+ REPORTER_ASSERT(reporter, b2.getPixels());
if ((!(b1.getPixels())) || (!(b2.getPixels()))) {
return;
}
@@ -122,7 +122,7 @@ static void test_three_encodings(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
{
SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
- REPORTER_ASSERT(reporter, NULL != lazy.getPixels());
+ REPORTER_ASSERT(reporter, lazy.getPixels());
if (NULL == lazy.getPixels()) {
continue;
}
@@ -131,7 +131,7 @@ static void test_three_encodings(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
{
SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
- REPORTER_ASSERT(reporter, NULL != lazy.getPixels());
+ REPORTER_ASSERT(reporter, lazy.getPixels());
if (NULL == lazy.getPixels()) {
continue;
}
@@ -184,7 +184,7 @@ public:
protected:
virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE {
- REPORTER_ASSERT(fReporter, NULL != info);
+ REPORTER_ASSERT(fReporter, info);
if ((NULL == info) || (kFailGetInfo_TestType == fType)) {
return false;
}
@@ -223,7 +223,7 @@ static void check_test_image_generator_bitmap(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, TestImageGenerator::Width() == bm.width());
REPORTER_ASSERT(reporter, TestImageGenerator::Height() == bm.height());
SkAutoLockPixels autoLockPixels(bm);
- REPORTER_ASSERT(reporter, NULL != bm.getPixels());
+ REPORTER_ASSERT(reporter, bm.getPixels());
if (NULL == bm.getPixels()) {
return;
}
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index 787f9afaec..8364a4b414 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -270,7 +270,7 @@ DEF_TEST(CanvasState_test_draw_filters, reporter) {
SkCanvas* tmpCanvas = SkCanvasStateUtils::CreateFromCanvasState(state);
REPORTER_ASSERT(reporter, tmpCanvas);
- REPORTER_ASSERT(reporter, NULL != canvas.getDrawFilter());
+ REPORTER_ASSERT(reporter, canvas.getDrawFilter());
REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter());
tmpCanvas->unref();
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 0620df947b..662e68040e 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -980,12 +980,12 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) {
// whether the result is bounded or not, the whole plane should start outside the clip.
reducedStack.clipEmpty();
}
- for (ElementList::Iter iter = reducedClips.headIter(); NULL != iter.get(); iter.next()) {
+ for (ElementList::Iter iter = reducedClips.headIter(); iter.get(); iter.next()) {
add_elem_to_stack(*iter.get(), &reducedStack);
}
// GrReducedClipStack assumes that the final result is clipped to the returned bounds
- if (NULL != tightBounds) {
+ if (tightBounds) {
reducedStack.clipDevRect(*tightBounds, SkRegion::kIntersect_Op);
}
@@ -1191,7 +1191,7 @@ DEF_TEST(ClipStack, reporter) {
SkRect answer;
answer.iset(25, 25, 75, 75);
- REPORTER_ASSERT(reporter, NULL != element);
+ REPORTER_ASSERT(reporter, element);
REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType());
REPORTER_ASSERT(reporter, SkRegion::kIntersect_Op == element->getOp());
REPORTER_ASSERT(reporter, element->getRect() == answer);
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index b8b82b2e83..61af550e20 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -681,7 +681,7 @@ static PixelPtr get_surface_ptr(SkSurface* surface, bool useGpu) {
static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
- bool useGpu = NULL != factory;
+ bool useGpu = SkToBool(factory);
int cnt;
#if SK_SUPPORT_GPU
if (useGpu) {
@@ -712,7 +712,7 @@ static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac
{
surface = SkSurface::NewRaster(imageSpec);
}
- SkASSERT(NULL != surface);
+ SkASSERT(surface);
SkAutoTUnref<SkSurface> aur(surface);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface));
@@ -764,7 +764,7 @@ static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
SkSurface* surface;
SkSurface* alternateSurface;
- bool useGpu = NULL != factory;
+ bool useGpu = SkToBool(factory);
int cnt;
#if SK_SUPPORT_GPU
if (useGpu) {
@@ -796,8 +796,8 @@ static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext
surface = SkSurface::NewRaster(imageSpec);
alternateSurface = SkSurface::NewRaster(imageSpec);
}
- SkASSERT(NULL != surface);
- SkASSERT(NULL != alternateSurface);
+ SkASSERT(surface);
+ SkASSERT(alternateSurface);
SkAutoTUnref<SkSurface> aur1(surface);
SkAutoTUnref<SkSurface> aur2(alternateSurface);
PixelPtr pixels1 = get_surface_ptr(surface, useGpu);
diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp
index 5d5dc09176..04b1f4010e 100644
--- a/tests/DequeTest.cpp
+++ b/tests/DequeTest.cpp
@@ -19,8 +19,8 @@ static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int c
REPORTER_ASSERT(reporter, !deq.empty());
REPORTER_ASSERT(reporter, count == deq.count());
REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
- REPORTER_ASSERT(reporter, NULL != deq.front());
- REPORTER_ASSERT(reporter, NULL != deq.back());
+ REPORTER_ASSERT(reporter, deq.front());
+ REPORTER_ASSERT(reporter, deq.back());
if (1 == count) {
REPORTER_ASSERT(reporter, deq.back() == deq.front());
} else {
@@ -36,7 +36,7 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq,
void* ptr;
int value = max;
- while (NULL != (ptr = iter.next())) {
+ while ((ptr = iter.next())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value -= 1;
}
@@ -46,7 +46,7 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq,
iter.reset(deq, SkDeque::Iter::kBack_IterStart);
value = min;
- while (NULL != (ptr = iter.prev())) {
+ while ((ptr = iter.prev())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value += 1;
}
@@ -57,12 +57,12 @@ static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq,
value = max;
// forward iteration half-way
- for (int i = 0; i < deq.count()/2 && NULL != (ptr = iter.next()); i++) {
+ for (int i = 0; i < deq.count()/2 && (ptr = iter.next()); i++) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value -= 1;
}
// then back down w/ reverse iteration
- while (NULL != (ptr = iter.prev())) {
+ while ((ptr = iter.prev())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value += 1;
}
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index c9aa778244..a1dc9dc0b3 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -16,7 +16,7 @@ static void test_font(skiatest::Reporter* reporter) {
uint32_t flags = 0;
SkAutoTUnref<SkFont> font(SkFont::Create(NULL, 24, SkFont::kA8_MaskType, flags));
- REPORTER_ASSERT(reporter, NULL != font->getTypeface());
+ REPORTER_ASSERT(reporter, font->getTypeface());
REPORTER_ASSERT(reporter, 24 == font->getSize());
REPORTER_ASSERT(reporter, 1 == font->getScaleX());
REPORTER_ASSERT(reporter, 0 == font->getSkewX());
diff --git a/tests/GLInterfaceValidationTest.cpp b/tests/GLInterfaceValidationTest.cpp
index 541af8fe92..797ba72cc0 100755
--- a/tests/GLInterfaceValidationTest.cpp
+++ b/tests/GLInterfaceValidationTest.cpp
@@ -22,14 +22,14 @@ DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
// We're supposed to fail the NVPR context type when we the native context that does not
// support the NVPR extension.
if (GrContextFactory::kNVPR_GLContextType == glCtxType &&
- NULL != factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
+ factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
!factory->getGLContext(GrContextFactory::kNative_GLContextType)->hasExtension("GL_NV_path_rendering")) {
REPORTER_ASSERT(reporter, NULL == glCtxHelper);
continue;
}
- REPORTER_ASSERT(reporter, NULL != glCtxHelper);
- if (NULL != glCtxHelper) {
+ REPORTER_ASSERT(reporter, glCtxHelper);
+ if (glCtxHelper) {
const GrGLInterface* interface = glCtxHelper->gl();
REPORTER_ASSERT(reporter, interface->validate());
}
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 6efd7d5b5b..a641fe2314 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -44,9 +44,9 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
bool dstRead = false;
bool fragPos = false;
- bool vertexShader = (NULL != geometryProcessor);
+ bool vertexShader = SkToBool(geometryProcessor);
int offset = 0;
- if (NULL != geometryProcessor) {
+ if (geometryProcessor) {
const GrEffectStage* stage = geometryProcessor;
uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() +
kEffectKeyOffsetsAndLengthOffset +
@@ -295,7 +295,7 @@ bool GrGpuGL::programUnitTest(int maxStages) {
DEF_GPUTEST(GLPrograms, reporter, factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(type));
- if (NULL != context) {
+ if (context) {
GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu());
int maxStages = 6;
#if SK_ANGLE
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index 5e18197ed7..83f31f5f06 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -34,7 +34,7 @@ static void create_layers(skiatest::Reporter* reporter,
GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(),
idOffset+i+1, idOffset+i+2,
SkMatrix::I());
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1, idOffset+i+2, SkMatrix::I());
REPORTER_ASSERT(reporter, temp == layer);
@@ -66,7 +66,7 @@ static void lock_layer(skiatest::Reporter* reporter,
needsRerendering = cache->lock(layer, desc, false);
REPORTER_ASSERT(reporter, !needsRerendering);
- REPORTER_ASSERT(reporter, NULL != layer->texture());
+ REPORTER_ASSERT(reporter, layer->texture());
REPORTER_ASSERT(reporter, layer->locked());
}
@@ -100,7 +100,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
for (int i = 0; i < kInitialNumLayers; ++i) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
lock_layer(reporter, &cache, layer);
@@ -117,19 +117,19 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// Unlock the textures
for (int i = 0; i < kInitialNumLayers; ++i) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
cache.unlock(layer);
}
for (int i = 0; i < kInitialNumLayers; ++i) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
REPORTER_ASSERT(reporter, !layer->locked());
// The first 4 layers should still be in the atlas.
if (i < 4) {
- REPORTER_ASSERT(reporter, NULL != layer->texture());
+ REPORTER_ASSERT(reporter, layer->texture());
REPORTER_ASSERT(reporter, layer->isAtlased());
} else {
// The final layer should be unlocked.
@@ -145,7 +145,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(),
kInitialNumLayers+1, kInitialNumLayers+2,
SkMatrix::I());
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
lock_layer(reporter, &cache, layer);
cache.unlock(layer);
@@ -155,13 +155,13 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, i+2, SkMatrix::I());
// 3 old layers plus the new one should be in the atlas.
if (1 == i || 2 == i || 3 == i || 5 == i) {
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
REPORTER_ASSERT(reporter, !layer->locked());
- REPORTER_ASSERT(reporter, NULL != layer->texture());
+ REPORTER_ASSERT(reporter, layer->texture());
REPORTER_ASSERT(reporter, layer->isAtlased());
} else if (4 == i) {
// The one that was never atlased should still be around
- REPORTER_ASSERT(reporter, NULL != layer);
+ REPORTER_ASSERT(reporter, layer);
REPORTER_ASSERT(reporter, NULL == layer->texture());
REPORTER_ASSERT(reporter, !layer->isAtlased());
diff --git a/tests/GrAllocatorTest.cpp b/tests/GrAllocatorTest.cpp
index a05da8fc6c..c02a7ca9af 100644
--- a/tests/GrAllocatorTest.cpp
+++ b/tests/GrAllocatorTest.cpp
@@ -30,7 +30,7 @@ static void check_allocator_helper(GrTAllocator<C>* allocator, int cnt, int popC
// again. Finally it resets the allocator and checks again.
static void check_allocator(GrTAllocator<C>* allocator, int cnt, int popCnt,
skiatest::Reporter* reporter) {
- SkASSERT(NULL != allocator);
+ SkASSERT(allocator);
SkASSERT(allocator->empty());
for (int i = 0; i < cnt; ++i) {
// Try both variations of push_back().
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index ff67b1b672..a2ed62928e 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -16,7 +16,7 @@
DEF_GPUTEST(GrSurface, reporter, factory) {
GrContext* context = factory->get(GrContextFactory::kNull_GLContextType);
- if (NULL != context) {
+ if (context) {
GrTextureDesc desc;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrTextureFlagBit;
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index bda10a040a..317ed6da15 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -45,7 +45,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache,
TestingRec* newRec = SkNEW_ARGS(TestingRec, (key, i));
const TestingRec* addedRec = (const TestingRec*)cache.addAndLock(newRec);
- REPORTER_ASSERT(reporter, NULL != addedRec);
+ REPORTER_ASSERT(reporter, addedRec);
const TestingRec* foundRec = (const TestingRec*)cache.findAndLock(key);
REPORTER_ASSERT(reporter, foundRec == addedRec);
@@ -59,7 +59,7 @@ static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache,
for (size_t i = 0; i < COUNT * 100; ++i) {
TestingKey key(i);
SkResourceCache::ID id = cache.addAndLock(SkNEW_ARGS(TestingRec, (key, i)));
- REPORTER_ASSERT(reporter, NULL != id);
+ REPORTER_ASSERT(reporter, id);
cache.unlock(id);
}
}
@@ -117,7 +117,7 @@ DEF_TEST(ImageCache_doubleAdd, r) {
// Lookup can return either value.
const TestingRec* rec = (const TestingRec*)cache.findAndLock(key);
- REPORTER_ASSERT(r, NULL != rec);
+ REPORTER_ASSERT(r, rec);
REPORTER_ASSERT(r, 2 == rec->fValue || 3 == rec->fValue);
cache.unlock(rec);
}
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 4d26167370..30665a6f8e 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -278,7 +278,7 @@ DEF_TEST(ImageDecoding_unpremul, reporter) {
// This should never fail since we know the images we're decoding.
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
- REPORTER_ASSERT(reporter, NULL != decoder.get());
+ REPORTER_ASSERT(reporter, decoder.get());
if (NULL == decoder.get()) {
continue;
}
@@ -510,9 +510,9 @@ DEF_TEST(ImprovedBitmapFactory, reporter) {
SkBitmap bm;
SkAssertResult(bm.setInfo(SkImageInfo::MakeN32Premul(1, 1)));
REPORTER_ASSERT(reporter,
- NULL != install_pixel_ref(&bm, stream.detach(), 1, true));
+ install_pixel_ref(&bm, stream.detach(), 1, true));
SkAutoLockPixels alp(bm);
- REPORTER_ASSERT(reporter, NULL != bm.getPixels());
+ REPORTER_ASSERT(reporter, bm.getPixels());
}
}
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index a8cd5d0cf9..ebe9c4dfef 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -152,7 +152,7 @@ DEF_TEST(ImageFilter, reporter) {
// Check that a clipping color matrix followed by a grayscale does not concatenate into a single filter.
SkAutoTUnref<SkImageFilter> doubleBrightness(make_scale(2.0f));
SkAutoTUnref<SkImageFilter> halfBrightness(make_scale(0.5f, doubleBrightness));
- REPORTER_ASSERT(reporter, NULL != halfBrightness->getInput(0));
+ REPORTER_ASSERT(reporter, halfBrightness->getInput(0));
}
{
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index 32dacd5a0f..1a61f3aa0b 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -31,7 +31,7 @@ DEF_TEST(KtxReadWrite, reporter) {
bm8888.allocN32Pixels(128, 128);
uint8_t *pixels = reinterpret_cast<uint8_t*>(bm8888.getPixels());
- REPORTER_ASSERT(reporter, NULL != pixels);
+ REPORTER_ASSERT(reporter, pixels);
if (NULL == pixels) {
return;
@@ -53,10 +53,10 @@ DEF_TEST(KtxReadWrite, reporter) {
REPORTER_ASSERT(reporter, !(bm8888.empty()));
SkAutoDataUnref encodedData(SkImageEncoder::EncodeData(bm8888, SkImageEncoder::kKTX_Type, 0));
- REPORTER_ASSERT(reporter, NULL != encodedData);
+ REPORTER_ASSERT(reporter, encodedData);
SkAutoTUnref<SkMemoryStream> stream(SkNEW_ARGS(SkMemoryStream, (encodedData)));
- REPORTER_ASSERT(reporter, NULL != stream);
+ REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitmap);
@@ -69,7 +69,7 @@ DEF_TEST(KtxReadWrite, reporter) {
REPORTER_ASSERT(reporter, !(decodedBitmap.empty()));
uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels());
- REPORTER_ASSERT(reporter, NULL != decodedPixels);
+ REPORTER_ASSERT(reporter, decodedPixels);
REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize());
if (NULL == decodedPixels) {
@@ -109,7 +109,7 @@ DEF_TEST(KtxReadUnpremul, reporter) {
SkAutoTUnref<SkMemoryStream> stream(
SkNEW_ARGS(SkMemoryStream, (kHalfWhiteKTX, sizeof(kHalfWhiteKTX))));
- REPORTER_ASSERT(reporter, NULL != stream);
+ REPORTER_ASSERT(reporter, stream);
SkBitmap decodedBitmap;
bool imageDecodeSuccess = SkImageDecoder::DecodeStream(stream, &decodedBitmap);
@@ -122,7 +122,7 @@ DEF_TEST(KtxReadUnpremul, reporter) {
REPORTER_ASSERT(reporter, !(decodedBitmap.empty()));
uint8_t *decodedPixels = reinterpret_cast<uint8_t*>(decodedBitmap.getPixels());
- REPORTER_ASSERT(reporter, NULL != decodedPixels);
+ REPORTER_ASSERT(reporter, decodedPixels);
uint8_t *row = decodedPixels;
for (int j = 0; j < decodedBitmap.height(); ++j) {
@@ -145,7 +145,7 @@ DEF_TEST(KtxReexportPKM, reporter) {
// Load PKM file into a bitmap
SkBitmap etcBitmap;
SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str()));
- REPORTER_ASSERT(reporter, NULL != fileData);
+ REPORTER_ASSERT(reporter, fileData);
if (NULL == fileData) {
return;
}
@@ -159,7 +159,7 @@ DEF_TEST(KtxReexportPKM, reporter) {
// Write the bitmap out to a KTX file.
SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::kKTX_Type, 0);
SkAutoDataUnref newKtxData(ktxDataPtr);
- REPORTER_ASSERT(reporter, NULL != ktxDataPtr);
+ REPORTER_ASSERT(reporter, ktxDataPtr);
// See is this data is identical to data in existing ktx file.
SkString ktxFilename = GetResourcePath("mandrill_128.ktx");
diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp
index 20151c33ec..8fb0117af8 100644
--- a/tests/LListTest.cpp
+++ b/tests/LListTest.cpp
@@ -73,12 +73,12 @@ static void TestTInternalLList(skiatest::Reporter* reporter) {
Iter iter;
ListElement* cur = iter.init(list, Iter::kHead_IterStart);
- for (int i = 0; NULL != cur; ++i, cur = iter.next()) {
+ for (int i = 0; cur; ++i, cur = iter.next()) {
REPORTER_ASSERT(reporter, cur->fID == 3-i);
}
cur = iter.init(list, Iter::kTail_IterStart);
- for (int i = 0; NULL != cur; ++i, cur = iter.prev()) {
+ for (int i = 0; cur; ++i, cur = iter.prev()) {
REPORTER_ASSERT(reporter, cur->fID == i);
}
@@ -114,7 +114,7 @@ static void TestTInternalLList(skiatest::Reporter* reporter) {
check_list(list, reporter, false, 4, true, true, true, true, elements);
cur = iter.init(list, Iter::kHead_IterStart);
- for (int i = 0; NULL != cur; ++i, cur = iter.next()) {
+ for (int i = 0; cur; ++i, cur = iter.next()) {
REPORTER_ASSERT(reporter, cur->fID == i);
}
}
@@ -228,7 +228,7 @@ static void TestTLList(skiatest::Reporter* reporter) {
next.next();
prev.prev();
- SkASSERT(NULL != iter.get());
+ SkASSERT(iter.get());
// insert either before or after the iterator, then check that the
// surrounding sequence is correct.
if (2 == insertionMethod) {
@@ -237,10 +237,10 @@ static void TestTLList(skiatest::Reporter* reporter) {
newItem.prev();
REPORTER_ASSERT(reporter, newItem.get()->fID == id);
- if (NULL != next.get()) {
+ if (next.get()) {
REPORTER_ASSERT(reporter, next.prev()->fID == iter.get()->fID);
}
- if (NULL != prev.get()) {
+ if (prev.get()) {
REPORTER_ASSERT(reporter, prev.next()->fID == id);
}
} else {
@@ -249,10 +249,10 @@ static void TestTLList(skiatest::Reporter* reporter) {
newItem.next();
REPORTER_ASSERT(reporter, newItem.get()->fID == id);
- if (NULL != next.get()) {
+ if (next.get()) {
REPORTER_ASSERT(reporter, next.prev()->fID == id);
}
- if (NULL != prev.get()) {
+ if (prev.get()) {
REPORTER_ASSERT(reporter, prev.next()->fID == iter.get()->fID);
}
}
@@ -276,10 +276,10 @@ static void TestTLList(skiatest::Reporter* reporter) {
// find the element
Iter iter(list1, start);
while (n--) {
- REPORTER_ASSERT(reporter, NULL != iter.get());
+ REPORTER_ASSERT(reporter, iter.get());
(iter.*incrFunc)();
}
- REPORTER_ASSERT(reporter, NULL != iter.get());
+ REPORTER_ASSERT(reporter, iter.get());
// remember the prev and next elements from the element to be removed
Iter prev = iter;
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index cf5e054220..c20c8836b2 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -64,7 +64,7 @@ DEF_TEST(MallocPixelRef, reporter) {
SkAutoTUnref<SkMallocPixelRef> pr(
SkMallocPixelRef::NewAllocate(info, rowBytes, NULL));
REPORTER_ASSERT(reporter, pr.get() != NULL);
- REPORTER_ASSERT(reporter, NULL != pr->pixels());
+ REPORTER_ASSERT(reporter, pr->pixels());
}
{
void* addr = static_cast<void*>(new uint8_t[size]);
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 57587c4a35..35fbf2fdc3 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -3377,7 +3377,7 @@ public:
REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countWeights());
REPORTER_ASSERT(reporter, SkPath::kConic_SegmentMask == pathRef->getSegmentMasks());
- REPORTER_ASSERT(reporter, NULL != weights);
+ REPORTER_ASSERT(reporter, weights);
for (int i = 0; i < kRepeatCnt; ++i) {
REPORTER_ASSERT(reporter, SkPath::kConic_Verb == pathRef->atVerb(i));
}
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index eb85c94a69..b1cdf7e5d1 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -770,7 +770,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter,
const char *reason = NULL;
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason));
- REPORTER_ASSERT(reporter, NULL != reason);
+ REPORTER_ASSERT(reporter, reason);
canvas = GENERATE_CANVAS(recorder, useNewPath);
{
@@ -968,7 +968,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(key);
- REPORTER_ASSERT(reporter, NULL != data);
+ REPORTER_ASSERT(reporter, data);
const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
REPORTER_ASSERT(reporter, 8 == gpuData->numSaveLayers());
@@ -1023,7 +1023,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
kHeight == info3.fSize.fHeight);
REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity());
REPORTER_ASSERT(reporter, 0 == info3.fOffset.fX && 0 == info3.fOffset.fY);
- REPORTER_ASSERT(reporter, NULL != info3.fPaint);
+ REPORTER_ASSERT(reporter, info3.fPaint);
REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayers);
REPORTER_ASSERT(reporter, info4.fValid);
diff --git a/tests/RTreeTest.cpp b/tests/RTreeTest.cpp
index 087f19a7ef..40af5fe55b 100644
--- a/tests/RTreeTest.cpp
+++ b/tests/RTreeTest.cpp
@@ -84,7 +84,7 @@ static void run_queries(skiatest::Reporter* reporter, SkRandom& rand, DataRect r
static void rtree_test_main(SkRTree* rtree, skiatest::Reporter* reporter) {
DataRect rects[NUM_RECTS];
SkRandom rand;
- REPORTER_ASSERT(reporter, NULL != rtree);
+ REPORTER_ASSERT(reporter, rtree);
int expectedDepthMin = -1;
int expectedDepthMax = -1;
diff --git a/tests/RecordTestUtils.h b/tests/RecordTestUtils.h
index db3f02d3a2..0575b83cdd 100644
--- a/tests/RecordTestUtils.h
+++ b/tests/RecordTestUtils.h
@@ -24,7 +24,7 @@ static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsig
ReadAs<T> reader;
record.visit<void>(index, reader);
REPORTER_ASSERT(r, T::kType == reader.type);
- REPORTER_ASSERT(r, NULL != reader.ptr);
+ REPORTER_ASSERT(r, SkToBool(reader.ptr));
return reader.ptr;
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index c08e75f62c..a66b0360eb 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -74,7 +74,7 @@ public:
~TestResource() {
--fAlive;
- if (NULL != fToDelete) {
+ if (fToDelete) {
// Breaks our little 2-element cycle below.
fToDelete->setDeleteWhenDestroyed(NULL, NULL);
fCache->deleteResource(fToDelete->getCacheEntry());
@@ -274,7 +274,7 @@ static void test_resource_size_changed(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, 300 == cache.getCachedResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache.getCachedResourceCount());
- REPORTER_ASSERT(reporter, NULL != cache.find(key1));
+ REPORTER_ASSERT(reporter, cache.find(key1));
// Internal resource cache validation will test the detached size (debug mode only).
}
}
diff --git a/tests/SListTest.cpp b/tests/SListTest.cpp
index 72a82814f9..78fcc65a27 100644
--- a/tests/SListTest.cpp
+++ b/tests/SListTest.cpp
@@ -27,7 +27,7 @@ static bool verifyEmptyList(skiatest::Reporter* reporter,
ERRORF(reporter, "%s - List count is not zero, %d instead", stage, list.getCount());
return false;
}
- if (NULL != list.head()) {
+ if (list.head()) {
ERRORF(reporter, "%s - List has elements when empty", stage);
return false;
}
@@ -55,7 +55,7 @@ static bool verifyList(skiatest::Reporter* reporter,
}
next = next->next();
}
- if (NULL != next) {
+ if (next) {
ERRORF(reporter, "%s - List too long, should be %d", stage, count);
return false;
}
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index b5582dccfc..23cc33dd4a 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -198,7 +198,7 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed,
// This should have succeeded, since there are enough bytes to read this
REPORTER_ASSERT(reporter, buffer2.isValid());
REPORTER_ASSERT(reporter, static_cast<size_t>(peekAfter - peekBefore) == bytesWritten);
- REPORTER_ASSERT(reporter, NULL != obj2);
+ REPORTER_ASSERT(reporter, obj2);
} else {
// If the deserialization was supposed to fail, make sure it did
REPORTER_ASSERT(reporter, !buffer.isValid());
@@ -490,7 +490,7 @@ DEF_TEST(Serialization, reporter) {
SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size);
SkAutoTUnref<SkPicture> readPict(
SkPicture::CreateFromBuffer(reader));
- REPORTER_ASSERT(reporter, NULL != readPict.get());
+ REPORTER_ASSERT(reporter, readPict.get());
}
TestPictureTypefaceSerialization(reporter);
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index dbd327cd12..b660890e87 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -79,7 +79,7 @@ static SkBitmap createAllocatedBitmap(const SkImageInfo& info) {
SkBitmap cachedBitmap;
cachedBitmap.setInfo(info);
SkBitmap::Allocator* allocator = SkBitmapCache::GetAllocator();
- if (NULL != allocator) {
+ if (allocator) {
allocator->allocPixelRef(&cachedBitmap, 0);
} else {
cachedBitmap.allocPixels();
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index eca929e0cc..a175f64951 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -139,7 +139,7 @@ static void test_imagepeek(skiatest::Reporter* reporter) {
continue; // gpu may not be enabled
}
const void* addr = image->peekPixels(&info, &rowBytes);
- bool success = (NULL != addr);
+ bool success = SkToBool(addr);
REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success);
if (success) {
REPORTER_ASSERT(reporter, 10 == info.width());
@@ -199,7 +199,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
surface->getCanvas()->clear(color);
const void* addr = surface->getCanvas()->peekPixels(&info, &rowBytes);
- bool success = (NULL != addr);
+ bool success = SkToBool(addr);
REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success);
SkImageInfo info2;
@@ -389,7 +389,7 @@ static void TestGetTexture(skiatest::Reporter* reporter,
SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
GrTexture* texture = image->getTexture();
if (surfaceType == kGpu_SurfaceType || surfaceType == kGpuScratch_SurfaceType) {
- REPORTER_ASSERT(reporter, NULL != texture);
+ REPORTER_ASSERT(reporter, texture);
REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle());
} else {
REPORTER_ASSERT(reporter, NULL == texture);
@@ -444,14 +444,14 @@ DEF_GPUTEST(Surface, reporter, factory) {
#if SK_SUPPORT_GPU
TestGetTexture(reporter, kRaster_SurfaceType, NULL);
- if (NULL != factory) {
+ if (factory) {
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
continue;
}
GrContext* context = factory->get(glCtxType);
- if (NULL != context) {
+ if (context) {
TestSurfaceInCache(reporter, kGpu_SurfaceType, context);
TestSurfaceInCache(reporter, kGpuScratch_SurfaceType, context);
Test_crbug263329(reporter, kGpu_SurfaceType, context);
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index 7495ef3166..70c9ddc861 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -175,9 +175,9 @@ private:
}
SkAutoTUnref<const SkTextBlob> blob(builder.build());
- REPORTER_ASSERT(reporter, (NULL != blob->fGlyphBuffer) == (glyphCount > 0));
- REPORTER_ASSERT(reporter, (NULL != blob->fPosBuffer) == (posCount > 0));
- REPORTER_ASSERT(reporter, (NULL != blob->fRuns.get()) == (inCount > 0));
+ REPORTER_ASSERT(reporter, SkToBool(blob->fGlyphBuffer) == (glyphCount > 0));
+ REPORTER_ASSERT(reporter, SkToBool(blob->fPosBuffer) == (posCount > 0));
+ REPORTER_ASSERT(reporter, SkToBool(blob->fRuns.get()) == (inCount > 0));
SkTextBlob::RunIterator it(blob);
for (unsigned i = 0; i < outCount; ++i) {
diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp
index b93cabb4e0..7dd285d4f3 100644
--- a/tests/TextureCompressionTest.cpp
+++ b/tests/TextureCompressionTest.cpp
@@ -134,7 +134,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
SkAutoLockPixels alp(bitmap);
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels());
- REPORTER_ASSERT(reporter, NULL != pixels);
+ REPORTER_ASSERT(reporter, pixels);
if (NULL == pixels) {
return;
}
@@ -153,7 +153,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
SkAutoMalloc decompMemory(kWidth*kHeight);
uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get());
- REPORTER_ASSERT(reporter, NULL != decompBuffer);
+ REPORTER_ASSERT(reporter, decompBuffer);
if (NULL == decompBuffer) {
return;
}
@@ -168,7 +168,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
}
SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(bitmap, fmt));
- REPORTER_ASSERT(reporter, NULL != data);
+ REPORTER_ASSERT(reporter, data);
if (NULL == data) {
continue;
}
@@ -182,7 +182,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
SkAutoLockPixels alp(bitmap);
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels());
- REPORTER_ASSERT(reporter, NULL != pixels);
+ REPORTER_ASSERT(reporter, pixels);
if (NULL == pixels) {
continue;
}
@@ -228,7 +228,7 @@ DEF_TEST(CompressLATC, reporter) {
for (int lum = 0; lum < 256; ++lum) {
bitmap.lockPixels();
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels());
- REPORTER_ASSERT(reporter, NULL != pixels);
+ REPORTER_ASSERT(reporter, pixels);
if (NULL == pixels) {
bitmap.unlockPixels();
continue;
@@ -241,7 +241,7 @@ DEF_TEST(CompressLATC, reporter) {
SkAutoDataUnref latcData(
SkTextureCompressor::CompressBitmapToFormat(bitmap, kLATCFormat));
- REPORTER_ASSERT(reporter, NULL != latcData);
+ REPORTER_ASSERT(reporter, latcData);
if (NULL == latcData) {
continue;
}
diff --git a/third_party/ktx/ktx.cpp b/third_party/ktx/ktx.cpp
index 2391bafcf8..7cc2f28585 100644
--- a/third_party/ktx/ktx.cpp
+++ b/third_party/ktx/ktx.cpp
@@ -135,7 +135,7 @@ bool SkKTXFile::KeyValue::writeKeyAndValueForKTX(SkWStream* strm) {
}
uint32_t SkKTXFile::readInt(const uint8_t** buf, size_t* bytesLeft) const {
- SkASSERT(NULL != buf && NULL != bytesLeft);
+ SkASSERT(buf && bytesLeft);
uint32_t result;
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index 8a714ca239..15b6173aa1 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -73,7 +73,7 @@ void PictureBenchmark::run(SkPicture* pict) {
fRenderer->setup();
if (fPreprocess) {
- if (NULL != fRenderer->getCanvas()) {
+ if (fRenderer->getCanvas()) {
fRenderer->getCanvas()->EXPERIMENTAL_optimize(fRenderer->getPicture());
}
}
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index b2bac003f4..8148a2b625 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -60,7 +60,7 @@ void PictureRenderer::init(const SkPicture* pict,
SkASSERT(NULL == fPicture);
SkASSERT(NULL == fCanvas.get());
- if (NULL != fPicture || NULL != fCanvas.get()) {
+ if (fPicture || fCanvas.get()) {
return;
}
@@ -74,7 +74,7 @@ void PictureRenderer::init(const SkPicture* pict,
}
void PictureRenderer::CopyString(SkString* dest, const SkString* src) {
- if (NULL != src) {
+ if (src) {
dest->set(*src);
} else {
dest->reset();
@@ -90,7 +90,7 @@ public:
paint->setFlags(paint->getFlags() & ~fFlags[t] & SkPaint::kAllFlags);
if (PictureRenderer::kMaskFilter_DrawFilterFlag & fFlags[t]) {
SkMaskFilter* maskFilter = paint->getMaskFilter();
- if (NULL != maskFilter) {
+ if (maskFilter) {
paint->setMaskFilter(NULL);
}
}
@@ -212,8 +212,8 @@ int PictureRenderer::getViewHeight() {
* should call this method during init.
*/
void PictureRenderer::buildBBoxHierarchy() {
- SkASSERT(NULL != fPicture);
- if (kNone_BBoxHierarchyType != fBBoxHierarchyType && NULL != fPicture) {
+ SkASSERT(fPicture);
+ if (kNone_BBoxHierarchyType != fBBoxHierarchyType && fPicture) {
SkAutoTDelete<SkBBHFactory> factory(this->getFactory());
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(fPicture->cullRect().width(),
@@ -305,14 +305,14 @@ static bool write(SkCanvas* canvas, const SkString& writePath, const SkString& m
outputFilename.appendU64(imageDigestPtr->getHashValue());
} else {
outputFilename.set(escapedInputFilename);
- if (NULL != tileNumberPtr) {
+ if (tileNumberPtr) {
outputFilename.append("-tile");
outputFilename.appendS32(*tileNumberPtr);
}
}
outputFilename.append(".png");
- if (NULL != jsonSummaryPtr) {
+ if (jsonSummaryPtr) {
ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
SkString outputRelativePath;
if (outputSubdirPtr) {
@@ -392,7 +392,7 @@ bool PipePictureRenderer::render(SkBitmap** out) {
pipeCanvas->drawPicture(fPicture);
writer.endRecording();
fCanvas->flush();
- if (NULL != out) {
+ if (out) {
*out = SkNEW(SkBitmap);
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
@@ -421,14 +421,14 @@ void SimplePictureRenderer::init(const SkPicture* picture, const SkString* write
bool SimplePictureRenderer::render(SkBitmap** out) {
SkASSERT(fCanvas.get() != NULL);
- SkASSERT(NULL != fPicture);
+ SkASSERT(fPicture);
if (NULL == fCanvas.get() || NULL == fPicture) {
return false;
}
fCanvas->drawPicture(fPicture);
fCanvas->flush();
- if (NULL != out) {
+ if (out) {
*out = SkNEW(SkBitmap);
setup_bitmap(*out, SkScalarCeilToInt(fPicture->cullRect().width()),
SkScalarCeilToInt(fPicture->cullRect().height()));
@@ -467,7 +467,7 @@ TiledPictureRenderer::TiledPictureRenderer()
void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath,
const SkString* mismatchPath, const SkString* inputFilename,
bool useChecksumBasedFilenames) {
- SkASSERT(NULL != pict);
+ SkASSERT(pict);
SkASSERT(0 == fTileRects.count());
if (NULL == pict || fTileRects.count() != 0) {
return;
@@ -662,7 +662,7 @@ bool TiledPictureRenderer::render(SkBitmap** out) {
success &= write(fCanvas, fWritePath, fMismatchPath, fInputFilename, fJsonSummaryPtr,
fUseChecksumBasedFilenames, &i);
}
- if (NULL != out) {
+ if (out) {
if (fCanvas->readPixels(&bitmap, 0, 0)) {
// Add this tile to the entire bitmap.
bitmapCopyAtOffset(bitmap, *out, SkScalarFloorToInt(fTileRects[i].left()),
@@ -677,7 +677,7 @@ bool TiledPictureRenderer::render(SkBitmap** out) {
SkCanvas* TiledPictureRenderer::setupCanvas(int width, int height) {
SkCanvas* canvas = this->INHERITED::setupCanvas(width, height);
- SkASSERT(NULL != fPicture);
+ SkASSERT(fPicture);
// Clip the tile to an area that is completely inside both the SkPicture and the viewport. This
// is mostly important for tiles on the right and bottom edges as they may go over this area and
// the picture may have some commands that draw outside of this area and so should not actually
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index 00854d4e3e..87d68ff3a2 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -84,7 +84,7 @@ static void apply_0(SkDebugCanvas* canvas, int curCommand) {
const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
- if (NULL != saveLayerPaint) {
+ if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkPaint* dbmrPaint = dbmr->paint();
@@ -92,7 +92,7 @@ static void apply_0(SkDebugCanvas* canvas, int curCommand) {
if (NULL == dbmrPaint) {
// if the DBMR doesn't have a paint just use the saveLayer's
dbmr->setPaint(*saveLayerPaint);
- } else if (NULL != saveLayerPaint) {
+ } else if (saveLayerPaint) {
// Both paints are present so their alphas need to be combined
SkColor color = saveLayerPaint->getColor();
int a0 = SkColorGetA(color);
@@ -162,7 +162,7 @@ static void apply_1(SkDebugCanvas* canvas, int curCommand) {
const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
- if (NULL != saveLayerPaint) {
+ if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
SkPaint* dbmrPaint = dbmr->paint();
@@ -423,8 +423,8 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
const SkPaint* saveLayerPaint0 = saveLayer0->paint();
const SkPaint* saveLayerPaint1 = saveLayer1->paint();
- if ((NULL != saveLayerPaint0 && !is_simple(*saveLayerPaint0)) ||
- (NULL != saveLayerPaint1 && !is_simple(*saveLayerPaint1))) {
+ if ((saveLayerPaint0 && !is_simple(*saveLayerPaint0)) ||
+ (saveLayerPaint1 && !is_simple(*saveLayerPaint1))) {
return false;
}
@@ -434,14 +434,14 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
return true;
}
- if (NULL != saveLayerPaint0) {
+ if (saveLayerPaint0) {
SkColor layerColor0 = saveLayerPaint0->getColor() | 0xFF000000; // force opaque
if (dbmrPaint->getColor() != layerColor0) {
return false;
}
}
- if (NULL != saveLayerPaint1) {
+ if (saveLayerPaint1) {
SkColor layerColor1 = saveLayerPaint1->getColor() | 0xFF000000; // force opaque
if (dbmrPaint->getColor() != layerColor1) {
return false;
@@ -477,7 +477,7 @@ static void apply_7(SkDebugCanvas* canvas, int curCommand) {
int a0, a1;
const SkPaint* saveLayerPaint0 = saveLayer0->paint();
- if (NULL != saveLayerPaint0) {
+ if (saveLayerPaint0) {
color = saveLayerPaint0->getColor();
a0 = SkColorGetA(color);
} else {
@@ -485,7 +485,7 @@ static void apply_7(SkDebugCanvas* canvas, int curCommand) {
}
const SkPaint* saveLayerPaint1 = saveLayer1->paint();
- if (NULL != saveLayerPaint1) {
+ if (saveLayerPaint1) {
color = saveLayerPaint1->getColor();
a1 = SkColorGetA(color);
} else {
@@ -497,7 +497,7 @@ static void apply_7(SkDebugCanvas* canvas, int curCommand) {
SkPaint* dbmrPaint = dbmr->paint();
- if (NULL != dbmrPaint) {
+ if (dbmrPaint) {
SkColor newColor = SkColorSetA(dbmrPaint->getColor(), newA);
dbmrPaint->setColor(newColor);
} else {
@@ -579,7 +579,7 @@ static void apply_8(SkDebugCanvas* canvas, int curCommand) {
SkScalar newSrcLeft, newSrcTop;
- if (NULL != dbmr->srcRect()) {
+ if (dbmr->srcRect()) {
newSrcLeft = dbmr->srcRect()->fLeft + clip->rect().fLeft - dbmr->dstRect().fLeft;
newSrcTop = dbmr->srcRect()->fTop + clip->rect().fTop - dbmr->dstRect().fTop;
} else {
diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h
index c6a783de3f..0fb023335e 100644
--- a/tools/flags/SkCommandLineFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -416,7 +416,7 @@ private:
, fStrings(NULL) {
fNext = SkCommandLineFlags::gHead;
SkCommandLineFlags::gHead = this;
- SkASSERT(NULL != name && strlen(name) > 1);
+ SkASSERT(name && strlen(name) > 1);
SkASSERT(NULL == shortName || 1 == strlen(shortName));
}
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 6a35dd1d70..5c120b010d 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -18,7 +18,7 @@ namespace sk_tools {
void force_all_opaque(const SkBitmap& bitmap) {
SkASSERT(NULL == bitmap.getTexture());
SkASSERT(kN32_SkColorType == bitmap.colorType());
- if (NULL != bitmap.getTexture() || kN32_SkColorType == bitmap.colorType()) {
+ if (bitmap.getTexture() || kN32_SkColorType == bitmap.colorType()) {
return;
}
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 9ec136c1e7..4fb83521c8 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -145,11 +145,11 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
SkBitmap** out) {
SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkString writePathString;
- if (NULL != writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
+ if (writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
writePathString.set(*writePath);
}
SkString mismatchPathString;
- if (NULL != mismatchPath && mismatchPath->size() > 0) {
+ if (mismatchPath && mismatchPath->size() > 0) {
mismatchPathString.set(*mismatchPath);
}
@@ -207,7 +207,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
FLAGS_writeChecksumBasedFilenames);
if (FLAGS_preprocess) {
- if (NULL != renderer.getCanvas()) {
+ if (renderer.getCanvas()) {
renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture());
}
}
@@ -250,7 +250,7 @@ public:
}
~AutoRestoreBbhType() {
- if (NULL != fRenderer) {
+ if (fRenderer) {
fRenderer->setBBoxHierarchyType(fSavedBbhType);
}
}
@@ -369,17 +369,17 @@ static bool render_picture(const SkString& inputPath, const SkString* writePath,
sk_tools::replace_char(&outputFilename, '.', '_');
outputFilename.append(".png");
- if (NULL != jsonSummaryPtr) {
+ if (jsonSummaryPtr) {
sk_tools::ImageDigest imageDigest(*bitmap);
jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), imageDigest);
- if ((NULL != mismatchPath) && !mismatchPath->isEmpty() &&
+ if ((mismatchPath) && !mismatchPath->isEmpty() &&
!jsonSummaryPtr->getExpectation(inputFilename.c_str()).matches(imageDigest)) {
success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath, NULL,
outputFilename);
}
}
- if ((NULL != writePath) && !writePath->isEmpty()) {
+ if ((writePath) && !writePath->isEmpty()) {
success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, NULL, outputFilename);
}
}
diff --git a/tools/skdiff_image.cpp b/tools/skdiff_image.cpp
index 172f62b555..89f73810e7 100644
--- a/tools/skdiff_image.cpp
+++ b/tools/skdiff_image.cpp
@@ -37,11 +37,11 @@ static void create_diff_images (DiffMetricProc dmp,
drp->fComparison.fStatus = DiffResource::kSpecified_Status;
SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()));
- if (NULL != baseFileBits) {
+ if (baseFileBits) {
drp->fBase.fStatus = DiffResource::kRead_Status;
}
SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_str()));
- if (NULL != comparisonFileBits) {
+ if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
if (NULL == baseFileBits || NULL == comparisonFileBits) {
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index ba3221678e..df07844734 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -422,11 +422,11 @@ static void create_diff_images (DiffMetricProc dmp,
drp->fComparison.fStatus = DiffResource::kExists_Status;
SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()));
- if (NULL != baseFileBits) {
+ if (baseFileBits) {
drp->fBase.fStatus = DiffResource::kRead_Status;
}
SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_str()));
- if (NULL != comparisonFileBits) {
+ if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
if (NULL == baseFileBits || NULL == comparisonFileBits) {
diff --git a/tools/skdiff_utils.cpp b/tools/skdiff_utils.cpp
index 9157ac6b91..14a9fec7e4 100644
--- a/tools/skdiff_utils.cpp
+++ b/tools/skdiff_utils.cpp
@@ -103,7 +103,7 @@ static SkString replace_all(const SkString &input,
const char *first_char = input_cstr;
const char *match_char;
size_t oldSubstringLen = strlen(oldSubstring);
- while (NULL != (match_char = strstr(first_char, oldSubstring))) {
+ while ((match_char = strstr(first_char, oldSubstring))) {
output.append(first_char, (match_char - first_char));
output.append(newSubstring);
first_char = match_char + oldSubstringLen;
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 60bdd05485..a2d353c25d 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -511,7 +511,7 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
const char* filename = basename.c_str();
if (!codec->decode(&stream, &bitmap, gPrefColorType, SkImageDecoder::kDecodePixels_Mode)) {
- if (NULL != gJsonExpectations.get()) {
+ if (gJsonExpectations.get()) {
const SkString name_config = create_json_key(filename);
skiagm::Expectations jsExpectations = gJsonExpectations->get(name_config.c_str());
if (jsExpectations.ignoreFailure()) {
@@ -637,7 +637,7 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
}
if (SkImageDecoder::kUnknown_Format == format) {
const char* dot = strrchr(srcPath, '.');
- if (NULL != dot) {
+ if (dot) {
format = guess_format_from_suffix(dot);
}
if (SkImageDecoder::kUnknown_Format == format) {
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index 4248ca3b56..32688f5013 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -27,7 +27,7 @@ SkDiffContext::SkDiffContext() {
}
SkDiffContext::~SkDiffContext() {
- if (NULL != fDiffers) {
+ if (fDiffers) {
SkDELETE_ARRAY(fDiffers);
}
}
@@ -56,7 +56,7 @@ void SkDiffContext::setLongNames(const bool useLongNames) {
void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
// Delete whatever the last array of differs was
- if (NULL != fDiffers) {
+ if (fDiffers) {
SkDELETE_ARRAY(fDiffers);
fDiffers = NULL;
fDifferCount = 0;
@@ -307,7 +307,7 @@ void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) {
// See http://skbug.com/2713 ('make skpdiff use jsoncpp library to write out
// JSON output, instead of manual writeText() calls?')
stream.writeText(" \"records\": [\n");
- while (NULL != currentRecord) {
+ while (currentRecord) {
stream.writeText(" {\n");
SkString baselineAbsPath = get_absolute_path(currentRecord->fBaselinePath);
@@ -386,7 +386,7 @@ void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) {
currentRecord = iter.next();
// JSON does not allow trailing commas
- if (NULL != currentRecord) {
+ if (currentRecord) {
stream.writeText(",");
}
stream.writeText("\n");
@@ -409,7 +409,7 @@ void SkDiffContext::outputCsv(SkWStream& stream) {
DiffRecord* currentRecord = iter.get();
// Write CSV header and create a dictionary of all columns.
- while (NULL != currentRecord) {
+ while (currentRecord) {
for (int diffIndex = 0; diffIndex < currentRecord->fDiffs.count(); diffIndex++) {
DiffData& data = currentRecord->fDiffs[diffIndex];
if (!columns.find(data.fDiffName)) {
@@ -428,7 +428,7 @@ void SkDiffContext::outputCsv(SkWStream& stream) {
SkTLList<DiffRecord>::Iter iter2(fRecords, SkTLList<DiffRecord>::Iter::kHead_IterStart);
currentRecord = iter2.get();
- while (NULL != currentRecord) {
+ while (currentRecord) {
for (int i = 0; i < cntColumns; i++) {
values[i] = -1;
}
diff --git a/tools/skpdiff/skpdiff_main.cpp b/tools/skpdiff/skpdiff_main.cpp
index 9c1f37f243..c01767ef14 100644
--- a/tools/skpdiff/skpdiff_main.cpp
+++ b/tools/skpdiff/skpdiff_main.cpp
@@ -134,7 +134,7 @@ int tool_main(int argc, char * argv[]) {
// Figure which differs the user chose, and optionally print them if the user requests it
SkTDArray<SkImageDiffer*> chosenDiffers;
- for (int differIndex = 0; NULL != gDiffers[differIndex]; differIndex++) {
+ for (int differIndex = 0; gDiffers[differIndex]; differIndex++) {
SkImageDiffer* differ = gDiffers[differIndex];
if (FLAGS_list) {
SkDebugf(" %s", differ->getName());
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp
index 4a92f5e3f7..498f657f9e 100644
--- a/tools/skpdiff/skpdiff_util.cpp
+++ b/tools/skpdiff/skpdiff_util.cpp
@@ -174,7 +174,7 @@ bool glob_files(const char globPattern[], SkTArray<SkString>* entries) {
// Note these paths are in sorted order by default according to http://linux.die.net/man/3/glob
// Check under the flag GLOB_NOSORT
char** paths = globBuffer.gl_pathv;
- while(NULL != *paths) {
+ while(*paths) {
entries->push_back(SkString(*paths));
paths++;
}