aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/AlternatingColorPatternBench.cpp6
-rw-r--r--bench/BenchLogger.cpp2
-rwxr-xr-xbench/BezierBench.cpp2
-rw-r--r--bench/BitmapBench.cpp2
-rw-r--r--bench/BlurImageFilterBench.cpp4
-rw-r--r--bench/BlurRectBench.cpp6
-rw-r--r--bench/ChartBench.cpp6
-rw-r--r--bench/CmapBench.cpp2
-rw-r--r--bench/CodecBench.cpp2
-rw-r--r--bench/ColorCubeBench.cpp4
-rw-r--r--bench/ColorFilterBench.cpp6
-rw-r--r--bench/DashBench.cpp4
-rw-r--r--bench/DecodingBench.cpp2
-rw-r--r--bench/ETCBitmapBench.cpp24
-rw-r--r--bench/FontCacheBench.cpp2
-rw-r--r--bench/GLBench.cpp16
-rw-r--r--bench/GLInstancedArraysBench.cpp2
-rw-r--r--bench/GLVec4ScalarBench.cpp2
-rw-r--r--bench/GameBench.cpp2
-rw-r--r--bench/GeometryBench.cpp8
-rw-r--r--bench/GrMemoryPoolBench.cpp2
-rw-r--r--bench/GrResourceCacheBench.cpp2
-rw-r--r--bench/GradientBench.cpp10
-rw-r--r--bench/ImageCacheBench.cpp4
-rw-r--r--bench/ImageFilterCollapse.cpp8
-rw-r--r--bench/MathBench.cpp2
-rw-r--r--bench/MipMapBench.cpp2
-rw-r--r--bench/MorphologyBench.cpp2
-rw-r--r--bench/PatchBench.cpp12
-rw-r--r--bench/PatchGridBench.cpp12
-rw-r--r--bench/PathBench.cpp10
-rw-r--r--bench/PerlinNoiseBench.cpp4
-rw-r--r--bench/PicturePlaybackBench.cpp2
-rw-r--r--bench/RTreeBench.cpp2
-rw-r--r--bench/RecordingBench.cpp2
-rw-r--r--bench/RectanizerBench.cpp2
-rw-r--r--bench/RepeatTileBench.cpp2
-rw-r--r--bench/ResultsWriter.h4
-rw-r--r--bench/SKPAnimationBench.cpp2
-rw-r--r--bench/SKPBench.cpp2
-rw-r--r--bench/SkipZeroesBench.cpp2
-rw-r--r--bench/StrokeBench.cpp2
-rw-r--r--bench/TextBench.cpp2
-rw-r--r--bench/TextBlobBench.cpp6
-rw-r--r--bench/VertBench.cpp2
-rw-r--r--bench/nanobench.cpp34
-rw-r--r--bench/nanobench.h2
-rw-r--r--bench/subset/SubsetBenchPriv.h2
-rw-r--r--bench/subset/SubsetSingleBench.cpp2
-rw-r--r--bench/subset/SubsetTranslateBench.cpp4
-rw-r--r--bench/subset/SubsetZoomBench.cpp2
-rw-r--r--debugger/QT/SkDebuggerGUI.cpp14
-rw-r--r--debugger/QT/SkDrawCommandGeometryWidget.cpp2
-rw-r--r--debugger/QT/SkGLWidget.cpp8
-rw-r--r--debugger/QT/SkListWidget.h2
-rw-r--r--debugger/QT/SkRasterWidget.cpp2
-rw-r--r--debugger/SkDebugger.cpp6
-rw-r--r--debugger/SkDebugger.h2
-rw-r--r--dm/DM.cpp32
-rw-r--r--dm/DMGpuSupport.h2
-rw-r--r--dm/DMSrcSink.cpp60
-rw-r--r--gm/aaclip.cpp2
-rw-r--r--gm/aarectmodes.cpp2
-rw-r--r--gm/aaxfermodes.cpp2
-rw-r--r--gm/addarc.cpp2
-rw-r--r--gm/all_bitmap_configs.cpp6
-rw-r--r--gm/alphagradients.cpp6
-rw-r--r--gm/arithmode.cpp12
-rw-r--r--gm/astcbitmap.cpp2
-rw-r--r--gm/beziereffects.cpp18
-rw-r--r--gm/bigrrectaaeffect.cpp4
-rw-r--r--gm/bigtileimagefilter.cpp2
-rw-r--r--gm/bitmapfilters.cpp2
-rw-r--r--gm/bitmaprect.cpp2
-rw-r--r--gm/bitmaprecttest.cpp4
-rw-r--r--gm/bitmapshader.cpp2
-rw-r--r--gm/bitmapsource2.cpp2
-rw-r--r--gm/blend.cpp6
-rw-r--r--gm/blurrect.cpp4
-rw-r--r--gm/blurs.cpp4
-rw-r--r--gm/colorcube.cpp12
-rw-r--r--gm/coloremoji.cpp10
-rw-r--r--gm/colorfilterimagefilter.cpp8
-rw-r--r--gm/colorfilters.cpp4
-rw-r--r--gm/colormatrix.cpp2
-rw-r--r--gm/colortype.cpp8
-rw-r--r--gm/colortypexfermode.cpp8
-rw-r--r--gm/colorwheel.cpp2
-rw-r--r--gm/complexclip.cpp2
-rw-r--r--gm/composeshader.cpp6
-rw-r--r--gm/constcolorprocessor.cpp8
-rw-r--r--gm/convex_all_line_paths.cpp2
-rw-r--r--gm/convexpolyclip.cpp4
-rw-r--r--gm/convexpolyeffect.cpp8
-rw-r--r--gm/dashcubics.cpp2
-rw-r--r--gm/dcshader.cpp2
-rw-r--r--gm/dftext.cpp12
-rw-r--r--gm/discard.cpp6
-rw-r--r--gm/displacement.cpp22
-rw-r--r--gm/distantclip.cpp4
-rw-r--r--gm/downsamplebitmap.cpp10
-rw-r--r--gm/drawatlas.cpp10
-rw-r--r--gm/drawatlascolor.cpp10
-rw-r--r--gm/drawbitmaprect.cpp6
-rw-r--r--gm/drawfilter.cpp6
-rw-r--r--gm/drawlooper.cpp2
-rw-r--r--gm/drawminibitmaprect.cpp4
-rw-r--r--gm/dropshadowimagefilter.cpp10
-rw-r--r--gm/etc1bitmap.cpp4
-rw-r--r--gm/factory.cpp2
-rw-r--r--gm/fatpathfill.cpp2
-rw-r--r--gm/filterbitmap.cpp2
-rw-r--r--gm/filterfastbounds.cpp6
-rw-r--r--gm/filterindiabox.cpp2
-rw-r--r--gm/fontcache.cpp4
-rw-r--r--gm/fontmgr.cpp10
-rw-r--r--gm/fontscaler.cpp2
-rw-r--r--gm/fontscalerdistortable.cpp2
-rw-r--r--gm/gammatext.cpp8
-rw-r--r--gm/giantbitmap.cpp4
-rw-r--r--gm/glyph_pos.cpp2
-rw-r--r--gm/glyph_pos_align.cpp2
-rw-r--r--gm/gm_expectations.h4
-rw-r--r--gm/gradientDirtyLaundry.cpp4
-rw-r--r--gm/gradient_matrix.cpp4
-rw-r--r--gm/gradients.cpp20
-rw-r--r--gm/gradients_no_texture.cpp12
-rw-r--r--gm/gradtext.cpp6
-rw-r--r--gm/hairmodes.cpp2
-rw-r--r--gm/image.cpp26
-rw-r--r--gm/imagealphathreshold.cpp2
-rw-r--r--gm/imageblur.cpp2
-rw-r--r--gm/imageblur2.cpp2
-rw-r--r--gm/imageblurtiled.cpp2
-rw-r--r--gm/imagefilters.cpp4
-rw-r--r--gm/imagefiltersbase.cpp14
-rw-r--r--gm/imagefiltersclipped.cpp2
-rw-r--r--gm/imagefilterscropexpand.cpp4
-rw-r--r--gm/imagefilterscropped.cpp28
-rw-r--r--gm/imagefiltersgraph.cpp4
-rw-r--r--gm/imagefiltersscaled.cpp2
-rw-r--r--gm/imagefilterstransformed.cpp2
-rw-r--r--gm/imagefromyuvtextures.cpp4
-rw-r--r--gm/imagemagnifier.cpp2
-rw-r--r--gm/imageresizetiled.cpp2
-rw-r--r--gm/lerpmode.cpp4
-rw-r--r--gm/lighting.cpp6
-rw-r--r--gm/lumafilter.cpp8
-rw-r--r--gm/matrixconvolution.cpp4
-rw-r--r--gm/mipmap.cpp2
-rw-r--r--gm/modecolorfilters.cpp8
-rw-r--r--gm/morphology.cpp6
-rw-r--r--gm/multipicturedraw.cpp14
-rw-r--r--gm/ninepatchstretch.cpp4
-rw-r--r--gm/offsetimagefilter.cpp20
-rwxr-xr-xgm/ovals.cpp2
-rw-r--r--gm/patch.cpp12
-rw-r--r--gm/patchgrid.cpp6
-rw-r--r--gm/patheffects.cpp2
-rw-r--r--gm/pathfill.cpp2
-rw-r--r--gm/pathopsskpclip.cpp2
-rw-r--r--gm/peekpixels.cpp6
-rw-r--r--gm/perlinnoise.cpp8
-rw-r--r--gm/picture.cpp4
-rw-r--r--gm/pictureimagefilter.cpp2
-rw-r--r--gm/pictureshader.cpp20
-rw-r--r--gm/pictureshadertile.cpp2
-rw-r--r--gm/resizeimagefilter.cpp2
-rw-r--r--gm/roundrects.cpp2
-rw-r--r--gm/rrects.cpp8
-rw-r--r--gm/samplerstress.cpp4
-rw-r--r--gm/shaderbounds.cpp2
-rw-r--r--gm/shadertext.cpp6
-rw-r--r--gm/shadertext2.cpp4
-rw-r--r--gm/shallowgradient.cpp8
-rw-r--r--gm/simpleaaclip.cpp4
-rw-r--r--gm/spritebitmap.cpp2
-rw-r--r--gm/srcmode.cpp10
-rw-r--r--gm/strokefill.cpp6
-rw-r--r--gm/surface.cpp14
-rw-r--r--gm/tablecolorfilter.cpp14
-rw-r--r--gm/texdata.cpp2
-rw-r--r--gm/textblob.cpp2
-rw-r--r--gm/textbloblooper.cpp6
-rw-r--r--gm/textblobmixedsizes.cpp2
-rw-r--r--gm/textblobrandomfont.cpp4
-rw-r--r--gm/textblobshader.cpp8
-rw-r--r--gm/textblobuseaftergpufree.cpp2
-rw-r--r--gm/texteffects.cpp14
-rw-r--r--gm/texturedomaineffect.cpp14
-rw-r--r--gm/tileimagefilter.cpp2
-rw-r--r--gm/tilemodes.cpp8
-rw-r--r--gm/tilemodes_scaled.cpp8
-rw-r--r--gm/tinybitmap.cpp2
-rw-r--r--gm/transparency.cpp4
-rw-r--r--gm/typeface.cpp2
-rw-r--r--gm/vertices.cpp8
-rw-r--r--gm/verttext.cpp2
-rw-r--r--gm/verttext2.cpp4
-rw-r--r--gm/verylargebitmap.cpp6
-rw-r--r--gm/xfermodeimagefilter.cpp4
-rw-r--r--gm/xfermodes.cpp4
-rw-r--r--gm/xfermodes2.cpp6
-rw-r--r--gm/xfermodes3.cpp14
-rw-r--r--gm/yuvtorgbeffect.cpp12
-rw-r--r--platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp42
-rw-r--r--platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp4
-rw-r--r--platform_tools/android/apps/visualbench/src/main/jni/main.cpp12
-rw-r--r--samplecode/ClockFaceView.cpp8
-rw-r--r--samplecode/OverView.cpp4
-rw-r--r--samplecode/Sample2PtRadial.cpp2
-rw-r--r--samplecode/SampleAARectModes.cpp2
-rw-r--r--samplecode/SampleAll.cpp36
-rw-r--r--samplecode/SampleAnimator.cpp20
-rw-r--r--samplecode/SampleApp.cpp146
-rw-r--r--samplecode/SampleApp.h8
-rw-r--r--samplecode/SampleArc.cpp2
-rw-r--r--samplecode/SampleAtlas.cpp6
-rw-r--r--samplecode/SampleBigGradient.cpp2
-rw-r--r--samplecode/SampleBitmapRect.cpp2
-rw-r--r--samplecode/SampleBlur.cpp6
-rw-r--r--samplecode/SampleChart.cpp8
-rw-r--r--samplecode/SampleClamp.cpp2
-rw-r--r--samplecode/SampleClipDrawMatch.cpp24
-rw-r--r--samplecode/SampleClock.cpp2
-rw-r--r--samplecode/SampleConcavePaths.cpp2
-rw-r--r--samplecode/SampleCull.cpp4
-rw-r--r--samplecode/SampleDash.cpp2
-rw-r--r--samplecode/SampleDither.cpp4
-rw-r--r--samplecode/SampleDitherBitmap.cpp6
-rw-r--r--samplecode/SampleDraw.cpp10
-rw-r--r--samplecode/SampleEffects.cpp2
-rw-r--r--samplecode/SampleEncode.cpp10
-rw-r--r--samplecode/SampleFatBits.cpp30
-rw-r--r--samplecode/SampleFilter.cpp2
-rw-r--r--samplecode/SampleFilter2.cpp4
-rw-r--r--samplecode/SampleFilterFuzz.cpp8
-rw-r--r--samplecode/SampleFilterQuality.cpp14
-rw-r--r--samplecode/SampleFontCache.cpp10
-rw-r--r--samplecode/SampleFontScalerTest.cpp6
-rw-r--r--samplecode/SampleFuzz.cpp2
-rw-r--r--samplecode/SampleGradients.cpp8
-rw-r--r--samplecode/SampleHT.cpp8
-rw-r--r--samplecode/SampleHairModes.cpp2
-rw-r--r--samplecode/SampleHairline.cpp8
-rw-r--r--samplecode/SampleIdentityScale.cpp4
-rw-r--r--samplecode/SampleLayerMask.cpp2
-rw-r--r--samplecode/SampleLayers.cpp10
-rwxr-xr-xsamplecode/SampleLighting.cpp4
-rw-r--r--samplecode/SampleLines.cpp6
-rw-r--r--samplecode/SampleLua.cpp14
-rw-r--r--samplecode/SampleManyRects.cpp2
-rw-r--r--samplecode/SampleMeasure.cpp2
-rw-r--r--samplecode/SamplePatch.cpp14
-rw-r--r--samplecode/SamplePath.cpp10
-rw-r--r--samplecode/SamplePathClip.cpp2
-rw-r--r--samplecode/SamplePathFuzz.cpp2
-rw-r--r--samplecode/SamplePdfFileViewer.cpp8
-rw-r--r--samplecode/SamplePictFile.cpp16
-rw-r--r--samplecode/SamplePicture.cpp14
-rw-r--r--samplecode/SampleQuadStroker.cpp10
-rw-r--r--samplecode/SampleRectanizer.cpp2
-rw-r--r--samplecode/SampleRegion.cpp14
-rw-r--r--samplecode/SampleRepeatTile.cpp4
-rw-r--r--samplecode/SampleShaderText.cpp6
-rw-r--r--samplecode/SampleShaders.cpp10
-rw-r--r--samplecode/SampleSlides.cpp36
-rw-r--r--samplecode/SampleStringArt.cpp4
-rw-r--r--samplecode/SampleStrokePath.cpp2
-rw-r--r--samplecode/SampleSubpixelTranslate.cpp4
-rw-r--r--samplecode/SampleText.cpp4
-rw-r--r--samplecode/SampleTextAlpha.cpp4
-rw-r--r--samplecode/SampleTextOnPath.cpp6
-rw-r--r--samplecode/SampleTextureDomain.cpp4
-rw-r--r--samplecode/SampleTiling.cpp8
-rw-r--r--samplecode/SampleTinyBitmap.cpp2
-rw-r--r--samplecode/SampleUnpremul.cpp6
-rw-r--r--samplecode/SampleVertices.cpp14
-rw-r--r--samplecode/SampleXfermodesBlur.cpp4
-rw-r--r--site/dev/contrib/style.md22
-rw-r--r--site/dev/testing/fonts.md2
-rw-r--r--site/user/api/skpaint.md30
-rw-r--r--src/animator/SkAnimateActive.cpp8
-rw-r--r--src/animator/SkAnimateBase.cpp6
-rw-r--r--src/animator/SkAnimateField.cpp8
-rw-r--r--src/animator/SkAnimateMaker.cpp22
-rw-r--r--src/animator/SkAnimateSet.cpp4
-rw-r--r--src/animator/SkAnimator.cpp70
-rw-r--r--src/animator/SkAnimatorScript.cpp18
-rw-r--r--src/animator/SkAnimatorScript2.cpp14
-rw-r--r--src/animator/SkBoundable.cpp2
-rw-r--r--src/animator/SkBuildCondensedInfo.cpp14
-rw-r--r--src/animator/SkDisplayAdd.cpp22
-rw-r--r--src/animator/SkDisplayAdd.h2
-rw-r--r--src/animator/SkDisplayApply.cpp58
-rw-r--r--src/animator/SkDisplayEvent.cpp8
-rw-r--r--src/animator/SkDisplayEvents.cpp10
-rw-r--r--src/animator/SkDisplayInput.cpp2
-rw-r--r--src/animator/SkDisplayList.cpp4
-rw-r--r--src/animator/SkDisplayMath.cpp2
-rw-r--r--src/animator/SkDisplayMovie.cpp6
-rw-r--r--src/animator/SkDisplayPost.cpp14
-rw-r--r--src/animator/SkDisplayType.cpp26
-rw-r--r--src/animator/SkDisplayTypes.cpp2
-rw-r--r--src/animator/SkDisplayXMLParser.cpp34
-rw-r--r--src/animator/SkDisplayable.cpp30
-rw-r--r--src/animator/SkDraw3D.cpp2
-rw-r--r--src/animator/SkDrawBitmap.cpp4
-rw-r--r--src/animator/SkDrawBlur.cpp2
-rw-r--r--src/animator/SkDrawClip.cpp6
-rw-r--r--src/animator/SkDrawColor.cpp4
-rw-r--r--src/animator/SkDrawDash.cpp2
-rw-r--r--src/animator/SkDrawDiscrete.cpp2
-rw-r--r--src/animator/SkDrawEmboss.cpp2
-rw-r--r--src/animator/SkDrawExtraPathEffect.cpp34
-rw-r--r--src/animator/SkDrawGradient.cpp4
-rw-r--r--src/animator/SkDrawGroup.cpp4
-rw-r--r--src/animator/SkDrawGroup.h2
-rw-r--r--src/animator/SkDrawPaint.cpp24
-rw-r--r--src/animator/SkDrawPath.cpp2
-rw-r--r--src/animator/SkDrawRectangle.cpp2
-rw-r--r--src/animator/SkDrawSaveLayer.cpp2
-rw-r--r--src/animator/SkDrawShader.cpp10
-rw-r--r--src/animator/SkDrawTo.cpp2
-rw-r--r--src/animator/SkDump.cpp6
-rw-r--r--src/animator/SkGetCondensedInfo.cpp14
-rw-r--r--src/animator/SkMatrixParts.cpp22
-rw-r--r--src/animator/SkMemberInfo.cpp30
-rw-r--r--src/animator/SkMemberInfo.h18
-rw-r--r--src/animator/SkOperandIterpolator.cpp2
-rw-r--r--src/animator/SkPaintPart.cpp12
-rw-r--r--src/animator/SkPaintPart.h2
-rw-r--r--src/animator/SkParseSVGPath.cpp2
-rw-r--r--src/animator/SkPathParts.cpp8
-rw-r--r--src/animator/SkPostParts.cpp2
-rw-r--r--src/animator/SkScript.cpp30
-rw-r--r--src/animator/SkScriptRuntime.cpp8
-rw-r--r--src/animator/SkScriptTokenizer.cpp32
-rw-r--r--src/animator/SkTDArray_Experimental.h18
-rw-r--r--src/animator/SkTextOnPath.cpp2
-rw-r--r--src/animator/SkTextToPath.cpp4
-rw-r--r--src/animator/SkTypedArray.cpp14
-rw-r--r--src/codec/SkBmpCodec.cpp10
-rw-r--r--src/codec/SkBmpCodec.h2
-rw-r--r--src/codec/SkBmpMaskCodec.cpp8
-rw-r--r--src/codec/SkBmpRLECodec.cpp8
-rw-r--r--src/codec/SkBmpRLECodec.h2
-rw-r--r--src/codec/SkBmpStandardCodec.cpp14
-rw-r--r--src/codec/SkBmpStandardCodec.h2
-rw-r--r--src/codec/SkCodec.cpp22
-rw-r--r--src/codec/SkCodecPriv.h10
-rw-r--r--src/codec/SkCodec_libgif.cpp44
-rw-r--r--src/codec/SkCodec_libgif.h6
-rw-r--r--src/codec/SkCodec_libico.cpp16
-rw-r--r--src/codec/SkCodec_libpng.cpp48
-rw-r--r--src/codec/SkCodec_wbmp.cpp18
-rw-r--r--src/codec/SkCodec_wbmp.h2
-rw-r--r--src/codec/SkGifInterlaceIter.cpp4
-rw-r--r--src/codec/SkJpegCodec.cpp28
-rw-r--r--src/codec/SkJpegCodec.h6
-rw-r--r--src/codec/SkMaskSwizzler.cpp6
-rw-r--r--src/codec/SkMasks.cpp2
-rw-r--r--src/codec/SkScaledCodec.cpp10
-rw-r--r--src/codec/SkScanlineDecoder.cpp20
-rw-r--r--src/codec/SkSwizzler.cpp20
-rw-r--r--src/codec/SkSwizzler.h8
-rw-r--r--src/codec/SkWebpCodec.cpp4
-rw-r--r--src/core/SkAAClip.cpp48
-rw-r--r--src/core/SkAAClip.h10
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.cpp4
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.h4
-rw-r--r--src/core/SkAnnotation.cpp10
-rw-r--r--src/core/SkBitmap.cpp94
-rw-r--r--src/core/SkBitmapCache.cpp4
-rw-r--r--src/core/SkBitmapCache.h18
-rw-r--r--src/core/SkBitmapController.cpp20
-rw-r--r--src/core/SkBitmapController.h2
-rw-r--r--src/core/SkBitmapDevice.cpp22
-rw-r--r--src/core/SkBitmapFilter.cpp2
-rw-r--r--src/core/SkBitmapHeap.cpp56
-rw-r--r--src/core/SkBitmapHeap.h24
-rw-r--r--src/core/SkBitmapProcShader.cpp14
-rw-r--r--src/core/SkBitmapProcShader.h4
-rw-r--r--src/core/SkBitmapProcState.cpp40
-rw-r--r--src/core/SkBitmapProcState.h2
-rw-r--r--src/core/SkBitmapProcState_sample.h8
-rw-r--r--src/core/SkBitmapProcState_shaderproc.h2
-rw-r--r--src/core/SkBitmapScaler.cpp6
-rw-r--r--src/core/SkBitmapScaler.h2
-rw-r--r--src/core/SkBlitMask.h6
-rw-r--r--src/core/SkBlitMask_D32.cpp12
-rw-r--r--src/core/SkBlitRow_D16.cpp4
-rw-r--r--src/core/SkBlitRow_D32.cpp2
-rw-r--r--src/core/SkBlitter.cpp54
-rw-r--r--src/core/SkBlitter.h6
-rw-r--r--src/core/SkBlitter_A8.cpp16
-rw-r--r--src/core/SkBlitter_ARGB32.cpp16
-rw-r--r--src/core/SkBlitter_RGB16.cpp20
-rw-r--r--src/core/SkBlitter_Sprite.cpp4
-rw-r--r--src/core/SkBuffer.cpp6
-rw-r--r--src/core/SkCachedData.cpp6
-rw-r--r--src/core/SkCachedData.h4
-rw-r--r--src/core/SkCanvas.cpp190
-rw-r--r--src/core/SkChunkAlloc.cpp10
-rw-r--r--src/core/SkClipStack.cpp28
-rw-r--r--src/core/SkColorFilter.cpp2
-rw-r--r--src/core/SkColorTable.cpp2
-rw-r--r--src/core/SkComposeShader.cpp8
-rw-r--r--src/core/SkConfig8888.cpp8
-rw-r--r--src/core/SkConfig8888.h2
-rw-r--r--src/core/SkConvolver.cpp2
-rw-r--r--src/core/SkConvolver.h4
-rw-r--r--src/core/SkData.cpp32
-rw-r--r--src/core/SkDataTable.cpp16
-rw-r--r--src/core/SkDeque.cpp80
-rw-r--r--src/core/SkDescriptor.h12
-rw-r--r--src/core/SkDevice.cpp18
-rw-r--r--src/core/SkDeviceLooper.cpp6
-rw-r--r--src/core/SkDeviceProfile.cpp4
-rw-r--r--src/core/SkDeviceProfile.h4
-rw-r--r--src/core/SkDiscardableMemory.h4
-rw-r--r--src/core/SkDraw.cpp98
-rw-r--r--src/core/SkDrawLooper.cpp4
-rw-r--r--src/core/SkDrawable.cpp2
-rw-r--r--src/core/SkEdgeBuilder.cpp2
-rw-r--r--src/core/SkEmptyShader.h6
-rw-r--r--src/core/SkEndian.h6
-rw-r--r--src/core/SkError.cpp6
-rw-r--r--src/core/SkFilterShader.cpp6
-rw-r--r--src/core/SkFlattenable.cpp8
-rw-r--r--src/core/SkFont.cpp8
-rw-r--r--src/core/SkFontDescriptor.h4
-rw-r--r--src/core/SkFontMgr.cpp38
-rw-r--r--src/core/SkFontStream.cpp2
-rw-r--r--src/core/SkFontStream.h2
-rw-r--r--src/core/SkGeometry.cpp2
-rw-r--r--src/core/SkGeometry.h6
-rw-r--r--src/core/SkGlyph.h4
-rw-r--r--src/core/SkGlyphCache.cpp32
-rw-r--r--src/core/SkGlyphCache.h12
-rw-r--r--src/core/SkGlyphCache_Globals.h2
-rw-r--r--src/core/SkImageCacherator.h2
-rw-r--r--src/core/SkImageFilter.cpp18
-rw-r--r--src/core/SkImageGenerator.cpp22
-rw-r--r--src/core/SkImageGeneratorPriv.h6
-rw-r--r--src/core/SkImageInfo.cpp2
-rw-r--r--src/core/SkLayerInfo.h8
-rw-r--r--src/core/SkLazyFnPtr.h10
-rw-r--r--src/core/SkLightingShader.cpp22
-rw-r--r--src/core/SkLightingShader.h2
-rw-r--r--src/core/SkLocalMatrixShader.cpp6
-rw-r--r--src/core/SkMallocPixelRef.cpp40
-rw-r--r--src/core/SkMaskCache.cpp8
-rw-r--r--src/core/SkMaskCache.h10
-rw-r--r--src/core/SkMaskFilter.cpp12
-rw-r--r--src/core/SkMaskGamma.h6
-rw-r--r--src/core/SkMatrix.cpp4
-rw-r--r--src/core/SkMatrixImageFilter.cpp2
-rw-r--r--src/core/SkMatrixImageFilter.h4
-rw-r--r--src/core/SkMetaData.cpp22
-rw-r--r--src/core/SkMipMap.cpp18
-rw-r--r--src/core/SkMipMap.h2
-rw-r--r--src/core/SkMultiPictureDraw.cpp8
-rw-r--r--src/core/SkPaint.cpp188
-rw-r--r--src/core/SkPaintPriv.h6
-rw-r--r--src/core/SkPath.cpp36
-rw-r--r--src/core/SkPathMeasure.cpp14
-rw-r--r--src/core/SkPathRef.cpp22
-rw-r--r--src/core/SkPictureContentInfo.cpp2
-rw-r--r--src/core/SkPictureData.cpp38
-rw-r--r--src/core/SkPictureData.h2
-rw-r--r--src/core/SkPictureFlat.cpp18
-rw-r--r--src/core/SkPictureFlat.h22
-rw-r--r--src/core/SkPicturePlayback.cpp16
-rw-r--r--src/core/SkPictureRecord.cpp18
-rw-r--r--src/core/SkPictureRecorder.cpp22
-rw-r--r--src/core/SkPictureShader.cpp22
-rw-r--r--src/core/SkPixelRef.cpp10
-rw-r--r--src/core/SkPixmap.cpp18
-rw-r--r--src/core/SkPtrRecorder.cpp4
-rw-r--r--src/core/SkPtrRecorder.h8
-rw-r--r--src/core/SkRRect.cpp2
-rw-r--r--src/core/SkRWBuffer.cpp20
-rw-r--r--src/core/SkRWBuffer.h2
-rw-r--r--src/core/SkRasterClip.cpp6
-rw-r--r--src/core/SkRasterizer.cpp4
-rw-r--r--src/core/SkReadBuffer.cpp52
-rw-r--r--src/core/SkReadBuffer.h4
-rw-r--r--src/core/SkReader32.h10
-rw-r--r--src/core/SkRecordDraw.cpp22
-rw-r--r--src/core/SkRecordDraw.h2
-rw-r--r--src/core/SkRecordOpts.cpp8
-rw-r--r--src/core/SkRecordPattern.h10
-rw-r--r--src/core/SkRecorder.cpp28
-rw-r--r--src/core/SkRecorder.h2
-rw-r--r--src/core/SkRefDict.cpp14
-rw-r--r--src/core/SkRefDict.h8
-rw-r--r--src/core/SkRegion.cpp22
-rw-r--r--src/core/SkRegionPriv.h2
-rw-r--r--src/core/SkRegion_path.cpp30
-rw-r--r--src/core/SkResourceCache.cpp40
-rw-r--r--src/core/SkResourceCache.h10
-rw-r--r--src/core/SkScalar.cpp4
-rw-r--r--src/core/SkScalerContext.cpp32
-rw-r--r--src/core/SkScalerContext.h10
-rw-r--r--src/core/SkScan_AntiPath.cpp4
-rw-r--r--src/core/SkScan_Antihair.cpp20
-rw-r--r--src/core/SkScan_Hairline.cpp6
-rw-r--r--src/core/SkScan_Path.cpp26
-rw-r--r--src/core/SkSemaphore.cpp6
-rw-r--r--src/core/SkShader.cpp18
-rw-r--r--src/core/SkSmallAllocator.h30
-rw-r--r--src/core/SkSpriteBlitter_ARGB32.cpp16
-rw-r--r--src/core/SkSpriteBlitter_RGB16.cpp16
-rw-r--r--src/core/SkStream.cpp74
-rw-r--r--src/core/SkStreamPriv.h2
-rw-r--r--src/core/SkString.cpp4
-rw-r--r--src/core/SkStroke.cpp20
-rw-r--r--src/core/SkTDPQueue.h10
-rw-r--r--src/core/SkTDynamicHash.h14
-rw-r--r--src/core/SkTLList.h6
-rwxr-xr-xsrc/core/SkTLS.cpp18
-rw-r--r--src/core/SkTLS.h6
-rw-r--r--src/core/SkTMultiMap.h10
-rw-r--r--src/core/SkTSearch.cpp2
-rw-r--r--src/core/SkTaskGroup.cpp6
-rw-r--r--src/core/SkTextBlob.cpp18
-rw-r--r--src/core/SkTraceEvent.h4
-rw-r--r--src/core/SkTypeface.cpp34
-rw-r--r--src/core/SkTypefaceCache.cpp4
-rw-r--r--src/core/SkTypefaceCache.h2
-rw-r--r--src/core/SkUtils.cpp8
-rw-r--r--src/core/SkUtilsArm.cpp6
-rw-r--r--src/core/SkValidatingReadBuffer.cpp16
-rw-r--r--src/core/SkVarAlloc.cpp6
-rw-r--r--src/core/SkVertState.cpp2
-rw-r--r--src/core/SkVertState.h2
-rw-r--r--src/core/SkWriteBuffer.cpp54
-rw-r--r--src/core/SkWriter32.cpp4
-rw-r--r--src/core/SkXfermode.cpp32
-rw-r--r--src/core/SkYUVPlanesCache.cpp4
-rw-r--r--src/core/SkYUVPlanesCache.h6
-rw-r--r--src/device/xps/SkXPSDevice.cpp88
-rw-r--r--src/doc/SkDocument.cpp16
-rw-r--r--src/doc/SkDocument_PDF.cpp6
-rw-r--r--src/doc/SkDocument_PDF_None.cpp4
-rw-r--r--src/doc/SkDocument_XPS.cpp6
-rw-r--r--src/doc/SkDocument_XPS_None.cpp10
-rw-r--r--src/effects/Sk1DPathEffect.cpp4
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp2
-rw-r--r--src/effects/SkArithmeticMode.cpp2
-rw-r--r--src/effects/SkArithmeticMode_gpu.cpp2
-rw-r--r--src/effects/SkBitmapSource.cpp4
-rw-r--r--src/effects/SkBlurDrawLooper.cpp4
-rw-r--r--src/effects/SkBlurMask.cpp8
-rw-r--r--src/effects/SkBlurMask.h8
-rw-r--r--src/effects/SkBlurMaskFilter.cpp50
-rw-r--r--src/effects/SkColorCubeFilter.cpp30
-rw-r--r--src/effects/SkColorFilterImageFilter.cpp6
-rw-r--r--src/effects/SkColorFilters.cpp10
-rw-r--r--src/effects/SkColorMatrixFilter.cpp12
-rw-r--r--src/effects/SkDashPathEffect.cpp4
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp2
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp2
-rw-r--r--src/effects/SkEmbossMaskFilter.cpp8
-rw-r--r--src/effects/SkGpuBlurUtils.cpp20
-rw-r--r--src/effects/SkLayerDrawLooper.cpp22
-rw-r--r--src/effects/SkLayerRasterizer.cpp18
-rw-r--r--src/effects/SkLightingImageFilter.cpp26
-rw-r--r--src/effects/SkLumaColorFilter.cpp4
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp4
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp12
-rwxr-xr-xsrc/effects/SkMergeImageFilter.cpp18
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp4
-rw-r--r--src/effects/SkOffsetImageFilter.cpp2
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp18
-rw-r--r--src/effects/SkPictureImageFilter.cpp8
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp8
-rw-r--r--src/effects/SkTableColorFilter.cpp44
-rw-r--r--src/effects/SkTableMaskFilter.cpp4
-rwxr-xr-xsrc/effects/SkTestImageFilters.cpp4
-rw-r--r--src/effects/SkTileImageFilter.cpp4
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp8
-rw-r--r--src/effects/gradients/SkGradientBitmapCache.cpp16
-rw-r--r--src/effects/gradients/SkGradientShader.cpp50
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h4
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp8
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp4
-rw-r--r--src/effects/gradients/SkSweepGradient.cpp4
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp34
-rw-r--r--src/fonts/SkFontMgr_fontconfig.cpp34
-rw-r--r--src/fonts/SkFontMgr_indirect.cpp28
-rw-r--r--src/fonts/SkTestScalerContext.cpp4
-rw-r--r--src/fonts/SkTestScalerContext.h2
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp2
-rw-r--r--src/gpu/GrAADistanceFieldPathRenderer.cpp8
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp6
-rw-r--r--src/gpu/GrAllocator.h6
-rw-r--r--src/gpu/GrAtlas.cpp24
-rw-r--r--src/gpu/GrAtlas.h2
-rw-r--r--src/gpu/GrAtlasTextBlob.h2
-rw-r--r--src/gpu/GrAtlasTextContext.cpp48
-rw-r--r--src/gpu/GrBatchAtlas.cpp12
-rw-r--r--src/gpu/GrBatchAtlas.h2
-rw-r--r--src/gpu/GrBatchFontCache.cpp12
-rw-r--r--src/gpu/GrBatchFontCache.h10
-rw-r--r--src/gpu/GrBlurUtils.cpp14
-rw-r--r--src/gpu/GrBufferedDrawTarget.cpp4
-rw-r--r--src/gpu/GrBufferedDrawTarget.h4
-rw-r--r--src/gpu/GrClipMaskCache.h12
-rw-r--r--src/gpu/GrClipMaskManager.cpp38
-rw-r--r--src/gpu/GrClipMaskManager.h4
-rw-r--r--src/gpu/GrContext.cpp36
-rwxr-xr-xsrc/gpu/GrContextFactory.cpp10
-rw-r--r--src/gpu/GrContextFactory.h4
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.cpp10
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.h4
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp10
-rw-r--r--src/gpu/GrDrawContext.cpp16
-rw-r--r--src/gpu/GrDrawTarget.cpp12
-rw-r--r--src/gpu/GrDrawTarget.h6
-rw-r--r--src/gpu/GrFontScaler.cpp8
-rw-r--r--src/gpu/GrGeometryBuffer.h10
-rw-r--r--src/gpu/GrGlyph.h4
-rw-r--r--src/gpu/GrGpu.cpp22
-rw-r--r--src/gpu/GrGpu.h16
-rw-r--r--src/gpu/GrGpuFactory.cpp4
-rw-r--r--src/gpu/GrGpuResource.cpp8
-rw-r--r--src/gpu/GrGpuResourceRef.cpp10
-rw-r--r--src/gpu/GrInOrderCommandBuilder.cpp4
-rw-r--r--src/gpu/GrLayerCache.cpp28
-rw-r--r--src/gpu/GrLayerCache.h18
-rw-r--r--src/gpu/GrLayerHoister.cpp4
-rw-r--r--src/gpu/GrMemoryPool.cpp12
-rw-r--r--src/gpu/GrOvalRenderer.cpp20
-rw-r--r--src/gpu/GrPathRange.h2
-rw-r--r--src/gpu/GrPathRendererChain.cpp2
-rw-r--r--src/gpu/GrPathRendering.cpp4
-rw-r--r--src/gpu/GrPathUtils.h10
-rw-r--r--src/gpu/GrPendingProgramElement.h2
-rw-r--r--src/gpu/GrPipelineBuilder.cpp2
-rw-r--r--src/gpu/GrPipelineBuilder.h12
-rw-r--r--src/gpu/GrPrimitiveProcessor.h2
-rw-r--r--src/gpu/GrRecordReplaceDraw.cpp8
-rw-r--r--src/gpu/GrReducedClip.cpp2
-rw-r--r--src/gpu/GrReducedClip.h8
-rw-r--r--src/gpu/GrRenderTarget.cpp6
-rw-r--r--src/gpu/GrReorderCommandBuilder.cpp2
-rw-r--r--src/gpu/GrReorderCommandBuilder.h2
-rw-r--r--src/gpu/GrResourceCache.cpp20
-rw-r--r--src/gpu/GrResourceProvider.cpp12
-rw-r--r--src/gpu/GrResourceProvider.h4
-rw-r--r--src/gpu/GrSWMaskHelper.cpp14
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp8
-rw-r--r--src/gpu/GrStencilAndCoverPathRenderer.cpp2
-rw-r--r--src/gpu/GrStencilAndCoverTextContext.cpp24
-rw-r--r--src/gpu/GrStrokeInfo.cpp2
-rw-r--r--src/gpu/GrSurface.cpp4
-rw-r--r--src/gpu/GrTRecorder.h20
-rw-r--r--src/gpu/GrTargetCommands.h2
-rw-r--r--src/gpu/GrTessellatingPathRenderer.cpp150
-rw-r--r--src/gpu/GrTest.cpp14
-rw-r--r--src/gpu/GrTextBlobCache.h4
-rw-r--r--src/gpu/GrTextContext.cpp10
-rw-r--r--src/gpu/GrTextureProvider.cpp18
-rw-r--r--src/gpu/GrVertices.h4
-rw-r--r--src/gpu/SkGpuDevice.cpp88
-rw-r--r--src/gpu/SkGpuDevice.h6
-rw-r--r--src/gpu/SkGr.cpp58
-rw-r--r--src/gpu/SkGrPixelRef.cpp32
-rw-r--r--src/gpu/batches/GrAAFillRectBatch.cpp2
-rw-r--r--src/gpu/batches/GrCopySurfaceBatch.cpp2
-rw-r--r--src/gpu/batches/GrDrawVerticesBatch.cpp4
-rw-r--r--src/gpu/batches/GrVertexBatch.cpp6
-rw-r--r--src/gpu/batches/GrVertexBatch.h2
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp6
-rw-r--r--src/gpu/effects/GrBezierEffect.h18
-rw-r--r--src/gpu/effects/GrBicubicEffect.h4
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp2
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp6
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp14
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.h6
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp4
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp6
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp8
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.cpp10
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp4
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp6
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp14
-rw-r--r--src/gpu/effects/GrRRectEffect.h2
-rw-r--r--src/gpu/effects/GrTextureDomain.h4
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp64
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.h6
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp2
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp38
-rw-r--r--src/gpu/gl/GrGLBufferImpl.cpp36
-rw-r--r--src/gpu/gl/GrGLCaps.cpp12
-rw-r--r--src/gpu/gl/GrGLContext.cpp8
-rw-r--r--src/gpu/gl/GrGLCreateNativeInterface_none.cpp2
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp10
-rw-r--r--src/gpu/gl/GrGLDefaultInterface_none.cpp2
-rw-r--r--src/gpu/gl/GrGLExtensions.cpp8
-rw-r--r--src/gpu/gl/GrGLFragmentProcessor.h2
-rw-r--r--src/gpu/gl/GrGLGpu.cpp68
-rw-r--r--src/gpu/gl/GrGLGpu.h6
-rw-r--r--src/gpu/gl/GrGLGpuProgramCache.cpp16
-rw-r--r--src/gpu/gl/GrGLIndexBuffer.cpp2
-rw-r--r--src/gpu/gl/GrGLInterface.cpp662
-rw-r--r--src/gpu/gl/GrGLNameAllocator.cpp18
-rw-r--r--src/gpu/gl/GrGLNoOpInterface.cpp6
-rw-r--r--src/gpu/gl/GrGLPath.cpp2
-rw-r--r--src/gpu/gl/GrGLPathRange.cpp2
-rw-r--r--src/gpu/gl/GrGLPathRendering.cpp14
-rw-r--r--src/gpu/gl/GrGLUtil.cpp12
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp2
-rw-r--r--src/gpu/gl/GrGLVertexArray.h2
-rw-r--r--src/gpu/gl/GrGLVertexBuffer.cpp2
-rw-r--r--src/gpu/gl/SkGLContext.cpp14
-rw-r--r--src/gpu/gl/SkNullGLContext.cpp16
-rw-r--r--src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp4
-rw-r--r--src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp8
-rw-r--r--src/gpu/gl/angle/SkANGLEGLContext.cpp4
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp18
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h10
-rw-r--r--src/gpu/gl/builders/GrGLShaderBuilder.cpp2
-rw-r--r--src/gpu/gl/builders/GrGLShaderBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp2
-rw-r--r--src/gpu/gl/debug/GrBufferObj.h2
-rw-r--r--src/gpu/gl/debug/GrDebugGL.cpp32
-rw-r--r--src/gpu/gl/debug/GrDebugGL.h4
-rw-r--r--src/gpu/gl/debug/GrFrameBufferObj.h18
-rw-r--r--src/gpu/gl/debug/GrGLCreateDebugInterface.cpp40
-rw-r--r--src/gpu/gl/debug/GrTextureUnitObj.h2
-rw-r--r--src/gpu/gl/debug/SkDebugGLContext.h4
-rw-r--r--src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp4
-rw-r--r--src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp12
-rw-r--r--src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp8
-rw-r--r--src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp12
-rw-r--r--src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp2
-rw-r--r--src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp2
-rw-r--r--src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp16
-rw-r--r--src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp8
-rw-r--r--src/gpu/gl/mesa/SkMesaGLContext.cpp14
-rw-r--r--src/gpu/gl/mesa/SkMesaGLContext.h4
-rw-r--r--src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp2
-rw-r--r--src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp14
-rw-r--r--src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp30
-rw-r--r--src/gpu/glsl/GrGLSL.h2
-rwxr-xr-xsrc/gpu/glsl/GrGLSLCaps.cpp4
-rw-r--r--src/image/SkImage.cpp42
-rw-r--r--src/image/SkImagePriv.h2
-rw-r--r--src/image/SkImage_Base.h10
-rw-r--r--src/image/SkImage_Gpu.cpp26
-rw-r--r--src/image/SkImage_Raster.cpp50
-rw-r--r--src/image/SkSurface.cpp20
-rw-r--r--src/image/SkSurface_Base.h6
-rw-r--r--src/image/SkSurface_Gpu.cpp24
-rw-r--r--src/image/SkSurface_Raster.cpp24
-rw-r--r--src/images/SkDecodingImageGenerator.cpp56
-rw-r--r--src/images/SkImageDecoder.cpp8
-rw-r--r--src/images/SkImageDecoder_FactoryDefault.cpp4
-rw-r--r--src/images/SkImageDecoder_FactoryRegistrar.cpp8
-rw-r--r--src/images/SkImageDecoder_astc.cpp4
-rw-r--r--src/images/SkImageDecoder_ktx.cpp8
-rw-r--r--src/images/SkImageDecoder_libbmp.cpp6
-rw-r--r--src/images/SkImageDecoder_libgif.cpp32
-rw-r--r--src/images/SkImageDecoder_libico.cpp10
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp42
-rw-r--r--src/images/SkImageDecoder_libpng.cpp74
-rw-r--r--src/images/SkImageDecoder_libwebp.cpp24
-rw-r--r--src/images/SkImageDecoder_pkm.cpp4
-rw-r--r--src/images/SkImageDecoder_wbmp.cpp2
-rw-r--r--src/images/SkImageEncoder.cpp8
-rw-r--r--src/images/SkImageEncoder_Factory.cpp6
-rw-r--r--src/images/SkImageEncoder_argb.cpp8
-rw-r--r--src/images/SkJpegUtility.cpp2
-rw-r--r--src/images/SkMovie.cpp2
-rw-r--r--src/images/SkMovie_gif.cpp26
-rw-r--r--src/images/SkScaledBitmapSampler.cpp74
-rw-r--r--src/images/SkScaledBitmapSampler.h4
-rw-r--r--src/images/bmpdecoderhelper.cpp2
-rw-r--r--src/images/bmpdecoderhelper.h2
-rw-r--r--src/lazy/SkCachingPixelRef.cpp10
-rw-r--r--src/lazy/SkDiscardableMemoryPool.cpp28
-rw-r--r--src/lazy/SkDiscardableMemoryPool.h2
-rw-r--r--src/lazy/SkDiscardablePixelRef.cpp22
-rw-r--r--src/opts/SkBitmapProcState_arm_neon.cpp6
-rw-r--r--src/opts/SkBitmapProcState_opts_SSE2.cpp6
-rw-r--r--src/opts/SkBitmapProcState_opts_SSSE3.cpp4
-rw-r--r--src/opts/SkBitmapProcState_opts_mips_dsp.cpp8
-rw-r--r--src/opts/SkBlitMask_opts_arm.cpp2
-rw-r--r--src/opts/SkBlitMask_opts_none.cpp4
-rw-r--r--src/opts/SkBlitRow_opts_arm.cpp8
-rw-r--r--src/opts/SkBlitRow_opts_arm_neon.cpp8
-rw-r--r--src/opts/SkBlitRow_opts_mips_dsp.cpp12
-rw-r--r--src/opts/SkBlitRow_opts_none.cpp8
-rw-r--r--src/opts/SkXfermode_opts.h4
-rw-r--r--src/opts/opts_check_x86.cpp24
-rw-r--r--src/pathops/SkDConicLineIntersection.cpp8
-rw-r--r--src/pathops/SkDCubicLineIntersection.cpp4
-rw-r--r--src/pathops/SkDLineIntersection.cpp8
-rw-r--r--src/pathops/SkDQuadLineIntersection.cpp8
-rw-r--r--src/pathops/SkIntersectionHelper.h4
-rw-r--r--src/pathops/SkOpAngle.cpp12
-rw-r--r--src/pathops/SkOpBuilder.cpp2
-rwxr-xr-xsrc/pathops/SkOpCoincidence.cpp8
-rw-r--r--src/pathops/SkOpCoincidence.h16
-rw-r--r--src/pathops/SkOpContour.cpp4
-rw-r--r--src/pathops/SkOpContour.h22
-rw-r--r--src/pathops/SkOpEdgeBuilder.h2
-rw-r--r--src/pathops/SkOpSegment.cpp98
-rw-r--r--src/pathops/SkOpSegment.h2
-rwxr-xr-xsrc/pathops/SkOpSpan.cpp14
-rw-r--r--src/pathops/SkOpSpan.h8
-rw-r--r--src/pathops/SkPathOpsCommon.cpp14
-rw-r--r--src/pathops/SkPathOpsCurve.h16
-rw-r--r--src/pathops/SkPathOpsDebug.cpp6
-rw-r--r--src/pathops/SkPathOpsOp.cpp8
-rw-r--r--src/pathops/SkPathOpsSimplify.cpp2
-rw-r--r--src/pathops/SkPathOpsTSect.h72
-rw-r--r--src/pathops/SkPathOpsTightBounds.cpp2
-rw-r--r--src/pathops/SkPathOpsWinding.cpp20
-rw-r--r--src/pdf/SkDeflate.cpp4
-rw-r--r--src/pdf/SkJpegInfo.cpp2
-rw-r--r--src/pdf/SkJpegInfo.h2
-rw-r--r--src/pdf/SkPDFBitmap.cpp6
-rw-r--r--src/pdf/SkPDFBitmap.h2
-rw-r--r--src/pdf/SkPDFCanon.cpp10
-rw-r--r--src/pdf/SkPDFCanon.h6
-rw-r--r--src/pdf/SkPDFDevice.cpp124
-rw-r--r--src/pdf/SkPDFDevice.h6
-rw-r--r--src/pdf/SkPDFFont.cpp80
-rw-r--r--src/pdf/SkPDFFont.h6
-rw-r--r--src/pdf/SkPDFFormXObject.cpp4
-rw-r--r--src/pdf/SkPDFGraphicState.cpp4
-rw-r--r--src/pdf/SkPDFResourceDict.h2
-rw-r--r--src/pdf/SkPDFShader.cpp24
-rw-r--r--src/pdf/SkPDFShader.h2
-rw-r--r--src/pipe/SkGPipePriv.h4
-rw-r--r--src/pipe/SkGPipeRead.cpp76
-rw-r--r--src/pipe/SkGPipeWrite.cpp72
-rw-r--r--src/pipe/utils/SamplePipeControllers.cpp8
-rw-r--r--src/pipe/utils/SamplePipeControllers.h6
-rw-r--r--src/ports/SkFontConfigInterface_direct.cpp38
-rw-r--r--src/ports/SkFontConfigTypeface.h2
-rw-r--r--src/ports/SkFontHost_FreeType.cpp94
-rw-r--r--src/ports/SkFontHost_FreeType_common.cpp2
-rw-r--r--src/ports/SkFontHost_fontconfig.cpp10
-rw-r--r--src/ports/SkFontHost_mac.cpp174
-rw-r--r--src/ports/SkFontHost_win.cpp160
-rw-r--r--src/ports/SkFontMgr_android.cpp40
-rw-r--r--src/ports/SkFontMgr_android_factory.cpp8
-rw-r--r--src/ports/SkFontMgr_android_parser.cpp96
-rw-r--r--src/ports/SkFontMgr_android_parser.h2
-rw-r--r--src/ports/SkFontMgr_custom.cpp46
-rw-r--r--src/ports/SkFontMgr_empty_factory.cpp4
-rw-r--r--src/ports/SkFontMgr_fontconfig.cpp48
-rw-r--r--src/ports/SkFontMgr_fontconfig_factory.cpp2
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp74
-rw-r--r--src/ports/SkImageDecoder_CG.cpp32
-rw-r--r--src/ports/SkImageDecoder_WIC.cpp30
-rw-r--r--src/ports/SkImageDecoder_empty.cpp16
-rw-r--r--src/ports/SkImageGenerator_none.cpp2
-rw-r--r--src/ports/SkImageGenerator_skia.cpp10
-rw-r--r--src/ports/SkMemory_malloc.cpp4
-rw-r--r--src/ports/SkOSFile_posix.cpp14
-rw-r--r--src/ports/SkOSFile_stdio.cpp2
-rw-r--r--src/ports/SkOSFile_win.cpp26
-rw-r--r--src/ports/SkRemotableFontMgr_win_dw.cpp46
-rw-r--r--src/ports/SkScalerContext_win_dw.cpp6
-rw-r--r--src/ports/SkTLS_none.cpp2
-rw-r--r--src/ports/SkTLS_pthread.cpp2
-rw-r--r--src/ports/SkTLS_win.cpp6
-rw-r--r--src/ports/SkTime_Unix.cpp2
-rw-r--r--src/ports/SkTypeface_win_dw.cpp16
-rw-r--r--src/ports/SkTypeface_win_dw.h12
-rw-r--r--src/sfnt/SkOTTable_name.cpp2
-rw-r--r--src/sfnt/SkOTUtils.cpp20
-rw-r--r--src/sfnt/SkOTUtils.h4
-rw-r--r--src/svg/SkSVGDevice.cpp14
-rw-r--r--src/svg/SkSVGDevice.h2
-rw-r--r--src/svg/parser/SkSVGClipPath.cpp2
-rw-r--r--src/svg/parser/SkSVGElements.cpp4
-rw-r--r--src/svg/parser/SkSVGGradient.cpp2
-rw-r--r--src/svg/parser/SkSVGGroup.cpp4
-rw-r--r--src/svg/parser/SkSVGPaintState.cpp10
-rw-r--r--src/svg/parser/SkSVGParser.cpp20
-rw-r--r--src/svg/parser/SkSVGPath.cpp2
-rw-r--r--src/utils/SkBase64.cpp4
-rw-r--r--src/utils/SkBase64.h2
-rwxr-xr-xsrc/utils/SkBitSet.cpp8
-rw-r--r--src/utils/SkBoundaryPatch.cpp4
-rw-r--r--src/utils/SkCamera.cpp4
-rw-r--r--src/utils/SkCanvasStateUtils.cpp16
-rw-r--r--src/utils/SkCullPoints.cpp4
-rw-r--r--src/utils/SkDashPath.cpp2
-rw-r--r--src/utils/SkDashPathPriv.h4
-rw-r--r--src/utils/SkDumpCanvas.cpp26
-rw-r--r--src/utils/SkFrontBufferedStream.cpp22
-rw-r--r--src/utils/SkInterpolator.cpp20
-rw-r--r--src/utils/SkLayer.cpp16
-rw-r--r--src/utils/SkLua.cpp94
-rw-r--r--src/utils/SkMeshUtils.cpp10
-rw-r--r--src/utils/SkNinePatch.cpp6
-rw-r--r--src/utils/SkOSFile.cpp4
-rw-r--r--src/utils/SkParse.cpp18
-rw-r--r--src/utils/SkParseColor.cpp22
-rw-r--r--src/utils/SkParsePath.cpp2
-rw-r--r--src/utils/SkPatchGrid.cpp22
-rw-r--r--src/utils/SkPatchGrid.h6
-rw-r--r--src/utils/SkPatchUtils.cpp2
-rw-r--r--src/utils/SkPatchUtils.h8
-rw-r--r--src/utils/SkRTConf.cpp6
-rw-r--r--src/utils/SkTextBox.cpp2
-rw-r--r--src/utils/SkTextureCompressor.cpp10
-rw-r--r--src/utils/SkTextureCompressor.h2
-rw-r--r--src/utils/SkTextureCompressor_ASTC.cpp4
-rw-r--r--src/utils/SkTextureCompressor_Blitter.h4
-rw-r--r--src/utils/SkTextureCompressor_LATC.cpp4
-rw-r--r--src/utils/SkTextureCompressor_R11EAC.cpp2
-rw-r--r--src/utils/SkThreadUtils.h2
-rw-r--r--src/utils/SkThreadUtils_pthread.cpp10
-rw-r--r--src/utils/SkThreadUtils_win.cpp20
-rw-r--r--src/utils/android/SkAndroidSDKCanvas.cpp20
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp12
-rw-r--r--src/utils/debugger/SkDrawCommand.cpp24
-rw-r--r--src/utils/debugger/SkDrawCommand.h2
-rw-r--r--src/utils/debugger/SkObjectParser.cpp8
-rw-r--r--src/utils/debugger/SkObjectParser.h4
-rw-r--r--src/utils/mac/SkCreateCGImageRef.cpp20
-rw-r--r--src/utils/win/SkAutoCoInitialize.cpp2
-rw-r--r--src/utils/win/SkDWrite.cpp8
-rw-r--r--src/utils/win/SkDWriteFontFileStream.cpp20
-rw-r--r--src/utils/win/SkDWriteGeometrySink.cpp4
-rw-r--r--src/utils/win/SkHRESULT.cpp10
-rw-r--r--src/utils/win/SkIStream.cpp10
-rw-r--r--src/utils/win/SkWGL_win.cpp66
-rw-r--r--src/views/SkEvent.cpp42
-rw-r--r--src/views/SkEventSink.cpp18
-rw-r--r--src/views/SkOSMenu.cpp10
-rw-r--r--src/views/SkParsePaint.cpp16
-rw-r--r--src/views/SkProgressView.cpp22
-rw-r--r--src/views/SkStackViewLayout.cpp8
-rw-r--r--src/views/SkTagList.cpp6
-rw-r--r--src/views/SkTagList.h2
-rw-r--r--src/views/SkView.cpp118
-rw-r--r--src/views/SkViewInflate.cpp18
-rw-r--r--src/views/SkViewPriv.cpp12
-rw-r--r--src/views/SkWidgets.cpp28
-rw-r--r--src/views/SkWindow.cpp18
-rw-r--r--src/views/animated/SkBorderView.cpp4
-rw-r--r--src/views/animated/SkImageView.cpp20
-rw-r--r--src/views/animated/SkProgressBarView.cpp4
-rw-r--r--src/views/animated/SkScrollBarView.cpp4
-rw-r--r--src/views/animated/SkStaticTextView.cpp14
-rw-r--r--src/views/animated/SkWidgetViews.cpp20
-rw-r--r--src/views/sdl/SkOSWindow_SDL.cpp14
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp58
-rw-r--r--src/views/unix/skia_unix.cpp2
-rw-r--r--src/xml/SkBML_XMLParser.cpp2
-rw-r--r--src/xml/SkDOM.cpp50
-rw-r--r--src/xml/SkXMLParser.cpp2
-rw-r--r--src/xml/SkXMLPullParser.cpp10
-rw-r--r--src/xml/SkXMLWriter.cpp8
-rw-r--r--tests/AAClipTest.cpp12
-rw-r--r--tests/AsADashTest.cpp2
-rw-r--r--tests/BitmapCopyTest.cpp12
-rw-r--r--tests/BitmapTest.cpp8
-rw-r--r--tests/BlitRowTest.cpp2
-rw-r--r--tests/BlurTest.cpp10
-rw-r--r--tests/CTest.cpp14
-rw-r--r--tests/CachedDataTest.cpp4
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp40
-rw-r--r--tests/CanvasStateTest.cpp16
-rw-r--r--tests/CanvasTest.cpp20
-rw-r--r--tests/ChecksumTest.cpp4
-rw-r--r--tests/ClipCacheTest.cpp12
-rw-r--r--tests/ClipStackTest.cpp12
-rw-r--r--tests/CodexTest.cpp24
-rw-r--r--tests/ColorFilterTest.cpp8
-rw-r--r--tests/DashPathEffectTest.cpp4
-rw-r--r--tests/DataRefTest.cpp16
-rw-r--r--tests/DequeTest.cpp4
-rw-r--r--tests/DiscardableMemoryPoolTest.cpp4
-rw-r--r--tests/DiscardableMemoryTest.cpp6
-rw-r--r--tests/DrawBitmapRectTest.cpp6
-rw-r--r--tests/DrawFilterTest.cpp6
-rw-r--r--tests/DrawPathTest.cpp2
-rw-r--r--tests/DynamicHashTest.cpp24
-rw-r--r--tests/FloatingPointTextureTest.cpp4
-rw-r--r--tests/FontHostStreamTest.cpp2
-rw-r--r--tests/FontHostTest.cpp6
-rw-r--r--tests/FontMgrAndroidParserTest.cpp2
-rw-r--r--tests/FontMgrTest.cpp4
-rw-r--r--tests/FontObjTest.cpp2
-rwxr-xr-xtests/GLInterfaceValidationTest.cpp2
-rw-r--r--tests/GLProgramsTest.cpp6
-rw-r--r--tests/GeometryTest.cpp12
-rw-r--r--tests/GpuColorFilterTest.cpp2
-rw-r--r--tests/GpuDrawPathTest.cpp6
-rw-r--r--tests/GpuLayerCacheTest.cpp16
-rw-r--r--tests/GrContextFactoryTest.cpp8
-rw-r--r--tests/GrDrawTargetTest.cpp2
-rw-r--r--tests/GrGLSLPrettyPrintTest.cpp4
-rw-r--r--tests/GrMemoryPoolTest.cpp4
-rw-r--r--tests/GrPorterDuffTest.cpp32
-rw-r--r--tests/GrSurfaceTest.cpp6
-rw-r--r--tests/GrTextureMipMapInvalidationTest.cpp10
-rw-r--r--tests/GradientTest.cpp8
-rw-r--r--tests/HashTest.cpp2
-rw-r--r--tests/ImageCacheTest.cpp4
-rw-r--r--tests/ImageDecodingTest.cpp30
-rw-r--r--tests/ImageFilterTest.cpp104
-rw-r--r--tests/ImageGeneratorTest.cpp18
-rw-r--r--tests/ImageIsOpaqueTest.cpp2
-rw-r--r--tests/ImageNewShaderTest.cpp2
-rw-r--r--tests/ImageTest.cpp4
-rw-r--r--tests/IndexedPngOverflowTest.cpp2
-rw-r--r--tests/JpegTest.cpp4
-rw-r--r--tests/KtxTest.cpp6
-rw-r--r--tests/LListTest.cpp12
-rw-r--r--tests/LayerRasterizerTest.cpp12
-rw-r--r--tests/MallocPixelRefTest.cpp42
-rw-r--r--tests/MaskCacheTest.cpp6
-rw-r--r--tests/Matrix44Test.cpp16
-rw-r--r--tests/MatrixClipCollapseTest.cpp28
-rw-r--r--tests/MatrixTest.cpp14
-rw-r--r--tests/MemsetTest.cpp2
-rw-r--r--tests/MetaDataTest.cpp2
-rw-r--r--tests/MipMapTest.cpp8
-rw-r--r--tests/OSPathTest.cpp8
-rw-r--r--tests/PDFDeflateWStreamTest.cpp12
-rw-r--r--tests/PDFDocumentTest.cpp2
-rw-r--r--tests/PDFGlyphsToUnicodeTest.cpp2
-rw-r--r--tests/PDFJpegEmbedTest.cpp6
-rw-r--r--tests/PDFPrimitivesTest.cpp4
-rw-r--r--tests/PaintTest.cpp4
-rwxr-xr-xtests/PathOpsAngleIdeas.cpp2
-rw-r--r--tests/PathOpsAngleTest.cpp4
-rw-r--r--tests/PathOpsBattles.cpp2
-rw-r--r--tests/PathOpsBuildUseTest.cpp2
-rw-r--r--tests/PathOpsBuilderTest.cpp6
-rwxr-xr-xtests/PathOpsDebug.cpp12
-rw-r--r--tests/PathOpsExtendedTest.cpp14
-rw-r--r--tests/PathOpsOpTest.cpp6
-rw-r--r--tests/PathOpsSimplifyTest.cpp4
-rw-r--r--tests/PathOpsSkpClipTest.cpp20
-rw-r--r--tests/PathOpsTSectDebug.h8
-rw-r--r--tests/PathTest.cpp100
-rw-r--r--tests/PictureBBHTest.cpp2
-rw-r--r--tests/PictureShaderTest.cpp8
-rw-r--r--tests/PictureTest.cpp66
-rw-r--r--tests/PixelRefTest.cpp16
-rw-r--r--tests/PointTest.cpp2
-rw-r--r--tests/PremulAlphaRoundTripTest.cpp2
-rw-r--r--tests/QuickRejectTest.cpp2
-rw-r--r--tests/ReadPixelsTest.cpp2
-rw-r--r--tests/ReadWriteAlphaTest.cpp2
-rw-r--r--tests/Reader32Test.cpp10
-rw-r--r--tests/RecordDrawTest.cpp14
-rw-r--r--tests/RecordOptsTest.cpp40
-rw-r--r--tests/RecordPatternTest.cpp8
-rw-r--r--tests/RecordReplaceDrawTest.cpp14
-rw-r--r--tests/RecordTestUtils.h4
-rw-r--r--tests/RecordingXfermodeTest.cpp4
-rw-r--r--tests/RefDictTest.cpp16
-rw-r--r--tests/RegionTest.cpp2
-rw-r--r--tests/ResourceCacheTest.cpp44
-rw-r--r--tests/SVGDeviceTest.cpp16
-rw-r--r--tests/SerializationTest.cpp16
-rw-r--r--tests/SkBase64Test.cpp2
-rw-r--r--tests/SkImageTest.cpp2
-rw-r--r--tests/SkResourceCacheTest.cpp4
-rw-r--r--tests/SkpSkGrTest.cpp6
-rw-r--r--tests/SmallAllocatorTest.cpp4
-rw-r--r--tests/StreamTest.cpp10
-rw-r--r--tests/StringTest.cpp2
-rw-r--r--tests/SurfaceTest.cpp82
-rw-r--r--tests/SwizzlerTest.cpp6
-rw-r--r--tests/TLSTest.cpp2
-rw-r--r--tests/TessellatingPathRendererTests.cpp2
-rw-r--r--tests/Test.cpp4
-rw-r--r--tests/TextBlobCacheTest.cpp4
-rw-r--r--tests/TextBlobTest.cpp4
-rw-r--r--tests/TextureCompressionTest.cpp14
-rw-r--r--tests/TypefaceTest.cpp4
-rw-r--r--tests/UtilsTest.cpp4
-rw-r--r--tests/WArrayTest.cpp30
-rw-r--r--tests/WritePixelsTest.cpp12
-rw-r--r--tests/Writer32Test.cpp6
-rw-r--r--tests/XfermodeTest.cpp4
-rw-r--r--tests/YUVCacheTest.cpp4
-rw-r--r--tests/skia_test.cpp4
-rw-r--r--tools/CopyTilesRenderer.cpp2
-rw-r--r--tools/CrashHandler.cpp4
-rw-r--r--tools/DumpRecord.cpp2
-rw-r--r--tools/LazyDecodeBitmap.cpp8
-rw-r--r--tools/PictureBenchmark.cpp22
-rw-r--r--tools/PictureRenderer.cpp62
-rw-r--r--tools/PictureRenderer.h30
-rw-r--r--tools/PictureRenderingFlags.cpp52
-rw-r--r--tools/PictureRenderingFlags.h2
-rw-r--r--tools/PictureResultsWriter.h2
-rw-r--r--tools/Resources.cpp4
-rw-r--r--tools/VisualBench/VisualBench.cpp8
-rw-r--r--tools/VisualBench/VisualBenchmarkStream.cpp16
-rw-r--r--tools/bench_pictures_main.cpp6
-rw-r--r--tools/chrome_fuzz.cpp2
-rw-r--r--tools/create_test_font.cpp4
-rw-r--r--tools/filtermain.cpp42
-rw-r--r--tools/flags/SkCommandLineFlags.cpp10
-rw-r--r--tools/flags/SkCommandLineFlags.h18
-rw-r--r--tools/flags/SkCommonFlags.cpp2
-rw-r--r--tools/gpuveto.cpp6
-rw-r--r--tools/image_expectations.cpp10
-rw-r--r--tools/image_expectations.h8
-rw-r--r--tools/lua/lua_app.cpp2
-rw-r--r--tools/lua/lua_pictures.cpp4
-rw-r--r--tools/picture_utils.cpp4
-rw-r--r--tools/picture_utils.h2
-rw-r--r--tools/pinspect.cpp8
-rw-r--r--tools/render_pdfs_main.cpp6
-rw-r--r--tools/render_pictures_main.cpp38
-rw-r--r--tools/sk_tool_utils.cpp6
-rw-r--r--tools/sk_tool_utils.h2
-rw-r--r--tools/sk_tool_utils_font.cpp2
-rw-r--r--tools/skdiff_image.cpp8
-rw-r--r--tools/skdiff_main.cpp18
-rw-r--r--tools/skdiff_utils.cpp4
-rw-r--r--tools/skdiff_utils.h4
-rw-r--r--tools/skhello.cpp4
-rw-r--r--tools/skpdiff/SkCLImageDiffer.cpp6
-rw-r--r--tools/skpdiff/SkDiffContext.cpp4
-rw-r--r--tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp8
-rw-r--r--tools/skpdiff/skpdiff_main.cpp4
-rw-r--r--tools/skpdiff/skpdiff_util.cpp14
-rw-r--r--tools/skpmaker.cpp2
-rw-r--r--tools/test_font_data.cpp28
-rw-r--r--tools/test_font_index.cpp24
-rw-r--r--tools/timer/Timer.h2
-rw-r--r--tools/timer/TimerData.cpp2
-rw-r--r--tools/win_dbghelp.cpp10
-rw-r--r--tools/win_lcid.cpp10
1145 files changed, 7454 insertions, 7440 deletions
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index 08a28ea3dc..af06c4b357 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -95,7 +95,7 @@ public:
AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType)
- : fBmShader(NULL) {
+ : fBmShader(nullptr) {
fPattern1 = gColorPatterns[pattern1];
fPattern2 = gColorPatterns[pattern2];
fName.printf("colorPattern_%s_%s_%s",
@@ -137,10 +137,10 @@ protected:
}
if (0 == count % 2) {
fColors[count] = fPattern1.fColor;
- fShaders[count] = fPattern1.fIsBitmap ? fBmShader : NULL;
+ fShaders[count] = fPattern1.fIsBitmap ? fBmShader : nullptr;
} else {
fColors[count] = fPattern2.fColor;
- fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL;
+ fShaders[count] = fPattern2.fIsBitmap ? fBmShader : nullptr;
}
++count;
}
diff --git a/bench/BenchLogger.cpp b/bench/BenchLogger.cpp
index 5e7455238a..7eae514b17 100644
--- a/bench/BenchLogger.cpp
+++ b/bench/BenchLogger.cpp
@@ -10,7 +10,7 @@
#include "SkStream.h"
BenchLogger::BenchLogger()
-: fFileStream(NULL) {}
+: fFileStream(nullptr) {}
BenchLogger::~BenchLogger() {
if (fFileStream) {
diff --git a/bench/BezierBench.cpp b/bench/BezierBench.cpp
index 73c9cb5b2c..d4fdf0f7e5 100755
--- a/bench/BezierBench.cpp
+++ b/bench/BezierBench.cpp
@@ -64,7 +64,7 @@ public:
fJoin = j;
fProc = proc;
fWidth = SkIntToScalar(w);
- fName.printf("draw_stroke_bezier_%s_%s_%s_%g", proc(NULL, 0), gCapName[c], gJoinName[j], w);
+ fName.printf("draw_stroke_bezier_%s_%s_%s_%g", proc(nullptr, 0), gCapName[c], gJoinName[j], w);
fRec.fQuad.moveTo(20, 20);
fRec.fQuad.quadTo(60, 20, 60, 60);
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp
index 718f7ac86f..8176f38891 100644
--- a/bench/BitmapBench.cpp
+++ b/bench/BitmapBench.cpp
@@ -46,7 +46,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst, SkAlphaType aT
}
SkColorTable* ctable = new SkColorTable(storage, 216);
dst->allocPixels(SkImageInfo::Make(src.width(), src.height(), kIndex_8_SkColorType, aType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
SkAutoLockPixels alps(src);
diff --git a/bench/BlurImageFilterBench.cpp b/bench/BlurImageFilterBench.cpp
index ec8b9ef59d..8bfd005f44 100644
--- a/bench/BlurImageFilterBench.cpp
+++ b/bench/BlurImageFilterBench.cpp
@@ -51,9 +51,9 @@ protected:
SkIntToScalar(fCheckerboard.height()));
const SkImageFilter::CropRect cropRect =
SkImageFilter::CropRect(bmpRect.makeInset(10.f, 10.f));
- const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : NULL;
+ const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : nullptr;
- paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, NULL, crop))->unref();
+ paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, nullptr, crop))->unref();
for (int i = 0; i < loops; i++) {
canvas->drawBitmap(fCheckerboard, kX, kY, &paint);
diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp
index 8f8a2de25b..890a79e673 100644
--- a/bench/BlurRectBench.cpp
+++ b/bench/BlurRectBench.cpp
@@ -102,7 +102,7 @@ class BlurRectSeparableBench: public BlurRectBench {
public:
BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
- fSrcMask.fImage = NULL;
+ fSrcMask.fImage = nullptr;
}
~BlurRectSeparableBench() {
@@ -144,7 +144,7 @@ protected:
void makeBlurryRect(const SkRect&) override {
SkMask mask;
- mask.fImage = NULL;
+ mask.fImage = nullptr;
SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
kNormal_SkBlurStyle, kHigh_SkBlurQuality);
SkMask::FreeImage(mask.fImage);
@@ -171,7 +171,7 @@ protected:
void makeBlurryRect(const SkRect&) override {
SkMask mask;
- mask.fImage = NULL;
+ mask.fImage = nullptr;
SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
&mask, fSrcMask, kNormal_SkBlurStyle);
SkMask::FreeImage(mask.fImage);
diff --git a/bench/ChartBench.cpp b/bench/ChartBench.cpp
index 61f97a2f2a..8b3aa73cff 100644
--- a/bench/ChartBench.cpp
+++ b/bench/ChartBench.cpp
@@ -29,7 +29,7 @@ static void gen_data(SkScalar yAvg, SkScalar ySpread, int count,
// Generates a path to stroke along the top of each plot and a fill path for the area below each
// plot. The fill path is bounded below by the bottomData plot points or a horizontal line at
-// yBase if bottomData == NULL.
+// yBase if bottomData == nullptr.
// The plots are animated by rotating the data points by leftShift.
static void gen_paths(const SkTDArray<SkScalar>& topData,
const SkTDArray<SkScalar>* bottomData,
@@ -40,7 +40,7 @@ static void gen_paths(const SkTDArray<SkScalar>& topData,
plot->rewind();
fill->rewind();
plot->incReserve(topData.count());
- if (NULL == bottomData) {
+ if (nullptr == bottomData) {
fill->incReserve(topData.count() + 2);
} else {
fill->incReserve(2 * topData.count());
@@ -149,7 +149,7 @@ protected:
fillPaint.setAntiAlias(fAA);
fillPaint.setStyle(SkPaint::kFill_Style);
- SkTDArray<SkScalar>* prevData = NULL;
+ SkTDArray<SkScalar>* prevData = nullptr;
for (int i = 0; i < kNumGraphs; ++i) {
gen_paths(fData[i],
prevData,
diff --git a/bench/CmapBench.cpp b/bench/CmapBench.cpp
index 10591ed410..5bec50652e 100644
--- a/bench/CmapBench.cpp
+++ b/bench/CmapBench.cpp
@@ -58,7 +58,7 @@ static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void*
SkTypeface* face = paint.getTypeface();
for (int i = 0; i < loops; ++i) {
- face->charsToGlyphs(text, encoding, NULL, glyphCount);
+ face->charsToGlyphs(text, encoding, nullptr, glyphCount);
}
}
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp
index 903b7336c8..1e6b5207bf 100644
--- a/bench/CodecBench.cpp
+++ b/bench/CodecBench.cpp
@@ -72,7 +72,7 @@ void CodecBench::onDraw(const int n, SkCanvas* canvas) {
const SkCodec::Result result =
#endif
codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(),
- NULL, colorTable, &colorCount);
+ nullptr, colorTable, &colorCount);
SkASSERT(result == SkCodec::kSuccess
|| result == SkCodec::kIncompleteInput);
}
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
index 9326a123c3..65270a85a3 100644
--- a/bench/ColorCubeBench.cpp
+++ b/bench/ColorCubeBench.cpp
@@ -18,7 +18,7 @@ class ColorCubeBench : public Benchmark {
public:
ColorCubeBench()
: fCubeDimension(0)
- , fCubeData(NULL) {
+ , fCubeData(nullptr) {
fSize = SkISize::Make(2880, 1800); // 2014 Macbook Pro resolution
}
@@ -54,7 +54,7 @@ private:
};
static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE };
return SkGradientShader::CreateLinear(
- pts, colors, NULL, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
+ pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
}
void make_bitmap() {
diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp
index 4f7f1517dd..3c4ddd86e5 100644
--- a/bench/ColorFilterBench.cpp
+++ b/bench/ColorFilterBench.cpp
@@ -28,7 +28,7 @@ protected:
SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARGE);
}
- static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) {
+ static SkImageFilter* make_brightness(float amount, SkImageFilter* input = nullptr) {
SkScalar amount255 = SkScalarMul(amount, SkIntToScalar(255));
SkScalar matrix[20] = { 1, 0, 0, 0, amount255,
0, 1, 0, 0, amount255,
@@ -38,7 +38,7 @@ protected:
return SkColorFilterImageFilter::Create(filter, input);
}
- static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
+ static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) {
SkScalar matrix[20];
memset(matrix, 0, 20 * sizeof(SkScalar));
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
@@ -49,7 +49,7 @@ protected:
return SkColorFilterImageFilter::Create(filter, input);
}
- static SkImageFilter* make_mode_blue(SkImageFilter* input = NULL) {
+ static SkImageFilter* make_mode_blue(SkImageFilter* input = nullptr) {
SkAutoTUnref<SkColorFilter> filter(
SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
return SkColorFilterImageFilter::Create(filter, input);
diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp
index e54d038768..2653cdc992 100644
--- a/bench/DashBench.cpp
+++ b/bench/DashBench.cpp
@@ -119,7 +119,7 @@ protected:
SkPaint p(paint);
p.setStyle(SkPaint::kFill_Style);
- p.setPathEffect(NULL);
+ p.setPathEffect(nullptr);
int count = SkScalarRoundToInt((pts[1].fX - pts[0].fX) / (2*fWidth));
SkScalar dx = SkIntToScalar(2 * fWidth);
@@ -198,7 +198,7 @@ protected:
for (int i = 0; i < loops; ++i) {
SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);
- fPE->filterPath(&dst, fPath, &rec, NULL);
+ fPE->filterPath(&dst, fPath, &rec, nullptr);
dst.rewind();
}
}
diff --git a/bench/DecodingBench.cpp b/bench/DecodingBench.cpp
index 6cf3c3aed7..421cabe34a 100644
--- a/bench/DecodingBench.cpp
+++ b/bench/DecodingBench.cpp
@@ -45,7 +45,7 @@ DecodingBench::DecodingBench(SkString path, SkColorType colorType)
// Ensure that we can create a decoder.
SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData));
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
- SkASSERT(decoder != NULL);
+ SkASSERT(decoder != nullptr);
#endif
}
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp
index 1cc61e6157..5d72bf4c68 100644
--- a/bench/ETCBitmapBench.cpp
+++ b/bench/ETCBitmapBench.cpp
@@ -19,14 +19,14 @@
#include "etc1.h"
// 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.
+// dimension. The return value is the new data or nullptr on error.
static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
SkASSERT(orig);
SkASSERT(factor > 1);
const etc1_byte* origData = reinterpret_cast<const etc1_byte*>(orig);
if (!etc1_pkm_is_valid(orig)) {
- return NULL;
+ return nullptr;
}
etc1_uint32 origWidth = etc1_pkm_get_width(origData);
@@ -37,12 +37,12 @@ static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
static const etc1_uint32 kETC1BlockHeight = 4;
if ((origWidth % kETC1BlockWidth) != 0 ||
(origHeight % kETC1BlockHeight) != 0) {
- return NULL;
+ return nullptr;
}
// The picture must be at least as large as a block.
if (origWidth <= kETC1BlockWidth || origHeight <= kETC1BlockHeight) {
- return NULL;
+ return nullptr;
}
etc1_uint32 newWidth = origWidth * factor;
@@ -80,7 +80,7 @@ static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) {
class ETCBitmapBenchBase : public Benchmark {
public:
ETCBitmapBenchBase() : fPKMData(loadPKM()) {
- if (NULL == fPKMData) {
+ if (nullptr == fPKMData) {
SkDebugf("Could not load PKM data!");
}
}
@@ -93,17 +93,17 @@ private:
SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
// Expand the data
SkAutoDataUnref fileData(SkData::NewFromFileName(pkmFilename.c_str()));
- if (NULL == fileData) {
+ if (nullptr == fileData) {
SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n");
- return NULL;
+ return nullptr;
}
const etc1_uint32 kExpansionFactor = 8;
etc1_byte* expandedETC1 =
create_expanded_etc1_bitmap(fileData->bytes(), kExpansionFactor);
- if (NULL == expandedETC1) {
+ if (nullptr == expandedETC1) {
SkDebugf("Error expanding ETC1 data by factor of %d\n", kExpansionFactor);
- return NULL;
+ return nullptr;
}
etc1_uint32 width = etc1_pkm_get_width(expandedETC1);
@@ -145,7 +145,7 @@ protected:
}
void onPreDraw() override {
- if (NULL == fPKMData) {
+ if (nullptr == fPKMData) {
SkDebugf("Failed to load PKM data!\n");
return;
}
@@ -164,7 +164,7 @@ protected:
void onDraw(const int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops; ++i) {
- canvas->drawBitmap(this->fBitmap, 0, 0, NULL);
+ canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
}
}
@@ -210,7 +210,7 @@ protected:
if (pr) {
pr->notifyPixelsChanged();
}
- canvas->drawBitmap(this->fBitmap, 0, 0, NULL);
+ canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
}
}
diff --git a/bench/FontCacheBench.cpp b/bench/FontCacheBench.cpp
index 304d8d3c88..35bb329e9e 100644
--- a/bench/FontCacheBench.cpp
+++ b/bench/FontCacheBench.cpp
@@ -99,7 +99,7 @@ static void dump_array(const uint16_t array[], int count) {
class FontCacheEfficiency : public Benchmark {
public:
FontCacheEfficiency() {
- if (false) dump_array(NULL, 0);
+ if (false) dump_array(nullptr, 0);
if (false) rotr(0, 0);
}
diff --git a/bench/GLBench.cpp b/bench/GLBench.cpp
index 0252c26b37..531bf88b55 100644
--- a/bench/GLBench.cpp
+++ b/bench/GLBench.cpp
@@ -13,20 +13,20 @@
const GrGLContext* GLBench::getGLContext(SkCanvas* canvas) {
// This bench exclusively tests GL calls directly
- if (NULL == canvas->getGrContext()) {
- return NULL;
+ if (nullptr == canvas->getGrContext()) {
+ return nullptr;
}
GrContext* context = canvas->getGrContext();
GrGpu* gpu = context->getGpu();
if (!gpu) {
SkDebugf("Couldn't get Gr gpu.");
- return NULL;
+ return nullptr;
}
const GrGLContext* ctx = gpu->glContextForTesting();
if (!ctx) {
SkDebugf("Couldn't get an interface\n");
- return NULL;
+ return nullptr;
}
return this->onGetGLContext(ctx);
@@ -64,7 +64,7 @@ GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GR_GL_CALL_RET(gl, shader, CreateShader(type));
// Load the shader source
- GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, NULL));
+ GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr));
// Compile the shader
GR_GL_CALL(gl, CompileShader(shader));
@@ -74,7 +74,7 @@ GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc,
GrGLchar infoLog[512];
GR_GL_CALL(gl, GetShaderiv(shader, GR_GL_COMPILE_STATUS, &success));
if (!success) {
- GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, NULL, infoLog));
+ GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, nullptr, infoLog));
SkDebugf("ERROR::SHADER::COMPLIATION_FAILED: %s\n", infoLog);
}
@@ -97,7 +97,7 @@ GrGLuint GLBench::CreateProgram(const GrGLInterface* gl, const char* vshader, co
GrGLchar infoLog[512];
GR_GL_CALL(gl, GetProgramiv(shaderProgram, GR_GL_LINK_STATUS, &success));
if (!success) {
- GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, NULL, infoLog));
+ GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, nullptr, infoLog));
SkDebugf("Linker Error: %s\n", infoLog);
}
GR_GL_CALL(gl, DeleteShader(vertexShader));
@@ -124,7 +124,7 @@ GrGLuint GLBench::SetupFramebuffer(const GrGLInterface* gl, int screenWidth, int
0, //border
GR_GL_RGBA, //format
GR_GL_UNSIGNED_BYTE, // type
- NULL));
+ nullptr));
// bind framebuffer
GrGLuint framebuffer;
diff --git a/bench/GLInstancedArraysBench.cpp b/bench/GLInstancedArraysBench.cpp
index 8ffbaf03fe..5cb4c069ab 100644
--- a/bench/GLInstancedArraysBench.cpp
+++ b/bench/GLInstancedArraysBench.cpp
@@ -172,7 +172,7 @@ static void setup_matrices(int numQuads, Func f) {
const GrGLContext* GLCpuPosInstancedArraysBench::onGetGLContext(const GrGLContext* ctx) {
// We only care about gpus with drawArraysInstanced support
if (!ctx->interface()->fFunctions.fDrawArraysInstanced) {
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/bench/GLVec4ScalarBench.cpp b/bench/GLVec4ScalarBench.cpp
index e8c40f429d..bbd282e43e 100644
--- a/bench/GLVec4ScalarBench.cpp
+++ b/bench/GLVec4ScalarBench.cpp
@@ -246,7 +246,7 @@ void GLVec4ScalarBench::setupSingleVbo(const GrGLInterface* gl, const SkMatrix*
void GLVec4ScalarBench::setup(const GrGLContext* ctx) {
const GrGLInterface* gl = ctx->interface();
if (!gl) {
- SkFAIL("GL interface is NULL in setup()!\n");
+ SkFAIL("GL interface is nullptr in setup()!\n");
}
fFboTextureId = SetupFramebuffer(gl, kScreenWidth, kScreenHeight);
diff --git a/bench/GameBench.cpp b/bench/GameBench.cpp
index 631a8f25f0..b99440043c 100644
--- a/bench/GameBench.cpp
+++ b/bench/GameBench.cpp
@@ -201,7 +201,7 @@ protected:
{ SkIntToScalar(src.fRight), SkIntToScalar(src.fBottom) },
};
canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
- 4, verts, uvs, NULL, NULL,
+ 4, verts, uvs, nullptr, nullptr,
indices, 6, p2);
} else {
canvas->drawBitmapRect(fAtlas, src, dst, &p,
diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp
index 6cd9ca2377..99d39dd740 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -185,10 +185,10 @@ protected:
void onDraw(const int loops, SkCanvas* canvas) override {
SkPoint result;
for (int outer = 0; outer < loops; ++outer) {
- SkEvalQuadAt(fPts, 0.5f, NULL, &result);
- SkEvalQuadAt(fPts, 0.5f, NULL, &result);
- SkEvalQuadAt(fPts, 0.5f, NULL, &result);
- SkEvalQuadAt(fPts, 0.5f, NULL, &result);
+ SkEvalQuadAt(fPts, 0.5f, nullptr, &result);
+ SkEvalQuadAt(fPts, 0.5f, nullptr, &result);
+ SkEvalQuadAt(fPts, 0.5f, nullptr, &result);
+ SkEvalQuadAt(fPts, 0.5f, nullptr, &result);
}
}
};
diff --git a/bench/GrMemoryPoolBench.cpp b/bench/GrMemoryPoolBench.cpp
index 394577498f..fd29775307 100644
--- a/bench/GrMemoryPoolBench.cpp
+++ b/bench/GrMemoryPoolBench.cpp
@@ -114,7 +114,7 @@ protected:
for (int i = 0; i < loops; i++) {
uint32_t idx = r.nextRangeU(0, kMaxObjects-1);
- if (NULL == objects[idx].get()) {
+ if (nullptr == objects[idx].get()) {
objects[idx].reset(new B);
} else {
objects[idx].free();
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index e7a9ca8c8f..ec2f8cabdb 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -71,7 +71,7 @@ protected:
void onDraw(const int loops, SkCanvas* canvas) override {
SkAutoTUnref<GrContext> context(GrContext::CreateMockContext());
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
// Set the cache budget to be very large so no purging occurs.
diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp
index 21b73708d1..705099db1c 100644
--- a/bench/GradientBench.cpp
+++ b/bench/GradientBench.cpp
@@ -39,10 +39,10 @@ static const SkColor gShallowColors[] = { 0xFF555555, 0xFF444444 };
// We have several special-cases depending on the number (and spacing) of colors, so
// try to exercise those here.
static const GradData gGradData[] = {
- { 2, gColors, NULL, "" },
- { 50, gColors, NULL, "_hicolor" }, // many color gradient
- { 3, gColors, NULL, "_3color" },
- { 2, gShallowColors, NULL, "_shallow" },
+ { 2, gColors, nullptr, "" },
+ { 50, gColors, nullptr, "_hicolor" }, // many color gradient
+ { 3, gColors, nullptr, "_3color" },
+ { 2, gShallowColors, nullptr, "_shallow" },
};
/// Ignores scale
@@ -354,7 +354,7 @@ protected:
SK_ColorBLACK,
SkColorSetARGB(alpha, gray, gray, gray),
SK_ColorWHITE };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL,
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
paint.setShader(s)->unref();
diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp
index 4d71cf0190..fe11868523 100644
--- a/bench/ImageCacheBench.cpp
+++ b/bench/ImageCacheBench.cpp
@@ -27,7 +27,7 @@ struct TestRec : public SkResourceCache::Rec {
const Key& getKey() const override { return fKey; }
size_t bytesUsed() const override { return sizeof(fKey) + sizeof(fValue); }
const char* getCategory() const override { return "imagecachebench-test"; }
- SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return NULL; }
+ SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return nullptr; }
static bool Visitor(const SkResourceCache::Rec&, void*) {
return true;
@@ -63,7 +63,7 @@ protected:
TestKey key(-1);
// search for a miss (-1)
for (int i = 0; i < loops; ++i) {
- SkDEBUGCODE(bool found =) fCache.find(key, TestRec::Visitor, NULL);
+ SkDEBUGCODE(bool found =) fCache.find(key, TestRec::Visitor, nullptr);
SkASSERT(!found);
}
}
diff --git a/bench/ImageFilterCollapse.cpp b/bench/ImageFilterCollapse.cpp
index c631c99262..4024750dc3 100644
--- a/bench/ImageFilterCollapse.cpp
+++ b/bench/ImageFilterCollapse.cpp
@@ -22,7 +22,7 @@
class BaseImageFilterCollapseBench : public Benchmark {
public:
- BaseImageFilterCollapseBench(): fImageFilter(NULL) {}
+ BaseImageFilterCollapseBench(): fImageFilter(nullptr) {}
~BaseImageFilterCollapseBench() {
SkSafeUnref(fImageFilter);
}
@@ -30,10 +30,10 @@ public:
protected:
void doPreDraw(SkColorFilter* colorFilters[], int nFilters) {
// Create a chain of ImageFilters from colorFilters
- fImageFilter = NULL;
+ fImageFilter = nullptr;
for(int i = nFilters; i --> 0;) {
SkAutoTUnref<SkImageFilter> filter(
- SkColorFilterImageFilter::Create(colorFilters[i], fImageFilter, NULL)
+ SkColorFilterImageFilter::Create(colorFilters[i], fImageFilter, nullptr)
);
SkRefCnt_SafeAssign(fImageFilter, filter.get());
}
@@ -67,7 +67,7 @@ private:
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
};
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear(
- pts, colors, NULL, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode
+ pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode
));
paint.setShader(shader);
canvas.drawPaint(paint);
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp
index e05bd5fada..02867e2743 100644
--- a/bench/MathBench.cpp
+++ b/bench/MathBench.cpp
@@ -274,7 +274,7 @@ public:
}
if (index < 0) {
- fProc = NULL;
+ fProc = nullptr;
fName = "isfinite_rect";
} else {
fProc = gRec[index].fProc;
diff --git a/bench/MipMapBench.cpp b/bench/MipMapBench.cpp
index a8156ed5f9..18af1e5f8c 100644
--- a/bench/MipMapBench.cpp
+++ b/bench/MipMapBench.cpp
@@ -29,7 +29,7 @@ protected:
void onDraw(const int loops, SkCanvas*) override {
for (int i = 0; i < loops; i++) {
- SkMipMap::Build(fBitmap, NULL)->unref();
+ SkMipMap::Build(fBitmap, nullptr)->unref();
}
}
diff --git a/bench/MorphologyBench.cpp b/bench/MorphologyBench.cpp
index 97995e8195..972892b53a 100644
--- a/bench/MorphologyBench.cpp
+++ b/bench/MorphologyBench.cpp
@@ -63,7 +63,7 @@ protected:
r.offset(fRadius, fRadius);
if (fRadius > 0) {
- SkMorphologyImageFilter* mf = NULL;
+ SkMorphologyImageFilter* mf = nullptr;
switch (fStyle) {
case kDilate_MT:
mf = SkDilateImageFilter::Create(SkScalarFloorToInt(fRadius),
diff --git a/bench/PatchBench.cpp b/bench/PatchBench.cpp
index 097e68ec8c..a6f5faae65 100644
--- a/bench/PatchBench.cpp
+++ b/bench/PatchBench.cpp
@@ -76,7 +76,7 @@ public:
};
const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -118,7 +118,7 @@ protected:
fPaint.setShader(this->createShader())->unref();
break;
default:
- fPaint.setShader(NULL);
+ fPaint.setShader(nullptr);
break;
}
}
@@ -128,16 +128,16 @@ protected:
for (int i = 0; i < loops; i++) {
switch (fVertexMode) {
case kNone_VertexMode:
- canvas->drawPatch(fCubics, NULL, NULL, NULL, fPaint);
+ canvas->drawPatch(fCubics, nullptr, nullptr, nullptr, fPaint);
break;
case kColors_VertexMode:
- canvas->drawPatch(fCubics, fColors, NULL, NULL, fPaint);
+ canvas->drawPatch(fCubics, fColors, nullptr, nullptr, fPaint);
break;
case kTexCoords_VertexMode:
- canvas->drawPatch(fCubics, NULL, fTexCoords, NULL, fPaint);
+ canvas->drawPatch(fCubics, nullptr, fTexCoords, nullptr, fPaint);
break;
case kBoth_VertexMode:
- canvas->drawPatch(fCubics, fColors, fTexCoords, NULL, fPaint);
+ canvas->drawPatch(fCubics, fColors, fTexCoords, nullptr, fPaint);
break;
default:
break;
diff --git a/bench/PatchGridBench.cpp b/bench/PatchGridBench.cpp
index 610d8e7232..e6b44870a1 100644
--- a/bench/PatchGridBench.cpp
+++ b/bench/PatchGridBench.cpp
@@ -96,7 +96,7 @@ public:
static const int kRows = 3;
static const int kCols = 4;
- fGrid.reset(kRows, kCols, SkPatchGrid::kColors_VertexType, NULL);
+ fGrid.reset(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr);
for (int i = 0; i < kRows; i++) {
for (int j = 0; j < kCols; j++) {
SkPoint points[12];
@@ -131,13 +131,13 @@ public:
switch (fVertexMode) {
case kNone_VertexMode:
- fGrid.setPatch(j, i, points, NULL, NULL);
+ fGrid.setPatch(j, i, points, nullptr, nullptr);
break;
case kColors_VertexMode:
- fGrid.setPatch(j, i, points, colors, NULL);
+ fGrid.setPatch(j, i, points, colors, nullptr);
break;
case kTexCoords_VertexMode:
- fGrid.setPatch(j, i, points, NULL, texs);
+ fGrid.setPatch(j, i, points, nullptr, texs);
break;
case kBoth_VertexMode:
fGrid.setPatch(j, i, points, colors, texs);
@@ -157,7 +157,7 @@ public:
};
const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -208,7 +208,7 @@ protected:
fPaint.setShader(createShader())->unref();
break;
default:
- fPaint.setShader(NULL);
+ fPaint.setShader(nullptr);
break;
}
this->setupPaint(&fPaint);
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index f2e84c2bb2..8c157119d4 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -224,9 +224,9 @@ protected:
void createData(int minVerbs,
int maxVerbs,
bool allowMoves = true,
- SkRect* bounds = NULL) {
+ SkRect* bounds = nullptr) {
SkRect tempBounds;
- if (NULL == bounds) {
+ if (nullptr == bounds) {
tempBounds.setXYWH(0, 0, SK_Scalar1, SK_Scalar1);
bounds = &tempBounds;
}
@@ -711,7 +711,7 @@ protected:
if (fZeroRad) {
make_arb_round_rect(&temp, r, 0, 0);
- SkASSERT(temp.isRect(NULL));
+ SkASSERT(temp.isRect(nullptr));
} else {
make_arb_round_rect(&temp, r, r.width() / 10, r.height() / 15);
}
@@ -851,7 +851,7 @@ public:
} else {
for (int i = 0; i < loops; ++i) {
for (int j = 0; j < 1000; ++j) {
- fRQ.evalAt(0.4f, &fDst[0].fPts[0], NULL);
+ fRQ.evalAt(0.4f, &fDst[0].fPts[0], nullptr);
}
}
}
@@ -876,7 +876,7 @@ public:
} else {
for (int i = 0; i < loops; ++i) {
for (int j = 0; j < 1000; ++j) {
- fRQ.evalAt(0.4f, NULL, &fDst[0].fPts[0]);
+ fRQ.evalAt(0.4f, nullptr, &fDst[0].fPts[0]);
}
}
}
diff --git a/bench/PerlinNoiseBench.cpp b/bench/PerlinNoiseBench.cpp
index b8237c0655..3fbb72309d 100644
--- a/bench/PerlinNoiseBench.cpp
+++ b/bench/PerlinNoiseBench.cpp
@@ -43,9 +43,9 @@ private:
bool stitchTiles) {
SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &fSize : NULL) :
+ seed, stitchTiles ? &fSize : nullptr) :
SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &fSize : NULL);
+ seed, stitchTiles ? &fSize : nullptr);
SkPaint paint;
paint.setShader(shader)->unref();
diff --git a/bench/PicturePlaybackBench.cpp b/bench/PicturePlaybackBench.cpp
index e11d7c8360..04eddc4f4f 100644
--- a/bench/PicturePlaybackBench.cpp
+++ b/bench/PicturePlaybackBench.cpp
@@ -40,7 +40,7 @@ protected:
virtual void onDraw(const int loops, SkCanvas* canvas) {
SkPictureRecorder recorder;
- SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGHT, NULL, 0);
+ SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGHT, nullptr, 0);
this->recordCanvas(pCanvas);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp
index 1da9fbe094..63d8ed9d2c 100644
--- a/bench/RTreeBench.cpp
+++ b/bench/RTreeBench.cpp
@@ -44,7 +44,7 @@ protected:
for (int i = 0; i < loops; ++i) {
SkRTree tree;
tree.insert(rects.get(), NUM_BUILD_RECTS);
- SkASSERT(rects != NULL); // It'd break this bench if the tree took ownership of rects.
+ SkASSERT(rects != nullptr); // It'd break this bench if the tree took ownership of rects.
}
}
private:
diff --git a/bench/RecordingBench.cpp b/bench/RecordingBench.cpp
index eada9305f9..c66e11a1d5 100644
--- a/bench/RecordingBench.cpp
+++ b/bench/RecordingBench.cpp
@@ -37,7 +37,7 @@ void RecordingBench::onDraw(const int loops, SkCanvas*) {
| SkPictureRecorder::kPlaybackDrawPicture_RecordFlag;
for (int i = 0; i < loops; i++) {
SkPictureRecorder recorder;
- fSrc->playback(recorder.beginRecording(w, h, fUseBBH ? &factory : NULL, flags));
+ fSrc->playback(recorder.beginRecording(w, h, fUseBBH ? &factory : nullptr, flags));
SkSafeUnref(recorder.endRecording());
}
}
diff --git a/bench/RectanizerBench.cpp b/bench/RectanizerBench.cpp
index 506a363541..fec9bf5839 100644
--- a/bench/RectanizerBench.cpp
+++ b/bench/RectanizerBench.cpp
@@ -73,7 +73,7 @@ protected:
}
void onPreDraw() override {
- SkASSERT(NULL == fRectanizer.get());
+ SkASSERT(nullptr == fRectanizer.get());
if (kPow2_RectanizerType == fRectanizerType) {
fRectanizer.reset(new GrRectanizerPow2(kWidth, kHeight));
diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp
index afbc5b27f1..4844f18af7 100644
--- a/bench/RepeatTileBench.cpp
+++ b/bench/RepeatTileBench.cpp
@@ -66,7 +66,7 @@ static void convert_to_index666(const SkBitmap& src, SkBitmap* dst) {
SkColorTable* ctable = new SkColorTable(storage, 216);
dst->allocPixels(SkImageInfo::Make(src.width(), src.height(),
kIndex_8_SkColorType, kOpaque_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
SkAutoLockPixels alps(src);
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index b8b9a2e5ed..2906429bf0 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -79,8 +79,8 @@ public:
: fFilename(filename)
, fRoot()
, fResults(fRoot["results"])
- , fBench(NULL)
- , fConfig(NULL) {}
+ , fBench(nullptr)
+ , fConfig(nullptr) {}
~NanoJSONResultsWriter() {
this->flush();
diff --git a/bench/SKPAnimationBench.cpp b/bench/SKPAnimationBench.cpp
index f43dc80abd..1a1ca447e5 100644
--- a/bench/SKPAnimationBench.cpp
+++ b/bench/SKPAnimationBench.cpp
@@ -34,7 +34,7 @@ void SKPAnimationBench::drawPicture() {
SkMatrix trans = SkMatrix::MakeTrans(-1.f * this->tileRects()[j].fLeft,
-1.f * this->tileRects()[j].fTop);
fAnimation->preConcatFrameMatrix(fAnimationTimer.fWall, fDevBounds, &trans);
- this->surfaces()[j]->getCanvas()->drawPicture(this->picture(), &trans, NULL);
+ this->surfaces()[j]->getCanvas()->drawPicture(this->picture(), &trans, nullptr);
}
for (int j = 0; j < this->tileRects().count(); ++j) {
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index ef7f644dd7..f0dafb6c9e 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -138,7 +138,7 @@ void SKPBench::drawPicture() {
for (int j = 0; j < fTileRects.count(); ++j) {
const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale,
-fTileRects[j].fTop / fScale);
- fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL);
+ fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr);
}
for (int j = 0; j < fTileRects.count(); ++j) {
diff --git a/bench/SkipZeroesBench.cpp b/bench/SkipZeroesBench.cpp
index 75fe78a156..87d433e422 100644
--- a/bench/SkipZeroesBench.cpp
+++ b/bench/SkipZeroesBench.cpp
@@ -23,7 +23,7 @@ class SkipZeroesBench : public Benchmark {
public:
SkipZeroesBench(const char* filename, bool skipZeroes)
: fName("SkipZeroes_")
- , fDecoder(NULL)
+ , fDecoder(nullptr)
, fFilename(filename)
, fStream()
, fSkipZeroes(skipZeroes)
diff --git a/bench/StrokeBench.cpp b/bench/StrokeBench.cpp
index 750bd0694d..d6737486e0 100644
--- a/bench/StrokeBench.cpp
+++ b/bench/StrokeBench.cpp
@@ -34,7 +34,7 @@ protected:
for (int outer = 0; outer < 10; ++outer) {
for (int i = 0; i < loops; ++i) {
SkPath result;
- paint.getFillPath(fPath, &result, NULL, fRes);
+ paint.getFillPath(fPath, &result, nullptr, fRes);
}
}
}
diff --git a/bench/TextBench.cpp b/bench/TextBench.cpp
index 3d97428d9f..ee5d5e0db3 100644
--- a/bench/TextBench.cpp
+++ b/bench/TextBench.cpp
@@ -57,7 +57,7 @@ public:
, fFQ(fq)
, fDoPos(doPos)
, fDoColorEmoji(doColorEmoji)
- , fPos(NULL) {
+ , fPos(nullptr) {
fPaint.setAntiAlias(kBW != fq);
fPaint.setLCDRenderText(kLCD == fq);
fPaint.setTextSize(SkIntToScalar(ps));
diff --git a/bench/TextBlobBench.cpp b/bench/TextBlobBench.cpp
index d110b8d2bb..0ef5eb9654 100644
--- a/bench/TextBlobBench.cpp
+++ b/bench/TextBlobBench.cpp
@@ -25,7 +25,7 @@
class TextBlobBench : public Benchmark {
public:
TextBlobBench()
- : fTypeface(NULL) {
+ : fTypeface(nullptr) {
}
protected:
@@ -37,14 +37,14 @@ protected:
const char* text = "Hello blob!";
SkTDArray<uint16_t> glyphs;
size_t len = strlen(text);
- glyphs.append(paint.textToGlyphs(text, len, NULL));
+ glyphs.append(paint.textToGlyphs(text, len, nullptr));
paint.textToGlyphs(text, len, glyphs.begin());
SkTextBlobBuilder builder;
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
const SkTextBlobBuilder::RunBuffer& run = builder.allocRun(paint, glyphs.count(), 10, 10,
- NULL);
+ nullptr);
memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t));
fBlob.reset(builder.build());
diff --git a/bench/VertBench.cpp b/bench/VertBench.cpp
index 6e49bf42b5..d2e5269c52 100644
--- a/bench/VertBench.cpp
+++ b/bench/VertBench.cpp
@@ -83,7 +83,7 @@ protected:
for (int i = 0; i < loops; i++) {
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS,
- fPts, NULL, fColors, NULL, fIdx, IDX, paint);
+ fPts, nullptr, fColors, nullptr, fIdx, IDX, paint);
}
}
private:
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 75d0ce3ba2..9933cf4393 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -141,7 +141,7 @@ bool Target::capturePixels(SkBitmap* bmp) {
#if SK_SUPPORT_GPU
struct GPUTarget : public Target {
- explicit GPUTarget(const Config& c) : Target(c), gl(NULL) { }
+ explicit GPUTarget(const Config& c) : Target(c), gl(nullptr) { }
SkGLContext* gl;
void setup() override {
@@ -458,16 +458,16 @@ static void create_configs(SkTDArray<Config>* configs) {
#endif
}
-// If bench is enabled for config, returns a Target* for it, otherwise NULL.
+// If bench is enabled for config, returns a Target* for it, otherwise nullptr.
static Target* is_enabled(Benchmark* bench, const Config& config) {
if (!bench->isSuitableFor(config.backend)) {
- return NULL;
+ return nullptr;
}
SkImageInfo info = SkImageInfo::Make(bench->getSize().fX, bench->getSize().fY,
config.color, config.alpha);
- Target* target = NULL;
+ Target* target = nullptr;
switch (config.backend) {
#if SK_SUPPORT_GPU
@@ -487,7 +487,7 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
if (!target->init(info, bench)) {
delete target;
- return NULL;
+ return nullptr;
}
return target;
}
@@ -504,7 +504,7 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
// Check that we can create a codec or image decoder.
if (useCodec) {
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
- if (NULL == codec) {
+ if (nullptr == codec) {
SkDebugf("Could not create codec for %s. Skipping bench.\n", path.c_str());
return false;
}
@@ -516,7 +516,7 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
const SkImageInfo info = codec->getInfo().makeColorType(colorType);
SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromData(encoded));
- if (NULL == scanlineDecoder || scanlineDecoder->start(info, NULL,
+ if (nullptr == scanlineDecoder || scanlineDecoder->start(info, nullptr,
colors, &colorCount) != SkCodec::kSuccess)
{
SkDebugf("Could not create scanline decoder for %s with color type %s. "
@@ -527,7 +527,7 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
*height = info.height();
} else {
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
- if (NULL == decoder) {
+ if (nullptr == decoder) {
SkDebugf("Could not create decoder for %s. Skipping bench.\n", path.c_str());
return false;
}
@@ -648,13 +648,13 @@ public:
}
SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path));
- if (stream.get() == NULL) {
+ if (stream.get() == nullptr) {
SkDebugf("Could not read %s.\n", path);
return false;
}
pic->reset(SkPicture::CreateFromStream(stream.get()));
- if (pic->get() == NULL) {
+ if (pic->get() == nullptr) {
SkDebugf("Could not read %s as an SkPicture.\n", path);
return false;
}
@@ -663,7 +663,7 @@ public:
Benchmark* next() {
if (fBenches) {
- Benchmark* bench = fBenches->factory()(NULL);
+ Benchmark* bench = fBenches->factory()(nullptr);
fBenches = fBenches->next();
fSourceType = "bench";
fBenchType = "micro";
@@ -671,7 +671,7 @@ public:
}
while (fGMs) {
- SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr));
fGMs = fGMs->next();
if (gm->runAsBench()) {
fSourceType = "gm";
@@ -783,7 +783,7 @@ public:
SkPMColor colors[256];
const SkCodec::Result result = codec->getPixels(
- info, storage.get(), rowBytes, NULL, colors,
+ info, storage.get(), rowBytes, nullptr, colors,
&colorCount);
switch (result) {
case SkCodec::kSuccess:
@@ -871,7 +871,7 @@ public:
fUseCodec++;
}
- return NULL;
+ return nullptr;
}
void fillCurrentOptions(ResultsWriter* log) const {
@@ -976,7 +976,7 @@ int nanobench_main() {
SkDebugf("Writing files to %s.\n", FLAGS_writePath[0]);
if (!sk_mkdir(FLAGS_writePath[0])) {
SkDebugf("Could not create %s. Files won't be written.\n", FLAGS_writePath[0]);
- FLAGS_writePath.set(0, NULL);
+ FLAGS_writePath.set(0, nullptr);
}
}
@@ -1038,7 +1038,7 @@ int nanobench_main() {
continue;
}
- // During HWUI output this canvas may be NULL.
+ // During HWUI output this canvas may be nullptr.
SkCanvas* canvas = target->getCanvas();
const char* config = target->config.name;
@@ -1151,7 +1151,7 @@ int nanobench_main() {
#if SK_SUPPORT_GPU
// Make sure we clean up the global GrContextFactory here, otherwise we might race with the
// SkEventTracer destructor
- gGrFactory.reset(NULL);
+ gGrFactory.reset(nullptr);
#endif
return 0;
diff --git a/bench/nanobench.h b/bench/nanobench.h
index f556f7dc14..36f5ad5b75 100644
--- a/bench/nanobench.h
+++ b/bench/nanobench.h
@@ -78,7 +78,7 @@ struct Target {
SkCanvas* getCanvas() const {
if (!surface.get()) {
- return NULL;
+ return nullptr;
}
return surface->getCanvas();
}
diff --git a/bench/subset/SubsetBenchPriv.h b/bench/subset/SubsetBenchPriv.h
index d3876840a7..02f7040a22 100644
--- a/bench/subset/SubsetBenchPriv.h
+++ b/bench/subset/SubsetBenchPriv.h
@@ -41,7 +41,7 @@ static inline void alloc_pixels(SkBitmap* bitmap, const SkImageInfo& info, SkPMC
int colorCount) {
if (kIndex_8_SkColorType == info.colorType()) {
SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colors, colorCount));
- bitmap->allocPixels(info, NULL, colorTable);
+ bitmap->allocPixels(info, nullptr, colorTable);
} else {
bitmap->allocPixels(info);
}
diff --git a/bench/subset/SubsetSingleBench.cpp b/bench/subset/SubsetSingleBench.cpp
index 9713cfd4bd..ce00f20947 100644
--- a/bench/subset/SubsetSingleBench.cpp
+++ b/bench/subset/SubsetSingleBench.cpp
@@ -68,7 +68,7 @@ void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) {
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
- scanlineDecoder->start(info, NULL, colors, &colorCount);
+ scanlineDecoder->start(info, nullptr, colors, &colorCount);
SkBitmap bitmap;
SkImageInfo subsetInfo = info.makeWH(fSubsetWidth, fSubsetHeight);
diff --git a/bench/subset/SubsetTranslateBench.cpp b/bench/subset/SubsetTranslateBench.cpp
index 35654d6a0a..8f6f2ea21b 100644
--- a/bench/subset/SubsetTranslateBench.cpp
+++ b/bench/subset/SubsetTranslateBench.cpp
@@ -64,7 +64,7 @@ void SubsetTranslateBench::onDraw(const int n, SkCanvas* canvas) {
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
- scanlineDecoder->start(info, NULL, colors, &colorCount);
+ scanlineDecoder->start(info, nullptr, colors, &colorCount);
SkBitmap bitmap;
// Note that we use the same bitmap for all of the subsets.
@@ -108,7 +108,7 @@ void SubsetTranslateBench::onDraw(const int n, SkCanvas* canvas) {
// because it gives a more fair comparison with SkCodec and is a common
// use case of BitmapRegionDecoder.
bitmap.allocPixels(SkImageInfo::Make(fSubsetWidth, fSubsetHeight,
- fColorType, kOpaque_SkAlphaType), NULL, colorTable);
+ fColorType, kOpaque_SkAlphaType), nullptr, colorTable);
for (int x = 0; x < width; x += fSubsetWidth) {
for (int y = 0; y < height; y += fSubsetHeight) {
diff --git a/bench/subset/SubsetZoomBench.cpp b/bench/subset/SubsetZoomBench.cpp
index d8abfd7673..bbdca75a54 100644
--- a/bench/subset/SubsetZoomBench.cpp
+++ b/bench/subset/SubsetZoomBench.cpp
@@ -64,7 +64,7 @@ void SubsetZoomBench::onDraw(const int n, SkCanvas* canvas) {
SkScanlineDecoder::NewFromStream(fStream->duplicate()));
const SkImageInfo info = scanlineDecoder->getInfo().makeColorType(fColorType);
SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
- scanlineDecoder->start(info, NULL, colors, &colorCount);
+ scanlineDecoder->start(info, nullptr, colors, &colorCount);
const int centerX = info.width() / 2;
const int centerY = info.height() / 2;
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index d86e3786f1..155fb63901 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -137,16 +137,16 @@ void SkDebuggerGUI::run(const SkPicture* pict,
sk_tools::PictureRenderer* renderer,
int repeats) {
SkASSERT(pict);
- if (NULL == pict) {
+ if (nullptr == pict) {
return;
}
- SkASSERT(renderer != NULL);
- if (NULL == renderer) {
+ SkASSERT(renderer != nullptr);
+ if (nullptr == renderer) {
return;
}
- renderer->init(pict, NULL, NULL, NULL, false, false);
+ renderer->init(pict, nullptr, nullptr, nullptr, false, false);
renderer->setup();
renderer->render();
@@ -181,7 +181,7 @@ void SkDebuggerGUI::actionProfile() {
SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream,
&SkImageDecoder::DecodeMemory)); // , fSkipCommands));
- if (NULL == picture.get()) {
+ if (nullptr == picture.get()) {
return;
}
}
@@ -729,7 +729,7 @@ void SkDebuggerGUI::loadPicture(const SkString& fileName) {
SkPicture* picture = SkPicture::CreateFromStream(stream);
- if (NULL == picture) {
+ if (nullptr == picture) {
QMessageBox::critical(this, "Error loading file", "Couldn't read file, sorry.");
return;
}
@@ -755,7 +755,7 @@ void SkDebuggerGUI::loadPicture(const SkString& fileName) {
this->setupListWidget();
this->setupComboBox();
- this->setupOverviewText(NULL, 0.0, 1);
+ this->setupOverviewText(nullptr, 0.0, 1);
fInspectorWidget.setDisabled(false);
fViewStateFrame.setDisabled(false);
fSettingsWidget.setDisabled(false);
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.cpp b/debugger/QT/SkDrawCommandGeometryWidget.cpp
index 9f19785667..08192acf9a 100644
--- a/debugger/QT/SkDrawCommandGeometryWidget.cpp
+++ b/debugger/QT/SkDrawCommandGeometryWidget.cpp
@@ -23,7 +23,7 @@ void SkDrawCommandGeometryWidget::resizeEvent(QResizeEvent* event) {
QRect r = this->contentsRect();
int dim = std::min(r.width(), r.height());
if (dim == 0) {
- fSurface.reset(NULL);
+ fSurface.reset(nullptr);
} else {
SkImageInfo info = SkImageInfo::MakeN32Premul(dim, dim);
fSurface.reset(SkSurface::NewRaster(info));
diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp
index 92c7b421ab..55bf963b1a 100644
--- a/debugger/QT/SkGLWidget.cpp
+++ b/debugger/QT/SkGLWidget.cpp
@@ -38,8 +38,8 @@ void SkGLWidget::initializeGL() {
if (fCurContext) {
fCurContext->abandonContext();
}
- fGpuDevice.reset(NULL);
- fCanvas.reset(NULL);
+ fGpuDevice.reset(nullptr);
+ fCanvas.reset(nullptr);
fCurContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf.get()));
}
@@ -55,8 +55,8 @@ void SkGLWidget::createRenderTarget() {
glClear(GL_STENCIL_BUFFER_BIT);
fCurContext->resetContext();
- fGpuDevice.reset(NULL);
- fCanvas.reset(NULL);
+ fGpuDevice.reset(nullptr);
+ fCanvas.reset(nullptr);
GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height());
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
diff --git a/debugger/QT/SkListWidget.h b/debugger/QT/SkListWidget.h
index 4a799a01fe..4298074481 100644
--- a/debugger/QT/SkListWidget.h
+++ b/debugger/QT/SkListWidget.h
@@ -23,7 +23,7 @@ public:
Constructs the list widget with the specified parent for layout purposes.
@param parent The parent container of this widget
*/
- SkListWidget(QObject* parent = NULL) {}
+ SkListWidget(QObject* parent = nullptr) {}
virtual ~SkListWidget() {}
diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp
index 72a742f7aa..203d98ee4e 100644
--- a/debugger/QT/SkRasterWidget.cpp
+++ b/debugger/QT/SkRasterWidget.cpp
@@ -22,7 +22,7 @@ void SkRasterWidget::resizeEvent(QResizeEvent* event) {
QRect r = this->contentsRect();
if (r.width() == 0 || r.height() == 0) {
- fSurface.reset(NULL);
+ fSurface.reset(nullptr);
} else {
SkImageInfo info = SkImageInfo::MakeN32Premul(r.width(), r.height());
fSurface.reset(SkSurface::NewRaster(info));
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index 61fa3ec642..b7e673629d 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -12,7 +12,7 @@
SkDebugger::SkDebugger()
- : fPicture(NULL)
+ : fPicture(nullptr)
, fIndex(-1) {
// Create this some other dynamic way?
fDebugCanvas = new SkDebugCanvas(0, 0);
@@ -32,7 +32,7 @@ void SkDebugger::loadPicture(SkPicture* picture) {
SkScalarCeilToInt(this->pictureCull().height()));
fDebugCanvas->setPicture(picture);
picture->playback(fDebugCanvas);
- fDebugCanvas->setPicture(NULL);
+ fDebugCanvas->setPicture(nullptr);
fIndex = fDebugCanvas->getSize() - 1;
}
@@ -83,7 +83,7 @@ void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
for (int i = 0; i < SkDrawCommand::kOpTypeCount; ++i) {
if (0 == counts[i]) {
// if there were no commands of this type then they should've consumed no time
- SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]);
+ SkASSERT(nullptr == typeTimes || 0.0 == (*typeTimes)[i]);
continue;
}
diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h
index 230a1ffc4e..94f83b71c3 100644
--- a/debugger/SkDebugger.h
+++ b/debugger/SkDebugger.h
@@ -86,7 +86,7 @@ public:
}
SkRect pictureCull() const {
- return NULL == fPicture ? SkRect::MakeEmpty() : fPicture->cullRect();
+ return nullptr == fPicture ? SkRect::MakeEmpty() : fPicture->cullRect();
}
int index() {
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 983a8704ae..8c3b6ed084 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -212,7 +212,7 @@ static void push_codec_srcs(Path path) {
return;
}
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
- if (NULL == codec.get()) {
+ if (nullptr == codec.get()) {
SkDebugf("Couldn't create codec for %s.", path.c_str());
return;
}
@@ -418,17 +418,17 @@ static Sink* create_sink(const char* tag) {
SINK("xps", XPSSink);
}
#undef SINK
- return NULL;
+ return nullptr;
}
static Sink* create_via(const char* tag, Sink* wrapped) {
#define VIA(t, via, ...) if (0 == strcmp(t, tag)) { return new via(__VA_ARGS__); }
- VIA("twice", ViaTwice, wrapped);
- VIA("pipe", ViaPipe, wrapped);
- VIA("serialize", ViaSerialization, wrapped);
- VIA("2ndpic", ViaSecondPicture, wrapped);
+ VIA("twice", ViaTwice, wrapped);
+ VIA("pipe", ViaPipe, wrapped);
+ VIA("serialize", ViaSerialization, wrapped);
+ VIA("2ndpic", ViaSecondPicture, wrapped);
VIA("sp", ViaSingletonPictures, wrapped);
- VIA("tiles", ViaTiles, 256, 256, NULL, wrapped);
+ VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped);
VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped);
if (FLAGS_matrix.count() == 4) {
@@ -447,7 +447,7 @@ static Sink* create_via(const char* tag, Sink* wrapped) {
#endif
#undef VIA
- return NULL;
+ return nullptr;
}
static void gather_sinks() {
@@ -456,14 +456,14 @@ static void gather_sinks() {
SkTArray<SkString> parts;
SkStrSplit(config, "-", &parts);
- Sink* sink = NULL;
+ Sink* sink = nullptr;
for (int i = parts.count(); i-- > 0;) {
const char* part = parts[i].c_str();
- Sink* next = (sink == NULL) ? create_sink(part) : create_via(part, sink);
- if (next == NULL) {
+ Sink* next = (sink == nullptr) ? create_sink(part) : create_via(part, sink);
+ if (next == nullptr) {
SkDebugf("Skipping %s: Don't understand '%s'.\n", config, part);
delete sink;
- sink = NULL;
+ sink = nullptr;
break;
}
sink = next;
@@ -539,7 +539,7 @@ static bool dump_png(SkBitmap bitmap, const char* path, const char* md5) {
}
static bool match(const char* needle, const char* haystack) {
- return 0 == strcmp("_", needle) || NULL != strstr(haystack, needle);
+ return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
}
static ImplicitString is_blacklisted(const char* sink, const char* src,
@@ -648,10 +648,10 @@ struct Task {
if (!FLAGS_writePath.isEmpty()) {
const char* ext = task->sink->fileExtension();
if (data->getLength()) {
- WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
+ WriteToDisk(*task, md5, ext, data, data->getLength(), nullptr);
SkASSERT(bitmap.drawsNothing());
} else if (!bitmap.drawsNothing()) {
- WriteToDisk(*task, md5, ext, NULL, 0, &bitmap);
+ WriteToDisk(*task, md5, ext, nullptr, 0, &bitmap);
}
}
}
@@ -838,7 +838,7 @@ static SkTypeface* create_from_name(const char familyName[], SkTypeface::Style s
&& !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
return sk_tool_utils::create_portable_typeface(familyName, style);
}
- return NULL;
+ return nullptr;
}
#undef PORTABLE_FONT_PREFIX
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index f147248465..4025f31559 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -86,7 +86,7 @@ static inline SkSurface* NewGpuSurface(GrContextFactory*,
SkImageInfo,
int,
bool) {
- return NULL;
+ return nullptr;
}
} // namespace DM
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index d46e5906e6..12530142d2 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -41,24 +41,24 @@ namespace DM {
GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {}
Error GMSrc::draw(SkCanvas* canvas) const {
- SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
canvas->concat(gm->getInitialTransform());
gm->draw(canvas);
return "";
}
SkISize GMSrc::size() const {
- SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
return gm->getISize();
}
Name GMSrc::name() const {
- SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
return gm->getName();
}
void GMSrc::modifyGrContextOptions(GrContextOptions* options) const {
- SkAutoTDelete<skiagm::GM> gm(fFactory(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fFactory(nullptr));
gm->modifyGrContextOptions(options);
}
@@ -85,10 +85,10 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
return SkStringPrintf("Couldn't read %s.", fPath.c_str());
}
SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
- if (NULL == codec.get()) {
+ if (nullptr == codec.get()) {
// scaledCodec not supported, try normal codec
codec.reset(SkCodec::NewFromData(encoded));
- if (NULL == codec.get()) {
+ if (nullptr == codec.get()) {
return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str());
}
}
@@ -128,9 +128,9 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
decodeInfo = decodeInfo.makeWH(size.width(), size.height());
// Construct a color table for the decode if necessary
- SkAutoTUnref<SkColorTable> colorTable(NULL);
- SkPMColor* colorPtr = NULL;
- int* colorCountPtr = NULL;
+ SkAutoTUnref<SkColorTable> colorTable(nullptr);
+ SkPMColor* colorPtr = nullptr;
+ int* colorCountPtr = nullptr;
int maxColors = 256;
if (kIndex_8_SkColorType == decodeInfo.colorType()) {
SkPMColor colors[256];
@@ -145,14 +145,14 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
}
SkBitmap bitmap;
- if (!bitmap.tryAllocPixels(decodeInfo, NULL, colorTable.get())) {
+ if (!bitmap.tryAllocPixels(decodeInfo, nullptr, colorTable.get())) {
return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(),
decodeInfo.width(), decodeInfo.height());
}
switch (fMode) {
case kNormal_Mode: {
- switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), NULL,
+ switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), nullptr,
colorPtr, colorCountPtr)) {
case SkCodec::kSuccess:
// We consider incomplete to be valid, since we should still decode what is
@@ -171,8 +171,8 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
case kScanline_Mode: {
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
SkScanlineDecoder::NewFromData(encoded));
- if (NULL == scanlineDecoder || SkCodec::kSuccess !=
- scanlineDecoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
+ if (nullptr == scanlineDecoder || SkCodec::kSuccess !=
+ scanlineDecoder->start(decodeInfo, nullptr, colorPtr, colorCountPtr)) {
return Error::Nonfatal("Cannot use scanline decoder for all images");
}
@@ -215,7 +215,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
SkImageInfo largestSubsetDecodeInfo =
decodeInfo.makeWH(subsetWidth + extraX, subsetHeight + extraY);
SkBitmap largestSubsetBm;
- if (!largestSubsetBm.tryAllocPixels(largestSubsetDecodeInfo, NULL, colorTable.get())) {
+ if (!largestSubsetBm.tryAllocPixels(largestSubsetDecodeInfo, nullptr, colorTable.get())) {
return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(),
largestSubsetDecodeInfo.width(), largestSubsetDecodeInfo.height());
}
@@ -235,15 +235,15 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
//create scanline decoder for each subset
SkAutoTDelete<SkScanlineDecoder> subsetScanlineDecoder(
SkScanlineDecoder::NewFromData(encoded));
- if (NULL == subsetScanlineDecoder || SkCodec::kSuccess !=
+ if (nullptr == subsetScanlineDecoder || SkCodec::kSuccess !=
subsetScanlineDecoder->start(
- decodeInfo, NULL, colorPtr, colorCountPtr))
+ decodeInfo, nullptr, colorPtr, colorCountPtr))
{
if (x == 0 && y == 0) {
//first try, image may not be compatible
return Error::Nonfatal("Cannot use scanline decoder for all images");
} else {
- return "Error scanline decoder is NULL";
+ return "Error scanline decoder is nullptr";
}
}
//skip to first line of subset
@@ -305,8 +305,8 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
// Decode odd stripes
SkAutoTDelete<SkScanlineDecoder> decoder(SkScanlineDecoder::NewFromData(encoded));
- if (NULL == decoder || SkCodec::kSuccess !=
- decoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
+ if (nullptr == decoder || SkCodec::kSuccess !=
+ decoder->start(decodeInfo, nullptr, colorPtr, colorCountPtr)) {
return Error::Nonfatal("Cannot use scanline decoder for all images");
}
for (int i = 0; i < numStripes; i += 2) {
@@ -338,7 +338,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
}
// Decode even stripes
- const SkCodec::Result startResult = decoder->start(decodeInfo, NULL, colorPtr,
+ const SkCodec::Result startResult = decoder->start(decodeInfo, nullptr, colorPtr,
colorCountPtr);
if (SkCodec::kSuccess != startResult) {
return "Failed to restart scanline decoder with same parameters.";
@@ -412,7 +412,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
SkScalarRoundToInt(preScaleH * fScale));
size_t rowBytes = decodeInfo.minRowBytes();
if (!subsetBm.installPixels(decodeInfo, pixels, rowBytes, colorTable.get(),
- NULL, NULL)) {
+ nullptr, nullptr)) {
return SkStringPrintf("could not install pixels for %s.", fPath.c_str());
}
const SkCodec::Result result = codec->getPixels(decodeInfo, pixels, rowBytes,
@@ -457,10 +457,10 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
SkISize CodecSrc::size() const {
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
- if (NULL == codec) {
+ if (nullptr == codec) {
// scaledCodec not supported, try regular codec
codec.reset(SkCodec::NewFromData(encoded));
- if (NULL == codec) {
+ if (nullptr == codec) {
return SkISize::Make(0, 0);
}
}
@@ -504,7 +504,7 @@ Error ImageSrc::draw(SkCanvas* canvas) const {
// Do not draw a bitmap with alpha to a destination without alpha.
return Error::Nonfatal("Uninteresting to decode image with alpha into 565.");
}
- encoded.reset((SkData*)NULL); // Might as well drop this when we're done with it.
+ encoded.reset((SkData*)nullptr); // Might as well drop this when we're done with it.
canvas->drawBitmap(bitmap, 0,0);
return "";
}
@@ -582,7 +582,7 @@ Error SKPSrc::draw(SkCanvas* canvas) const {
if (!pic) {
return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str());
}
- stream.reset((SkStream*)NULL); // Might as well drop this when we're done with it.
+ stream.reset((SkStream*)nullptr); // Might as well drop this when we're done with it.
canvas->clipRect(kSKPViewport);
canvas->drawPicture(pic);
@@ -649,7 +649,7 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
return "Could not create a surface.";
}
if (FLAGS_preAbandonGpuContext) {
- SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, NULL);
+ SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr);
factory.abandonContexts();
}
SkCanvas* canvas = surface->getCanvas();
@@ -694,7 +694,7 @@ static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
SkCanvas* canvas =
doc->beginPage(SkIntToScalar(w), SkIntToScalar(h));
if (!canvas) {
- return "SkDocument::beginPage(w,h) returned NULL";
+ return "SkDocument::beginPage(w,h) returned nullptr";
}
canvas->clipRect(letter);
canvas->translate(-letter.width() * x, -letter.height() * y);
@@ -709,7 +709,7 @@ static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
SkCanvas* canvas =
doc->beginPage(SkIntToScalar(width), SkIntToScalar(height));
if (!canvas) {
- return "SkDocument::beginPage(w,h) returned NULL";
+ return "SkDocument::beginPage(w,h) returned nullptr";
}
Error err = src.draw(canvas);
if (!err.isEmpty()) {
@@ -729,7 +729,7 @@ PDFSink::PDFSink() {}
Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
if (!doc) {
- return "SkDocument::CreatePDF() returned NULL";
+ return "SkDocument::CreatePDF() returned nullptr";
}
return draw_skdocument(src, doc.get(), dst);
}
@@ -741,7 +741,7 @@ XPSSink::XPSSink() {}
Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
if (!doc) {
- return "SkDocument::CreateXPS() returned NULL";
+ return "SkDocument::CreateXPS() returned nullptr";
}
return draw_skdocument(src, doc.get(), dst);
}
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 7ede6a5fe1..b3c39b7b14 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -140,7 +140,7 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) {
newc->drawCircle(50, 50, 49, paint);
canvas->drawBitmap(bm, 10, 10);
- CGImageRef image = SkCreateCGImageRefWithColorspace(bm, NULL);
+ CGImageRef image = SkCreateCGImageRefWithColorspace(bm, nullptr);
SkBitmap bm2;
SkCreateBitmapFromCGImage(&bm2, image);
diff --git a/gm/aarectmodes.cpp b/gm/aarectmodes.cpp
index e0df7d84b1..fb5145bc5f 100644
--- a/gm/aarectmodes.cpp
+++ b/gm/aarectmodes.cpp
@@ -161,7 +161,7 @@ namespace skiagm {
SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
canvas->drawRect(bounds, fBGPaint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
SkScalar dy = drawCell(canvas, mode,
gAlphaValue[alpha & 1],
gAlphaValue[alpha & 2]);
diff --git a/gm/aaxfermodes.cpp b/gm/aaxfermodes.cpp
index d33423a35e..9e07f8d751 100644
--- a/gm/aaxfermodes.cpp
+++ b/gm/aaxfermodes.cpp
@@ -161,7 +161,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
draw_pass(canvas, kCheckerboard_Pass);
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
canvas->translate(kMargin, kMargin);
draw_pass(canvas, kBackground_Pass);
diff --git a/gm/addarc.cpp b/gm/addarc.cpp
index 3bfed8d549..0d1ea93133 100644
--- a/gm/addarc.cpp
+++ b/gm/addarc.cpp
@@ -101,7 +101,7 @@ protected:
SkPathMeasure meas(path, false);
SkScalar arcLen = rad * R;
SkPoint pos;
- if (meas.getPosTan(arcLen, &pos, NULL)) {
+ if (meas.getPosTan(arcLen, &pos, nullptr)) {
canvas->drawLine(0, 0, pos.x(), pos.y(), measPaint);
}
}
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp
index 2fbd71de24..4cabf2ec9b 100644
--- a/gm/all_bitmap_configs.cpp
+++ b/gm/all_bitmap_configs.cpp
@@ -75,7 +75,7 @@ static void color_wheel_native(SkCanvas* canvas) {
const SkScalar D = 0.3f * SkIntToScalar(SCALE);
const SkScalar X = SkDoubleToScalar(D * sqrt_3_over_2);
const SkScalar Y = D * SK_ScalarHalf;
- sk_tool_utils::set_portable_typeface(&p, NULL, SkTypeface::kBold);
+ sk_tool_utils::set_portable_typeface(&p, nullptr, SkTypeface::kBold);
p.setTextSize(0.28125f * SCALE);
draw_center_letter('K', &p, SK_ColorBLACK, Z, Z, canvas);
draw_center_letter('R', &p, SK_ColorRED, Z, D, canvas);
@@ -127,7 +127,7 @@ static SkBitmap indexed_bitmap() {
SkAutoTUnref<SkColorTable> ctable(new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
SkImageInfo info = SkImageInfo::Make(SCALE, SCALE, kIndex_8_SkColorType,
kPremul_SkAlphaType);
- bm.allocPixels(info, NULL, ctable);
+ bm.allocPixels(info, nullptr, ctable);
SkAutoLockPixels autoLockPixels1(n32bitmap);
SkAutoLockPixels autoLockPixels2(bm);
for (int y = 0; y < SCALE; ++y) {
@@ -155,7 +155,7 @@ DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) {
SkPaint p;
p.setColor(SK_ColorBLACK);
p.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&p, NULL);
+ sk_tool_utils::set_portable_typeface(&p, nullptr);
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
diff --git a/gm/alphagradients.cpp b/gm/alphagradients.cpp
index b209cec9d1..71ec27c975 100644
--- a/gm/alphagradients.cpp
+++ b/gm/alphagradients.cpp
@@ -28,12 +28,12 @@ protected:
SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fBottom } };
SkPaint paint;
uint32_t flags = doPreMul ? SkGradientShader::kInterpolateColorsInPremul_Flag : 0;
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2,
- SkShader::kClamp_TileMode, flags, NULL);
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
+ SkShader::kClamp_TileMode, flags, nullptr);
paint.setShader(s)->unref();
canvas->drawRect(r, paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(r, paint);
}
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp
index 4b8194464f..53385ea6ab 100644
--- a/gm/arithmode.cpp
+++ b/gm/arithmode.cpp
@@ -31,7 +31,7 @@ static SkBitmap make_src() {
SK_ColorTRANSPARENT, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, SK_ColorMAGENTA, SK_ColorWHITE,
};
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
paint.setShader(s)->unref();
canvas.drawPaint(paint);
@@ -47,7 +47,7 @@ static SkBitmap make_dst() {
SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN,
sk_tool_utils::color_to_565(SK_ColorGRAY)
};
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
paint.setShader(s)->unref();
canvas.drawPaint(paint);
@@ -105,13 +105,13 @@ protected:
SkScalar gap = SkIntToScalar(src.width() + 20);
while (k < stop) {
SkScalar x = 0;
- canvas->drawBitmap(src, x, y, NULL);
+ canvas->drawBitmap(src, x, y, nullptr);
x += gap;
- canvas->drawBitmap(dst, x, y, NULL);
+ canvas->drawBitmap(dst, x, y, nullptr);
x += gap;
SkRect rect = SkRect::MakeXYWH(x, y, SkIntToScalar(WW), SkIntToScalar(HH));
- canvas->saveLayer(&rect, NULL);
- canvas->drawBitmap(dst, x, y, NULL);
+ canvas->saveLayer(&rect, nullptr);
+ canvas->drawBitmap(dst, x, y, nullptr);
SkXfermode* xfer = SkArithmeticMode::Create(k[0], k[1], k[2], k[3]);
SkPaint paint;
paint.setXfermode(xfer)->unref();
diff --git a/gm/astcbitmap.cpp b/gm/astcbitmap.cpp
index 8ee7746f61..bc5e1e978f 100644
--- a/gm/astcbitmap.cpp
+++ b/gm/astcbitmap.cpp
@@ -70,7 +70,7 @@ protected:
}
SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()));
- if (NULL == fileData) {
+ if (nullptr == fileData) {
SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n");
return;
}
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 9edc11411a..ff75f74c66 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -121,12 +121,12 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
@@ -159,7 +159,7 @@ protected:
{ // scope to contain GrTestTarget
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
continue;
}
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
@@ -269,12 +269,12 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
@@ -307,7 +307,7 @@ protected:
{ // scope to contain GrTestTarget
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
continue;
}
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
@@ -512,12 +512,12 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
@@ -548,7 +548,7 @@ protected:
{ // scope to contain GrTestTarget
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
continue;
}
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index f19b57ce45..3facc8c47c 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -32,7 +32,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- GrContext* context = rt ? rt->getContext() : NULL;
+ GrContext* context = rt ? rt->getContext() : nullptr;
if (!context) {
this->drawGpuOnlyMessage(canvas);
return;
@@ -66,7 +66,7 @@ protected:
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
diff --git a/gm/bigtileimagefilter.cpp b/gm/bigtileimagefilter.cpp
index dbd41c2ebd..3c55b71410 100644
--- a/gm/bigtileimagefilter.cpp
+++ b/gm/bigtileimagefilter.cpp
@@ -74,7 +74,7 @@ protected:
SkAutoTUnref<SkTileImageFilter> tif2(SkTileImageFilter::Create(
SkRect::MakeWH(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)),
SkRect::MakeWH(SkIntToScalar(kBitmapSize), SkIntToScalar(kBitmapSize)),
- NULL));
+ nullptr));
p2.setImageFilter(tif2);
canvas->translate(320, 320);
diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp
index aeb88d6d22..b7273288ac 100644
--- a/gm/bitmapfilters.cpp
+++ b/gm/bitmapfilters.cpp
@@ -21,7 +21,7 @@ static void make_bm(SkBitmap* bm) {
bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
*bm->getAddr8(0, 0) = 0;
diff --git a/gm/bitmaprect.cpp b/gm/bitmaprect.cpp
index cfceab5af9..077f0ee273 100644
--- a/gm/bitmaprect.cpp
+++ b/gm/bitmaprect.cpp
@@ -23,7 +23,7 @@ static void make_bitmap(SkBitmap* bitmap) {
paint.setAntiAlias(true);
const SkPoint pts[] = { { 0, 0 }, { 64, 64 } };
const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE };
- paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode))->unref();
canvas.drawCircle(32, 32, 32, paint);
}
diff --git a/gm/bitmaprecttest.cpp b/gm/bitmaprecttest.cpp
index 878029a8dd..741cc9ddfd 100644
--- a/gm/bitmaprecttest.cpp
+++ b/gm/bitmaprecttest.cpp
@@ -38,7 +38,7 @@ static void test_bitmaprect(SkCanvas* canvas) {
SkBitmap bm;
make_bm(&bm);
- canvas->drawBitmap(bm, 150, 45, NULL);
+ canvas->drawBitmap(bm, 150, 45, nullptr);
SkScalar scale = 0.472560018f;
canvas->save();
@@ -47,7 +47,7 @@ static void test_bitmaprect(SkCanvas* canvas) {
canvas->restore();
canvas->scale(-1, 1);
- canvas->drawBitmap(bm, -310, 45, NULL);
+ canvas->drawBitmap(bm, -310, 45, nullptr);
}
class BitmapRectTestGM : public skiagm::GM {
diff --git a/gm/bitmapshader.cpp b/gm/bitmapshader.cpp
index 2b6906f381..5d7b35c2cd 100644
--- a/gm/bitmapshader.cpp
+++ b/gm/bitmapshader.cpp
@@ -84,7 +84,7 @@ protected:
canvas->translate(0, 25);
// clear the shader, colorized by a solid color with a bitmap mask
- paint.setShader(NULL);
+ paint.setShader(nullptr);
paint.setColor(SK_ColorGREEN);
canvas->drawBitmap(fMask, 0, 0, &paint);
canvas->drawBitmap(fMask, 30, 0, &paint);
diff --git a/gm/bitmapsource2.cpp b/gm/bitmapsource2.cpp
index 6c32f625d9..f65bafd2bc 100644
--- a/gm/bitmapsource2.cpp
+++ b/gm/bitmapsource2.cpp
@@ -66,7 +66,7 @@ protected:
SkPaint p;
p.setImageFilter(filter);
- canvas->saveLayer(NULL, &p);
+ canvas->saveLayer(nullptr, &p);
canvas->restore();
}
diff --git a/gm/blend.cpp b/gm/blend.cpp
index a89ecfe46d..94dc4c7f75 100644
--- a/gm/blend.cpp
+++ b/gm/blend.cpp
@@ -21,14 +21,14 @@ DEF_SIMPLE_GM(blend, canvas, 300, 100) {
p.setColor(SK_ColorRED);
canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
p.setColor(0xFC008000);
canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
canvas->restore();
p.setColor(SK_ColorRED);
canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
- canvas->saveLayerAlpha(NULL, 0xFC);
+ canvas->saveLayerAlpha(nullptr, 0xFC);
p.setColor(sk_tool_utils::color_to_565(0xFF008000));
canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
canvas->restore();
@@ -36,7 +36,7 @@ DEF_SIMPLE_GM(blend, canvas, 300, 100) {
// Print out the colors in each block (if we're looking at 8888 raster).
if (canvas->imageInfo().colorType() == kN32_SkColorType) {
- if (const SkPMColor* px = (const SkPMColor*)canvas->peekPixels(NULL, NULL)) {
+ if (const SkPMColor* px = (const SkPMColor*)canvas->peekPixels(nullptr, nullptr)) {
p.setColor(SK_ColorWHITE);
for (int i = 0; i < 3; i++) {
SkPMColor c = px[i * 100];
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index 0726f2cd52..6b7354071b 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -235,7 +235,7 @@ protected:
canvas->save();
canvas->translate((SkScalar)cur_x, (SkScalar)cur_y);
canvas->translate(-(bm.width() - r.width())/2, -(bm.height()-r.height())/2);
- canvas->drawBitmap(bm, 0.f, 0.f, NULL);
+ canvas->drawBitmap(bm, 0.f, 0.f, nullptr);
canvas->restore();
cur_x += bm.width() + fPadding;
@@ -313,7 +313,7 @@ protected:
center_x = (canvas_size.fWidth - mask.fBounds.width())/2;
center_y = (canvas_size.fHeight - mask.fBounds.height())/2;
- canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), NULL);
+ canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), nullptr);
}
private:
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index 8f95f007fa..d52a656963 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -56,7 +56,7 @@ protected:
flags);
paint.setMaskFilter(mf)->unref();
} else {
- paint.setMaskFilter(NULL);
+ paint.setMaskFilter(nullptr);
}
canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100),
SkIntToScalar(200 + gRecs[i].fCy*100),
@@ -75,7 +75,7 @@ protected:
canvas->drawText("Hamburgefons Style", 18, x, y, paint);
canvas->drawText("Hamburgefons Style", 18,
x, y + SkIntToScalar(50), paint);
- paint.setMaskFilter(NULL);
+ paint.setMaskFilter(nullptr);
paint.setColor(SK_ColorWHITE);
x -= SkIntToScalar(2);
y -= SkIntToScalar(2);
diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp
index 931dcfaf51..18de813134 100644
--- a/gm/colorcube.cpp
+++ b/gm/colorcube.cpp
@@ -20,18 +20,18 @@ static SkShader* MakeLinear() {
};
static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE };
return SkGradientShader::CreateLinear(
- pts, colors, NULL, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
+ pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
}
class ColorCubeGM : public GM {
public:
ColorCubeGM()
: fInitialized(false)
- , f3DLut4(NULL)
- , f3DLut8(NULL)
- , f3DLut16(NULL)
- , f3DLut32(NULL)
- , f3DLut64(NULL)
+ , f3DLut4(nullptr)
+ , f3DLut8(nullptr)
+ , f3DLut16(nullptr)
+ , f3DLut32(nullptr)
+ , f3DLut64(nullptr)
{
this->setBGColor(0xFF000000);
}
diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp
index 8ef335a158..6dddc0fdc6 100644
--- a/gm/coloremoji.cpp
+++ b/gm/coloremoji.cpp
@@ -27,7 +27,7 @@ static SkShader* MakeLinear() {
SK_ARRAY_COUNT(kColors), SkShader::kClamp_TileMode);
}
-static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
+static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) {
SkScalar matrix[20];
memset(matrix, 0, 20 * sizeof(SkScalar));
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
@@ -38,7 +38,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
return SkColorFilterImageFilter::Create(filter, input);
}
-static SkImageFilter* make_blur(float amount, SkImageFilter* input = NULL) {
+static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) {
return SkBlurImageFilter::Create(amount, amount, input);
}
@@ -98,14 +98,14 @@ protected:
}
if (SkToBool(makeBlur) && SkToBool(makeGray)) {
- SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(NULL));
+ SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(nullptr));
SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, grayScale));
shaderPaint.setImageFilter(blur);
} else if (SkToBool(makeBlur)) {
- SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, NULL));
+ SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f, nullptr));
shaderPaint.setImageFilter(blur);
} else if (SkToBool(makeGray)) {
- SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(NULL));
+ SkAutoTUnref<SkImageFilter> grayScale(make_grayscale(nullptr));
shaderPaint.setImageFilter(grayScale);
}
shaderPaint.setTextSize(30);
diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp
index 500450f61b..4f5a768d57 100644
--- a/gm/colorfilterimagefilter.cpp
+++ b/gm/colorfilterimagefilter.cpp
@@ -18,11 +18,11 @@
#define FILTER_HEIGHT SkIntToScalar(30)
#define MARGIN SkIntToScalar(10)
-static SkImageFilter* make_blur(float amount, SkImageFilter* input = NULL) {
+static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) {
return SkBlurImageFilter::Create(amount, amount, input);
}
-static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) {
+static SkImageFilter* make_brightness(float amount, SkImageFilter* input = nullptr) {
SkScalar amount255 = SkScalarMul(amount, SkIntToScalar(255));
SkScalar matrix[20] = { 1, 0, 0, 0, amount255,
0, 1, 0, 0, amount255,
@@ -32,7 +32,7 @@ static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL)
return SkColorFilterImageFilter::Create(filter, input);
}
-static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
+static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) {
SkScalar matrix[20];
memset(matrix, 0, 20 * sizeof(SkScalar));
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
@@ -43,7 +43,7 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
return SkColorFilterImageFilter::Create(filter, input);
}
-static SkImageFilter* make_mode_blue(SkImageFilter* input = NULL) {
+static SkImageFilter* make_mode_blue(SkImageFilter* input = nullptr) {
SkAutoTUnref<SkColorFilter> filter(
SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrc_Mode));
return SkColorFilterImageFilter::Create(filter, input);
diff --git a/gm/colorfilters.cpp b/gm/colorfilters.cpp
index 73ca7f318d..2d220d2c1d 100644
--- a/gm/colorfilters.cpp
+++ b/gm/colorfilters.cpp
@@ -20,14 +20,14 @@ static SkShader* make_shader(const SkRect& bounds) {
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
};
return SkGradientShader::CreateLinear(pts,
- colors, NULL, SK_ARRAY_COUNT(colors),
+ colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
}
typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t);
static void install_nothing(SkPaint* paint, uint32_t, uint32_t) {
- paint->setColorFilter(NULL);
+ paint->setColorFilter(nullptr);
}
static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) {
diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp
index a80f8cb581..b466188c6a 100644
--- a/gm/colormatrix.cpp
+++ b/gm/colormatrix.cpp
@@ -67,7 +67,7 @@ protected:
SkPoint pts[] = {{0, 0}, {SkIntToScalar(width), SkIntToScalar(height)}};
SkColor colors[] = {0x00000000, 0xFFFFFFFF};
SkPaint paint;
- paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode))->unref();
canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), paint);
return SkImage::NewFromBitmap(bm);
diff --git a/gm/colortype.cpp b/gm/colortype.cpp
index 4d8c9d6056..76b13817a9 100644
--- a/gm/colortype.cpp
+++ b/gm/colortype.cpp
@@ -13,7 +13,7 @@
class ColorTypeGM : public skiagm::GM {
public:
ColorTypeGM()
- : fColorType(NULL) {
+ : fColorType(nullptr) {
}
virtual ~ColorTypeGM() {
@@ -28,7 +28,7 @@ protected:
};
SkMatrix local;
local.setRotate(180);
- SkShader* s = SkGradientShader::CreateSweep(0,0, colors, NULL,
+ SkShader* s = SkGradientShader::CreateSweep(0,0, colors, nullptr,
SK_ARRAY_COUNT(colors), 0, &local);
SkPaint paint;
@@ -37,7 +37,7 @@ protected:
SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif",
SkTypeface::kBold);
- if (NULL == orig) {
+ if (nullptr == orig) {
orig = SkTypeface::RefDefault();
}
fColorType = new SkGTypeface(orig, paint);
@@ -59,7 +59,7 @@ protected:
for (SkScalar size = 10; size <= 100; size += 10) {
paint.setTextSize(size);
- canvas->translate(0, paint.getFontMetrics(NULL));
+ canvas->translate(0, paint.getFontMetrics(nullptr));
canvas->drawText("Hamburgefons", 12, 10, 10, paint);
}
}
diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp
index 2926523c27..55d7697e35 100644
--- a/gm/colortypexfermode.cpp
+++ b/gm/colortypexfermode.cpp
@@ -20,7 +20,7 @@ public:
const static int W = 64;
const static int H = 64;
ColorTypeXfermodeGM()
- : fColorType(NULL) {
+ : fColorType(nullptr) {
}
virtual ~ColorTypeXfermodeGM() {
@@ -35,7 +35,7 @@ protected:
};
SkMatrix local;
local.setRotate(180);
- SkShader* s = SkGradientShader::CreateSweep(0,0, colors, NULL,
+ SkShader* s = SkGradientShader::CreateSweep(0,0, colors, nullptr,
SK_ARRAY_COUNT(colors), 0, &local);
SkPaint paint;
@@ -44,7 +44,7 @@ protected:
SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif",
SkTypeface::kBold);
- if (NULL == orig) {
+ if (nullptr == orig) {
orig = SkTypeface::RefDefault();
}
fColorType = new SkGTypeface(orig, paint);
@@ -138,7 +138,7 @@ protected:
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
p.setStyle(SkPaint::kStroke_Style);
- p.setShader(NULL);
+ p.setShader(nullptr);
canvas->drawRect(r, p);
textP.setXfermode(mode);
diff --git a/gm/colorwheel.cpp b/gm/colorwheel.cpp
index dfa81ead70..efa3a6b0b4 100644
--- a/gm/colorwheel.cpp
+++ b/gm/colorwheel.cpp
@@ -40,7 +40,7 @@ DEF_SIMPLE_GM(colorwheel, canvas, 256, 256) {
DEF_SIMPLE_GM(colorwheelnative, canvas, 128, 28) {
SkPaint paint;
- sk_tool_utils::set_portable_typeface(&paint, NULL, SkTypeface::kBold);
+ sk_tool_utils::set_portable_typeface(&paint, nullptr, SkTypeface::kBold);
paint.setTextSize(18.0f);
canvas->clear(sk_tool_utils::color_to_565(SK_ColorLTGRAY));
diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp
index 74c877d8e6..bcbd7fd17a 100644
--- a/gm/complexclip.cpp
+++ b/gm/complexclip.cpp
@@ -115,7 +115,7 @@ protected:
boundPaint.setColor(SK_ColorRED);
boundPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, boundPaint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
}
for (int invBits = 0; invBits < 4; ++invBits) {
diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp
index 9d2103beb4..f5ab996f37 100644
--- a/gm/composeshader.cpp
+++ b/gm/composeshader.cpp
@@ -23,14 +23,14 @@ static SkShader* make_shader(SkXfermode::Mode mode) {
pts[1].set(SkIntToScalar(100), 0);
colors[0] = SK_ColorRED;
colors[1] = SK_ColorBLUE;
- SkAutoTUnref<SkShader> shaderA(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ SkAutoTUnref<SkShader> shaderA(SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode));
pts[0].set(0, 0);
pts[1].set(0, SkIntToScalar(100));
colors[0] = SK_ColorBLACK;
colors[1] = SkColorSetARGB(0x80, 0, 0, 0);
- SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode));
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode));
@@ -102,7 +102,7 @@ protected:
canvas->save();
for (int alpha = 0xFF; alpha > 0; alpha -= 0x28) {
paint.setAlpha(0xFF);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
canvas->drawRect(r, paint);
paint.setAlpha(alpha);
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index f5d7853ba7..3d2e5865d8 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -40,17 +40,17 @@ protected:
void onOnceBeforeDraw() override {
SkColor colors[] = { 0xFFFF0000, 0x2000FF00, 0xFF0000FF};
SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(kRectSize, kRectSize) };
- fShader.reset(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ fShader.reset(SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode));
}
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
this->drawGpuOnlyMessage(canvas);
return;
}
@@ -92,7 +92,7 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp
index 6c494cdfc4..3eae959a65 100644
--- a/gm/convex_all_line_paths.cpp
+++ b/gm/convex_all_line_paths.cpp
@@ -165,7 +165,7 @@ protected:
};
static_assert(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), "array_mismatch");
- SkAutoTDeleteArray<SkPoint> data(NULL);
+ SkAutoTDeleteArray<SkPoint> data(nullptr);
const SkPoint* points;
int numPts;
if (index < (int) SK_ARRAY_COUNT(gPoints)) {
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index 2aa05a83d2..fbfd1670d5 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -169,7 +169,7 @@ protected:
clip->getBounds(&bounds);
bounds.outset(2, 2);
bounds.offset(x, y);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
} else {
canvas->save();
}
@@ -192,7 +192,7 @@ protected:
clip->getBounds(&bounds);
bounds.outset(2, 2);
bounds.offset(x, y);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
} else {
canvas->save();
}
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 95482f74be..b6a05cc6be 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -151,12 +151,12 @@ protected:
void onDraw(SkCanvas* canvas) override {
using namespace GrDefaultGeoProcFactory;
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
@@ -176,7 +176,7 @@ protected:
for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) {
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
@@ -227,7 +227,7 @@ protected:
for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) {
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
diff --git a/gm/dashcubics.cpp b/gm/dashcubics.cpp
index 246d0548ca..ecbe41537b 100644
--- a/gm/dashcubics.cpp
+++ b/gm/dashcubics.cpp
@@ -45,7 +45,7 @@ protected:
canvas->drawPath(path, paint);
paint.setColor(SK_ColorGREEN);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
paint.setStrokeWidth(0);
canvas->drawPath(path, paint);
}
diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp
index e0cb2d714f..3eee43d147 100644
--- a/gm/dcshader.cpp
+++ b/gm/dcshader.cpp
@@ -226,7 +226,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
// This GM exists to test a specific feature of the GPU backend. It does not work with the
// sw rasterizer, tile modes, etc.
- if (NULL == canvas->getGrContext()) {
+ if (nullptr == canvas->getGrContext()) {
this->drawGpuOnlyMessage(canvas);
return;
}
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index f6bc0b2b9c..c66e03fdc8 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -81,7 +81,7 @@ protected:
canvas->scale(scales[i], scales[i]);
paint.setTextSize(textSizes[i]);
canvas->drawText(text, textLen, 0, 0, paint);
- y += paint.getFontMetrics(NULL)*scales[i];
+ y += paint.getFontMetrics(nullptr)*scales[i];
}
// check rotation
@@ -95,7 +95,7 @@ protected:
for (int ps = 6; ps <= 32; ps += 3) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, rotX, rotY, paint);
- rotY += paint.getFontMetrics(NULL);
+ rotY += paint.getFontMetrics(nullptr);
}
}
@@ -111,7 +111,7 @@ protected:
canvas->scale(scaleFactor, scaleFactor);
paint.setTextSize(textSizes[i]);
canvas->drawText(text, textLen, 0, 0, paint);
- y += paint.getFontMetrics(NULL)*scaleFactor;
+ y += paint.getFontMetrics(nullptr)*scaleFactor;
}
// check pos text
@@ -156,7 +156,7 @@ protected:
paint.setColor(fg[i]);
canvas->drawText(text, textLen, x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
}
paint.setColor(0xFF181C18);
@@ -170,7 +170,7 @@ protected:
paint.setColor(fg[i]);
canvas->drawText(text, textLen, x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
}
// check skew
@@ -202,7 +202,7 @@ protected:
// since we prepended this matrix already, we blit using identity
inputCanvas->resetMatrix();
SkImage* image = surface->newImageSnapshot();
- inputCanvas->drawImage(image, 0, 0, NULL);
+ inputCanvas->drawImage(image, 0, 0, nullptr);
image->unref();
}
#endif
diff --git a/gm/discard.cpp b/gm/discard.cpp
index 93da1ab52a..85ef382ae7 100644
--- a/gm/discard.cpp
+++ b/gm/discard.cpp
@@ -37,7 +37,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrContext* context = canvas->getGrContext();
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
@@ -47,7 +47,7 @@ protected:
SkImageInfo info = SkImageInfo::MakeN32Premul(size);
SkSurface* surface = SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info);
- if (NULL == surface) {
+ if (nullptr == surface) {
return;
}
@@ -73,7 +73,7 @@ protected:
surface->getCanvas()->drawPaint(paint);
break;
}
- surface->draw(canvas, 10.f*x, 10.f*y, NULL);
+ surface->draw(canvas, 10.f*x, 10.f*y, nullptr);
}
}
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index 4450fe2eec..353d14ecd8 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -118,53 +118,53 @@ protected:
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
- 0.0f, displ, NULL, &cropRect))->unref();
+ 0.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 0, 200, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 16.0f, displ, NULL, &cropRect))->unref();
+ 16.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 100, 200, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
- 32.0f, displ, NULL, &cropRect))->unref();
+ 32.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 200, 200, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 48.0f, displ, NULL, &cropRect))->unref();
+ 48.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 300, 200, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 64.0f, displ, NULL, &cropRect))->unref();
+ 64.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 400, 200, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kG_ChannelSelectorType,
- 40.0f, displ, NULL, &cropRect))->unref();
+ 40.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 0, 300, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kB_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ, NULL, &cropRect))->unref();
+ 40.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 100, 300, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kB_ChannelSelectorType,
- 40.0f, displ, NULL, &cropRect))->unref();
+ 40.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 200, 300, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ, NULL, &cropRect))->unref();
+ 40.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 300, 300, paint);
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, displ, NULL, &cropRect))->unref();
+ 40.0f, displ, nullptr, &cropRect))->unref();
drawClippedBitmap(canvas, 400, 300, paint);
// Tests for images of different sizes
@@ -199,7 +199,7 @@ protected:
paint.setImageFilter(SkDisplacementMapEffect::Create(
SkDisplacementMapEffect::kG_ChannelSelectorType,
SkDisplacementMapEffect::kA_ChannelSelectorType,
- 40.0f, NULL))->unref();
+ 40.0f, nullptr))->unref();
drawClippedBitmap(canvas, 400, 400, paint);
}
diff --git a/gm/distantclip.cpp b/gm/distantclip.cpp
index 54938b0d13..dbfe9160a8 100644
--- a/gm/distantclip.cpp
+++ b/gm/distantclip.cpp
@@ -34,7 +34,7 @@ protected:
// We record a picture of huge vertical extents in which we clear the canvas to red, create
// a 'extents' by 'extents' round rect clip at a vertical offset of 'offset', then draw
// green into that.
- SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, NULL, 0);
+ SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, nullptr, 0);
rec->drawColor(SK_ColorRED);
rec->save();
SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents);
@@ -48,7 +48,7 @@ protected:
// Next we play that picture into another picture of the same size.
pict->playback(recorder.beginRecording(pict->cullRect().width(),
pict->cullRect().height(),
- NULL, 0));
+ nullptr, 0));
SkAutoTUnref<SkPicture> pict2(recorder.endRecording());
// Finally we play the part of that second picture that should be green into the canvas.
diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp
index 5732378703..d7a8b35927 100644
--- a/gm/downsamplebitmap.cpp
+++ b/gm/downsamplebitmap.cpp
@@ -171,7 +171,7 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
int fSize;
void make_bitmap() override {
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
SkString resourcePath = GetResourcePath(fFilename.c_str());
SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
@@ -219,20 +219,20 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkScalar x = 4;
SkScalar y = 4;
- canvas->drawBitmap(fBM, x, y, NULL);
+ canvas->drawBitmap(fBM, x, y, nullptr);
y += fBM.height() + 4;
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(fBM, NULL));
+ SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(fBM, nullptr));
SkMipMap::Level level;
SkScalar scale = 0.5f;
while (mm->extractLevel(scale, &level)) {
SkImageInfo info = SkImageInfo::MakeN32Premul(level.fWidth, level.fHeight);
SkBitmap bm;
- bm.installPixels(info, level.fPixels, level.fRowBytes, NULL,
+ bm.installPixels(info, level.fPixels, level.fRowBytes, nullptr,
&release_mipmap, (void*)(SkRef(mm.get())));
bm.setImmutable();
- canvas->drawBitmap(bm, x, y, NULL);
+ canvas->drawBitmap(bm, x, y, nullptr);
y += bm.height() + 4;
scale /= 2;
if (info.width() == 1 || info.height() == 1) {
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 89bd49c0a2..858e4bf056 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -14,7 +14,7 @@ class DrawAtlasGM : public skiagm::GM {
static SkImage* MakeAtlas(SkCanvas* caller, const SkRect& target) {
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
- if (NULL == surface) {
+ if (nullptr == surface) {
surface.reset(SkSurface::NewRaster(info));
}
SkCanvas* canvas = surface->getCanvas();
@@ -28,7 +28,7 @@ class DrawAtlasGM : public skiagm::GM {
r.inset(-1, -1);
// zero out a place (with a 1-pixel border) to land our drawing.
canvas->drawRect(r, paint);
- paint.setXfermode(NULL);
+ paint.setXfermode(nullptr);
paint.setColor(SK_ColorBLUE);
paint.setAntiAlias(true);
canvas->drawOval(target, paint);
@@ -52,7 +52,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
const SkRect target = { 50, 50, 80, 90 };
- if (NULL == fAtlas) {
+ if (nullptr == fAtlas) {
fAtlas.reset(MakeAtlas(canvas, target));
}
@@ -91,9 +91,9 @@ protected:
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setAntiAlias(true);
- canvas->drawAtlas(fAtlas, xform, tex, N, NULL, &paint);
+ canvas->drawAtlas(fAtlas, xform, tex, N, nullptr, &paint);
canvas->translate(0, 100);
- canvas->drawAtlas(fAtlas, xform, tex, colors, N, SkXfermode::kSrcIn_Mode, NULL, &paint);
+ canvas->drawAtlas(fAtlas, xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
}
private:
diff --git a/gm/drawatlascolor.cpp b/gm/drawatlascolor.cpp
index a04822f033..b5f9d7a285 100644
--- a/gm/drawatlascolor.cpp
+++ b/gm/drawatlascolor.cpp
@@ -20,7 +20,7 @@ static SkImage* make_atlas(SkCanvas* caller, int atlasSize) {
SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
- if (NULL == surface) {
+ if (nullptr == surface) {
surface.reset(SkSurface::NewRaster(info));
}
SkCanvas* canvas = surface->getCanvas();
@@ -72,7 +72,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
const SkRect target = SkRect::MakeWH(SkIntToScalar(kAtlasSize), SkIntToScalar(kAtlasSize));
- if (NULL == fAtlas) {
+ if (nullptr == fAtlas) {
fAtlas.reset(make_atlas(canvas, kAtlasSize));
}
@@ -138,7 +138,7 @@ protected:
SkPaint textP;
textP.setTextSize(SkIntToScalar(kTextPad));
textP.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&textP, NULL);
+ sk_tool_utils::set_portable_typeface(&textP, nullptr);
for (int i = 0; i < numModes; ++i) {
canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel),
@@ -152,11 +152,11 @@ protected:
SkIntToScalar(kTextPad+kPad));
// w/o a paint
canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors,
- gModes[i].fMode, NULL, NULL);
+ gModes[i].fMode, nullptr, nullptr);
canvas->translate(0.0f, numColors*(target.height()+kPad));
// w a paint
canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors,
- gModes[i].fMode, NULL, &paint);
+ gModes[i].fMode, nullptr, &paint);
canvas->restore();
}
}
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 2a41465a35..dd6d2b7a7d 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -81,12 +81,12 @@ static SkImage* makebm(SkBitmap* bm, int w, int h) {
static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkIRect& srcR,
const SkRect& dstR) {
- canvas->drawBitmapRect(bm, srcR, dstR, NULL);
+ canvas->drawBitmapRect(bm, srcR, dstR, nullptr);
}
static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcR,
const SkRect& dstR) {
- canvas->drawImageRect(image, srcR, dstR, NULL);
+ canvas->drawImageRect(image, srcR, dstR, nullptr);
}
static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcIR,
@@ -226,6 +226,6 @@ private:
typedef skiagm::GM INHERITED;
};
-DEF_GM( return new DrawBitmapRectGM(canvasproc, NULL); )
+DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); )
DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); )
DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); )
diff --git a/gm/drawfilter.cpp b/gm/drawfilter.cpp
index 8c29f07b02..b0a21e9a11 100644
--- a/gm/drawfilter.cpp
+++ b/gm/drawfilter.cpp
@@ -24,7 +24,7 @@ class TestFilter : public SkDrawFilter {
public:
bool filter(SkPaint* p, Type) override {
p->setColor(SK_ColorRED);
- p->setMaskFilter(NULL);
+ p->setMaskFilter(nullptr);
return true;
}
};
@@ -53,7 +53,7 @@ protected:
p.setColor(SK_ColorBLUE);
p.setMaskFilter(fBlur.get());
SkRect r = { 20, 20, 100, 100 };
- canvas->setDrawFilter(NULL);
+ canvas->setDrawFilter(nullptr);
canvas->drawRect(r, p);
TestFilter redNoBlur;
canvas->setDrawFilter(&redNoBlur);
@@ -61,7 +61,7 @@ protected:
canvas->drawRect(r, p);
// Must unset if the DrawFilter is from the stack to avoid refcount errors!
- canvas->setDrawFilter(NULL);
+ canvas->setDrawFilter(nullptr);
}
private:
diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp
index 624358f7eb..ffa7d6c91b 100644
--- a/gm/drawlooper.cpp
+++ b/gm/drawlooper.cpp
@@ -18,7 +18,7 @@
class DrawLooperGM : public skiagm::GM {
public:
- DrawLooperGM() : fLooper(NULL) {
+ DrawLooperGM() : fLooper(nullptr) {
this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
}
diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp
index 56f99082f4..85071c56c4 100644
--- a/gm/drawminibitmaprect.cpp
+++ b/gm/drawminibitmaprect.cpp
@@ -16,7 +16,7 @@
static SkImage* makebm(SkCanvas* caller, int w, int h) {
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
- if (NULL == surface) {
+ if (nullptr == surface) {
surface.reset(SkSurface::NewRaster(info));
}
SkCanvas* canvas = surface->getCanvas();
@@ -79,7 +79,7 @@ protected:
SkISize onISize() override { return SkISize::Make(gSize, gSize); }
void onDraw(SkCanvas* canvas) override {
- if (NULL == fImage) {
+ if (nullptr == fImage) {
fImage.reset(makebm(canvas, gSurfaceSize, gSurfaceSize));
}
diff --git a/gm/dropshadowimagefilter.cpp b/gm/dropshadowimagefilter.cpp
index e06264c9da..1b6bca42d0 100644
--- a/gm/dropshadowimagefilter.cpp
+++ b/gm/dropshadowimagefilter.cpp
@@ -58,7 +58,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
bm.allocN32Pixels(bounds.width(), bounds.height());
bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
- draw_path(&c, r, NULL);
+ draw_path(&c, r, nullptr);
paint.setImageFilter(imf);
canvas->save();
@@ -125,7 +125,7 @@ protected:
SkImageFilter::CropRect::kHasAll_CropEdge);
SkImageFilter* filters[] = {
- NULL,
+ nullptr,
SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
SkDropShadowImageFilter::Create(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE,
@@ -133,11 +133,11 @@ protected:
SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE,
- SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, cfif, NULL),
+ SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, cfif, nullptr),
SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE,
- SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NULL, &cropRect),
+ SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr, &cropRect),
SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE,
- SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NULL, &bogusRect),
+ SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr, &bogusRect),
SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE,
SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode),
};
diff --git a/gm/etc1bitmap.cpp b/gm/etc1bitmap.cpp
index 363bd4419c..11a700eabc 100644
--- a/gm/etc1bitmap.cpp
+++ b/gm/etc1bitmap.cpp
@@ -98,7 +98,7 @@ protected:
SkString filename = GetResourcePath("mandrill_128.");
filename.append(this->fileExtension());
SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()));
- if (NULL == fileData) {
+ if (nullptr == fileData) {
SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n");
return;
}
@@ -182,7 +182,7 @@ protected:
SkBitmap bm;
SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
SkAutoDataUnref fileData(SkData::NewFromFileName(pkmFilename.c_str()));
- if (NULL == fileData) {
+ if (nullptr == fileData) {
SkDebugf("Could not open the file. Did you forget to set the resourcePath?\n");
return;
}
diff --git a/gm/factory.cpp b/gm/factory.cpp
index 0a938629b9..66cb65ee24 100644
--- a/gm/factory.cpp
+++ b/gm/factory.cpp
@@ -37,7 +37,7 @@ protected:
SkAutoTUnref<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(1));
SkAssertResult(SkInstallDiscardablePixelRef(SkImageGenerator::NewFromEncoded(data),
- NULL, &fBitmap, pool));
+ nullptr, &fBitmap, pool));
}
}
diff --git a/gm/fatpathfill.cpp b/gm/fatpathfill.cpp
index 711d713852..be5fbc4d56 100644
--- a/gm/fatpathfill.cpp
+++ b/gm/fatpathfill.cpp
@@ -36,7 +36,7 @@ static void draw_fatpath(SkCanvas* canvas, SkSurface* surface, const SkPath& pat
surface->getCanvas()->clear(SK_ColorTRANSPARENT);
surface->getCanvas()->drawPath(path, paint);
- surface->draw(canvas, 0, 0, NULL);
+ surface->draw(canvas, 0, 0, nullptr);
paint.setAntiAlias(true);
paint.setColor(SK_ColorRED);
diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp
index 1af16959c2..5c63910a78 100644
--- a/gm/filterbitmap.cpp
+++ b/gm/filterbitmap.cpp
@@ -196,7 +196,7 @@ protected:
}
void makeBitmap() override {
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
SkString resourcePath = GetResourcePath(fFilename.c_str());
SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp
index f6797db9f3..fe06ff1049 100644
--- a/gm/filterfastbounds.cpp
+++ b/gm/filterfastbounds.cpp
@@ -116,7 +116,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) {
SkDropShadowImageFilter::Create(10.0f, 10.0f,
3.0f, 3.0f,
SK_ColorRED, kBoth,
- source, NULL));
+ source, nullptr));
add_paint(dsif, paints);
}
@@ -127,7 +127,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) {
3.0f, 3.0f,
SK_ColorRED,
SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode,
- source, NULL));
+ source, nullptr));
add_paint(dsif, paints);
}
@@ -231,7 +231,7 @@ protected:
//-----------
// Normal paints (no source)
SkTArray<SkPaint> paints;
- create_paints(NULL, &paints);
+ create_paints(nullptr, &paints);
//-----------
// Paints with a PictureImageFilter as a source
diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp
index 8df39bcec7..c5d7166423 100644
--- a/gm/filterindiabox.cpp
+++ b/gm/filterindiabox.cpp
@@ -99,7 +99,7 @@ protected:
}
void makeBitmap() {
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
SkString resourcePath = GetResourcePath(fFilename.c_str());
SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
diff --git a/gm/fontcache.cpp b/gm/fontcache.cpp
index 77a4c86572..30f8892c78 100644
--- a/gm/fontcache.cpp
+++ b/gm/fontcache.cpp
@@ -21,8 +21,8 @@ static SkScalar draw_string(SkCanvas* canvas, const SkString& text, SkScalar x,
class FontCacheGM : public skiagm::GM {
public:
FontCacheGM() {
- fTypefaces[0] = NULL;
- fTypefaces[1] = NULL;
+ fTypefaces[0] = nullptr;
+ fTypefaces[1] = nullptr;
}
virtual ~FontCacheGM() {
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index 9339115d0b..67be00d0ac 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -36,7 +36,7 @@ static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
SkSafeUnref(paint.setTypeface(typeface));
x = drawString(canvas, ch, x, y, paint) + 20;
- if (NULL == typeface) {
+ if (nullptr == typeface) {
return x;
}
@@ -55,7 +55,7 @@ static const char* ja = "ja";
class FontMgrGM : public skiagm::GM {
public:
- FontMgrGM(SkFontMgr* fontMgr = NULL) {
+ FontMgrGM(SkFontMgr* fontMgr = nullptr) {
SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
fName.set("fontmgr_iter");
@@ -92,7 +92,7 @@ protected:
for (int i = 0; i < count; ++i) {
SkString familyName;
fm->getFamilyName(i, &familyName);
- paint.setTypeface(NULL);
+ paint.setTypeface(nullptr);
(void)drawString(canvas, familyName, 20, y, paint);
SkScalar x = 220;
@@ -111,7 +111,7 @@ protected:
x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_str(), &zh, 1, fs);
x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_str(), &ja, 1, fs);
// check that emoji characters are found
- x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c_str(), NULL,0, fs);
+ x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c_str(), nullptr,0, fs);
}
y += 24;
}
@@ -199,7 +199,7 @@ protected:
break;
}
}
- if (NULL == fset.get()) {
+ if (nullptr == fset.get()) {
return;
}
diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp
index 6087478566..69cf346c4d 100644
--- a/gm/fontscaler.cpp
+++ b/gm/fontscaler.cpp
@@ -73,7 +73,7 @@ protected:
for (int ps = 6; ps <= 22; ps++) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
}
}
canvas->translate(0, SkIntToScalar(360));
diff --git a/gm/fontscalerdistortable.cpp b/gm/fontscalerdistortable.cpp
index 715f32169c..a207f967fd 100644
--- a/gm/fontscalerdistortable.cpp
+++ b/gm/fontscalerdistortable.cpp
@@ -75,7 +75,7 @@ protected:
for (int ps = 6; ps <= 22; ps++) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
}
}
canvas->translate(0, SkIntToScalar(360));
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index a46f828784..63acb40c13 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -14,7 +14,7 @@
static SkShader* make_heatGradient(const SkPoint pts[2]) {
const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE };
- return SkGradientShader::CreateLinear(pts, bw, NULL,
+ return SkGradientShader::CreateLinear(pts, bw, nullptr,
SK_ARRAY_COUNT(bw),
SkShader::kClamp_TileMode);
}
@@ -106,7 +106,7 @@ static SkShader* make_gradient(SkColor c) {
SkColor colors[2];
colors[0] = c;
colors[1] = SkColorSetA(c, 0);
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
static void set_face(SkPaint* paint) {
@@ -118,7 +118,7 @@ static void draw_pair(SkCanvas* canvas, SkPaint* paint, SkShader* shader) {
const char text[] = "Now is the time for all good";
const size_t len = strlen(text);
- paint->setShader(NULL);
+ paint->setShader(nullptr);
canvas->drawText(text, len, 10, 20, *paint);
paint->setShader(SkShader::CreateColorShader(paint->getColor()))->unref();
canvas->drawText(text, len, 10, 40, *paint);
@@ -134,7 +134,7 @@ public:
GammaShaderTextGM() {
const SkColor colors[] = { SK_ColorBLACK, SK_ColorRED, SK_ColorBLUE };
for (size_t i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) {
- fShaders[i] = NULL;
+ fShaders[i] = nullptr;
fColors[i] = colors[i];
}
}
diff --git a/gm/giantbitmap.cpp b/gm/giantbitmap.cpp
index e8bfad4990..571dbd8114 100644
--- a/gm/giantbitmap.cpp
+++ b/gm/giantbitmap.cpp
@@ -25,7 +25,7 @@ class GiantBitmapGM : public skiagm::GM {
bool fDoRotate;
const SkBitmap& getBitmap() {
- if (NULL == fBM) {
+ if (nullptr == fBM) {
fBM = new SkBitmap;
fBM->allocN32Pixels(W, H);
fBM->eraseColor(SK_ColorWHITE);
@@ -60,7 +60,7 @@ class GiantBitmapGM : public skiagm::GM {
}
public:
- GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(NULL) {
+ GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(nullptr) {
fMode = mode;
fDoFilter = doFilter;
fDoRotate = doRotate;
diff --git a/gm/glyph_pos.cpp b/gm/glyph_pos.cpp
index e57f5c6767..15229b8dab 100644
--- a/gm/glyph_pos.cpp
+++ b/gm/glyph_pos.cpp
@@ -138,7 +138,7 @@ protected:
if (drawRef) {
SkScalar widths[sizeof(kText) - 1];
- paint.getTextWidths(kText, sizeof(kText) - 1, widths, NULL);
+ paint.getTextWidths(kText, sizeof(kText) - 1, widths, nullptr);
paint.setStrokeWidth(0.0f);
paint.setStyle(SkPaint::kStroke_Style);
diff --git a/gm/glyph_pos_align.cpp b/gm/glyph_pos_align.cpp
index e8528047aa..9add494ffd 100644
--- a/gm/glyph_pos_align.cpp
+++ b/gm/glyph_pos_align.cpp
@@ -36,7 +36,7 @@ protected:
paint.setFakeBoldText(true);
const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}};
- SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors, NULL,
+ SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode));
paint.setShader(grad);
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h
index 029a533c62..6767b90f51 100644
--- a/gm/gm_expectations.h
+++ b/gm/gm_expectations.h
@@ -147,10 +147,10 @@ namespace skiagm {
* If this Expectation is based on a single SkBitmap, return a
* pointer to that SkBitmap. Otherwise (if the Expectation is
* empty, or if it was based on a list of checksums rather
- * than a single bitmap), returns NULL.
+ * than a single bitmap), returns nullptr.
*/
const SkBitmap *asBitmap() const {
- return (kUnknown_SkColorType == fBitmap.colorType()) ? NULL : &fBitmap;
+ return (kUnknown_SkColorType == fBitmap.colorType()) ? nullptr : &fBitmap;
}
/**
diff --git a/gm/gradientDirtyLaundry.cpp b/gm/gradientDirtyLaundry.cpp
index 2ba0963013..8ef5fc9229 100644
--- a/gm/gradientDirtyLaundry.cpp
+++ b/gm/gradientDirtyLaundry.cpp
@@ -30,9 +30,9 @@ static const SkColor gColors[] = {
//static const SkScalar gPos[] = { SK_Scalar1*999/2000, SK_Scalar1*1001/2000 };
static const GradData gGradData[] = {
- { 40, gColors, NULL },
+ { 40, gColors, nullptr },
// { 2, gColors, gPos },
- // { 2, gCol2, NULL },
+ // { 2, gCol2, nullptr },
};
static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp
index 10499ca986..77227599e6 100644
--- a/gm/gradient_matrix.cpp
+++ b/gm/gradient_matrix.cpp
@@ -62,7 +62,7 @@ static const SkScalar TESTGRID_Y = SkIntToScalar(200);
static const int IMAGES_X = 4; // number of images per row
static SkShader* make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
- return SkGradientShader::CreateLinear(pts, gColors, NULL, SK_ARRAY_COUNT(gColors),
+ return SkGradientShader::CreateLinear(pts, gColors, nullptr, SK_ARRAY_COUNT(gColors),
SkShader::kClamp_TileMode, 0, &localMatrix);
}
@@ -71,7 +71,7 @@ static SkShader* make_radial_gradient(const SkPoint pts[2], const SkMatrix& loca
center.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
float radius = (center - pts[0]).length();
- return SkGradientShader::CreateRadial(center, radius, gColors, NULL, SK_ARRAY_COUNT(gColors),
+ return SkGradientShader::CreateRadial(center, radius, gColors, nullptr, SK_ARRAY_COUNT(gColors),
SkShader::kClamp_TileMode, 0, &localMatrix);
}
diff --git a/gm/gradients.cpp b/gm/gradients.cpp
index ea2b8eae6b..ee6380c7ca 100644
--- a/gm/gradients.cpp
+++ b/gm/gradients.cpp
@@ -31,10 +31,10 @@ static const SkColor gColorClamp[] = {
};
static const GradData gGradData[] = {
- { 2, gColors, NULL },
+ { 2, gColors, nullptr },
{ 2, gColors, gPos0 },
{ 2, gColors, gPos1 },
- { 5, gColors, NULL },
+ { 5, gColors, nullptr },
{ 5, gColors, gPos2 },
{ 4, gColorClamp, gPosClamp }
};
@@ -311,7 +311,7 @@ protected:
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
SkShader* shader = SkGradientShader::CreateRadial(
SkPoint(center),
- SkIntToScalar(200), gColors, NULL, 5,
+ SkIntToScalar(200), gColors, nullptr, 5,
SkShader::kClamp_TileMode);
paint.setShader(shader);
canvas->drawRect(r, paint);
@@ -401,18 +401,18 @@ protected:
for (size_t i = 0; i < SK_ARRAY_COUNT(flags); i++) {
SkAutoTUnref<SkShader> sweep(
SkGradientShader::CreateSweep(cx, cy, sweep_colors,
- NULL, SK_ARRAY_COUNT(sweep_colors),
- flags[i], NULL));
+ nullptr, SK_ARRAY_COUNT(sweep_colors),
+ flags[i], nullptr));
SkAutoTUnref<SkShader> radial1(
SkGradientShader::CreateRadial(center, radius, colors1,
- NULL, SK_ARRAY_COUNT(colors1),
+ nullptr, SK_ARRAY_COUNT(colors1),
SkShader::kClamp_TileMode,
- flags[i], NULL));
+ flags[i], nullptr));
SkAutoTUnref<SkShader> radial2(
SkGradientShader::CreateRadial(center, radius, colors2,
- NULL, SK_ARRAY_COUNT(colors2),
+ nullptr, SK_ARRAY_COUNT(colors2),
SkShader::kClamp_TileMode,
- flags[i], NULL));
+ flags[i], nullptr));
paint1.setShader(sweep);
paint2.setShader(radial1);
paint3.setShader(radial2);
@@ -445,7 +445,7 @@ protected:
const SkPoint center = { 0, 0 };
const SkScalar kRadius = 3000;
const SkColor gColors[] = { 0xFFFFFFFF, 0xFF000000 };
- fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, NULL, 2,
+ fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, nullptr, 2,
SkShader::kClamp_TileMode));
}
diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp
index d06ae5bdbf..3e73d1b4b3 100644
--- a/gm/gradients_no_texture.cpp
+++ b/gm/gradients_no_texture.cpp
@@ -20,10 +20,10 @@ static const SkColor gColors[] = {
};
static const GradData gGradData[] = {
- { 1, gColors, NULL },
- { 2, gColors, NULL },
- { 3, gColors, NULL },
- { 4, gColors, NULL },
+ { 1, gColors, nullptr },
+ { 2, gColors, nullptr },
+ { 3, gColors, nullptr },
+ { 4, gColors, nullptr },
};
static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
@@ -126,7 +126,7 @@ struct ColorPos {
SkScalar* fPos;
int fCount;
- ColorPos() : fColors(NULL), fPos(NULL), fCount(0) {}
+ ColorPos() : fColors(nullptr), fPos(nullptr), fCount(0) {}
~ColorPos() {
delete[] fColors;
delete[] fPos;
@@ -180,7 +180,7 @@ static void make1(ColorPos* rec) {
SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorWHITE,
SK_ColorBLACK,
};
- rec->construct(colors, NULL, SK_ARRAY_COUNT(colors));
+ rec->construct(colors, nullptr, SK_ARRAY_COUNT(colors));
}
static void make2(ColorPos* rec) {
diff --git a/gm/gradtext.cpp b/gm/gradtext.cpp
index b576ede644..acb88d6e52 100644
--- a/gm/gradtext.cpp
+++ b/gm/gradtext.cpp
@@ -14,7 +14,7 @@
static SkShader* make_grad(SkScalar width) {
SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -23,7 +23,7 @@ static SkShader* make_grad(SkScalar width) {
static SkShader* make_grad2(SkScalar width) {
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -31,7 +31,7 @@ static SkShader* make_grad2(SkScalar width) {
static SkShader* make_chrome_solid() {
SkColor colors[] = { SK_ColorGREEN, SK_ColorGREEN };
SkPoint pts[] = { { 0, 0 }, { 1, 0 } };
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode);
}
diff --git a/gm/hairmodes.cpp b/gm/hairmodes.cpp
index 74eda7b913..4f85c19883 100644
--- a/gm/hairmodes.cpp
+++ b/gm/hairmodes.cpp
@@ -106,7 +106,7 @@ namespace skiagm {
SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
canvas->drawRect(bounds, fBGPaint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
SkScalar dy = drawCell(canvas, mode,
gAlphaValue[alpha & 1],
gAlphaValue[alpha & 2]);
diff --git a/gm/image.cpp b/gm/image.cpp
index 205b4ab278..726ab97a8f 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -21,7 +21,7 @@ static void drawJpeg(SkCanvas* canvas, const SkISize& size) {
// be exercised on machines other than mike's. Will require a
// rebaseline.
SkAutoDataUnref data(SkData::NewFromFileName("/Users/mike/Downloads/skia.google.jpeg"));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
return;
}
SkImage* image = SkImage::NewFromEncoded(data);
@@ -29,7 +29,7 @@ static void drawJpeg(SkCanvas* canvas, const SkISize& size) {
SkAutoCanvasRestore acr(canvas, true);
canvas->scale(size.width() * 1.0f / image->width(),
size.height() * 1.0f / image->height());
- canvas->drawImage(image, 0, 0, NULL);
+ canvas->drawImage(image, 0, 0, nullptr);
image->unref();
}
}
@@ -76,9 +76,9 @@ static void test_surface(SkCanvas* canvas, SkSurface* surf, bool usePaint) {
// paint.setFilterBitmap(true);
// paint.setAlpha(0x80);
- canvas->drawImage(imgR, 0, 0, usePaint ? &paint : NULL);
- canvas->drawImage(imgG, 0, 80, usePaint ? &paint : NULL);
- surf->draw(canvas, 0, 160, usePaint ? &paint : NULL);
+ canvas->drawImage(imgR, 0, 0, usePaint ? &paint : nullptr);
+ canvas->drawImage(imgG, 0, 80, usePaint ? &paint : nullptr);
+ surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr);
SkRect src1, src2, src3;
src1.iset(0, 0, surf->width(), surf->height());
@@ -92,10 +92,10 @@ static void test_surface(SkCanvas* canvas, SkSurface* surf, bool usePaint) {
dst3.set(0, 400, 65, 465);
dst4.set(0, 480, 65, 545);
- canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : NULL);
- canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : NULL);
- canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : NULL);
- canvas->drawImageRect(imgG, dst4, usePaint ? &paint : NULL);
+ canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : nullptr);
+ canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : nullptr);
+ canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : nullptr);
+ canvas->drawImageRect(imgG, dst4, usePaint ? &paint : nullptr);
imgG->unref();
imgR->unref();
@@ -241,20 +241,20 @@ protected:
if (subset) {
srcR.set(*subset);
}
- canvas->legacy_drawImageRect(image, subset ? &srcR : NULL, dstR, &paint);
+ canvas->legacy_drawImageRect(image, subset ? &srcR : nullptr, dstR, &paint);
canvas->translate(newW + 20.0f, 0);
// image method
SkAutoTUnref<SkImage> image2(image->newImage(newW, newH, subset, fq));
- canvas->drawImage(image2, 0, 0, NULL);
+ canvas->drawImage(image2, 0, 0, nullptr);
canvas->translate(image2->width() + 20.0f, 0);
}
void drawImage(SkCanvas* canvas, SkImage* image, SkFilterQuality fq) {
- canvas->drawImage(image, 0, 0, NULL);
+ canvas->drawImage(image, 0, 0, nullptr);
canvas->translate(image->width() + 20.0f, 0);
- this->drawResized(canvas, image, image->width()*4/10, image->height()*4/10, NULL, fq);
+ this->drawResized(canvas, image, image->width()*4/10, image->height()*4/10, nullptr, fq);
SkIRect subset = SkIRect::MakeLTRB(W/4, H/4, W/2, H/2);
this->drawResized(canvas, image, W, H, &subset, fq);
diff --git a/gm/imagealphathreshold.cpp b/gm/imagealphathreshold.cpp
index a418f0fe68..13a0ffa90b 100644
--- a/gm/imagealphathreshold.cpp
+++ b/gm/imagealphathreshold.cpp
@@ -47,7 +47,7 @@ protected:
SkPaint paint;
paint.setImageFilter(
SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f))->unref();
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
paint.setAntiAlias(true);
SkPaint rect_paint;
diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp
index efb5988d65..f6ac0982b7 100644
--- a/gm/imageblur.cpp
+++ b/gm/imageblur.cpp
@@ -35,7 +35,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkPaint paint;
paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref();
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
const char* str = "The quick brown fox jumped over the lazy dog.";
SkRandom rand;
diff --git a/gm/imageblur2.cpp b/gm/imageblur2.cpp
index 58e40961e4..223582f120 100644
--- a/gm/imageblur2.cpp
+++ b/gm/imageblur2.cpp
@@ -59,7 +59,7 @@ protected:
SkPaint paint;
paint.setImageFilter(SkBlurImageFilter::Create(sigmaX, sigmaY))->unref();
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
SkRandom rand;
SkPaint textPaint;
diff --git a/gm/imageblurtiled.cpp b/gm/imageblurtiled.cpp
index ed4ae6cef3..68e5785ddf 100644
--- a/gm/imageblurtiled.cpp
+++ b/gm/imageblurtiled.cpp
@@ -41,7 +41,7 @@ protected:
for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size) {
canvas->save();
canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size));
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
const char* str[] = {
"The quick",
"brown fox",
diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp
index 54e50e47f2..e28bf5255e 100644
--- a/gm/imagefilters.cpp
+++ b/gm/imagefilters.cpp
@@ -31,7 +31,7 @@ protected:
// want to force a layer, so modes like DstIn can combine meaningfully, but the final
// image can still be shown against our default (opaque) background. non-opaque GMs
// are a lot more trouble to compare/triage.
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
canvas->drawColor(SK_ColorGREEN);
SkPaint paint;
@@ -62,7 +62,7 @@ protected:
for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) {
canvas->save();
- this->doDraw(canvas, modes[i], NULL);
+ this->doDraw(canvas, modes[i], nullptr);
canvas->translate(240, 0);
this->doDraw(canvas, modes[i], imf);
canvas->restore();
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index 61c3f11f58..0101a9c2a0 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -32,7 +32,7 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
- FailImageFilter() : INHERITED(0, NULL) {}
+ FailImageFilter() : INHERITED(0, nullptr) {}
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const override {
@@ -67,7 +67,7 @@ public:
IdentityImageFilter::GetFlattenableType());
}
};
- static IdentityImageFilter* Create(SkImageFilter* input = NULL) {
+ static IdentityImageFilter* Create(SkImageFilter* input = nullptr) {
return new IdentityImageFilter(input);
}
@@ -160,7 +160,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
bm.allocN32Pixels(bounds.width(), bounds.height());
bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
- draw_path(&c, r, NULL);
+ draw_path(&c, r, nullptr);
canvas->drawBitmap(bm, 0, 0, &paint);
}
@@ -176,7 +176,7 @@ static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
bm.allocN32Pixels(bounds.width(), bounds.height());
bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
- draw_path(&c, r, NULL);
+ draw_path(&c, r, nullptr);
SkPoint loc = { r.fLeft, r.fTop };
canvas->getTotalMatrix().mapPoints(&loc, 1);
@@ -216,7 +216,7 @@ protected:
SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode);
SkImageFilter* filters[] = {
- NULL,
+ nullptr,
IdentityImageFilter::Create(),
FailImageFilter::Create(),
SkColorFilterImageFilter::Create(cf),
@@ -309,8 +309,8 @@ protected:
this->installFilter(&paint);
}
if (doSaveLayer) {
- canvas->saveLayer(NULL, &paint);
- paint.setImageFilter(NULL);
+ canvas->saveLayer(nullptr, &paint);
+ paint.setImageFilter(nullptr);
}
this->drawWaterfall(canvas, paint);
diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp
index a641ca3473..362d327b37 100644
--- a/gm/imagefiltersclipped.cpp
+++ b/gm/imagefiltersclipped.cpp
@@ -53,7 +53,7 @@ protected:
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkAutoTUnref<SkShader> shader(
- SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2,
+ SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode)
);
SkPaint paint;
diff --git a/gm/imagefilterscropexpand.cpp b/gm/imagefilterscropexpand.cpp
index 8f90fb14bd..cfbf13a759 100644
--- a/gm/imagefilterscropexpand.cpp
+++ b/gm/imagefilterscropexpand.cpp
@@ -68,7 +68,7 @@ protected:
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkAutoTUnref<SkShader> shader(
- SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2,
+ SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode)
);
SkPaint paint;
@@ -105,7 +105,7 @@ protected:
SkAutoTUnref<SkImageFilter> gradient_circle_source(
SkBitmapSource::Create(gradient_circle));
SkAutoTUnref<SkImageFilter> noop_cropped(
- SkOffsetImageFilter::Create(0, 0, NULL, &crop_rect));
+ SkOffsetImageFilter::Create(0, 0, nullptr, &crop_rect));
SkScalar sk255 = SkIntToScalar(255);
SkScalar matrix[20] = { 1, 0, 0, 0, 0,
0, 1, 0, 0, sk255,
diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp
index c5bef7b3f8..92e45ea499 100644
--- a/gm/imagefilterscropped.cpp
+++ b/gm/imagefilterscropped.cpp
@@ -60,7 +60,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
bm.allocN32Pixels(bounds.width(), bounds.height());
bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
- draw_path(&c, r, NULL);
+ draw_path(&c, r, nullptr);
paint.setImageFilter(imf);
canvas->drawBitmap(bm, 0, 0, &paint);
@@ -149,23 +149,23 @@ protected:
SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get()));
- SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, NULL, &cropRect));
- SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, NULL, &cropRect));
+ SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, nullptr, &cropRect));
+ SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, nullptr, &cropRect));
SkImageFilter* filters[] = {
- NULL,
- SkColorFilterImageFilter::Create(cf.get(), NULL, &cropRect),
- SkBlurImageFilter::Create(1.0f, 1.0f, NULL, &cropRect),
- SkBlurImageFilter::Create(8.0f, 0.0f, NULL, &cropRect),
- SkBlurImageFilter::Create(0.0f, 8.0f, NULL, &cropRect),
- SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &cropRect),
- SkErodeImageFilter::Create(1, 1, NULL, &cropRect),
+ nullptr,
+ SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect),
+ SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect),
+ SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect),
+ SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect),
+ SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect),
+ SkErodeImageFilter::Create(1, 1, nullptr, &cropRect),
SkErodeImageFilter::Create(8, 0, erodeY, &cropRect),
SkErodeImageFilter::Create(0, 8, erodeX, &cropRect),
- SkErodeImageFilter::Create(8, 8, NULL, &cropRect),
- SkMergeImageFilter::Create(NULL, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect),
- SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &bogusRect),
- SkColorFilterImageFilter::Create(cf.get(), NULL, &bogusRect),
+ SkErodeImageFilter::Create(8, 8, nullptr, &cropRect),
+ SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect),
+ SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect),
+ SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect),
};
SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 521dd3c7ef..66b32e99c3 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -194,7 +194,7 @@ protected:
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect cropRect(SkRect::MakeWH(SkIntToScalar(95), SkIntToScalar(100)));
SkAutoTUnref<SkImageFilter> blend(
- SkXfermodeImageFilter::Create(mode, blur, NULL, &cropRect));
+ SkXfermodeImageFilter::Create(mode, blur, nullptr, &cropRect));
SkPaint paint;
paint.setImageFilter(blend);
@@ -211,7 +211,7 @@ protected:
SkIntToScalar(80), SkIntToScalar(80)));
SkImageFilter::CropRect innerRect(SkRect::MakeXYWH(SkIntToScalar(20), SkIntToScalar(20),
SkIntToScalar(60), SkIntToScalar(60)));
- SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1, NULL, &outerRect));
+ SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1, nullptr, &outerRect));
SkAutoTUnref<SkImageFilter> color2(SkColorFilterImageFilter::Create(cf2, color1, &innerRect));
SkPaint paint;
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp
index 2e4756a9b3..b53263606c 100644
--- a/gm/imagefiltersscaled.cpp
+++ b/gm/imagefiltersscaled.cpp
@@ -52,7 +52,7 @@ protected:
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkAutoTUnref<SkShader> shader(
- SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2,
+ SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode)
);
SkPaint paint;
diff --git a/gm/imagefilterstransformed.cpp b/gm/imagefilterstransformed.cpp
index 794a47167a..9259ce4fce 100644
--- a/gm/imagefilterstransformed.cpp
+++ b/gm/imagefilterstransformed.cpp
@@ -45,7 +45,7 @@ protected:
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkAutoTUnref<SkShader> shader(
- SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2,
+ SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode)
);
SkPaint paint;
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 68faf801c6..faa3eefa7e 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -41,7 +41,7 @@ protected:
static const SkColor kColors[] =
{ SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE };
paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), kBmpSize / 2.f, kColors,
- NULL, SK_ARRAY_COUNT(kColors),
+ nullptr, SK_ARRAY_COUNT(kColors),
SkShader::kMirror_TileMode))->unref();
SkBitmap rgbBmp;
rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true);
@@ -156,7 +156,7 @@ protected:
canvas->drawImage(images[i], x, y);
images[i]->unref();
- images[i] = NULL;
+ images[i] = nullptr;
}
}
diff --git a/gm/imagemagnifier.cpp b/gm/imagemagnifier.cpp
index ac1941c121..2bf22262dc 100644
--- a/gm/imagemagnifier.cpp
+++ b/gm/imagemagnifier.cpp
@@ -38,7 +38,7 @@ protected:
SkIntToScalar(WIDTH / 2),
SkIntToScalar(HEIGHT / 2)),
100))->unref();
- canvas->saveLayer(NULL, &filterPaint);
+ canvas->saveLayer(nullptr, &filterPaint);
const char* str = "The quick brown fox jumped over the lazy dog.";
SkRandom rand;
for (int i = 0; i < 25; ++i) {
diff --git a/gm/imageresizetiled.cpp b/gm/imageresizetiled.cpp
index bc640bc6aa..1da2bcea3a 100644
--- a/gm/imageresizetiled.cpp
+++ b/gm/imageresizetiled.cpp
@@ -47,7 +47,7 @@ protected:
canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size));
canvas->scale(SkScalarInvert(RESIZE_FACTOR),
SkScalarInvert(RESIZE_FACTOR));
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
const char* str[] = {
"The quick",
"brown fox",
diff --git a/gm/lerpmode.cpp b/gm/lerpmode.cpp
index f690c76fa6..bcf17c37a8 100644
--- a/gm/lerpmode.cpp
+++ b/gm/lerpmode.cpp
@@ -18,7 +18,7 @@ static void show_circlelayers(SkCanvas* canvas, SkXfermode* mode) {
r.fRight = bounds.centerX();
canvas->drawRect(r, paint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
paint.setColor(0x80FF0000);
r = bounds;
@@ -48,7 +48,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- show_circlelayers(canvas, NULL);
+ show_circlelayers(canvas, nullptr);
canvas->translate(150, 0);
SkAutoTUnref<SkXfermode> mode(SkLerpXfermode::Create(0.5f));
show_circlelayers(canvas, mode.get());
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index a464a07480..d68e67db16 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -93,12 +93,12 @@ protected:
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65));
SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100));
- SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0, NULL, &cropRect));
+ SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0, nullptr, &cropRect));
int y = 0;
for (int i = 0; i < 3; i++) {
- const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : NULL;
- SkImageFilter* input = (i == 2) ? noopCropped.get() : NULL;
+ const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : nullptr;
+ SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr;
paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation,
white,
surfaceScale,
diff --git a/gm/lumafilter.cpp b/gm/lumafilter.cpp
index 46a22f84c4..3244b2b055 100644
--- a/gm/lumafilter.cpp
+++ b/gm/lumafilter.cpp
@@ -38,7 +38,7 @@ static void draw_scene(SkCanvas* canvas, SkColorFilter* filter,
paint.setARGB(0x20, 0, 0, 0xff);
canvas->drawRect(bounds, paint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
r = bounds;
r.inset(kInset, 0);
@@ -119,9 +119,9 @@ protected:
SkShader* fShader1;
SkShader* fShader2;
} shaders[] = {
- { NULL, NULL },
- { NULL, fGr2 },
- { fGr1, NULL },
+ { nullptr, nullptr },
+ { nullptr, fGr2 },
+ { fGr1, nullptr },
{ fGr1, fGr2 },
};
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index b912f90cfe..1e6a49d4b6 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -49,7 +49,7 @@ protected:
void draw(SkCanvas* canvas, int x, int y, const SkIPoint& kernelOffset,
SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha,
- const SkImageFilter::CropRect* cropRect = NULL) {
+ const SkImageFilter::CropRect* cropRect = nullptr) {
SkScalar kernel[9] = {
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
@@ -66,7 +66,7 @@ protected:
kernelOffset,
tileMode,
convolveAlpha,
- NULL,
+ nullptr,
cropRect));
paint.setImageFilter(filter);
canvas->save();
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index 596cc19d6e..4eb5c2aa3c 100644
--- a/gm/mipmap.cpp
+++ b/gm/mipmap.cpp
@@ -45,7 +45,7 @@ static void test_mip(SkCanvas* canvas) {
canvas->drawImageRect(img, dst, &paint);
canvas->translate(0, 20);
}
- canvas->drawImage(img, 20, 20, NULL);
+ canvas->drawImage(img, 20, 20, nullptr);
}
class MipMapGM : public skiagm::GM {
diff --git a/gm/modecolorfilters.cpp b/gm/modecolorfilters.cpp
index 9f70bf8674..b5ede710f1 100644
--- a/gm/modecolorfilters.cpp
+++ b/gm/modecolorfilters.cpp
@@ -20,7 +20,7 @@ static SkShader* make_color_shader(SkColor color) {
static const SkPoint kPts[] = {{0, 0}, {1, 1}};
SkColor colors[] = {color, color};
- return SkGradientShader::CreateLinear(kPts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(kPts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
static SkShader* make_solid_shader() {
@@ -82,7 +82,7 @@ protected:
bgPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
SkShader* shaders[] = {
- NULL, // use a paint color instead of a shader
+ nullptr, // use a paint color instead of a shader
make_solid_shader(),
make_transparent_shader(),
make_trans_black_shader(),
@@ -127,7 +127,7 @@ protected:
paint.setColorFilter(cf);
for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); ++s) {
paint.setShader(shaders[s]);
- bool hasShader = NULL == paint.getShader();
+ bool hasShader = nullptr == paint.getShader();
int paintColorCnt = hasShader ? SK_ARRAY_COUNT(alphas) : SK_ARRAY_COUNT(colors);
SkColor* paintColors = hasShader ? alphas : colors;
for (int pc = 0; pc < paintColorCnt; ++pc) {
@@ -137,7 +137,7 @@ protected:
SkRect rect = SkRect::MakeXYWH(x * kRectWidth, y * kRectHeight,
SkIntToScalar(kRectWidth),
SkIntToScalar(kRectHeight));
- canvas->saveLayer(&rect, NULL);
+ canvas->saveLayer(&rect, nullptr);
canvas->drawRect(rect, bgPaint);
canvas->drawRect(rect, paint);
canvas->restore();
diff --git a/gm/morphology.cpp b/gm/morphology.cpp
index cb321c6efd..3fb11d82d1 100644
--- a/gm/morphology.cpp
+++ b/gm/morphology.cpp
@@ -73,18 +73,18 @@ protected:
for (unsigned j = 0; j < 4; ++j) {
for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) {
- const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL;
+ const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : nullptr;
if (j & 0x01) {
paint.setImageFilter(SkErodeImageFilter::Create(
samples[i].fRadiusX,
samples[i].fRadiusY,
- NULL,
+ nullptr,
cr))->unref();
} else {
paint.setImageFilter(SkDilateImageFilter::Create(
samples[i].fRadiusX,
samples[i].fRadiusY,
- NULL,
+ nullptr,
cr))->unref();
}
drawClippedBitmap(canvas, paint, i * 140, j * 140);
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index 3a0b0fa7d9..88d6cd798f 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -68,7 +68,7 @@ static const SkPicture* make_hex_plane_picture(SkColor fillColor) {
xPos = 0;
for (int x = 0; x < kNumHexX; ++x) {
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
canvas->translate(xPos, yPos + ((x % 2) ? kRoot3Over2 * kHexSide : 0));
canvas->drawPath(hex, fill);
canvas->drawPath(hex, stroke);
@@ -111,7 +111,7 @@ static const SkPicture* make_single_layer_hex_plane_picture() {
SkCanvas* canvas = recorder.beginRecording(kBig, kBig, &bbhFactory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
SkScalar xPos = 0.0f, yPos = 0.0f;
@@ -171,7 +171,7 @@ static const SkPicture* make_tri_picture() {
r.outset(2.0f, 2.0f); // outset for stroke
canvas->clipRect(r);
// The saveLayer/restore block is to exercise layer hoisting
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
canvas->drawPath(tri, fill);
canvas->drawPath(tri, stroke);
canvas->restore();
@@ -245,8 +245,8 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height)
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
SkSurface* surface = canvas->newSurface(info);
- if (NULL == surface) {
- // picture canvas returns NULL so fall back to raster
+ if (nullptr == surface) {
+ // picture canvas returns nullptr so fall back to raster
surface = SkSurface::NewRaster(info);
}
@@ -257,7 +257,7 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height)
// fragments potentially generated by the MultiPictureDraw object
class ComposeStep {
public:
- ComposeStep() : fSurf(NULL), fX(0.0f), fY(0.0f), fPaint(NULL) { }
+ ComposeStep() : fSurf(nullptr), fX(0.0f), fY(0.0f), fPaint(nullptr) { }
~ComposeStep() {
SkSafeUnref(fSurf);
delete fPaint;
@@ -474,7 +474,7 @@ namespace skiagm {
SkASSERT(SK_ARRAY_COUNT(gContentMthds) == kContentCnt);
for (int i = 0; i < kNumPictures; ++i) {
- fPictures[i] = NULL;
+ fPictures[i] = nullptr;
}
}
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 267c41587b..4074add1bb 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -70,7 +70,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- if (NULL == fBitmap.pixelRef()) {
+ if (nullptr == fBitmap.pixelRef()) {
fImage.reset(make_image(canvas, &fCenter));
image_to_bitmap(fImage, &fBitmap);
}
@@ -85,7 +85,7 @@ protected:
{ fixed * 4, fixed * 4 }
};
- canvas->drawBitmap(fBitmap, 10, 10, NULL);
+ canvas->drawBitmap(fBitmap, 10, 10, nullptr);
SkScalar x = SkIntToScalar(100);
SkScalar y = SkIntToScalar(100);
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp
index 35ccc053c4..fdf2aa85fa 100644
--- a/gm/offsetimagefilter.cpp
+++ b/gm/offsetimagefilter.cpp
@@ -96,7 +96,7 @@ protected:
SkIRect cropRect = SkIRect::MakeXYWH(0, 0, 100, 100);
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
- SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, NULL, &rect));
+ SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, nullptr, &rect));
paint.setImageFilter(filter);
drawClippedBitmap(canvas, fBitmap, paint, 2, cropRect);
}
@@ -120,7 +120,7 @@ protected:
SkISize onISize() override { return SkISize::Make(640, 200); }
void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf,
- const SkRect* clipR = NULL) {
+ const SkRect* clipR = nullptr) {
SkPaint p;
if (clipR) {
@@ -167,23 +167,23 @@ protected:
canvas->translate(40, 40);
canvas->save();
- this->doDraw(canvas, r, NULL);
+ this->doDraw(canvas, r, nullptr);
canvas->translate(100, 0);
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20));
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr0));
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr0));
canvas->translate(100, 0);
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r);
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr1));
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr1));
SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40);
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, NULL), &clipR);
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, nullptr), &clipR);
canvas->restore();
// 2nd row
@@ -194,19 +194,19 @@ protected:
*/
// crop==clip==src
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r);
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0), &r);
// crop==src, clip==dst
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r2);
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0), &r2);
// crop==dst, clip==src
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r);
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2), &r);
// crop==clip==dst
canvas->translate(100, 0);
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r2);
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2), &r2);
}
private:
diff --git a/gm/ovals.cpp b/gm/ovals.cpp
index 32c9e71640..e4cc46eb21 100755
--- a/gm/ovals.cpp
+++ b/gm/ovals.cpp
@@ -267,7 +267,7 @@ protected:
canvas->drawRect(oval, rectPaint);
canvas->drawOval(oval, fPaints[i]);
- fPaints[i].setShader(NULL);
+ fPaints[i].setShader(nullptr);
canvas->restore();
}
diff --git a/gm/patch.cpp b/gm/patch.cpp
index df3a84e534..c3e43004a6 100644
--- a/gm/patch.cpp
+++ b/gm/patch.cpp
@@ -17,7 +17,7 @@ static SkShader* make_shader() {
};
const SkPoint pts[] = { { 100.f / 4.f, 0.f }, { 3.f * 100.f / 4.f, 100.f } };
- return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -124,20 +124,20 @@ protected:
canvas->translate(x * 350.0f, y * 350.0f);
switch (x) {
case 0:
- canvas->drawPatch(cubics, NULL, NULL, xfer, paint);
+ canvas->drawPatch(cubics, nullptr, nullptr, xfer, paint);
break;
case 1:
- canvas->drawPatch(cubics, colors, NULL, xfer, paint);
+ canvas->drawPatch(cubics, colors, nullptr, xfer, paint);
break;
case 2:
paint.setShader(shader);
- canvas->drawPatch(cubics, NULL, texCoords, xfer, paint);
- paint.setShader(NULL);
+ canvas->drawPatch(cubics, nullptr, texCoords, xfer, paint);
+ paint.setShader(nullptr);
break;
case 3:
paint.setShader(shader);
canvas->drawPatch(cubics, colors, texCoords, xfer, paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
break;
default:
break;
diff --git a/gm/patchgrid.cpp b/gm/patchgrid.cpp
index 89a9847271..6f77d48a88 100644
--- a/gm/patchgrid.cpp
+++ b/gm/patchgrid.cpp
@@ -110,7 +110,7 @@ protected:
static const int kCols = 4;
canvas->scale(3, 3);
- SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, NULL);
+ SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr);
for (int i = 0; i < kRows; i++) {
for (int j = 0; j < kCols; j++) {
SkPoint points[12];
@@ -137,7 +137,7 @@ protected:
colors[3] = cornerColors[i + 1][j];
colors[2] = cornerColors[i + 1][j + 1];
- grid.setPatch(j, i, points, colors, NULL);
+ grid.setPatch(j, i, points, colors, nullptr);
}
}
@@ -146,7 +146,7 @@ protected:
for (int y = 0; y < dims.height(); y++) {
for (int x = 0; x < dims.width(); x++) {
SkPoint cubics[12];
- grid.getPatch(x, y, cubics, NULL, NULL);
+ grid.getPatch(x, y, cubics, nullptr, nullptr);
draw_control_points(canvas, cubics);
}
}
diff --git a/gm/patheffects.cpp b/gm/patheffects.cpp
index c71d32bb75..517d02e547 100644
--- a/gm/patheffects.cpp
+++ b/gm/patheffects.cpp
@@ -79,7 +79,7 @@ static const PE_Proc gPE[] = { hair_pe, hair2_pe, stroke_pe, dash_pe, one_d_pe }
static void fill_pe(SkPaint* paint) {
paint->setStyle(SkPaint::kFill_Style);
- paint->setPathEffect(NULL);
+ paint->setPathEffect(nullptr);
}
static void discrete_pe(SkPaint* paint) {
diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp
index a2b1ee0142..f4e42e8165 100644
--- a/gm/pathfill.cpp
+++ b/gm/pathfill.cpp
@@ -198,7 +198,7 @@ protected:
canvas->save();
canvas->clipRect(clipR);
- const SkRect* clipPtr = doclip ? &clipR : NULL;
+ const SkRect* clipPtr = doclip ? &clipR : nullptr;
show(canvas, path, paint, clipPtr, clipR.fTop, clipR.centerY());
show(canvas, path, paint, clipPtr, clipR.centerY(), clipR.fBottom);
diff --git a/gm/pathopsskpclip.cpp b/gm/pathopsskpclip.cpp
index c9092f4ad2..1c8cf99cb8 100644
--- a/gm/pathopsskpclip.cpp
+++ b/gm/pathopsskpclip.cpp
@@ -34,7 +34,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkPictureRecorder recorder;
- SkCanvas* rec = recorder.beginRecording(1200, 900, NULL, 0);
+ SkCanvas* rec = recorder.beginRecording(1200, 900, nullptr, 0);
SkPath p;
SkRect r = {
SkIntToScalar(100),
diff --git a/gm/peekpixels.cpp b/gm/peekpixels.cpp
index b8c1678c03..a443c41b89 100644
--- a/gm/peekpixels.cpp
+++ b/gm/peekpixels.cpp
@@ -47,7 +47,7 @@ protected:
size_t rowBytes;
const void* addr = surfCanvas->peekPixels(&info, &rowBytes);
if (addr && bitmap.installPixels(info, const_cast<void*>(addr), rowBytes)) {
- canvas->drawBitmap(bitmap, 0, 0, NULL);
+ canvas->drawBitmap(bitmap, 0, 0, nullptr);
}
}
@@ -55,12 +55,12 @@ protected:
canvas->translate(120, 0);
SkAutoROCanvasPixels ropixels(surfCanvas);
if (ropixels.asROBitmap(&bitmap)) {
- canvas->drawBitmap(bitmap, 0, 0, NULL);
+ canvas->drawBitmap(bitmap, 0, 0, nullptr);
}
// test Surface
canvas->translate(120, 0);
- surface->draw(canvas, 0, 0, NULL);
+ surface->draw(canvas, 0, 0, nullptr);
}
}
diff --git a/gm/perlinnoise.cpp b/gm/perlinnoise.cpp
index 702e545c60..e4c559801b 100644
--- a/gm/perlinnoise.cpp
+++ b/gm/perlinnoise.cpp
@@ -39,9 +39,9 @@ protected:
SkISize tileSize = SkISize::Make(fSize.width() / 2, fSize.height() / 2);
SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &tileSize : NULL) :
+ seed, stitchTiles ? &tileSize : nullptr) :
SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &tileSize : NULL);
+ seed, stitchTiles ? &tileSize : nullptr);
SkPaint paint;
paint.setShader(shader)->unref();
if (stitchTiles) {
@@ -112,9 +112,9 @@ protected:
bool stitchTiles) {
SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &fSize : NULL) :
+ seed, stitchTiles ? &fSize : nullptr) :
SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves,
- seed, stitchTiles ? &fSize : NULL);
+ seed, stitchTiles ? &fSize : nullptr);
paint->setShader(shader)->unref();
}
diff --git a/gm/picture.cpp b/gm/picture.cpp
index 175e0a76f2..1f8ded0bac 100644
--- a/gm/picture.cpp
+++ b/gm/picture.cpp
@@ -40,7 +40,7 @@ static SkPicture* make_picture() {
class PictureGM : public skiagm::GM {
public:
PictureGM()
- : fPicture(NULL)
+ : fPicture(nullptr)
{}
protected:
@@ -65,7 +65,7 @@ protected:
canvas->drawPicture(fPicture);
matrix.setTranslate(110, 0);
- canvas->drawPicture(fPicture, &matrix, NULL);
+ canvas->drawPicture(fPicture, &matrix, nullptr);
matrix.postTranslate(110, 0);
canvas->drawPicture(fPicture, &matrix, &paint);
diff --git a/gm/pictureimagefilter.cpp b/gm/pictureimagefilter.cpp
index fd8ae62fa2..7f6cfbdd9a 100644
--- a/gm/pictureimagefilter.cpp
+++ b/gm/pictureimagefilter.cpp
@@ -24,7 +24,7 @@ protected:
void makePicture() {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100, nullptr, 0);
canvas->clear(SK_ColorBLACK);
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp
index d28749a644..c35c5c964e 100644
--- a/gm/pictureshader.cpp
+++ b/gm/pictureshader.cpp
@@ -33,7 +33,7 @@ public:
void onOnceBeforeDraw() override {
// Build the picture.
SkPictureRecorder recorder;
- SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, NULL, 0);
+ SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, nullptr, 0);
this->drawTile(pictureCanvas);
fPicture.reset(recorder.endRecording());
@@ -150,12 +150,9 @@ private:
canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSceneSize), paint);
- SkAutoTUnref<SkShader> pictureShader(SkShader::CreatePictureShader(
- fPicture,
- kTileConfigs[tileMode].tmx,
- kTileConfigs[tileMode].tmy,
- &localMatrix,
- NULL));
+ SkAutoTUnref<SkShader> pictureShader(
+ SkShader::CreatePictureShader(fPicture, kTileConfigs[tileMode].tmx,
+ kTileConfigs[tileMode].tmy, &localMatrix, nullptr));
paint.setShader(pictureShader.get());
canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
@@ -200,12 +197,9 @@ DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400) {
c->drawLine(20, 20, 80, 80, p);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
- SkAutoTUnref<SkShader> shader(SkShader::CreatePictureShader(
- picture.get(),
- SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode,
- NULL,
- NULL));
+ SkAutoTUnref<SkShader> shader(
+ SkShader::CreatePictureShader(picture.get(), SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode, nullptr, nullptr));
p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green
canvas->drawPaint(p);
diff --git a/gm/pictureshadertile.cpp b/gm/pictureshadertile.cpp
index a84e23343d..30776c338b 100644
--- a/gm/pictureshadertile.cpp
+++ b/gm/pictureshadertile.cpp
@@ -121,7 +121,7 @@ protected:
if (tile == SkRect::MakeWH(kPictureSize, kPictureSize)) {
// When the tile == picture bounds, exercise the picture + offset path.
picturePtr = offsetPicture.get();
- tilePtr = NULL;
+ tilePtr = nullptr;
}
fShaders[i].reset(SkShader::CreatePictureShader(picturePtr,
diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp
index 4a6da53c97..ca7f554fdb 100644
--- a/gm/resizeimagefilter.cpp
+++ b/gm/resizeimagefilter.cpp
@@ -27,7 +27,7 @@ protected:
const SkRect& rect,
const SkSize& deviceSize,
SkFilterQuality filterQuality,
- SkImageFilter* input = NULL) {
+ SkImageFilter* input = nullptr) {
SkRect dstRect;
canvas->getTotalMatrix().mapRect(&dstRect, rect);
canvas->save();
diff --git a/gm/roundrects.cpp b/gm/roundrects.cpp
index b27d0f4309..ab7ee696c2 100644
--- a/gm/roundrects.cpp
+++ b/gm/roundrects.cpp
@@ -282,7 +282,7 @@ protected:
canvas->drawRect(rect, rectPaint);
canvas->drawRRect(circleRect, fPaints[i]);
- fPaints[i].setShader(NULL);
+ fPaints[i].setShader(nullptr);
canvas->restore();
}
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index f9a21db0f2..c4736c7222 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -57,12 +57,12 @@ protected:
SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight); }
void onDraw(SkCanvas* canvas) override {
- GrContext* context = NULL;
+ GrContext* context = nullptr;
#if SK_SUPPORT_GPU
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- context = rt ? rt->getContext() : NULL;
+ context = rt ? rt->getContext() : nullptr;
#endif
- if (kEffect_Type == fType && NULL == context) {
+ if (kEffect_Type == fType && nullptr == context) {
this->drawGpuOnlyMessage(canvas);
return;
}
@@ -102,7 +102,7 @@ protected:
#if SK_SUPPORT_GPU
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
diff --git a/gm/samplerstress.cpp b/gm/samplerstress.cpp
index eff6281cdd..4bec6784a8 100644
--- a/gm/samplerstress.cpp
+++ b/gm/samplerstress.cpp
@@ -21,8 +21,8 @@ class SamplerStressGM : public GM {
public:
SamplerStressGM()
: fTextureCreated(false)
- , fShader(NULL)
- , fMaskFilter(NULL) {
+ , fShader(nullptr)
+ , fMaskFilter(nullptr) {
}
virtual ~SamplerStressGM() {
diff --git a/gm/shaderbounds.cpp b/gm/shaderbounds.cpp
index 4363d4eee3..fd42973dba 100644
--- a/gm/shaderbounds.cpp
+++ b/gm/shaderbounds.cpp
@@ -18,7 +18,7 @@ static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate,
colors[0] = SK_ColorBLUE;
colors[1] = SK_ColorYELLOW;
}
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode, 0, &localMatrix);
}
diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp
index fd74e7c6ce..e68ee98df0 100644
--- a/gm/shadertext.cpp
+++ b/gm/shadertext.cpp
@@ -42,8 +42,8 @@ static const SkColor gColors[] = {
};
static const GradData gGradData[] = {
- { 2, gColors, NULL },
- { 5, gColors, NULL },
+ { 2, gColors, nullptr },
+ { 5, gColors, nullptr },
};
static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
@@ -174,7 +174,7 @@ protected:
++i;
canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
SkIntToScalar((i % testsPerCol) * rowHeight));
- canvas->drawTextOnPath(text, textLen, path, NULL, paint);
+ canvas->drawTextOnPath(text, textLen, path, nullptr, paint);
canvas->restore();
}
canvas->restore();
diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp
index f4af684ae9..8ceb5e494b 100644
--- a/gm/shadertext2.cpp
+++ b/gm/shadertext2.cpp
@@ -175,8 +175,8 @@ protected:
canvas->save();
canvas->concat(matrices[m].fMatrix);
- canvas->drawTextOnPath(kText, kTextLen, path, NULL, paint);
- canvas->drawTextOnPath(kText, kTextLen, path, NULL, outlinePaint);
+ canvas->drawTextOnPath(kText, kTextLen, path, nullptr, paint);
+ canvas->drawTextOnPath(kText, kTextLen, path, nullptr, outlinePaint);
canvas->restore();
SkPaint stroke;
stroke.setStyle(SkPaint::kStroke_Style);
diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp
index 276ec14f49..b2a34f3b4c 100644
--- a/gm/shallowgradient.cpp
+++ b/gm/shallowgradient.cpp
@@ -12,13 +12,13 @@ typedef SkShader* (*MakeShaderProc)(const SkColor[], int count, const SkSize&);
static SkShader* shader_linear(const SkColor colors[], int count, const SkSize& size) {
SkPoint pts[] = { { 0, 0 }, { size.width(), size.height() } };
- return SkGradientShader::CreateLinear(pts, colors, NULL, count,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, count,
SkShader::kClamp_TileMode);
}
static SkShader* shader_radial(const SkColor colors[], int count, const SkSize& size) {
SkPoint center = { size.width()/2, size.height()/2 };
- return SkGradientShader::CreateRadial(center, size.width()/2, colors, NULL, count,
+ return SkGradientShader::CreateRadial(center, size.width()/2, colors, nullptr, count,
SkShader::kClamp_TileMode);
}
@@ -26,13 +26,13 @@ static SkShader* shader_conical(const SkColor colors[], int count, const SkSize&
SkPoint center = { size.width()/2, size.height()/2 };
return SkGradientShader::CreateTwoPointConical(center, size.width()/64,
center, size.width()/2,
- colors, NULL, count,
+ colors, nullptr, count,
SkShader::kClamp_TileMode);
}
static SkShader* shader_sweep(const SkColor colors[], int count, const SkSize& size) {
return SkGradientShader::CreateSweep(size.width()/2, size.height()/2,
- colors, NULL, count);
+ colors, nullptr, count);
}
class ShallowGradientGM : public skiagm::GM {
diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp
index 372cb1bafb..3b10c47ea0 100644
--- a/gm/simpleaaclip.cpp
+++ b/gm/simpleaaclip.cpp
@@ -68,10 +68,10 @@ protected:
}
void buildRgn(SkAAClip* clip, SkRegion::Op op) {
- clip->setPath(fBasePath, NULL, true);
+ clip->setPath(fBasePath, nullptr, true);
SkAAClip clip2;
- clip2.setPath(fRectPath, NULL, true);
+ clip2.setPath(fRectPath, nullptr, true);
clip->op(clip2, op);
}
diff --git a/gm/spritebitmap.cpp b/gm/spritebitmap.cpp
index 9e1bb87810..ceed50acaa 100644
--- a/gm/spritebitmap.cpp
+++ b/gm/spritebitmap.cpp
@@ -23,7 +23,7 @@ static void make_bm(SkBitmap* bm) {
}
static void draw_2_bitmaps(SkCanvas* canvas, const SkBitmap& bm, bool doClip,
- int dx, int dy, SkImageFilter* filter = NULL) {
+ int dx, int dy, SkImageFilter* filter = nullptr) {
SkAutoCanvasRestore acr(canvas, true);
SkPaint paint;
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 7a7e89e052..86fe89bd1a 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -21,13 +21,13 @@
typedef void (*PaintProc)(SkPaint*);
static void identity_paintproc(SkPaint* paint) {
- paint->setShader(NULL);
+ paint->setShader(nullptr);
}
static void gradient_paintproc(SkPaint* paint) {
const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE };
const SkPoint pts[] = { { 0, 0 }, { W, H } };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL,
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
paint->setShader(s)->unref();
@@ -126,8 +126,8 @@ protected:
callNewSurface = false;
}
#endif
- SkSurface* surface = callNewSurface ? canvas->newSurface(info) : NULL;
- if (NULL == surface) {
+ SkSurface* surface = callNewSurface ? canvas->newSurface(info) : nullptr;
+ if (nullptr == surface) {
// picture canvas will return null, so fall-back to raster
surface = SkSurface::NewRaster(info);
}
@@ -139,7 +139,7 @@ protected:
this->isCanvasDeferred()));
surf->getCanvas()->drawColor(SK_ColorWHITE);
this->drawContent(surf->getCanvas());
- surf->draw(canvas, 0, 0, NULL);
+ surf->draw(canvas, 0, 0, nullptr);
}
private:
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index 4e8eaffcca..e8878b5e3b 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -307,7 +307,7 @@ protected:
SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_FirstDirection));
path2.reset();
- SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, NULL));
+ SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, nullptr));
path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstDirection));
canvas->drawPath(path2, paint);
@@ -333,7 +333,7 @@ protected:
r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280),
SkIntToScalar(100), SkIntToScalar(100));
path4.reset();
- SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL));
+ SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr));
path4.addRect(r, SkPath::kCCW_Direction);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_FirstDirection));
path4.moveTo(0, 0); // test for crbug.com/247770
@@ -342,7 +342,7 @@ protected:
r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280),
SkIntToScalar(100), SkIntToScalar(100));
path4.reset();
- SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL));
+ SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr));
path4.addRect(r, SkPath::kCW_Direction);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstDirection));
path4.moveTo(0, 0); // test for crbug.com/247770
diff --git a/gm/surface.cpp b/gm/surface.cpp
index 694a0d09ab..bf7f931f46 100644
--- a/gm/surface.cpp
+++ b/gm/surface.cpp
@@ -18,7 +18,7 @@ static SkShader* make_shader() {
int b = 0xBB;
SkPoint pts[] = { { 0, 0 }, { W, H } };
SkColor colors[] = { SkColorSetRGB(a, a, a), SkColorSetRGB(b, b, b) };
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
static SkSurface* make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo,
@@ -48,7 +48,7 @@ static void test_draw(SkCanvas* canvas, const char label[]) {
paint.setShader(make_shader())->unref();
canvas->drawRect(SkRect::MakeWH(W, H), paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
paint.setColor(SK_ColorWHITE);
paint.setTextSize(32);
@@ -95,7 +95,7 @@ protected:
SkAutoTUnref<SkSurface> surface(make_surface(ctx, info, rec[i].fGeo,
disallowAA, disallowDither));
test_draw(surface->getCanvas(), rec[i].fLabel);
- surface->draw(canvas, x, y, NULL);
+ surface->draw(canvas, x, y, nullptr);
y += H;
}
x += W;
@@ -134,23 +134,23 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
- SkAutoTUnref<SkSurface> surf(canvas->newSurface(info, NULL));
+ SkAutoTUnref<SkSurface> surf(canvas->newSurface(info, nullptr));
if (!surf.get()) {
surf.reset(SkSurface::NewRaster(info));
}
drawInto(surf->getCanvas());
SkAutoTUnref<SkImage> image(surf->newImageSnapshot());
- canvas->drawImage(image, 10, 10, NULL);
+ canvas->drawImage(image, 10, 10, nullptr);
- SkAutoTUnref<SkSurface> surf2(image->newSurface(info, NULL));
+ SkAutoTUnref<SkSurface> surf2(image->newSurface(info, nullptr));
drawInto(surf2->getCanvas());
// Assert that the props were communicated transitively through the first image
SkASSERT(equal(surf->props(), surf2->props()));
SkAutoTUnref<SkImage> image2(surf2->newImageSnapshot());
- canvas->drawImage(image2, 10 + SkIntToScalar(image->width()) + 10, 10, NULL);
+ canvas->drawImage(image2, 10 + SkIntToScalar(image->width()) + 10, 10, nullptr);
}
private:
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index 0855ac0ea3..1053bb2518 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -17,7 +17,7 @@ static SkShader* make_shader0(int w, int h) {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
};
- return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
}
static void make_bm0(SkBitmap* bm) {
@@ -37,7 +37,7 @@ static SkShader* make_shader1(int w, int h) {
SkColor colors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
};
- return SkGradientShader::CreateRadial(SkPoint::Make(cx, cy), cx, colors, NULL,
+ return SkGradientShader::CreateRadial(SkPoint::Make(cx, cy), cx, colors, nullptr,
SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
}
static void make_bm1(SkBitmap* bm) {
@@ -74,7 +74,7 @@ static void make_table2(uint8_t table[]) {
}
static SkColorFilter* make_null_cf() {
- return NULL;
+ return nullptr;
}
static SkColorFilter* make_cf0() {
@@ -93,7 +93,7 @@ static SkColorFilter* make_cf3() {
uint8_t table0[256]; make_table0(table0);
uint8_t table1[256]; make_table1(table1);
uint8_t table2[256]; make_table2(table2);
- return SkTableColorFilter::CreateARGB(NULL, table0, table1, table2);
+ return SkTableColorFilter::CreateARGB(nullptr, table0, table1, table2);
}
class TableColorFilterGM : public skiagm::GM {
@@ -159,12 +159,12 @@ protected:
canvas->drawBitmap(bm, x, y, &paint);
}
- paint.setColorFilter(NULL);
+ paint.setColorFilter(nullptr);
for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]());
SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Create(
- colorFilter1, NULL, NULL));
+ colorFilter1, nullptr, nullptr));
// Move down to the next line and draw it
// each draw being at xOffset of the previous one
@@ -173,7 +173,7 @@ protected:
for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j) {
SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[j]());
SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageFilter::Create(
- colorFilter2, imageFilter1, NULL));
+ colorFilter2, imageFilter1, nullptr));
paint.setImageFilter(imageFilter2);
canvas->drawBitmap(bm, x, y, &paint);
x += xOffset;
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index e7c15b2498..13a1c2a6c2 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -39,7 +39,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTarget();
GrContext* ctx = canvas->getGrContext();
- GrDrawContext* drawContext = ctx ? ctx->drawContext() : NULL;
+ GrDrawContext* drawContext = ctx ? ctx->drawContext() : nullptr;
if (drawContext && target) {
SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S));
static const int stride = 2 * S;
diff --git a/gm/textblob.cpp b/gm/textblob.cpp
index 5020e7c5ef..a38215653d 100644
--- a/gm/textblob.cpp
+++ b/gm/textblob.cpp
@@ -76,7 +76,7 @@ protected:
SkPaint p;
p.setTypeface(fTypeface);
size_t txtLen = strlen(fText);
- int glyphCount = p.textToGlyphs(fText, txtLen, NULL);
+ int glyphCount = p.textToGlyphs(fText, txtLen, nullptr);
fGlyphs.append(glyphCount);
p.textToGlyphs(fText, txtLen, fGlyphs.begin());
diff --git a/gm/textbloblooper.cpp b/gm/textbloblooper.cpp
index dc4be0b129..c40a4eb2c6 100644
--- a/gm/textbloblooper.cpp
+++ b/gm/textbloblooper.cpp
@@ -30,7 +30,7 @@ static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const
SkTDArray<uint16_t> glyphs;
size_t len = strlen(text);
- glyphs.append(paint.textToGlyphs(text, len, NULL));
+ glyphs.append(paint.textToGlyphs(text, len, nullptr));
paint.textToGlyphs(text, len, glyphs.begin());
const SkScalar advanceX = paint.getTextSize() * 0.85f;
@@ -90,7 +90,7 @@ static SkShader* make_shader(const SkRect& bounds) {
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
};
return SkGradientShader::CreateLinear(pts,
- colors, NULL, SK_ARRAY_COUNT(colors),
+ colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
}
@@ -202,7 +202,7 @@ protected:
SkLayerDrawLooper::kColorFilter_Bit |
SkLayerDrawLooper::kXfermode_Bit, &color_filter,
xfermode, SK_ARRAY_COUNT(xfermode)));
- fLoopers.push_back().reset(setupLooper(0, NULL, skew, SK_ARRAY_COUNT(skew)));
+ fLoopers.push_back().reset(setupLooper(0, nullptr, skew, SK_ARRAY_COUNT(skew)));
fLoopers.push_back().reset(setupLooper(SkLayerDrawLooper::kMaskFilter_Bit |
SkLayerDrawLooper::kShader_Bit |
SkLayerDrawLooper::kColorFilter_Bit |
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index a76c6f575b..9f745d6106 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -165,7 +165,7 @@ protected:
// since we prepended this matrix already, we blit using identity
inputCanvas->resetMatrix();
SkImage* image = surface->newImageSnapshot();
- inputCanvas->drawImage(image, 0, 0, NULL);
+ inputCanvas->drawImage(image, 0, 0, nullptr);
image->unref();
}
#endif
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index ada46cadfc..862d83b707 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -41,7 +41,7 @@ protected:
// Setup our random scaler context
SkAutoTUnref<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif",
SkTypeface::kBold));
- if (NULL == orig) {
+ if (nullptr == orig) {
orig.reset(SkTypeface::RefDefault());
}
SkAutoTUnref<SkTypeface> random(new SkRandomTypeface(orig, paint, false));
@@ -93,7 +93,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
// This GM exists to test a specific feature of the GPU backend.
- if (NULL == canvas->getGrContext()) {
+ if (nullptr == canvas->getGrContext()) {
this->drawGpuOnlyMessage(canvas);
return;
}
diff --git a/gm/textblobshader.cpp b/gm/textblobshader.cpp
index 5c9372d93c..30674e1d68 100644
--- a/gm/textblobshader.cpp
+++ b/gm/textblobshader.cpp
@@ -22,7 +22,7 @@ public:
SkPaint p;
sk_tool_utils::set_portable_typeface(&p);
size_t txtLen = strlen(txt);
- fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL));
+ fGlyphs.append(p.textToGlyphs(txt, txtLen, nullptr));
p.textToGlyphs(txt, txtLen, fGlyphs.begin());
}
@@ -40,16 +40,16 @@ protected:
int glyphCount = fGlyphs.count();
const SkTextBlobBuilder::RunBuffer* run;
- run = &builder.allocRun(p, glyphCount, 10, 10, NULL);
+ run = &builder.allocRun(p, glyphCount, 10, 10, nullptr);
memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t));
- run = &builder.allocRunPosH(p, glyphCount, 80, NULL);
+ run = &builder.allocRunPosH(p, glyphCount, 80, nullptr);
memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t));
for (int i = 0; i < glyphCount; ++i) {
run->pos[i] = p.getTextSize() * i * .75f;
}
- run = &builder.allocRunPos(p, glyphCount, NULL);
+ run = &builder.allocRunPos(p, glyphCount, nullptr);
memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t));
for (int i = 0; i < glyphCount; ++i) {
run->pos[i * 2] = p.getTextSize() * i * .75f;
diff --git a/gm/textblobuseaftergpufree.cpp b/gm/textblobuseaftergpufree.cpp
index 363cd2fed9..91681b82ac 100644
--- a/gm/textblobuseaftergpufree.cpp
+++ b/gm/textblobuseaftergpufree.cpp
@@ -31,7 +31,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
// This GM exists to test a specific feature of the GPU backend.
- if (NULL == canvas->getGrContext()) {
+ if (nullptr == canvas->getGrContext()) {
this->drawGpuOnlyMessage(canvas);
return;
}
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index 03dbd68cc1..902bed3ea8 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -17,7 +17,7 @@ static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
- p.setMaskFilter(NULL);
+ p.setMaskFilter(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -68,7 +68,7 @@ static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2);
- p.setXfermode(NULL);
+ p.setXfermode(nullptr);
rastBuilder->addLayer(p);
}
@@ -119,8 +119,8 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -136,8 +136,8 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -199,7 +199,7 @@ protected:
for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) {
apply_shader(&paint, i);
- // paint.setMaskFilter(NULL);
+ // paint.setMaskFilter(nullptr);
// paint.setColor(SK_ColorBLACK);
canvas->drawText(str.c_str(), str.size(), x, y, paint);
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index eb0f2cc944..facfb7a792 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -49,19 +49,19 @@ protected:
SkColor colors1[] = { SK_ColorCYAN, SK_ColorLTGRAY, SK_ColorGRAY };
paint.setShader(SkGradientShader::CreateSweep(65.f, 75.f, colors1,
- NULL, SK_ARRAY_COUNT(colors1)))->unref();
+ nullptr, SK_ARRAY_COUNT(colors1)))->unref();
canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
fBmp.width() + 10.f, fBmp.height() + 10.f), paint);
SkColor colors2[] = { SK_ColorMAGENTA, SK_ColorLTGRAY, SK_ColorYELLOW };
- paint.setShader(SkGradientShader::CreateSweep(45.f, 55.f, colors2, NULL,
+ paint.setShader(SkGradientShader::CreateSweep(45.f, 55.f, colors2, nullptr,
SK_ARRAY_COUNT(colors2)))->unref();
paint.setXfermodeMode(SkXfermode::kDarken_Mode);
canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
fBmp.width() + 10.f, fBmp.height() + 10.f), paint);
SkColor colors3[] = { SK_ColorBLUE, SK_ColorLTGRAY, SK_ColorGREEN };
- paint.setShader(SkGradientShader::CreateSweep(25.f, 35.f, colors3, NULL,
+ paint.setShader(SkGradientShader::CreateSweep(25.f, 35.f, colors3, nullptr,
SK_ARRAY_COUNT(colors3)))->unref();
paint.setXfermodeMode(SkXfermode::kLighten_Mode);
canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
@@ -70,23 +70,23 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
- SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, NULL));
+ SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, nullptr));
if (!texture) {
return;
}
diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp
index 1ec05113e1..e47e8fa659 100644
--- a/gm/tileimagefilter.cpp
+++ b/gm/tileimagefilter.cpp
@@ -98,7 +98,7 @@ protected:
SkIntToScalar(fBitmap.height()));
SkRect dstRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() * 2),
SkIntToScalar(fBitmap.height() * 2));
- SkAutoTUnref<SkImageFilter> tile(SkTileImageFilter::Create(srcRect, dstRect, NULL));
+ SkAutoTUnref<SkImageFilter> tile(SkTileImageFilter::Create(srcRect, dstRect, nullptr));
SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(matrix));
SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf, tile.get()));
diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp
index 4e4a2ff8ce..26b83486e8 100644
--- a/gm/tilemodes.cpp
+++ b/gm/tilemodes.cpp
@@ -171,14 +171,14 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
int index = (int)ty;
switch (index % 3) {
case 0:
- return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 1:
- return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 2:
- return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors));
+ return SkGradientShader::CreateSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
}
- return NULL;
+ return nullptr;
}
typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode);
diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp
index 87e3029a01..0d46fb66c5 100644
--- a/gm/tilemodes_scaled.cpp
+++ b/gm/tilemodes_scaled.cpp
@@ -175,14 +175,14 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
int index = (int)ty;
switch (index % 3) {
case 0:
- return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 1:
- return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 2:
- return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors));
+ return SkGradientShader::CreateSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
}
- return NULL;
+ return nullptr;
}
typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode);
diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp
index 9bfa2287ca..7942b4266a 100644
--- a/gm/tinybitmap.cpp
+++ b/gm/tinybitmap.cpp
@@ -20,7 +20,7 @@ static SkBitmap make_bitmap() {
SkBitmap bm;
bm.allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
bm.lockPixels();
diff --git a/gm/transparency.cpp b/gm/transparency.cpp
index 62c277a691..73bd8b2023 100644
--- a/gm/transparency.cpp
+++ b/gm/transparency.cpp
@@ -32,7 +32,7 @@ static void make_transparency(SkCanvas* canvas,
shaderColors[0] = SK_AlphaTRANSPARENT;
shaderColors[1] = kColors[i];
SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear(
- pts, shaderColors, NULL, 2, SkShader::kClamp_TileMode));
+ pts, shaderColors, nullptr, 2, SkShader::kClamp_TileMode));
SkRect r = SkRect::MakeXYWH(0, i * kRowHeight, width, kRowHeight);
SkPaint p;
p.setShader(shader);
@@ -70,6 +70,6 @@ DEF_SIMPLE_GM(transparency_check, canvas, 1792, 1080) {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(256, 9));
make_transparency(surface->getCanvas(), 256.0f, 9.0f);
canvas->scale(7.0f, 120.0f);
- surface->draw(canvas, 0, 0, NULL);
+ surface->draw(canvas, 0, 0, nullptr);
}
}
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index b8f54abe37..d88efa51bf 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -135,7 +135,7 @@ protected:
const size_t textLen = strlen(text);
SkScalar x = SkIntToScalar(10);
- SkScalar dy = paint.getFontMetrics(NULL);
+ SkScalar dy = paint.getFontMetrics(nullptr);
SkScalar y = dy;
if (fApplyKerning) {
diff --git a/gm/vertices.cpp b/gm/vertices.cpp
index 9533d81bb4..40dd9496ef 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -17,7 +17,7 @@ static SkShader* make_shader(SkScalar w, SkScalar h) {
};
const SkPoint pts[] = { { w/4, 0 }, { 3*w/4, h } };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
}
@@ -30,7 +30,7 @@ class VerticesGM : public skiagm::GM {
unsigned fAlpha;
public:
- VerticesGM(unsigned alpha) : fShader(NULL), fAlpha(alpha) {
+ VerticesGM(unsigned alpha) : fShader(nullptr), fAlpha(alpha) {
}
virtual ~VerticesGM() {
@@ -85,8 +85,8 @@ protected:
const SkColor* fColors;
const SkPoint* fTexs;
} rec[] = {
- { fColors, NULL },
- { NULL, fTexs },
+ { fColors, nullptr },
+ { nullptr, fTexs },
{ fColors, fTexs },
};
diff --git a/gm/verttext.cpp b/gm/verttext.cpp
index 9039685206..37cf37cbad 100644
--- a/gm/verttext.cpp
+++ b/gm/verttext.cpp
@@ -70,7 +70,7 @@ protected:
p.setColor(0xFF0000FF);
SkScalar adv[gLen];
- int numChars = paint.getTextWidths(gText, gLen, adv, NULL);
+ int numChars = paint.getTextWidths(gText, gLen, adv, nullptr);
for (int i = 0; i < numChars; ++i) {
canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p);
if (paint.isVerticalText()) {
diff --git a/gm/verttext2.cpp b/gm/verttext2.cpp
index 3a3955ee7c..4896cc992a 100644
--- a/gm/verttext2.cpp
+++ b/gm/verttext2.cpp
@@ -19,8 +19,8 @@ namespace skiagm {
class VertText2GM : public GM {
public:
VertText2GM()
- : fProp(NULL)
- , fMono(NULL) {
+ : fProp(nullptr)
+ , fMono(nullptr) {
}
virtual ~VertText2GM() {
diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp
index 5e2dbd4f41..9b5496bc0f 100644
--- a/gm/verylargebitmap.cpp
+++ b/gm/verylargebitmap.cpp
@@ -15,7 +15,7 @@ static void make_bm(SkBitmap* bm, int width, int height, SkColor colors[2]) {
SkCanvas canvas(*bm);
SkPoint center = {SkIntToScalar(width)/2, SkIntToScalar(height)/2};
SkScalar radius = 40;
- SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, NULL, 2,
+ SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, nullptr, 2,
SkShader::kMirror_TileMode);
SkPaint paint;
paint.setShader(shader)->unref();
@@ -39,13 +39,13 @@ static void show_bm(SkCanvas* canvas, int width, int height, SkColor colors[2])
canvas->save();
canvas->clipRect(r);
- canvas->drawBitmap(bm, 0, 0, NULL);
+ canvas->drawBitmap(bm, 0, 0, nullptr);
canvas->restore();
canvas->drawRect(r, paint);
r.offset(SkIntToScalar(150), 0);
// exercises extract bitmap, but not shader
- canvas->drawBitmapRect(bm, ir, r, NULL);
+ canvas->drawBitmapRect(bm, ir, r, nullptr);
canvas->drawRect(r, paint);
r.offset(SkIntToScalar(150), 0);
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 3efbbfad6a..80994a6ed8 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -138,8 +138,8 @@ protected:
x = 0;
y += fBitmap.height() + MARGIN;
}
- // Test NULL mode
- filter.reset(SkXfermodeImageFilter::Create(NULL, background));
+ // Test nullptr mode
+ filter.reset(SkXfermodeImageFilter::Create(nullptr, background));
paint.setImageFilter(filter);
drawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp
index aae8cbd234..bc1bc7ff73 100644
--- a/gm/xfermodes.cpp
+++ b/gm/xfermodes.cpp
@@ -255,14 +255,14 @@ protected:
p.setShader(s);
canvas->drawRect(r, p);
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
draw_mode(canvas, mode, static_cast<SrcType>(sourceType),
r.fLeft, r.fTop);
canvas->restore();
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
p.setStyle(SkPaint::kStroke_Style);
- p.setShader(NULL);
+ p.setShader(nullptr);
canvas->drawRect(r, p);
#if 1
diff --git a/gm/xfermodes2.cpp b/gm/xfermodes2.cpp
index 192a279bf4..db48c03d20 100644
--- a/gm/xfermodes2.cpp
+++ b/gm/xfermodes2.cpp
@@ -55,7 +55,7 @@ protected:
SkRect r = SkRect::MakeWH(w, h);
canvas->drawRect(r, p);
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
p.setShader(fDst);
canvas->drawRect(r, p);
@@ -67,8 +67,8 @@ protected:
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
p.setStyle(SkPaint::kStroke_Style);
- p.setShader(NULL);
- p.setXfermode(NULL);
+ p.setShader(nullptr);
+ p.setXfermode(nullptr);
canvas->drawRect(r, p);
canvas->restore();
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index c5e1695399..4466b1ce04 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -122,14 +122,14 @@ private:
* dimensions exactly matching the layer size.
*/
SkCanvas* possiblyCreateTempCanvas(SkCanvas* baseCanvas, int w, int h) {
- SkCanvas* tempCanvas = NULL;
+ SkCanvas* tempCanvas = nullptr;
#if SK_SUPPORT_GPU
GrContext* context = baseCanvas->getGrContext();
SkImageInfo baseInfo = baseCanvas->imageInfo();
SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(),
baseInfo.profileType());
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted,
- info, 0, NULL));
+ info, 0, nullptr));
if (surface) {
tempCanvas = SkRef(surface->getCanvas());
}
@@ -147,8 +147,8 @@ private:
SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h));
SkCanvas* modeCanvas;
- if (NULL == layerCanvas) {
- canvas->saveLayer(&r, NULL);
+ if (nullptr == layerCanvas) {
+ canvas->saveLayer(&r, nullptr);
modeCanvas = canvas;
} else {
modeCanvas = layerCanvas;
@@ -159,9 +159,9 @@ private:
bgPaint.setShader(fBGShader);
modeCanvas->drawRect(r, bgPaint);
modeCanvas->drawRect(r, modePaint);
- modeCanvas = NULL;
+ modeCanvas = nullptr;
- if (NULL == layerCanvas) {
+ if (nullptr == layerCanvas) {
canvas->restore();
} else {
SkAutoROCanvasPixels ropixels(layerCanvas);
@@ -205,7 +205,7 @@ private:
bmpPaint.setShader(SkGradientShader::CreateRadial(kCenter,
3 * SkIntToScalar(kSize) / 4,
kColors,
- NULL,
+ nullptr,
SK_ARRAY_COUNT(kColors),
SkShader::kRepeat_TileMode))->unref();
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 9d5ec450f9..4fd23efaa7 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -68,26 +68,26 @@ protected:
void onDraw(SkCanvas* canvas) override {
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
return;
}
GrContext* context = rt->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
this->drawGpuOnlyMessage(canvas);
return;
}
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
+ if (nullptr == tt.target()) {
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
SkAutoTUnref<GrTexture> texture[3];
- texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL));
- texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL));
- texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL));
+ texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], nullptr));
+ texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], nullptr));
+ texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], nullptr));
if (!texture[0] || !texture[1] || !texture[2]) {
return;
diff --git a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
index d66221a01c..15f01a94bf 100644
--- a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
+++ b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
@@ -29,11 +29,11 @@ struct ActivityGlue {
jmethodID m_setSlideList;
jmethodID m_addToDownloads;
ActivityGlue() {
- m_env = NULL;
- m_obj = NULL;
- m_setTitle = NULL;
- m_setSlideList = NULL;
- m_addToDownloads = NULL;
+ m_env = nullptr;
+ m_obj = nullptr;
+ m_setTitle = nullptr;
+ m_setSlideList = nullptr;
+ m_addToDownloads = nullptr;
}
} gActivityGlue;
@@ -44,11 +44,11 @@ struct WindowGlue {
jmethodID m_startTimer;
jmethodID m_getMSAASampleCount;
WindowGlue() {
- m_obj = NULL;
- m_inval = NULL;
- m_queueSkEvent = NULL;
- m_startTimer = NULL;
- m_getMSAASampleCount = NULL;
+ m_obj = nullptr;
+ m_inval = nullptr;
+ m_queueSkEvent = nullptr;
+ m_startTimer = nullptr;
+ m_getMSAASampleCount = nullptr;
}
} gWindowGlue;
@@ -70,7 +70,7 @@ bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int /*msaaSampleCount*/
if (!env || !gWindowGlue.m_getMSAASampleCount || !gWindowGlue.m_obj) {
return false;
}
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gWindowGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
return false;
}
@@ -99,7 +99,7 @@ void SkOSWindow::onSetTitle(const char title[])
if (!env) {
return;
}
- if (env->IsSameObject(gActivityGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gActivityGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Activity is invalid");
return;
}
@@ -115,7 +115,7 @@ void SkOSWindow::onHandleInval(const SkIRect& rect)
if (!env || !gWindowGlue.m_inval || !gWindowGlue.m_obj) {
return;
}
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gWindowGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
return;
}
@@ -129,7 +129,7 @@ void SkOSWindow::onPDFSaved(const char title[], const char desc[],
if (!env || !gActivityGlue.m_addToDownloads || !gActivityGlue.m_obj) {
return;
}
- if (env->IsSameObject(gActivityGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gActivityGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Activity is invalid");
return;
}
@@ -156,7 +156,7 @@ void SkEvent::SignalQueueTimer(SkMSec ms)
if (!env || !gWindowGlue.m_startTimer || !gWindowGlue.m_obj || !ms) {
return;
}
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gWindowGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
return;
}
@@ -170,7 +170,7 @@ void SkEvent::SignalNonEmptyQueue()
if (!env || !gWindowGlue.m_queueSkEvent || !gWindowGlue.m_obj) {
return;
}
- if (env->IsSameObject(gWindowGlue.m_obj, NULL)) {
+ if (env->IsSameObject(gWindowGlue.m_obj, nullptr)) {
SkDebugf("ERROR: The JNI WeakRef to the Window is invalid");
return;
}
@@ -234,7 +234,7 @@ JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_init(JNIEnv* env,
if (gWindow) {
SkDebugf("The sample window already exists.");
} else {
- gWindow = new SampleWindow(NULL, args.count(), const_cast<char**>(args.begin()), NULL);
+ gWindow = new SampleWindow(nullptr, args.count(), const_cast<char**>(args.begin()), nullptr);
}
// cleanup the command line flags
@@ -256,15 +256,15 @@ JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_term(JNIEnv* env,
jobject thiz)
{
delete gWindow;
- gWindow = NULL;
+ gWindow = nullptr;
application_term();
if (gWindowGlue.m_obj) {
env->DeleteWeakGlobalRef(gWindowGlue.m_obj);
- gWindowGlue.m_obj = NULL;
+ gWindowGlue.m_obj = nullptr;
}
if (gActivityGlue.m_obj) {
env->DeleteWeakGlobalRef(gActivityGlue.m_obj);
- gActivityGlue.m_obj = NULL;
+ gActivityGlue.m_obj = nullptr;
}
}
@@ -272,7 +272,7 @@ JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_draw(
JNIEnv* env, jobject thiz)
{
if (!gWindow) return;
- gWindow->update(NULL);
+ gWindow->update(nullptr);
}
JNIEXPORT void JNICALL Java_com_skia_SkiaSampleRenderer_updateSize(JNIEnv* env,
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
index e2bc99610f..487835b31d 100644
--- a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
+++ b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
@@ -111,8 +111,8 @@ bool SkOSWindow::attach(SkBackEndTypes attachType,
ANativeWindow_setBuffersGeometry(fNativeWindow, 0, 0, format);
- surface = eglCreateWindowSurface(display, config, fNativeWindow, NULL);
- context = eglCreateContext(display, config, NULL, kAPIs[api].fContextAttribs);
+ surface = eglCreateWindowSurface(display, config, fNativeWindow, nullptr);
+ context = eglCreateContext(display, config, nullptr, kAPIs[api].fContextAttribs);
if (EGL_NO_CONTEXT == context) {
SkDebugf("eglCreateContext failed. EGL Error: 0x%08x\n", eglGetError());
continue;
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
index ba78c3f280..f8d54cd064 100644
--- a/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
+++ b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp
@@ -22,7 +22,7 @@ enum State {
};
struct VisualBenchState {
- VisualBenchState() : fApp(NULL), fWindow(NULL), fState(kInit_State) {}
+ VisualBenchState() : fApp(nullptr), fWindow(nullptr), fState(kInit_State) {}
struct android_app* fApp;
SkOSWindow* fWindow;
SkTArray<SkString> fFlags;
@@ -34,7 +34,7 @@ static void handle_cmd(struct android_app* app, int32_t cmd) {
switch (cmd) {
case APP_CMD_INIT_WINDOW:
// The window is being shown, get it ready.
- if (state->fApp->window != NULL && kInit_State == state->fState) {
+ if (state->fApp->window != nullptr && kInit_State == state->fState) {
// drain any events that occurred before |window| was assigned.
while (SkEvent::ProcessEvent());
@@ -102,9 +102,9 @@ void android_main(struct android_app* state) {
struct android_poll_source* source;
// We loop until all events are read, then continue to draw the next frame of animation.
- while ((ident=ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0) {
+ while ((ident=ALooper_pollAll(0, nullptr, &events, (void**)&source)) >= 0) {
// Process this event.
- if (source != NULL) {
+ if (source != nullptr) {
source->process(state, source);
}
@@ -119,13 +119,13 @@ void android_main(struct android_app* state) {
if (visualBenchState.fWindow->destroyRequested()) {
visualBenchState.fState = kDestroyRequested_State;
} else {
- visualBenchState.fWindow->update(NULL);
+ visualBenchState.fWindow->update(nullptr);
}
}
if (kDestroyRequested_State == visualBenchState.fState) {
delete visualBenchState.fWindow;
- visualBenchState.fWindow = NULL;
+ visualBenchState.fWindow = nullptr;
application_term();
ANativeActivity_finish(state->activity);
visualBenchState.fState = kFinished_State;
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp
index 9a1f8f97fb..8362c35cb6 100644
--- a/samplecode/ClockFaceView.cpp
+++ b/samplecode/ClockFaceView.cpp
@@ -104,7 +104,7 @@ private:
SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
SkMatrix matrix;
buffer.readMatrix(&matrix);
- return new Dot2DPathEffect(buffer.readScalar(), matrix, NULL);
+ return new Dot2DPathEffect(buffer.readScalar(), matrix, nullptr);
}
class InverseFillPE : public SkPathEffect {
@@ -140,7 +140,7 @@ static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) {
}
static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar interp) {
- p.setPathEffect(makepe(SkScalarToFloat(interp), NULL))->unref();
+ p.setPathEffect(makepe(SkScalarToFloat(interp), nullptr))->unref();
rastBuilder->addLayer(p);
#if 0
p.setPathEffect(new InverseFillPE())->unref();
@@ -205,7 +205,7 @@ protected:
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
SkPath path, dstPath;
orig.getTextPath("9", 1, 0, 0, &path);
- pe->filterPath(&dstPath, path, &rec, NULL);
+ pe->filterPath(&dstPath, path, &rec, nullptr);
SkPaint p;
p.setAntiAlias(true);
@@ -245,7 +245,7 @@ protected:
fInterp = 0;
fDx = -fDx;
}
- this->inval(NULL);
+ this->inval(nullptr);
}
}
diff --git a/samplecode/OverView.cpp b/samplecode/OverView.cpp
index 9e229ff947..d7633452bc 100644
--- a/samplecode/OverView.cpp
+++ b/samplecode/OverView.cpp
@@ -60,7 +60,7 @@ protected:
SkUnichar uni;
if (SampleCode::CharQ(*evt, &uni)) {
fMatchStr.appendUnichar(uni);
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return this->INHERITED::onQuery(evt);
@@ -86,7 +86,7 @@ protected:
this->next(&loc);
}
}
- return NULL;
+ return nullptr;
}
private:
diff --git a/samplecode/Sample2PtRadial.cpp b/samplecode/Sample2PtRadial.cpp
index 764c2b129c..07efd0a41c 100644
--- a/samplecode/Sample2PtRadial.cpp
+++ b/samplecode/Sample2PtRadial.cpp
@@ -34,7 +34,7 @@ protected:
SkPoint c1 = { 100, 100 };
SkScalar r1 = 100;
SkShader* s = SkGradientShader::CreateTwoPointConical(c0, r0, c1, r1, colors,
- NULL, 2,
+ nullptr, 2,
SkShader::kClamp_TileMode);
SkPaint paint;
diff --git a/samplecode/SampleAARectModes.cpp b/samplecode/SampleAARectModes.cpp
index f9972aea9b..ae28925a42 100644
--- a/samplecode/SampleAARectModes.cpp
+++ b/samplecode/SampleAARectModes.cpp
@@ -112,7 +112,7 @@ protected:
SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
canvas->drawRect(bounds, fBGPaint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
SkScalar dy = drawCell(canvas, mode,
gAlphaValue[alpha & 1],
gAlphaValue[alpha & 2]);
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 667bcc3054..628504d90d 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -84,7 +84,7 @@ static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
SkBlurMaskFilter::kNone_BlurFlag))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
- p.setMaskFilter(NULL);
+ p.setMaskFilter(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -135,7 +135,7 @@ static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2);
- p.setXfermode(NULL);
+ p.setXfermode(nullptr);
rastBuilder->addLayer(p);
}
@@ -199,8 +199,8 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -216,8 +216,8 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -303,7 +303,7 @@ protected:
{
SkPictureRecorder recorder;
{
- SkCanvas* record = recorder.beginRecording(320, 480, NULL, 0);
+ SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0);
this->drawPicture(record, 120);
}
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
@@ -359,7 +359,7 @@ protected:
// shaders
SkPoint linearPoints[] = { { 0, 0, }, { SkIntToScalar(40), SkIntToScalar(40) } };
SkColor linearColors[] = { SK_ColorRED, SK_ColorBLUE };
- SkScalar* linearPos = NULL;
+ SkScalar* linearPos = nullptr;
int linearCount = 2;
SkShader::TileMode linearMode = SkShader::kMirror_TileMode;
SkShader* linear = SkGradientShader::CreateLinear(linearPoints,
@@ -409,8 +409,8 @@ protected:
paint.setXfermode(xfermode)->unref();
paint.setColorFilter(lightingFilter)->unref();
canvas->drawLine(start.fX, start.fY, stop.fX, stop.fY, paint); // should not be green
- paint.setXfermode(NULL);
- paint.setColorFilter(NULL);
+ paint.setXfermode(nullptr);
+ paint.setColorFilter(nullptr);
// rectangle
paint.setStyle(SkPaint::kFill_Style);
@@ -419,7 +419,7 @@ protected:
paint.setShader(linear)->unref();
paint.setPathEffect(pathEffectTest())->unref();
canvas->drawRect(rect, paint);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
// circle w/ emboss & transparent (exercises 3dshader)
canvas->translate(SkIntToScalar(50), 0);
@@ -436,10 +436,10 @@ protected:
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(5));
paint.setShader(radial)->unref();
- paint.setMaskFilter(NULL);
+ paint.setMaskFilter(nullptr);
canvas->drawPath(path, paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
// bitmap, sprite
canvas->translate(SkIntToScalar(50), 0);
paint.setStyle(SkPaint::kFill_Style);
@@ -452,7 +452,7 @@ protected:
canvas->translate(-SkIntToScalar(30), SkIntToScalar(30));
paint.setShader(shaderTest())->unref(); // test compose shader
canvas->drawRect(rect2, paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
canvas->restore();
// text
@@ -482,7 +482,7 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) {
fClickPt.set(x, y);
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
@@ -508,11 +508,11 @@ protected:
SkShader* shaderTest() {
SkPoint pts[] = { { 0, 0, }, { SkIntToScalar(100), 0 } };
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
- SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, NULL,
+ SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, nullptr,
2, SkShader::kClamp_TileMode);
pts[1].set(0, SkIntToScalar(100));
SkColor colors2[] = {SK_ColorBLACK, SkColorSetARGB(0x80, 0, 0, 0)};
- SkShader* shaderB = SkGradientShader::CreateLinear(pts, colors2, NULL,
+ SkShader* shaderB = SkGradientShader::CreateLinear(pts, colors2, nullptr,
2, SkShader::kClamp_TileMode);
SkXfermode* mode = SkXfermode::Create(SkXfermode::kDstIn_Mode);
SkShader* result = new SkComposeShader(shaderA, shaderB, mode);
@@ -550,7 +550,7 @@ protected:
for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
apply_shader(&paint, (int)i);
- // paint.setMaskFilter(NULL);
+ // paint.setMaskFilter(nullptr);
// paint.setColor(SK_ColorBLACK);
#if 01
diff --git a/samplecode/SampleAnimator.cpp b/samplecode/SampleAnimator.cpp
index a7cc8851ea..8b7af68cb3 100644
--- a/samplecode/SampleAnimator.cpp
+++ b/samplecode/SampleAnimator.cpp
@@ -40,7 +40,7 @@ private:
typedef SkView INHERITED;
};
-SkAnimatorView::SkAnimatorView() : fAnimator(NULL) {}
+SkAnimatorView::SkAnimatorView() : fAnimator(nullptr) {}
SkAnimatorView::~SkAnimatorView() {
delete fAnimator;
@@ -52,7 +52,7 @@ void SkAnimatorView::setURIBase(const char dir[]) {
bool SkAnimatorView::decodeFile(const char path[]) {
SkAutoTDelete<SkStream> is(SkStream::NewFromFile(path));
- return is.get() != NULL && this->decodeStream(is);
+ return is.get() != nullptr && this->decodeStream(is);
}
bool SkAnimatorView::decodeMemory(const void* buffer, size_t size) {
@@ -62,7 +62,7 @@ bool SkAnimatorView::decodeMemory(const void* buffer, size_t size) {
static const SkDOMNode* find_nodeID(const SkDOM& dom,
const SkDOMNode* node, const char name[]) {
- if (NULL == node) {
+ if (nullptr == node) {
node = dom.getRootNode();
}
do {
@@ -77,8 +77,8 @@ static const SkDOMNode* find_nodeID(const SkDOM& dom,
return found;
}
}
- } while ((node = dom.getNextSibling(node)) != NULL);
- return NULL;
+ } while ((node = dom.getNextSibling(node)) != nullptr);
+ return nullptr;
}
bool SkAnimatorView::decodeStream(SkStream* stream) {
@@ -88,7 +88,7 @@ bool SkAnimatorView::decodeStream(SkStream* stream) {
#if 0
if (!fAnimator->decodeStream(stream)) {
delete fAnimator;
- fAnimator = NULL;
+ fAnimator = nullptr;
return false;
}
#else
@@ -97,18 +97,18 @@ bool SkAnimatorView::decodeStream(SkStream* stream) {
stream->read(text, len);
SkDOM dom;
const SkDOM::Node* root = dom.build(text, len);
- if (NULL == root) {
+ if (nullptr == root) {
return false;
}
if (!fAnimator->decodeDOM(dom, root)) {
delete fAnimator;
- fAnimator = NULL;
+ fAnimator = nullptr;
return false;
}
for (int i = 0; i <= 10; i++) {
SkString name("glyph");
name.appendS32(i);
- const SkDOM::Node* node = find_nodeID(dom, NULL, name.c_str());
+ const SkDOM::Node* node = find_nodeID(dom, nullptr, name.c_str());
SkASSERT(node);
SkRect r;
dom.findScalar(node, "left", &r.fLeft);
@@ -141,7 +141,7 @@ void SkAnimatorView::onDraw(SkCanvas* canvas) {
fAnimator->draw(canvas, 0);
canvas->restore();
- this->inval(NULL);
+ this->inval(nullptr);
#endif
}
}
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index d2f10b3365..44daeb63a1 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -111,7 +111,7 @@ static SkAnimTimer gAnimTimer;
static const char* skip_until(const char* str, const char* skip) {
if (!str) {
- return NULL;
+ return nullptr;
}
return strstr(str, skip);
}
@@ -119,7 +119,7 @@ static const char* skip_until(const char* str, const char* skip) {
static const char* skip_past(const char* str, const char* skip) {
const char* found = skip_until(str, skip);
if (!found) {
- return NULL;
+ return nullptr;
}
return found + strlen(skip);
}
@@ -162,9 +162,9 @@ public:
DefaultDeviceManager() {
#if SK_SUPPORT_GPU
- fCurContext = NULL;
- fCurIntf = NULL;
- fCurRenderTarget = NULL;
+ fCurContext = nullptr;
+ fCurIntf = nullptr;
+ fCurRenderTarget = nullptr;
fMSAASampleCount = 0;
#endif
fBackend = kNone_BackEndType;
@@ -209,7 +209,7 @@ public:
}
fMSAASampleCount = msaaSampleCount;
- SkASSERT(NULL == fCurIntf);
+ SkASSERT(nullptr == fCurIntf);
SkAutoTUnref<const GrGLInterface> glInterface;
switch (win->getDeviceType()) {
case kRaster_DeviceType: // fallthrough
@@ -232,15 +232,15 @@ public:
// when the driver doesn't support NVPR.
fCurIntf = GrGLInterfaceRemoveNVPR(glInterface.get());
- SkASSERT(NULL == fCurContext);
+ SkASSERT(nullptr == fCurContext);
fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf);
- if (NULL == fCurContext || NULL == fCurIntf) {
+ if (nullptr == fCurContext || nullptr == fCurIntf) {
// We need some context and interface to see results
SkSafeUnref(fCurContext);
SkSafeUnref(fCurIntf);
- fCurContext = NULL;
- fCurIntf = NULL;
+ fCurContext = nullptr;
+ fCurIntf = nullptr;
SkDebugf("Failed to setup 3D");
win->detach();
@@ -256,14 +256,14 @@ public:
// in case we have outstanding refs to this guy (lua?)
fCurContext->abandonContext();
fCurContext->unref();
- fCurContext = NULL;
+ fCurContext = nullptr;
}
SkSafeUnref(fCurIntf);
- fCurIntf = NULL;
+ fCurIntf = nullptr;
SkSafeUnref(fCurRenderTarget);
- fCurRenderTarget = NULL;
+ fCurRenderTarget = nullptr;
#endif
win->detach();
fBackend = kNone_BackEndType;
@@ -276,7 +276,7 @@ public:
return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props);
}
#endif
- return NULL;
+ return nullptr;
}
void publishCanvas(SampleWindow::DeviceType dType,
@@ -318,7 +318,7 @@ public:
#if SK_SUPPORT_GPU
return fCurContext;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -326,7 +326,7 @@ public:
#if SK_SUPPORT_GPU
return fCurRenderTarget;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -371,7 +371,7 @@ SkGMSampleViewFactory::SkGMSampleViewFactory(GMFactoryFunc func)
}
SkView* SkGMSampleViewFactory::operator() () const {
- skiagm::GM* gm = fFunc(NULL);
+ skiagm::GM* gm = fFunc(nullptr);
gm->setMode(skiagm::GM::kSample_Mode);
return new GMSampleView(gm);
}
@@ -442,7 +442,7 @@ struct HintingState {
const char* label;
};
static HintingState gHintingStates[] = {
- {SkPaint::kNo_Hinting, "Mixed", NULL },
+ {SkPaint::kNo_Hinting, "Mixed", nullptr },
{SkPaint::kNo_Hinting, "None", "H0 " },
{SkPaint::kSlight_Hinting, "Slight", "Hs " },
{SkPaint::kNormal_Hinting, "Normal", "Hn " },
@@ -455,7 +455,7 @@ struct FilterQualityState {
const char* fLabel;
};
static FilterQualityState gFilterQualityStates[] = {
- { kNone_SkFilterQuality, "Mixed", NULL },
+ { kNone_SkFilterQuality, "Mixed", nullptr },
{ kNone_SkFilterQuality, "None", "F0 " },
{ kLow_SkFilterQuality, "Low", "F1 " },
{ kMedium_SkFilterQuality, "Medium", "F2 " },
@@ -643,14 +643,14 @@ bool SampleWindow::zoomIn() {
// Arbitrarily decided
if (fFatBitsScale == kMaxFatBitsScale) return false;
fFatBitsScale++;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
bool SampleWindow::zoomOut() {
if (fFatBitsScale == 1) return false;
fFatBitsScale--;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
@@ -658,7 +658,7 @@ void SampleWindow::updatePointer(int x, int y) {
fMouseX = x;
fMouseY = y;
if (fShowZoomer) {
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -704,7 +704,7 @@ DEFINE_string(pdfPath, "", "Path to direcotry of pdf files.");
SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* devManager)
: INHERITED(hwnd)
- , fDevManager(NULL) {
+ , fDevManager(nullptr) {
SkCommandLineFlags::Parse(argc, argv);
@@ -745,7 +745,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
if (FLAGS_sort) {
// Sort samples, so foo.skp and foo.pdf are consecutive and we can quickly spot where
// skp -> pdf -> png fails.
- SkTQSort(fSamples.begin(), fSamples.end() ? fSamples.end() - 1 : NULL, compareSampleTitle);
+ SkTQSort(fSamples.begin(), fSamples.end() ? fSamples.end() - 1 : nullptr, compareSampleTitle);
}
if (!FLAGS_slide.isEmpty()) {
@@ -809,7 +809,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fMouseX = fMouseY = 0;
fFatBitsScale = 8;
- fTypeface = SkTypeface::CreateFromTypeface(NULL, SkTypeface::kBold);
+ fTypeface = SkTypeface::CreateFromTypeface(nullptr, SkTypeface::kBold);
fShowZoomer = false;
fZoomLevel = 0;
@@ -830,7 +830,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
#if SK_ANGLE
"ANGLE",
#endif
- NULL);
+ nullptr);
fAppMenu->assignKeyEquivalentToItem(itemID, 'd');
itemID = fAppMenu->appendTriState("AA", "AA", sinkID, fAAState);
fAppMenu->assignKeyEquivalentToItem(itemID, 'b');
@@ -842,7 +842,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
gFilterQualityStates[2].fName,
gFilterQualityStates[3].fName,
gFilterQualityStates[4].fName,
- NULL);
+ nullptr);
fAppMenu->assignKeyEquivalentToItem(itemID, 'n');
itemID = fAppMenu->appendTriState("Subpixel", "Subpixel", sinkID, fSubpixelState);
fAppMenu->assignKeyEquivalentToItem(itemID, 's');
@@ -852,7 +852,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
gHintingStates[2].name,
gHintingStates[3].name,
gHintingStates[4].name,
- NULL);
+ nullptr);
fAppMenu->assignKeyEquivalentToItem(itemID, 'h');
fUsePipeMenuItemID = fAppMenu->appendTriState("Pipe", "Pipe" , sinkID,
@@ -866,7 +866,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
gTilingInfo[kRel_4x4_Tiling].label,
gTilingInfo[kRel_1x16_Tiling].label,
gTilingInfo[kRel_16x1_Tiling].label,
- NULL);
+ nullptr);
fAppMenu->assignKeyEquivalentToItem(itemID, 't');
itemID = fAppMenu->appendSwitch("Slide Show", "Slide Show" , sinkID, false);
@@ -894,7 +894,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
this->loadView((*fSamples[fCurrIndex])());
- if (NULL == devManager) {
+ if (nullptr == devManager) {
fDevManager = new DefaultDeviceManager();
} else {
devManager->ref();
@@ -999,7 +999,7 @@ void SampleWindow::draw(SkCanvas* canvas) {
tileCanvas->translate(-x, -y);
tileCanvas->clear(0);
this->INHERITED::draw(tileCanvas);
- surface->draw(canvas, x, y, NULL);
+ surface->draw(canvas, x, y, nullptr);
}
}
@@ -1028,7 +1028,7 @@ void SampleWindow::draw(SkCanvas* canvas) {
}
if (this->sendAnimatePulse()) {
- this->inval(NULL);
+ this->inval(nullptr);
}
// do this last
@@ -1172,7 +1172,7 @@ void SampleWindow::showZoomer(SkCanvas* canvas) {
show_lcd_grid(canvas, bitmap, src, dest, show_lcd_circle);
break;
default:
- canvas->drawBitmapRect(bitmap, src, dest, NULL);
+ canvas->drawBitmapRect(bitmap, src, dest, nullptr);
break;
}
@@ -1201,7 +1201,7 @@ void SampleWindow::showZoomer(SkCanvas* canvas) {
// Identify the pixel and its color on screen
paint.setTypeface(fTypeface);
paint.setAntiAlias(true);
- SkScalar lineHeight = paint.getFontMetrics(NULL);
+ SkScalar lineHeight = paint.getFontMetrics(nullptr);
SkString string;
string.appendf("(%i, %i)", fMouseX, fMouseY);
SkScalar left = dest.fLeft + SkIntToScalar(3);
@@ -1242,7 +1242,7 @@ void SampleWindow::saveToPdf()
{
#if SK_SUPPORT_PDF
fSaveToPdf = true;
- this->inval(NULL);
+ this->inval(nullptr);
#endif // SK_SUPPORT_PDF
}
@@ -1259,7 +1259,7 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
fPDFDocument.reset(SkDocument::CreatePDF(name.c_str()));
canvas = fPDFDocument->beginPage(this->width(), this->height());
} else if (kPicture_DeviceType == fDeviceType) {
- canvas = fRecorder.beginRecording(9999, 9999, NULL, 0);
+ canvas = fRecorder.beginRecording(9999, 9999, nullptr, 0);
} else {
canvas = this->INHERITED::beforeChildren(canvas);
}
@@ -1284,15 +1284,15 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
}
#include "SkMultiPictureDraw.h"
void SampleWindow::afterChildren(SkCanvas* orig) {
- fFlagsFilterCanvas.reset(NULL);
+ fFlagsFilterCanvas.reset(nullptr);
if (fSaveToPdf) {
fSaveToPdf = false;
fPDFDocument->endPage();
- fPDFDocument.reset(NULL);
+ fPDFDocument.reset(nullptr);
// We took over the draw calls in order to create the PDF, so we need
// to redraw.
- this->inval(NULL);
+ this->inval(nullptr);
return;
}
@@ -1340,7 +1340,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
c->translate(SkIntToScalar(-x * n.width()),
SkIntToScalar(-y * n.height()));
c->concat(orig->getTotalMatrix());
- md.add(c, picture, NULL, NULL);
+ md.add(c, picture, nullptr, nullptr);
index++;
}
}
@@ -1359,7 +1359,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
SkAutoDataUnref data(ostream.copyToData());
SkMemoryStream istream(data->data(), data->size());
SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream));
- if (pict.get() != NULL) {
+ if (pict.get() != nullptr) {
orig->drawPicture(pict.get());
}
} else {
@@ -1413,7 +1413,7 @@ void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
(void)SampleView::SetRepeatDraw(child, 1);
}
if (fPerspAnim || fRotate) {
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -1464,7 +1464,7 @@ void SampleWindow::updateMatrix(){
this->setLocalMatrix(m);
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
}
bool SampleWindow::previousSample() {
fCurrIndex = (fCurrIndex - 1 + fSamples.count()) % fSamples.count();
@@ -1528,7 +1528,7 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
return true;
}
if (isInvalEvent(evt)) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
int selected = -1;
@@ -1543,10 +1543,10 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
#endif
(void)SampleView::SetUsePipe(curr_view(this), fPipeState);
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
- if (SkOSMenu::FindSwitchState(evt, "Slide Show", NULL)) {
+ if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) {
this->toggleSlideshow();
return true;
}
@@ -1559,7 +1559,7 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
SkOSMenu::FindSwitchState(evt, "Zoomer", &fShowZoomer) ||
SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify))
{
- this->inval(NULL);
+ this->inval(nullptr);
this->updateTitle();
return true;
}
@@ -1567,16 +1567,16 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
if (SampleView::IsSampleView(curr_view(this))) {
((SampleView*)curr_view(this))->onTileSizeChanged(this->tileSize());
}
- this->inval(NULL);
+ this->inval(nullptr);
this->updateTitle();
return true;
}
- if (SkOSMenu::FindSwitchState(evt, "Flip X", NULL)) {
+ if (SkOSMenu::FindSwitchState(evt, "Flip X", nullptr)) {
fFlipAxis ^= kFlipAxis_X;
this->updateMatrix();
return true;
}
- if (SkOSMenu::FindSwitchState(evt, "Flip Y", NULL)) {
+ if (SkOSMenu::FindSwitchState(evt, "Flip Y", nullptr)) {
fFlipAxis ^= kFlipAxis_Y;
this->updateMatrix();
return true;
@@ -1607,7 +1607,7 @@ bool SampleWindow::onQuery(SkEvent* query) {
return curr_view(this)->doQuery(&evt);
}
if (query->isType("ignore-window-bitmap")) {
- query->setFast32(this->getGrContext() != NULL);
+ query->setFast32(this->getGrContext() != nullptr);
return true;
}
return this->INHERITED::onQuery(query);
@@ -1652,7 +1652,7 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
fScrollTestX += dx;
fScrollTestY += dy;
}
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
@@ -1660,13 +1660,13 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
case 27: // ESC
gAnimTimer.stop();
if (this->sendAnimatePulse()) {
- this->inval(NULL);
+ this->inval(nullptr);
}
break;
case ' ':
gAnimTimer.togglePauseResume();
if (this->sendAnimatePulse()) {
- this->inval(NULL);
+ this->inval(nullptr);
}
break;
case 'B':
@@ -1674,7 +1674,7 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
// Cannot call updateTitle() synchronously, because the toggleBBox event is still in
// the queue.
post_event_to_sink(new SkEvent(gUpdateWindowTitleEvtName), this);
- this->inval(NULL);
+ this->inval(nullptr);
break;
case 'D':
toggleDistanceFieldFonts();
@@ -1685,17 +1685,17 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
break;
case 'F':
FLAGS_portableFonts ^= true;
- this->inval(NULL);
+ this->inval(nullptr);
break;
case 'g':
fRequestGrabImage = true;
- this->inval(NULL);
+ this->inval(nullptr);
break;
case 'G':
gShowGMBounds = !gShowGMBounds;
post_event_to_sink(GMSampleView::NewShowSizeEvt(gShowGMBounds),
curr_view(this));
- this->inval(NULL);
+ this->inval(nullptr);
break;
case 'i':
this->zoomIn();
@@ -1705,17 +1705,17 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
break;
case 'r':
fRotate = !fRotate;
- this->inval(NULL);
+ this->inval(nullptr);
this->updateTitle();
return true;
case 'k':
fPerspAnim = !fPerspAnim;
- this->inval(NULL);
+ this->inval(nullptr);
this->updateTitle();
return true;
case 'K':
fSaveToSKP = true;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
#if SK_SUPPORT_GPU
case 'p':
@@ -1723,7 +1723,7 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
GrContext* grContext = this->getGrContext();
if (grContext) {
size_t cacheBytes;
- grContext->getResourceCacheUsage(NULL, &cacheBytes);
+ grContext->getResourceCacheUsage(nullptr, &cacheBytes);
grContext->freeGpuResources();
SkDebugf("Purged %d bytes from the GPU resource cache.\n", cacheBytes);
}
@@ -1753,7 +1753,7 @@ void SampleWindow::setDeviceType(DeviceType type) {
fDevManager->setUpBackend(this, fMSAASampleCount);
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
}
void SampleWindow::toggleSlideshow() {
@@ -1765,13 +1765,13 @@ void SampleWindow::toggleSlideshow() {
void SampleWindow::toggleRendering() {
this->setDeviceType(cycle_devicetype(fDeviceType));
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
}
void SampleWindow::toggleFPS() {
fMeasureFPS = !fMeasureFPS;
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
}
void SampleWindow::toggleDistanceFieldFonts() {
@@ -1780,7 +1780,7 @@ void SampleWindow::toggleDistanceFieldFonts() {
this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
this->updateTitle();
- this->inval(NULL);
+ this->inval(nullptr);
}
#include "SkDumpCanvas.h"
@@ -1847,7 +1847,7 @@ bool SampleWindow::onDispatchClick(int x, int y, Click::State state,
}
else if (fMagnify) {
//it's only necessary to update the drawing if there's a click
- this->inval(NULL);
+ this->inval(nullptr);
return false; //prevent dragging while magnify is enabled
} else {
// capture control+option, and trigger debugger
@@ -1951,7 +1951,7 @@ static const char* trystate_str(SkOSMenu::TriState state,
} else if (SkOSMenu::kOffState == state) {
return falseStr;
}
- return NULL;
+ return nullptr;
}
bool SampleWindow::getRawTitle(SkString* title) {
@@ -1989,8 +1989,8 @@ void SampleWindow::updateTitle() {
title.prepend(trystate_str(fAAState, "AA ", "aa "));
title.prepend(gFilterQualityStates[fFilterQualityIndex].fLabel);
title.prepend(trystate_str(fSubpixelState, "S ", "s "));
- title.prepend(fFlipAxis & kFlipAxis_X ? "X " : NULL);
- title.prepend(fFlipAxis & kFlipAxis_Y ? "Y " : NULL);
+ title.prepend(fFlipAxis & kFlipAxis_X ? "X " : nullptr);
+ title.prepend(fFlipAxis & kFlipAxis_Y ? "Y " : nullptr);
title.prepend(gHintingStates[fHintingState].label);
if (fZoomLevel) {
@@ -2141,7 +2141,7 @@ private:
};
SimplePC::SimplePC(SkCanvas* target) : fReader(target) {
- fBlock = NULL;
+ fBlock = nullptr;
fBlockSize = fBytesWritten = 0;
fStatus = SkGPipeReader::kDone_Status;
fTotalWritten = 0;
@@ -2157,7 +2157,7 @@ SimplePC::~SimplePC() {
#ifdef PIPE_FILE
//File is open in append mode
FILE* f = fopen(FILE_PATH, "ab");
- SkASSERT(f != NULL);
+ SkASSERT(f != nullptr);
fwrite((const char*)fBlock + fBytesWritten, 1, bytes, f);
fclose(f);
#endif
@@ -2341,7 +2341,7 @@ SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
if (false) { // avoid bit rot, suppress warning
test();
}
- return new SampleWindow(hwnd, argc, argv, NULL);
+ return new SampleWindow(hwnd, argc, argv, nullptr);
}
// FIXME: this should be in a header
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index 1f8c33389a..d8724955e0 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -87,10 +87,10 @@ public:
// at least once before first draw (after init)
virtual void windowSizeChanged(SampleWindow* win) = 0;
- // return the GrContext backing gpu devices (NULL if not built with GPU support)
+ // return the GrContext backing gpu devices (nullptr if not built with GPU support)
virtual GrContext* getGrContext() = 0;
- // return the GrRenderTarget backing gpu devices (NULL if not built with GPU support)
+ // return the GrRenderTarget backing gpu devices (nullptr if not built with GPU support)
virtual GrRenderTarget* getGrRenderTarget() = 0;
private:
typedef SkRefCnt INHERITED;
@@ -100,11 +100,11 @@ public:
virtual ~SampleWindow();
SkSurface* createSurface() override {
- SkSurface* surface = NULL;
+ SkSurface* surface = nullptr;
if (fDevManager) {
surface = fDevManager->createSurface(fDeviceType, this);
}
- if (NULL == surface) {
+ if (nullptr == surface) {
surface = this->INHERITED::createSurface();
}
return surface;
diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp
index 90fbb7863c..834ba90a8f 100644
--- a/samplecode/SampleArc.cpp
+++ b/samplecode/SampleArc.cpp
@@ -204,7 +204,7 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
// fSweep += SK_Scalar1;
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index e11bf7e2c1..a7d5cbe9fd 100644
--- a/samplecode/SampleAtlas.cpp
+++ b/samplecode/SampleAtlas.cpp
@@ -186,7 +186,7 @@ protected:
paint.setFilterQuality(kLow_SkFilterQuality);
const SkRect cull = this->getBounds();
- const SkColor* colorsPtr = fUseColors ? colors : NULL;
+ const SkColor* colorsPtr = fUseColors ? colors : nullptr;
fProc(canvas, fAtlas, xform, fTex, colorsPtr, N, &cull, &paint);
}
@@ -223,7 +223,7 @@ protected:
SkUnichar uni;
if (SampleCode::CharQ(*evt, &uni)) {
switch (uni) {
- case 'C': fDrawable->toggleUseColors(); this->inval(NULL); return true;
+ case 'C': fDrawable->toggleUseColors(); this->inval(nullptr); return true;
default: break;
}
}
@@ -232,7 +232,7 @@ protected:
void onDrawContent(SkCanvas* canvas) override {
canvas->drawDrawable(fDrawable);
- this->inval(NULL);
+ this->inval(nullptr);
}
#if 0
diff --git a/samplecode/SampleBigGradient.cpp b/samplecode/SampleBigGradient.cpp
index c2e6225f5d..0fa7969c7a 100644
--- a/samplecode/SampleBigGradient.cpp
+++ b/samplecode/SampleBigGradient.cpp
@@ -13,7 +13,7 @@
static SkShader* make_grad(SkScalar w, SkScalar h) {
SkColor colors[] = { 0xFF000000, 0xFF333333 };
SkPoint pts[] = { { 0, 0 }, { w, h } };
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode);
}
diff --git a/samplecode/SampleBitmapRect.cpp b/samplecode/SampleBitmapRect.cpp
index b39db4c192..d7eed02ef9 100644
--- a/samplecode/SampleBitmapRect.cpp
+++ b/samplecode/SampleBitmapRect.cpp
@@ -37,7 +37,7 @@ static void make_bitmap(SkBitmap* bitmap) {
paint.setAntiAlias(true);
const SkPoint pts[] = { { 0, 0 }, { SCALAR_SIZE, SCALAR_SIZE } };
const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE };
- paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode))->unref();
canvas.drawCircle(SCALAR_SIZE/2, SCALAR_SIZE/2, SCALAR_SIZE/2, paint);
}
diff --git a/samplecode/SampleBlur.cpp b/samplecode/SampleBlur.cpp
index 7607dfc9f3..bd5ff475d7 100644
--- a/samplecode/SampleBlur.cpp
+++ b/samplecode/SampleBlur.cpp
@@ -25,7 +25,7 @@ static SkBitmap make_bitmap() {
bm.allocPixels(SkImageInfo::Make(256, 256, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
bm.lockPixels();
@@ -104,7 +104,7 @@ protected:
flags);
paint.setMaskFilter(mf)->unref();
} else {
- paint.setMaskFilter(NULL);
+ paint.setMaskFilter(nullptr);
}
canvas->drawCircle(200 + gRecs[i].fCx*100.f,
200 + gRecs[i].fCy*100.f, 50, paint);
@@ -120,7 +120,7 @@ protected:
paint.setColor(SK_ColorBLACK);
canvas->drawText("Hamburgefons Style", 18, x, y, paint);
canvas->drawText("Hamburgefons Style", 18, x, y + SkIntToScalar(50), paint);
- paint.setMaskFilter(NULL);
+ paint.setMaskFilter(nullptr);
paint.setColor(SK_ColorWHITE);
x -= SkIntToScalar(2);
y -= SkIntToScalar(2);
diff --git a/samplecode/SampleChart.cpp b/samplecode/SampleChart.cpp
index 8d158f1506..0c8949c8ef 100644
--- a/samplecode/SampleChart.cpp
+++ b/samplecode/SampleChart.cpp
@@ -24,7 +24,7 @@ static void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkSca
// Generates a path to stroke along the top of each plot and a fill path for the area below each
// plot. The fill path is bounded below by the bottomData plot points or a horizontal line at
-// yBase if bottomData == NULL.
+// yBase if bottomData == nullptr.
// The plots are animated by rotating the data points by leftShift.
static void gen_paths(const SkTDArray<SkScalar>& topData,
const SkTDArray<SkScalar>* bottomData,
@@ -35,7 +35,7 @@ static void gen_paths(const SkTDArray<SkScalar>& topData,
plot->rewind();
fill->rewind();
plot->incReserve(topData.count());
- if (NULL == bottomData) {
+ if (nullptr == bottomData) {
fill->incReserve(topData.count() + 2);
} else {
fill->incReserve(2 * topData.count());
@@ -142,7 +142,7 @@ protected:
fillPaint.setAntiAlias(true);
fillPaint.setStyle(SkPaint::kFill_Style);
- SkTDArray<SkScalar>* prevData = NULL;
+ SkTDArray<SkScalar>* prevData = nullptr;
for (int i = 0; i < kNumGraphs; ++i) {
gen_paths(fData[i],
prevData,
@@ -164,7 +164,7 @@ protected:
}
fShift += kShiftPerFrame;
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleClamp.cpp b/samplecode/SampleClamp.cpp
index 2368ab2051..e319a56dc4 100644
--- a/samplecode/SampleClamp.cpp
+++ b/samplecode/SampleClamp.cpp
@@ -16,7 +16,7 @@
static SkShader* make_linear() {
SkPoint pts[] = { 0, 0, SK_Scalar1/500, SK_Scalar1/500 };
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode);
}
diff --git a/samplecode/SampleClipDrawMatch.cpp b/samplecode/SampleClipDrawMatch.cpp
index c79c87239d..502f34946b 100644
--- a/samplecode/SampleClipDrawMatch.cpp
+++ b/samplecode/SampleClipDrawMatch.cpp
@@ -141,17 +141,17 @@ protected:
SkUnichar uni;
if (SampleCode::CharQ(*evt, &uni)) {
switch (uni) {
- case '1': fGeom = kRect_Geometry; this->inval(NULL); return true;
- case '2': fGeom = kRRect_Geometry; this->inval(NULL); return true;
- case '3': fGeom = kCircle_Geometry; this->inval(NULL); return true;
- case '4': fGeom = kConvexPath_Geometry; this->inval(NULL); return true;
- case '5': fGeom = kConcavePath_Geometry; this->inval(NULL); return true;
- case '6': fGeom = kRectAndRect_Geometry; this->inval(NULL); return true;
- case '7': fGeom = kRectAndRRect_Geometry; this->inval(NULL); return true;
- case '8': fGeom = kRectAndConvex_Geometry; this->inval(NULL); return true;
- case '9': fGeom = kRectAndConcave_Geometry; this->inval(NULL); return true;
- case 'f': fSign = -fSign; this->inval(NULL); return true;
- case 't': fClipFirst = !fClipFirst; this->inval(NULL); return true;
+ case '1': fGeom = kRect_Geometry; this->inval(nullptr); return true;
+ case '2': fGeom = kRRect_Geometry; this->inval(nullptr); return true;
+ case '3': fGeom = kCircle_Geometry; this->inval(nullptr); return true;
+ case '4': fGeom = kConvexPath_Geometry; this->inval(nullptr); return true;
+ case '5': fGeom = kConcavePath_Geometry; this->inval(nullptr); return true;
+ case '6': fGeom = kRectAndRect_Geometry; this->inval(nullptr); return true;
+ case '7': fGeom = kRectAndRRect_Geometry; this->inval(nullptr); return true;
+ case '8': fGeom = kRectAndConvex_Geometry; this->inval(nullptr); return true;
+ case '9': fGeom = kRectAndConcave_Geometry; this->inval(nullptr); return true;
+ case 'f': fSign = -fSign; this->inval(nullptr); return true;
+ case 't': fClipFirst = !fClipFirst; this->inval(nullptr); return true;
default: break;
}
}
@@ -240,7 +240,7 @@ protected:
this->drawGeometry(canvas, offset, false);
canvas->restoreToCount(saveCount);
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleClock.cpp b/samplecode/SampleClock.cpp
index 9b1e3e0499..ae7462d1dc 100644
--- a/samplecode/SampleClock.cpp
+++ b/samplecode/SampleClock.cpp
@@ -216,7 +216,7 @@ protected:
canvas->restore();
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleConcavePaths.cpp b/samplecode/SampleConcavePaths.cpp
index 2fc01076d2..fb5447efc7 100644
--- a/samplecode/SampleConcavePaths.cpp
+++ b/samplecode/SampleConcavePaths.cpp
@@ -139,7 +139,7 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleCull.cpp b/samplecode/SampleCull.cpp
index afc41849cb..011b22f9e7 100644
--- a/samplecode/SampleCull.cpp
+++ b/samplecode/SampleCull.cpp
@@ -161,7 +161,7 @@ protected:
paint.setStrokeWidth(SkIntToScalar(2));
// paint.setPathEffect(new SkCornerPathEffect(SkIntToScalar(30)))->unref();
canvas->drawPath(fPath, paint);
-// paint.setPathEffect(NULL);
+// paint.setPathEffect(nullptr);
#endif
SkPath tmp;
@@ -179,7 +179,7 @@ protected:
paint.setStrokeJoin(SkPaint::kRound_Join);
canvas->drawPath(tmp, paint);
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleDash.cpp b/samplecode/SampleDash.cpp
index e4fa79d47e..a01c079c70 100644
--- a/samplecode/SampleDash.cpp
+++ b/samplecode/SampleDash.cpp
@@ -73,7 +73,7 @@ protected:
SkDashPathEffect dash(interval, len, 0);
paint.setPathEffect(&dash);
canvas->drawLine(x0, y0, x1, y0, paint);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
y0 += paint.getStrokeWidth() * 3;
}
diff --git a/samplecode/SampleDither.cpp b/samplecode/SampleDither.cpp
index c0ce2992a9..8c14fb5110 100644
--- a/samplecode/SampleDither.cpp
+++ b/samplecode/SampleDither.cpp
@@ -35,7 +35,7 @@ static void draw_sweep(SkCanvas* c, int width, int height, SkScalar angle) {
// SkColor colors[] = { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorCYAN };
SkColor colors[] = { 0x4c737373, 0x4c737373, 0xffffd300 };
SkShader* s = SkGradientShader::CreateSweep(r.centerX(), r.centerY(),
- colors, NULL, SK_ARRAY_COUNT(colors));
+ colors, nullptr, SK_ARRAY_COUNT(colors));
p.setShader(s)->unref();
SkAutoCanvasRestore acr(c, true);
@@ -165,7 +165,7 @@ protected:
draw_sweep(canvas, fBM.width()>>2, fBM.height()>>2, fAngle);
fAngle += SK_Scalar1/2;
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp
index 9af5ce576f..df72dd4ffe 100644
--- a/samplecode/SampleDitherBitmap.cpp
+++ b/samplecode/SampleDitherBitmap.cpp
@@ -17,7 +17,7 @@ static void draw_rect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
canvas->drawRect(r, p);
SkPaint frame(p);
- frame.setShader(NULL);
+ frame.setShader(nullptr);
frame.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(r, frame);
}
@@ -26,7 +26,7 @@ static void draw_gradient(SkCanvas* canvas) {
SkRect r = { 0, 0, SkIntToScalar(256), SkIntToScalar(32) };
SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fTop } };
SkColor colors[] = { 0xFF000000, 0xFFFF0000 };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2,
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
SkShader::kClamp_TileMode);
SkPaint p;
@@ -62,7 +62,7 @@ static SkBitmap make_bitmap() {
SkBitmap bm;
bm.allocPixels(SkImageInfo::Make(256, 32, kIndex_8_SkColorType, kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
bm.lockPixels();
diff --git a/samplecode/SampleDraw.cpp b/samplecode/SampleDraw.cpp
index 616650f9ef..5e239c61f2 100644
--- a/samplecode/SampleDraw.cpp
+++ b/samplecode/SampleDraw.cpp
@@ -22,7 +22,7 @@ static void test_clearonlayers(SkCanvas* canvas) {
c.clipRect(rect);
- c.saveLayer(NULL, NULL);
+ c.saveLayer(nullptr, nullptr);
rect = SkRect::MakeXYWH(50, 10, 40, 80);
c.clipRect(rect, SkRegion::kUnion_Op);
@@ -262,7 +262,7 @@ class DrawView : public SkView {
SkTDArray<Draw*> fList;
public:
- DrawView() : fDraw(NULL) {
+ DrawView() : fDraw(nullptr) {
fFactory = new RectFactory;
}
@@ -289,7 +289,7 @@ public:
return *iter;
}
}
- return NULL;
+ return nullptr;
}
protected:
@@ -344,7 +344,7 @@ protected:
} else {
fDraw->unref();
}
- fDraw = NULL;
+ fDraw = nullptr;
}
return true;
}
@@ -365,7 +365,7 @@ protected:
}
}
}
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleEffects.cpp b/samplecode/SampleEffects.cpp
index 01a63adb75..b58d5573ad 100644
--- a/samplecode/SampleEffects.cpp
+++ b/samplecode/SampleEffects.cpp
@@ -40,7 +40,7 @@ static void paint_proc2(SkPaint* paint) {
static void paint_proc3(SkPaint* paint) {
SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE };
SkPoint pts[] = { { 3, 0 }, { 7, 5 } };
- paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
+ paint->setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode))->unref();
}
diff --git a/samplecode/SampleEncode.cpp b/samplecode/SampleEncode.cpp
index 185208b35b..9ca7d8ae46 100644
--- a/samplecode/SampleEncode.cpp
+++ b/samplecode/SampleEncode.cpp
@@ -65,7 +65,7 @@ static void make_image(SkBitmap* bm, SkColorType ct, int configIndex) {
}
}
SkColorTable* ctable = new SkColorTable(colors, 256);
- bm->allocPixels(info, NULL, ctable);
+ bm->allocPixels(info, nullptr, ctable);
ctable->unref();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
@@ -122,13 +122,13 @@ public:
for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) {
SkAutoTDelete<SkImageEncoder> codec(
SkImageEncoder::Create(gTypes[j]));
- if (NULL == codec.get()) {
+ if (nullptr == codec.get()) {
SkDebugf("[%s:%d] failed to encode %s%s\n",
__FILE__, __LINE__,gConfigLabels[i], gExt[j]);
continue;
}
SkAutoDataUnref data(codec->encodeData(fBitmaps[i], 100));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
SkDebugf("[%s:%d] failed to encode %s%s\n",
__FILE__, __LINE__,gConfigLabels[i], gExt[j]);
continue;
@@ -186,7 +186,7 @@ protected:
yy += SkIntToScalar(fBitmaps[i].height() + 10);
SkBitmap bm;
- SkData* encoded = NULL;
+ SkData* encoded = nullptr;
if (SkImageEncoder::kJPEG_Type == gTypes[j]) {
encoded = fEncodedJPEGs[i].get();
} else if (SkImageEncoder::kPNG_Type == gTypes[j]) {
@@ -219,7 +219,7 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index a756591844..0a47259d83 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -163,7 +163,7 @@ private:
SkCanvas* canvas = fMaxSurface->getCanvas();
canvas->save();
canvas->concat(fMatrix);
- fMinSurface->draw(canvas, 0, 0, NULL);
+ fMinSurface->draw(canvas, 0, 0, nullptr);
canvas->restore();
SkPaint paint;
@@ -184,7 +184,7 @@ void FatBits::drawBG(SkCanvas* canvas) {
paint.setShader(fShader);
canvas->drawRect(fBounds, paint);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
}
void FatBits::drawFG(SkCanvas* canvas) {
@@ -288,7 +288,7 @@ void FatBits::drawLine(SkCanvas* canvas, SkPoint pts[]) {
fMatrix.mapPoints(pts, 2);
this->drawLineSkeleton(max, pts);
- fMaxSurface->draw(canvas, 0, 0, NULL);
+ fMaxSurface->draw(canvas, 0, 0, nullptr);
}
void FatBits::drawRect(SkCanvas* canvas, SkPoint pts[2]) {
@@ -318,7 +318,7 @@ void FatBits::drawRect(SkCanvas* canvas, SkPoint pts[2]) {
r.set(pts, 2);
this->drawRectSkeleton(max, r);
- fMaxSurface->draw(canvas, 0, 0, NULL);
+ fMaxSurface->draw(canvas, 0, 0, nullptr);
}
void FatBits::drawTriangleSkeleton(SkCanvas* max, const SkPoint pts[]) {
@@ -360,7 +360,7 @@ void FatBits::drawTriangle(SkCanvas* canvas, SkPoint pts[3]) {
fMatrix.mapPoints(pts, 3);
this->drawTriangleSkeleton(max, pts);
- fMaxSurface->draw(canvas, 0, 0, NULL);
+ fMaxSurface->draw(canvas, 0, 0, nullptr);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -395,7 +395,7 @@ public:
void setStyle(FatBits::Style s) {
fFB.setStyle(s);
- this->inval(NULL);
+ this->inval(nullptr);
}
protected:
@@ -409,19 +409,19 @@ protected:
switch (uni) {
case 'c':
fFB.setUseClip(!fFB.getUseClip());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 'r':
fIsRect = !fIsRect;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 'o':
fFB.toggleRectAsOval();
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 'x':
fFB.setGrid(!fFB.getGrid());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 's':
if (FatBits::kStroke_Style == fFB.getStyle()) {
@@ -432,19 +432,19 @@ protected:
return true;
case 'a':
fFB.setAA(!fFB.getAA());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 'w':
fFB.setShowSkeleton(!fFB.getShowSkeleton());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 'g':
fFB.setUseGPU(!fFB.getUseGPU());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
case 't':
fFB.setTriangle(!fFB.getTriangle());
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
}
@@ -504,7 +504,7 @@ protected:
fPts[1].offset(dx, dy);
fPts[2].offset(dx, dy);
}
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleFilter.cpp b/samplecode/SampleFilter.cpp
index 3713a72450..acf358a857 100644
--- a/samplecode/SampleFilter.cpp
+++ b/samplecode/SampleFilter.cpp
@@ -30,7 +30,7 @@ static void make_bm(SkBitmap* bm) {
SkColorTable* ctable = new SkColorTable(colors, 4);
bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType,
kOpaque_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
*bm->getAddr8(0, 0) = 0;
diff --git a/samplecode/SampleFilter2.cpp b/samplecode/SampleFilter2.cpp
index 3541e15e2a..3663f11971 100644
--- a/samplecode/SampleFilter2.cpp
+++ b/samplecode/SampleFilter2.cpp
@@ -36,11 +36,11 @@ public:
for (int i = 0; i < fBitmapCount/2; i++) {
SkImageDecoder::DecodeFile(gNames[i], &fBitmaps[i], kN32_SkColorType,
- SkImageDecoder::kDecodePixels_Mode, NULL);
+ SkImageDecoder::kDecodePixels_Mode, nullptr);
}
for (int i = fBitmapCount/2; i < fBitmapCount; i++) {
SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], kRGB_565_SkColorType,
- SkImageDecoder::kDecodePixels_Mode, NULL);
+ SkImageDecoder::kDecodePixels_Mode, nullptr);
}
fCurrIndex = 0;
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index bae7c21a5f..ca4b8e2db3 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -39,7 +39,7 @@
//#define SK_ADD_RANDOM_BIT_FLIPS
//#define SK_FUZZER_IS_VERBOSE
-static const uint32_t kSeed = (uint32_t)(time(NULL));
+static const uint32_t kSeed = (uint32_t)(time(nullptr));
static SkRandom gRand(kSeed);
static bool return_large = false;
static bool return_undef = false;
@@ -245,7 +245,7 @@ static void drawSomething(SkCanvas* canvas) {
canvas->save();
canvas->scale(0.5f, 0.5f);
- canvas->drawBitmap(make_bitmap(), 0, 0, NULL);
+ canvas->drawBitmap(make_bitmap(), 0, 0, nullptr);
canvas->restore();
paint.setAntiAlias(true);
@@ -260,7 +260,7 @@ static void drawSomething(SkCanvas* canvas) {
static SkImageFilter* make_image_filter(bool canBeNull = true) {
SkImageFilter* filter = 0;
- // Add a 1 in 3 chance to get a NULL input
+ // Add a 1 in 3 chance to get a nullptr input
if (canBeNull && (R(3) == 1)) { return filter; }
enum { ALPHA_THRESHOLD, MERGE, COLOR, LUT3D, BLUR, MAGNIFIER,
@@ -380,7 +380,7 @@ static SkImageFilter* make_image_filter(bool canBeNull = true) {
case DROP_SHADOW:
filter = SkDropShadowImageFilter::Create(make_scalar(), make_scalar(), make_scalar(true),
make_scalar(true), make_color(), make_shadow_mode(), make_image_filter(),
- NULL);
+ nullptr);
break;
case MORPHOLOGY:
if (R(2) == 1) {
diff --git a/samplecode/SampleFilterQuality.cpp b/samplecode/SampleFilterQuality.cpp
index 12a04a6d60..8bc2b07c5b 100644
--- a/samplecode/SampleFilterQuality.cpp
+++ b/samplecode/SampleFilterQuality.cpp
@@ -59,7 +59,7 @@ static SkImage* zoom_up(SkImage* orig) {
canvas->scale(S, S);
canvas->translate(-SkScalarHalf(orig->width()) * (S - D) / S,
-SkScalarHalf(orig->height()) * (S - D) / S);
- canvas->drawImage(orig, 0, 0, NULL);
+ canvas->drawImage(orig, 0, 0, nullptr);
if (S > 3) {
SkPaint paint;
@@ -165,11 +165,11 @@ protected:
SkUnichar uni;
if (SampleCode::CharQ(*evt, &uni)) {
switch (uni) {
- case '1': fAngle.inc(-ANGLE_DELTA); this->inval(NULL); return true;
- case '2': fAngle.inc( ANGLE_DELTA); this->inval(NULL); return true;
- case '3': fScale.inc(-SCALE_DELTA); this->inval(NULL); return true;
- case '4': fScale.inc( SCALE_DELTA); this->inval(NULL); return true;
- case '5': fShowFatBits = !fShowFatBits; this->inval(NULL); return true;
+ case '1': fAngle.inc(-ANGLE_DELTA); this->inval(nullptr); return true;
+ case '2': fAngle.inc( ANGLE_DELTA); this->inval(nullptr); return true;
+ case '3': fScale.inc(-SCALE_DELTA); this->inval(nullptr); return true;
+ case '4': fScale.inc( SCALE_DELTA); this->inval(nullptr); return true;
+ case '5': fShowFatBits = !fShowFatBits; this->inval(nullptr); return true;
default: break;
}
}
@@ -283,7 +283,7 @@ protected:
}
virtual bool handleKey(SkKey key) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleFontCache.cpp b/samplecode/SampleFontCache.cpp
index 77f66b0eff..5391d2449b 100644
--- a/samplecode/SampleFontCache.cpp
+++ b/samplecode/SampleFontCache.cpp
@@ -63,7 +63,7 @@ static void* measure_proc(void* context) {
while (!gDone) {
call_measure();
}
- return NULL;
+ return nullptr;
}
static void* draw_proc(void* context) {
@@ -73,7 +73,7 @@ static void* draw_proc(void* context) {
while (!gDone) {
call_draw(&canvas);
}
- return NULL;
+ return nullptr;
}
class FontCacheView : public SampleView {
@@ -89,13 +89,13 @@ public:
for (int i = 0; i < N; i++) {
int status;
- status = pthread_create(&fMThreads[i], NULL, measure_proc, NULL);
+ status = pthread_create(&fMThreads[i], nullptr, measure_proc, nullptr);
SkASSERT(0 == status);
fBitmaps[i].allocPixels(SkImageInfo::Make(320, 240,
kRGB_565_SkColorType,
kOpaque_SkAlphaType));
- status = pthread_create(&fDThreads[i], NULL, draw_proc, &fBitmaps[i]);
+ status = pthread_create(&fDThreads[i], nullptr, draw_proc, &fBitmaps[i]);
SkASSERT(0 == status);
}
this->setBGColor(0xFFDDDDDD);
@@ -129,7 +129,7 @@ protected:
canvas->drawBitmap(fBitmaps[i], x, y);
x += SkIntToScalar(fBitmaps[i].width());
}
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleFontScalerTest.cpp b/samplecode/SampleFontScalerTest.cpp
index bbfd5a5e14..0105a47346 100644
--- a/samplecode/SampleFontScalerTest.cpp
+++ b/samplecode/SampleFontScalerTest.cpp
@@ -25,8 +25,8 @@ static const struct {
const char* fName;
SkTypeface::Style fStyle;
} gFaces[] = {
- { NULL, SkTypeface::kNormal },
- { NULL, SkTypeface::kBold },
+ { nullptr, SkTypeface::kNormal },
+ { nullptr, SkTypeface::kBold },
{ "serif", SkTypeface::kNormal },
{ "serif", SkTypeface::kBold },
{ "serif", SkTypeface::kItalic },
@@ -121,7 +121,7 @@ protected:
for (int ps = 6; ps <= 22; ps++) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
index += 1;
}
}
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp
index e690df1d92..d1a696f8c1 100644
--- a/samplecode/SampleFuzz.cpp
+++ b/samplecode/SampleFuzz.cpp
@@ -383,7 +383,7 @@ protected:
virtual void onDrawContent(SkCanvas* canvas) {
do_fuzz(canvas);
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleGradients.cpp b/samplecode/SampleGradients.cpp
index 12d24d2ae4..2d6f7d4bb1 100644
--- a/samplecode/SampleGradients.cpp
+++ b/samplecode/SampleGradients.cpp
@@ -13,7 +13,7 @@
static SkShader* setgrad(const SkRect& r, SkColor c0, SkColor c1) {
SkColor colors[] = { c0, c1 };
SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fTop } };
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
static void test_alphagradients(SkCanvas* canvas) {
@@ -56,10 +56,10 @@ static const SkScalar gPos2[] = {
};
static const GradData gGradData[] = {
- { 2, gColors, NULL },
+ { 2, gColors, nullptr },
{ 2, gColors, gPos0 },
{ 2, gColors, gPos1 },
- { 5, gColors, NULL },
+ { 5, gColors, nullptr },
{ 5, gColors, gPos2 }
};
@@ -164,7 +164,7 @@ protected:
if (false) { // avoid bit rot, suppress warning
test_alphagradients(canvas);
}
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleHT.cpp b/samplecode/SampleHT.cpp
index 7b452505a4..099adcc948 100644
--- a/samplecode/SampleHT.cpp
+++ b/samplecode/SampleHT.cpp
@@ -54,7 +54,7 @@ public:
fR = SkRect::MakeXYWH(rand.nextRangeF(0, 640), rand.nextRangeF(0, 480),
rand.nextRangeF(20, 200), rand.nextRangeF(20, 200));
fColor = rand_opaque_color(rand.nextU());
- fInterp = NULL;
+ fInterp = nullptr;
fTime = 0;
}
@@ -102,7 +102,7 @@ public:
switch (res) {
case SkInterpolator::kFreezeEnd_Result:
delete fInterp;
- fInterp = NULL;
+ fInterp = nullptr;
break;
default:
break;
@@ -172,8 +172,8 @@ protected:
break;
}
}
- this->inval(NULL);
- return NULL;
+ this->inval(nullptr);
+ return nullptr;
}
private:
diff --git a/samplecode/SampleHairModes.cpp b/samplecode/SampleHairModes.cpp
index 878857703e..ae41aa9c9d 100644
--- a/samplecode/SampleHairModes.cpp
+++ b/samplecode/SampleHairModes.cpp
@@ -110,7 +110,7 @@ protected:
SkXfermode* mode = SkXfermode::Create(gModes[i].fMode);
canvas->drawRect(bounds, fBGPaint);
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
SkScalar dy = drawCell(canvas, mode,
gAlphaValue[alpha & 1],
gAlphaValue[alpha & 2]);
diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp
index bb2e2f171c..a8985c851e 100644
--- a/samplecode/SampleHairline.cpp
+++ b/samplecode/SampleHairline.cpp
@@ -197,8 +197,8 @@ protected:
void show_bitmaps(SkCanvas* canvas, const SkBitmap& b0, const SkBitmap& b1,
const SkIRect& inset) {
- canvas->drawBitmap(b0, 0, 0, NULL);
- canvas->drawBitmap(b1, SkIntToScalar(b0.width()), 0, NULL);
+ canvas->drawBitmap(b0, 0, 0, nullptr);
+ canvas->drawBitmap(b1, SkIntToScalar(b0.width()), 0, nullptr);
}
void onDrawContent(SkCanvas* canvas) override {
@@ -219,7 +219,7 @@ protected:
bm2.eraseColor(SK_ColorTRANSPARENT);
gProcs[fProcIndex].fProc(&c2, paint, bm);
- canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL);
+ canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), nullptr);
}
bool onAnimate(const SkAnimTimer&) override {
@@ -233,7 +233,7 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
fDoAA = !fDoAA;
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp
index 7a329dedd0..5a4e39d36b 100644
--- a/samplecode/SampleIdentityScale.cpp
+++ b/samplecode/SampleIdentityScale.cpp
@@ -25,7 +25,7 @@ class IdentityScaleView : public SampleView {
public:
IdentityScaleView(const char imageFilename[]) {
SkString resourcePath = GetResourcePath(imageFilename);
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
codec = SkImageDecoder::Factory(&stream);
@@ -80,7 +80,7 @@ protected:
canvas->drawBitmap( fBM, 100, 100, &paint );
canvas->restore();
canvas->drawText( text, strlen(text), 100, 400, paint );
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index f5b88229ea..5fce85c4b7 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -58,7 +58,7 @@ protected:
virtual void onDrawContent(SkCanvas* canvas) {
SkRect r;
r.set(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(120), SkIntToScalar(120));
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
canvas->drawColor(SK_ColorRED);
drawMask(canvas, r);
canvas->restore();
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index 0c34638fc8..52bf5b357b 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -30,7 +30,7 @@
static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) {
SkColor colors[] = { 0, SK_ColorWHITE };
SkPoint pts[] = { { 0, 0 }, { 0, SK_Scalar1*20 } };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode,
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode,
0, &localMatrix);
paint->setShader(s)->unref();
@@ -70,11 +70,11 @@ static void test_fade(SkCanvas* canvas) {
canvas->clipRect(r);
r.fBottom = SkIntToScalar(20);
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
r.fTop = SkIntToScalar(80);
r.fBottom = SkIntToScalar(100);
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
// now draw the "content"
@@ -215,7 +215,7 @@ protected:
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
@@ -225,7 +225,7 @@ protected:
}
virtual bool handleKey(SkKey) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 4838cf8183..566ed7f909 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -88,11 +88,11 @@ protected:
canvas->drawRect(r, paint);
// so we're constantly updating
- this->inval(NULL);
+ this->inval(nullptr);
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleLines.cpp b/samplecode/SampleLines.cpp
index 0166bc0296..4570635689 100644
--- a/samplecode/SampleLines.cpp
+++ b/samplecode/SampleLines.cpp
@@ -65,7 +65,7 @@ protected:
void onDrawContent(SkCanvas* canvas) override {
SkBitmap bm;
SkImageDecoder::DecodeFile("/kill.gif", &bm);
- canvas->drawBitmap(bm, 0, 0, NULL);
+ canvas->drawBitmap(bm, 0, 0, nullptr);
this->drawRings(canvas);
return;
@@ -98,8 +98,8 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override {
fAlpha = SkScalarRoundToInt(y);
- this->inval(NULL);
- return NULL;
+ this->inval(nullptr);
+ return nullptr;
}
private:
diff --git a/samplecode/SampleLua.cpp b/samplecode/SampleLua.cpp
index 5fc9ab0c78..96b15b91b8 100644
--- a/samplecode/SampleLua.cpp
+++ b/samplecode/SampleLua.cpp
@@ -39,7 +39,7 @@ static const char gMissingCode[] = ""
class LuaView : public SampleView {
public:
- LuaView() : fLua(NULL) {}
+ LuaView() : fLua(nullptr) {}
virtual ~LuaView() { delete fLua; }
@@ -56,7 +56,7 @@ public:
}
lua_State* ensureLua() {
- if (NULL == fLua) {
+ if (nullptr == fLua) {
fLua = new SkLua;
SkString str = GetResourcePath(LUA_FILENAME);
@@ -90,7 +90,7 @@ protected:
SkDebugf("lua err: %s\n", lua_tostring(L, -1));
} else {
if (lua_isboolean(L, -1) && lua_toboolean(L, -1)) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
}
@@ -117,7 +117,7 @@ protected:
SkDebugf("lua err: %s\n", lua_tostring(L, -1));
} else {
if (lua_isboolean(L, -1) && lua_toboolean(L, -1)) {
- this->inval(NULL);
+ this->inval(nullptr);
}
}
}
@@ -135,7 +135,7 @@ protected:
SkDebugf("lua err: %s\n", lua_tostring(L, -1));
} else {
if (lua_isboolean(L, -1) && lua_toboolean(L, -1)) {
- this->inval(NULL);
+ this->inval(nullptr);
Click* c = new Click(this);
c->setType(gLuaClickHandlerName);
return c;
@@ -150,7 +150,7 @@ protected:
return this->INHERITED::onClick(click);
}
- const char* state = NULL;
+ const char* state = nullptr;
switch (click->fState) {
case Click::kMoved_State:
state = "moved";
@@ -162,7 +162,7 @@ protected:
break;
}
if (state) {
- this->inval(NULL);
+ this->inval(nullptr);
lua_State* L = fLua->get();
lua_getglobal(L, gClickName);
fLua->pushScalar(click->fCurr.x());
diff --git a/samplecode/SampleManyRects.cpp b/samplecode/SampleManyRects.cpp
index 9c9e985206..0290af2ce6 100644
--- a/samplecode/SampleManyRects.cpp
+++ b/samplecode/SampleManyRects.cpp
@@ -65,7 +65,7 @@ protected:
canvas->drawRect(rect, paint);
canvas->restore();
}
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleMeasure.cpp b/samplecode/SampleMeasure.cpp
index 86f9b52516..20335f203f 100644
--- a/samplecode/SampleMeasure.cpp
+++ b/samplecode/SampleMeasure.cpp
@@ -35,7 +35,7 @@ static const Setting gSettings[] = {
};
static void doMeasure(SkCanvas* canvas, const SkPaint& paint, const char text[]) {
- SkScalar dy = paint.getFontMetrics(NULL);
+ SkScalar dy = paint.getFontMetrics(nullptr);
size_t len = strlen(text);
SkAutoTMalloc<SkScalar> autoWidths(len);
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index 9ada9ef68c..dc3e9df086 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -42,7 +42,7 @@ static SkShader* make_shader1(const SkIPoint& size) {
SkPoint pts[] = { { 0, 0, },
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode);
}
@@ -74,7 +74,7 @@ static void eval_patch_edge(const SkPoint cubic[], SkPoint samples[], int segs)
samples[0] = cubic[0];
for (int i = 1; i < segs; i++) {
t += dt;
- SkEvalCubicAt(cubic, t, &samples[i], NULL, NULL);
+ SkEvalCubicAt(cubic, t, &samples[i], nullptr, nullptr);
}
}
@@ -199,9 +199,9 @@ void Patch::draw(SkCanvas* canvas, const SkPaint& paint, int nu, int nv,
}
t += dt;
canvas->drawVertices(SkCanvas::kTriangleStrip_VertexMode, stripCount,
- strip, doTextures ? tex : NULL,
- doColors ? colors : NULL, NULL,
- NULL, 0, paint);
+ strip, doTextures ? tex : nullptr,
+ doColors ? colors : nullptr, nullptr,
+ nullptr, 0, paint);
}
}
@@ -294,7 +294,7 @@ protected:
patch.setPatch(fPts);
drawpatches(canvas, paint, nu, nv, &patch);
- paint.setShader(NULL);
+ paint.setShader(nullptr);
paint.setAntiAlias(true);
paint.setStrokeWidth(SkIntToScalar(5));
canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fPts, paint);
@@ -347,7 +347,7 @@ protected:
bool onClick(Click* click) override {
fPts[((PtClick*)click)->fIndex].set(click->fCurr.fX - DX, click->fCurr.fY - DY);
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index c09ff20206..c977ca0dc2 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -57,9 +57,9 @@ static void test_cubic2() {
{
#ifdef SK_BUILD_FOR_WIN
// windows doesn't have strtof
- float x = (float)strtod("9.94099e+07", NULL);
+ float x = (float)strtod("9.94099e+07", nullptr);
#else
- float x = strtof("9.94099e+07", NULL);
+ float x = strtof("9.94099e+07", nullptr);
#endif
int ix = (int)x;
int fx = (int)(x * 65536);
@@ -211,7 +211,7 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
fShowHairline = !fShowHairline;
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
@@ -269,7 +269,7 @@ public:
void toggle(bool& value) {
value = !value;
- this->inval(NULL);
+ this->inval(nullptr);
}
protected:
@@ -323,7 +323,7 @@ protected:
if (click->fMeta.findS32("index", &index)) {
SkASSERT((unsigned)index < N);
fPts[index] = click->fCurr;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return false;
diff --git a/samplecode/SamplePathClip.cpp b/samplecode/SamplePathClip.cpp
index 494debfb4f..27f1f307ef 100644
--- a/samplecode/SamplePathClip.cpp
+++ b/samplecode/SamplePathClip.cpp
@@ -76,7 +76,7 @@ protected:
bool onClick(Click* click) override {
fCenter.set(click->fCurr.fX, click->fCurr.fY);
- this->inval(NULL);
+ this->inval(nullptr);
return false;
}
diff --git a/samplecode/SamplePathFuzz.cpp b/samplecode/SamplePathFuzz.cpp
index 70a052f80a..317833dfe9 100644
--- a/samplecode/SamplePathFuzz.cpp
+++ b/samplecode/SamplePathFuzz.cpp
@@ -685,7 +685,7 @@ protected:
path_fuzz_stroker(&offscreen, fIndex += 100);
canvas->drawBitmap(offscreen, 0, 0);
}
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SamplePdfFileViewer.cpp b/samplecode/SamplePdfFileViewer.cpp
index 747f729d3e..950d42b3fd 100644
--- a/samplecode/SamplePdfFileViewer.cpp
+++ b/samplecode/SamplePdfFileViewer.cpp
@@ -38,8 +38,8 @@ private:
static SkPicture* LoadPdf(const char path[]) {
SkAutoTDelete<SkPdfRenderer> renderer(SkPdfRenderer::CreateFromFile(path));
- if (NULL == renderer.get()) {
- return NULL;
+ if (nullptr == renderer.get()) {
+ return nullptr;
}
SkPicture* pic = new SkPicture;
@@ -51,8 +51,8 @@ private:
}
public:
- PdfFileViewer(const char name[] = NULL) : fFilename(name) {
- fPicture = NULL;
+ PdfFileViewer(const char name[] = nullptr) : fFilename(name) {
+ fPicture = nullptr;
}
virtual ~PdfFileViewer() {
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index dd315f8a14..4ba4f39ed4 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -46,12 +46,12 @@ public:
class PictFileView : public SampleView {
public:
- PictFileView(const char name[] = NULL)
+ PictFileView(const char name[] = nullptr)
: fFilename(name)
, fBBox(kNo_BBoxType)
, fTileSize(SkSize::Make(0, 0)) {
for (int i = 0; i < kBBoxTypeCount; ++i) {
- fPictures[i] = NULL;
+ fPictures[i] = nullptr;
}
fCount = 0;
}
@@ -126,7 +126,7 @@ protected:
canvas->setDrawFilter(&filter);
}
canvas->drawPicture(*picture);
- canvas->setDrawFilter(NULL);
+ canvas->setDrawFilter(nullptr);
}
#ifdef SK_GLYPHCACHE_TRACK_HASH_STATS
@@ -159,8 +159,8 @@ private:
SkPictureRecorder recorder;
SkCanvas* can = recorder.beginRecording(SkIntToScalar(bm.width()),
SkIntToScalar(bm.height()),
- NULL, 0);
- can->drawBitmap(bm, 0, 0, NULL);
+ nullptr, 0);
+ can->drawBitmap(bm, 0, 0, nullptr);
pic.reset(recorder.endRecording());
} else {
SkFILEStream stream(path);
@@ -174,7 +174,7 @@ private:
SkPictureRecorder recorder;
pic->playback(recorder.beginRecording(pic->cullRect().width(),
pic->cullRect().height(),
- NULL, 0));
+ nullptr, 0));
SkAutoTUnref<SkPicture> p2(recorder.endRecording());
SkString path2(path);
@@ -184,8 +184,8 @@ private:
}
}
- if (NULL == pic) {
- return NULL;
+ if (nullptr == pic) {
+ return nullptr;
}
SkAutoTDelete<SkBBHFactory> factory;
diff --git a/samplecode/SamplePicture.cpp b/samplecode/SamplePicture.cpp
index 638af054b1..eb2cd733fe 100644
--- a/samplecode/SamplePicture.cpp
+++ b/samplecode/SamplePicture.cpp
@@ -39,7 +39,7 @@ static SkBitmap load_bitmap() {
SkBitmap bm;
SkString pngFilename = GetResourcePath("mandrill_512.png");
SkAutoDataUnref data(SkData::NewFromFileName(pngFilename.c_str()));
- if (data.get() != NULL) {
+ if (data.get() != nullptr) {
SkInstallDiscardablePixelRef(data, &bm);
}
return bm;
@@ -63,14 +63,14 @@ public:
SkPictureRecorder recorder;
- recorder.beginRecording(100, 100, NULL, 0);
+ recorder.beginRecording(100, 100, nullptr, 0);
fSubPicture = recorder.endRecording();
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100, nullptr, 0);
SkPaint paint;
paint.setAntiAlias(true);
- canvas->drawBitmap(fBitmap, 0, 0, NULL);
+ canvas->drawBitmap(fBitmap, 0, 0, nullptr);
drawCircle(canvas, 50, SK_ColorBLACK);
canvas->drawPicture(fSubPicture);
@@ -108,7 +108,7 @@ protected:
canvas->save();
canvas->scale(0.5f, 0.5f);
- canvas->drawBitmap(fBitmap, 0, 0, NULL);
+ canvas->drawBitmap(fBitmap, 0, 0, nullptr);
canvas->restore();
paint.setAntiAlias(true);
@@ -127,7 +127,7 @@ protected:
this->drawSomething(canvas);
SkPictureRecorder recorder;
- this->drawSomething(recorder.beginRecording(100, 100, NULL, 0));
+ this->drawSomething(recorder.beginRecording(100, 100, nullptr, 0));
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
canvas->save();
@@ -161,7 +161,7 @@ private:
bool onEvent(const SkEvent& evt) override {
if (evt.isType(INVAL_ALL_TYPE)) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return this->INHERITED::onEvent(evt);
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 91a6a0f5d8..3b029804ad 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -196,7 +196,7 @@ protected:
default:
fText.appendUnichar(uni);
}
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return this->INHERITED::onQuery(evt);
@@ -226,7 +226,7 @@ protected:
SkCanvas* canvas = fMaxSurface->getCanvas();
canvas->save();
canvas->concat(fMatrix);
- fMinSurface->draw(canvas, 0, 0, NULL);
+ fMinSurface->draw(canvas, 0, 0, nullptr);
canvas->restore();
SkPaint paint;
@@ -320,7 +320,7 @@ protected:
if (drawText) {
fMinSurface->getCanvas()->drawPath(path, paint);
this->copyMinToMax();
- fMaxSurface->draw(canvas, 0, 0, NULL);
+ fMaxSurface->draw(canvas, 0, 0, nullptr);
}
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
@@ -541,7 +541,7 @@ protected:
draw_button(canvas, fRRectButton);
draw_button(canvas, fCircleButton);
draw_button(canvas, fTextButton);
- this->inval(NULL);
+ this->inval(nullptr);
}
class MyClick : public Click {
@@ -608,7 +608,7 @@ protected:
if (index < (int) SK_ARRAY_COUNT(fPts)) {
fPts[index].offset(SkIntToScalar(click->fICurr.fX - click->fIPrev.fX),
SkIntToScalar(click->fICurr.fY - click->fIPrev.fY));
- this->inval(NULL);
+ this->inval(nullptr);
} else if (index == (int) SK_ARRAY_COUNT(fPts) + 1) {
fWeight = MapScreenYtoValue(click->fICurr.fY, fWeightControl, 0, 5);
}
diff --git a/samplecode/SampleRectanizer.cpp b/samplecode/SampleRectanizer.cpp
index 7bb712c721..55e70a29d2 100644
--- a/samplecode/SampleRectanizer.cpp
+++ b/samplecode/SampleRectanizer.cpp
@@ -127,7 +127,7 @@ protected:
str.printf("Press \'h\' to toggle rects");
canvas->drawText(str.c_str(), str.size(), 50, kHeight + 150, blackBigFont);
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 8047844307..eb3e134af9 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -43,12 +43,12 @@ static void test_strokerect(SkCanvas* canvas) {
// use the rect
c.clear(SK_ColorTRANSPARENT);
c.drawRect(r, paint);
- canvas->drawBitmap(bitmap, 0, 0, NULL);
+ canvas->drawBitmap(bitmap, 0, 0, nullptr);
// use the path
c.clear(SK_ColorTRANSPARENT);
c.drawPath(path, paint);
- canvas->drawBitmap(bitmap, SkIntToScalar(2*width), 0, NULL);
+ canvas->drawBitmap(bitmap, SkIntToScalar(2*width), 0, nullptr);
}
static void drawFadingText(SkCanvas* canvas,
@@ -65,7 +65,7 @@ static void drawFadingText(SkCanvas* canvas,
// antialiasing
bounds.inset(-SkIntToScalar(2), -SkIntToScalar(2));
- canvas->saveLayer(&bounds, NULL);
+ canvas->saveLayer(&bounds, nullptr);
canvas->drawText(text, len, x, y, paint);
const SkPoint pts[] = {
@@ -112,7 +112,7 @@ static void test_text(SkCanvas* canvas) {
canvas->drawText(str, len, x, y, paint);
y += 20;
- paint.setShader(NULL);
+ paint.setShader(nullptr);
drawFadingText(canvas, str, len, x, y, paint);
}
@@ -269,7 +269,7 @@ protected:
{
char buffer[1000];
- SkDEBUGCODE(size_t size = ) tmp.writeToMemory(NULL);
+ SkDEBUGCODE(size_t size = ) tmp.writeToMemory(nullptr);
SkASSERT(size <= sizeof(buffer));
SkDEBUGCODE(size_t size2 = ) tmp.writeToMemory(buffer);
SkASSERT(size == size2);
@@ -392,13 +392,13 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) override {
return fRect.contains(SkScalarRoundToInt(x),
- SkScalarRoundToInt(y)) ? new Click(this) : NULL;
+ SkScalarRoundToInt(y)) ? new Click(this) : nullptr;
}
bool onClick(Click* click) override {
fRect.offset(click->fICurr.fX - click->fIPrev.fX,
click->fICurr.fY - click->fIPrev.fY);
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleRepeatTile.cpp b/samplecode/SampleRepeatTile.cpp
index 61bc8cd171..9287439613 100644
--- a/samplecode/SampleRepeatTile.cpp
+++ b/samplecode/SampleRepeatTile.cpp
@@ -67,7 +67,7 @@ protected:
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
@@ -77,7 +77,7 @@ protected:
}
virtual bool handleKey(SkKey) {
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleShaderText.cpp b/samplecode/SampleShaderText.cpp
index cf7cf96a43..f13fd4edc7 100644
--- a/samplecode/SampleShaderText.cpp
+++ b/samplecode/SampleShaderText.cpp
@@ -50,8 +50,8 @@ static const SkColor gColors[] = {
};
static const GradData gGradData[] = {
- { 2, gColors, NULL },
- { 5, gColors, NULL },
+ { 2, gColors, nullptr },
+ { 5, gColors, nullptr },
};
static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
@@ -182,7 +182,7 @@ protected:
++i;
canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
SkIntToScalar((i % testsPerCol) * rowHeight));
- canvas->drawTextOnPath(text, textLen, path, NULL, paint);
+ canvas->drawTextOnPath(text, textLen, path, nullptr, paint);
canvas->restore();
}
canvas->restore();
diff --git a/samplecode/SampleShaders.cpp b/samplecode/SampleShaders.cpp
index a9a8cf9c17..dd444ec34a 100644
--- a/samplecode/SampleShaders.cpp
+++ b/samplecode/SampleShaders.cpp
@@ -31,7 +31,7 @@ static SkShader* make_bitmapfade(const SkBitmap& bm)
pts[1].set(0, SkIntToScalar(bm.height()));
colors[0] = SK_ColorBLACK;
colors[1] = SkColorSetARGB(0, 0, 0, 0);
- SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
SkShader* shaderB = SkShader::CreateBitmapShader(bm,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
@@ -61,13 +61,13 @@ public:
pts[1].set(SkIntToScalar(100), 0);
colors[0] = SK_ColorRED;
colors[1] = SK_ColorBLUE;
- SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
pts[0].set(0, 0);
pts[1].set(0, SkIntToScalar(100));
colors[0] = SK_ColorBLACK;
colors[1] = SkColorSetARGB(0x80, 0, 0, 0);
- SkShader* shaderB = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkShader* shaderB = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
SkXfermode* mode = SkXfermode::Create(SkXfermode::kDstIn_Mode);
@@ -111,14 +111,14 @@ protected:
h = 80;
r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
- paint.setShader(NULL);
+ paint.setShader(nullptr);
canvas->drawRect(r, paint);
paint.setShader(make_bitmapfade(fBitmap))->unref();
canvas->drawRect(r, paint);
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index 83e91bb4d6..8b853365fe 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -93,7 +93,7 @@ static const PE_Proc gPE[] = { hair_pe, hair2_pe, stroke_pe, dash_pe, one_d_pe }
static void fill_pe(SkPaint* paint) {
paint->setStyle(SkPaint::kFill_Style);
- paint->setPathEffect(NULL);
+ paint->setPathEffect(nullptr);
}
static void discrete_pe(SkPaint* paint) {
@@ -171,10 +171,10 @@ static const SkScalar gPos2[] = {
};
static const GradData gGradData[] = {
-{ 2, gColors, NULL },
+{ 2, gColors, nullptr },
{ 2, gColors, gPos0 },
{ 2, gColors, gPos1 },
-{ 5, gColors, NULL },
+{ 5, gColors, nullptr },
{ 5, gColors, gPos2 }
};
@@ -290,7 +290,7 @@ static void textonpath_slide(SkCanvas* canvas) {
paint.setStyle(SkPaint::kFill_Style);
paint.setTextSize(50);
- canvas->drawTextOnPath(text, len, path, NULL, paint);
+ canvas->drawTextOnPath(text, len, path, nullptr, paint);
paint.setColor(SK_ColorRED);
matrix.setScale(-SK_Scalar1, SK_Scalar1);
@@ -327,7 +327,7 @@ static SkShader* make_shader1(const SkIPoint& size) {
SkPoint pts[] = { { 0, 0 },
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode);
}
@@ -338,7 +338,7 @@ public:
SkPoint* fVerts;
SkPoint* fTexs;
- Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {}
+ Rec() : fCount(0), fVerts(nullptr), fTexs(nullptr) {}
~Rec() { delete[] fVerts; delete[] fTexs; }
};
@@ -443,24 +443,24 @@ static void mesh_slide(SkCanvas* canvas) {
for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
canvas->save();
- paint.setShader(NULL);
+ paint.setShader(nullptr);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->translate(SkIntToScalar(210), 0);
paint.setShader(fShader0);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->translate(SkIntToScalar(210), 0);
paint.setShader(fShader1);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->restore();
canvas->translate(0, SkIntToScalar(250));
@@ -475,7 +475,7 @@ static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
- p.setMaskFilter(NULL);
+ p.setMaskFilter(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -530,7 +530,7 @@ static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2);
- p.setXfermode(NULL);
+ p.setXfermode(nullptr);
rastBuilder->addLayer(p);
}
@@ -585,8 +585,8 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -603,8 +603,8 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
p.setXfermodeMode(SkXfermode::kClear_Mode);
rastBuilder->addLayer(p);
- p.setPathEffect(NULL);
- p.setXfermode(NULL);
+ p.setPathEffect(nullptr);
+ p.setXfermode(nullptr);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rastBuilder->addLayer(p);
@@ -713,8 +713,8 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override {
this->init();
fIndex = (fIndex + 1) % SK_ARRAY_COUNT(gProc);
- this->inval(NULL);
- return NULL;
+ this->inval(nullptr);
+ return nullptr;
}
private:
diff --git a/samplecode/SampleStringArt.cpp b/samplecode/SampleStringArt.cpp
index 5bc667bb7e..74f3bd800a 100644
--- a/samplecode/SampleStringArt.cpp
+++ b/samplecode/SampleStringArt.cpp
@@ -59,8 +59,8 @@ protected:
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override {
fAngle = x/width();
- this->inval(NULL);
- return NULL;
+ this->inval(nullptr);
+ return nullptr;
}
private:
diff --git a/samplecode/SampleStrokePath.cpp b/samplecode/SampleStrokePath.cpp
index 63809cea75..9bcfcd96f9 100644
--- a/samplecode/SampleStrokePath.cpp
+++ b/samplecode/SampleStrokePath.cpp
@@ -210,7 +210,7 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) override {
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
private:
diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp
index 0f7639efa2..7e067a6dd4 100644
--- a/samplecode/SampleSubpixelTranslate.cpp
+++ b/samplecode/SampleSubpixelTranslate.cpp
@@ -27,7 +27,7 @@ public:
: fHorizontalVelocity(horizontalVelocity),
fVerticalVelocity(verticalVelocity) {
SkString resourcePath = GetResourcePath(imageFilename);
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
codec = SkImageDecoder::Factory(&stream);
@@ -109,7 +109,7 @@ protected:
fCurPos.fX += fHorizontalVelocity;
fCurPos.fY += fVerticalVelocity;
- this->inval(NULL);
+ this->inval(nullptr);
}
private:
diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
index aae42c1694..f5f8dbefa0 100644
--- a/samplecode/SampleText.cpp
+++ b/samplecode/SampleText.cpp
@@ -148,7 +148,7 @@ protected:
{
SkRect r;
r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20));
- // canvas->saveLayer(&r, NULL, SkCanvas::kHasAlphaLayer_SaveFlag);
+ // canvas->saveLayer(&r, nullptr, SkCanvas::kHasAlphaLayer_SaveFlag);
}
SkPaint paint;
@@ -188,7 +188,7 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) override {
fClickX = x;
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp
index f3440213ef..d8fd1044d6 100644
--- a/samplecode/SampleTextAlpha.cpp
+++ b/samplecode/SampleTextAlpha.cpp
@@ -65,7 +65,7 @@ protected:
paint.setTextSize(SkIntToScalar(ps));
paint.setTextSize(SkIntToScalar(24));
canvas->drawText(str, strlen(str), x, y, paint);
- y += paint.getFontMetrics(NULL);
+ y += paint.getFontMetrics(nullptr);
}
}
@@ -81,7 +81,7 @@ protected:
y = 255;
}
fByte = y;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
diff --git a/samplecode/SampleTextOnPath.cpp b/samplecode/SampleTextOnPath.cpp
index 7ea4694761..ea2ae81dc0 100644
--- a/samplecode/SampleTextOnPath.cpp
+++ b/samplecode/SampleTextOnPath.cpp
@@ -71,7 +71,7 @@ static void textPathMatrix(SkCanvas* canvas) {
SkPathMeasure meas(path, false);
SkScalar pathLen = meas.getLength();
- canvas->drawTextOnPath(text, len, path, NULL, paint);
+ canvas->drawTextOnPath(text, len, path, nullptr, paint);
paint.setColor(SK_ColorRED);
matrix.setScale(-SK_Scalar1, SK_Scalar1);
@@ -148,12 +148,12 @@ protected:
textPathMatrix(canvas);
if (REPEAT_COUNT > 1)
- this->inval(NULL);
+ this->inval(nullptr);
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
fHints += 1;
- this->inval(NULL);
+ this->inval(nullptr);
return this->INHERITED::onFindClickHandler(x, y, modi);
}
diff --git a/samplecode/SampleTextureDomain.cpp b/samplecode/SampleTextureDomain.cpp
index 7c770a9aac..65575338c9 100644
--- a/samplecode/SampleTextureDomain.cpp
+++ b/samplecode/SampleTextureDomain.cpp
@@ -85,11 +85,11 @@ protected:
paint.setMaskFilter(mf)->unref();
canvas->drawImageRect(image, srcRect, dstRect, &paint);
- // Blur and a rotation + NULL src rect
+ // Blur and a rotation + nullptr src rect
// This should not trigger the texture domain code
// but it will test a code path in SkGpuDevice::drawBitmap
// that handles blurs with rects transformed to non-
- // orthogonal rects. It also tests the NULL src rect handling
+ // orthogonal rects. It also tests the nullptr src rect handling
mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(5),
SkBlurMaskFilter::kHighQuality_BlurFlag);
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index 5f995e2bdb..ba79e5a0ba 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -97,9 +97,9 @@ protected:
SkScalar x = SkIntToScalar(10);
SkPictureRecorder recorder;
- SkCanvas* textCanvas = NULL;
- if (NULL == fTextPicture) {
- textCanvas = recorder.beginRecording(1000, 1000, NULL, 0);
+ SkCanvas* textCanvas = nullptr;
+ if (nullptr == fTextPicture) {
+ textCanvas = recorder.beginRecording(1000, 1000, nullptr, 0);
}
if (textCanvas) {
@@ -153,7 +153,7 @@ protected:
}
if (textCanvas) {
- SkASSERT(NULL == fTextPicture);
+ SkASSERT(nullptr == fTextPicture);
fTextPicture.reset(recorder.endRecording());
}
diff --git a/samplecode/SampleTinyBitmap.cpp b/samplecode/SampleTinyBitmap.cpp
index 57ce2ff319..8b1bdf0d18 100644
--- a/samplecode/SampleTinyBitmap.cpp
+++ b/samplecode/SampleTinyBitmap.cpp
@@ -24,7 +24,7 @@ static SkBitmap make_bitmap() {
SkBitmap bm;
bm.allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
ctable->unref();
bm.lockPixels();
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp
index ee3ec826b8..6d5cf6cccc 100644
--- a/samplecode/SampleUnpremul.cpp
+++ b/samplecode/SampleUnpremul.cpp
@@ -88,7 +88,7 @@ protected:
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(2)),
0, 0));
paint.setLooper(looper);
- SkScalar height = paint.getFontMetrics(NULL);
+ SkScalar height = paint.getFontMetrics(nullptr);
if (!fDecodeSucceeded) {
SkString failure;
if (fResPath.size() == 0) {
@@ -169,7 +169,7 @@ private:
}
SkFILEStream stream(fCurrFile.c_str());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
fDecodeSucceeded = false;
return;
}
@@ -178,7 +178,7 @@ private:
}
fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType,
SkImageDecoder::kDecodePixels_Mode) != SkImageDecoder::kFailure;
- this->inval(NULL);
+ this->inval(nullptr);
}
void togglePremul() {
diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp
index 138ab2e5ba..2f2dc024d0 100644
--- a/samplecode/SampleVertices.cpp
+++ b/samplecode/SampleVertices.cpp
@@ -46,7 +46,7 @@ static SkShader* make_shader1(const SkIPoint& size) {
SkPoint pts[] = { { 0, 0 },
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
- return SkGradientShader::CreateLinear(pts, colors, NULL,
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode);
}
@@ -95,24 +95,24 @@ protected:
for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
canvas->save();
- paint.setShader(NULL);
+ paint.setShader(nullptr);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->translate(SkIntToScalar(250), 0);
paint.setShader(fShader0);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->translate(SkIntToScalar(250), 0);
paint.setShader(fShader1);
canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
canvas->restore();
canvas->translate(0, SkIntToScalar(250));
@@ -126,7 +126,7 @@ protected:
bool onClick(Click* click) override {
// fCurrX = click->fICurr.fX;
// fCurrY = click->fICurr.fY;
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
@@ -137,7 +137,7 @@ private:
SkPoint* fVerts;
SkPoint* fTexs;
- Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {}
+ Rec() : fCount(0), fVerts(nullptr), fTexs(nullptr) {}
~Rec() { delete[] fVerts; delete[] fTexs; }
};
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index fff4bed0a4..a17a06e614 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -178,13 +178,13 @@ protected:
p.setShader(s);
canvas->drawRect(r, p);
- canvas->saveLayer(&r, NULL);
+ canvas->saveLayer(&r, nullptr);
draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop);
canvas->restore();
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
p.setStyle(SkPaint::kStroke_Style);
- p.setShader(NULL);
+ p.setShader(nullptr);
canvas->drawRect(r, p);
canvas->drawText(gModes[i].fLabel, strlen(gModes[i].fLabel),
diff --git a/site/dev/contrib/style.md b/site/dev/contrib/style.md
index ec556d9b67..639738c28f 100644
--- a/site/dev/contrib/style.md
+++ b/site/dev/contrib/style.md
@@ -440,25 +440,25 @@ stdint.h types (int32_t, etc). Assert that counts, etc are not negative instead
of using unsigned. Bitfields use uint32_t unless they have to be made shorter
for packing or performance reasons.
-NULL, 0
+nullptr, 0
-------
-Use NULL for pointers, 0 for ints. We prefer explicit NULL comparisons when
-checking for NULL pointers (as documentation):
+Use nullptr for pointers, 0 for ints. We prefer explicit nullptr comparisons when
+checking for nullptr pointers (as documentation):
<!--?prettify?-->
~~~~
-if (NULL == x) { // slightly preferred over if (!x)
+if (nullptr == x) { // slightly preferred over if (!x)
...
}
~~~~
-When checking non-NULL pointers explicit comparisons are not required because it
+When checking non-nullptr pointers explicit comparisons are not required because it
reads like a double negative:
<!--?prettify?-->
~~~~
-if (x) { // slightly preferred over if (NULL != x)
+if (x) { // slightly preferred over if (nullptr != x)
...
}
~~~~
@@ -514,7 +514,7 @@ Variable (i.e. mutable) object parameters are passed to functions as pointers.
~~~~
// src and paint are optional
void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
- const SkRect& dst, const SkPaint* paint = NULL);
+ const SkRect& dst, const SkPaint* paint = nullptr);
// metrics is mutable (it is changed by the method)
SkScalar SkPaint::getFontMetrics(FontMetric* metrics, SkScalar scale) const;
// A reference to foo is retained by SkContainer
@@ -527,8 +527,8 @@ lined up with the first parameter on the same line
<!--?prettify?-->
~~~~
void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst,
- const SkPaint* paint = NULL) {
- this->drawBitmapRectToRect(bitmap, NULL, dst, paint,
+ const SkPaint* paint = nullptr) {
+ this->drawBitmapRectToRect(bitmap, nullptr, dst, paint,
kNone_DrawBitmapRectFlag);
}
~~~~
@@ -539,9 +539,9 @@ or placed on the next line indented eight spaces
~~~~
void drawBitmapRect(
const SkBitmap& bitmap, const SkRect& dst,
- const SkPaint* paint = NULL) {
+ const SkPaint* paint = nullptr) {
this->drawBitmapRectToRect(
- bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag);
+ bitmap, nullptr, dst, paint, kNone_DrawBitmapRectFlag);
}
~~~~
diff --git a/site/dev/testing/fonts.md b/site/dev/testing/fonts.md
index 317ee9f1fa..cf1eec6d96 100644
--- a/site/dev/testing/fonts.md
+++ b/site/dev/testing/fonts.md
@@ -70,7 +70,7 @@ Each gm specifies the typeface to use when drawing text. For now, to set the
portable typeface on the paint, call:
~~~~
-sk_tool_utils::set_portable_typeface(SkPaint* , const char* name = NULL,
+sk_tool_utils::set_portable_typeface(SkPaint* , const char* name = nullptr,
SkTypeface::Style style = SkTypeface::kNormal );
~~~~
diff --git a/site/user/api/skpaint.md b/site/user/api/skpaint.md
index 8f34df30d3..df38cda6fc 100644
--- a/site/user/api/skpaint.md
+++ b/site/user/api/skpaint.md
@@ -99,8 +99,8 @@ assign a SkShader to the paint.
SkColor colors[2] = {SK_ColorBLUE, SK_ColorYELLOW};
SkShader* shader =
SkGradientShader::CreateLinear(
- points, colors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL);
+ points, colors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -201,8 +201,8 @@ with a vertical alpha gradient.
SK_ColorMAGENTA};
SkAutoTUnref<SkShader> srcShader(
SkGradientShader::CreateLinear(
- srcPoints, srcColors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL));
+ srcPoints, srcColors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr));
src.setShader(srcShader);
SkPoint dstPoints[2] = {
@@ -214,8 +214,8 @@ with a vertical alpha gradient.
SK_ColorCYAN};
SkAutoTUnref<SkShader> dstShader(
SkGradientShader::CreateLinear(
- dstPoints, dstColors, NULL, 2,
- SkShader::kClamp_TileMode, 0, NULL));
+ dstPoints, dstColors, nullptr, 2,
+ SkShader::kClamp_TileMode, 0, nullptr));
dst.setShader(dstShader);
canvas->clear(SK_ColorWHITE);
size_t N = sizeof(modes) / sizeof(modes[0]);
@@ -228,7 +228,7 @@ with a vertical alpha gradient.
canvas->drawText(desc, strlen(desc), 68.0f, 30.0f, text);
canvas->clipRect(SkRect::MakeWH(64.0f, 64.0f));
canvas->drawColor(SK_ColorLTGRAY);
- (void)canvas->saveLayer(NULL, NULL);
+ (void)canvas->saveLayer(nullptr, nullptr);
canvas->clear(SK_ColorTRANSPARENT);
canvas->drawPaint(dst);
src.setXfermodeMode(modes[i]);
@@ -275,7 +275,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkShader* shader =
SkGradientShader::CreateRadial(
SkPoint::Make(128.0f, 128.0f), 180.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -293,7 +293,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkGradientShader::CreateTwoPointConical(
SkPoint::Make(128.0f, 128.0f), 128.0f,
SkPoint::Make(128.0f, 16.0f), 16.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -311,7 +311,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, SK_ColorCYAN};
SkShader* shader =
SkGradientShader::CreateSweep(
- 128.0f, 128.0f, colors, NULL, 4, 0, NULL);
+ 128.0f, 128.0f, colors, nullptr, 4, 0, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -326,7 +326,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
canvas->clear(SK_ColorWHITE);
SkShader* shader = SkPerlinNoiseShader::CreateFractalNoise(
- 0.05f, 0.05f, 4, 0.0f, NULL);
+ 0.05f, 0.05f, 4, 0.0f, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -341,7 +341,7 @@ Several shaders are defined (besides the linear gradient already mentioned):
canvas->clear(SK_ColorWHITE);
SkShader* shader = SkPerlinNoiseShader::CreateTurbulence(
- 0.05f, 0.05f, 4, 0.0f, NULL);
+ 0.05f, 0.05f, 4, 0.0f, nullptr);
SkPaint paint;
paint.setShader(shader);
shader->unref();
@@ -358,9 +358,9 @@ Several shaders are defined (besides the linear gradient already mentioned):
SkShader* shader1 =
SkGradientShader::CreateRadial(
SkPoint::Make(128.0f, 128.0f), 180.0f,
- colors, NULL, 2, SkShader::kClamp_TileMode, 0, NULL);
+ colors, nullptr, 2, SkShader::kClamp_TileMode, 0, nullptr);
SkShader* shader2 = SkPerlinNoiseShader::CreateTurbulence(
- 0.025f, 0.025f, 2, 0.0f, NULL);
+ 0.025f, 0.025f, 2, 0.0f, nullptr);
SkShader* shader =
new SkComposeShader(shader1, shader2);
SkPaint paint;
@@ -507,7 +507,7 @@ SkColorFilter
int x = (i - 96) * 255 / 64;
ct[i] = x < 0 ? 0 : x > 255 ? 255 : x;
}
- SkColorFilter* cf = SkTableColorFilter::CreateARGB(NULL, ct, ct, ct);
+ SkColorFilter* cf = SkTableColorFilter::CreateARGB(nullptr, ct, ct, ct);
SkPaint paint;
paint.setColorFilter(cf);
cf->unref();
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index 8d8c268016..0dbe9c9f0f 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -152,7 +152,7 @@ void SkActive::calcDurations(int index)
// SkScriptValue value;
// value.fOperand = animate->getValues()[entries - 1];
// value.fType = animate->getValuesType();
-// bool result = SkScriptEngine::ConvertTo(NULL, SkType_Int, &value);
+// bool result = SkScriptEngine::ConvertTo(nullptr, SkType_Int, &value);
// SkASSERT(result);
// duration = value.fOperand.fS32 * SK_MSec1;
// break;
@@ -174,7 +174,7 @@ void SkActive::create(SkADrawable* drawable, SkMSec time) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, nullptr,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -212,7 +212,7 @@ bool SkActive::immediate(bool enable) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, nullptr,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -368,7 +368,7 @@ void SkActive::saveInterpolatorValues(int index) {
}
void SkActive::setInterpolator(int index, SkOperand* from) {
- if (from == NULL) // legitimate for set string
+ if (from == nullptr) // legitimate for set string
return;
SkAnimateBase* animate = fAnimators[index];
int entries = animate->entries();
diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp
index 82f777ef39..a4b2c64d1e 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -39,7 +39,7 @@ const SkMemberInfo SkAnimateBase::fInfo[] = {
DEFINE_GET_MEMBER(SkAnimateBase);
SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1),
- fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL),
+ fApply(nullptr), fFieldInfo(nullptr), fFieldOffset(0), fStart((SkMSec) -1), fTarget(nullptr),
fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0),
fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) {
blend.setCount(1);
@@ -116,7 +116,7 @@ returnBool:
value->fType = SkType_Boolean;
break;
case SK_PROPERTY(step):
- if (fApply == NULL)
+ if (fApply == nullptr)
return false; // !!! notify there's an error?
fApply->getStep(value);
break;
@@ -148,7 +148,7 @@ void SkAnimateBase::onEndElement(SkAnimateMaker& maker) {
// lval must be of the form x[y]
const char* lvalStr = lval.c_str();
const char* arrayEnd = strchr(lvalStr, '[');
- if (arrayEnd == NULL)
+ if (arrayEnd == nullptr)
return; //should this return an error?
size_t arrayNameLen = arrayEnd - lvalStr;
SkString arrayStr(lvalStr, arrayNameLen);
diff --git a/src/animator/SkAnimateField.cpp b/src/animator/SkAnimateField.cpp
index c6676e5be7..00113823ee 100644
--- a/src/animator/SkAnimateField.cpp
+++ b/src/animator/SkAnimateField.cpp
@@ -63,7 +63,7 @@ void SkAnimate::dump(SkAnimateMaker* maker) {
#endif
bool SkAnimate::resolveCommon(SkAnimateMaker& maker) {
- if (fTarget == NULL) // if NULL, recall onEndElement after apply closes and sets target to scope
+ if (fTarget == nullptr) // if nullptr, recall onEndElement after apply closes and sets target to scope
return false;
INHERITED::onEndElement(maker);
return maker.hasError() == false;
@@ -71,16 +71,16 @@ bool SkAnimate::resolveCommon(SkAnimateMaker& maker) {
void SkAnimate::onEndElement(SkAnimateMaker& maker) {
bool resolved = resolveCommon(maker);
- if (resolved && fFieldInfo == NULL) {
+ if (resolved && fFieldInfo == nullptr) {
maker.setErrorNoun(field);
maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget);
}
- if (resolved == false || fFieldInfo == NULL)
+ if (resolved == false || fFieldInfo == nullptr)
return;
SkDisplayTypes outType = fFieldInfo->getType();
if (fHasValues) {
SkASSERT(to.size() > 0);
- fFieldInfo->setValue(maker, &fValues, 0, 0, NULL, outType, to);
+ fFieldInfo->setValue(maker, &fValues, 0, 0, nullptr, outType, to);
SkASSERT(0);
// !!! this needs to set fComponents
return;
diff --git a/src/animator/SkAnimateMaker.cpp b/src/animator/SkAnimateMaker.cpp
index 256576259e..0c28c7bd57 100644
--- a/src/animator/SkAnimateMaker.cpp
+++ b/src/animator/SkAnimateMaker.cpp
@@ -28,8 +28,8 @@ class DefaultTimeline : public SkAnimator::Timeline {
} gDefaultTimeline;
SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint)
- : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
- fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(NULL),
+ : fActiveEvent(nullptr), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
+ fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(nullptr),
fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false),
fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator)
{
@@ -66,8 +66,8 @@ void SkAnimateMaker::clearExtraPropertyCallBack(SkDisplayTypes type) {
for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) {
SkExtras* extra = *extraPtr;
if (extra->definesType(type)) {
- extra->fExtraCallBack = NULL;
- extra->fExtraStorage = NULL;
+ extra->fExtraCallBack = nullptr;
+ extra->fExtraStorage = nullptr;
break;
}
}
@@ -84,7 +84,7 @@ SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) {
SkDisplayTypes type = SkDisplayType::GetType(this, name, len );
if ((int)type >= 0)
return SkDisplayType::CreateInstance(this, type);
- return NULL;
+ return nullptr;
}
// differs from SkAnimator::decodeStream in that it does not reset error state
@@ -181,7 +181,7 @@ void SkAnimateMaker::dump(const char* match) {
SkTDict<SkDisplayable*>::Iter iter(fIDs);
const char* name;
SkDisplayable* result;
- while ((name = iter.next(&result)) != NULL) {
+ while ((name = iter.next(&result)) != nullptr) {
if (strcmp(match,name) == 0)
result->dump(this);
}
@@ -213,7 +213,7 @@ SkAnimator* SkAnimateMaker::getRoot()
SkAnimateMaker* maker = this;
while (maker->fParentMaker)
maker = maker->fParentMaker;
- return maker == this ? NULL : maker->fAnimator;
+ return maker == this ? nullptr : maker->fAnimator;
}
#endif
@@ -235,8 +235,8 @@ void SkAnimateMaker::loadMovies() {
SkASSERT(displayable->getType() == SkType_Movie);
SkDisplayMovie* movie = (SkDisplayMovie*) displayable;
SkAnimateMaker* movieMaker = movie->fMovie.fMaker;
- movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL);
- movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
+ movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, nullptr);
+ movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr);
movieMaker->loadMovies();
}
}
@@ -271,14 +271,14 @@ void SkAnimateMaker::reset() {
}
void SkAnimateMaker::removeActive(SkActive* active) {
- if (active == NULL)
+ if (active == nullptr)
return;
fDisplayList.remove(active);
}
bool SkAnimateMaker::resolveID(SkDisplayable* displayable, SkDisplayable* original) {
SkString newID;
- bool success = computeID(original, NULL, &newID);
+ bool success = computeID(original, nullptr, &newID);
if (success)
setID(displayable, newID);
return success;
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index 6679a92fb5..c05e0299d8 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -48,14 +48,14 @@ void SkSet::dump(SkAnimateMaker* maker) {
#endif
void SkSet::refresh(SkAnimateMaker& maker) {
- fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
+ fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, nullptr,
fFieldInfo->getType(), to);
}
void SkSet::onEndElement(SkAnimateMaker& maker) {
if (resolveCommon(maker) == false)
return;
- if (fFieldInfo == NULL) {
+ if (fFieldInfo == nullptr) {
maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget);
return;
}
diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp
index 97f55af01a..ee75ab14af 100644
--- a/src/animator/SkAnimator.cpp
+++ b/src/animator/SkAnimator.cpp
@@ -42,7 +42,7 @@ _static const char gMathPrimerText[] =
#define gMathPrimer gMathPrimerText
-SkAnimator::SkAnimator() : fMaker(NULL) {
+SkAnimator::SkAnimator() : fMaker(nullptr) {
initialize();
}
@@ -144,7 +144,7 @@ bool SkAnimator::doUserEvent(const SkEvent& evt) {
}
SkAnimator::DifferenceType SkAnimator::draw(SkCanvas* canvas, SkPaint* paint, SkMSec time) {
- if (paint == NULL)
+ if (paint == nullptr)
return draw(canvas, time);
fMaker->fScreenplay.time = time;
fMaker->fCanvas = canvas;
@@ -179,7 +179,7 @@ bool SkAnimator::findClickEvent(SkScalar x, SkScalar y) {
const SkAnimator* SkAnimator::getAnimator(const SkDisplayable* displayable) const {
if (displayable->getType() != SkType_Movie)
- return NULL;
+ return nullptr;
const SkDisplayMovie* movie = (const SkDisplayMovie*) displayable;
return movie->getAnimator();
}
@@ -187,13 +187,13 @@ const SkAnimator* SkAnimator::getAnimator(const SkDisplayable* displayable) cons
const SkDisplayable* SkAnimator::getElement(const char* id) {
SkDisplayable* element;
if (fMaker->find(id, &element) == false)
- return NULL;
+ return nullptr;
return (const SkDisplayable*) element;
}
SkElementType SkAnimator::getElementType(const SkDisplayable* ae) {
SkDisplayable* element = (SkDisplayable*) ae;
- const SkMemberInfo* info = SkDisplayType::GetMembers(fMaker, element->getType(), NULL);
+ const SkMemberInfo* info = SkDisplayType::GetMembers(fMaker, element->getType(), nullptr);
return (SkElementType) SkDisplayType::Find(fMaker, info);
}
@@ -240,10 +240,10 @@ int32_t SkAnimator::getArrayInt(const SkDisplayable* ae,
int32_t SkAnimator::getArrayInt(const char* id, const char* fieldID, int index) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return SK_NaN32;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return SK_NaN32;
return getArrayInt(element, field, index);
}
@@ -257,10 +257,10 @@ SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae,
SkScalar SkAnimator::getArrayScalar(const char* id, const char* fieldID, int index) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return SK_ScalarNaN;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return SK_ScalarNaN;
return getArrayScalar(element, field, index);
}
@@ -269,16 +269,16 @@ const char* SkAnimator::getArrayString(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand);
- return result ? operand.fString->c_str() : NULL;
+ return result ? operand.fString->c_str() : nullptr;
}
const char* SkAnimator::getArrayString(const char* id, const char* fieldID, int index) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
- return NULL;
+ if (element == nullptr)
+ return nullptr;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
- return NULL;
+ if (field == nullptr)
+ return nullptr;
return getArrayString(element, field, index);
}
@@ -326,10 +326,10 @@ int32_t SkAnimator::getInt(const SkDisplayable* element, const SkMemberInfo* inf
int32_t SkAnimator::getInt(const char* id, const char* fieldID) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return SK_NaN32;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return SK_NaN32;
return getInt(element, field);
}
@@ -352,10 +352,10 @@ SkScalar SkAnimator::getScalar(const SkDisplayable* element, const SkMemberInfo*
SkScalar SkAnimator::getScalar(const char* id, const char* fieldID) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return SK_ScalarNaN;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return SK_ScalarNaN;
return getScalar(element, field);
}
@@ -371,11 +371,11 @@ const char* SkAnimator::getString(const SkDisplayable* ae,
const char* SkAnimator::getString(const char* id, const char* fieldID) {
const SkDisplayable* element = getElement(id);
- if (element == NULL)
- return NULL;
+ if (element == nullptr)
+ return nullptr;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
- return NULL;
+ if (field == nullptr)
+ return nullptr;
return getString(element, field);
}
@@ -385,7 +385,7 @@ const char* SkAnimator::getURIBase() {
void SkAnimator::initialize() {
delete fMaker;
- fMaker = new SkAnimateMaker(this, NULL, NULL);
+ fMaker = new SkAnimateMaker(this, nullptr, nullptr);
decodeMemory(gMathPrimer, sizeof(gMathPrimer)-1);
#ifdef SK_BUILD_FOR_ANDROID
InitializeSkExtraPathEffects(this);
@@ -402,7 +402,7 @@ bool SkAnimator::isTrackingEvents() {
bool SkAnimator::onEvent(const SkEvent& evt) {
#ifdef SK_DEBUG
SkAnimator* root = fMaker->getRoot();
- if (root == NULL)
+ if (root == nullptr)
root = this;
if (root->isTrackingEvents())
root->eventDone(evt);
@@ -424,7 +424,7 @@ bool SkAnimator::onEvent(const SkEvent& evt) {
}
{
const char* id = evt.findString("id");
- if (id == NULL)
+ if (id == nullptr)
return false;
SkDisplayable** firstMovie = fMaker->fMovies.begin();
SkDisplayable** endMovie = fMaker->fMovies.end();
@@ -555,11 +555,11 @@ bool SkAnimator::setArray(SkDisplayable* element, const SkMemberInfo* info, SkTy
bool SkAnimator::setArray(const char* id, const char* fieldID, SkTypedArray array) {
SkDisplayable* element = (SkDisplayable*) getElement(id);
- //should I go ahead and change all 'NULL's to 'NULL'?
- if (element == NULL)
+ //should I go ahead and change all 'nullptr's to 'nullptr'?
+ if (element == nullptr)
return false;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return false;
return setArray(element, field, array);
}
@@ -581,10 +581,10 @@ bool SkAnimator::setInt(SkDisplayable* element, const SkMemberInfo* info, int32_
bool SkAnimator::setInt(const char* id, const char* fieldID, int32_t s32) {
SkDisplayable* element = (SkDisplayable*) getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return false;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return false;
return setInt(element, field, s32);
}
@@ -606,10 +606,10 @@ bool SkAnimator::setScalar(SkDisplayable* element, const SkMemberInfo* info, SkS
bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar) {
SkDisplayable* element = (SkDisplayable*) getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return false;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return false;
return setScalar(element, field, scalar);
}
@@ -617,16 +617,16 @@ bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar)
bool SkAnimator::setString(SkDisplayable* element,
const SkMemberInfo* info, const char* str) {
// !!! until this is fixed, can't call script with global references from here
- info->setValue(*fMaker, NULL, 0, info->fCount, element, info->getType(), str, strlen(str));
+ info->setValue(*fMaker, nullptr, 0, info->fCount, element, info->getType(), str, strlen(str));
return true;
}
bool SkAnimator::setString(const char* id, const char* fieldID, const char* str) {
SkDisplayable* element = (SkDisplayable*) getElement(id);
- if (element == NULL)
+ if (element == nullptr)
return false;
const SkMemberInfo* field = getField(element, fieldID);
- if (field == NULL)
+ if (field == nullptr)
return false;
return setString(element, field, str);
}
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index 051dc0d872..cbe1d04b1e 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -45,7 +45,7 @@ static const SkDisplayEnumMap gEnumMaps[] = {
static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps);
SkAnimatorScript::SkAnimatorScript(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type)
- : SkScriptEngine(SkScriptEngine::ToOpType(type)), fMaker(maker), fParent(NULL), fWorking(working)
+ : SkScriptEngine(SkScriptEngine::ToOpType(type)), fMaker(maker), fParent(nullptr), fWorking(working)
{
memberCallBack(EvalMember, (void*) this);
memberFunctionCallBack(EvalMemberFunction, (void*) this);
@@ -165,7 +165,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
displayable = engine->fWorking;
if (SK_LITERAL_STR_EQUAL("parent", token, len)) {
SkDisplayable* parent = displayable->getParent();
- if (parent == NULL)
+ if (parent == nullptr)
parent = engine->fParent;
if (parent) {
value->fOperand.fDisplayable = parent;
@@ -175,7 +175,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
}
if (displayable && EvalMember(token, len, displayable, engine, value))
return true;
- value->fOperand.fString = NULL;
+ value->fOperand.fString = nullptr;
value->fType = SkType_String;
} else {
SkDisplayable* working = engine->fWorking;
@@ -194,7 +194,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
bool SkAnimatorScript::EvalNamedColor(const char* token, size_t len, void* callback, SkScriptValue* value) {
value->fType = SkType_Int;
- if (SkParse::FindNamedColor(token, len, (SkColor*) &value->fOperand.fS32) != NULL)
+ if (SkParse::FindNamedColor(token, len, (SkColor*) &value->fOperand.fS32) != nullptr)
return true;
return false;
}
@@ -281,7 +281,7 @@ bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object,
return true;
}
const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL)
+ if (info == nullptr)
return false;
if (info->fType == SkType_MemberProperty) {
if (displayable->getProperty(info->propertyIndex(), value) == false) {
@@ -298,7 +298,7 @@ bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void*
SkDisplayable* displayable = (SkDisplayable*) object;
SkString name(member, len);
const SkMemberInfo* info = displayable->getMember(name.c_str());
- SkASSERT(info != NULL); /* !!! error handling unimplemented */
+ SkASSERT(info != nullptr); /* !!! error handling unimplemented */
if (info->fType != SkType_MemberFunction) {
SkASSERT(0);
return false;
@@ -401,7 +401,7 @@ bool SkAnimatorScript::MapEnums(const char* ptr, const char* match, size_t len,
bool more = true;
do {
const char* last = strchr(ptr, '|');
- if (last == NULL) {
+ if (last == nullptr) {
last = &ptr[strlen(ptr)];
more = false;
}
@@ -465,7 +465,7 @@ bool SkAnimatorScript::Unbox(void* m, SkScriptValue* scriptValue) {
scriptValue->fOperand.fString = new SkString(boxedValue->value);
} break;
default: {
- const char* id = NULL;
+ const char* id = nullptr;
SkDEBUGCODE(bool success = ) maker->findKey(displayable, &id);
SkASSERT(success);
scriptValue->fOperand.fString = new SkString(id);
@@ -562,7 +562,7 @@ void SkAnimatorScript::UnitTest() {
animator.doUserEvent(evt);
// set up animator with memory script above, then run value tests
for (unsigned index = 0; index < SkScriptNAnswer_testCount; index++) {
- SkAnimatorScript engine(*animator.fMaker, NULL, scriptTests[index].fType);
+ SkAnimatorScript engine(*animator.fMaker, nullptr, scriptTests[index].fType);
SkScriptValue value;
const char* script = scriptTests[index].fScript;
bool success = engine.evaluateScript(&script, &value);
diff --git a/src/animator/SkAnimatorScript2.cpp b/src/animator/SkAnimatorScript2.cpp
index 700027aec0..d246130fbe 100644
--- a/src/animator/SkAnimatorScript2.cpp
+++ b/src/animator/SkAnimatorScript2.cpp
@@ -205,7 +205,7 @@ public:
return true;
}
const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL)
+ if (info == nullptr)
return false; // !!! add additional error info?
ref->fType = SkAnimatorScript2::ToOpType(info->getType());
ref->fOperand.fObject = (void*) info;
@@ -235,7 +235,7 @@ public:
SkDisplayable* displayable = (SkDisplayable*) object;
SkString name(member, len);
const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL || info->fType != SkType_MemberFunction)
+ if (info == nullptr || info->fType != SkType_MemberFunction)
return false; // !!! add additional error info?
ref->fType = SkAnimatorScript2::ToOpType(info->getType());
ref->fOperand.fObject = (void*) info;
@@ -264,7 +264,7 @@ public:
class SkAnimatorScript_NamedColor : public SkScriptCallBackProperty {
public:
virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
- return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL;
+ return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != nullptr;
}
};
@@ -474,9 +474,9 @@ SkDisplayTypes SkAnimatorScript2::ToDisplayType(SkOperand2::OpType type) {
}
SkOperand2::OpType SkAnimatorScript2::ToOpType(SkDisplayTypes type) {
- if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
+ if (SkDisplayType::IsDisplayable(nullptr /* fMaker */, type))
return SkOperand2::kObject;
- if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
+ if (SkDisplayType::IsEnum(nullptr /* fMaker */, type))
return SkOperand2::kS32;
switch (type) {
case SkType_ARGB:
@@ -506,7 +506,7 @@ bool SkAnimatorScript2::MapEnums(const char* ptr, const char* match, size_t len,
bool more = true;
do {
const char* last = strchr(ptr, '|');
- if (last == NULL) {
+ if (last == nullptr) {
last = &ptr[strlen(ptr)];
more = false;
}
@@ -591,7 +591,7 @@ void SkAnimatorScript2::UnitTest() {
animator.doUserEvent(evt);
// set up animator with memory script above, then run value tests
for (int index = 0; index < SkScriptNAnswer_testCount; index++) {
- SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType);
+ SkAnimatorScript2 engine(*animator.fMaker, nullptr, scriptTests[index].fType);
SkScriptValue2 value;
const char* script = scriptTests[index].fScript;
bool success = engine.evaluateScript(&script, &value);
diff --git a/src/animator/SkBoundable.cpp b/src/animator/SkBoundable.cpp
index abc4f40d6e..e784e9f6d0 100644
--- a/src/animator/SkBoundable.cpp
+++ b/src/animator/SkBoundable.cpp
@@ -50,6 +50,6 @@ SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
SkBoundableAuto::~SkBoundableAuto() {
if (fBoundable->hasBounds() == false)
return;
-// fMaker.fCanvas->setBounder(NULL);
+// fMaker.fCanvas->setBounder(nullptr);
fBoundable->setBounds(fMaker.fDisplayList.fBounds);
}
diff --git a/src/animator/SkBuildCondensedInfo.cpp b/src/animator/SkBuildCondensedInfo.cpp
index 411be904fe..1ee1917d3c 100644
--- a/src/animator/SkBuildCondensedInfo.cpp
+++ b/src/animator/SkBuildCondensedInfo.cpp
@@ -27,7 +27,7 @@ SkTDMemberInfoArray gUnknowns;
SkTDIntArray gUnknownsCounts;
static void AddInfo(SkDisplayTypes type, const SkMemberInfo* info, int infoCount) {
- SkASSERT(gInfos[type] == NULL);
+ SkASSERT(gInfos[type] == nullptr);
gInfos[type] = info;
gInfosCounts[type] = infoCount;
*gInfosTypeIDs.append() = type;
@@ -111,7 +111,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
int index, infoCount;
for (index = 0; index < kTypeNamesSize; index++) {
const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount);
- if (info == NULL)
+ if (info == nullptr)
continue;
AddInfo(gTypeNames[index].fType, info, infoCount);
}
@@ -131,7 +131,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
int typeIndex = 0;
for (; typeIndex < kNumberOfTypes; typeIndex++) {
const SkMemberInfo* temp = SkDisplayType::GetMembers(
- maker, (SkDisplayTypes) typeIndex, NULL);
+ maker, (SkDisplayTypes) typeIndex, nullptr);
if (temp == info)
break;
}
@@ -160,7 +160,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
int unknown = 1;
for (index = 0; index < gInfos.count(); index++) {
const SkMemberInfo* info = gInfos[index];
- if (info == NULL)
+ if (info == nullptr)
continue;
char scratch[64];
bool drawPrefix, displayPrefix;
@@ -183,7 +183,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
unknown = 1;
for (index = 0; index < gInfos.count(); index++) {
const SkMemberInfo* info = gInfos[index];
- if (info == NULL)
+ if (info == nullptr)
continue;
char scratch[64];
bool drawPrefix, displayPrefix;
@@ -229,7 +229,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
unknown = 1;
for (index = 0; index < gInfosCounts.count(); index++) {
const SkMemberInfo* info = gInfos[index];
- if (info == NULL)
+ if (info == nullptr)
continue;
typeIDCount++;
char scratch[64];
@@ -251,7 +251,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
written = 0;
for (index = 0; index < gInfosCounts.count(); index++) {
const SkMemberInfo* info = gInfos[index];
- if (info == NULL)
+ if (info == nullptr)
continue;
if (written > 0)
putc(',', condensed);
diff --git a/src/animator/SkDisplayAdd.cpp b/src/animator/SkDisplayAdd.cpp
index ffc9ba4cfb..f5788a3869 100644
--- a/src/animator/SkDisplayAdd.cpp
+++ b/src/animator/SkDisplayAdd.cpp
@@ -34,14 +34,14 @@ const SkMemberInfo SkAdd::fInfo[] = {
DEFINE_GET_MEMBER(SkAdd);
SkAdd::SkAdd() : mode(kMode_indirect),
- offset(SK_MaxS32), use(NULL), where(NULL) {
+ offset(SK_MaxS32), use(nullptr), where(nullptr) {
}
SkDisplayable* SkAdd::deepCopy(SkAnimateMaker* maker) {
SkADrawable* saveUse = use;
SkADrawable* saveWhere = where;
- use = NULL;
- where = NULL;
+ use = nullptr;
+ where = nullptr;
SkAdd* copy = (SkAdd*) INHERITED::deepCopy(maker);
copy->use = use = saveUse;
copy->where = where = saveWhere;
@@ -80,20 +80,20 @@ bool SkAdd::enable(SkAnimateMaker& maker ) {
SkDisplayList& displayList = maker.fDisplayList;
SkTDDrawableArray* parentList = displayList.getDrawList();
if (type == SkType_Add) {
- if (use == NULL) // not set in apply yet
+ if (use == nullptr) // not set in apply yet
return true;
}
bool skipAddToParent = true;
SkASSERT(type != SkType_Replace || where);
SkTDDrawableArray* grandList SK_INIT_TO_AVOID_WARNING;
- SkGroup* parentGroup = NULL;
- SkGroup* thisGroup = NULL;
+ SkGroup* parentGroup = nullptr;
+ SkGroup* thisGroup = nullptr;
int index = where ? displayList.findGroup(where, &parentList, &parentGroup,
&thisGroup, &grandList) : 0;
if (index < 0)
return true;
int max = parentList->count();
- if (where == NULL && type == SkType_Move)
+ if (where == nullptr && type == SkType_Move)
index = max;
if (offset != SK_MaxS32) {
index += offset;
@@ -102,15 +102,15 @@ bool SkAdd::enable(SkAnimateMaker& maker ) {
return true; // caller should not add
}
}
- if (offset < 0 && where == NULL)
+ if (offset < 0 && where == nullptr)
index += max + 1;
switch (type) {
case SkType_Add:
- if (offset == SK_MaxS32 && where == NULL) {
+ if (offset == SK_MaxS32 && where == nullptr) {
if (use->isDrawable()) {
skipAddToParent = mode == kMode_immediate;
if (skipAddToParent) {
- if (where == NULL) {
+ if (where == nullptr) {
SkTDDrawableArray* useParentList;
index = displayList.findGroup(this, &useParentList, &parentGroup,
&thisGroup, &grandList);
@@ -194,7 +194,7 @@ void SkAdd::initialize() {
bool SkAdd::isDrawable() const {
return getType() == SkType_Add && mode == kMode_indirect && offset == SK_MaxS32 &&
- where == NULL && use != NULL && use->isDrawable();
+ where == nullptr && use != nullptr && use->isDrawable();
}
//SkDisplayable* SkAdd::resolveTarget(SkAnimateMaker& maker) {
diff --git a/src/animator/SkDisplayAdd.h b/src/animator/SkDisplayAdd.h
index c106d867b1..eb4610b39f 100644
--- a/src/animator/SkDisplayAdd.h
+++ b/src/animator/SkDisplayAdd.h
@@ -36,7 +36,7 @@ protected:
Mode mode;
int32_t offset;
SkADrawable* use;
- SkADrawable* where; // if NULL, offset becomes index
+ SkADrawable* where; // if nullptr, offset becomes index
// } A;
private:
typedef SkADrawable INHERITED;
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index 88f73eccab..0d5f09d342 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -56,7 +56,7 @@ const SkMemberInfo SkApply::fInfo[] = {
DEFINE_GET_MEMBER(SkApply);
SkApply::SkApply() : begin(0), dontDraw(false), interval((SkMSec) -1), mode((Mode) -1), /*pickup(false), */
- restore(false), scope(NULL), steps(-1), transition((Transition) -1), fActive(NULL), /*fCurrentScope(NULL),*/
+ restore(false), scope(nullptr), steps(-1), transition((Transition) -1), fActive(nullptr), /*fCurrentScope(nullptr),*/
fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false),
fEnabled(false), fEnabling(false) {
}
@@ -71,7 +71,7 @@ SkApply::~SkApply() {
}
void SkApply::activate(SkAnimateMaker& maker) {
- if (fActive != NULL) {
+ if (fActive != nullptr) {
if (fActive->fDrawIndex == 0 && fActive->fDrawMax == 0)
return; // if only one use, nothing more to do
if (restore == false)
@@ -92,7 +92,7 @@ void SkApply::activate(SkAnimateMaker& maker) {
}
void SkApply::append(SkApply* apply) {
- if (fActive == NULL)
+ if (fActive == nullptr)
return;
int oldCount = fActive->fAnimators.count();
fActive->append(apply);
@@ -110,7 +110,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
SkAnimateBase* animator = fActive->fAnimators[animatorIndex];
const SkMemberInfo * info = animator->fFieldInfo;
SkASSERT(animator);
- SkASSERT(info != NULL);
+ SkASSERT(info != nullptr);
SkDisplayTypes type = (SkDisplayTypes) info->fType;
SkDisplayable* target = getTarget(animator);
if (animator->hasExecute() || type == SkType_MemberFunction || type == SkType_MemberProperty) {
@@ -123,7 +123,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
temp.fOperand = values[index];
*typedValues.append() = temp;
}
- executor->executeFunction(target, info->functionIndex(), typedValues, info->getType(), NULL);
+ executor->executeFunction(target, info->functionIndex(), typedValues, info->getType(), nullptr);
} else {
SkScriptValue scriptValue;
scriptValue.fOperand = values[0];
@@ -162,7 +162,7 @@ bool SkApply::contains(SkDisplayable* child) {
SkDisplayable* SkApply::deepCopy(SkAnimateMaker* maker) {
SkADrawable* saveScope = scope;
- scope = NULL;
+ scope = nullptr;
SkApply* result = (SkApply*) INHERITED::deepCopy(maker);
result->scope = scope = saveScope;
SkAnimateBase** end = fAnimators.end();
@@ -184,7 +184,7 @@ void SkApply::disable() {
}
bool SkApply::draw(SkAnimateMaker& maker) {
- if (scope ==NULL)
+ if (scope ==nullptr)
return false;
if (scope->isApply() || scope->isDrawable() == false)
return false;
@@ -262,7 +262,7 @@ void SkApply::dump(SkAnimateMaker* maker) {
bool SkApply::enable(SkAnimateMaker& maker) {
fEnabled = true;
- bool initialized = fActive != NULL;
+ bool initialized = fActive != nullptr;
if (dynamicScope.size() > 0)
enableDynamic(maker);
if (maker.fError.hasError())
@@ -284,14 +284,14 @@ bool SkApply::enable(SkAnimateMaker& maker) {
}
return true;
}*/
- if ((mode == kMode_immediate || mode == kMode_create) && scope == NULL)
+ if ((mode == kMode_immediate || mode == kMode_create) && scope == nullptr)
return false; // !!! error?
bool enableMe = scope && (scope->hasEnable() || scope->isApply() || scope->isDrawable() == false);
if ((mode == kMode_immediate && enableMe) || mode == kMode_create)
activate(maker); // for non-drawables like post, prime them here
if (mode == kMode_immediate && enableMe)
fActive->enable();
- if (mode == kMode_create && scope != NULL) {
+ if (mode == kMode_create && scope != nullptr) {
enableCreate(maker);
return true;
}
@@ -311,7 +311,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
debugOut.appendS32(maker.fEnableTime - maker.fDebugTimeBase);
SkDebugf("%s\n", debugOut.c_str());
#endif
- if (scope == NULL || scope->isApply() || scope->getType() == SkType_Movie || scope->isDrawable() == false) {
+ if (scope == nullptr || scope->isApply() || scope->getType() == SkType_Movie || scope->isDrawable() == false) {
activate(maker); // for non-drawables like post, prime them here
if (initialized) {
append(this);
@@ -319,7 +319,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
fEnabling = true;
interpolate(maker, maker.fEnableTime);
fEnabling = false;
- if (scope != NULL && dontDraw == false)
+ if (scope != nullptr && dontDraw == false)
scope->enable(maker);
return true;
} else if (initialized && restore == false)
@@ -365,10 +365,10 @@ append:
SkASSERT(old < parentList->count());
if ((*parentList)[old]->isApply()) {
SkApply* apply = (SkApply*) (*parentList)[old];
- if (apply != this && apply->fActive == NULL)
+ if (apply != this && apply->fActive == nullptr)
apply->activate(maker);
apply->append(this);
- parentGroup = NULL;
+ parentGroup = nullptr;
} else {
if (parentGroup)
parentGroup->markCopySize(old);
@@ -377,7 +377,7 @@ append:
int oldApply = displayList.findGroup(this, &parentList, &pGroup, &thisGroup, &grandList);
if (oldApply >= 0) {
(*parentList)[oldApply] = (SkADrawable*) SkDisplayType::CreateInstance(&maker, SkType_Apply);
- parentGroup = NULL;
+ parentGroup = nullptr;
fDeleteScope = true;
}
*newApplyLocation = this;
@@ -397,7 +397,7 @@ void SkApply::enableCreate(SkAnimateMaker& maker) {
bool success = maker.computeID(scope, this, &newID);
if (success == false)
return;
- if (maker.find(newID.c_str(), NULL))
+ if (maker.find(newID.c_str(), nullptr))
continue;
SkApply* copy = (SkApply*) deepCopy(&maker); // work on copy of animator state
if (mode == kMode_create)
@@ -429,11 +429,11 @@ void SkApply::enableDynamic(SkAnimateMaker& maker) {
&newScope);
if (success && scope != newScope) {
SkTDDrawableArray* pList, * gList;
- SkGroup* pGroup = NULL, * found = NULL;
+ SkGroup* pGroup = nullptr, * found = nullptr;
int old = maker.fDisplayList.findGroup(scope, &pList, &pGroup, &found, &gList);
if (pList && old >= 0 && (*pList)[old]->isApply() && (*pList)[old] != this) {
if (fAppended == false) {
- if (found != NULL) {
+ if (found != nullptr) {
SkDisplayable* oldChild = (*pList)[old];
if (oldChild->isApply() && found->copySet(old)) {
found->markCopyClear(old);
@@ -449,7 +449,7 @@ void SkApply::enableDynamic(SkAnimateMaker& maker) {
}
maker.removeActive(fActive);
delete fActive;
- fActive = NULL;
+ fActive = nullptr;
}
void SkApply::endSave(int index) {
@@ -528,11 +528,11 @@ bool SkApply::hasEnable() const {
}
bool SkApply::inactivate(SkAnimateMaker& maker) {
- if (fActive == NULL)
+ if (fActive == nullptr)
return false;
maker.removeActive(fActive);
delete fActive;
- fActive = NULL;
+ fActive = nullptr;
return true;
}
@@ -541,14 +541,14 @@ SkMSec lastTime = (SkMSec) -1;
#endif
bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
- if (fActive == NULL)
+ if (fActive == nullptr)
return false;
bool result = false;
#if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING
SkMSec time = maker.getAppTime();
if (lastTime == (SkMSec) -1)
lastTime = rawTime - 1;
- if (fActive != NULL &&
+ if (fActive != nullptr &&
strcmp(id, "a3") == 0 && rawTime > lastTime) {
lastTime += 1000;
SkString debugOut;
@@ -629,7 +629,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
fLastTime = animate->dur;
SkTypedArray formulaValues;
formulaValues.setCount(count);
- SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, nullptr,
animate->getValuesType(), animate->formula);
SkASSERT(success);
if (restore)
@@ -645,7 +645,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
}
void SkApply::initialize() {
- if (scope == NULL)
+ if (scope == nullptr)
return;
if (scope->isApply() || scope->isDrawable() == false)
return;
@@ -665,12 +665,12 @@ void SkApply::onEndElement(SkAnimateMaker& maker)
}
if (mode == kMode_create)
return;
- if (scope != NULL && steps >= 0 && scope->isApply() == false && scope->isDrawable())
+ if (scope != nullptr && steps >= 0 && scope->isApply() == false && scope->isDrawable())
scope->setSteps(steps);
for (SkAnimateBase** animPtr = fAnimators.begin(); animPtr < fAnimators.end(); animPtr++) {
SkAnimateBase* anim = *animPtr;
//for reusing apply statements with dynamic scope
- if (anim->fTarget == NULL || anim->fTargetIsScope) {
+ if (anim->fTarget == nullptr || anim->fTargetIsScope) {
anim->fTargetIsScope = true;
if (scope)
anim->fTarget = scope;
@@ -678,7 +678,7 @@ void SkApply::onEndElement(SkAnimateMaker& maker)
anim->setTarget(maker);
anim->onEndElement(maker); // allows animate->fFieldInfo to be set
}
- if (scope != NULL && steps >= 0 && anim->fTarget != scope && anim->fTarget->isDrawable())
+ if (scope != nullptr && steps >= 0 && anim->fTarget != scope && anim->fTarget->isDrawable())
anim->fTarget->setSteps(steps);
}
}
@@ -748,7 +748,7 @@ void SkApply::save(int index) {
// !!! this all may be unneeded, at least in the dynamic case ??
int activeIndex = fActive->fDrawIndex + index;
SkTDOperandArray last;
- if (fActive->fSaveRestore[activeIndex] == NULL) {
+ if (fActive->fSaveRestore[activeIndex] == nullptr) {
fActive->fSaveRestore[activeIndex] = new SkOperand[count];
useLast = false;
} else {
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index b5dc8145ae..746780df1c 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -45,7 +45,7 @@ const SkMemberInfo SkDisplayEvent::fInfo[] = {
DEFINE_GET_MEMBER(SkDisplayEvent);
SkDisplayEvent::SkDisplayEvent() : code((SkKey) -1), disable(false),
- kind(kUser), x(0), y(0), fLastCode((SkKey) -1), fMax((SkKey) -1), fTarget(NULL) {
+ kind(kUser), x(0), y(0), fLastCode((SkKey) -1), fMax((SkKey) -1), fTarget(nullptr) {
}
SkDisplayEvent::~SkDisplayEvent() {
@@ -71,7 +71,7 @@ SkDisplayable* SkDisplayEvent::contains(const SkString& match) {
if (child->contains(match))
return child;
}
- return NULL;
+ return nullptr;
}
void SkDisplayEvent::deleteMembers() {
@@ -100,7 +100,7 @@ void SkDisplayEvent::dumpEvent(SkAnimateMaker* maker) {
else
SkDebugf("key=\"%c\" ", code);
}
- if (fTarget != NULL) {
+ if (fTarget != nullptr) {
SkDebugf("target=\"%s\" ", fTarget->id);
}
if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kMouseUp) {
@@ -188,7 +188,7 @@ void SkDisplayEvent::populateInput(SkAnimateMaker& maker, const SkEvent& fEvent)
SkMetaData::Type type;
int number;
const char* name;
- while ((name = iter.next(&type, &number)) != NULL) {
+ while ((name = iter.next(&type, &number)) != nullptr) {
if (name[0] == '\0')
continue;
SkDisplayable* displayable;
diff --git a/src/animator/SkDisplayEvents.cpp b/src/animator/SkDisplayEvents.cpp
index 3c3791de75..d367cf11c3 100644
--- a/src/animator/SkDisplayEvents.cpp
+++ b/src/animator/SkDisplayEvents.cpp
@@ -47,7 +47,7 @@ bool SkEvents::doEvent(SkAnimateMaker& maker, SkDisplayEvent::Kind kind, SkEvent
if (kind != SkDisplayEvent::kOnload)
movie->doEvent(kind, state);
}
- SkDisplayable* displayable = state ? state->fDisplayable : NULL;
+ SkDisplayable* displayable = state ? state->fDisplayable : nullptr;
int keyCode = state ? state->fCode : 0;
int count = fEvents.count();
for (int index = 0; index < count; index++) {
@@ -61,9 +61,9 @@ bool SkEvents::doEvent(SkAnimateMaker& maker, SkDisplayEvent::Kind kind, SkEvent
continue;
evt->fLastCode = (SkKey) keyCode;
}
- if (evt->fTarget != NULL && evt->fTarget != displayable)
+ if (evt->fTarget != nullptr && evt->fTarget != displayable)
continue;
- if (state == NULL || state->fDisable == 0) {
+ if (state == nullptr || state->fDisable == 0) {
if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kMouseUp) {
evt->x = state->fX;
evt->y = state->fY;
@@ -96,7 +96,7 @@ void SkEvents::dump(SkAnimateMaker& maker) {
// currently this only removes onLoad events
void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) {
int keyCode = state ? state->fCode : 0;
- SkDisplayable* displayable = state ? state->fDisplayable : NULL;
+ SkDisplayable* displayable = state ? state->fDisplayable : nullptr;
for (SkDisplayEvent** evtPtr = fEvents.begin(); evtPtr < fEvents.end(); evtPtr++) {
SkDisplayEvent* evt = *evtPtr;
if (evt->kind != kind)
@@ -105,7 +105,7 @@ void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) {
if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? evt->fMax : evt->code) < keyCode)
continue;
}
- if (evt->fTarget != NULL && evt->fTarget != displayable)
+ if (evt->fTarget != nullptr && evt->fTarget != displayable)
continue;
int index = fEvents.find(evt);
fEvents.remove(index);
diff --git a/src/animator/SkDisplayInput.cpp b/src/animator/SkDisplayInput.cpp
index 7061aa8ea9..facc703976 100644
--- a/src/animator/SkDisplayInput.cpp
+++ b/src/animator/SkDisplayInput.cpp
@@ -30,7 +30,7 @@ DEFINE_GET_MEMBER(SkInput);
SkInput::SkInput() : fInt((int) SK_NaN32), fFloat(SK_ScalarNaN) {}
SkDisplayable* SkInput::contains(const SkString& string) {
- return string.equals(name) ? this : NULL;
+ return string.equals(name) ? this : nullptr;
}
bool SkInput::enable(SkAnimateMaker & ) {
diff --git a/src/animator/SkDisplayList.cpp b/src/animator/SkDisplayList.cpp
index f5f2c7fbae..fbba83f4f0 100644
--- a/src/animator/SkDisplayList.cpp
+++ b/src/animator/SkDisplayList.cpp
@@ -52,7 +52,7 @@ bool SkDisplayList::draw(SkAnimateMaker& maker, SkMSec inTime) {
int SkDisplayList::findGroup(SkADrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
- *parent = NULL;
+ *parent = nullptr;
*list = &fDrawList;
*grandList = &fDrawList;
return SearchForMatch(match, list, parent, found, grandList);
@@ -70,7 +70,7 @@ bool SkDisplayList::onIRect(const SkIRect& r) {
int SkDisplayList::SearchForMatch(SkADrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
- *found = NULL;
+ *found = nullptr;
for (int index = 0; index < (*list)->count(); index++) {
SkADrawable* draw = (**list)[index];
if (draw == match)
diff --git a/src/animator/SkDisplayMath.cpp b/src/animator/SkDisplayMath.cpp
index 7f406c1f65..f52cf19371 100644
--- a/src/animator/SkDisplayMath.cpp
+++ b/src/animator/SkDisplayMath.cpp
@@ -131,7 +131,7 @@ DEFINE_GET_MEMBER(SkDisplayMath);
void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
- if (scriptValue == NULL)
+ if (scriptValue == nullptr)
return;
SkASSERT(target == this);
SkScriptValue* array = parameters.begin();
diff --git a/src/animator/SkDisplayMovie.cpp b/src/animator/SkDisplayMovie.cpp
index ea832dcb4c..797d853be6 100644
--- a/src/animator/SkDisplayMovie.cpp
+++ b/src/animator/SkDisplayMovie.cpp
@@ -34,7 +34,7 @@ void SkDisplayMovie::buildMovie() {
return;
SkAnimateMaker* movieMaker = fMovie.fMaker;
SkAnimateMaker* parentMaker = movieMaker->fParentMaker;
- if (src.size() == 0 || parentMaker == NULL)
+ if (src.size() == 0 || parentMaker == nullptr)
return;
movieMaker->fPrefix.set(parentMaker->fPrefix);
fDecodedSuccessfully = fMovie.fMaker->decodeURI(src.c_str());
@@ -105,8 +105,8 @@ bool SkDisplayMovie::enable(SkAnimateMaker&) {
if (fDecodedSuccessfully == false)
return false;
SkAnimateMaker* movieMaker = fMovie.fMaker;
- movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL);
- movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
+ movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, nullptr);
+ movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr);
fLoaded = true;
movieMaker->fLoaded = true;
return false;
diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp
index 0fd4a06753..a30fd4442f 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -38,8 +38,8 @@ const SkMemberInfo SkPost::fInfo[] = {
DEFINE_GET_MEMBER(SkPost);
-SkPost::SkPost() : delay(0), /*initialized(SkBool(-1)), */ mode(kImmediate), fMaker(NULL),
- fSinkID(0), fTargetMaker(NULL), fChildHasID(false), fDirty(false) {
+SkPost::SkPost() : delay(0), /*initialized(SkBool(-1)), */ mode(kImmediate), fMaker(nullptr),
+ fSinkID(0), fTargetMaker(nullptr), fChildHasID(false), fDirty(false) {
}
SkPost::~SkPost() {
@@ -104,7 +104,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
//SkDataInput** ptr = fParts.end();
//SkDataInput* data;
//const char* ID;
- while ((name = iter.next(&type, &number)) != NULL) {
+ while ((name = iter.next(&type, &number)) != nullptr) {
//ptr--;
if (strcmp(name, "id") == 0)
continue;
@@ -210,7 +210,7 @@ bool SkPost::enable(SkAnimateMaker& maker ) {
bool isAnimatorEvent = true;
SkAnimator* anim = maker.getAnimator();
if (targetID == 0) {
- isAnimatorEvent = fEvent.findString("id") != NULL;
+ isAnimatorEvent = fEvent.findString("id") != nullptr;
if (isAnimatorEvent)
targetID = anim->getSinkID();
else if (maker.fHostEventSinkID)
@@ -236,7 +236,7 @@ void SkPost::findSinkID() {
do {
const char* end = strchr(ch, '.');
size_t len = end ? (size_t) (end - ch) : strlen(ch);
- SkDisplayable* displayable = NULL;
+ SkDisplayable* displayable = nullptr;
if (SK_LITERAL_STR_EQUAL("parent", ch, len)) {
if (fTargetMaker->fParentMaker)
fTargetMaker = fTargetMaker->fParentMaker;
@@ -246,14 +246,14 @@ void SkPost::findSinkID() {
}
} else {
fTargetMaker->find(ch, len, &displayable);
- if (displayable == NULL || displayable->getType() != SkType_Movie) {
+ if (displayable == nullptr || displayable->getType() != SkType_Movie) {
fTargetMaker->setErrorCode(SkDisplayXMLParserError::kExpectedMovie);
return;
}
SkDisplayMovie* movie = (SkDisplayMovie*) displayable;
fTargetMaker = movie->fMovie.fMaker;
}
- if (end == NULL)
+ if (end == nullptr)
break;
ch = ++end;
} while (true);
diff --git a/src/animator/SkDisplayType.cpp b/src/animator/SkDisplayType.cpp
index 87ea560d80..7ee8dab5a4 100644
--- a/src/animator/SkDisplayType.cpp
+++ b/src/animator/SkDisplayType.cpp
@@ -62,7 +62,7 @@
case SkType_##_class: result = new SkDisplay##_class(); break
#ifdef SK_DEBUG
#define CASE_DEBUG_RETURN_NIL(_class) \
- case SkType_##_class: return NULL
+ case SkType_##_class: return nullptr
#else
#define CASE_DEBUG_RETURN_NIL(_class)
#endif
@@ -71,7 +71,7 @@
SkDisplayTypes SkDisplayType::gNewTypes = kNumberOfTypes;
SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTypes type) {
- SkDisplayable* result = NULL;
+ SkDisplayable* result = nullptr;
switch (type) {
// unknown
CASE_DISPLAY_NEW(Math);
@@ -200,7 +200,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp
default:
SkExtras** end = maker->fExtras.end();
for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
- if ((result = (*extraPtr)->createInstance(type)) != NULL)
+ if ((result = (*extraPtr)->createInstance(type)) != nullptr)
return result;
}
SkASSERT(0);
@@ -224,7 +224,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp
const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
SkDisplayTypes type, int* infoCountPtr) {
- const SkMemberInfo* info = NULL;
+ const SkMemberInfo* info = nullptr;
int infoCount = 0;
switch (type) {
// unknown
@@ -356,11 +356,11 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
if (maker) {
SkExtras** end = maker->fExtras.end();
for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
- if ((info = (*extraPtr)->getMembers(type, infoCountPtr)) != NULL)
+ if ((info = (*extraPtr)->getMembers(type, infoCountPtr)) != nullptr)
return info;
}
}
- return NULL;
+ return nullptr;
}
if (infoCountPtr)
*infoCountPtr = infoCount;
@@ -525,7 +525,7 @@ const int kTypeNamesSize = SK_ARRAY_COUNT(gTypeNames);
SkDisplayTypes SkDisplayType::Find(SkAnimateMaker* maker, const SkMemberInfo* match) {
for (int index = 0; index < kTypeNamesSize; index++) {
SkDisplayTypes type = gTypeNames[index].fType;
- const SkMemberInfo* info = SkDisplayType::GetMembers(maker, type, NULL);
+ const SkMemberInfo* info = SkDisplayType::GetMembers(maker, type, nullptr);
if (info == match)
return type;
}
@@ -538,7 +538,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
return SkType_Displayable;
if (base == SkType_Set)
return SkType_Animate; // another cheat until we have a lookup table
- const SkMemberInfo* info = GetMembers(maker, base, NULL); // get info for this type
+ const SkMemberInfo* info = GetMembers(maker, base, nullptr); // get info for this type
SkASSERT(info);
if (info->fType != SkType_BaseClassInfo)
return SkType_Unknown; // if no base, done
@@ -547,7 +547,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
const SkMemberInfo* inherited = info->getInherited();
SkDisplayTypes result = (SkDisplayTypes) (SkType_Unknown + 1);
for (; result <= SkType_Xfermode; result = (SkDisplayTypes) (result + 1)) {
- const SkMemberInfo* match = GetMembers(maker, result, NULL);
+ const SkMemberInfo* match = GetMembers(maker, result, nullptr);
if (match == inherited)
break;
}
@@ -710,10 +710,10 @@ const char* SkDisplayType::GetName(SkAnimateMaker* maker, SkDisplayTypes type) {
SkExtras** end = maker->fExtras.end();
for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
const char* result = (*extraPtr)->getName(type);
- if (result != NULL)
+ if (result != nullptr)
return result;
}
- return NULL;
+ return nullptr;
}
#endif
@@ -728,7 +728,7 @@ void SkDisplayType::UnitTest() {
}
for (index = 0; index < kTypeNamesSize; index++) {
SkDisplayable* test = CreateInstance(maker, gTypeNames[index].fType);
- if (test == NULL)
+ if (test == nullptr)
continue;
#if defined _WIN32 && _MSC_VER >= 1300 && defined _INC_CRTDBG // only on windows, only if using "crtdbg.h"
// we know that crtdbg puts 0xfdfdfdfd at the end of the block
@@ -744,7 +744,7 @@ void SkDisplayType::UnitTest() {
for (index = 0; index < kTypeNamesSize; index++) {
int infoCount;
const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount);
- if (info == NULL)
+ if (info == nullptr)
continue;
#if SK_USE_CONDENSED_INFO == 0
for (int inner = 0; inner < infoCount - 1; inner++) {
diff --git a/src/animator/SkDisplayTypes.cpp b/src/animator/SkDisplayTypes.cpp
index 287ca6e4d4..d3d8c68146 100644
--- a/src/animator/SkDisplayTypes.cpp
+++ b/src/animator/SkDisplayTypes.cpp
@@ -121,7 +121,7 @@ SkDisplayString::SkDisplayString(SkString& copyFrom) : value(copyFrom) {
void SkDisplayString::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
- if (scriptValue == NULL)
+ if (scriptValue == nullptr)
return;
SkASSERT(target == this);
switch (index) {
diff --git a/src/animator/SkDisplayXMLParser.cpp b/src/animator/SkDisplayXMLParser.cpp
index 3ebf9dc4fe..1c8b67b6af 100644
--- a/src/animator/SkDisplayXMLParser.cpp
+++ b/src/animator/SkDisplayXMLParser.cpp
@@ -71,7 +71,7 @@ void SkDisplayXMLParserError::setInnerError(SkAnimateMaker* parent, const SkStri
SkDisplayXMLParser::SkDisplayXMLParser(SkAnimateMaker& maker)
: INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude),
- fInSkia(maker.fInInclude), fCurrDisplayable(NULL)
+ fInSkia(maker.fInInclude), fCurrDisplayable(nullptr)
{
}
@@ -97,13 +97,13 @@ bool SkDisplayXMLParser::onAddAttribute(const char name[], const char value[]) {
bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
size_t attrValueLen)
{
- if (fCurrDisplayable == NULL) // this signals we should ignore attributes for this element
+ if (fCurrDisplayable == nullptr) // this signals we should ignore attributes for this element
return strncmp(attrName, "xmlns", sizeof("xmlns") - 1) != 0;
SkDisplayable* displayable = fCurrDisplayable;
SkDisplayTypes type = fCurrType;
if (strcmp(attrName, "id") == 0) {
- if (fMaker.find(attrValue, attrValueLen, NULL)) {
+ if (fMaker.find(attrValue, attrValueLen, nullptr)) {
fError->setNoun(attrValue, attrValueLen);
fError->setCode(SkXMLParserError::kDuplicateIDs);
return true;
@@ -122,22 +122,22 @@ bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char att
}
const char* name = attrName;
const SkMemberInfo* info = SkDisplayType::GetMember(&fMaker, type, &name);
- if (info == NULL) {
+ if (info == nullptr) {
fError->setNoun(name);
fError->setCode(SkXMLParserError::kUnknownAttributeName);
return true;
}
- if (info->setValue(fMaker, NULL, 0, info->getCount(), displayable, info->getType(), attrValue,
+ if (info->setValue(fMaker, nullptr, 0, info->getCount(), displayable, info->getType(), attrValue,
attrValueLen))
return false;
if (fMaker.fError.hasError()) {
fError->setNoun(attrValue, attrValueLen);
return true;
}
- SkDisplayable* ref = NULL;
+ SkDisplayable* ref = nullptr;
if (fMaker.find(attrValue, attrValueLen, &ref) == false) {
ref = fMaker.createInstance(attrValue, attrValueLen);
- if (ref == NULL) {
+ if (ref == nullptr) {
fError->setNoun(attrValue, attrValueLen);
fError->setCode(SkXMLParserError::kErrorInAttributeValue);
return true;
@@ -184,7 +184,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
const SkMemberInfo* info =
SkDisplayType::GetMembers(&fMaker, fParents[parentIndex - 1].fType, &infoCount);
const SkMemberInfo* foundInfo;
- if ((foundInfo = searchContainer(info, infoCount)) != NULL) {
+ if ((foundInfo = searchContainer(info, infoCount)) != nullptr) {
parent->setReference(foundInfo, displayable);
// if (displayable->isHelper() == false)
fMaker.helperAdd(displayable);
@@ -198,7 +198,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
}
fParents.remove(parentIndex);
}
- fCurrDisplayable = NULL;
+ fCurrDisplayable = nullptr;
if (fInInclude == false && SK_strcasecmp(elem, "screenplay") == 0) {
if (fMaker.fInMovie == false) {
fMaker.fEnableTime = fMaker.getAppTime();
@@ -212,10 +212,10 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
debugOut.appendS32(fMaker.fEnableTime - fMaker.fDebugTimeBase);
SkDebugf("%s\n", debugOut.c_str());
#endif
- fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, NULL);
+ fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, nullptr);
if (fMaker.fError.hasError())
return true;
- fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
+ fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, nullptr);
}
fInSkia = false;
@@ -229,7 +229,7 @@ bool SkDisplayXMLParser::onStartElement(const char name[])
}
bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) {
- fCurrDisplayable = NULL; // init so we'll ignore attributes if we exit early
+ fCurrDisplayable = nullptr; // init so we'll ignore attributes if we exit early
if (SK_strncasecmp(name, "screenplay", len) == 0) {
fInSkia = true;
@@ -241,7 +241,7 @@ bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) {
return false;
SkDisplayable* displayable = fMaker.createInstance(name, len);
- if (displayable == NULL) {
+ if (displayable == nullptr) {
fError->setNoun(name, len);
fError->setCode(SkXMLParserError::kUnknownElement);
return true;
@@ -268,14 +268,14 @@ bool SkDisplayXMLParser::onStartElementLen(const char name[], size_t len) {
const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* infoBase,
int infoCount) {
- const SkMemberInfo* bestDisplayable = NULL;
- const SkMemberInfo* lastResort = NULL;
+ const SkMemberInfo* bestDisplayable = nullptr;
+ const SkMemberInfo* lastResort = nullptr;
for (int index = 0; index < infoCount; index++) {
const SkMemberInfo* info = &infoBase[index];
if (info->fType == SkType_BaseClassInfo) {
const SkMemberInfo* inherited = info->getInherited();
const SkMemberInfo* result = searchContainer(inherited, info->fCount);
- if (result != NULL)
+ if (result != nullptr)
return result;
continue;
}
@@ -312,5 +312,5 @@ rectNext:
return bestDisplayable;
if (lastResort)
return lastResort;
- return NULL;
+ return nullptr;
}
diff --git a/src/animator/SkDisplayable.cpp b/src/animator/SkDisplayable.cpp
index 52532fedcd..dc3cecfdba 100644
--- a/src/animator/SkDisplayable.cpp
+++ b/src/animator/SkDisplayable.cpp
@@ -64,14 +64,14 @@ bool SkDisplayable::contains(SkDisplayable* ) {
}
SkDisplayable* SkDisplayable::contains(const SkString& ) {
- return NULL;
+ return nullptr;
}
SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) {
SkDisplayTypes type = getType();
if (type == SkType_Unknown) {
SkASSERT(0);
- return NULL;
+ return nullptr;
}
SkDisplayable* copy = SkDisplayType::CreateInstance(maker, type);
int index = -1;
@@ -79,7 +79,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) {
const SkMemberInfo* info;
do {
info = copy->getMember(++index);
- if (info == NULL)
+ if (info == nullptr)
break;
if (info->fType == SkType_MemberProperty) {
SkScriptValue value;
@@ -93,7 +93,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) {
if (info->fType == SkType_Array) {
SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this);
int arrayCount;
- if (array == NULL || (arrayCount = array->count()) == 0)
+ if (array == nullptr || (arrayCount = array->count()) == 0)
continue;
SkTDOperandArray* copyArray = (SkTDOperandArray*) info->memberData(copy);
copyArray->setCount(arrayCount);
@@ -110,7 +110,7 @@ SkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) {
}
if (SkDisplayType::IsDisplayable(maker, info->fType)) {
SkDisplayable** displayable = (SkDisplayable**) info->memberData(this);
- if (*displayable == NULL || *displayable == (SkDisplayable*) -1)
+ if (*displayable == nullptr || *displayable == (SkDisplayable*) -1)
continue;
SkDisplayable* deeper = (*displayable)->deepCopy(maker);
info->setMemberData(copy, deeper, sizeof(deeper));
@@ -160,7 +160,7 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
SkOperand blankValues[2];
do {
info = this->getMember(++index);
- if (NULL == info) {
+ if (nullptr == info) {
//SkDebugf("\n");
break;
}
@@ -185,7 +185,7 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
if (info->fType == SkType_Array) {
SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this);
int arrayCount;
- if (array == NULL || (arrayCount = array->count()) == 0)
+ if (array == nullptr || (arrayCount = array->count()) == 0)
continue;
SkDisplayTypes elementType;
if (type == SkType_Array) {
@@ -259,12 +259,12 @@ void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) {
SkDisplayList::fIndent += 4;
do {
info = this->getMember(++index);
- if (NULL == info) {
+ if (nullptr == info) {
break;
}
if (SkDisplayType::IsDisplayable(maker, info->fType)) {
SkDisplayable** displayable = (SkDisplayable**) info->memberData(this);
- if (*displayable == NULL || *displayable == (SkDisplayable*) -1)
+ if (*displayable == nullptr || *displayable == (SkDisplayable*) -1)
continue;
if (closedAngle == false) {
SkDebugf(">\n");
@@ -422,21 +422,21 @@ void SkDisplayable::getBounds(SkRect* rect) {
}
const SkFunctionParamType* SkDisplayable::getFunctionsParameters() {
- return NULL;
+ return nullptr;
}
const SkMemberInfo* SkDisplayable::getMember(int index) {
- return NULL;
+ return nullptr;
}
const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
- return NULL;
+ return nullptr;
}
const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info,
int* paramCount) {
const SkFunctionParamType* params = getFunctionsParameters();
- SkASSERT(params != NULL);
+ SkASSERT(params != nullptr);
int funcIndex = info->functionIndex();
// !!! eventually break traversing params into an external function (maybe this whole function)
int index = funcIndex;
@@ -456,7 +456,7 @@ const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info
}
SkDisplayable* SkDisplayable::getParent() const {
- return NULL;
+ return nullptr;
}
bool SkDisplayable::getProperty(int index, SkScriptValue* ) const {
@@ -484,7 +484,7 @@ bool SkDisplayable::isDrawable() const {
void SkDisplayable::onEndElement(SkAnimateMaker& ) {}
const SkMemberInfo* SkDisplayable::preferredChild(SkDisplayTypes type) {
- return NULL;
+ return nullptr;
}
bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* apply) {
diff --git a/src/animator/SkDraw3D.cpp b/src/animator/SkDraw3D.cpp
index 9e1c2cc0a6..e7e92df3e3 100644
--- a/src/animator/SkDraw3D.cpp
+++ b/src/animator/SkDraw3D.cpp
@@ -44,7 +44,7 @@ const SkMemberInfo Sk3D_Camera::fInfo[] = {
DEFINE_GET_MEMBER(Sk3D_Camera);
-Sk3D_Camera::Sk3D_Camera() : hackWidth(0), hackHeight(0), patch(NULL) {
+Sk3D_Camera::Sk3D_Camera() : hackWidth(0), hackHeight(0), patch(nullptr) {
}
Sk3D_Camera::~Sk3D_Camera() {
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index f41c152a32..ce7464d702 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -130,8 +130,8 @@ const SkMemberInfo SkImageBaseBitmap::fInfo[] = {
DEFINE_GET_MEMBER(SkImageBaseBitmap);
-SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(NULL) {
- base64.fData = NULL;
+SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(nullptr) {
+ base64.fData = nullptr;
base64.fLength = 0;
}
diff --git a/src/animator/SkDrawBlur.cpp b/src/animator/SkDrawBlur.cpp
index 36d645286f..14f34acf9b 100644
--- a/src/animator/SkDrawBlur.cpp
+++ b/src/animator/SkDrawBlur.cpp
@@ -27,7 +27,7 @@ SkDrawBlur::SkDrawBlur()
SkMaskFilter* SkDrawBlur::getMaskFilter() {
if (fSigma <= 0) {
- return NULL;
+ return nullptr;
}
return SkBlurMaskFilter::Create((SkBlurStyle)fBlurStyle, fSigma);
}
diff --git a/src/animator/SkDrawClip.cpp b/src/animator/SkDrawClip.cpp
index e26a1bf410..bca816f637 100644
--- a/src/animator/SkDrawClip.cpp
+++ b/src/animator/SkDrawClip.cpp
@@ -25,14 +25,14 @@ const SkMemberInfo SkDrawClip::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawClip);
-SkDrawClip::SkDrawClip() : rect(NULL), path(NULL) {
+SkDrawClip::SkDrawClip() : rect(nullptr), path(nullptr) {
}
bool SkDrawClip::draw(SkAnimateMaker& maker ) {
- if (rect != NULL)
+ if (rect != nullptr)
maker.fCanvas->clipRect(rect->fRect);
else {
- SkASSERT(path != NULL);
+ SkASSERT(path != nullptr);
maker.fCanvas->clipPath(path->fPath);
}
return false;
diff --git a/src/animator/SkDrawColor.cpp b/src/animator/SkDrawColor.cpp
index d86a2e93e7..c2d0dae8fe 100644
--- a/src/animator/SkDrawColor.cpp
+++ b/src/animator/SkDrawColor.cpp
@@ -126,7 +126,7 @@ SkDrawColor::SkDrawColor() : fDirty(false) {
}
bool SkDrawColor::add() {
- if (fPaint->color != NULL)
+ if (fPaint->color != nullptr)
return true; // error (probably color in paint as attribute as well)
fPaint->color = this;
fPaint->fOwnsColor = true;
@@ -211,7 +211,7 @@ void SkDrawColor::onEndElement(SkAnimateMaker&) {
}
bool SkDrawColor::setParent(SkDisplayable* parent) {
- SkASSERT(parent != NULL);
+ SkASSERT(parent != nullptr);
if (parent->getType() == SkType_DrawLinearGradient || parent->getType() == SkType_DrawRadialGradient)
return false;
if (parent->isPaint() == false)
diff --git a/src/animator/SkDrawDash.cpp b/src/animator/SkDrawDash.cpp
index cfef30335b..d47db416fb 100644
--- a/src/animator/SkDrawDash.cpp
+++ b/src/animator/SkDrawDash.cpp
@@ -30,6 +30,6 @@ SkDash::~SkDash() {
SkPathEffect* SkDash::getPathEffect() {
int count = intervals.count();
if (count == 0)
- return NULL;
+ return nullptr;
return SkDashPathEffect::Create(intervals.begin(), count, phase);
}
diff --git a/src/animator/SkDrawDiscrete.cpp b/src/animator/SkDrawDiscrete.cpp
index 9376435950..14917839b2 100644
--- a/src/animator/SkDrawDiscrete.cpp
+++ b/src/animator/SkDrawDiscrete.cpp
@@ -28,7 +28,7 @@ SkDiscrete::SkDiscrete() : deviation(0), segLength(0) {
SkPathEffect* SkDiscrete::getPathEffect() {
if (deviation <= 0 || segLength <= 0)
- return NULL;
+ return nullptr;
else
return SkDiscretePathEffect::Create(segLength, deviation);
}
diff --git a/src/animator/SkDrawEmboss.cpp b/src/animator/SkDrawEmboss.cpp
index 70a2826d3e..a1cd4dcd16 100644
--- a/src/animator/SkDrawEmboss.cpp
+++ b/src/animator/SkDrawEmboss.cpp
@@ -28,7 +28,7 @@ SkDrawEmboss::SkDrawEmboss() : fSigma(-1) {
SkMaskFilter* SkDrawEmboss::getMaskFilter() {
if (fSigma < 0 || fDirection.count() !=3)
- return NULL;
+ return nullptr;
return SkBlurMaskFilter::CreateEmboss(fSigma, fDirection.begin(),
fAmbient, fSpecular);
}
diff --git a/src/animator/SkDrawExtraPathEffect.cpp b/src/animator/SkDrawExtraPathEffect.cpp
index 68b5006ed3..4fa76c65c9 100644
--- a/src/animator/SkDrawExtraPathEffect.cpp
+++ b/src/animator/SkDrawExtraPathEffect.cpp
@@ -90,12 +90,12 @@ public:
}
// For serialization. This will never be called.
- Factory getFactory() const override { sk_throw(); return NULL; }
+ Factory getFactory() const override { sk_throw(); return nullptr; }
protected:
SkScalar begin(SkScalar contourLength) const override {
SkScriptValue value;
- SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
+ SkAnimatorScript engine(*fMaker, nullptr, SkType_Float);
engine.propertyCallBack(GetContourLength, &contourLength);
value.fOperand.fScalar = 0;
engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float);
@@ -104,7 +104,7 @@ protected:
SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) const override {
fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance);
- SkDrawPath* drawPath = NULL;
+ SkDrawPath* drawPath = nullptr;
if (fDraw->addPath->isPath()) {
drawPath = (SkDrawPath*) fDraw->addPath;
} else {
@@ -132,7 +132,7 @@ protected:
}
}
SkScalar result = 0;
- SkAnimatorScript::EvaluateFloat(*fMaker, NULL, fDraw->spacing.c_str(), &result);
+ SkAnimatorScript::EvaluateFloat(*fMaker, nullptr, fDraw->spacing.c_str(), &result);
if (drawPath)
dst->addPath(drawPath->getPath(), m);
fMaker->clearExtraPropertyCallBack(fDraw->fType);
@@ -185,7 +185,7 @@ const SkMemberInfo SkDrawShapePathEffect::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawShapePathEffect);
SkDrawShapePathEffect::SkDrawShapePathEffect() :
- addPath(NULL), addMatrix(NULL), path(NULL), fPathEffect(NULL) {
+ addPath(nullptr), addMatrix(nullptr), path(nullptr), fPathEffect(nullptr) {
}
SkDrawShapePathEffect::~SkDrawShapePathEffect() {
@@ -223,7 +223,7 @@ SkDrawShape1DPathEffect::~SkDrawShape1DPathEffect() {
}
void SkDrawShape1DPathEffect::onEndElement(SkAnimateMaker& maker) {
- if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() == false))
+ if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply() == false))
maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add error
else
fPathEffect = new SkShape1DPathEffect(this, &maker);
@@ -238,7 +238,7 @@ public:
}
// For serialization. This will never be called.
- Factory getFactory() const override { sk_throw(); return NULL; }
+ Factory getFactory() const override { sk_throw(); return nullptr; }
protected:
void begin(const SkIRect& uvBounds, SkPath*) const override {
@@ -270,7 +270,7 @@ private:
apply->interpolate(*fMaker, v);
drawPath = (SkDrawPath*) apply->getScope();
}
- if (drawPath == NULL)
+ if (drawPath == nullptr)
goto clearCallBack;
if (fDraw->matrix) {
SkDrawMatrix* matrix;
@@ -341,8 +341,8 @@ SkDrawShape2DPathEffect::~SkDrawShape2DPathEffect() {
}
void SkDrawShape2DPathEffect::onEndElement(SkAnimateMaker& maker) {
- if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() == false) ||
- matrix == NULL)
+ if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply() == false) ||
+ matrix == nullptr)
maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add error
else
fPathEffect = new SkShape2DPathEffect(this, &maker, matrix->getMatrix());
@@ -362,7 +362,7 @@ const SkMemberInfo SkDrawComposePathEffect::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawComposePathEffect);
SkDrawComposePathEffect::SkDrawComposePathEffect(SkDisplayTypes type) : fType(type),
- effect1(NULL), effect2(NULL) {
+ effect1(nullptr), effect2(nullptr) {
}
SkDrawComposePathEffect::~SkDrawComposePathEffect() {
@@ -371,7 +371,7 @@ SkDrawComposePathEffect::~SkDrawComposePathEffect() {
}
bool SkDrawComposePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) {
- if (effect1 == NULL)
+ if (effect1 == nullptr)
effect1 = (SkDrawPathEffect*) child;
else
effect2 = (SkDrawPathEffect*) child;
@@ -433,7 +433,7 @@ public:
}
virtual SkDisplayable* createInstance(SkDisplayTypes type) {
- SkDisplayable* result = NULL;
+ SkDisplayable* result = nullptr;
if (skDrawShape1DPathEffectType == type)
result = new SkDrawShape1DPathEffect(type);
else if (skDrawShape2DPathEffectType == type)
@@ -454,7 +454,7 @@ public:
#if SK_USE_CONDENSED_INFO == 0
virtual const SkMemberInfo* getMembers(SkDisplayTypes type, int* infoCountPtr) {
- const SkMemberInfo* info = NULL;
+ const SkMemberInfo* info = nullptr;
int infoCount = 0;
if (skDrawShape1DPathEffectType == type) {
info = SkDrawShape1DPathEffect::fInfo;
@@ -485,12 +485,12 @@ public:
return kDrawComposePathEffectName;
else if (skDrawCornerPathEffectType == type)
return kDrawCornerPathEffectName;
- return NULL;
+ return nullptr;
}
#endif
virtual SkDisplayTypes getType(const char name[], size_t len ) {
- SkDisplayTypes* type = NULL;
+ SkDisplayTypes* type = nullptr;
if (SK_LITERAL_STR_EQUAL(kDrawShape1DPathEffectName, name, len))
type = &skDrawShape1DPathEffectType;
else if (SK_LITERAL_STR_EQUAL(kDrawShape2DPathEffectName, name, len))
@@ -521,5 +521,5 @@ void InitializeSkExtraPathEffects(SkAnimator* animator) {
////////////////
-SkExtras::SkExtras() : fExtraCallBack(NULL), fExtraStorage(NULL) {
+SkExtras::SkExtras() : fExtraCallBack(nullptr), fExtraStorage(nullptr) {
}
diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp
index 70e5e4493e..4aecbc3936 100644
--- a/src/animator/SkDrawGradient.cpp
+++ b/src/animator/SkDrawGradient.cpp
@@ -127,7 +127,7 @@ void SkDrawLinearGradient::dump(SkAnimateMaker* maker) {
SkShader* SkDrawLinearGradient::getShader() {
if (addPrelude() == 0 || points.count() != 4)
- return NULL;
+ return nullptr;
SkShader* shader = SkGradientShader::CreateLinear((SkPoint*)points.begin(),
fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode,
0, getMatrix());
@@ -162,7 +162,7 @@ void SkDrawRadialGradient::dump(SkAnimateMaker* maker) {
SkShader* SkDrawRadialGradient::getShader() {
if (addPrelude() == 0)
- return NULL;
+ return nullptr;
SkShader* shader = SkGradientShader::CreateRadial(center,
radius, fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode,
0, getMatrix());
diff --git a/src/animator/SkDrawGroup.cpp b/src/animator/SkDrawGroup.cpp
index b1b7f0a429..76807bf591 100644
--- a/src/animator/SkDrawGroup.cpp
+++ b/src/animator/SkDrawGroup.cpp
@@ -28,7 +28,7 @@ const SkMemberInfo SkGroup::fInfo[] = {
DEFINE_GET_MEMBER(SkGroup);
-SkGroup::SkGroup() : fParentList(NULL), fOriginal(NULL) {
+SkGroup::SkGroup() : fParentList(nullptr), fOriginal(nullptr) {
}
SkGroup::~SkGroup() {
@@ -55,7 +55,7 @@ bool SkGroup::addChild(SkAnimateMaker& , SkDisplayable* child) {
*fChildren.append() = (SkADrawable*) child;
if (child->isGroup()) {
SkGroup* groupie = (SkGroup*) child;
- SkASSERT(groupie->fParentList == NULL);
+ SkASSERT(groupie->fParentList == nullptr);
groupie->fParentList = &fChildren;
}
return true;
diff --git a/src/animator/SkDrawGroup.h b/src/animator/SkDrawGroup.h
index 83e6771d2d..f1b7bb6e28 100644
--- a/src/animator/SkDrawGroup.h
+++ b/src/animator/SkDrawGroup.h
@@ -38,7 +38,7 @@ public:
SkGroup* getOriginal() { return fOriginal; }
bool hasEnable() const override;
void initialize() override;
- SkBool isACopy() { return fOriginal != NULL; }
+ SkBool isACopy() { return fOriginal != nullptr; }
void markCopyClear(int index);
void markCopySet(int index);
void markCopySize(int index);
diff --git a/src/animator/SkDrawPaint.cpp b/src/animator/SkDrawPaint.cpp
index f5d33881a0..d1af4f42ff 100644
--- a/src/animator/SkDrawPaint.cpp
+++ b/src/animator/SkDrawPaint.cpp
@@ -64,7 +64,7 @@ const SkMemberInfo SkDrawPaint::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawPaint);
-SkDrawPaint::SkDrawPaint() : antiAlias(-1), color(NULL), fakeBold(-1), filterBitmap(-1),
+SkDrawPaint::SkDrawPaint() : antiAlias(-1), color(nullptr), fakeBold(-1), filterBitmap(-1),
linearText(-1), maskFilter((SkDrawMaskFilter*) -1), pathEffect((SkDrawPathEffect*) -1),
shader((SkDrawShader*) -1), strikeThru(-1), stroke(-1),
strokeCap((SkPaint::Cap) -1), strokeJoin((SkPaint::Join) -1), strokeMiter(SK_ScalarNaN),
@@ -98,7 +98,7 @@ bool SkDrawPaint::add(SkAnimateMaker* maker, SkDisplayable* child) {
SkDisplayable* SkDrawPaint::deepCopy(SkAnimateMaker* maker) {
SkDrawColor* tempColor = color;
- color = NULL;
+ color = nullptr;
SkDrawPaint* copy = (SkDrawPaint*) INHERITED::deepCopy(maker);
color = tempColor;
tempColor = (SkDrawColor*) color->deepCopy(maker);
@@ -148,7 +148,7 @@ void SkDrawPaint::dump(SkAnimateMaker* maker) {
void SkDrawPaint::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
- if (scriptValue == NULL)
+ if (scriptValue == nullptr)
return;
SkASSERT(target == this);
switch (index) {
@@ -213,7 +213,7 @@ bool SkDrawPaint::resolveIDs(SkAnimateMaker& maker, SkDisplayable* origDisp, SkA
void SkDrawPaint::setupPaint(SkPaint* paint) const {
if (antiAlias != -1)
paint->setAntiAlias(SkToBool(antiAlias));
- if (color != NULL)
+ if (color != nullptr)
paint->setColor(color->getColor());
if (fakeBold != -1)
paint->setFakeBoldText(SkToBool(fakeBold));
@@ -226,16 +226,16 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const {
paint->setStyle((SkPaint::Style) style);
if (linearText != -1)
paint->setLinearText(SkToBool(linearText));
- if (maskFilter == NULL)
- paint->setMaskFilter(NULL);
+ if (maskFilter == nullptr)
+ paint->setMaskFilter(nullptr);
else if (maskFilter != (SkDrawMaskFilter*) -1)
SkSafeUnref(paint->setMaskFilter(maskFilter->getMaskFilter()));
- if (pathEffect == NULL)
- paint->setPathEffect(NULL);
+ if (pathEffect == nullptr)
+ paint->setPathEffect(nullptr);
else if (pathEffect != (SkDrawPathEffect*) -1)
SkSafeUnref(paint->setPathEffect(pathEffect->getPathEffect()));
- if (shader == NULL)
- paint->setShader(NULL);
+ if (shader == nullptr)
+ paint->setShader(nullptr);
else if (shader != (SkDrawShader*) -1)
SkSafeUnref(paint->setShader(shader->getShader()));
if (strikeThru != -1)
@@ -256,8 +256,8 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const {
paint->setTextSize(textSize);
if (SkScalarIsNaN(textSkewX) == false)
paint->setTextSkewX(textSkewX);
- if (typeface == NULL)
- paint->setTypeface(NULL);
+ if (typeface == nullptr)
+ paint->setTypeface(nullptr);
else if (typeface != (SkDrawTypeface*) -1)
SkSafeUnref(paint->setTypeface(typeface->getTypeface()));
if (underline != -1)
diff --git a/src/animator/SkDrawPath.cpp b/src/animator/SkDrawPath.cpp
index f62f7c04dd..c4c6f5caf5 100644
--- a/src/animator/SkDrawPath.cpp
+++ b/src/animator/SkDrawPath.cpp
@@ -34,7 +34,7 @@ DEFINE_GET_MEMBER(SkDrawPath);
SkDrawPath::SkDrawPath()
{
- fParent = NULL;
+ fParent = nullptr;
fLength = SK_ScalarNaN;
fChildHasID = false;
fDirty = false;
diff --git a/src/animator/SkDrawRectangle.cpp b/src/animator/SkDrawRectangle.cpp
index c3fb7ff705..a89b67cfdf 100644
--- a/src/animator/SkDrawRectangle.cpp
+++ b/src/animator/SkDrawRectangle.cpp
@@ -36,7 +36,7 @@ const SkMemberInfo SkDrawRect::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawRect);
-SkDrawRect::SkDrawRect() : fParent(NULL) {
+SkDrawRect::SkDrawRect() : fParent(nullptr) {
fRect.setEmpty();
}
diff --git a/src/animator/SkDrawSaveLayer.cpp b/src/animator/SkDrawSaveLayer.cpp
index 9623c905c9..c9a4d9fead 100644
--- a/src/animator/SkDrawSaveLayer.cpp
+++ b/src/animator/SkDrawSaveLayer.cpp
@@ -24,7 +24,7 @@ const SkMemberInfo SkSaveLayer::fInfo[] = {
DEFINE_GET_MEMBER(SkSaveLayer);
-SkSaveLayer::SkSaveLayer() : paint(NULL), bounds(NULL) {
+SkSaveLayer::SkSaveLayer() : paint(nullptr), bounds(nullptr) {
}
SkSaveLayer::~SkSaveLayer(){
diff --git a/src/animator/SkDrawShader.cpp b/src/animator/SkDrawShader.cpp
index 29e5251e22..9e3becc48b 100644
--- a/src/animator/SkDrawShader.cpp
+++ b/src/animator/SkDrawShader.cpp
@@ -23,7 +23,7 @@ const SkMemberInfo SkDrawShader::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawShader);
-SkDrawShader::SkDrawShader() : matrix(NULL),
+SkDrawShader::SkDrawShader() : matrix(nullptr),
tileMode(SkShader::kClamp_TileMode) {
}
@@ -36,7 +36,7 @@ bool SkDrawShader::add() {
}
SkMatrix* SkDrawShader::getMatrix() {
- return matrix ? &matrix->getMatrix() : NULL;
+ return matrix ? &matrix->getMatrix() : nullptr;
}
#if SK_USE_CONDENSED_INFO == 0
@@ -51,7 +51,7 @@ const SkMemberInfo SkDrawBitmapShader::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBitmapShader);
-SkDrawBitmapShader::SkDrawBitmapShader() : filterBitmap(-1), image(NULL) {}
+SkDrawBitmapShader::SkDrawBitmapShader() : filterBitmap(-1), image(nullptr) {}
bool SkDrawBitmapShader::add() {
if (fPaint->shader != (SkDrawShader*) -1)
@@ -62,8 +62,8 @@ bool SkDrawBitmapShader::add() {
}
SkShader* SkDrawBitmapShader::getShader() {
- if (image == NULL)
- return NULL;
+ if (image == nullptr)
+ return nullptr;
// note: bitmap shader now supports independent tile modes for X and Y
// we pass the same to both, but later we should extend this flexibility
diff --git a/src/animator/SkDrawTo.cpp b/src/animator/SkDrawTo.cpp
index ef084d12d0..7ae9ca58d4 100644
--- a/src/animator/SkDrawTo.cpp
+++ b/src/animator/SkDrawTo.cpp
@@ -23,7 +23,7 @@ const SkMemberInfo SkDrawTo::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawTo);
-SkDrawTo::SkDrawTo() : drawOnce(false), use(NULL), fDrawnOnce(false) {
+SkDrawTo::SkDrawTo() : drawOnce(false), use(nullptr), fDrawnOnce(false) {
}
#if 0
diff --git a/src/animator/SkDump.cpp b/src/animator/SkDump.cpp
index 9f297e9d58..346b30daf7 100644
--- a/src/animator/SkDump.cpp
+++ b/src/animator/SkDump.cpp
@@ -56,7 +56,7 @@ bool SkDump::enable(SkAnimateMaker& maker ) {
}
bool SkDump::evaluate(SkAnimateMaker &maker) {
- SkAnimatorScript scriptEngine(maker, NULL, SkType_Int);
+ SkAnimatorScript scriptEngine(maker, nullptr, SkType_Int);
SkScriptValue value;
const char* cScript = script.c_str();
bool success = scriptEngine.evaluateScript(&cScript, &value);
@@ -91,7 +91,7 @@ void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) {
const char* str = map.fValues;
while (--index >= 0) {
str = strchr(str, '|');
- if (str == NULL) {
+ if (str == nullptr) {
result->reset();
result->appendS32(badEnum);
return;
@@ -99,7 +99,7 @@ void SkDump::GetEnumString(SkDisplayTypes type, int index, SkString* result) {
str += 1;
}
const char* end = strchr(str, '|');
- if (end == NULL)
+ if (end == nullptr)
end = str + strlen(str);
result->set(str, end - str);
}
diff --git a/src/animator/SkGetCondensedInfo.cpp b/src/animator/SkGetCondensedInfo.cpp
index f2471bbed9..de6fa184b5 100644
--- a/src/animator/SkGetCondensedInfo.cpp
+++ b/src/animator/SkGetCondensedInfo.cpp
@@ -53,7 +53,7 @@ static int _searchByType(SkDisplayTypes type) {
const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* , SkDisplayTypes type, int* infoCountPtr) {
int lookup = _searchByType(type);
if (lookup < 0)
- return NULL;
+ return nullptr;
if (infoCountPtr)
*infoCountPtr = gInfoCounts[lookup];
return gInfoTables[lookup];
@@ -72,10 +72,10 @@ static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) {
if (info->fType == SkType_BaseClassInfo) {
int baseTypeLookup = info->fOffset;
const SkMemberInfo* result = _lookup(baseTypeLookup, matchPtr);
- if (result != NULL)
+ if (result != nullptr)
return result;
if (--count == 0)
- return NULL;
+ return nullptr;
info++;
}
SkASSERT(info->fType != SkType_BaseClassInfo);
@@ -83,7 +83,7 @@ static const SkMemberInfo* _lookup(int lookup, const char** matchPtr) {
const char* strings = gInfoNames[lookup];
int index = _searchByName(&info->fName, count, strings, match);
if (index < 0)
- return NULL;
+ return nullptr;
return &info[index];
}
@@ -93,16 +93,16 @@ const SkMemberInfo* SkMemberInfo::Find(SkDisplayTypes type, int* index) {
if (info->fType == SkType_BaseClassInfo) {
int baseTypeLookup = info->fOffset;
const SkMemberInfo* result = Find(baseTypeLookup, index);
- if (result != NULL)
+ if (result != nullptr)
return result;
if (--count == 0)
- return NULL;
+ return nullptr;
info++;
}
SkASSERT(info->fType != SkType_BaseClassInfo);
if (*index >= count) {
*index -= count;
- return NULL;
+ return nullptr;
}
return &info[index];
}
diff --git a/src/animator/SkMatrixParts.cpp b/src/animator/SkMatrixParts.cpp
index a2f3a9a524..c607f2523f 100644
--- a/src/animator/SkMatrixParts.cpp
+++ b/src/animator/SkMatrixParts.cpp
@@ -13,7 +13,7 @@
#include "SkDrawRectangle.h"
#include "SkDrawPath.h"
-SkMatrixPart::SkMatrixPart() : fMatrix(NULL) {
+SkMatrixPart::SkMatrixPart() : fMatrix(nullptr) {
}
void SkMatrixPart::dirty() {
@@ -25,7 +25,7 @@ SkDisplayable* SkMatrixPart::getParent() const {
}
bool SkMatrixPart::setParent(SkDisplayable* parent) {
- SkASSERT(parent != NULL);
+ SkASSERT(parent != nullptr);
if (parent->isMatrix() == false)
return true;
fMatrix = (SkDrawMatrix*) parent;
@@ -131,14 +131,14 @@ const SkMemberInfo SkFromPath::fInfo[] = {
DEFINE_GET_MEMBER(SkFromPath);
SkFromPath::SkFromPath() :
- mode(0), offset(0), path(NULL) {
+ mode(0), offset(0), path(nullptr) {
}
SkFromPath::~SkFromPath() {
}
bool SkFromPath::add() {
- if (path == NULL)
+ if (path == nullptr)
return true;
static const uint8_t gFlags[] = {
SkPathMeasure::kGetPosAndTan_MatrixFlag, // normal
@@ -167,14 +167,14 @@ const SkMemberInfo SkRectToRect::fInfo[] = {
DEFINE_GET_MEMBER(SkRectToRect);
SkRectToRect::SkRectToRect() :
- source(NULL), destination(NULL) {
+ source(nullptr), destination(nullptr) {
}
SkRectToRect::~SkRectToRect() {
}
bool SkRectToRect::add() {
- if (source == NULL || destination == NULL)
+ if (source == nullptr || destination == nullptr)
return true;
SkMatrix temp;
temp.setRectToRect(source->fRect, destination->fRect,
@@ -208,10 +208,10 @@ void SkRectToRect::dump(SkAnimateMaker* maker) {
#endif
const SkMemberInfo* SkRectToRect::preferredChild(SkDisplayTypes ) {
- if (source == NULL)
+ if (source == nullptr)
return getMember("source"); // !!! cwap! need to refer to member through enum like kScope instead
else {
- SkASSERT(destination == NULL);
+ SkASSERT(destination == nullptr);
return getMember("destination");
}
}
@@ -228,7 +228,7 @@ const SkMemberInfo SkPolyToPoly::fInfo[] = {
DEFINE_GET_MEMBER(SkPolyToPoly);
-SkPolyToPoly::SkPolyToPoly() : source(NULL), destination(NULL) {
+SkPolyToPoly::SkPolyToPoly() : source(nullptr), destination(nullptr) {
}
SkPolyToPoly::~SkPolyToPoly() {
@@ -283,10 +283,10 @@ void SkPolyToPoly::onEndElement(SkAnimateMaker& ) {
}
const SkMemberInfo* SkPolyToPoly::preferredChild(SkDisplayTypes ) {
- if (source == NULL)
+ if (source == nullptr)
return getMember("source"); // !!! cwap! need to refer to member through enum like kScope instead
else {
- SkASSERT(destination == NULL);
+ SkASSERT(destination == nullptr);
return getMember("destination");
}
}
diff --git a/src/animator/SkMemberInfo.cpp b/src/animator/SkMemberInfo.cpp
index 5cdc8d0de6..ea4c257b10 100644
--- a/src/animator/SkMemberInfo.cpp
+++ b/src/animator/SkMemberInfo.cpp
@@ -105,7 +105,7 @@ size_t SkMemberInfo::getSize(const SkDisplayable* displayable) const {
break;
case SkType_Array: {
SkDisplayTypes type;
- if (displayable == NULL)
+ if (displayable == nullptr)
return sizeof(int);
if (displayable->getType() == SkType_Array) {
SkDisplayArray* dispArray = (SkDisplayArray*) displayable;
@@ -191,9 +191,9 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
SkDisplayTypes type = getType();
SkAnimatorScript engine(maker, displayable, type);
if (arrayStorage)
- displayable = NULL;
+ displayable = nullptr;
bool success = true;
- void* untypedStorage = NULL;
+ void* untypedStorage = nullptr;
if (displayable && fType != SkType_MemberProperty && fType != SkType_MemberFunction)
untypedStorage = (SkTDOperandArray*) memberData(displayable);
@@ -201,7 +201,7 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
// for both SpiderMonkey and SkiaScript, substitute any #xyz or #xxyyzz first
// it's enough to expand the colors into 0xFFxxyyzz
const char* poundPos;
- while ((poundPos = strchr(valueStr.c_str(), '#')) != NULL) {
+ while ((poundPos = strchr(valueStr.c_str(), '#')) != nullptr) {
size_t offset = poundPos - valueStr.c_str();
if (valueStr.size() - offset < 4)
break;
@@ -258,7 +258,7 @@ scriptCommon: {
SkASSERT(success);
if (scriptValue.fType == SkType_Displayable) {
if (type == SkType_String) {
- const char* charPtr = NULL;
+ const char* charPtr = nullptr;
maker.findKey(scriptValue.fOperand.fDisplayable, &charPtr);
scriptValue.fOperand.fString = new SkString(charPtr);
scriptValue.fType = SkType_String;
@@ -358,7 +358,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
SkScriptValue& scriptValue) const
{
SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ?
- arrayStorage->begin() : NULL;
+ arrayStorage->begin() : nullptr;
if (storage)
storage += storageOffset;
SkDisplayTypes type = getType();
@@ -386,7 +386,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
} else if (fType == SkType_MemberFunction) {
SkASSERT(scriptValue.fType == SkType_Array);
if (displayable)
- displayable->executeFunction(displayable, this, scriptValue.fOperand.fArray, NULL);
+ displayable->executeFunction(displayable, this, scriptValue.fOperand.fArray, nullptr);
else {
int count = scriptValue.fOperand.fArray->count();
// SkASSERT(maxStorage == 0 || count == maxStorage);
@@ -426,7 +426,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
SkTypedArray* array = scriptValue.fOperand.fArray;
SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB ||
scriptValue.fType == SkType_Array);
- SkASSERT(scriptValue.fType != SkType_Array || (array != NULL &&
+ SkASSERT(scriptValue.fType != SkType_Array || (array != nullptr &&
array->getType() == SkType_Int));
int numberOfColors = scriptValue.fType == SkType_Array ? array->count() : 1;
int numberOfComponents = numberOfColors * 4;
@@ -442,7 +442,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
storage[3].fScalar = SkIntToScalar(SkColorGetB(color));
storage += 4;
}
- } else if (SkDisplayType::IsStruct(NULL /* !!! maker*/, type)) {
+ } else if (SkDisplayType::IsStruct(nullptr /* !!! maker*/, type)) {
if (scriptValue.fType != SkType_Array)
return true; // error
SkASSERT(sizeof(SkScalar) == sizeof(SkOperand)); // !!! no 64 bit pointer support yet
@@ -486,17 +486,17 @@ const SkMemberInfo* SkMemberInfo::Find(const SkMemberInfo info[], int count, int
if (info->fType == SkType_BaseClassInfo) {
const SkMemberInfo* inherited = (SkMemberInfo*) info->fName;
const SkMemberInfo* result = SkMemberInfo::Find(inherited, info->fCount, index);
- if (result != NULL)
+ if (result != nullptr)
return result;
if (--count == 0)
- return NULL;
+ return nullptr;
info++;
}
SkASSERT(info->fName);
SkASSERT(info->fType != SkType_BaseClassInfo);
if (*index >= count) {
*index -= count;
- return NULL;
+ return nullptr;
}
return &info[*index];
}
@@ -507,17 +507,17 @@ const SkMemberInfo* SkMemberInfo::Find(const SkMemberInfo info[], int count, con
if (info->fType == SkType_BaseClassInfo) {
const SkMemberInfo* inherited = (SkMemberInfo*) info->fName;
const SkMemberInfo* result = SkMemberInfo::Find(inherited, info->fCount, matchPtr);
- if (result != NULL)
+ if (result != nullptr)
return result;
if (--count == 0)
- return NULL;
+ return nullptr;
info++;
}
SkASSERT(info->fName);
SkASSERT(info->fType != SkType_BaseClassInfo);
int index = SkStrSearch(&info->fName, count, match, sizeof(*info));
if (index < 0 || index >= count)
- return NULL;
+ return nullptr;
return &info[index];
}
diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h
index 3588da2515..b62de663d4 100644
--- a/src/animator/SkMemberInfo.h
+++ b/src/animator/SkMemberInfo.h
@@ -32,7 +32,7 @@ struct SkMemberInfo {
// if fCount == 0, record is member property
// then fType can be type, so caller doesn't have to check
#if SK_USE_CONDENSED_INFO == 0
- const char* fName; // may be NULL for anonymous functions
+ const char* fName; // may be nullptr for anonymous functions
size_t fOffset; // if negative, is index into member pointer table (for properties and functions)
SkDisplayTypes fType;
int fCount; // for properties, actual type (count is always assumed to be 1)
@@ -229,36 +229,36 @@ public: \
#define DECLARE_MEMBER_INFO(_type) \
public: \
virtual const SkMemberInfo* getMember(int index) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \
virtual const SkMemberInfo* getMember(const char name[]) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \
virtual SkDisplayTypes getType() const { return SkType_##_type; } \
typedef Sk##_type BASE_CLASS
#define DECLARE_DRAW_MEMBER_INFO(_type) \
public: \
virtual const SkMemberInfo* getMember(int index) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \
virtual const SkMemberInfo* getMember(const char name[]) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \
virtual SkDisplayTypes getType() const { return SkType_##_type; } \
typedef SkDraw##_type BASE_CLASS
#define DECLARE_DISPLAY_MEMBER_INFO(_type) \
public: \
virtual const SkMemberInfo* getMember(int index) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \
virtual const SkMemberInfo* getMember(const char name[]) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &name); } \
virtual SkDisplayTypes getType() const { return SkType_##_type; } \
typedef SkDisplay##_type BASE_CLASS
#define DECLARE_EXTRAS_MEMBER_INFO(_type) \
public: \
virtual const SkMemberInfo* getMember(int index) { \
- return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
+ return SkDisplayType::GetMember(nullptr, SkType_##_type, &index); } \
virtual const SkMemberInfo* getMember(const char name[]) { \
- return SkDisplayType::GetMember(NULL, fType, &name); } \
+ return SkDisplayType::GetMember(nullptr, fType, &name); } \
SkDisplayTypes fType; \
virtual SkDisplayTypes getType() const { return fType; } \
typedef _type BASE_CLASS
diff --git a/src/animator/SkOperandIterpolator.cpp b/src/animator/SkOperandIterpolator.cpp
index 84b32823e1..e6973e29f7 100644
--- a/src/animator/SkOperandIterpolator.cpp
+++ b/src/animator/SkOperandIterpolator.cpp
@@ -38,7 +38,7 @@ void SkOperandInterpolator::reset(int elemCount, int frameCount, SkDisplayTypes
bool SkOperandInterpolator::setKeyFrame(int index, SkMSec time, const SkOperand values[], SkScalar blend)
{
- SkASSERT(values != NULL);
+ SkASSERT(values != nullptr);
blend = SkScalarPin(blend, 0, SK_Scalar1);
bool success = ~index == SkTSearch<SkMSec>(&fTimes->fTime, index, time, sizeof(SkTimeCode));
diff --git a/src/animator/SkPaintPart.cpp b/src/animator/SkPaintPart.cpp
index 285b564c93..842dbc9752 100644
--- a/src/animator/SkPaintPart.cpp
+++ b/src/animator/SkPaintPart.cpp
@@ -12,7 +12,7 @@
#include "SkDump.h"
#endif
-SkPaintPart::SkPaintPart() : fPaint(NULL) {
+SkPaintPart::SkPaintPart() : fPaint(nullptr) {
}
SkDisplayable* SkPaintPart::getParent() const {
@@ -20,7 +20,7 @@ SkDisplayable* SkPaintPart::getParent() const {
}
bool SkPaintPart::setParent(SkDisplayable* parent) {
- SkASSERT(parent != NULL);
+ SkASSERT(parent != nullptr);
if (parent->isPaint() == false)
return true;
fPaint = (SkDrawPaint*) parent;
@@ -38,7 +38,7 @@ bool SkDrawMaskFilter::add() {
}
SkMaskFilter* SkDrawMaskFilter::getMaskFilter() {
- return NULL;
+ return nullptr;
}
@@ -51,18 +51,18 @@ bool SkDrawPathEffect::add() {
fPaint->fOwnsPathEffect = true;
return false;
}
- fPaint->add(NULL, this);
+ fPaint->add(nullptr, this);
return false;
}
SkPathEffect* SkDrawPathEffect::getPathEffect() {
- return NULL;
+ return nullptr;
}
// SkDrawShader
SkShader* SkDrawShader::getShader() {
- return NULL;
+ return nullptr;
}
diff --git a/src/animator/SkPaintPart.h b/src/animator/SkPaintPart.h
index 2907d81615..a7e28ed3e2 100644
--- a/src/animator/SkPaintPart.h
+++ b/src/animator/SkPaintPart.h
@@ -51,7 +51,7 @@ class SkDrawShader : public SkPaintPart {
virtual SkShader* getShader();
protected:
bool add() override;
- SkMatrix* getMatrix(); // returns NULL if matrix is NULL
+ SkMatrix* getMatrix(); // returns nullptr if matrix is nullptr
SkDrawMatrix* matrix;
int /*SkShader::TileMode*/ tileMode;
};
diff --git a/src/animator/SkParseSVGPath.cpp b/src/animator/SkParseSVGPath.cpp
index 4b548e28be..7050f7c1e0 100644
--- a/src/animator/SkParseSVGPath.cpp
+++ b/src/animator/SkParseSVGPath.cpp
@@ -218,7 +218,7 @@ void SkDrawPath::parseSVG() {
break;
case '~': {
SkPoint args[2];
- data = find_points(data, args, 2, false, NULL);
+ data = find_points(data, args, 2, false, nullptr);
fPath.moveTo(args[0].fX, args[0].fY);
fPath.lineTo(args[1].fX, args[1].fY);
}
diff --git a/src/animator/SkPathParts.cpp b/src/animator/SkPathParts.cpp
index efc7c3355d..b5407ceeb5 100644
--- a/src/animator/SkPathParts.cpp
+++ b/src/animator/SkPathParts.cpp
@@ -13,7 +13,7 @@
#include "SkDrawRectangle.h"
#include "SkDrawPath.h"
-SkPathPart::SkPathPart() : fPath(NULL) {
+SkPathPart::SkPathPart() : fPath(nullptr) {
}
void SkPathPart::dirty() {
@@ -25,7 +25,7 @@ SkDisplayable* SkPathPart::getParent() const {
}
bool SkPathPart::setParent(SkDisplayable* parent) {
- SkASSERT(parent != NULL);
+ SkASSERT(parent != nullptr);
if (parent->isPath() == false)
return true;
fPath = (SkDrawPath*) parent;
@@ -305,11 +305,11 @@ const SkMemberInfo SkAddPath::fInfo[] = {
DEFINE_GET_MEMBER(SkAddPath);
-SkAddPath::SkAddPath() : matrix(NULL), path(NULL) {
+SkAddPath::SkAddPath() : matrix(nullptr), path(nullptr) {
}
bool SkAddPath::add() {
- SkASSERT (path != NULL);
+ SkASSERT (path != nullptr);
if (matrix)
fPath->fPath.addPath(path->fPath, matrix->getMatrix());
else
diff --git a/src/animator/SkPostParts.cpp b/src/animator/SkPostParts.cpp
index 7c0931eaa0..bfd5385532 100644
--- a/src/animator/SkPostParts.cpp
+++ b/src/animator/SkPostParts.cpp
@@ -20,7 +20,7 @@ const SkMemberInfo SkDataInput::fInfo[] = {
DEFINE_GET_MEMBER(SkDataInput);
-SkDataInput::SkDataInput() : fParent(NULL) {}
+SkDataInput::SkDataInput() : fParent(nullptr) {}
bool SkDataInput::add() {
SkASSERT(name.size() > 0);
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index 0694fc4a84..cd864146f7 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -386,7 +386,7 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
const char* field, size_t fieldLength) {
void* object;
if (suppressed)
- object = NULL;
+ object = nullptr;
else {
if (fTypeStack.top() != kObject) {
fError = kDotOperatorExpectsObject;
@@ -492,7 +492,7 @@ bool SkScriptEngine::functionParams(const char** scriptPtr, SkTDArray<SkScriptVa
SkBool suppressed = fSuppressStack.top().fSuppress;
do {
SkScriptValue value;
- bool success = innerScript(scriptPtr, suppressed ? NULL : &value);
+ bool success = innerScript(scriptPtr, suppressed ? nullptr : &value);
if (success == false) {
fError = kErrorInFunctionParameters;
return false;
@@ -559,7 +559,7 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
if (convertTo(tokenInfo->getType(), &tokenValue) == false)
return false;
}
- tokenInfo->writeValue(fDisplayable, NULL, 0, 0,
+ tokenInfo->writeValue(fDisplayable, nullptr, 0, 0,
(void*) ((char*) fInfo->memberData(fDisplayable) + tokenInfo->fOffset + fArrayOffset),
tokenInfo->getType(), tokenValue);
}
@@ -635,7 +635,7 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
}
script += 2;
script = SkParse::FindHex(script, (uint32_t*)&operand.fS32);
- if (script == NULL) {
+ if (script == nullptr) {
fError = kExpectedHex;
return false;
}
@@ -711,7 +711,7 @@ scalarCommon:
if (ch == '.') {
if (fTokenLength == 0) {
SkScriptValue scriptValue;
- SkDEBUGCODE(scriptValue.fOperand.fObject = NULL);
+ SkDEBUGCODE(scriptValue.fOperand.fObject = nullptr);
int tokenLength = token_length(++script);
const char* token = script;
script += tokenLength;
@@ -880,7 +880,7 @@ bool SkScriptEngine::handleArrayIndexer(const char** scriptPtr, bool suppressed)
*fBraceStack.push() = kArrayBrace;
SkOpType saveType = fReturnType;
fReturnType = kInt;
- bool success = innerScript(scriptPtr, suppressed == false ? &scriptValue : NULL);
+ bool success = innerScript(scriptPtr, suppressed == false ? &scriptValue : nullptr);
if (success == false)
return false;
fReturnType = saveType;
@@ -1037,7 +1037,7 @@ bool SkScriptEngine::handleProperty(bool suppressed) {
success = (*callBack->fPropertyCallBack)(fToken, fTokenLength,
callBack->fUserStorage, &callbackResult);
if (success) {
- if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == NULL) {
+ if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == nullptr) {
callbackResult.fOperand.fString = new SkString(fToken, fTokenLength);
track(callbackResult.fOperand.fString);
}
@@ -1317,7 +1317,7 @@ bool SkScriptEngine::processOp() {
if ((type1 & attributes->fLeftType) == 0 || type1 != type2) {
if (type1 == kString) {
const char* result = SkParse::FindScalar(operand1.fString->c_str(), &operand1.fScalar);
- if (result == NULL) {
+ if (result == nullptr) {
fError = kExpectedNumber;
return false;
}
@@ -1332,7 +1332,7 @@ bool SkScriptEngine::processOp() {
if ((type2 & attributes->fRightType) == 0 || type1 != type2) {
if (type2 == kString) {
const char* result = SkParse::FindScalar(operand2.fString->c_str(), &operand2.fScalar);
- if (result == NULL) {
+ if (result == nullptr) {
fError = kExpectedNumber;
return false;
}
@@ -1487,7 +1487,7 @@ void SkScriptEngine::unboxCallBack(_unboxCallBack func, void* userStorage) {
bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, SkScriptValue* value ) {
SkASSERT(value);
- if (SkDisplayType::IsEnum(NULL /* fMaker */, toType))
+ if (SkDisplayType::IsEnum(nullptr /* fMaker */, toType))
toType = SkType_Int;
if (toType == SkType_Point || toType == SkType_3D_Point)
toType = SkType_Float;
@@ -1509,7 +1509,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
success = false;
break; // error
}
- success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != NULL;
+ success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != nullptr;
}
break;
case SkType_Float:
@@ -1525,7 +1525,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
success = false;
break; // error
}
- success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != NULL;
+ success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != nullptr;
}
break;
case SkType_String: {
@@ -1595,9 +1595,9 @@ SkDisplayTypes SkScriptEngine::ToDisplayType(SkOpType type) {
}
SkScriptEngine::SkOpType SkScriptEngine::ToOpType(SkDisplayTypes type) {
- if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
+ if (SkDisplayType::IsDisplayable(nullptr /* fMaker */, type))
return (SkOpType) kObject;
- if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
+ if (SkDisplayType::IsEnum(nullptr /* fMaker */, type))
return kInt;
switch (type) {
case SkType_ARGB:
@@ -1647,7 +1647,7 @@ bool SkScriptEngine::ValueToString(SkScriptValue value, SkString* string) {
#include "SkFloatingPoint.h"
#define DEF_SCALAR_ANSWER 0
-#define DEF_STRING_ANSWER NULL
+#define DEF_STRING_ANSWER nullptr
#define testInt(expression) { #expression, SkType_Int, expression, DEF_SCALAR_ANSWER, DEF_STRING_ANSWER }
#define testScalar(expression) { #expression, SkType_Float, 0, (float) expression, DEF_STRING_ANSWER }
diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp
index 5517b5142a..7cb35a69db 100644
--- a/src/animator/SkScriptRuntime.cpp
+++ b/src/animator/SkScriptRuntime.cpp
@@ -200,13 +200,13 @@ bool SkScriptRuntime::executeTokens(unsigned char* opCode) {
operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32);
break;
case SkScriptEngine2::kStringToInt:
- if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == NULL)
+ if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == nullptr)
return false;
break;
case SkScriptEngine2::kStringToScalar:
case SkScriptEngine2::kStringToScalar2:
if (SkParse::FindScalar(operand[0].fString->c_str(),
- &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == NULL)
+ &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == nullptr)
return false;
break;
case SkScriptEngine2::kScalarToInt:
@@ -341,11 +341,11 @@ void SkScriptRuntime::track(SkString* string) {
void SkScriptRuntime::untrack(SkOpArray* array) {
int index = fTrackArray.find(array);
SkASSERT(index >= 0);
- fTrackArray.begin()[index] = NULL;
+ fTrackArray.begin()[index] = nullptr;
}
void SkScriptRuntime::untrack(SkString* string) {
int index = fTrackString.find(string);
SkASSERT(index >= 0);
- fTrackString.begin()[index] = NULL;
+ fTrackString.begin()[index] = nullptr;
}
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 03ffaa4a72..4ab7584f7a 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -815,7 +815,7 @@ bool SkScriptEngine2::handleFunction(const char** scriptPtr) {
SkScriptValue2 callbackResult;
success = (*callBack)->getReference(functionName, functionNameLen, &callbackResult);
if (success) {
- callbackResult.fType = (*callBack)->getReturnType(callbackResult.fOperand.fReference, NULL);
+ callbackResult.fType = (*callBack)->getReturnType(callbackResult.fOperand.fReference, nullptr);
callbackResult.fIsConstant = SkScriptValue2::kVariable;
fValueStack.push(callbackResult);
goto done;
@@ -877,7 +877,7 @@ bool SkScriptEngine2::handleProperty() {
SkScriptValue2 callbackResult;
success = (*callBack)->getReference(fToken, fTokenLength, &callbackResult);
if (success) {
- if (callbackResult.fType == SkOperand2::kString && callbackResult.fOperand.fString == NULL) {
+ if (callbackResult.fType == SkOperand2::kString && callbackResult.fOperand.fString == nullptr) {
callbackResult.fOperand.fString = new SkString(fToken, fTokenLength);
track(callbackResult.fOperand.fString);
}
@@ -1203,7 +1203,7 @@ bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toTy
operand.fS32 = SkScalarFloorToInt(operand.fScalar);
else {
SkASSERT(type == SkOperand2::kString);
- success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != NULL;
+ success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != nullptr;
}
break;
case SkOperand2::kScalar:
@@ -1211,7 +1211,7 @@ bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toTy
operand.fScalar = IntToScalar(operand.fS32);
else {
SkASSERT(type == SkOperand2::kString);
- success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != NULL;
+ success = SkParse::FindScalar(operand.fString->c_str(), &operand.fScalar) != nullptr;
}
break;
case SkOperand2::kString: {
@@ -1273,11 +1273,11 @@ bool SkScriptEngine2::ValueToString(const SkScriptValue2& value, SkString* strin
#ifdef SK_DEBUG
#if defined(SK_SUPPORT_UNITTEST)
-#define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, NULL }
-#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (expression), NULL }
-#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf((float) exp1, (float) exp2), NULL }
-#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL }
-#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL }
+#define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, nullptr }
+#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (expression), nullptr }
+#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf((float) exp1, (float) exp2), nullptr }
+#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, nullptr }
+#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, nullptr }
static const SkScriptNAnswer2 scriptTests[] = {
testInt(1||(0&&3)),
@@ -1308,12 +1308,12 @@ static const SkScriptNAnswer2 scriptTests[] = {
{ "'123'+\"456\"", SkOperand2::kString, 0, 0, "123456" },
{ "123+\"456\"", SkOperand2::kString, 0, 0, "123456" },
{ "'123'+456", SkOperand2::kString, 0, 0, "123456" },
- { "'123'|\"456\"", SkOperand2::kS32, 123|456, 0, NULL },
- { "123|\"456\"", SkOperand2::kS32, 123|456, 0, NULL },
- { "'123'|456", SkOperand2::kS32, 123|456, 0, NULL },
- { "'2'<11", SkOperand2::kS32, 1, 0, NULL },
- { "2<'11'", SkOperand2::kS32, 1, 0, NULL },
- { "'2'<'11'", SkOperand2::kS32, 0, 0, NULL },
+ { "'123'|\"456\"", SkOperand2::kS32, 123|456, 0, nullptr },
+ { "123|\"456\"", SkOperand2::kS32, 123|456, 0, nullptr },
+ { "'123'|456", SkOperand2::kS32, 123|456, 0, nullptr },
+ { "'2'<11", SkOperand2::kS32, 1, 0, nullptr },
+ { "2<'11'", SkOperand2::kS32, 1, 0, nullptr },
+ { "'2'<'11'", SkOperand2::kS32, 0, 0, nullptr },
testInt(123),
testInt(-345),
testInt(+678),
@@ -1465,7 +1465,7 @@ static const SkScriptNAnswer2 scriptTests[] = {
testInt(0||(0&&3)),
testInt(0||(1&&3)),
testInt(0&&1?2:3)
- , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, NULL }
+ , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, nullptr }
};
#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
diff --git a/src/animator/SkTDArray_Experimental.h b/src/animator/SkTDArray_Experimental.h
index 4b3970fde0..ff693ac39b 100644
--- a/src/animator/SkTDArray_Experimental.h
+++ b/src/animator/SkTDArray_Experimental.h
@@ -35,8 +35,8 @@ protected:
SkDS32Array(const int32_t src[], U16CPU count);
SkDS32Array& operator=(const SkDS32Array& src);
friend int operator==(const SkDS32Array& a, const SkDS32Array& b);
- int32_t* append() { return this->append(1, NULL); }
- int32_t* append(U16CPU count, const int32_t* src = NULL);
+ int32_t* append() { return this->append(1, nullptr); }
+ int32_t* append(U16CPU count, const int32_t* src = nullptr);
int32_t* appendClear()
{
@@ -65,9 +65,9 @@ public:
if (fArray)
{
sk_free(fArray);
- fArray = NULL;
+ fArray = nullptr;
#ifdef SK_DEBUG
- fData = NULL;
+ fData = nullptr;
#endif
fReserve = fCount = 0;
}
@@ -104,7 +104,7 @@ protected:
template <typename T> class SkTDS32Array : public SkDS32Array {
public:
- SkTDS32Array() { SkDEBUGCODE(fTData=NULL); SkASSERT(sizeof(T) == sizeof(int32_t)); }
+ SkTDS32Array() { SkDEBUGCODE(fTData=nullptr); SkASSERT(sizeof(T) == sizeof(int32_t)); }
SkTDS32Array(const SkTDS32Array<T>& src) : SkDS32Array(src) {}
~SkTDS32Array() { sk_free(fArray); }
T& operator[](int index) const { SYNC(); SkASSERT((unsigned)index < fCount); return ((T*) fArray)[index]; }
@@ -114,12 +114,12 @@ public:
return operator==((const SkDS32Array&) a, (const SkDS32Array&) b); }
T* append() { return (T*) SkDS32Array::append(); }
T* appendClear() { return (T*) SkDS32Array::appendClear(); }
- T* append(U16CPU count, const T* src = NULL) { return (T*) SkDS32Array::append(count, (const int32_t*) src); }
+ T* append(U16CPU count, const T* src = nullptr) { return (T*) SkDS32Array::append(count, (const int32_t*) src); }
T* begin() const { SYNC(); return (T*) fArray; }
- T* end() const { return (T*) (fArray ? fArray + fCount : NULL); }
+ T* end() const { return (T*) (fArray ? fArray + fCount : nullptr); }
int find(const T& elem) const { return SkDS32Array::find((const int32_t&) elem); }
- T* insert(U16CPU index) { return this->insert(index, 1, NULL); }
- T* insert(U16CPU index, U16CPU count, const T* src = NULL) {
+ T* insert(U16CPU index) { return this->insert(index, 1, nullptr); }
+ T* insert(U16CPU index, U16CPU count, const T* src = nullptr) {
return (T*) SkDS32Array::insert(index, count, (const int32_t*) src); }
int rfind(const T& elem) const { return SkDS32Array::rfind((const int32_t&) elem); }
T* push() { return this->append(); }
diff --git a/src/animator/SkTextOnPath.cpp b/src/animator/SkTextOnPath.cpp
index 7bdb7fd977..864741619b 100644
--- a/src/animator/SkTextOnPath.cpp
+++ b/src/animator/SkTextOnPath.cpp
@@ -26,7 +26,7 @@ const SkMemberInfo SkTextOnPath::fInfo[] = {
DEFINE_GET_MEMBER(SkTextOnPath);
-SkTextOnPath::SkTextOnPath() : offset(0), path(NULL), text(NULL) {
+SkTextOnPath::SkTextOnPath() : offset(0), path(nullptr), text(nullptr) {
}
bool SkTextOnPath::draw(SkAnimateMaker& maker) {
diff --git a/src/animator/SkTextToPath.cpp b/src/animator/SkTextToPath.cpp
index 0c1b0e42e4..d4b525b9af 100644
--- a/src/animator/SkTextToPath.cpp
+++ b/src/animator/SkTextToPath.cpp
@@ -26,7 +26,7 @@ const SkMemberInfo SkTextToPath::fInfo[] = {
DEFINE_GET_MEMBER(SkTextToPath);
-SkTextToPath::SkTextToPath() : paint(NULL), path(NULL), text(NULL) {
+SkTextToPath::SkTextToPath() : paint(nullptr), path(nullptr), text(nullptr) {
}
bool SkTextToPath::draw(SkAnimateMaker& maker) {
@@ -35,7 +35,7 @@ bool SkTextToPath::draw(SkAnimateMaker& maker) {
}
void SkTextToPath::onEndElement(SkAnimateMaker& maker) {
- if (paint == NULL || path == NULL || text == NULL) {
+ if (paint == nullptr || path == nullptr || text == nullptr) {
// !!! add error message here
maker.setErrorCode(SkDisplayXMLParserError::kErrorInAttributeValue);
return;
diff --git a/src/animator/SkTypedArray.cpp b/src/animator/SkTypedArray.cpp
index e94e57dca7..d9e2bc7f73 100644
--- a/src/animator/SkTypedArray.cpp
+++ b/src/animator/SkTypedArray.cpp
@@ -29,18 +29,18 @@ bool SkTypedArray::getIndex(int index, SkOperand* operand) {
SkDS32Array::SkDS32Array()
{
fReserve = fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
#ifdef SK_DEBUG
- fData = NULL;
+ fData = nullptr;
#endif
}
SkDS32Array::SkDS32Array(const SkDS32Array& src)
{
fReserve = fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
#ifdef SK_DEBUG
- fData = NULL;
+ fData = nullptr;
#endif
SkDS32Array tmp(src.fArray, src.fCount);
this->swap(tmp);
@@ -51,9 +51,9 @@ SkDS32Array::SkDS32Array(const int32_t src[], U16CPU count)
SkASSERT(src || count == 0);
fReserve = fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
#ifdef SK_DEBUG
- fData = NULL;
+ fData = nullptr;
#endif
if (count)
{
@@ -105,7 +105,7 @@ int32_t* SkDS32Array::append(U16CPU count, const int32_t* src)
unsigned oldCount = fCount;
if (count)
{
- SkASSERT(src == NULL || fArray == NULL ||
+ SkASSERT(src == nullptr || fArray == nullptr ||
src + count <= fArray || fArray + count <= src);
this->growBy(count);
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index b88c892d05..f2f6a8e771 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -84,7 +84,7 @@ SkCodec* SkBmpCodec::NewFromIco(SkStream* stream) {
/*
* Read enough of the stream to initialize the SkBmpCodec. Returns a bool
* representing success or failure. If it returned true, and codecOut was
- * not NULL, it will be set to a new SkBmpCodec.
+ * not nullptr, it will be set to a new SkBmpCodec.
* Does *not* take ownership of the passed in SkStream.
*/
bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) {
@@ -441,7 +441,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) {
// Check that input bit masks are valid and create the masks object
SkAutoTDelete<SkMasks>
masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel));
- if (NULL == masks) {
+ if (nullptr == masks) {
SkCodecPrintf("Error: invalid input masks.\n");
return false;
}
@@ -514,7 +514,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) {
*/
SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkCodec* codec = NULL;
+ SkCodec* codec = nullptr;
if (ReadHeader(stream, inIco, &codec)) {
// codec has taken ownership of stream, so we do not need to
// delete it.
@@ -522,7 +522,7 @@ SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
streamDeleter.detach();
return codec;
}
- return NULL;
+ return nullptr;
}
SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream,
@@ -533,7 +533,7 @@ SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream,
{}
bool SkBmpCodec::onRewind() {
- return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), NULL);
+ return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr);
}
/*
diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h
index 71006f7315..ee14f8936a 100644
--- a/src/codec/SkBmpCodec.h
+++ b/src/codec/SkBmpCodec.h
@@ -58,7 +58,7 @@ protected:
/*
* Read enough of the stream to initialize the SkBmpCodec. Returns a bool
* representing success or failure. If it returned true, and codecOut was
- * not NULL, it will be set to a new SkBmpCodec.
+ * not nullptr, it will be set to a new SkBmpCodec.
* Does *not* take ownership of the passed in SkStream.
*/
static bool ReadHeader(SkStream*, bool inIco, SkCodec** codecOut);
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 90457b2feb..5684b683d2 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -17,8 +17,8 @@ SkBmpMaskCodec::SkBmpMaskCodec(const SkImageInfo& info, SkStream* stream,
SkBmpCodec::RowOrder rowOrder)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
, fMasks(masks)
- , fMaskSwizzler(NULL)
- , fSrcBuffer(NULL)
+ , fMaskSwizzler(nullptr)
+ , fSrcBuffer(nullptr)
{}
/*
@@ -64,7 +64,7 @@ bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) {
fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(
dstInfo, fMasks, this->bitsPerPixel()));
- if (NULL == fMaskSwizzler.get()) {
+ if (nullptr == fMaskSwizzler.get()) {
return false;
}
@@ -94,7 +94,7 @@ SkCodec::Result SkBmpMaskCodec::decode(const SkImageInfo& dstInfo,
if (kNo_ZeroInitialized == opts.fZeroInitialized || 0 != fillColor) {
void* dstStart = this->getDstStartRow(dst, dstRowBytes, y);
SkSwizzler::Fill(dstStart, dstInfo, dstRowBytes, dstInfo.height() - y, fillColor,
- NULL);
+ nullptr);
}
return kIncompleteInput;
}
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index ed0617f2e7..9af19d1b12 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -24,7 +24,7 @@ SkBmpRLECodec::SkBmpRLECodec(const SkImageInfo& info,
SkBmpCodec::RowOrder rowOrder,
size_t RLEBytes)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
- , fColorTable(NULL)
+ , fColorTable(nullptr)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
@@ -57,7 +57,7 @@ SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo,
}
// Create the color table if necessary and prepare the stream for decode
- // Note that if it is non-NULL, inputColorCount will be modified
+ // Note that if it is non-nullptr, inputColorCount will be modified
if (!this->createColorTable(inputColorCount)) {
SkCodecPrintf("Error: could not create color table.\n");
return kInvalidInput;
@@ -86,7 +86,7 @@ SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo,
if (this->bitsPerPixel() <= 8) {
// Inform the caller of the number of colors
uint32_t maxColors = 1 << this->bitsPerPixel();
- if (NULL != numColors) {
+ if (nullptr != numColors) {
// We set the number of colors to maxColors in order to ensure
// safe memory accesses. Otherwise, an invalid pixel could
// access memory outside of our color table array.
@@ -291,7 +291,7 @@ SkCodec::Result SkBmpRLECodec::decode(const SkImageInfo& dstInfo,
// type that makes sense for the destination format.
SkASSERT(kN32_SkColorType == dstInfo.colorType());
if (kNo_ZeroInitialized == opts.fZeroInitialized) {
- SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height, SK_ColorTRANSPARENT, NULL);
+ SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height, SK_ColorTRANSPARENT, nullptr);
}
while (true) {
diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h
index ee8989be64..65b0180f98 100644
--- a/src/codec/SkBmpRLECodec.h
+++ b/src/codec/SkBmpRLECodec.h
@@ -49,7 +49,7 @@ private:
/*
* Creates the color table
- * Sets colorCount to the new color count if it is non-NULL
+ * Sets colorCount to the new color count if it is non-nullptr
*/
bool createColorTable(int* colorCount);
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 8404aa616b..210498eb00 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -20,12 +20,12 @@ SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream
uint32_t bytesPerColor, uint32_t offset,
SkBmpCodec::RowOrder rowOrder, bool inIco)
: INHERITED(info, stream, bitsPerPixel, rowOrder)
- , fColorTable(NULL)
+ , fColorTable(nullptr)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
- , fSwizzler(NULL)
- , fSrcBuffer(NULL)
+ , fSwizzler(nullptr)
+ , fSrcBuffer(nullptr)
, fInIco(inIco)
{}
@@ -54,7 +54,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
}
// Create the color table if necessary and prepare the stream for decode
- // Note that if it is non-NULL, inputColorCount will be modified
+ // Note that if it is non-nullptr, inputColorCount will be modified
if (!this->createColorTable(dstInfo.alphaType(), inputColorCount)) {
SkCodecPrintf("Error: could not create color table.\n");
return kInvalidInput;
@@ -82,7 +82,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
if (this->bitsPerPixel() <= 8) {
// Inform the caller of the number of colors
uint32_t maxColors = 1 << this->bitsPerPixel();
- if (NULL != numColors) {
+ if (nullptr != numColors) {
// We set the number of colors to maxColors in order to ensure
// safe memory accesses. Otherwise, an invalid pixel could
// access memory outside of our color table array.
@@ -112,7 +112,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
// should fail if the alpha type is not one of the above
// values.
SkASSERT(false);
- packARGB = NULL;
+ packARGB = nullptr;
break;
}
@@ -210,7 +210,7 @@ bool SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo,
fSwizzler.reset(SkSwizzler::CreateSwizzler(config,
colorPtr, dstInfo, opts.fZeroInitialized, this->getInfo()));
- if (NULL == fSwizzler.get()) {
+ if (nullptr == fSwizzler.get()) {
return false;
}
return true;
diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h
index 45450e6591..a7d48c8011 100644
--- a/src/codec/SkBmpStandardCodec.h
+++ b/src/codec/SkBmpStandardCodec.h
@@ -52,7 +52,7 @@ private:
/*
* Creates the color table
- * Sets colorCount to the new color count if it is non-NULL
+ * Sets colorCount to the new color count if it is non-nullptr
*/
bool createColorTable(SkAlphaType alphaType, int* colorCount);
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 76abcda421..d12de21f51 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -38,17 +38,17 @@ static const DecoderProc gDecoderProcs[] = {
SkCodec* SkCodec::NewFromStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkAutoTDelete<SkCodec> codec(NULL);
+ SkAutoTDelete<SkCodec> codec(nullptr);
for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) {
DecoderProc proc = gDecoderProcs[i];
const bool correctFormat = proc.IsFormat(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (correctFormat) {
codec.reset(proc.NewFromStream(streamDeleter.detach()));
@@ -62,7 +62,7 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream) {
const int32_t maxSize = 1 << 27;
if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
SkCodecPrintf("Error: Image size too large, cannot decode.\n");
- return NULL;
+ return nullptr;
} else {
return codec.detach();
}
@@ -70,7 +70,7 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream) {
SkCodec* SkCodec::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
@@ -104,7 +104,7 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
if (kUnknown_SkColorType == info.colorType()) {
return kInvalidConversion;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return kInvalidParameters;
}
if (rowBytes < info.minRowBytes()) {
@@ -112,15 +112,15 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
}
if (kIndex_8_SkColorType == info.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return kInvalidParameters;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
{
@@ -134,7 +134,7 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
// Default options.
Options optsStorage;
- if (NULL == options) {
+ if (nullptr == options) {
options = &optsStorage;
}
const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount);
@@ -146,5 +146,5 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
}
SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
- return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL);
+ return this->getPixels(info, pixels, rowBytes, nullptr, nullptr, nullptr);
}
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 450457f630..9a28cfdda1 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -82,10 +82,10 @@ static bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src)
}
/*
- * If there is a color table, get a pointer to the colors, otherwise return NULL
+ * If there is a color table, get a pointer to the colors, otherwise return nullptr
*/
static const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
- return NULL != colorTable ? colorTable->readColors() : NULL;
+ return nullptr != colorTable ? colorTable->readColors() : nullptr;
}
/*
@@ -95,9 +95,9 @@ static const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* colorTable,
SkPMColor* inputColorPtr, int* inputColorCount) {
if (kIndex_8_SkColorType == dstInfo.colorType()) {
- SkASSERT(NULL != inputColorPtr);
- SkASSERT(NULL != inputColorCount);
- SkASSERT(NULL != colorTable);
+ SkASSERT(nullptr != inputColorPtr);
+ SkASSERT(nullptr != inputColorCount);
+ SkASSERT(nullptr != colorTable);
memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4);
}
}
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 40d159ac22..250a0d63be 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -59,7 +59,7 @@ static int32_t read_bytes_callback(GifFileType* fileType, GifByteType* out,
* Open the gif file
*/
static GifFileType* open_gif(SkStream* stream) {
- return DGifOpen(stream, read_bytes_callback, NULL);
+ return DGifOpen(stream, read_bytes_callback, nullptr);
}
/*
@@ -67,7 +67,7 @@ static GifFileType* open_gif(SkStream* stream) {
* It is used in a SkAutoTCallIProc template
*/
void SkGifCodec::CloseGif(GifFileType* gif) {
- DGifCloseFile(gif, NULL);
+ DGifCloseFile(gif, nullptr);
}
/*
@@ -75,7 +75,7 @@ void SkGifCodec::CloseGif(GifFileType* gif) {
* decoder
*/
void SkGifCodec::FreeExtension(SavedImage* image) {
- if (NULL != image->ExtensionBlocks) {
+ if (nullptr != image->ExtensionBlocks) {
GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks);
}
}
@@ -123,12 +123,12 @@ static uint32_t find_trans_index(const SavedImage& image) {
* Returns a bool representing success or failure.
*
* @param codecOut
- * If it returned true, and codecOut was not NULL,
+ * If it returned true, and codecOut was not nullptr,
* codecOut will be set to a new SkGifCodec.
*
* @param gifOut
- * If it returned true, and codecOut was NULL,
- * gifOut must be non-NULL and gifOut will be set to a new
+ * If it returned true, and codecOut was nullptr,
+ * gifOut must be non-nullptr and gifOut will be set to a new
* GifFileType pointer.
*
* @param stream
@@ -143,12 +143,12 @@ bool SkGifCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType**
// Read gif header, logical screen descriptor, and global color table
SkAutoTCallVProc<GifFileType, CloseGif> gif(open_gif(stream));
- if (NULL == gif) {
+ if (nullptr == gif) {
gif_error("DGifOpen failed.\n");
return false;
}
- if (NULL != codecOut) {
+ if (nullptr != codecOut) {
// Get fields from header
const int32_t width = gif->SWidth;
const int32_t height = gif->SHeight;
@@ -172,7 +172,7 @@ bool SkGifCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType**
kIndex_8_SkColorType, kPremul_SkAlphaType);
*codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach());
} else {
- SkASSERT(NULL != gifOut);
+ SkASSERT(nullptr != gifOut);
streamDeleter.detach();
*gifOut = gif.detach();
}
@@ -185,11 +185,11 @@ bool SkGifCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType**
* Reads enough of the stream to determine the image format
*/
SkCodec* SkGifCodec::NewFromStream(SkStream* stream) {
- SkCodec* codec = NULL;
- if (ReadHeader(stream, &codec, NULL)) {
+ SkCodec* codec = nullptr;
+ if (ReadHeader(stream, &codec, nullptr)) {
return codec;
}
- return NULL;
+ return nullptr;
}
SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream,
@@ -199,12 +199,12 @@ SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream,
{}
bool SkGifCodec::onRewind() {
- GifFileType* gifOut = NULL;
- if (!ReadHeader(this->stream(), NULL, &gifOut)) {
+ GifFileType* gifOut = nullptr;
+ if (!ReadHeader(this->stream(), nullptr, &gifOut)) {
return false;
}
- SkASSERT(NULL != gifOut);
+ SkASSERT(nullptr != gifOut);
fGif.reset(gifOut);
return true;
}
@@ -239,7 +239,7 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
// blocks. This generally stores transparency and animation instructions.
SavedImage saveExt;
SkAutoTCallVProc<SavedImage, FreeExtension> autoFreeExt(&saveExt);
- saveExt.ExtensionBlocks = NULL;
+ saveExt.ExtensionBlocks = nullptr;
saveExt.ExtensionBlockCount = 0;
GifByteType* extData;
int32_t extFunction;
@@ -309,8 +309,8 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
SkPMColor* colorTable;
SkColorType dstColorType = dstInfo.colorType();
if (kIndex_8_SkColorType == dstColorType) {
- SkASSERT(NULL != inputColorPtr);
- SkASSERT(NULL != inputColorCount);
+ SkASSERT(nullptr != inputColorPtr);
+ SkASSERT(nullptr != inputColorCount);
colorTable = inputColorPtr;
} else {
colorTable = alternateColorPtr;
@@ -322,10 +322,10 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
const uint32_t maxColors = 256;
ColorMapObject* colorMap = fGif->Image.ColorMap;
// If there is no local color table, use the global color table
- if (NULL == colorMap) {
+ if (nullptr == colorMap) {
colorMap = fGif->SColorMap;
}
- if (NULL != colorMap) {
+ if (nullptr != colorMap) {
colorCount = colorMap->ColorCount;
SkASSERT(colorCount ==
(unsigned) (1 << (colorMap->BitsPerPixel)));
@@ -380,7 +380,7 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
}
// Check if image is only a subset of the image frame
- SkAutoTDelete<SkSwizzler> swizzler(NULL);
+ SkAutoTDelete<SkSwizzler> swizzler(nullptr);
if (innerWidth < width || innerHeight < height) {
// Modify the destination info
@@ -497,7 +497,7 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
}
// Create an extension block with our data
- while (NULL != extData) {
+ while (nullptr != extData) {
// Add a single block
if (GIF_ERROR ==
GifAddExtensionBlock(&saveExt.ExtensionBlockCount,
diff --git a/src/codec/SkCodec_libgif.h b/src/codec/SkCodec_libgif.h
index 109020b5cf..df01088951 100644
--- a/src/codec/SkCodec_libgif.h
+++ b/src/codec/SkCodec_libgif.h
@@ -38,12 +38,12 @@ protected:
* Returns a bool representing success or failure.
*
* @param codecOut
- * If it returned true, and codecOut was not NULL,
+ * If it returned true, and codecOut was not nullptr,
* codecOut will be set to a new SkGifCodec.
*
* @param gifOut
- * If it returned true, and codecOut was NULL,
- * gifOut must be non-NULL and gifOut will be set to a new
+ * If it returned true, and codecOut was nullptr,
+ * gifOut must be non-nullptr and gifOut will be set to a new
* GifFileType pointer.
*
* @param stream
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
index e8e6531a06..6f343369c4 100644
--- a/src/codec/SkCodec_libico.cpp
+++ b/src/codec/SkCodec_libico.cpp
@@ -45,14 +45,14 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
if (inputStream.get()->read(dirBuffer.get(), kIcoDirectoryBytes) !=
kIcoDirectoryBytes) {
SkCodecPrintf("Error: unable to read ico directory header.\n");
- return NULL;
+ return nullptr;
}
// Process the directory header
const uint16_t numImages = get_short(dirBuffer.get(), 4);
if (0 == numImages) {
SkCodecPrintf("Error: No images embedded in ico.\n");
- return NULL;
+ return nullptr;
}
// Ensure that we can read all of indicated directory entries
@@ -60,7 +60,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
if (inputStream.get()->read(entryBuffer.get(), numImages*kIcoDirEntryBytes) !=
numImages*kIcoDirEntryBytes) {
SkCodecPrintf("Error: unable to read ico directory entries.\n");
- return NULL;
+ return nullptr;
}
// This structure is used to represent the vital information about entries
@@ -131,7 +131,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
// Create a new stream for the embedded codec
SkAutoTUnref<SkData> data(
SkData::NewFromStream(inputStream.get(), size));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
SkCodecPrintf("Warning: could not create embedded stream.\n");
break;
}
@@ -141,7 +141,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
// Check if the embedded codec is bmp or png and create the codec
const bool isPng = SkPngCodec::IsPng(embeddedStream);
SkAssertResult(embeddedStream->rewind());
- SkCodec* codec = NULL;
+ SkCodec* codec = nullptr;
if (isPng) {
codec = SkPngCodec::NewFromStream(embeddedStream.detach());
} else {
@@ -149,7 +149,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
}
// Save a valid codec
- if (NULL != codec) {
+ if (nullptr != codec) {
codecs->push_back().reset(codec);
}
}
@@ -157,7 +157,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
// Recognize if there are no valid codecs
if (0 == codecs->count()) {
SkCodecPrintf("Error: could not find any valid embedded ico codecs.\n");
- return NULL;
+ return nullptr;
}
// Use the largest codec as a "suggestion" for image info
@@ -195,7 +195,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
*/
SkIcoCodec::SkIcoCodec(const SkImageInfo& info,
SkTArray<SkAutoTDelete<SkCodec>, true>* codecs)
- : INHERITED(info, NULL)
+ : INHERITED(info, nullptr)
, fEmbeddedCodecs(codecs)
{}
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 31a4d2e711..2e543424b1 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -27,19 +27,19 @@
/* These were dropped in libpng >= 1.4 */
#ifndef png_infopp_NULL
- #define png_infopp_NULL NULL
+ #define png_infopp_NULL nullptr
#endif
#ifndef png_bytepp_NULL
- #define png_bytepp_NULL NULL
+ #define png_bytepp_NULL nullptr
#endif
#ifndef int_p_NULL
- #define int_p_NULL NULL
+ #define int_p_NULL nullptr
#endif
#ifndef png_flush_ptr_NULL
- #define png_flush_ptr_NULL NULL
+ #define png_flush_ptr_NULL nullptr
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -75,24 +75,24 @@ class AutoCleanPng : public SkNoncopyable {
public:
AutoCleanPng(png_structp png_ptr)
: fPng_ptr(png_ptr)
- , fInfo_ptr(NULL) {}
+ , fInfo_ptr(nullptr) {}
~AutoCleanPng() {
- // fInfo_ptr will never be non-NULL unless fPng_ptr is.
+ // fInfo_ptr will never be non-nullptr unless fPng_ptr is.
if (fPng_ptr) {
- png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : NULL;
+ png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : nullptr;
png_destroy_read_struct(&fPng_ptr, info_pp, png_infopp_NULL);
}
}
void setInfoPtr(png_infop info_ptr) {
- SkASSERT(NULL == fInfo_ptr);
+ SkASSERT(nullptr == fInfo_ptr);
fInfo_ptr = info_ptr;
}
void detach() {
- fPng_ptr = NULL;
- fInfo_ptr = NULL;
+ fPng_ptr = nullptr;
+ fInfo_ptr = nullptr;
}
private:
@@ -111,7 +111,7 @@ static bool has_transparency_in_tRNS(png_structp png_ptr,
png_bytep trans;
int num_trans;
- png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
+ png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, nullptr);
return num_trans > 0;
}
@@ -136,7 +136,7 @@ bool SkPngCodec::decodePalette(bool premultiply, int* ctableCount) {
int numTrans;
if (png_get_valid(fPng_ptr, fInfo_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(fPng_ptr, fInfo_ptr, &trans, &numTrans, NULL);
+ png_get_tRNS(fPng_ptr, fInfo_ptr, &trans, &numTrans, nullptr);
} else {
numTrans = 0;
}
@@ -185,7 +185,7 @@ bool SkPngCodec::decodePalette(bool premultiply, int* ctableCount) {
}
// Set the new color count
- if (ctableCount != NULL) {
+ if (ctableCount != nullptr) {
*ctableCount = colorCount;
}
@@ -210,7 +210,7 @@ bool SkPngCodec::IsPng(SkStream* stream) {
return true;
}
-// Reads the header, and initializes the passed in fields, if not NULL (except
+// Reads the header, and initializes the passed in fields, if not nullptr (except
// stream, which is passed to the read function).
// Returns true on success, in which case the caller is responsible for calling
// png_destroy_read_struct. If it returns false, the passed in fields (except
@@ -218,7 +218,7 @@ bool SkPngCodec::IsPng(SkStream* stream) {
static bool read_header(SkStream* stream, png_structp* png_ptrp,
png_infop* info_ptrp, SkImageInfo* imageInfo, int* bitDepthPtr) {
// The image is known to be a PNG. Decode enough to know the SkImageInfo.
- png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
+ png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr,
sk_error_fn, sk_warning_fn);
if (!png_ptr) {
return false;
@@ -227,7 +227,7 @@ static bool read_header(SkStream* stream, png_structp* png_ptrp,
AutoCleanPng autoClean(png_ptr);
png_infop info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
+ if (info_ptr == nullptr) {
return false;
}
@@ -358,7 +358,7 @@ SkCodec* SkPngCodec::NewFromStream(SkStream* stream) {
if (read_header(stream, &png_ptr, &info_ptr, &imageInfo, &bitDepth)) {
return new SkPngCodec(imageInfo, streamDeleter.detach(), png_ptr, info_ptr, bitDepth);
}
- return NULL;
+ return nullptr;
}
#define INVALID_NUMBER_PASSES -1
@@ -379,11 +379,11 @@ SkPngCodec::~SkPngCodec() {
void SkPngCodec::destroyReadStruct() {
if (fPng_ptr) {
- // We will never have a NULL fInfo_ptr with a non-NULL fPng_ptr
+ // We will never have a nullptr fInfo_ptr with a non-nullptr fPng_ptr
SkASSERT(fInfo_ptr);
png_destroy_read_struct(&fPng_ptr, &fInfo_ptr, png_infopp_NULL);
- fPng_ptr = NULL;
- fInfo_ptr = NULL;
+ fPng_ptr = nullptr;
+ fInfo_ptr = nullptr;
}
}
@@ -450,16 +450,16 @@ SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo,
bool SkPngCodec::onRewind() {
- // This sets fPng_ptr and fInfo_ptr to NULL. If read_header
+ // This sets fPng_ptr and fInfo_ptr to nullptr. If read_header
// succeeds, they will be repopulated, and if it fails, they will
- // remain NULL. Any future accesses to fPng_ptr and fInfo_ptr will
+ // remain nullptr. Any future accesses to fPng_ptr and fInfo_ptr will
// come through this function which will rewind and again attempt
// to reinitialize them.
this->destroyReadStruct();
png_structp png_ptr;
png_infop info_ptr;
- if (!read_header(this->stream(), &png_ptr, &info_ptr, NULL, NULL)) {
+ if (!read_header(this->stream(), &png_ptr, &info_ptr, nullptr, nullptr)) {
return false;
}
@@ -771,7 +771,7 @@ private:
SkScanlineDecoder* SkPngCodec::NewSDFromStream(SkStream* stream) {
SkAutoTDelete<SkPngCodec> codec (static_cast<SkPngCodec*>(SkPngCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
codec->fNumberPasses = png_set_interlace_handling(codec->fPng_ptr);
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 16cdbeaa72..22f2bacce0 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -68,7 +68,7 @@ static bool read_header(SkStream* stream, SkISize* size) {
}
bool SkWbmpCodec::onRewind() {
- return read_header(this->stream(), NULL);
+ return read_header(this->stream(), nullptr);
}
SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
@@ -82,7 +82,7 @@ SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized,
this->getInfo());
default:
- return NULL;
+ return nullptr;
}
}
@@ -129,7 +129,7 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
// Initialize the swizzler
SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
- if (NULL == swizzler.get()) {
+ if (nullptr == swizzler.get()) {
return kInvalidConversion;
}
@@ -149,14 +149,14 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
}
bool SkWbmpCodec::IsWbmp(SkStream* stream) {
- return read_header(stream, NULL);
+ return read_header(stream, nullptr);
}
SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
SkAutoTDelete<SkStream> streamDeleter(stream);
SkISize size;
if (!read_header(stream, &size)) {
- return NULL;
+ return nullptr;
}
SkImageInfo info = SkImageInfo::Make(size.width(), size.height(),
kGray_8_SkColorType, kOpaque_SkAlphaType);
@@ -171,8 +171,8 @@ public:
SkWbmpScanlineDecoder(SkWbmpCodec* codec)
: INHERITED(codec->getInfo())
, fCodec(codec)
- , fColorTable(NULL)
- , fSwizzler(NULL)
+ , fColorTable(nullptr)
+ , fSwizzler(nullptr)
, fSrcBuffer(codec->fSrcRowBytes)
{}
@@ -220,7 +220,7 @@ public:
// Initialize the swizzler
fSwizzler.reset(fCodec->initializeSwizzler(dstInfo,
get_color_ptr(fColorTable.get()), options));
- if (NULL == fSwizzler.get()) {
+ if (nullptr == fSwizzler.get()) {
return SkCodec::kInvalidConversion;
}
@@ -244,7 +244,7 @@ SkScanlineDecoder* SkWbmpCodec::NewSDFromStream(SkStream* stream) {
SkAutoTDelete<SkWbmpCodec> codec(static_cast<SkWbmpCodec*>(
SkWbmpCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
// Return the new scanline decoder
diff --git a/src/codec/SkCodec_wbmp.h b/src/codec/SkCodec_wbmp.h
index 8c5466105c..0891eb86b9 100644
--- a/src/codec/SkCodec_wbmp.h
+++ b/src/codec/SkCodec_wbmp.h
@@ -36,7 +36,7 @@ protected:
bool onRewind() override;
private:
/*
- * Returns a swizzler on success, NULL on failure
+ * Returns a swizzler on success, nullptr on failure
*/
SkSwizzler* initializeSwizzler(const SkImageInfo& info, const SkPMColor* ctable,
const Options& opts);
diff --git a/src/codec/SkGifInterlaceIter.cpp b/src/codec/SkGifInterlaceIter.cpp
index 268a142e86..3a87f6950d 100644
--- a/src/codec/SkGifInterlaceIter.cpp
+++ b/src/codec/SkGifInterlaceIter.cpp
@@ -28,8 +28,8 @@ void SkGifInterlaceIter::prepareY() {
SK_ARRAY_COUNT(kStartingInterlaceYValues) == fStartYPtr) {
// Now we have iterated over the entire image. Forbid any
// subsequent calls to nextY().
- SkDEBUGCODE(fStartYPtr = NULL;)
- SkDEBUGCODE(fDeltaYPtr = NULL;)
+ SkDEBUGCODE(fStartYPtr = nullptr;)
+ SkDEBUGCODE(fDeltaYPtr = nullptr;)
y = 0;
} else {
y = *fStartYPtr++;
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 4988dca3c0..ed3944cc42 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -116,7 +116,7 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
return decoderMgr->returnFalse("read_header");
}
- if (NULL != codecOut) {
+ if (nullptr != codecOut) {
// Recommend the color type to decode to
const SkColorType colorType = decoderMgr->getColorType();
@@ -125,7 +125,7 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType);
*codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.detach());
} else {
- SkASSERT(NULL != decoderMgrOut);
+ SkASSERT(nullptr != decoderMgrOut);
*decoderMgrOut = decoderMgr.detach();
}
return true;
@@ -133,14 +133,14 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkCodec* codec = NULL;
- if (ReadHeader(stream, &codec, NULL)) {
+ SkCodec* codec = nullptr;
+ if (ReadHeader(stream, &codec, nullptr)) {
// Codec has taken ownership of the stream, we do not need to delete it
SkASSERT(codec);
streamDeleter.detach();
return codec;
}
- return NULL;
+ return nullptr;
}
SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream,
@@ -199,11 +199,11 @@ SkISize SkJpegCodec::onGetScaledDimensions(float desiredScale) const {
}
bool SkJpegCodec::onRewind() {
- JpegDecoderMgr* decoderMgr = NULL;
- if (!ReadHeader(this->stream(), NULL, &decoderMgr)) {
+ JpegDecoderMgr* decoderMgr = nullptr;
+ if (!ReadHeader(this->stream(), nullptr, &decoderMgr)) {
return fDecoderMgr->returnFalse("could not rewind");
}
- SkASSERT(NULL != decoderMgr);
+ SkASSERT(nullptr != decoderMgr);
fDecoderMgr.reset(decoderMgr);
return true;
}
@@ -358,7 +358,7 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
if (kNo_ZeroInitialized == options.fZeroInitialized ||
kN32_SkColorType == dstInfo.colorType()) {
SkSwizzler::Fill(dstRow, dstInfo, dstRowBytes, dstHeight - y,
- SK_ColorBLACK, NULL);
+ SK_ColorBLACK, nullptr);
}
// Prevent libjpeg from failing on incomplete decode
@@ -425,7 +425,7 @@ public:
SkASSERT(false);
}
- fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, NULL, info, options.fZeroInitialized,
+ fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, info, options.fZeroInitialized,
this->getInfo()));
if (!fSwizzler) {
// FIXME: CreateSwizzler could fail for another reason.
@@ -469,8 +469,8 @@ public:
fStorage.reset(get_row_bytes(fCodec->fDecoderMgr->dinfo()));
fSrcRow = static_cast<uint8_t*>(fStorage.get());
} else {
- fSrcRow = NULL;
- fSwizzler.reset(NULL);
+ fSrcRow = nullptr;
+ fSwizzler.reset(nullptr);
}
// Now, given valid output dimensions, we can start the decompress
@@ -519,7 +519,7 @@ public:
if (SkCodec::kNo_ZeroInitialized == fOpts.fZeroInitialized ||
kN32_SkColorType == this->dstInfo().colorType()) {
SkSwizzler::Fill(dstRow, this->dstInfo(), rowBytes,
- count - y, SK_ColorBLACK, NULL);
+ count - y, SK_ColorBLACK, nullptr);
}
fCodec->fDecoderMgr->dinfo()->output_scanline = this->dstInfo().height();
return SkCodec::kIncompleteInput;
@@ -580,7 +580,7 @@ private:
SkScanlineDecoder* SkJpegCodec::NewSDFromStream(SkStream* stream) {
SkAutoTDelete<SkJpegCodec> codec(static_cast<SkJpegCodec*>(SkJpegCodec::NewFromStream(stream)));
if (!codec) {
- return NULL;
+ return nullptr;
}
const SkImageInfo& srcInfo = codec->getInfo();
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h
index fac7d96075..ce4fe56d58 100644
--- a/src/codec/SkJpegCodec.h
+++ b/src/codec/SkJpegCodec.h
@@ -74,12 +74,12 @@ private:
* Returns a bool representing success or failure.
*
* @param codecOut
- * If this returns true, and codecOut was not NULL,
+ * If this returns true, and codecOut was not nullptr,
* codecOut will be set to a new SkJpegCodec.
*
* @param decoderMgrOut
- * If this returns true, and codecOut was NULL,
- * decoderMgrOut must be non-NULL and decoderMgrOut will be set to a new
+ * If this returns true, and codecOut was nullptr,
+ * decoderMgrOut must be non-nullptr and decoderMgrOut will be set to a new
* JpegDecoderMgr pointer.
*
* @param stream
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 95f3627a17..58be0c67af 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -225,7 +225,7 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
const SkImageInfo& info, SkMasks* masks, uint32_t bitsPerPixel) {
// Choose the appropriate row procedure
- RowProc proc = NULL;
+ RowProc proc = nullptr;
switch (bitsPerPixel) {
case 16:
switch (info.colorType()) {
@@ -319,7 +319,7 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
break;
default:
SkASSERT(false);
- return NULL;
+ return nullptr;
}
return new SkMaskSwizzler(info, masks, proc);
}
@@ -342,6 +342,6 @@ SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks,
*
*/
SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
- SkASSERT(NULL != dst && NULL != src);
+ SkASSERT(nullptr != dst && nullptr != src);
return fRowProc(dst, src, fDstInfo.width(), fMasks);
}
diff --git a/src/codec/SkMasks.cpp b/src/codec/SkMasks.cpp
index b136c59edc..b8603148b9 100644
--- a/src/codec/SkMasks.cpp
+++ b/src/codec/SkMasks.cpp
@@ -139,7 +139,7 @@ SkMasks* SkMasks::CreateMasks(InputMasks masks, uint32_t bitsPerPixel) {
if (((masks.red & masks.green) | (masks.red & masks.blue) |
(masks.red & masks.alpha) | (masks.green & masks.blue) |
(masks.green & masks.alpha) | (masks.blue & masks.alpha)) != 0) {
- return NULL;
+ return nullptr;
}
// Collect information about the masks
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index bf09b4beca..7ff279c217 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -14,7 +14,7 @@
SkCodec* SkScaledCodec::NewFromStream(SkStream* stream) {
bool isWebp = SkWebpCodec::IsWebp(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (isWebp) {
// Webp codec supports scaling and subsetting natively
@@ -22,8 +22,8 @@ SkCodec* SkScaledCodec::NewFromStream(SkStream* stream) {
}
SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(SkScanlineDecoder::NewFromStream(stream));
- if (NULL == scanlineDecoder) {
- return NULL;
+ if (nullptr == scanlineDecoder) {
+ return nullptr;
}
// wrap in new SkScaledCodec
@@ -32,13 +32,13 @@ SkCodec* SkScaledCodec::NewFromStream(SkStream* stream) {
SkCodec* SkScaledCodec::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
SkScaledCodec::SkScaledCodec(SkScanlineDecoder* scanlineDecoder)
- : INHERITED(scanlineDecoder->getInfo(), NULL)
+ : INHERITED(scanlineDecoder->getInfo(), nullptr)
, fScanlineDecoder(scanlineDecoder)
{}
diff --git a/src/codec/SkScanlineDecoder.cpp b/src/codec/SkScanlineDecoder.cpp
index 5c94a6d381..859956f5de 100644
--- a/src/codec/SkScanlineDecoder.cpp
+++ b/src/codec/SkScanlineDecoder.cpp
@@ -28,17 +28,17 @@ static const DecoderProc gDecoderProcs[] = {
SkScanlineDecoder* SkScanlineDecoder::NewFromStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStream> streamDeleter(stream);
- SkAutoTDelete<SkScanlineDecoder> codec(NULL);
+ SkAutoTDelete<SkScanlineDecoder> codec(nullptr);
for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) {
DecoderProc proc = gDecoderProcs[i];
const bool correctFormat = proc.IsFormat(stream);
if (!stream->rewind()) {
- return NULL;
+ return nullptr;
}
if (correctFormat) {
codec.reset(proc.NewFromStream(streamDeleter.detach()));
@@ -52,7 +52,7 @@ SkScanlineDecoder* SkScanlineDecoder::NewFromStream(SkStream* stream) {
const int32_t maxSize = 1 << 27;
if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
SkCodecPrintf("Error: Image size too large, cannot decode.\n");
- return NULL;
+ return nullptr;
} else {
return codec.detach();
}
@@ -60,7 +60,7 @@ SkScanlineDecoder* SkScanlineDecoder::NewFromStream(SkStream* stream) {
SkScanlineDecoder* SkScanlineDecoder::NewFromData(SkData* data) {
if (!data) {
- return NULL;
+ return nullptr;
}
return NewFromStream(new SkMemoryStream(data));
}
@@ -70,20 +70,20 @@ SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo,
const SkCodec::Options* options, SkPMColor ctable[], int* ctableCount) {
// Ensure that valid color ptrs are passed in for kIndex8 color type
if (kIndex_8_SkColorType == dstInfo.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return SkCodec::kInvalidParameters;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
// Set options.
SkCodec::Options optsStorage;
- if (NULL == options) {
+ if (nullptr == options) {
options = &optsStorage;
}
@@ -98,6 +98,6 @@ SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo,
}
SkCodec::Result SkScanlineDecoder::start(const SkImageInfo& dstInfo) {
- return this->start(dstInfo, NULL, NULL, NULL);
+ return this->start(dstInfo, nullptr, nullptr, nullptr);
}
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index db49fb17d9..54d9764fe8 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -517,13 +517,13 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
SkCodec::ZeroInitialized zeroInit,
const SkImageInfo& srcInfo) {
if (dstInfo.colorType() == kUnknown_SkColorType || kUnknown == sc) {
- return NULL;
+ return nullptr;
}
if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc)
- && NULL == ctable) {
- return NULL;
+ && nullptr == ctable) {
+ return nullptr;
}
- RowProc proc = NULL;
+ RowProc proc = nullptr;
switch (sc) {
case kBit:
@@ -679,8 +679,8 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
default:
break;
}
- if (NULL == proc) {
- return NULL;
+ if (nullptr == proc) {
+ return nullptr;
}
// Store deltaSrc in bytes if it is an even multiple, otherwise use bits
@@ -688,7 +688,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
// get sampleX based on srcInfo and dstInfo dimensions
int sampleX;
- SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL);
+ SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, nullptr);
return new SkSwizzler(proc, ctable, deltaSrc, dstInfo, sampleX);
}
@@ -707,13 +707,13 @@ SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable,
}
SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
- SkASSERT(NULL != dst && NULL != src);
+ SkASSERT(nullptr != dst && nullptr != src);
return fRowProc(dst, src, fDstInfo.width(), fSampleX * fDeltaSrc, fX0 * fDeltaSrc, fColorTable);
}
void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRowBytes,
uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable) {
- SkASSERT(dstStartRow != NULL);
+ SkASSERT(dstStartRow != nullptr);
SkASSERT(numRows <= (uint32_t) dstInfo.height());
// Calculate bytes to fill. We use getSafeSize since the last row may not be padded.
@@ -724,7 +724,7 @@ void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstR
case kN32_SkColorType:
// Assume input is an index if we have a color table
uint32_t color;
- if (NULL != colorTable) {
+ if (nullptr != colorTable) {
SkASSERT(colorOrIndex == (uint8_t) colorOrIndex);
color = colorTable[colorOrIndex];
// Otherwise, assume the input is a color
diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h
index b7132ce6d5..3d57205997 100644
--- a/src/codec/SkSwizzler.h
+++ b/src/codec/SkSwizzler.h
@@ -128,7 +128,7 @@ public:
Sampling in Y can be done by a client with a scanline decoder,
but sampling in X allows the swizzler to skip swizzling pixels and
reading from and writing to memory.
- * @return A new SkSwizzler or NULL on failure.
+ * @return A new SkSwizzler or nullptr on failure.
*/
static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
const SkImageInfo& dstInfo, SkCodec::ZeroInitialized,
@@ -149,13 +149,13 @@ public:
* index.
*
* If dstInfo.colorType() is kN32, colorOrIndex is treated differently depending on
- * whether colorTable is NULL:
+ * whether colorTable is nullptr:
*
- * A NULL colorTable means colorOrIndex is treated as an SkPMColor (premul or
+ * A nullptr colorTable means colorOrIndex is treated as an SkPMColor (premul or
* unpremul, depending on dstInfo.alphaType()). Each 4-byte pixel will be set to
* colorOrIndex.
- * A non-NULL colorTable means colorOrIndex is treated as a uint8_t index into
+ * A non-nullptr colorTable means colorOrIndex is treated as a uint8_t index into
* the colorTable. i.e. each 4-byte pixel will be set to
* colorTable[(uint8_t) colorOrIndex].
*
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index e17aa7e9cc..ccf49649ed 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -79,7 +79,7 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
if (webp_parse_header(stream, &info)) {
return new SkWebpCodec(info, streamDeleter.detach());
}
- return NULL;
+ return nullptr;
}
// This version is slightly different from SkCodecPriv's version of conversion_possible. It
@@ -221,7 +221,7 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
config.output.u.RGBA.size = dstInfo.getSafeSize(rowBytes);
config.output.is_external_memory = 1;
- SkAutoTCallVProc<WebPIDecoder, WebPIDelete> idec(WebPIDecode(NULL, 0, &config));
+ SkAutoTCallVProc<WebPIDecoder, WebPIDelete> idec(WebPIDecode(nullptr, 0, &config));
if (!idec) {
return kInvalidInput;
}
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 902b87a6c7..bbd1f555f0 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -136,9 +136,9 @@ SkAAClip::Iter::Iter(const SkAAClip& clip) {
if (clip.isEmpty()) {
fDone = true;
fTop = fBottom = clip.fBounds.fBottom;
- fData = NULL;
- fCurrYOff = NULL;
- fStopYOff = NULL;
+ fData = nullptr;
+ fCurrYOff = nullptr;
+ fStopYOff = nullptr;
return;
}
@@ -163,7 +163,7 @@ void SkAAClip::Iter::next() {
if (curr >= fStopYOff) {
fDone = true;
fBottom = kMaxInt32;
- fData = NULL;
+ fData = nullptr;
} else {
fBottom += curr->fY - prev->fY;
fData += curr->fOffset - prev->fOffset;
@@ -188,7 +188,7 @@ static size_t compute_row_length(const uint8_t row[], int width) {
}
void SkAAClip::validate() const {
- if (NULL == fRunHead) {
+ if (nullptr == fRunHead) {
SkASSERT(fBounds.isEmpty());
return;
}
@@ -625,12 +625,12 @@ void SkAAClip::freeRuns() {
SkAAClip::SkAAClip() {
fBounds.setEmpty();
- fRunHead = NULL;
+ fRunHead = nullptr;
}
SkAAClip::SkAAClip(const SkAAClip& src) {
SkDEBUGCODE(fBounds.setEmpty();) // need this for validate
- fRunHead = NULL;
+ fRunHead = nullptr;
*this = src;
}
@@ -698,7 +698,7 @@ bool SkAAClip::set(const SkAAClip& src) {
bool SkAAClip::setEmpty() {
this->freeRuns();
fBounds.setEmpty();
- fRunHead = NULL;
+ fRunHead = nullptr;
return false;
}
@@ -763,7 +763,7 @@ bool SkAAClip::setRect(const SkRect& r, bool doAA) {
SkPath path;
path.addRect(r);
- return this->setPath(path, NULL, doAA);
+ return this->setPath(path, nullptr, doAA);
}
static void append_run(SkTDArray<uint8_t>& array, uint8_t value, int count) {
@@ -810,7 +810,7 @@ bool SkAAClip::setRegion(const SkRegion& rgn) {
SkRegion::Iterator iter(rgn);
int prevRight = 0;
int prevBot = 0;
- YOffset* currY = NULL;
+ YOffset* currY = nullptr;
for (; !iter.done(); iter.next()) {
const SkIRect& r = iter.rect();
@@ -869,7 +869,7 @@ const uint8_t* SkAAClip::findRow(int y, int* lastYForRow) const {
SkASSERT(fRunHead);
if (!y_in_rect(y, fBounds)) {
- return NULL;
+ return nullptr;
}
y -= fBounds.y(); // our yoffs values are relative to the top
@@ -960,7 +960,7 @@ public:
Builder(const SkIRect& bounds) : fBounds(bounds) {
fPrevY = -1;
fWidth = bounds.width();
- fCurrRow = NULL;
+ fCurrRow = nullptr;
fMinY = bounds.fTop;
}
@@ -1181,7 +1181,7 @@ private:
}
Row* flushRow(bool readyForAnother) {
- Row* next = NULL;
+ Row* next = nullptr;
int count = fRows.count();
if (count > 0) {
this->flushRowH(&fRows[count - 1]);
@@ -1298,7 +1298,7 @@ public:
{ unexpected(); }
const SkPixmap* justAnOpaqueColor(uint32_t*) override {
- return NULL;
+ return nullptr;
}
void blitH(int x, int y, int width) override {
@@ -1381,7 +1381,7 @@ bool SkAAClip::setPath(const SkPath& path, const SkRegion* clip, bool doAA) {
path.getBounds().roundOut(&ibounds);
SkRegion tmpClip;
- if (NULL == clip) {
+ if (nullptr == clip) {
tmpClip.setRect(ibounds);
clip = &tmpClip;
}
@@ -1608,8 +1608,8 @@ static void operateY(SkAAClip::Builder& builder, const SkAAClip& A,
int botB = iterB.bottom();
do {
- const uint8_t* rowA = NULL;
- const uint8_t* rowB = NULL;
+ const uint8_t* rowA = nullptr;
+ const uint8_t* rowB = nullptr;
int top, bot;
if (topA < topB) {
@@ -1803,7 +1803,7 @@ bool SkAAClip::op(const SkAAClip& clip, SkRegion::Op op) {
///////////////////////////////////////////////////////////////////////////////
bool SkAAClip::translate(int dx, int dy, SkAAClip* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return !this->isEmpty();
}
@@ -1839,7 +1839,7 @@ void SkAAClip::copyToMask(SkMask* mask) const {
mask->fFormat = SkMask::kA8_Format;
if (this->isEmpty()) {
mask->fBounds.setEmpty();
- mask->fImage = NULL;
+ mask->fImage = nullptr;
mask->fRowBytes = 0;
return;
}
@@ -1898,7 +1898,7 @@ SkAAClipBlitter::~SkAAClipBlitter() {
}
void SkAAClipBlitter::ensureRunsAndAA() {
- if (NULL == fScanlineScratch) {
+ if (nullptr == fScanlineScratch) {
// add 1 so we can store the terminating run count of 0
int count = fAAClipBounds.width() + 1;
// we use this either for fRuns + fAA, or a scaline of a mask
@@ -2092,7 +2092,7 @@ static MergeAAProc find_merge_aa_proc(SkMask::Format format) {
switch (format) {
case SkMask::kBW_Format:
SkDEBUGFAIL("unsupported");
- return NULL;
+ return nullptr;
case SkMask::kA8_Format:
case SkMask::k3D_Format: {
void (*proc8)(const uint8_t*, int, const uint8_t*, int, uint8_t*) = mergeT;
@@ -2104,7 +2104,7 @@ static MergeAAProc find_merge_aa_proc(SkMask::Format format) {
}
default:
SkDEBUGFAIL("unsupported");
- return NULL;
+ return nullptr;
}
}
@@ -2168,7 +2168,7 @@ void SkAAClipBlitter::blitMask(const SkMask& origMask, const SkIRect& clip) {
// if we're BW, we need to upscale to A8 (ugh)
SkMask grayMask;
- grayMask.fImage = NULL;
+ grayMask.fImage = nullptr;
if (SkMask::kBW_Format == origMask.fFormat) {
grayMask.fFormat = SkMask::kA8_Format;
grayMask.fBounds = origMask.fBounds;
@@ -2220,5 +2220,5 @@ void SkAAClipBlitter::blitMask(const SkMask& origMask, const SkIRect& clip) {
}
const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkAAClip.h b/src/core/SkAAClip.h
index 9f6a3d6012..0207233386 100644
--- a/src/core/SkAAClip.h
+++ b/src/core/SkAAClip.h
@@ -26,7 +26,7 @@ public:
void swap(SkAAClip&);
- bool isEmpty() const { return NULL == fRunHead; }
+ bool isEmpty() const { return nullptr == fRunHead; }
const SkIRect& getBounds() const { return fBounds; }
// Returns true iff the clip is not empty, and is just a hard-edged rect (no partial alpha).
@@ -36,7 +36,7 @@ public:
bool setEmpty();
bool setRect(const SkIRect&);
bool setRect(const SkRect&, bool doAA = true);
- bool setPath(const SkPath&, const SkRegion* clip = NULL, bool doAA = true);
+ bool setPath(const SkPath&, const SkRegion* clip = nullptr, bool doAA = true);
bool setRegion(const SkRegion&);
bool set(const SkAAClip&);
@@ -65,8 +65,8 @@ public:
return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom);
}
- const uint8_t* findRow(int y, int* lastYForRow = NULL) const;
- const uint8_t* findX(const uint8_t data[], int x, int* initialCount = NULL) const;
+ const uint8_t* findRow(int y, int* lastYForRow = nullptr) const;
+ const uint8_t* findX(const uint8_t data[], int x, int* initialCount = nullptr) const;
class Iter;
struct RunHead;
@@ -99,7 +99,7 @@ private:
class SkAAClipBlitter : public SkBlitter {
public:
- SkAAClipBlitter() : fScanlineScratch(NULL) {}
+ SkAAClipBlitter() : fScanlineScratch(nullptr) {}
virtual ~SkAAClipBlitter();
void init(SkBlitter* blitter, const SkAAClip* aaclip) {
diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp
index 81e98f3613..56a557c343 100644
--- a/src/core/SkAdvancedTypefaceMetrics.cpp
+++ b/src/core/SkAdvancedTypefaceMetrics.cpp
@@ -148,7 +148,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
SkAutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<Data> > result;
SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* curRange;
- SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* prevRange = NULL;
+ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* prevRange = nullptr;
Data lastAdvance = kInvalidAdvance;
int repeatedAdvances = 0;
int wildCardsInRun = 0;
@@ -168,7 +168,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
for (int gId = firstIndex; gId <= lastIndex; gId++) {
Data advance = kInvalidAdvance;
if (gId < lastIndex) {
- // Get glyph id only when subset is NULL, or the id is in subset.
+ // Get glyph id only when subset is nullptr, or the id is in subset.
SkASSERT(!subsetGlyphIDs || (subsetIndex < subsetGlyphIDsLength &&
static_cast<uint32_t>(gId) <= subsetGlyphIDs[subsetIndex]));
if (!subsetGlyphIDs ||
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 44a6854bd5..b2c9ac3142 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -147,9 +147,9 @@ void finishRange(
@param num_glyphs Total number of glyphs in the given font.
@param glyphIDs For per-glyph info, specify subset of the font by
giving glyph ids. Each integer represents a glyph
- id. Passing NULL means all glyphs in the font.
+ id. Passing nullptr means all glyphs in the font.
@param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if
- glyphIDs is NULL.
+ glyphIDs is nullptr.
*/
template <typename Data, typename FontHandle>
SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
diff --git a/src/core/SkAnnotation.cpp b/src/core/SkAnnotation.cpp
index aa7a02af4f..84d41fc669 100644
--- a/src/core/SkAnnotation.cpp
+++ b/src/core/SkAnnotation.cpp
@@ -13,7 +13,7 @@
#include "SkWriteBuffer.h"
SkAnnotation::SkAnnotation(const char key[], SkData* value) : fKey(key) {
- if (NULL == value) {
+ if (nullptr == value) {
value = SkData::NewEmpty();
} else {
value->ref();
@@ -26,7 +26,7 @@ SkAnnotation::~SkAnnotation() {
}
SkData* SkAnnotation::find(const char key[]) const {
- return fKey.equals(key) ? fData : NULL;
+ return fKey.equals(key) ? fData : nullptr;
}
SkAnnotation::SkAnnotation(SkReadBuffer& buffer) {
@@ -60,7 +60,7 @@ static void annotate_paint(SkPaint& paint, const char* key, SkData* value) {
}
void SkAnnotateRectWithURL(SkCanvas* canvas, const SkRect& rect, SkData* value) {
- if (NULL == value) {
+ if (nullptr == value) {
return;
}
SkPaint paint;
@@ -69,7 +69,7 @@ void SkAnnotateRectWithURL(SkCanvas* canvas, const SkRect& rect, SkData* value)
}
void SkAnnotateNamedDestination(SkCanvas* canvas, const SkPoint& point, SkData* name) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
SkPaint paint;
@@ -78,7 +78,7 @@ void SkAnnotateNamedDestination(SkCanvas* canvas, const SkPoint& point, SkData*
}
void SkAnnotateLinkToDestination(SkCanvas* canvas, const SkRect& rect, SkData* name) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
SkPaint paint;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 03d1f4292b..7cc7344d2f 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -56,8 +56,8 @@ SkBitmap& SkBitmap::operator=(const SkBitmap& src) {
if (fPixelRef) {
// ignore the values from the memcpy
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
// Note that what to for genID is somewhat arbitrary. We have no
// way to track changes to raw pixels across multiple SkBitmaps.
// Would benefit from an SkRawPixelRef type created by
@@ -165,8 +165,8 @@ void SkBitmap::updatePixelsFromRef() const {
fColorTable = fPixelRef->colorTable();
} else {
SkASSERT(0 == fPixelLockCount);
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
}
}
}
@@ -207,7 +207,7 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, int dx, int dy) {
if (fPixelRef != pr) {
this->freePixels();
- SkASSERT(NULL == fPixelRef);
+ SkASSERT(nullptr == fPixelRef);
SkSafeRef(pr);
fPixelRef = pr;
@@ -227,7 +227,7 @@ void SkBitmap::lockPixels() const {
}
void SkBitmap::unlockPixels() const {
- SkASSERT(NULL == fPixelRef || fPixelLockCount > 0);
+ SkASSERT(nullptr == fPixelRef || fPixelLockCount > 0);
if (fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) {
fPixelRef->unlockPixels();
@@ -241,19 +241,19 @@ bool SkBitmap::lockPixelsAreWritable() const {
}
void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
- if (NULL == p) {
- this->setPixelRef(NULL);
+ if (nullptr == p) {
+ this->setPixelRef(nullptr);
return;
}
if (kUnknown_SkColorType == fInfo.colorType()) {
- this->setPixelRef(NULL);
+ this->setPixelRef(nullptr);
return;
}
SkPixelRef* pr = SkMallocPixelRef::NewDirect(fInfo, p, fRowBytes, ctable);
- if (NULL == pr) {
- this->setPixelRef(NULL);
+ if (nullptr == pr) {
+ this->setPixelRef(nullptr);
return;
}
@@ -267,7 +267,7 @@ void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
bool SkBitmap::tryAllocPixels(Allocator* allocator, SkColorTable* ctable) {
HeapAllocator stdalloc;
- if (NULL == allocator) {
+ if (nullptr == allocator) {
allocator = &stdalloc;
}
return allocator->allocPixelRef(this, ctable);
@@ -290,15 +290,15 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
SkMallocPixelRef::PRFactory defaultFactory;
- SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, NULL);
- if (NULL == pr) {
+ SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, nullptr);
+ if (nullptr == pr) {
return reset_return_false(this);
}
this->setPixelRef(pr)->unref();
- // TODO: lockPixels could/should return bool or void*/NULL
+ // TODO: lockPixels could/should return bool or void*/nullptr
this->lockPixels();
- if (NULL == this->getPixels()) {
+ if (nullptr == this->getPixels()) {
return reset_return_false(this);
}
return true;
@@ -306,7 +306,7 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactory* factory,
SkColorTable* ctable) {
- if (kIndex_8_SkColorType == requestedInfo.colorType() && NULL == ctable) {
+ if (kIndex_8_SkColorType == requestedInfo.colorType() && nullptr == ctable) {
return reset_return_false(this);
}
if (!this->setInfo(requestedInfo)) {
@@ -317,19 +317,19 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactor
const SkImageInfo& correctedInfo = this->info();
SkMallocPixelRef::PRFactory defaultFactory;
- if (NULL == factory) {
+ if (nullptr == factory) {
factory = &defaultFactory;
}
SkPixelRef* pr = factory->create(correctedInfo, correctedInfo.minRowBytes(), ctable);
- if (NULL == pr) {
+ if (nullptr == pr) {
return reset_return_false(this);
}
this->setPixelRef(pr)->unref();
- // TODO: lockPixels could/should return bool or void*/NULL
+ // TODO: lockPixels could/should return bool or void*/nullptr
this->lockPixels();
- if (NULL == this->getPixels()) {
+ if (nullptr == this->getPixels()) {
return reset_return_false(this);
}
return true;
@@ -349,7 +349,7 @@ bool SkBitmap::installPixels(const SkImageInfo& requestedInfo, void* pixels, siz
this->reset();
return false;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
invoke_release_proc(releaseProc, pixels, context);
return true; // we behaved as if they called setInfo()
}
@@ -390,12 +390,12 @@ void SkBitmap::freePixels() {
fPixelRef->unlockPixels();
}
fPixelRef->unref();
- fPixelRef = NULL;
+ fPixelRef = nullptr;
fPixelRefOrigin.setZero();
}
fPixelLockCount = 0;
- fPixels = NULL;
- fColorTable = NULL;
+ fPixels = nullptr;
+ fColorTable = nullptr;
}
uint32_t SkBitmap::getGenerationID() const {
@@ -410,7 +410,7 @@ void SkBitmap::notifyPixelsChanged() const {
}
GrTexture* SkBitmap::getTexture() const {
- return fPixelRef ? fPixelRef->getTexture() : NULL;
+ return fPixelRef ? fPixelRef->getTexture() : nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -427,7 +427,7 @@ bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst,
}
SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, dst->rowBytes(), ctable);
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
@@ -482,7 +482,7 @@ static bool copy_pixels_to(const SkPixmap& src, void* const dst, size_t dstSize,
}
bool SkBitmap::copyPixelsTo(void* dst, size_t dstSize, size_t dstRB, bool preserveDstPad) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
SkAutoPixmapUnlock result;
@@ -539,7 +539,7 @@ void* SkBitmap::getAddr(int x, int y) const {
break;
default:
SkDEBUGFAIL("Can't return addr for config");
- base = NULL;
+ base = nullptr;
break;
}
}
@@ -605,7 +605,7 @@ static bool compute_is_opaque(const SkPixmap& pmap) {
} break;
case kIndex_8_SkColorType: {
const SkColorTable* ctable = pmap.ctable();
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
const SkPMColor* table = ctable->readColors();
@@ -696,7 +696,7 @@ void SkBitmap::eraseColor(SkColor c) const {
bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
SkDEBUGCODE(this->validate();)
- if (NULL == result || NULL == fPixelRef) {
+ if (nullptr == result || nullptr == fPixelRef) {
return false; // no src pixels
}
@@ -706,10 +706,10 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
return false; // r is empty (i.e. no intersection)
}
- if (fPixelRef->getTexture() != NULL) {
+ if (fPixelRef->getTexture() != nullptr) {
// Do a deep copy
SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->profileType(), &subset);
- if (pixelRef != NULL) {
+ if (pixelRef != nullptr) {
SkBitmap dst;
dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(),
this->colorType(), this->alphaType()));
@@ -816,7 +816,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, Allocator* alloc)
SkASSERT(tmpSrc.height() == this->height());
// did we get lucky and we can just return tmpSrc?
- if (tmpSrc.colorType() == dstColorType && NULL == alloc) {
+ if (tmpSrc.colorType() == dstColorType && nullptr == alloc) {
dst->swap(tmpSrc);
// If the result is an exact copy, clone the gen ID.
if (dst->pixelRef() && dst->pixelRef()->info() == fPixelRef->info()) {
@@ -888,7 +888,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
// If we have a PixelRef, and it supports deep copy, use it.
// Currently supported only by texture-backed bitmaps.
if (fPixelRef) {
- SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstPT, NULL);
+ SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstPT, nullptr);
if (pixelRef) {
uint32_t rowBytes;
if (this->colorType() == dstCT && this->profileType() == dstPT) {
@@ -915,7 +915,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
if (this->getTexture()) {
return false;
} else {
- return this->copyTo(dst, dstCT, NULL);
+ return this->copyTo(dst, dstCT, nullptr);
}
}
@@ -978,7 +978,7 @@ static void get_bitmap_alpha(const SkPixmap& pmap, uint8_t* SK_RESTRICT alpha, i
}
static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, int alphaRowBytes) {
- SkASSERT(alpha != NULL);
+ SkASSERT(alpha != nullptr);
SkASSERT(alphaRowBytes >= src.width());
SkAutoPixmapUnlock apl;
@@ -1006,20 +1006,20 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
srcM.fRowBytes = SkAlign4(this->width());
srcM.fFormat = SkMask::kA8_Format;
- SkMaskFilter* filter = paint ? paint->getMaskFilter() : NULL;
+ SkMaskFilter* filter = paint ? paint->getMaskFilter() : nullptr;
// compute our (larger?) dst bounds if we have a filter
if (filter) {
identity.reset();
- srcM.fImage = NULL;
- if (!filter->filterMask(&dstM, srcM, identity, NULL)) {
+ srcM.fImage = nullptr;
+ if (!filter->filterMask(&dstM, srcM, identity, nullptr)) {
goto NO_FILTER_CASE;
}
dstM.fRowBytes = SkAlign4(dstM.fBounds.width());
} else {
NO_FILTER_CASE:
tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes);
- if (!tmpBitmap.tryAllocPixels(allocator, NULL)) {
+ if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
tmpBitmap.width(), tmpBitmap.height());
@@ -1036,14 +1036,14 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
SkAutoMaskFreeImage srcCleanup(srcM.fImage);
GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes);
- if (!filter->filterMask(&dstM, srcM, identity, NULL)) {
+ if (!filter->filterMask(&dstM, srcM, identity, nullptr)) {
goto NO_FILTER_CASE;
}
SkAutoMaskFreeImage dstCleanup(dstM.fImage);
tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
dstM.fRowBytes);
- if (!tmpBitmap.tryAllocPixels(allocator, NULL)) {
+ if (!tmpBitmap.tryAllocPixels(allocator, nullptr)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
tmpBitmap.width(), tmpBitmap.height());
@@ -1091,7 +1091,7 @@ static void write_raw_pixels(SkWriteBuffer* buffer, const SkPixmap& pmap) {
void SkBitmap::WriteRawPixels(SkWriteBuffer* buffer, const SkBitmap& bitmap) {
const SkImageInfo info = bitmap.info();
- if (0 == info.width() || 0 == info.height() || NULL == bitmap.pixelRef()) {
+ if (0 == info.width() || 0 == info.height() || nullptr == bitmap.pixelRef()) {
buffer->writeUInt(0); // instead of snugRB, signaling no pixels
return;
}
@@ -1210,7 +1210,7 @@ void SkBitmap::validate() const {
SkASSERT(fPixelRef->info().height() >= (int)this->height() + fPixelRefOrigin.fY);
SkASSERT(fPixelRef->rowBytes() >= fInfo.minRowBytes());
} else {
- SkASSERT(NULL == fColorTable);
+ SkASSERT(nullptr == fColorTable);
}
}
#endif
@@ -1240,7 +1240,7 @@ void SkBitmap::toString(SkString* str) const {
str->append(")");
SkPixelRef* pr = this->pixelRef();
- if (NULL == pr) {
+ if (nullptr == pr) {
// show null or the explicit pixel address (rare)
str->appendf(" pixels:%p", this->getPixels());
} else {
@@ -1262,7 +1262,7 @@ bool SkBitmap::requestLock(SkAutoPixmapUnlock* result) const {
SkASSERT(result);
SkPixelRef* pr = fPixelRef;
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp
index 66075d4eae..2b11b81fd7 100644
--- a/src/core/SkBitmapCache.cpp
+++ b/src/core/SkBitmapCache.cpp
@@ -202,7 +202,7 @@ struct MipMapRec : public SkResourceCache::Rec {
const SkMipMap* mm = SkRef(rec.fMipMap);
// the call to ref() above triggers a "lock" in the case of discardable memory,
// which means we can now check for null (in case the lock failed).
- if (NULL == mm->data()) {
+ if (nullptr == mm->data()) {
mm->unref(); // balance our call to ref()
return false;
}
@@ -222,7 +222,7 @@ const SkMipMap* SkMipMapCache::FindAndRef(const SkBitmap& src, SkResourceCache*
const SkMipMap* result;
if (!CHECK_LOCAL(localCache, find, Find, key, MipMapRec::Finder, &result)) {
- result = NULL;
+ result = nullptr;
}
return result;
}
diff --git a/src/core/SkBitmapCache.h b/src/core/SkBitmapCache.h
index c758942080..3e541eed2c 100644
--- a/src/core/SkBitmapCache.h
+++ b/src/core/SkBitmapCache.h
@@ -22,7 +22,7 @@ class SkBitmapCache {
public:
/**
* Use this allocator for bitmaps, so they can use ashmem when available.
- * Returns NULL if the ResourceCache has not been initialized with a DiscardableFactory.
+ * Returns nullptr if the ResourceCache has not been initialized with a DiscardableFactory.
*/
static SkBitmap::Allocator* GetAllocator();
@@ -31,37 +31,37 @@ public:
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, SkBitmap* result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/*
* result must be marked isImmutable()
*/
static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
- const SkBitmap& result, SkResourceCache* localCache = NULL);
+ const SkBitmap& result, SkResourceCache* localCache = nullptr);
/**
* Search based on the bitmap's genID and subset. If found, returns true and
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(uint32_t genID, const SkIRect& subset, SkBitmap* result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* The width and the height of the provided subset must be the same as the result bitmap ones.
* result must be marked isImmutable()
*/
static bool Add(SkPixelRef*, const SkIRect& subset, const SkBitmap& result,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
- static bool Find(uint32_t genID, SkBitmap* result, SkResourceCache* localCache = NULL);
+ static bool Find(uint32_t genID, SkBitmap* result, SkResourceCache* localCache = nullptr);
// todo: eliminate the need to specify ID, since it should == the bitmap's
- static void Add(uint32_t genID, const SkBitmap&, SkResourceCache* localCache = NULL);
+ static void Add(uint32_t genID, const SkBitmap&, SkResourceCache* localCache = nullptr);
};
class SkMipMapCache {
public:
- static const SkMipMap* FindAndRef(const SkBitmap& src, SkResourceCache* localCache = NULL);
- static const SkMipMap* AddAndRef(const SkBitmap& src, SkResourceCache* localCache = NULL);
+ static const SkMipMap* FindAndRef(const SkBitmap& src, SkResourceCache* localCache = nullptr);
+ static const SkMipMap* AddAndRef(const SkBitmap& src, SkResourceCache* localCache = nullptr);
};
#endif
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index fb54388a7e..e4b4199c69 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -16,7 +16,7 @@ static bool valid_for_drawing(const SkBitmap& bm) {
if (0 == bm.width() || 0 == bm.height()) {
return false; // nothing to draw
}
- if (NULL == bm.pixelRef()) {
+ if (nullptr == bm.pixelRef()) {
return false; // no pixels to read
}
if (bm.getTexture()) {
@@ -38,14 +38,14 @@ SkBitmapController::State* SkBitmapController::requestBitmap(const SkBitmap& bm,
void* storage, size_t storageSize) {
if (!valid_for_drawing(bm)) {
- return NULL;
+ return nullptr;
}
State* state = this->onRequestBitmap(bm, inv, quality, storage, storageSize);
if (state) {
- if (NULL == state->fPixmap.addr()) {
+ if (nullptr == state->fPixmap.addr()) {
SkInPlaceDeleteCheck(state, storage);
- state = NULL;
+ state = nullptr;
}
}
return state;
@@ -161,21 +161,21 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmap& origBi
fQuality = kLow_SkFilterQuality;
SkSize invScaleSize;
- if (!fInvMatrix.decomposeScale(&invScaleSize, NULL)) {
+ if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) {
return false;
}
SkScalar invScale = SkScalarSqrt(invScaleSize.width() * invScaleSize.height());
if (invScale > SK_Scalar1) {
fCurrMip.reset(SkMipMapCache::FindAndRef(origBitmap));
- if (NULL == fCurrMip.get()) {
+ if (nullptr == fCurrMip.get()) {
fCurrMip.reset(SkMipMapCache::AddAndRef(origBitmap));
- if (NULL == fCurrMip.get()) {
+ if (nullptr == fCurrMip.get()) {
return false;
}
}
// diagnostic for a crasher...
- if (NULL == fCurrMip->data()) {
+ if (nullptr == fCurrMip->data()) {
sk_throw();
}
@@ -191,7 +191,7 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmap& origBi
return fResultBitmap.installPixels(info, level.fPixels, level.fRowBytes);
} else {
// failed to extract, so release the mipmap
- fCurrMip.reset(NULL);
+ fCurrMip.reset(nullptr);
}
}
return false;
@@ -213,7 +213,7 @@ SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmap& s
SkASSERT(fQuality <= kLow_SkFilterQuality);
// fResultBitmap.getPixels() may be null, but our caller knows to check fPixmap.addr()
- // and will destroy us if it is NULL.
+ // and will destroy us if it is nullptr.
fPixmap.reset(fResultBitmap.info(), fResultBitmap.getPixels(), fResultBitmap.rowBytes(),
fResultBitmap.getColorTable());
}
diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h
index ead4b783bd..aa663e85f7 100644
--- a/src/core/SkBitmapController.h
+++ b/src/core/SkBitmapController.h
@@ -40,7 +40,7 @@ public:
void* storage, size_t storageSize);
State* requestBitmap(const SkBitmap& bm, const SkMatrix& inverse, SkFilterQuality quality) {
- return this->requestBitmap(bm, inverse, quality, NULL, 0);
+ return this->requestBitmap(bm, inverse, quality, nullptr, 0);
}
protected:
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index d4445fae9b..b7df9a4c25 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -67,7 +67,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
: INHERITED(SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
, fBitmap(bitmap) {
- SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
+ SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
}
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
@@ -77,14 +77,14 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps)
: INHERITED(surfaceProps)
, fBitmap(bitmap) {
- SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
+ SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
}
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
const SkSurfaceProps& surfaceProps) {
SkAlphaType newAT = origInfo.alphaType();
if (!valid_for_bitmap_device(origInfo, &newAT)) {
- return NULL;
+ return nullptr;
}
const SkImageInfo info = origInfo.makeAlphaType(newAT);
@@ -92,11 +92,11 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
if (kUnknown_SkColorType == info.colorType()) {
if (!bitmap.setInfo(info)) {
- return NULL;
+ return nullptr;
}
} else {
if (!bitmap.tryAllocPixels(info)) {
- return NULL;
+ return nullptr;
}
if (!bitmap.info().isOpaque()) {
bitmap.eraseColor(SK_ColorTRANSPARENT);
@@ -142,7 +142,7 @@ bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
const SkImageInfo info = fBitmap.info();
if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) {
- SkColorTable* ctable = NULL;
+ SkColorTable* ctable = nullptr;
pmap->reset(fBitmap.info(), fBitmap.getPixels(), fBitmap.rowBytes(), ctable);
return true;
}
@@ -152,7 +152,7 @@ bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels,
size_t srcRowBytes, int x, int y) {
// since we don't stop creating un-pixeled devices yet, check for no pixels here
- if (NULL == fBitmap.getPixels()) {
+ if (nullptr == fBitmap.getPixels()) {
return false;
}
@@ -211,7 +211,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa
path.addOval(oval);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawOval.
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
@@ -223,7 +223,7 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
#else
draw.drawRRect(rrect, paint);
#endif
@@ -238,7 +238,7 @@ void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint& paint) {
- draw.drawBitmap(bitmap, matrix, NULL, paint);
+ draw.drawBitmap(bitmap, matrix, nullptr, paint);
}
void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
@@ -319,7 +319,7 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
&matrix);
- if (NULL == s) {
+ if (nullptr == s) {
return;
}
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index 4c1e9c68a3..55a7092ba7 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -35,6 +35,6 @@ SkBitmapFilter *SkBitmapFilter::Allocate() {
SkDEBUGFAIL("Unknown filter type");
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp
index 5b16d21e30..c65a704b5a 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -65,9 +65,9 @@ bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a,
SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
: INHERITED()
- , fExternalStorage(NULL)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fExternalStorage(nullptr)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(ownerCount)
, fBytesAllocated(0)
@@ -77,8 +77,8 @@ SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
SkBitmapHeap::SkBitmapHeap(ExternalStorage* storage, int32_t preferredSize)
: INHERITED()
, fExternalStorage(storage)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(IGNORE_OWNERS)
, fBytesAllocated(0)
@@ -111,39 +111,39 @@ SkBitmapHeap::~SkBitmapHeap() {
void SkBitmapHeap::removeFromLRU(SkBitmapHeap::LookupEntry* entry) {
if (fMostRecentlyUsed == entry) {
fMostRecentlyUsed = entry->fLessRecentlyUsed;
- if (NULL == fMostRecentlyUsed) {
+ if (nullptr == fMostRecentlyUsed) {
SkASSERT(fLeastRecentlyUsed == entry);
- fLeastRecentlyUsed = NULL;
+ fLeastRecentlyUsed = nullptr;
} else {
- fMostRecentlyUsed->fMoreRecentlyUsed = NULL;
+ fMostRecentlyUsed->fMoreRecentlyUsed = nullptr;
}
} else {
// Remove entry from its prior place, and make sure to cover the hole.
if (fLeastRecentlyUsed == entry) {
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
fLeastRecentlyUsed = entry->fMoreRecentlyUsed;
}
// Since we have already considered the case where entry is the most recently used, it must
// have a more recently used at this point.
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
entry->fMoreRecentlyUsed->fLessRecentlyUsed = entry->fLessRecentlyUsed;
- if (entry->fLessRecentlyUsed != NULL) {
+ if (entry->fLessRecentlyUsed != nullptr) {
SkASSERT(fLeastRecentlyUsed != entry);
entry->fLessRecentlyUsed->fMoreRecentlyUsed = entry->fMoreRecentlyUsed;
}
}
- entry->fMoreRecentlyUsed = NULL;
+ entry->fMoreRecentlyUsed = nullptr;
}
void SkBitmapHeap::appendToLRU(SkBitmapHeap::LookupEntry* entry) {
- if (fMostRecentlyUsed != NULL) {
- SkASSERT(NULL == fMostRecentlyUsed->fMoreRecentlyUsed);
+ if (fMostRecentlyUsed != nullptr) {
+ SkASSERT(nullptr == fMostRecentlyUsed->fMoreRecentlyUsed);
fMostRecentlyUsed->fMoreRecentlyUsed = entry;
entry->fLessRecentlyUsed = fMostRecentlyUsed;
}
fMostRecentlyUsed = entry;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
fLeastRecentlyUsed = entry;
}
}
@@ -154,13 +154,13 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
SkASSERT(fStorage.count() >= fPreferredCount);
SkBitmapHeap::LookupEntry* iter = fLeastRecentlyUsed;
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
// If the least recently used bitmap has not been unreferenced
// by its owner, then according to our LRU specifications a more
// recently used one can not have used all its references yet either.
- return NULL;
+ return nullptr;
}
if (replacement.getGenerationID() == iter->fGenerationId) {
// Do not replace a bitmap with a new one using the same
@@ -171,7 +171,7 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
return iter;
}
}
- return NULL;
+ return nullptr;
}
size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
@@ -182,7 +182,7 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
size_t origBytesAllocated = fBytesAllocated;
// Purge starting from LRU until a non-evictable bitmap is found or until
// everything is evicted.
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
break;
@@ -203,15 +203,15 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
if (fLeastRecentlyUsed != iter) {
// There was at least one eviction.
fLeastRecentlyUsed = iter;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
// Everything was evicted
- fMostRecentlyUsed = NULL;
+ fMostRecentlyUsed = nullptr;
fBytesAllocated -= (fStorage.count() * sizeof(SkBitmapHeapEntry));
fStorage.deleteAll();
fUnusedSlots.reset();
SkASSERT(0 == fBytesAllocated);
} else {
- fLeastRecentlyUsed->fLessRecentlyUsed = NULL;
+ fLeastRecentlyUsed->fLessRecentlyUsed = nullptr;
}
}
@@ -228,7 +228,7 @@ int SkBitmapHeap::findInLookupTable(const LookupEntry& indexEntry, SkBitmapHeapE
// insert ourselves into the bitmapIndex
index = ~index;
*fLookupTable.insert(index) = new LookupEntry(indexEntry);
- } else if (entry != NULL) {
+ } else if (entry != nullptr) {
// populate the entry if needed
*entry = fStorage[fLookupTable[index]->fStorageSlot];
}
@@ -244,7 +244,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
if (originalBitmap.isImmutable()) {
copiedBitmap = originalBitmap;
// TODO if we have the pixel ref in the heap we could pass it here to avoid a potential deep copy
-// else if (sharedPixelRef != NULL) {
+// else if (sharedPixelRef != nullptr) {
// copiedBitmap = orig;
// copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset());
} else if (originalBitmap.empty()) {
@@ -259,7 +259,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
// remove the bitmap index for the deleted entry
SkDEBUGCODE(int count = fLookupTable.count();)
- int index = this->findInLookupTable(*entry, NULL);
+ int index = this->findInLookupTable(*entry, nullptr);
// Verify that findInLookupTable found an existing entry rather than adding
// a new entry to the lookup table.
SkASSERT(count == fLookupTable.count());
@@ -270,7 +270,7 @@ int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
}
int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
- SkBitmapHeapEntry* entry = NULL;
+ SkBitmapHeapEntry* entry = nullptr;
int searchIndex = this->findInLookupTable(LookupEntry(originalBitmap), &entry);
if (entry) {
@@ -296,7 +296,7 @@ int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
if (fPreferredCount != UNLIMITED_SIZE && fStorage.count() >= fPreferredCount) {
// iterate through our LRU cache and try to find an entry to evict
LookupEntry* lookupEntry = this->findEntryToReplace(originalBitmap);
- if (lookupEntry != NULL) {
+ if (lookupEntry != nullptr) {
// we found an entry to evict
entry = fStorage[lookupEntry->fStorageSlot];
// Remove it from the LRU. The new entry will be added to the LRU later.
@@ -383,7 +383,7 @@ void SkBitmapHeap::endAddingOwnersDeferral(bool add) {
for (int i = 0; i < fDeferredEntries.count(); i++) {
SkASSERT(fOwnerCount != IGNORE_OWNERS);
SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]);
- SkASSERT(heapEntry != NULL);
+ SkASSERT(heapEntry != nullptr);
heapEntry->addReferences(fOwnerCount);
}
}
diff --git a/src/core/SkBitmapHeap.h b/src/core/SkBitmapHeap.h
index 1e1979fbf7..22c31a0b0b 100644
--- a/src/core/SkBitmapHeap.h
+++ b/src/core/SkBitmapHeap.h
@@ -116,24 +116,24 @@ public:
/**
* Retrieves the bitmap from the specified slot in the heap
*
- * @return The bitmap located at that slot or NULL if external storage is being used.
+ * @return The bitmap located at that slot or nullptr if external storage is being used.
*/
SkBitmap* getBitmap(int32_t slot) const override {
- SkASSERT(fExternalStorage == NULL);
+ SkASSERT(fExternalStorage == nullptr);
SkBitmapHeapEntry* entry = getEntry(slot);
if (entry) {
return &entry->fBitmap;
}
- return NULL;
+ return nullptr;
}
/**
* Retrieves the bitmap from the specified slot in the heap
*
- * @return The bitmap located at that slot or NULL if external storage is being used.
+ * @return The bitmap located at that slot or nullptr if external storage is being used.
*/
void releaseRef(int32_t slot) override {
- SkASSERT(fExternalStorage == NULL);
+ SkASSERT(fExternalStorage == nullptr);
if (fOwnerCount != IGNORE_OWNERS) {
SkBitmapHeapEntry* entry = getEntry(slot);
if (entry) {
@@ -158,12 +158,12 @@ public:
* Retrieves an entry from the heap at a given slot.
*
* @param slot the slot in the heap where a bitmap was stored.
- * @return a SkBitmapHeapEntry that wraps the bitmap or NULL if external storage is used.
+ * @return a SkBitmapHeapEntry that wraps the bitmap or nullptr if external storage is used.
*/
SkBitmapHeapEntry* getEntry(int32_t slot) const {
SkASSERT(slot <= fStorage.count());
- if (fExternalStorage != NULL) {
- return NULL;
+ if (fExternalStorage != nullptr) {
+ return nullptr;
}
return fStorage[slot];
}
@@ -172,7 +172,7 @@ public:
* Returns a count of the number of items currently in the heap
*/
int count() const {
- SkASSERT(fExternalStorage != NULL ||
+ SkASSERT(fExternalStorage != nullptr ||
fStorage.count() - fUnusedSlots.count() == fLookupTable.count());
return fLookupTable.count();
}
@@ -215,8 +215,8 @@ private:
, fPixelOrigin(bm.pixelRefOrigin())
, fWidth(bm.width())
, fHeight(bm.height())
- , fMoreRecentlyUsed(NULL)
- , fLessRecentlyUsed(NULL){}
+ , fMoreRecentlyUsed(nullptr)
+ , fLessRecentlyUsed(nullptr){}
const uint32_t fGenerationId; // SkPixelRef GenerationID.
const SkIPoint fPixelOrigin;
@@ -260,7 +260,7 @@ private:
/**
* Remove a LookupEntry from the LRU, in preparation for either deleting or appending as most
* recent. Points the LookupEntry's old neighbors at each other, and sets fLeastRecentlyUsed
- * (if there is still an entry left). Sets LookupEntry's fMoreRecentlyUsed to NULL and leaves
+ * (if there is still an entry left). Sets LookupEntry's fMoreRecentlyUsed to nullptr and leaves
* its fLessRecentlyUsed unmodified.
*/
void removeFromLRU(LookupEntry* entry);
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index ef9cfd4dc8..e382d09c99 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -47,7 +47,7 @@ SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) {
buffer.readMatrix(&lm);
SkBitmap bm;
if (!buffer.readBitmap(&bm)) {
- return NULL;
+ return nullptr;
}
bm.setImmutable();
TileMode mx = (TileMode)buffer.readUInt();
@@ -75,7 +75,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
SkMatrix totalInverse;
// Do this first, so we know the matrix can be inverted.
if (!this->computeTotalInverse(rec, &totalInverse)) {
- return NULL;
+ return nullptr;
}
void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
@@ -87,7 +87,7 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
state->fOrigBitmap = fRawBitmap;
if (!state->chooseProcs(totalInverse, *rec.fPaint)) {
state->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
return new (storage) BitmapProcShaderContext(*this, rec, state);
@@ -212,7 +212,7 @@ SkShader::Context::ShadeProc SkBitmapProcShader::BitmapProcShaderContext::asASha
*ctx = fState;
return (ShadeProc)fState->getShaderProc32();
}
- return NULL;
+ return nullptr;
}
void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan16(int x, int y, uint16_t dstC[],
@@ -301,19 +301,19 @@ SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
SkShader* shader;
SkColor color;
if (src.isNull() || bitmap_is_too_big(src)) {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkEmptyShader;
} else {
shader = allocator->createT<SkEmptyShader>();
}
} else if (can_use_color_shader(src, &color)) {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkColorShader(color);
} else {
shader = allocator->createT<SkColorShader>(color);
}
} else {
- if (NULL == allocator) {
+ if (nullptr == allocator) {
shader = new SkBitmapProcShader(src, tmx, tmy, localMatrix);
} else {
shader = allocator->createT<SkBitmapProcShader>(src, tmx, tmy, localMatrix);
diff --git a/src/core/SkBitmapProcShader.h b/src/core/SkBitmapProcShader.h
index 5179ff8bf2..30f860a9bf 100644
--- a/src/core/SkBitmapProcShader.h
+++ b/src/core/SkBitmapProcShader.h
@@ -18,7 +18,7 @@ struct SkBitmapProcState;
class SkBitmapProcShader : public SkShader {
public:
SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty,
- const SkMatrix* localMatrix = NULL);
+ const SkMatrix* localMatrix = nullptr);
// overrides from SkShader
bool isOpaque() const override;
@@ -72,7 +72,7 @@ private:
// yet found a situation where the size below isn't big enough.
typedef SkSmallAllocator<3, 1152> SkTBlitterAllocator;
-// If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive
+// If alloc is non-nullptr, it will be used to allocate the returned SkShader, and MUST outlive
// the SkShader.
SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader::TileMode,
const SkMatrix* localMatrix, SkTBlitterAllocator* alloc);
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 2227010da3..31109aaee9 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -37,7 +37,7 @@ extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState&
#include "SkBitmapProcState_filter.h"
#include "SkBitmapProcState_procs.h"
-SkBitmapProcState::SkBitmapProcState() : fBMState(NULL) {}
+SkBitmapProcState::SkBitmapProcState() : fBMState(nullptr) {}
SkBitmapProcState::~SkBitmapProcState() {
SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get());
@@ -122,7 +122,7 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
fBMState = controller.requestBitmap(fOrigBitmap, inv, paint.getFilterQuality(),
fBMStateStorage.get(), fBMStateStorage.size());
// Note : we allow the controller to return an empty (zero-dimension) result. Should we?
- if (NULL == fBMState || fBMState->pixmap().info().isEmpty()) {
+ if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) {
return false;
}
fPixmap = fBMState->pixmap();
@@ -174,10 +174,10 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
fAlphaScale = SkAlpha255To256(paint.getAlpha());
- fShaderProc32 = NULL;
- fShaderProc16 = NULL;
- fSampleProc32 = NULL;
- fSampleProc16 = NULL;
+ fShaderProc32 = nullptr;
+ fShaderProc16 = nullptr;
+ fSampleProc32 = nullptr;
+ fSampleProc16 = nullptr;
// recompute the triviality of the matrix here because we may have
// changed it!
@@ -201,8 +201,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
const SkPaint& paint) {
fMatrixProc = this->chooseMatrixProc(trivialMatrix);
- // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never returns NULL.
- if (NULL == fMatrixProc) {
+ // TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never returns nullptr.
+ if (nullptr == fMatrixProc) {
return false;
}
@@ -338,11 +338,11 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
SI8_D16_filter_DX,
// Don't support 4444 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support A8 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support G8 -> 565 (but we could)
- NULL, NULL, NULL, NULL
+ nullptr, nullptr, nullptr, nullptr
};
#endif
@@ -364,7 +364,7 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp,
fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc;
}
- if (NULL == fShaderProc32) {
+ if (nullptr == fShaderProc32) {
fShaderProc32 = this->chooseShaderProc32();
}
}
@@ -381,7 +381,7 @@ static void Clamp_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const int maxX = s.fPixmap.width() - 1;
@@ -455,7 +455,7 @@ static void Repeat_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const int stopX = s.fPixmap.width();
@@ -495,7 +495,7 @@ static void S32_D32_constX_shaderproc(const SkBitmapProcState& s,
int count) {
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(1 == s.fPixmap.width());
int iY0;
@@ -633,7 +633,7 @@ bool SkBitmapProcState::setupForTranslate() {
SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
if (kN32_SkColorType != fPixmap.colorType()) {
- return NULL;
+ return nullptr;
}
static const unsigned kMask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
@@ -648,13 +648,13 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
}
if (fAlphaScale < 256) {
- return NULL;
+ return nullptr;
}
if (fInvType > SkMatrix::kTranslate_Mask) {
- return NULL;
+ return nullptr;
}
if (kNone_SkFilterQuality != fFilterLevel) {
- return NULL;
+ return nullptr;
}
SkShader::TileMode tx = (SkShader::TileMode)fTileModeX;
@@ -672,7 +672,7 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
}
return DoNothing_shaderproc;
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 57fd2731b5..814c79a92c 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -123,7 +123,7 @@ private:
ShaderProc32 fShaderProc32; // chooseProcs
ShaderProc16 fShaderProc16; // chooseProcs
- // These are used if the shaderproc is NULL
+ // These are used if the shaderproc is nullptr
MatrixProc fMatrixProc; // chooseProcs
SampleProc32 fSampleProc32; // chooseProcs
SampleProc16 fSampleProc16; // chooseProcs
diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h
index 5322a3605c..f70b758ac2 100644
--- a/src/core/SkBitmapProcState_sample.h
+++ b/src/core/SkBitmapProcState_sample.h
@@ -41,7 +41,7 @@ void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -83,7 +83,7 @@ void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -138,7 +138,7 @@ void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
@@ -184,7 +184,7 @@ void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
diff --git a/src/core/SkBitmapProcState_shaderproc.h b/src/core/SkBitmapProcState_shaderproc.h
index 2708b012b5..94b2d3b48c 100644
--- a/src/core/SkBitmapProcState_shaderproc.h
+++ b/src/core/SkBitmapProcState_shaderproc.h
@@ -20,7 +20,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, int x, int y,
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
SkMatrix::kScale_Mask)) == 0);
SkASSERT(s.fInvKy == 0);
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkDEBUGCODE(CHECKSTATE(s);)
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index be7985732f..ff053a9a41 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -251,7 +251,7 @@ static SkBitmapScaler::ResizeMethod ResizeMethodToAlgorithmMethod(
bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeMethod method,
float destWidth, float destHeight,
SkBitmap::Allocator* allocator) {
- if (NULL == source.addr() || source.colorType() != kN32_SkColorType ||
+ if (nullptr == source.addr() || source.colorType() != kN32_SkColorType ||
source.width() < 1 || source.height() < 1)
{
return false;
@@ -263,7 +263,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeM
return false;
}
- SkConvolutionProcs convolveProcs= { 0, NULL, NULL, NULL, NULL };
+ SkConvolutionProcs convolveProcs= { 0, nullptr, nullptr, nullptr, nullptr };
PlatformConvolutionProcs(&convolveProcs);
SkRect destSubset = { 0, 0, destWidth, destHeight };
@@ -293,7 +293,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeM
result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
SkScalarCeilToInt(destSubset.height()),
source.alphaType()));
- result.allocPixels(allocator, NULL);
+ result.allocPixels(allocator, nullptr);
if (!result.readyToDraw()) {
return false;
}
diff --git a/src/core/SkBitmapScaler.h b/src/core/SkBitmapScaler.h
index c4c7f0ad0b..1b7eef5952 100644
--- a/src/core/SkBitmapScaler.h
+++ b/src/core/SkBitmapScaler.h
@@ -80,7 +80,7 @@ public:
};
static bool Resize(SkBitmap* result, const SkPixmap& src, ResizeMethod method,
- float dest_width, float dest_height, SkBitmap::Allocator* = NULL);
+ float dest_width, float dest_height, SkBitmap::Allocator* = nullptr);
/** Platforms can also optionally overwrite the convolution functions
if we have SIMD versions of them.
diff --git a/src/core/SkBlitMask.h b/src/core/SkBlitMask.h
index d39c094cb6..f36f9f3d82 100644
--- a/src/core/SkBlitMask.h
+++ b/src/core/SkBlitMask.h
@@ -54,7 +54,7 @@ public:
/**
* Return either platform specific optimized blitcolor BlitLCD16RowProc,
- * or NULL if no optimized routine is available.
+ * or nullptr if no optimized routine is available.
*/
static BlitLCD16RowProc PlatformBlitRowProcs16(bool isOpaque);
@@ -64,13 +64,13 @@ public:
/**
* Public entry-point to return a blitmask RowProc.
- * May return NULL if config or format are not supported.
+ * May return nullptr if config or format are not supported.
*/
static RowProc RowFactory(SkColorType, SkMask::Format, RowFlags);
/**
* Return either platform specific optimized blitmask RowProc,
- * or NULL if no optimized routine is available.
+ * or nullptr if no optimized routine is available.
*/
static RowProc PlatformRowProcs(SkColorType, SkMask::Format, RowFlags);
};
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index fb2991c919..3cc791af4e 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -31,10 +31,10 @@ static void D32_LCD16_Proc(void* SK_RESTRICT dst, size_t dstRB,
const uint16_t* srcRow = (const uint16_t*)mask;
SkPMColor opaqueDst;
- SkBlitMask::BlitLCD16RowProc proc = NULL;
+ SkBlitMask::BlitLCD16RowProc proc = nullptr;
bool isOpaque = (0xFF == SkColorGetA(color));
proc = SkBlitMask::BlitLCD16RowFactory(isOpaque);
- SkASSERT(proc != NULL);
+ SkASSERT(proc != nullptr);
if (isOpaque) {
opaqueDst = SkPreMultiplyColor(color);
@@ -283,8 +283,8 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
static const RowProc gProcs[] = {
// need X coordinate to handle BW
- false ? (RowProc)BW_RowProc_Blend : NULL, // suppress unused warning
- false ? (RowProc)BW_RowProc_Opaque : NULL, // suppress unused warning
+ false ? (RowProc)BW_RowProc_Blend : nullptr, // suppress unused warning
+ false ? (RowProc)BW_RowProc_Opaque : nullptr, // suppress unused warning
(RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque,
(RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque,
};
@@ -297,7 +297,7 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
case SkMask::kA8_Format: index = 2; break;
case SkMask::kLCD16_Format: index = 4; break;
default:
- return NULL;
+ return nullptr;
}
if (flags & kSrcIsOpaque_RowFlag) {
index |= 1;
@@ -307,5 +307,5 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
default:
break;
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBlitRow_D16.cpp b/src/core/SkBlitRow_D16.cpp
index 5aaa7a5805..9ac84c672d 100644
--- a/src/core/SkBlitRow_D16.cpp
+++ b/src/core/SkBlitRow_D16.cpp
@@ -246,7 +246,7 @@ SkBlitRow::Proc16 SkBlitRow::Factory16(unsigned flags) {
flags &= kFlags16_Mask;
SkBlitRow::Proc16 proc = PlatformFactory565(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_565_Procs[flags];
}
return proc;
@@ -274,7 +274,7 @@ SkBlitRow::ColorProc16 SkBlitRow::ColorFactory16(unsigned flags) {
SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_ColorProcs));
SkBlitRow::ColorProc16 proc = PlatformColorFactory565(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_565_ColorProcs[flags];
}
return proc;
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp
index 559ee18c5e..0f8cbe8104 100644
--- a/src/core/SkBlitRow_D32.cpp
+++ b/src/core/SkBlitRow_D32.cpp
@@ -124,7 +124,7 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) {
flags &= kFlags32_Mask;
SkBlitRow::Proc32 proc = PlatformProcs32(flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
proc = gDefault_Procs32[flags];
}
SkASSERT(proc);
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 62cd73ee24..1bc9963eeb 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -29,11 +29,11 @@ bool SkBlitter::resetShaderContext(const SkShader::ContextRec&) {
}
SkShader::Context* SkBlitter::getShaderContext() const {
- return NULL;
+ return nullptr;
}
const SkPixmap* SkBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
void SkBlitter::blitH(int x, int y, int width) {
@@ -243,7 +243,7 @@ void SkNullBlitter::blitRect(int x, int y, int width, int height) {}
void SkNullBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {}
const SkPixmap* SkNullBlitter::justAnOpaqueColor(uint32_t* value) {
- return NULL;
+ return nullptr;
}
bool SkNullBlitter::isNullBlitter() const { return true; }
@@ -553,7 +553,7 @@ SkBlitter* SkBlitterClipper::apply(SkBlitter* blitter, const SkRegion* clip,
if (clip->isEmpty() || (ir && !SkIRect::Intersects(clipR, *ir))) {
blitter = &fNullBlitter;
} else if (clip->isRect()) {
- if (ir == NULL || !clipR.contains(*ir)) {
+ if (ir == nullptr || !clipR.contains(*ir)) {
fRectBlitter.init(blitter, clipR);
blitter = &fRectBlitter;
}
@@ -589,12 +589,12 @@ public:
}
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
- SkShader::Context* proxyContext = NULL;
+ SkShader::Context* proxyContext = nullptr;
if (fProxy) {
char* proxyContextStorage = (char*) storage + sizeof(Sk3DShaderContext);
proxyContext = fProxy->createContext(rec, proxyContextStorage);
if (!proxyContext) {
- return NULL;
+ return nullptr;
}
}
return new (storage) Sk3DShaderContext(*this, rec, proxyContext);
@@ -606,7 +606,7 @@ public:
Sk3DShaderContext(const Sk3DShader& shader, const ContextRec& rec,
SkShader::Context* proxyContext)
: INHERITED(shader, rec)
- , fMask(NULL)
+ , fMask(nullptr)
, fProxyContext(proxyContext)
{
if (!fProxyContext) {
@@ -627,8 +627,8 @@ public:
fProxyContext->shadeSpan(x, y, span, count);
}
- if (fMask == NULL) {
- if (fProxyContext == NULL) {
+ if (fMask == nullptr) {
+ if (fProxyContext == nullptr) {
sk_memset32(span, fPMColor, count);
}
return;
@@ -761,7 +761,7 @@ public:
fProxy->blitMask(mask, clip);
((SkMask*)&mask)->fFormat = SkMask::k3D_Format;
- fShaderContext->set3DMask(NULL);
+ fShaderContext->set3DMask(nullptr);
} else {
fProxy->blitMask(mask, clip);
}
@@ -782,7 +782,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
const SkPaint& origPaint,
SkTBlitterAllocator* allocator,
bool drawCoverage) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
// which check, in case we're being called by a client with a dummy device
// (e.g. they have a bounder that always aborts the draw)
@@ -794,11 +794,11 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkShader* shader = origPaint.getShader();
SkColorFilter* cf = origPaint.getColorFilter();
SkXfermode* mode = origPaint.getXfermode();
- Sk3DShader* shader3D = NULL;
+ Sk3DShader* shader3D = nullptr;
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
- if (origPaint.getMaskFilter() != NULL &&
+ if (origPaint.getMaskFilter() != nullptr &&
origPaint.getMaskFilter()->getFormat() == SkMask::k3D_Format) {
shader3D = new Sk3DShader(shader);
// we know we haven't initialized lazyPaint yet, so just do it
@@ -810,8 +810,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
bool deviceIsOpaque = kRGB_565_SkColorType == device.colorType();
switch (SkInterpretXfermode(*paint, deviceIsOpaque)) {
case kSrcOver_SkXfermodeInterpretation:
- mode = NULL;
- paint.writable()->setXfermode(NULL);
+ mode = nullptr;
+ paint.writable()->setXfermode(nullptr);
break;
case kSkipDrawing_SkXfermodeInterpretation:{
return allocator->createT<SkNullBlitter>();
@@ -828,13 +828,13 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
*/
if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
SkPaint* p = paint.writable();
- shader = p->setShader(NULL);
- cf = p->setColorFilter(NULL);
+ shader = p->setShader(nullptr);
+ cf = p->setColorFilter(nullptr);
mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
p->setColor(0);
}
- if (NULL == shader) {
+ if (nullptr == shader) {
if (mode) {
// xfermodes (and filters) require shaders for our current blitters
shader = new SkColorShader(paint->getColor());
@@ -845,8 +845,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
// our color and move on.
SkPaint* writablePaint = paint.writable();
writablePaint->setColor(cf->filterColor(paint->getColor()));
- writablePaint->setColorFilter(NULL);
- cf = NULL;
+ writablePaint->setColorFilter(nullptr);
+ cf = nullptr;
}
}
@@ -861,9 +861,9 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
/*
* We create a SkShader::Context object, and store it on the blitter.
*/
- SkShader::Context* shaderContext = NULL;
+ SkShader::Context* shaderContext = nullptr;
if (shader) {
- SkShader::ContextRec rec(*paint, matrix, NULL);
+ SkShader::ContextRec rec(*paint, matrix, nullptr);
size_t contextSize = shader->contextSize();
if (contextSize) {
// Try to create the ShaderContext
@@ -880,12 +880,12 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
}
}
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
switch (device.colorType()) {
case kAlpha_8_SkColorType:
if (drawCoverage) {
- SkASSERT(NULL == shader);
- SkASSERT(NULL == paint->getXfermode());
+ SkASSERT(nullptr == shader);
+ SkASSERT(nullptr == paint->getXfermode());
blitter = allocator->createT<SkA8_Coverage_Blitter>(device, *paint);
} else if (shader) {
blitter = allocator->createT<SkA8_Shader_Blitter>(device, *paint, shaderContext);
@@ -933,7 +933,7 @@ class SkZeroShaderContext : public SkShader::Context {
public:
SkZeroShaderContext(const SkShader& shader, const SkShader::ContextRec& rec)
// Override rec with the identity matrix, so it is guaranteed to be invertible.
- : INHERITED(shader, SkShader::ContextRec(*rec.fPaint, SkMatrix::I(), NULL)) {}
+ : INHERITED(shader, SkShader::ContextRec(*rec.fPaint, SkMatrix::I(), nullptr)) {}
void shadeSpan(int x, int y, SkPMColor colors[], int count) override {
sk_bzero(colors, count * sizeof(SkPMColor));
@@ -967,7 +967,7 @@ bool SkShaderBlitter::resetShaderContext(const SkShader::ContextRec& rec) {
// shader to create it. It is therefore safe to re-use the storage.
fShaderContext->~Context();
SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
- if (NULL == ctx) {
+ if (nullptr == ctx) {
// Need a valid context in fShaderContext's storage, so we can later (or our caller) call
// the in-place destructor.
new (fShaderContext) SkZeroShaderContext(*fShader, rec);
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index baa9ccc39f..5740a5eaed 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -50,7 +50,7 @@ public:
virtual void blitMask(const SkMask&, const SkIRect& clip);
/** If the blitter just sets a single value for each pixel, return the
- bitmap it draws into, and assign value. If not, return NULL and ignore
+ bitmap it draws into, and assign value. If not, return nullptr and ignore
the value parameter.
*/
virtual const SkPixmap* justAnOpaqueColor(uint32_t* value);
@@ -109,7 +109,7 @@ public:
* This function allocates memory for the blitter that the blitter then owns.
* The memory can be used by the calling function at will, but it will be
* released when the blitter's destructor is called. This function returns
- * NULL if no persistent memory is needed by the blitter.
+ * nullptr if no persistent memory is needed by the blitter.
*/
virtual void* allocBlitMemory(size_t sz) {
return fBlitMemory.reset(sz, SkAutoMalloc::kReuse_OnShrink);
@@ -229,7 +229,7 @@ private:
class SkBlitterClipper {
public:
SkBlitter* apply(SkBlitter* blitter, const SkRegion* clip,
- const SkIRect* bounds = NULL);
+ const SkIRect* bounds = nullptr);
private:
SkNullBlitter fNullBlitter;
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index ce7d6e7ad2..51748b00e9 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -21,7 +21,7 @@ const SkPixmap* SkA8_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = 255;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
void SkA8_Blitter::blitH(int x, int y, int width) {
@@ -231,7 +231,7 @@ SkA8_Shader_Blitter::SkA8_Shader_Blitter(const SkPixmap& device, const SkPaint&
SkShader::Context* shaderContext)
: INHERITED(device, paint, shaderContext)
{
- if ((fXfermode = paint.getXfermode()) != NULL) {
+ if ((fXfermode = paint.getXfermode()) != nullptr) {
fXfermode->ref();
SkASSERT(fShaderContext);
}
@@ -260,7 +260,7 @@ void SkA8_Shader_Blitter::blitH(int x, int y, int width) {
shaderContext->shadeSpan(x, y, span, width);
if (fXfermode) {
- fXfermode->xferA8(device, span, width, NULL);
+ fXfermode->xferA8(device, span, width, nullptr);
} else {
for (int i = width - 1; i >= 0; --i) {
unsigned srcA = SkGetPackedA32(span[i]);
@@ -298,7 +298,7 @@ void SkA8_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
}
int aa = *antialias;
if (aa) {
- if (opaque && aa == 255 && mode == NULL) {
+ if (opaque && aa == 255 && mode == nullptr) {
memset(device, 0xFF, count);
} else {
shaderContext->shadeSpan(x, y, span, count);
@@ -355,9 +355,9 @@ void SkA8_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkPixmap& device,
const SkPaint& paint) : SkRasterBlitter(device) {
- SkASSERT(NULL == paint.getShader());
- SkASSERT(NULL == paint.getXfermode());
- SkASSERT(NULL == paint.getColorFilter());
+ SkASSERT(nullptr == paint.getShader());
+ SkASSERT(nullptr == paint.getXfermode());
+ SkASSERT(nullptr == paint.getColorFilter());
}
void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
@@ -430,5 +430,5 @@ void SkA8_Coverage_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
}
const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index 683acf0aae..e44ad02da5 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -59,7 +59,7 @@ const SkPixmap* SkARGB32_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = fPMColor;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
#if defined _WIN32 && _MSC_VER >= 1300 // disable warning : local variable used without having been initialized
@@ -338,7 +338,7 @@ SkARGB32_Shader_Blitter::SkARGB32_Shader_Blitter(const SkPixmap& device,
fProc32Blend = SkBlitRow::Factory32(flags | SkBlitRow::kGlobalAlpha_Flag32);
fShadeDirectlyIntoDevice = false;
- if (fXfermode == NULL) {
+ if (fXfermode == nullptr) {
if (shaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) {
fShadeDirectlyIntoDevice = true;
}
@@ -371,7 +371,7 @@ void SkARGB32_Shader_Blitter::blitH(int x, int y, int width) {
SkPMColor* span = fBuffer;
fShaderContext->shadeSpan(x, y, span, width);
if (fXfermode) {
- fXfermode->xfer32(device, span, width, NULL);
+ fXfermode->xfer32(device, span, width, nullptr);
} else {
fProc32(device, span, width, 255);
}
@@ -401,7 +401,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
SkXfermode* xfer = fXfermode;
if (xfer) {
do {
- xfer->xfer32(device, span, width, NULL);
+ xfer->xfer32(device, span, width, nullptr);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -438,7 +438,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
if (xfer) {
do {
shaderContext->shadeSpan(x, y, span, width);
- xfer->xfer32(device, span, width, NULL);
+ xfer->xfer32(device, span, width, nullptr);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -471,7 +471,7 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
if (aa) {
shaderContext->shadeSpan(x, y, span, count);
if (aa == 255) {
- xfer->xfer32(device, span, count, NULL);
+ xfer->xfer32(device, span, count, nullptr);
} else {
// count is almost always 1
for (int i = count - 1; i >= 0; --i) {
@@ -539,7 +539,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
SkASSERT(mask.fBounds.contains(clip));
SkShader::Context* shaderContext = fShaderContext;
- SkBlitMask::RowProc proc = NULL;
+ SkBlitMask::RowProc proc = nullptr;
if (!fXfermode) {
unsigned flags = 0;
if (shaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) {
@@ -547,7 +547,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
}
proc = SkBlitMask::RowFactory(kN32_SkColorType, mask.fFormat,
(SkBlitMask::RowFlags)flags);
- if (NULL == proc) {
+ if (nullptr == proc) {
this->INHERITED::blitMask(mask, clip);
return;
}
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index d87c636590..06dfeea1c1 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -172,9 +172,9 @@ private:
#ifdef USE_BLACK_BLITTER
SkRGB16_Black_Blitter::SkRGB16_Black_Blitter(const SkPixmap& device, const SkPaint& paint)
: INHERITED(device, paint) {
- SkASSERT(paint.getShader() == NULL);
- SkASSERT(paint.getColorFilter() == NULL);
- SkASSERT(paint.getXfermode() == NULL);
+ SkASSERT(paint.getShader() == nullptr);
+ SkASSERT(paint.getColorFilter() == nullptr);
+ SkASSERT(paint.getXfermode() == nullptr);
SkASSERT(paint.getColor() == SK_ColorBLACK);
}
@@ -568,7 +568,7 @@ const SkPixmap* SkRGB16_Blitter::justAnOpaqueColor(uint32_t* value) {
*value = fRawColor16;
return &fDevice;
}
- return NULL;
+ return nullptr;
}
void SkRGB16_Blitter::blitH(int x, int y, int width) {
@@ -822,7 +822,7 @@ SkRGB16_Shader_Blitter::SkRGB16_Shader_Blitter(const SkPixmap& device,
SkShader::Context* shaderContext)
: INHERITED(device, paint, shaderContext)
{
- SkASSERT(paint.getXfermode() == NULL);
+ SkASSERT(paint.getXfermode() == nullptr);
fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * sizeof(SkPMColor));
@@ -970,7 +970,7 @@ void SkRGB16_Shader_Xfermode_Blitter::blitH(int x, int y, int width) {
SkPMColor* span = fBuffer;
fShaderContext->shadeSpan(x, y, span, width);
- fXfermode->xfer16(device, span, width, NULL);
+ fXfermode->xfer16(device, span, width, nullptr);
}
void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
@@ -1006,7 +1006,7 @@ void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
SkPMColor* localSpan = span;
for (;;) {
if (aa == 0xFF) {
- mode->xfer16(device, localSpan, count, NULL);
+ mode->xfer16(device, localSpan, count, nullptr);
} else {
SkASSERT(aa);
memset(aaExpand, aa, count);
@@ -1033,17 +1033,17 @@ void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
SkBlitter* SkBlitter_ChooseD565(const SkPixmap& device, const SkPaint& paint,
SkShader::Context* shaderContext,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
SkBlitter* blitter;
SkShader* shader = paint.getShader();
SkXfermode* mode = paint.getXfermode();
// we require a shader if there is an xfermode, handled by our caller
- SkASSERT(NULL == mode || shader);
+ SkASSERT(nullptr == mode || shader);
if (shader) {
- SkASSERT(shaderContext != NULL);
+ SkASSERT(shaderContext != nullptr);
if (mode) {
blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device, paint,
shaderContext);
diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp
index 6dc5785cec..605fa43bf6 100644
--- a/src/core/SkBlitter_Sprite.cpp
+++ b/src/core/SkBlitter_Sprite.cpp
@@ -51,7 +51,7 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
paint and return null if it is set, forcing the client to take the slow shader case
(which does respect soft edges).
*/
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
SkSpriteBlitter* blitter;
@@ -63,7 +63,7 @@ SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint,
blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator);
break;
default:
- blitter = NULL;
+ blitter = nullptr;
break;
}
diff --git a/src/core/SkBuffer.cpp b/src/core/SkBuffer.cpp
index 51c368abe8..86c3bed3f1 100644
--- a/src/core/SkBuffer.cpp
+++ b/src/core/SkBuffer.cpp
@@ -22,7 +22,7 @@ void SkRBuffer::readNoSizeCheck(void* buffer, size_t size)
const void* SkRBuffer::skip(size_t size)
{
const void* result = fPos;
- readNoSizeCheck(NULL, size);
+ readNoSizeCheck(nullptr, size);
return result;
}
@@ -45,8 +45,8 @@ bool SkRBufferWithSizeCheck::read(void* buffer, size_t size) {
void* SkWBuffer::skip(size_t size)
{
void* result = fPos;
- writeNoSizeCheck(NULL, size);
- return fData == NULL ? NULL : result;
+ writeNoSizeCheck(nullptr, size);
+ return fData == nullptr ? nullptr : result;
}
void SkWBuffer::writeNoSizeCheck(const void* buffer, size_t size)
diff --git a/src/core/SkCachedData.cpp b/src/core/SkCachedData.cpp
index 439c2ffe05..cfa4c6165f 100644
--- a/src/core/SkCachedData.cpp
+++ b/src/core/SkCachedData.cpp
@@ -151,7 +151,7 @@ void SkCachedData::inMutexLock() {
SkASSERT(ptr);
this->setData(ptr);
} else {
- this->setData(NULL); // signal failure to lock, contents are gone
+ this->setData(nullptr); // signal failure to lock, contents are gone
}
break;
}
@@ -173,7 +173,7 @@ void SkCachedData::inMutexUnlock() {
}
break;
}
- this->setData(NULL); // signal that we're in an unlocked state
+ this->setData(nullptr); // signal that we're in an unlocked state
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -192,7 +192,7 @@ void SkCachedData::validate() const {
}
} else {
SkASSERT((fInCache && 1 == fRefCnt) || (0 == fRefCnt));
- SkASSERT(NULL == fData);
+ SkASSERT(nullptr == fData);
}
}
#endif
diff --git a/src/core/SkCachedData.h b/src/core/SkCachedData.h
index d44fbc5895..739be72182 100644
--- a/src/core/SkCachedData.h
+++ b/src/core/SkCachedData.h
@@ -36,7 +36,7 @@ public:
}
protected:
- // called when fData changes. could be NULL.
+ // called when fData changes. could be nullptr.
virtual void onDataChange(void* oldData, void* newData) {}
private:
@@ -93,7 +93,7 @@ public:
* ref's the data (typically from a find(key, visitor) call).
*
* Thus the data will always be "locked" when a non-cache has a ref on it (whether or not
- * the lock succeeded to recover the memory -- check data() to see if it is NULL).
+ * the lock succeeded to recover the memory -- check data() to see if it is nullptr).
*/
/*
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 03c5173e10..7043ec3bc3 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -194,16 +194,16 @@ struct DeviceCM {
DeviceCM(SkBaseDevice* device, const SkPaint* paint, SkCanvas* canvas,
bool conservativeRasterClip, bool deviceIsBitmapDevice)
- : fNext(NULL)
+ : fNext(nullptr)
, fClip(conservativeRasterClip)
, fDeviceIsBitmapDevice(deviceIsBitmapDevice)
{
- if (NULL != device) {
+ if (nullptr != device) {
device->ref();
device->onAttachToCanvas(canvas);
}
fDevice = device;
- fPaint = paint ? new SkPaint(*paint) : NULL;
+ fPaint = paint ? new SkPaint(*paint) : nullptr;
}
~DeviceCM() {
@@ -284,9 +284,9 @@ public:
int fDeferredSaveCount;
MCRec(bool conservativeRasterClip) : fRasterClip(conservativeRasterClip) {
- fFilter = NULL;
- fLayer = NULL;
- fTopLayer = NULL;
+ fFilter = nullptr;
+ fLayer = nullptr;
+ fTopLayer = nullptr;
fMatrix.reset();
fDeferredSaveCount = 0;
@@ -295,7 +295,7 @@ public:
}
MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix) {
fFilter = SkSafeRef(prev.fFilter);
- fLayer = NULL;
+ fLayer = nullptr;
fTopLayer = prev.fTopLayer;
fDeferredSaveCount = 0;
@@ -346,13 +346,13 @@ public:
fRC = &rec->fClip;
fDevice = rec->fDevice;
if (!fDevice->accessPixels(&fDst)) {
- fDst.reset(fDevice->imageInfo(), NULL, 0);
+ fDst.reset(fDevice->imageInfo(), nullptr, 0);
}
fPaint = rec->fPaint;
SkDEBUGCODE(this->validate();)
fCurrLayer = rec->fNext;
- // fCurrLayer may be NULL now
+ // fCurrLayer may be nullptr now
return true;
}
@@ -383,21 +383,21 @@ static SkPaint* set_if_needed(SkLazyPaint* lazy, const SkPaint& orig) {
/**
* If the paint has an imagefilter, but it can be simplified to just a colorfilter, return that
- * colorfilter, else return NULL.
+ * colorfilter, else return nullptr.
*/
static SkColorFilter* image_to_color_filter(const SkPaint& paint) {
SkImageFilter* imgf = paint.getImageFilter();
if (!imgf) {
- return NULL;
+ return nullptr;
}
SkColorFilter* imgCF;
if (!imgf->asAColorFilter(&imgCF)) {
- return NULL;
+ return nullptr;
}
SkColorFilter* paintCF = paint.getColorFilter();
- if (NULL == paintCF) {
+ if (nullptr == paintCF) {
// there is no existing paint colorfilter, so we can just return the imagefilter's
return imgCF;
}
@@ -412,7 +412,7 @@ class AutoDrawLooper {
public:
AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint,
bool skipLayerForImageFilter = false,
- const SkRect* bounds = NULL) : fOrigPaint(paint) {
+ const SkRect* bounds = nullptr) : fOrigPaint(paint) {
fCanvas = canvas;
fFilter = canvas->getDrawFilter();
fPaint = &fOrigPaint;
@@ -424,7 +424,7 @@ public:
if (simplifiedCF) {
SkPaint* paint = set_if_needed(&fLazyPaintInit, fOrigPaint);
paint->setColorFilter(simplifiedCF)->unref();
- paint->setImageFilter(NULL);
+ paint->setImageFilter(nullptr);
fPaint = paint;
}
@@ -459,7 +459,7 @@ public:
fLooperContext = looper->createContext(canvas, buffer);
fIsSimple = false;
} else {
- fLooperContext = NULL;
+ fLooperContext = nullptr;
// can we be marked as simple?
fIsSimple = !fFilter && !fTempLayerForImageFilter;
}
@@ -516,7 +516,7 @@ private:
};
bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
- fPaint = NULL;
+ fPaint = nullptr;
SkASSERT(!fIsSimple);
SkASSERT(fLooperContext || fFilter || fTempLayerForImageFilter);
@@ -525,8 +525,8 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
paint->setFlags(fNewPaintFlags);
if (fTempLayerForImageFilter) {
- paint->setImageFilter(NULL);
- paint->setXfermode(NULL);
+ paint->setImageFilter(nullptr);
+ paint->setXfermode(nullptr);
}
if (fLooperContext && !fLooperContext->next(fCanvas, paint)) {
@@ -538,7 +538,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
fDone = true;
return false;
}
- if (NULL == fLooperContext) {
+ if (nullptr == fLooperContext) {
// no looper means we only draw once
fDone = true;
}
@@ -552,7 +552,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
// call this after any possible paint modifiers
if (fPaint->nothingToDraw()) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
return true;
@@ -602,7 +602,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
fAllowSimplifyClip = false;
fDeviceCMDirty = true;
fSaveCount = 1;
- fMetaData = NULL;
+ fMetaData = nullptr;
fClipStack.reset(new SkClipStack);
@@ -611,11 +611,11 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
SkASSERT(sizeof(DeviceCM) <= sizeof(fDeviceCMStorage));
fMCRec->fLayer = (DeviceCM*)fDeviceCMStorage;
- new (fDeviceCMStorage) DeviceCM(NULL, NULL, NULL, fConservativeRasterClip, false);
+ new (fDeviceCMStorage) DeviceCM(nullptr, nullptr, nullptr, fConservativeRasterClip, false);
fMCRec->fTopLayer = fMCRec->fLayer;
- fSurfaceBase = NULL;
+ fSurfaceBase = nullptr;
if (device) {
// The root device and the canvas should always have the same pixel geometry
@@ -636,7 +636,7 @@ SkCanvas::SkCanvas()
{
inc_canvas();
- this->init(NULL, kDefault_InitFlags);
+ this->init(nullptr, kDefault_InitFlags);
}
static SkBitmap make_nopixels(int width, int height) {
@@ -739,7 +739,7 @@ SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
SkMetaData& SkCanvas::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
- if (NULL == fMetaData) {
+ if (nullptr == fMetaData) {
fMetaData = new SkMetaData;
}
return *fMetaData;
@@ -789,7 +789,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
}
bool weAllocated = false;
- if (NULL == bitmap->pixelRef()) {
+ if (nullptr == bitmap->pixelRef()) {
if (!bitmap->tryAllocPixels()) {
return false;
}
@@ -805,7 +805,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
}
if (weAllocated) {
- bitmap->setPixelRef(NULL);
+ bitmap->setPixelRef(nullptr);
}
return false;
}
@@ -867,7 +867,7 @@ bool SkCanvas::writePixels(const SkImageInfo& origInfo, const void* pixels, size
default:
break;
}
- if (NULL == pixels || rowBytes < origInfo.minRowBytes()) {
+ if (nullptr == pixels || rowBytes < origInfo.minRowBytes()) {
return false;
}
@@ -915,13 +915,13 @@ void SkCanvas::updateDeviceCMCache() {
const SkRasterClip& totalClip = fMCRec->fRasterClip;
DeviceCM* layer = fMCRec->fTopLayer;
- if (NULL == layer->fNext) { // only one layer
- layer->updateMC(totalMatrix, totalClip, *fClipStack, NULL);
+ if (nullptr == layer->fNext) { // only one layer
+ layer->updateMC(totalMatrix, totalClip, *fClipStack, nullptr);
} else {
SkRasterClip clip(totalClip);
do {
layer->updateMC(totalMatrix, clip, *fClipStack, &clip);
- } while ((layer = layer->fNext) != NULL);
+ } while ((layer = layer->fNext) != nullptr);
}
fDeviceCMDirty = false;
}
@@ -1056,7 +1056,7 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
if (gIgnoreSaveLayerBounds) {
- bounds = NULL;
+ bounds = nullptr;
}
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag);
fSaveCount += 1;
@@ -1066,7 +1066,7 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) {
if (gIgnoreSaveLayerBounds) {
- bounds = NULL;
+ bounds = nullptr;
}
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
fSaveCount += 1;
@@ -1087,7 +1087,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
fDeviceCMDirty = true;
SkIRect ir;
- if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : NULL)) {
+ if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : nullptr)) {
return;
}
@@ -1110,7 +1110,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
SkBaseDevice* device = this->getTopDevice();
- if (NULL == device) {
+ if (nullptr == device) {
SkDebugf("Unable to find device for layer.");
return;
}
@@ -1120,11 +1120,11 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo);
SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint);
- if (NULL == newDev) {
+ if (nullptr == newDev) {
// If onCreateDevice didn't succeed, try raster (e.g. PDF couldn't handle the paint)
const SkSurfaceProps surfaceProps(fProps.flags(), createInfo.fPixelGeometry);
newDev = SkBitmapDevice::Create(createInfo.fInfo, surfaceProps);
- if (NULL == newDev) {
+ if (nullptr == newDev) {
SkErrorInternals::SetError(kInternalError_SkError,
"Unable to create device for layer.");
return;
@@ -1151,7 +1151,7 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
SaveFlags flags) {
if (0xFF == alpha) {
- return this->saveLayer(bounds, NULL, flags);
+ return this->saveLayer(bounds, nullptr, flags);
} else {
SkPaint tmpPaint;
tmpPaint.setAlpha(alpha);
@@ -1170,7 +1170,7 @@ void SkCanvas::internalRestore() {
// reserve our layer (if any)
DeviceCM* layer = fMCRec->fLayer; // may be null
// now detach it from fMCRec so we can pop(). Gets freed after its drawn
- fMCRec->fLayer = NULL;
+ fMCRec->fLayer = nullptr;
// now do the normal restore()
fMCRec->~MCRec(); // balanced in save()
@@ -1198,7 +1198,7 @@ void SkCanvas::internalRestore() {
}
SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) {
- if (NULL == props) {
+ if (nullptr == props) {
props = &fProps;
}
return this->onNewSurface(info, *props);
@@ -1206,7 +1206,7 @@ SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
SkBaseDevice* dev = this->getDevice();
- return dev ? dev->newSurface(info, props) : NULL;
+ return dev ? dev->newSurface(info, props) : nullptr;
}
SkImageInfo SkCanvas::imageInfo() const {
@@ -1221,7 +1221,7 @@ SkImageInfo SkCanvas::imageInfo() const {
const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) {
SkPixmap pmap;
if (!this->onPeekPixels(&pmap)) {
- return NULL;
+ return nullptr;
}
if (info) {
*info = pmap.info();
@@ -1240,7 +1240,7 @@ bool SkCanvas::onPeekPixels(SkPixmap* pmap) {
void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin) {
SkPixmap pmap;
if (!this->onAccessTopLayerPixels(&pmap)) {
- return NULL;
+ return nullptr;
}
if (info) {
*info = pmap.info();
@@ -1261,13 +1261,13 @@ bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) {
fAddr = canvas->peekPixels(&fInfo, &fRowBytes);
- if (NULL == fAddr) {
+ if (nullptr == fAddr) {
fInfo = canvas->imageInfo();
if (kUnknown_SkColorType == fInfo.colorType() || !fBitmap.tryAllocPixels(fInfo)) {
- return; // failure, fAddr is NULL
+ return; // failure, fAddr is nullptr
}
if (!canvas->readPixels(&fBitmap, 0, 0)) {
- return; // failure, fAddr is NULL
+ return; // failure, fAddr is nullptr
}
fAddr = fBitmap.getPixels();
fRowBytes = fBitmap.rowBytes();
@@ -1292,14 +1292,14 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
SkDEBUGCODE(bitmap.validate();)
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint && paint->canComputeFastBounds()) {
bitmap.getBounds(&storage);
matrix.mapRect(&storage);
@@ -1318,7 +1318,7 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
const SkPaint* paint, bool deviceIsBitmapDevice) {
SkPaint tmp;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &tmp;
}
@@ -1340,7 +1340,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
- tmpUnfiltered.setImageFilter(NULL);
+ tmpUnfiltered.setImageFilter(nullptr);
dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + offset.y(),
tmpUnfiltered);
}
@@ -1370,7 +1370,7 @@ void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint*
SkDEBUGCODE(bitmap.validate();)
SkPaint tmp;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &tmp;
}
@@ -1391,7 +1391,7 @@ void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint*
SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
- tmpUnfiltered.setImageFilter(NULL);
+ tmpUnfiltered.setImageFilter(nullptr);
iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + offset.y(),
tmpUnfiltered);
}
@@ -1648,7 +1648,7 @@ void SkCanvas::validateClip() const {
SkClipStack::B2TIter iter(*fClipStack);
const SkClipStack::Element* element;
- while ((element = iter.next()) != NULL) {
+ while ((element = iter.next()) != nullptr) {
switch (element->getType()) {
case SkClipStack::Element::kRect_Type:
element->getRect().round(&ir);
@@ -1672,7 +1672,7 @@ void SkCanvas::replayClips(ClipVisitor* visitor) const {
SkClipStack::B2TIter iter(*fClipStack);
const SkClipStack::Element* element;
- while ((element = iter.next()) != NULL) {
+ while ((element = iter.next()) != nullptr) {
element->replay(visitor);
}
}
@@ -1770,7 +1770,7 @@ const SkRegion& SkCanvas::internal_private_getTotalClip() const {
GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() {
SkBaseDevice* dev = this->getTopDevice();
- return dev ? dev->accessRenderTarget() : NULL;
+ return dev ? dev->accessRenderTarget() : nullptr;
}
GrContext* SkCanvas::getGrContext() {
@@ -1784,7 +1784,7 @@ GrContext* SkCanvas::getGrContext() {
}
#endif
- return NULL;
+ return nullptr;
}
@@ -1967,7 +1967,7 @@ void SkCanvas::onDrawPaint(const SkPaint& paint) {
}
void SkCanvas::internalDrawPaint(const SkPaint& paint) {
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, NULL, false)
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, nullptr, false)
while (iter.next()) {
iter.fDevice->drawPaint(iter, looper.paint());
@@ -1984,7 +1984,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
SkRect r, storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
// special-case 2 points (common for drawing a single line)
if (2 == count) {
@@ -1998,7 +1998,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
}
- SkASSERT(pts != NULL);
+ SkASSERT(pts != nullptr);
LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds)
@@ -2012,7 +2012,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
// Skia will draw an inverted rect, because it explicitly "sorts" it downstream.
// To prevent accidental rejecting at this stage, we have to sort it before we check.
@@ -2037,7 +2037,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(oval, &storage);
if (this->quickReject(*bounds)) {
@@ -2057,7 +2057,7 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(rrect.getBounds(), &storage);
if (this->quickReject(*bounds)) {
@@ -2087,7 +2087,7 @@ void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
const SkPaint& paint) {
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
bounds = &paint.computeFastBounds(outer.getBounds(), &storage);
if (this->quickReject(*bounds)) {
@@ -2111,7 +2111,7 @@ void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
}
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (!path.isInverseFillType() && paint.canComputeFastBounds()) {
const SkRect& pathBounds = path.getBounds();
bounds = &paint.computeFastBounds(pathBounds, &storage);
@@ -2141,7 +2141,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
SkRect bounds = SkRect::MakeXYWH(x, y,
SkIntToScalar(image->width()), SkIntToScalar(image->height()));
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
paint->computeFastBounds(bounds, &bounds);
}
@@ -2151,7 +2151,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2169,7 +2169,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2178,7 +2178,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
}
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2196,7 +2196,7 @@ void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
SkDEBUGCODE(bitmap.validate();)
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
SkRect bounds = {
x, y,
x + SkIntToScalar(bitmap.width()),
@@ -2225,7 +2225,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2235,7 +2235,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2262,7 +2262,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2272,7 +2272,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2292,7 +2292,7 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
SkRect storage;
const SkRect* bounds = &dst;
- if (NULL == paint || paint->canComputeFastBounds()) {
+ if (nullptr == paint || paint->canComputeFastBounds()) {
if (paint) {
bounds = &paint->computeFastBounds(dst, &storage);
}
@@ -2302,7 +2302,7 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
}
SkLazyPaint lazy;
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = lazy.init();
}
@@ -2349,12 +2349,12 @@ void SkCanvas::DrawRect(const SkDraw& draw, const SkPaint& paint,
void SkCanvas::DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0 ||
+ if (text == nullptr || byteLength == 0 ||
draw.fClip->isEmpty() ||
- (paint.getAlpha() == 0 && paint.getXfermode() == NULL)) {
+ (paint.getAlpha() == 0 && paint.getXfermode() == nullptr)) {
return;
}
@@ -2409,7 +2409,7 @@ void SkCanvas::DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2425,7 +2425,7 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
const SkPaint& paint) {
SkPoint textOffset = SkPoint::Make(0, 0);
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2441,7 +2441,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
SkPoint textOffset = SkPoint::Make(0, constY);
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
@@ -2454,7 +2454,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawTextOnPath(iter, text, byteLength, path,
@@ -2468,7 +2468,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
SkRect storage;
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (paint.canComputeFastBounds()) {
storage = blob->bounds().makeOffset(x, y);
bounds = &paint.computeFastBounds(storage, &storage);
@@ -2481,7 +2481,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
// We cannot filter in the looper as we normally do, because the paint is
// incomplete at this point (text-related attributes are embedded within blob run paints).
SkDrawFilter* drawFilter = fMCRec->fFilter;
- fMCRec->fFilter = NULL;
+ fMCRec->fFilter = nullptr;
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
@@ -2530,7 +2530,7 @@ void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()");
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs,
@@ -2544,7 +2544,7 @@ void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPatch()");
- if (NULL == cubics) {
+ if (nullptr == cubics) {
return;
}
@@ -2562,7 +2562,7 @@ void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawPatch(iter, cubics, colors, texCoords, xmode, paint);
@@ -2577,7 +2577,7 @@ void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) {
SkMatrix matrix = SkMatrix::MakeTrans(x, y);
this->onDrawDrawable(dr, &matrix);
} else {
- this->onDrawDrawable(dr, NULL);
+ this->onDrawDrawable(dr, nullptr);
}
}
}
@@ -2585,7 +2585,7 @@ void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) {
void SkCanvas::drawDrawable(SkDrawable* dr, const SkMatrix* matrix) {
if (dr) {
if (matrix && matrix->isIdentity()) {
- matrix = NULL;
+ matrix = nullptr;
}
this->onDrawDrawable(dr, matrix);
}
@@ -2614,7 +2614,7 @@ void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const
pnt = *paint;
}
- LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL)
+ LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr)
while (iter.next()) {
iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pnt);
}
@@ -2761,7 +2761,7 @@ void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPicture()");
if (picture) {
if (matrix && matrix->isIdentity()) {
- matrix = NULL;
+ matrix = nullptr;
}
if (picture->approximateOpCount() <= kMaxPictureOpsToUnrollInsteadOfRef) {
SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
@@ -2830,7 +2830,7 @@ const SkMatrix& SkCanvas::LayerIter::matrix() const {
const SkPaint& SkCanvas::LayerIter::paint() const {
const SkPaint* paint = fImpl->getPaint();
- if (NULL == paint) {
+ if (nullptr == paint) {
paint = &fDefaultPaint;
}
return *paint;
@@ -2869,12 +2869,12 @@ static bool supported_for_raster_canvas(const SkImageInfo& info) {
SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes) {
if (!supported_for_raster_canvas(info)) {
- return NULL;
+ return nullptr;
}
SkBitmap bitmap;
if (!bitmap.installPixels(info, pixels, rowBytes)) {
- return NULL;
+ return nullptr;
}
return new SkCanvas(bitmap);
}
diff --git a/src/core/SkChunkAlloc.cpp b/src/core/SkChunkAlloc.cpp
index 4a71c2d2c4..3f30276f1b 100644
--- a/src/core/SkChunkAlloc.cpp
+++ b/src/core/SkChunkAlloc.cpp
@@ -30,7 +30,7 @@ struct SkChunkAlloc::Block {
}
void reset() {
- fNext = NULL;
+ fNext = nullptr;
fFreeSize = this->blockSize();
fFreePtr = this->startOfData();
}
@@ -60,7 +60,7 @@ SkChunkAlloc::SkChunkAlloc(size_t minSize) {
minSize = MIN_CHUNKALLOC_BLOCK_SIZE;
}
- fBlock = NULL;
+ fBlock = nullptr;
fMinSize = minSize;
fChunkSize = fMinSize;
fTotalCapacity = 0;
@@ -75,7 +75,7 @@ SkChunkAlloc::~SkChunkAlloc() {
void SkChunkAlloc::reset() {
Block::FreeChain(fBlock);
- fBlock = NULL;
+ fBlock = nullptr;
fChunkSize = fMinSize; // reset to our initial minSize
fTotalCapacity = 0;
fTotalUsed = 0;
@@ -142,7 +142,7 @@ SkChunkAlloc::Block* SkChunkAlloc::addBlockIfNecessary(size_t bytes, AllocFailTy
if (!fBlock || bytes > fBlock->fFreeSize) {
Block* block = this->newBlock(bytes, ftype);
if (!block) {
- return NULL;
+ return nullptr;
}
#ifdef SK_DEBUG
if (fBlock) {
@@ -164,7 +164,7 @@ void* SkChunkAlloc::alloc(size_t bytes, AllocFailType ftype) {
Block* block = this->addBlockIfNecessary(bytes, ftype);
if (!block) {
- return NULL;
+ return nullptr;
}
char* ptr = block->fFreePtr;
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 9541cc613f..f54d57fd0b 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -395,7 +395,7 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) {
fFiniteBoundType = kNormal_BoundsType;
if (SkRegion::kReplace_Op == fOp ||
- (SkRegion::kIntersect_Op == fOp && NULL == prior) ||
+ (SkRegion::kIntersect_Op == fOp && nullptr == prior) ||
(SkRegion::kIntersect_Op == fOp && prior->fIsIntersectionOfRects &&
prior->rectRectIntersectAllowed(this->getRect(), fDoAA))) {
fIsIntersectionOfRects = true;
@@ -431,7 +431,7 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) {
SkRect prevFinite;
SkClipStack::BoundsType prevType;
- if (NULL == prior) {
+ if (nullptr == prior) {
// no prior clip means the entire plane is writable
prevFinite.setEmpty(); // there are no pixels that cannot be drawn to
prevType = kInsideOut_BoundsType;
@@ -529,7 +529,7 @@ SkClipStack& SkClipStack::operator=(const SkClipStack& b) {
fSaveCount = b.fSaveCount;
SkDeque::F2BIter recIter(b.fDeque);
for (const Element* element = (const Element*)recIter.next();
- element != NULL;
+ element != nullptr;
element = (const Element*)recIter.next()) {
new (fDeque.push_back()) Element(*element);
}
@@ -550,14 +550,14 @@ bool SkClipStack::operator==(const SkClipStack& b) const {
const Element* myElement = (const Element*)myIter.next();
const Element* bElement = (const Element*)bIter.next();
- while (myElement != NULL && bElement != NULL) {
+ while (myElement != nullptr && bElement != nullptr) {
if (*myElement != *bElement) {
return false;
}
myElement = (const Element*)myIter.next();
bElement = (const Element*)bIter.next();
}
- return myElement == NULL && bElement == NULL;
+ return myElement == nullptr && bElement == nullptr;
}
void SkClipStack::reset() {
@@ -599,7 +599,7 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound,
Element* element = (Element*)fDeque.back();
- if (NULL == element) {
+ if (nullptr == element) {
// the clip is wide open - the infinite plane w/ no pixels un-writeable
canvFiniteBound->setEmpty();
*boundType = kInsideOut_BoundsType;
@@ -620,7 +620,7 @@ bool SkClipStack::quickContains(const SkRect& rect) const {
Iter iter(*this, Iter::kTop_IterStart);
const Element* element = iter.prev();
- while (element != NULL) {
+ while (element != nullptr) {
if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
return false;
if (element->isInverseFilled()) {
@@ -747,7 +747,7 @@ bool SkClipStack::isWideOpen() const {
///////////////////////////////////////////////////////////////////////////////
-SkClipStack::Iter::Iter() : fStack(NULL) {
+SkClipStack::Iter::Iter() : fStack(nullptr) {
}
SkClipStack::Iter::Iter(const SkClipStack& stack, IterStart startLoc)
@@ -765,13 +765,13 @@ const SkClipStack::Element* SkClipStack::Iter::prev() {
const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
- if (NULL == fStack) {
- return NULL;
+ if (nullptr == fStack) {
+ return nullptr;
}
fIter.reset(fStack->fDeque, SkDeque::Iter::kBack_IterStart);
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
for (element = (const SkClipStack::Element*) fIter.prev();
element;
@@ -784,7 +784,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
// return on the next "next" or "prev" call) the element
// in front of it in the deque. Bump the iterator forward a
// step so we get the expected result.
- if (NULL == fIter.next()) {
+ if (nullptr == fIter.next()) {
// The reverse iterator has run off the front of the deque
// (i.e., the "op" clip is the first clip) and can't
// recover. Reset the iterator to start at the front.
@@ -794,7 +794,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
}
}
- if (NULL == element) {
+ if (nullptr == element) {
// There were no "op" clips
fIter.reset(fStack->fDeque, SkDeque::Iter::kFront_IterStart);
}
@@ -899,7 +899,7 @@ void SkClipStack::Element::dump() const {
SkDebugf("\n");
break;
case kPath_Type:
- this->getPath().dump(NULL, true, false);
+ this->getPath().dump(nullptr, true, false);
break;
}
}
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index e1670b8e73..c67869fd65 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -130,7 +130,7 @@ SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorF
int count = inner->privateComposedFilterCount() + outer->privateComposedFilterCount();
if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
- return NULL;
+ return nullptr;
}
return new SkComposeColorFilter(outer, inner, count);
}
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 5a4e0a44e2..13c4795c3f 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -76,7 +76,7 @@ SkColorTable::SkColorTable(SkReadBuffer& buffer) {
SkDEBUGCODE(success =) buffer.readColorArray(fColors, fCount);
} else {
fCount = 0;
- fColors = NULL;
+ fColors = nullptr;
}
#ifdef SK_DEBUG
SkASSERT((unsigned)fCount <= 256);
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp
index 094dfdbc3d..853e157721 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -58,7 +58,7 @@ SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) {
SkAutoTUnref<SkShader> shaderB(buffer.readShader());
SkAutoTUnref<SkXfermode> mode(buffer.readXfermode());
if (!shaderA.get() || !shaderB.get()) {
- return NULL;
+ return nullptr;
}
return new SkComposeShader(shaderA, shaderB, mode);
}
@@ -99,7 +99,7 @@ SkShader::Context* SkComposeShader::onCreateContext(const ContextRec& rec, void*
if (!contextA || !contextB) {
safe_call_destructor(contextA);
safe_call_destructor(contextB);
- return NULL;
+ return nullptr;
}
return new (storage) ComposeShaderContext(*this, rec, contextA, contextB);
@@ -143,7 +143,7 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
SkPMColor tmp[TMP_COLOR_COUNT];
- if (NULL == mode) { // implied SRC_OVER
+ if (nullptr == mode) { // implied SRC_OVER
// TODO: when we have a good test-case, should use SkBlitRow::Proc32
// for these loops
do {
@@ -179,7 +179,7 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
shaderContextA->shadeSpan(x, y, result, n);
shaderContextB->shadeSpan(x, y, tmp, n);
- mode->xfer32(result, tmp, n, NULL);
+ mode->xfer32(result, tmp, n, nullptr);
if (256 != scale) {
for (int i = 0; i < n; i++) {
diff --git a/src/core/SkConfig8888.cpp b/src/core/SkConfig8888.cpp
index f49ab45c67..53f35c3737 100644
--- a/src/core/SkConfig8888.cpp
+++ b/src/core/SkConfig8888.cpp
@@ -237,9 +237,9 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
return false;
}
- const SkPMColor* table = NULL;
+ const SkPMColor* table = nullptr;
if (kIndex_8_SkColorType == srcInfo.colorType()) {
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
table = ctable->readColors();
@@ -276,11 +276,11 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
// TODO: switch the allocation of tmpDst to call sk_calloc_throw
{
SkBitmap bm;
- if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctable, NULL, NULL)) {
+ if (!bm.installPixels(srcInfo, const_cast<void*>(srcPixels), srcRB, ctable, nullptr, nullptr)) {
return false;
}
SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterDirect(dstInfo, dstPixels, dstRB));
- if (NULL == canvas.get()) {
+ if (nullptr == canvas.get()) {
return false;
}
diff --git a/src/core/SkConfig8888.h b/src/core/SkConfig8888.h
index 954f2b5387..ff287267aa 100644
--- a/src/core/SkConfig8888.h
+++ b/src/core/SkConfig8888.h
@@ -19,7 +19,7 @@ struct SkPixelInfo {
static bool CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRowBytes,
- SkColorTable* srcCTable = NULL);
+ SkColorTable* srcCTable = nullptr);
};
struct SkDstPixelInfo : SkPixelInfo {
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index bf00956b3a..3a088aa034 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -352,7 +352,7 @@ const SkConvolutionFilter1D::ConvolutionFixed* SkConvolutionFilter1D::GetSingleF
*filterLength = filter.fTrimmedLength;
*specifiedFilterlength = filter.fLength;
if (filter.fTrimmedLength == 0) {
- return NULL;
+ return nullptr;
}
return &fFilterValues[filter.fDataLocation];
diff --git a/src/core/SkConvolver.h b/src/core/SkConvolver.h
index 4beb7550f7..4e4d80692f 100644
--- a/src/core/SkConvolver.h
+++ b/src/core/SkConvolver.h
@@ -91,7 +91,7 @@ public:
*filterOffset = filter.fOffset;
*filterLength = filter.fTrimmedLength;
if (filter.fTrimmedLength == 0) {
- return NULL;
+ return nullptr;
}
return &fFilterValues[filter.fDataLocation];
}
@@ -102,7 +102,7 @@ public:
// |specifiedFilterLength| may be different if leading/trailing zeros of the
// original floating point form were clipped.
// There will be |filterLength| values in the return array.
- // Returns NULL if the filter is 0-length (for instance when all floating
+ // Returns nullptr if the filter is 0-length (for instance when all floating
// point values passed to AddFilter were clipped to 0).
SK_API const ConvolutionFixed* GetSingleFilter(int* specifiedFilterLength,
int* filterOffset,
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 4590e3bafe..9e65d2a32e 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -26,8 +26,8 @@ SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context) {
SkData::SkData(size_t size) {
fPtr = (char*)(this + 1); // contents are immediately after this
fSize = size;
- fReleaseProc = NULL;
- fReleaseProcContext = NULL;
+ fReleaseProc = nullptr;
+ fReleaseProcContext = nullptr;
}
SkData::~SkData() {
@@ -37,7 +37,7 @@ SkData::~SkData() {
}
bool SkData::equals(const SkData* other) const {
- if (NULL == other) {
+ if (nullptr == other) {
return false;
}
@@ -81,7 +81,7 @@ SkData* SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) {
///////////////////////////////////////////////////////////////////////////////
// As a template argument these must have external linkage.
-SkData* sk_new_empty_data() { return new SkData(NULL, 0, NULL, NULL); }
+SkData* sk_new_empty_data() { return new SkData(nullptr, 0, nullptr, nullptr); }
namespace { void sk_unref_data(SkData* ptr) { return SkSafeUnref(ptr); } }
SK_DECLARE_STATIC_LAZY_PTR(SkData, empty, sk_new_empty_data, sk_unref_data);
@@ -96,7 +96,7 @@ static void sk_free_releaseproc(const void* ptr, void*) {
}
SkData* SkData::NewFromMalloc(const void* data, size_t length) {
- return new SkData(data, length, sk_free_releaseproc, NULL);
+ return new SkData(data, length, sk_free_releaseproc, nullptr);
}
SkData* SkData::NewWithCopy(const void* src, size_t length) {
@@ -105,7 +105,7 @@ SkData* SkData::NewWithCopy(const void* src, size_t length) {
}
SkData* SkData::NewUninitialized(size_t length) {
- return PrivateNewWithCopy(NULL, length);
+ return PrivateNewWithCopy(nullptr, length);
}
SkData* SkData::NewWithProc(const void* ptr, size_t length, ReleaseProc proc, void* context) {
@@ -121,17 +121,17 @@ static void sk_mmap_releaseproc(const void* addr, void* ctx) {
SkData* SkData::NewFromFILE(SkFILE* f) {
size_t size;
void* addr = sk_fmmap(f, &size);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, reinterpret_cast<void*>(size));
}
SkData* SkData::NewFromFileName(const char path[]) {
- SkFILE* f = path ? sk_fopen(path, kRead_SkFILE_Flag) : NULL;
- if (NULL == f) {
- return NULL;
+ SkFILE* f = path ? sk_fopen(path, kRead_SkFILE_Flag) : nullptr;
+ if (nullptr == f) {
+ return nullptr;
}
SkData* data = NewFromFILE(f);
sk_fclose(f);
@@ -141,11 +141,11 @@ SkData* SkData::NewFromFileName(const char path[]) {
SkData* SkData::NewFromFD(int fd) {
size_t size;
void* addr = sk_fdmmap(fd, &size);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
- return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, NULL);
+ return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, nullptr);
}
// assumes context is a SkData
@@ -178,7 +178,7 @@ SkData* SkData::NewSubset(const SkData* src, size_t offset, size_t length) {
SkData* SkData::NewWithCString(const char cstr[]) {
size_t size;
- if (NULL == cstr) {
+ if (nullptr == cstr) {
cstr = "";
size = 1;
} else {
@@ -192,7 +192,7 @@ SkData* SkData::NewWithCString(const char cstr[]) {
SkData* SkData::NewFromStream(SkStream* stream, size_t size) {
SkAutoDataUnref data(SkData::NewUninitialized(size));
if (stream->read(data->writable_data(), size) != size) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
diff --git a/src/core/SkDataTable.cpp b/src/core/SkDataTable.cpp
index 20bc430853..32e30af64d 100644
--- a/src/core/SkDataTable.cpp
+++ b/src/core/SkDataTable.cpp
@@ -16,9 +16,9 @@ static void malloc_freeproc(void* context) {
SkDataTable::SkDataTable() {
fCount = 0;
fElemSize = 0; // 0 signals that we use fDir instead of fElems
- fU.fDir = NULL;
- fFreeProc = NULL;
- fFreeProcContext = NULL;
+ fU.fDir = nullptr;
+ fFreeProc = nullptr;
+ fFreeProcContext = nullptr;
}
SkDataTable::SkDataTable(const void* array, size_t elemSize, int count,
@@ -78,7 +78,7 @@ const void* SkDataTable::at(int index, size_t* size) const {
SkDataTable* SkDataTable::NewEmpty() {
static SkDataTable* gEmpty;
- if (NULL == gEmpty) {
+ if (nullptr == gEmpty) {
gEmpty = new SkDataTable;
}
gEmpty->ref();
@@ -137,7 +137,7 @@ SkDataTable* SkDataTable::NewArrayProc(const void* array, size_t elemSize,
static void chunkalloc_freeproc(void* context) { delete (SkChunkAlloc*)context; }
SkDataTableBuilder::SkDataTableBuilder(size_t minChunkSize)
- : fHeap(NULL)
+ : fHeap(nullptr)
, fMinChunkSize(minChunkSize) {}
SkDataTableBuilder::~SkDataTableBuilder() { this->reset(); }
@@ -147,12 +147,12 @@ void SkDataTableBuilder::reset(size_t minChunkSize) {
fDir.reset();
if (fHeap) {
delete fHeap;
- fHeap = NULL;
+ fHeap = nullptr;
}
}
void SkDataTableBuilder::append(const void* src, size_t size) {
- if (NULL == fHeap) {
+ if (nullptr == fHeap) {
fHeap = new SkChunkAlloc(fMinChunkSize);
}
@@ -177,7 +177,7 @@ SkDataTable* SkDataTableBuilder::detachDataTable() {
SkDataTable* table = new SkDataTable((SkDataTable::Dir*)dir, count, chunkalloc_freeproc, fHeap);
// we have to detach our fHeap, since we are giving that to the table
- fHeap = NULL;
+ fHeap = nullptr;
fDir.reset();
return table;
}
diff --git a/src/core/SkDeque.cpp b/src/core/SkDeque.cpp
index 27f3efcba4..2e469d1faf 100644
--- a/src/core/SkDeque.cpp
+++ b/src/core/SkDeque.cpp
@@ -20,20 +20,20 @@ struct SkDeque::Block {
const char* start() const { return (const char*)(this + 1); }
void init(size_t size) {
- fNext = fPrev = NULL;
- fBegin = fEnd = NULL;
+ fNext = fPrev = nullptr;
+ fBegin = fEnd = nullptr;
fStop = (char*)this + size;
}
};
SkDeque::SkDeque(size_t elemSize, int allocCount)
: fElemSize(elemSize)
- , fInitialStorage(NULL)
+ , fInitialStorage(nullptr)
, fCount(0)
, fAllocCount(allocCount) {
SkASSERT(allocCount >= 1);
- fFrontBlock = fBackBlock = NULL;
- fFront = fBack = NULL;
+ fFrontBlock = fBackBlock = nullptr;
+ fFront = fBack = nullptr;
}
SkDeque::SkDeque(size_t elemSize, void* storage, size_t storageSize, int allocCount)
@@ -41,17 +41,17 @@ SkDeque::SkDeque(size_t elemSize, void* storage, size_t storageSize, int allocCo
, fInitialStorage(storage)
, fCount(0)
, fAllocCount(allocCount) {
- SkASSERT(storageSize == 0 || storage != NULL);
+ SkASSERT(storageSize == 0 || storage != nullptr);
SkASSERT(allocCount >= 1);
if (storageSize >= sizeof(Block) + elemSize) {
fFrontBlock = (Block*)storage;
fFrontBlock->init(storageSize);
} else {
- fFrontBlock = NULL;
+ fFrontBlock = nullptr;
}
fBackBlock = fFrontBlock;
- fFront = fBack = NULL;
+ fFront = fBack = nullptr;
}
SkDeque::~SkDeque() {
@@ -70,7 +70,7 @@ SkDeque::~SkDeque() {
void* SkDeque::push_front() {
fCount += 1;
- if (NULL == fFrontBlock) {
+ if (nullptr == fFrontBlock) {
fFrontBlock = this->allocateBlock(fAllocCount);
fBackBlock = fFrontBlock; // update our linklist
}
@@ -78,7 +78,7 @@ void* SkDeque::push_front() {
Block* first = fFrontBlock;
char* begin;
- if (NULL == first->fBegin) {
+ if (nullptr == first->fBegin) {
INIT_CHUNK:
first->fEnd = first->fStop;
begin = first->fStop - fElemSize;
@@ -96,8 +96,8 @@ void* SkDeque::push_front() {
first->fBegin = begin;
- if (NULL == fFront) {
- SkASSERT(NULL == fBack);
+ if (nullptr == fFront) {
+ SkASSERT(nullptr == fBack);
fFront = fBack = begin;
} else {
SkASSERT(fBack);
@@ -110,7 +110,7 @@ void* SkDeque::push_front() {
void* SkDeque::push_back() {
fCount += 1;
- if (NULL == fBackBlock) {
+ if (nullptr == fBackBlock) {
fBackBlock = this->allocateBlock(fAllocCount);
fFrontBlock = fBackBlock; // update our linklist
}
@@ -118,7 +118,7 @@ void* SkDeque::push_back() {
Block* last = fBackBlock;
char* end;
- if (NULL == last->fBegin) {
+ if (nullptr == last->fBegin) {
INIT_CHUNK:
last->fBegin = last->start();
end = last->fBegin + fElemSize;
@@ -137,8 +137,8 @@ void* SkDeque::push_back() {
last->fEnd = end;
end -= fElemSize;
- if (NULL == fBack) {
- SkASSERT(NULL == fFront);
+ if (nullptr == fBack) {
+ SkASSERT(nullptr == fFront);
fFront = fBack = end;
} else {
SkASSERT(fFront);
@@ -154,14 +154,14 @@ void SkDeque::pop_front() {
Block* first = fFrontBlock;
- SkASSERT(first != NULL);
+ SkASSERT(first != nullptr);
- if (first->fBegin == NULL) { // we were marked empty from before
+ if (first->fBegin == nullptr) { // we were marked empty from before
first = first->fNext;
- first->fPrev = NULL;
+ first->fPrev = nullptr;
this->freeBlock(fFrontBlock);
fFrontBlock = first;
- SkASSERT(first != NULL); // else we popped too far
+ SkASSERT(first != nullptr); // else we popped too far
}
char* begin = first->fBegin + fElemSize;
@@ -172,9 +172,9 @@ void SkDeque::pop_front() {
SkASSERT(first->fBegin);
fFront = first->fBegin;
} else {
- first->fBegin = first->fEnd = NULL; // mark as empty
- if (NULL == first->fNext) {
- fFront = fBack = NULL;
+ first->fBegin = first->fEnd = nullptr; // mark as empty
+ if (nullptr == first->fNext) {
+ fFront = fBack = nullptr;
} else {
SkASSERT(first->fNext->fBegin);
fFront = first->fNext->fBegin;
@@ -188,14 +188,14 @@ void SkDeque::pop_back() {
Block* last = fBackBlock;
- SkASSERT(last != NULL);
+ SkASSERT(last != nullptr);
- if (last->fEnd == NULL) { // we were marked empty from before
+ if (last->fEnd == nullptr) { // we were marked empty from before
last = last->fPrev;
- last->fNext = NULL;
+ last->fNext = nullptr;
this->freeBlock(fBackBlock);
fBackBlock = last;
- SkASSERT(last != NULL); // else we popped too far
+ SkASSERT(last != nullptr); // else we popped too far
}
char* end = last->fEnd - fElemSize;
@@ -206,9 +206,9 @@ void SkDeque::pop_back() {
SkASSERT(last->fEnd);
fBack = last->fEnd - fElemSize;
} else {
- last->fBegin = last->fEnd = NULL; // mark as empty
- if (NULL == last->fPrev) {
- fFront = fBack = NULL;
+ last->fBegin = last->fEnd = nullptr; // mark as empty
+ if (nullptr == last->fPrev) {
+ fFront = fBack = nullptr;
} else {
SkASSERT(last->fPrev->fEnd);
fBack = last->fPrev->fEnd - fElemSize;
@@ -238,7 +238,7 @@ void SkDeque::freeBlock(Block* block) {
///////////////////////////////////////////////////////////////////////////////
-SkDeque::Iter::Iter() : fCurBlock(NULL), fPos(NULL), fElemSize(0) {}
+SkDeque::Iter::Iter() : fCurBlock(nullptr), fPos(nullptr), fElemSize(0) {}
SkDeque::Iter::Iter(const SkDeque& d, IterStart startLoc) {
this->reset(d, startLoc);
@@ -255,8 +255,8 @@ void* SkDeque::Iter::next() {
if (next == fCurBlock->fEnd) { // exhausted this chunk, move to next
do {
fCurBlock = fCurBlock->fNext;
- } while (fCurBlock != NULL && fCurBlock->fBegin == NULL);
- next = fCurBlock ? fCurBlock->fBegin : NULL;
+ } while (fCurBlock != nullptr && fCurBlock->fBegin == nullptr);
+ next = fCurBlock ? fCurBlock->fBegin : nullptr;
}
fPos = next;
}
@@ -274,8 +274,8 @@ void* SkDeque::Iter::prev() {
if (prev < fCurBlock->fBegin) { // exhausted this chunk, move to prior
do {
fCurBlock = fCurBlock->fPrev;
- } while (fCurBlock != NULL && fCurBlock->fEnd == NULL);
- prev = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL;
+ } while (fCurBlock != nullptr && fCurBlock->fEnd == nullptr);
+ prev = fCurBlock ? fCurBlock->fEnd - fElemSize : nullptr;
}
fPos = prev;
}
@@ -286,23 +286,23 @@ void* SkDeque::Iter::prev() {
// of the doubly linked list until a non-empty one is found. The fPos
// member is then set to the first (or last) element in the block. If
// there are no elements in the deque both fCurBlock and fPos will come
-// out of this routine NULL.
+// out of this routine nullptr.
void SkDeque::Iter::reset(const SkDeque& d, IterStart startLoc) {
fElemSize = d.fElemSize;
if (kFront_IterStart == startLoc) {
// initialize the iterator to start at the front
fCurBlock = d.fFrontBlock;
- while (fCurBlock && NULL == fCurBlock->fBegin) {
+ while (fCurBlock && nullptr == fCurBlock->fBegin) {
fCurBlock = fCurBlock->fNext;
}
- fPos = fCurBlock ? fCurBlock->fBegin : NULL;
+ fPos = fCurBlock ? fCurBlock->fBegin : nullptr;
} else {
// initialize the iterator to start at the back
fCurBlock = d.fBackBlock;
- while (fCurBlock && NULL == fCurBlock->fEnd) {
+ while (fCurBlock && nullptr == fCurBlock->fEnd) {
fCurBlock = fCurBlock->fPrev;
}
- fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL;
+ fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : nullptr;
}
}
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index e559215cb1..1f6f4a8657 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -37,10 +37,10 @@ public:
uint32_t getLength() const { return fLength; }
- void* addEntry(uint32_t tag, size_t length, const void* data = NULL) {
+ void* addEntry(uint32_t tag, size_t length, const void* data = nullptr) {
SkASSERT(tag);
SkASSERT(SkAlign4(length) == length);
- SkASSERT(this->findEntry(tag, NULL) == NULL);
+ SkASSERT(this->findEntry(tag, nullptr) == nullptr);
Entry* entry = (Entry*)((char*)this + fLength);
entry->fTag = tag;
@@ -77,7 +77,7 @@ public:
}
entry = (const Entry*)((const char*)(entry + 1) + entry->fLen);
}
- return NULL;
+ return nullptr;
}
SkDescriptor* copy() const {
@@ -134,9 +134,9 @@ private:
class SkAutoDescriptor : SkNoncopyable {
public:
- SkAutoDescriptor() : fDesc(NULL) {}
- SkAutoDescriptor(size_t size) : fDesc(NULL) { this->reset(size); }
- SkAutoDescriptor(const SkDescriptor& desc) : fDesc(NULL) {
+ SkAutoDescriptor() : fDesc(nullptr) {}
+ SkAutoDescriptor(size_t size) : fDesc(nullptr) { this->reset(size); }
+ SkAutoDescriptor(const SkDescriptor& desc) : fDesc(nullptr) {
size_t size = desc.getLength();
this->reset(size);
memcpy(fDesc, &desc, size);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index f8275fae93..a76a2ff0af 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -27,7 +27,7 @@ SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps)
#endif
{
fOrigin.setZero();
- fMetaData = NULL;
+ fMetaData = nullptr;
}
SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
@@ -35,7 +35,7 @@ SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
SkMetaData& SkBaseDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
- if (NULL == fMetaData) {
+ if (nullptr == fMetaData) {
fMetaData = new SkMetaData;
}
return *fMetaData;
@@ -78,7 +78,7 @@ void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- const SkMatrix* preMatrix = NULL;
+ const SkMatrix* preMatrix = nullptr;
const bool pathIsMutable = true;
this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
}
@@ -212,7 +212,7 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
- this->drawPath(draw, path, pnt, NULL, true);
+ this->drawPath(draw, path, pnt, nullptr, true);
}
}
@@ -263,7 +263,7 @@ bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
bool SkBaseDevice::accessPixels(SkPixmap* pmap) {
SkPixmap tempStorage;
- if (NULL == pmap) {
+ if (nullptr == pmap) {
pmap = &tempStorage;
}
return this->onAccessPixels(pmap);
@@ -271,7 +271,7 @@ bool SkBaseDevice::accessPixels(SkPixmap* pmap) {
bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
SkPixmap tempStorage;
- if (NULL == pmap) {
+ if (nullptr == pmap) {
pmap = &tempStorage;
}
return this->onPeekPixels(pmap);
@@ -357,10 +357,10 @@ static void morphpath(SkPath* dst, const SkPath& src, SkPathMeasure& meas,
void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t byteLength,
const SkPath& follow, const SkMatrix* matrix,
const SkPaint& paint) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0 || draw.fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || draw.fRC->isEmpty()) {
return;
}
@@ -395,7 +395,7 @@ void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t b
m.postConcat(*matrix);
}
morphpath(&tmp, *iterPath, meas, m);
- this->drawPath(draw, tmp, iter.getPaint(), NULL, true);
+ this->drawPath(draw, tmp, iter.getPaint(), nullptr, true);
}
}
}
diff --git a/src/core/SkDeviceLooper.cpp b/src/core/SkDeviceLooper.cpp
index 840a050436..c4e401361c 100644
--- a/src/core/SkDeviceLooper.cpp
+++ b/src/core/SkDeviceLooper.cpp
@@ -16,8 +16,8 @@ SkDeviceLooper::SkDeviceLooper(const SkPixmap& base, const SkRasterClip& rc, con
{
// sentinels that next() has not yet been called, and so our mapper functions
// should not be called either.
- fCurrDst = NULL;
- fCurrRC = NULL;
+ fCurrDst = nullptr;
+ fCurrRC = nullptr;
if (!rc.isEmpty()) {
// clip must be contained by the bitmap
@@ -102,7 +102,7 @@ bool SkDeviceLooper::next() {
case kSimple_State:
// first time for simple
- if (NULL == fCurrDst) {
+ if (nullptr == fCurrDst) {
fCurrDst = &fBaseDst;
fCurrRC = &fBaseRC;
fCurrOffset.set(0, 0);
diff --git a/src/core/SkDeviceProfile.cpp b/src/core/SkDeviceProfile.cpp
index 11d5c853f3..e1c10c87d7 100644
--- a/src/core/SkDeviceProfile.cpp
+++ b/src/core/SkDeviceProfile.cpp
@@ -51,7 +51,7 @@ static SkDeviceProfile* gGlobalProfile;
SkDeviceProfile* SkDeviceProfile::GetDefault() {
SkAutoMutexAcquire amc(gMutex);
- if (NULL == gDefaultProfile) {
+ if (nullptr == gDefaultProfile) {
gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP,
DEFAULT_CONTRASTSCALE,
DEFAULT_LCDCONFIG,
@@ -63,7 +63,7 @@ SkDeviceProfile* SkDeviceProfile::GetDefault() {
SkDeviceProfile* SkDeviceProfile::RefGlobal() {
SkAutoMutexAcquire amc(gMutex);
- if (NULL == gGlobalProfile) {
+ if (nullptr == gGlobalProfile) {
gGlobalProfile = SkDeviceProfile::GetDefault();
}
gGlobalProfile->ref();
diff --git a/src/core/SkDeviceProfile.h b/src/core/SkDeviceProfile.h
index d949444f8e..2872b13458 100644
--- a/src/core/SkDeviceProfile.h
+++ b/src/core/SkDeviceProfile.h
@@ -52,7 +52,7 @@ public:
/**
* Returns the global default profile, that is used if no global profile is
- * specified with SetGlobal(), or if NULL is specified to SetGlobal().
+ * specified with SetGlobal(), or if nullptr is specified to SetGlobal().
* The references count is *not* incremented, and the caller should not
* call unref().
*/
@@ -69,7 +69,7 @@ public:
* Make the specified profile be the global value for all subsequently
* instantiated devices. Does not affect any existing devices.
* Increments the reference count on the profile.
- * Specify NULL for the "identity" profile (where there is no gamma or
+ * Specify nullptr for the "identity" profile (where there is no gamma or
* contrast correction).
*/
static void SetGlobal(SkDeviceProfile*);
diff --git a/src/core/SkDiscardableMemory.h b/src/core/SkDiscardableMemory.h
index f3159fe2af..8952b8df7f 100644
--- a/src/core/SkDiscardableMemory.h
+++ b/src/core/SkDiscardableMemory.h
@@ -19,13 +19,13 @@ class SK_API SkDiscardableMemory {
public:
/**
* Factory method that creates, initializes and locks an SkDiscardableMemory
- * object. If either of these steps fails, a NULL pointer will be returned.
+ * object. If either of these steps fails, a nullptr pointer will be returned.
*/
static SkDiscardableMemory* Create(size_t bytes);
/**
* Factory class that creates, initializes and locks an SkDiscardableMemory
- * object. If either of these steps fails, a NULL pointer will be returned.
+ * object. If either of these steps fails, a nullptr pointer will be returned.
*/
class Factory : public SkRefCnt {
public:
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 6464d4a48c..8e1a132b4d 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -42,7 +42,7 @@
class SkAutoBlitterChoose : SkNoncopyable {
public:
SkAutoBlitterChoose() {
- fBlitter = NULL;
+ fBlitter = nullptr;
}
SkAutoBlitterChoose(const SkPixmap& dst, const SkMatrix& matrix,
const SkPaint& paint, bool drawCoverage = false) {
@@ -73,7 +73,7 @@ private:
class SkAutoBitmapShaderInstall : SkNoncopyable {
public:
SkAutoBitmapShaderInstall(const SkBitmap& src, const SkPaint& paint,
- const SkMatrix* localMatrix = NULL)
+ const SkMatrix* localMatrix = nullptr)
: fPaint(paint) /* makes a copy of the paint */ {
fPaint.setShader(SkCreateBitmapShader(src, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
@@ -86,7 +86,7 @@ public:
// since fAllocator will destroy shader, we insist that owners == 2
SkASSERT(2 == fPaint.getShader()->getRefCnt());
- fPaint.setShader(NULL); // unref the shader by 1
+ fPaint.setShader(nullptr); // unref the shader by 1
}
@@ -155,12 +155,12 @@ static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
// todo: we can apply colorfilter up front if no shader, so we wouldn't
// need to abort this fastpath
if (paint.getShader() || paint.getColorFilter()) {
- return NULL;
+ return nullptr;
}
SkXfermode::Mode mode;
if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) {
- return NULL;
+ return nullptr;
}
SkColor color = paint.getColor();
@@ -214,7 +214,7 @@ static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
default:
break;
}
- return NULL;
+ return nullptr;
}
static void CallBitmapXferProc(const SkPixmap& dst, const SkIRect& rect, BitmapXferProc proc,
@@ -451,7 +451,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
if (0 == width) {
fMode = mode;
fPaint = &paint;
- fClip = NULL;
+ fClip = nullptr;
fRC = rc;
fRadius = SK_FixedHalf;
return true;
@@ -467,7 +467,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
fMode = mode;
fPaint = &paint;
- fClip = NULL;
+ fClip = nullptr;
fRC = rc;
fRadius = SkScalarToFixed(SkScalarMul(width, sx)) >> 1;
return true;
@@ -477,7 +477,7 @@ bool PtProcRec::init(SkCanvas::PointMode mode, const SkPaint& paint,
}
PtProcRec::Proc PtProcRec::chooseProc(SkBlitter** blitterPtr) {
- Proc proc = NULL;
+ Proc proc = nullptr;
SkBlitter* blitter = *blitterPtr;
if (fRC->isBW()) {
@@ -546,7 +546,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
return;
}
- SkASSERT(pts != NULL);
+ SkASSERT(pts != nullptr);
SkDEBUGCODE(this->validate();)
// nothing to draw
@@ -642,7 +642,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
// 'asPoints' managed to find some fast path
SkPaint newP(paint);
- newP.setPathEffect(NULL);
+ newP.setPathEffect(nullptr);
newP.setStyle(SkPaint::kFill_Style);
if (!pointData.fFirst.isEmpty()) {
@@ -720,9 +720,9 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
path.moveTo(pts[i]);
path.lineTo(pts[i+1]);
if (fDevice) {
- fDevice->drawPath(*this, path, p, NULL, true);
+ fDevice->drawPath(*this, path, p, nullptr, true);
} else {
- this->drawPath(path, p, NULL, true);
+ this->drawPath(path, p, nullptr, true);
}
path.rewind();
}
@@ -820,7 +820,7 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint,
SkPath tmp;
tmp.addRect(prePaintRect);
tmp.setFillType(SkPath::kWinding_FillType);
- draw.drawPath(tmp, paint, NULL, true);
+ draw.drawPath(tmp, paint, nullptr, true);
return;
}
@@ -901,10 +901,10 @@ void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const {
SkMask dstM;
if (paint.getMaskFilter() &&
- paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL)) {
+ paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, nullptr)) {
mask = &dstM;
} else {
- dstM.fImage = NULL;
+ dstM.fImage = nullptr;
}
SkAutoMaskFreeImage ami(dstM.fImage);
@@ -998,7 +998,7 @@ DRAW_PATH:
// Now fall back to the default case of using a path.
SkPath path;
path.addRRect(rrect);
- this->drawPath(path, paint, NULL, true);
+ this->drawPath(path, paint, nullptr, true);
}
static SkScalar compute_res_scale_for_stroking(const SkMatrix& matrix) {
@@ -1076,7 +1076,7 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) {
SkRect cullRect;
- const SkRect* cullRectPtr = NULL;
+ const SkRect* cullRectPtr = nullptr;
if (this->computeConservativeLocalClipBounds(&cullRect)) {
cullRectPtr = &cullRect;
}
@@ -1102,9 +1102,9 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
// transform the path into device space
pathPtr->transform(*matrix, devPathPtr);
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
SkAutoBlitterChoose blitterStorage;
- if (NULL == customBlitter) {
+ if (nullptr == customBlitter) {
blitterStorage.choose(fDst, *fMatrix, *paint, drawCoverage);
blitter = blitterStorage.get();
} else {
@@ -1333,7 +1333,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& ori
}
const SkPixmap& pmap = unlocker.pixmap();
- if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) {
+ if (nullptr == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) {
SkTBlitterAllocator allocator;
// blitter will be owned by the allocator.
SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, paint, pmap, x, y, &allocator);
@@ -1453,8 +1453,8 @@ static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy,
int left = Sk48Dot16FloorToInt(fx);
int top = Sk48Dot16FloorToInt(fy);
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
- SkASSERT((NULL == state.fClip && state.fAAClip) ||
- (state.fClip && NULL == state.fAAClip && state.fClip->isRect()));
+ SkASSERT((nullptr == state.fClip && state.fAAClip) ||
+ (state.fClip && nullptr == state.fAAClip && state.fClip->isRect()));
left += glyph.fLeft;
top += glyph.fTop;
@@ -1477,9 +1477,9 @@ static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy,
}
uint8_t* aa = (uint8_t*)glyph.fImage;
- if (NULL == aa) {
+ if (nullptr == aa) {
aa = (uint8_t*)state.fCache->findImage(glyph);
- if (NULL == aa) {
+ if (nullptr == aa) {
return; // can't rasterize glyph
}
}
@@ -1507,9 +1507,9 @@ static void D1G_RgnClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, c
if (!clipper.done()) {
const SkIRect& cr = clipper.rect();
const uint8_t* aa = (const uint8_t*)glyph.fImage;
- if (NULL == aa) {
+ if (nullptr == aa) {
aa = (uint8_t*)state.fCache->findImage(glyph);
- if (NULL == aa) {
+ if (nullptr == aa) {
return;
}
}
@@ -1553,7 +1553,7 @@ SkDraw1Glyph::Proc SkDraw1Glyph::init(const SkDraw* draw, SkBlitter* blitter, Sk
}
if (draw->fRC->isBW()) {
- fAAClip = NULL;
+ fAAClip = nullptr;
fClip = &draw->fRC->bwRgn();
fClipBounds = fClip->getBounds();
if (fClip->isRect()) {
@@ -1563,7 +1563,7 @@ SkDraw1Glyph::Proc SkDraw1Glyph::init(const SkDraw* draw, SkBlitter* blitter, Sk
}
} else { // aaclip
fAAClip = &draw->fRC->aaRgn();
- fClip = NULL;
+ fClip = nullptr;
fClipBounds = fAAClip->getBounds();
return D1G_RectClip;
}
@@ -1583,12 +1583,12 @@ void SkDraw1Glyph::blitMaskAsSprite(const SkMask& mask) const {
void SkDraw::drawText(const char text[], size_t byteLength,
SkScalar x, SkScalar y, const SkPaint& paint) const {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkDEBUGCODE(this->validate();)
// nothing to draw
- if (text == NULL || byteLength == 0 || fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || fRC->isEmpty()) {
return;
}
@@ -1633,7 +1633,7 @@ void SkDraw::drawText(const char text[], size_t byteLength,
SkAAClipBlitter aaBlitter;
SkAutoBlitterChoose blitterChooser;
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
if (needsRasterTextBlit(*this)) {
blitterChooser.choose(fDst, *fMatrix, paint);
blitter = blitterChooser.get();
@@ -1691,10 +1691,10 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
// Temporarily jam in kFill, so we only ever ask for the raw outline from the cache.
paint.setStyle(SkPaint::kFill_Style);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
- SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), NULL);
+ SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), nullptr);
SkGlyphCache* cache = autoCache.getCache();
const char* stop = text + byteLength;
@@ -1731,13 +1731,13 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
void SkDraw::drawPosText(const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkPaint& paint) const {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
SkDEBUGCODE(this->validate();)
// nothing to draw
- if (text == NULL || byteLength == 0 || fRC->isEmpty()) {
+ if (text == nullptr || byteLength == 0 || fRC->isEmpty()) {
return;
}
@@ -1752,7 +1752,7 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
SkAAClipBlitterWrapper wrapper;
SkAutoBlitterChoose blitterChooser;
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
if (needsRasterTextBlit(*this)) {
blitterChooser.choose(fDst, *fMatrix, paint);
blitter = blitterChooser.get();
@@ -1915,7 +1915,7 @@ public:
SK_TO_STRING_OVERRIDE()
// For serialization. This will never be called.
- Factory getFactory() const override { sk_throw(); return NULL; }
+ Factory getFactory() const override { sk_throw(); return nullptr; }
protected:
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
@@ -2053,26 +2053,26 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
SkPaint p(paint);
SkShader* shader = p.getShader();
- if (NULL == shader) {
+ if (nullptr == shader) {
// if we have no shader, we ignore the texture coordinates
- textures = NULL;
- } else if (NULL == textures) {
+ textures = nullptr;
+ } else if (nullptr == textures) {
// if we don't have texture coordinates, ignore the shader
- p.setShader(NULL);
- shader = NULL;
+ p.setShader(nullptr);
+ shader = nullptr;
}
// setup the custom shader (if needed)
SkAutoTUnref<SkComposeShader> composeShader;
if (colors) {
- if (NULL == textures) {
+ if (nullptr == textures) {
// just colors (no texture)
shader = p.setShader(&triShader);
} else {
// colors * texture
SkASSERT(shader);
bool releaseMode = false;
- if (NULL == xmode) {
+ if (nullptr == xmode) {
xmode = SkXfermode::Create(SkXfermode::kModulate_Mode);
releaseMode = true;
}
@@ -2155,9 +2155,9 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
#ifdef SK_DEBUG
void SkDraw::validate() const {
- SkASSERT(fMatrix != NULL);
- SkASSERT(fClip != NULL);
- SkASSERT(fRC != NULL);
+ SkASSERT(fMatrix != nullptr);
+ SkASSERT(fClip != nullptr);
+ SkASSERT(fRC != nullptr);
const SkIRect& cr = fRC->getBounds();
SkIRect br;
@@ -2193,7 +2193,7 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
srcM.fBounds = *bounds;
srcM.fFormat = SkMask::kA8_Format;
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin)) {
return false;
}
diff --git a/src/core/SkDrawLooper.cpp b/src/core/SkDrawLooper.cpp
index 1af68a2289..aa53f2e3a1 100644
--- a/src/core/SkDrawLooper.cpp
+++ b/src/core/SkDrawLooper.cpp
@@ -21,7 +21,7 @@ bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) const {
for (;;) {
SkPaint p(paint);
if (context->next(&canvas, &p)) {
- p.setLooper(NULL);
+ p.setLooper(nullptr);
if (!p.canComputeFastBounds()) {
return false;
}
@@ -48,7 +48,7 @@ void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& s,
if (context->next(&canvas, &p)) {
SkRect r(src);
- p.setLooper(NULL);
+ p.setLooper(nullptr);
p.computeFastBounds(r, &r);
canvas.getTotalMatrix().mapRect(&r);
diff --git a/src/core/SkDrawable.cpp b/src/core/SkDrawable.cpp
index 50522709e9..8fea38be34 100644
--- a/src/core/SkDrawable.cpp
+++ b/src/core/SkDrawable.cpp
@@ -76,7 +76,7 @@ SkPicture* SkDrawable::onNewPictureSnapshot() {
SkPictureRecorder recorder;
const SkRect bounds = this->getBounds();
- SkCanvas* canvas = recorder.beginRecording(bounds, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(bounds, nullptr, 0);
this->draw(canvas);
if (false) {
draw_bbox(canvas, bounds);
diff --git a/src/core/SkEdgeBuilder.cpp b/src/core/SkEdgeBuilder.cpp
index 43181fdbfc..92c8330c16 100644
--- a/src/core/SkEdgeBuilder.cpp
+++ b/src/core/SkEdgeBuilder.cpp
@@ -19,7 +19,7 @@ template <typename T> static T* typedAllocThrow(SkChunkAlloc& alloc) {
///////////////////////////////////////////////////////////////////////////////
SkEdgeBuilder::SkEdgeBuilder() : fAlloc(16*1024) {
- fEdgeList = NULL;
+ fEdgeList = nullptr;
}
void SkEdgeBuilder::addLine(const SkPoint pts[]) {
diff --git a/src/core/SkEmptyShader.h b/src/core/SkEmptyShader.h
index 7b87c284f7..6453e0e440 100644
--- a/src/core/SkEmptyShader.h
+++ b/src/core/SkEmptyShader.h
@@ -14,14 +14,14 @@
/**
* \class SkEmptyShader
- * A Shader that always draws nothing. Its createContext always returns NULL.
+ * A Shader that always draws nothing. Its createContext always returns nullptr.
*/
class SK_API SkEmptyShader : public SkShader {
public:
SkEmptyShader() {}
size_t contextSize() const override {
- // Even though createContext returns NULL we have to return a value of at least
+ // Even though createContext returns nullptr we have to return a value of at least
// sizeof(SkShader::Context) to satisfy SkSmallAllocator.
return sizeof(SkShader::Context);
}
@@ -31,7 +31,7 @@ public:
protected:
SkShader::Context* onCreateContext(const ContextRec&, void*) const override {
- return NULL;
+ return nullptr;
}
void flatten(SkWriteBuffer& buffer) const override {
diff --git a/src/core/SkEndian.h b/src/core/SkEndian.h
index 0955fcc505..954afb046d 100644
--- a/src/core/SkEndian.h
+++ b/src/core/SkEndian.h
@@ -39,7 +39,7 @@ template<uint16_t N> struct SkTEndianSwap16 {
low two bytes of each value in the array.
*/
static inline void SkEndianSwap16s(uint16_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap16(*array);
@@ -68,7 +68,7 @@ template<uint32_t N> struct SkTEndianSwap32 {
bytes of each value in the array.
*/
static inline void SkEndianSwap32s(uint32_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap32(*array);
@@ -104,7 +104,7 @@ template<uint64_t N> struct SkTEndianSwap64 {
bytes of each value in the array.
*/
static inline void SkEndianSwap64s(uint64_t array[], int count) {
- SkASSERT(count == 0 || array != NULL);
+ SkASSERT(count == 0 || array != nullptr);
while (--count >= 0) {
*array = SkEndianSwap64(*array);
diff --git a/src/core/SkError.cpp b/src/core/SkError.cpp
index 23db8ac1e4..9e4385b489 100644
--- a/src/core/SkError.cpp
+++ b/src/core/SkError.cpp
@@ -31,7 +31,7 @@ void DeleteThreadError(void *v) { delete reinterpret_cast<SkError *>(v); }
*(reinterpret_cast<SkErrorCallbackFunction *>(SkTLS::Get(CreateThreadErrorCallback, \
DeleteThreadErrorCallback)))
- void *CreateThreadErrorContext() { return new void **(NULL); }
+ void *CreateThreadErrorContext() { return new void **(nullptr); }
void DeleteThreadErrorContext(void *v) { delete reinterpret_cast<void **>(v); }
#define THREAD_ERROR_CONTEXT \
(*reinterpret_cast<void **>(SkTLS::Get(CreateThreadErrorContext, DeleteThreadErrorContext)))
@@ -60,7 +60,7 @@ const char *SkGetLastErrorString() {
// ------------ Private Error functions ---------
void SkErrorInternals::SetErrorCallback(SkErrorCallbackFunction cb, void *context) {
- if (cb == NULL) {
+ if (cb == nullptr) {
THREAD_ERROR_CALLBACK = SkErrorInternals::DefaultErrorCallback;
} else {
THREAD_ERROR_CALLBACK = cb;
@@ -89,7 +89,7 @@ void SkErrorInternals::SetError(SkError code, const char *fmt, ...) {
va_list args;
char *str = THREAD_ERROR_STRING;
- const char *error_name = NULL;
+ const char *error_name = nullptr;
switch( code ) {
case kNoError_SkError:
error_name = "No Error";
diff --git a/src/core/SkFilterShader.cpp b/src/core/SkFilterShader.cpp
index d972489774..b52c2be8c4 100644
--- a/src/core/SkFilterShader.cpp
+++ b/src/core/SkFilterShader.cpp
@@ -30,7 +30,7 @@ SkFlattenable* SkFilterShader::CreateProc(SkReadBuffer& buffer) {
SkAutoTUnref<SkShader> shader(buffer.readShader());
SkAutoTUnref<SkColorFilter> filter(buffer.readColorFilter());
if (!shader.get() || !filter.get()) {
- return NULL;
+ return nullptr;
}
return new SkFilterShader(shader, filter);
}
@@ -59,8 +59,8 @@ uint32_t SkFilterShader::FilterShaderContext::getFlags() const {
SkShader::Context* SkFilterShader::onCreateContext(const ContextRec& rec, void* storage) const {
char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext);
SkShader::Context* shaderContext = fShader->createContext(rec, shaderContextStorage);
- if (NULL == shaderContext) {
- return NULL;
+ if (nullptr == shaderContext) {
+ return nullptr;
}
return new (storage) FilterShaderContext(*this, shaderContext, rec);
}
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp
index 27efe7ece3..87e720e95f 100644
--- a/src/core/SkFlattenable.cpp
+++ b/src/core/SkFlattenable.cpp
@@ -17,7 +17,7 @@ uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) {
return index;
}
const char* name = SkFlattenable::FactoryToName(factory);
- if (NULL == name) {
+ if (nullptr == name) {
return 0;
}
*fNames.append() = name;
@@ -28,7 +28,7 @@ const char* SkNamedFactorySet::getNextAddedFactoryName() {
if (fNextAddedFactory < fNames.count()) {
return fNames[fNextAddedFactory++];
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ SkFlattenable::Factory SkFlattenable::NameToFactory(const char name[]) {
return entries[i].fFactory;
}
}
- return NULL;
+ return nullptr;
}
bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) {
@@ -128,5 +128,5 @@ const char* SkFlattenable::FactoryToName(Factory fact) {
return entries[i].fName;
}
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index d6895a480b..c39cc185d3 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -31,13 +31,13 @@ SkFont::SkFont(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScalar skewX,
SkFont* SkFont::Create(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScalar skewX,
MaskType mt, uint32_t flags) {
if (size <= 0 || !SkScalarIsFinite(size)) {
- return NULL;
+ return nullptr;
}
if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) {
- return NULL;
+ return nullptr;
}
if (!SkScalarIsFinite(skewX)) {
- return NULL;
+ return nullptr;
}
flags &= kAllFlags;
return new SkFont(face, size, scaleX, skewX, mt, flags);
@@ -82,7 +82,7 @@ int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding enc
count = SkToInt(byteLength >> 1);
break;
}
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
return count;
}
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
index 933a36a095..21fecdc416 100644
--- a/src/core/SkFontDescriptor.h
+++ b/src/core/SkFontDescriptor.h
@@ -32,7 +32,7 @@ public:
fAxis[i] = that.fAxis[i];
}
}
- bool hasStream() const { return fStream.get() != NULL; }
+ bool hasStream() const { return fStream.get() != nullptr; }
SkStreamAsset* duplicateStream() const { return fStream->duplicate(); }
SkStreamAsset* detachStream() { return fStream.detach(); }
SkStreamAsset* getStream() { return fStream.get(); }
@@ -61,7 +61,7 @@ public:
const char* getFamilyName() const { return fFamilyName.c_str(); }
const char* getFullName() const { return fFullName.c_str(); }
const char* getPostscriptName() const { return fPostscriptName.c_str(); }
- bool hasFontData() const { return fFontData.get() != NULL; }
+ bool hasFontData() const { return fFontData.get() != nullptr; }
SkFontData* detachFontData() { return fFontData.detach(); }
void setFamilyName(const char* name) { fFamilyName.set(name); }
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 35ad6c39f7..7c06690d2e 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -22,10 +22,10 @@ public:
}
SkTypeface* createTypeface(int index) override {
SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set");
- return NULL;
+ return nullptr;
}
SkTypeface* matchStyle(const SkFontStyle&) override {
- return NULL;
+ return nullptr;
}
};
@@ -43,7 +43,7 @@ protected:
}
SkFontStyleSet* onCreateStyleSet(int index) const override {
SkDEBUGFAIL("onCreateStyleSet called with bad index");
- return NULL;
+ return nullptr;
}
SkFontStyleSet* onMatchFamily(const char[]) const override {
return SkFontStyleSet::CreateEmpty();
@@ -51,36 +51,36 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char[],
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
const SkFontStyle& style,
const char* bcp47[],
int bcp47Count,
SkUnichar character) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromData(SkData*, int) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const override {
delete stream;
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromFile(const char[], int) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override {
- return NULL;
+ return nullptr;
}
};
static SkFontStyleSet* emptyOnNull(SkFontStyleSet* fsset) {
- if (NULL == fsset) {
+ if (nullptr == fsset) {
fsset = SkFontStyleSet::CreateEmpty();
}
return fsset;
@@ -119,22 +119,22 @@ SkTypeface* SkFontMgr::matchFaceStyle(const SkTypeface* face,
}
SkTypeface* SkFontMgr::createFromData(SkData* data, int ttcIndex) const {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
return this->onCreateFromData(data, ttcIndex);
}
SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) const {
- if (NULL == stream) {
- return NULL;
+ if (nullptr == stream) {
+ return nullptr;
}
return this->onCreateFromStream(stream, ttcIndex);
}
SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
return this->onCreateFromFontData(data);
}
@@ -147,8 +147,8 @@ SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const {
}
SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
- if (NULL == path) {
- return NULL;
+ if (nullptr == path) {
+ return nullptr;
}
return this->onCreateFromFile(path, ttcIndex);
}
diff --git a/src/core/SkFontStream.cpp b/src/core/SkFontStream.cpp
index 580da37f43..b2ffe8deba 100644
--- a/src/core/SkFontStream.cpp
+++ b/src/core/SkFontStream.cpp
@@ -101,7 +101,7 @@ static int count_tables(SkStream* stream, int ttcIndex, size_t* offsetToDir) {
///////////////////////////////////////////////////////////////////////////////
struct SfntHeader {
- SfntHeader() : fCount(0), fDir(NULL) {}
+ SfntHeader() : fCount(0), fDir(nullptr) {}
~SfntHeader() { sk_free(fDir); }
/** If it returns true, then fCount and fDir are properly initialized.
diff --git a/src/core/SkFontStream.h b/src/core/SkFontStream.h
index 0f7a052e6a..0a2322fc06 100644
--- a/src/core/SkFontStream.h
+++ b/src/core/SkFontStream.h
@@ -42,7 +42,7 @@ public:
size_t offset, size_t length, void* data);
static size_t GetTableSize(SkStream* stream, int ttcIndex, SkFontTableTag tag) {
- return GetTableData(stream, ttcIndex, tag, 0, ~0U, NULL);
+ return GetTableData(stream, ttcIndex, tag, 0, ~0U, nullptr);
}
};
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 7462009479..01b618073a 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -912,7 +912,7 @@ int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13],
SkScalar tValues[3]) {
SkScalar t_storage[3];
- if (tValues == NULL) {
+ if (tValues == nullptr) {
tValues = t_storage;
}
diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h
index bd3abe1acf..79cad2eee0 100644
--- a/src/core/SkGeometry.h
+++ b/src/core/SkGeometry.h
@@ -39,7 +39,7 @@ SkPoint SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t);
/** Set pt to the point on the src quadratic specified by t. t must be
0 <= t <= 1.0
*/
-void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = NULL);
+void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = nullptr);
/**
* output is : eval(t) == coeff[0] * t^2 + coeff[1] * t + coeff[2]
@@ -164,7 +164,7 @@ int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10]);
int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]);
int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13],
- SkScalar tValues[3] = NULL);
+ SkScalar tValues[3] = nullptr);
bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar y, SkPoint dst[7]);
bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar x, SkPoint dst[7]);
@@ -239,7 +239,7 @@ struct SkConic {
* tangent value's length is arbitrary, and only its direction should
* be used.
*/
- void evalAt(SkScalar t, SkPoint* pos, SkVector* tangent = NULL) const;
+ void evalAt(SkScalar t, SkPoint* pos, SkVector* tangent = nullptr) const;
void chopAt(SkScalar t, SkConic dst[2]) const;
void chop(SkConic dst[2]) const;
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 469985959c..c747995ed0 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -131,8 +131,8 @@ class SkGlyph {
void initCommon(uint32_t id) {
fID = id;
- fImage = NULL;
- fPath = NULL;
+ fImage = nullptr;
+ fPath = nullptr;
fMaskFormat = MASK_FORMAT_UNKNOWN;
fForceBW = 0;
}
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index ff52004128..e6d66f0ac3 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -43,13 +43,13 @@ SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca
SkASSERT(desc);
SkASSERT(ctx);
- fPrev = fNext = NULL;
+ fPrev = fNext = nullptr;
fScalerContext->getFontMetrics(&fFontMetrics);
fMemoryUsed = sizeof(*this);
- fAuxProcList = NULL;
+ fAuxProcList = nullptr;
}
SkGlyphCache::~SkGlyphCache() {
@@ -60,7 +60,7 @@ SkGlyphCache::~SkGlyphCache() {
}
SkGlyphCache::CharGlyphRec* SkGlyphCache::getCharGlyphRec(PackedUnicharID packedUnicharID) {
- if (NULL == fPackedUnicharIDToPackedGlyphID.get()) {
+ if (nullptr == fPackedUnicharIDToPackedGlyphID.get()) {
// Allocate the array.
fPackedUnicharIDToPackedGlyphID.reset(kHashCount);
// Initialize array to map character and position with the impossible glyph ID. This
@@ -161,7 +161,7 @@ SkGlyph* SkGlyphCache::lookupByChar(SkUnichar charCode, MetricsType type, SkFixe
SkGlyph* SkGlyphCache::lookupByPackedGlyphID(PackedGlyphID packedGlyphID, MetricsType type) {
SkGlyph* glyph = fGlyphMap.find(packedGlyphID);
- if (NULL == glyph) {
+ if (nullptr == glyph) {
glyph = this->allocateNewGlyph(packedGlyphID, type);
} else {
if (type == kFull_MetricsType && glyph->isJustAdvance()) {
@@ -194,7 +194,7 @@ SkGlyph* SkGlyphCache::allocateNewGlyph(PackedGlyphID packedGlyphID, MetricsType
const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
if (glyph.fWidth > 0 && glyph.fWidth < kMaxGlyphWidth) {
- if (NULL == glyph.fImage) {
+ if (nullptr == glyph.fImage) {
size_t size = glyph.computeImageSize();
const_cast<SkGlyph&>(glyph).fImage = fGlyphAlloc.alloc(size,
SkChunkAlloc::kReturnNil_AllocFailType);
@@ -214,7 +214,7 @@ const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
if (glyph.fWidth) {
- if (glyph.fPath == NULL) {
+ if (glyph.fPath == nullptr) {
const_cast<SkGlyph&>(glyph).fPath = new SkPath;
fScalerContext->getPath(glyph, glyph.fPath);
fMemoryUsed += sizeof(SkPath) +
@@ -260,7 +260,7 @@ bool SkGlyphCache::getAuxProcData(void (*proc)(void*), void** dataPtr) const {
}
void SkGlyphCache::setAuxProc(void (*proc)(void*), void* data) {
- if (proc == NULL) {
+ if (proc == nullptr) {
return;
}
@@ -357,12 +357,12 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
globals.validate();
- for (cache = globals.internalGetHead(); cache != NULL; cache = cache->fNext) {
+ for (cache = globals.internalGetHead(); cache != nullptr; cache = cache->fNext) {
if (cache->fDesc->equals(*desc)) {
globals.internalDetachCache(cache);
if (!proc(cache, context)) {
globals.internalAttachCacheToHead(cache);
- cache = NULL;
+ cache = nullptr;
}
return cache;
}
@@ -388,14 +388,14 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
if (!proc(cache, context)) { // need to reattach
globals.attachCacheToHead(cache);
- cache = NULL;
+ cache = nullptr;
}
return cache;
}
void SkGlyphCache::AttachCache(SkGlyphCache* cache) {
SkASSERT(cache);
- SkASSERT(cache->fNext == NULL);
+ SkASSERT(cache->fNext == nullptr);
get_globals().attachCacheToHead(cache);
}
@@ -431,7 +431,7 @@ void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
globals.validate();
- for (cache = globals.internalGetHead(); cache != NULL; cache = cache->fNext) {
+ for (cache = globals.internalGetHead(); cache != nullptr; cache = cache->fNext) {
visitor(*cache, context);
}
}
@@ -489,7 +489,7 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) {
// we start at the tail and proceed backwards, as the linklist is in LRU
// order, with unimportant entries at the tail.
SkGlyphCache* cache = this->internalGetTail();
- while (cache != NULL &&
+ while (cache != nullptr &&
(bytesFreed < bytesNeeded || countFreed < countNeeded)) {
SkGlyphCache* prev = cache->fPrev;
bytesFreed += cache->fMemoryUsed;
@@ -513,7 +513,7 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) {
}
void SkGlyphCache_Globals::internalAttachCacheToHead(SkGlyphCache* cache) {
- SkASSERT(NULL == cache->fPrev && NULL == cache->fNext);
+ SkASSERT(nullptr == cache->fPrev && nullptr == cache->fNext);
if (fHead) {
fHead->fPrev = cache;
cache->fNext = fHead;
@@ -537,7 +537,7 @@ void SkGlyphCache_Globals::internalDetachCache(SkGlyphCache* cache) {
if (cache->fNext) {
cache->fNext->fPrev = cache->fPrev;
}
- cache->fPrev = cache->fNext = NULL;
+ cache->fPrev = cache->fNext = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -562,7 +562,7 @@ void SkGlyphCache_Globals::validate() const {
int computedCount = 0;
const SkGlyphCache* head = fHead;
- while (head != NULL) {
+ while (head != nullptr) {
computedBytes += head->fMemoryUsed;
computedCount += 1;
head = head->fNext;
diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h
index dc2aa579a7..706204173d 100644
--- a/src/core/SkGlyphCache.h
+++ b/src/core/SkGlyphCache.h
@@ -117,7 +117,7 @@ public:
/** Find a matching cache entry, and call proc() with it. If none is found create a new one.
If the proc() returns true, detach the cache and return it, otherwise leave it and return
- NULL.
+ nullptr.
*/
static SkGlyphCache* VisitCache(SkTypeface*, const SkDescriptor* desc,
bool (*proc)(const SkGlyphCache*, void*),
@@ -136,7 +136,7 @@ public:
win is that different thread will never block each other while a strike is being used.
*/
static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* desc) {
- return VisitCache(typeface, desc, DetachProc, NULL);
+ return VisitCache(typeface, desc, DetachProc, nullptr);
}
static void Dump();
@@ -163,7 +163,7 @@ public:
}
}
void forget() {
- fCache = NULL;
+ fCache = nullptr;
}
private:
const SkGlyphCache* fCache;
@@ -249,7 +249,7 @@ public:
void release() {
if (fCache) {
SkGlyphCache::AttachCache(fCache);
- fCache = NULL;
+ fCache = nullptr;
}
}
@@ -263,10 +263,10 @@ protected:
SkAutoGlyphCacheBase(const SkPaint& /*paint*/,
const SkSurfaceProps* /*surfaceProps*/,
const SkMatrix* /*matrix*/) {
- fCache = NULL;
+ fCache = nullptr;
}
SkAutoGlyphCacheBase() {
- fCache = NULL;
+ fCache = nullptr;
}
~SkAutoGlyphCacheBase() {
if (fCache) {
diff --git a/src/core/SkGlyphCache_Globals.h b/src/core/SkGlyphCache_Globals.h
index 70d80208d4..e1825a2f0f 100644
--- a/src/core/SkGlyphCache_Globals.h
+++ b/src/core/SkGlyphCache_Globals.h
@@ -26,7 +26,7 @@
class SkGlyphCache_Globals {
public:
SkGlyphCache_Globals() {
- fHead = NULL;
+ fHead = nullptr;
fTotalMemoryUsed = 0;
fCacheSizeLimit = SK_DEFAULT_FONT_CACHE_LIMIT;
fCacheCount = 0;
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index c9aa121d26..dc6b0f2c1a 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -34,7 +34,7 @@ public:
/**
* Returns a ref() on the texture produced by this generator. The caller must call unref()
- * when it is done. Will return NULL on failure.
+ * when it is done. Will return nullptr on failure.
*
* The caller is responsible for calling texture->unref() when they are done.
*/
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 90f14c55dc..cda3e053b9 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -182,7 +182,7 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)),
fUniqueID(next_image_filter_unique_id()) {
for (int i = 0; i < inputCount; ++i) {
- if (NULL == inputs[i] || inputs[i]->usesSrcInput()) {
+ if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) {
fUsesSrcInput = true;
}
fInputs[i] = inputs[i];
@@ -207,13 +207,13 @@ SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer)
fInputs = new SkImageFilter* [fInputCount];
common.detachInputs(fInputs);
for (int i = 0; i < fInputCount; ++i) {
- if (NULL == fInputs[i] || fInputs[i]->usesSrcInput()) {
+ if (nullptr == fInputs[i] || fInputs[i]->usesSrcInput()) {
fUsesSrcInput = true;
}
}
} else {
fInputCount = 0;
- fInputs = NULL;
+ fInputs = nullptr;
}
}
@@ -221,8 +221,8 @@ void SkImageFilter::flatten(SkWriteBuffer& buffer) const {
buffer.writeInt(fInputCount);
for (int i = 0; i < fInputCount; i++) {
SkImageFilter* input = getInput(i);
- buffer.writeBool(input != NULL);
- if (input != NULL) {
+ buffer.writeBool(input != nullptr);
+ if (input != nullptr) {
buffer.writeFlattenable(input);
}
}
@@ -307,7 +307,7 @@ bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const Context&,
}
bool SkImageFilter::canFilterImageGPU() const {
- return this->asFragmentProcessor(NULL, NULL, NULL, SkMatrix::I(), SkIRect());
+ return this->asFragmentProcessor(nullptr, nullptr, nullptr, SkMatrix::I(), SkIRect());
}
bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
@@ -464,7 +464,7 @@ bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
- SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(context, *result, NULL));
+ SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(context, *result, nullptr));
result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
}
return true;
@@ -587,8 +587,8 @@ SkBaseDevice* SkImageFilter::Proxy::createDevice(int w, int h) {
SkBaseDevice::kNever_TileUsage,
kUnknown_SkPixelGeometry,
true /*forImageFilter*/);
- SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, NULL);
- if (NULL == dev) {
+ SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, nullptr);
+ if (nullptr == dev) {
const SkSurfaceProps surfaceProps(fDevice->fSurfaceProps.flags(),
kUnknown_SkPixelGeometry);
dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index ffccb611d8..33da50a41d 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -18,7 +18,7 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return false;
}
if (rowBytes < info.minRowBytes()) {
@@ -26,15 +26,15 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
}
if (kIndex_8_SkColorType == info.colorType()) {
- if (NULL == ctable || NULL == ctableCount) {
+ if (nullptr == ctable || nullptr == ctableCount) {
return false;
}
} else {
if (ctableCount) {
*ctableCount = 0;
}
- ctableCount = NULL;
- ctable = NULL;
+ ctableCount = nullptr;
+ ctable = nullptr;
}
const bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount);
@@ -49,7 +49,7 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
if (kIndex_8_SkColorType == info.colorType()) {
return false;
}
- return this->getPixels(info, pixels, rowBytes, NULL, NULL);
+ return this->getPixels(info, pixels, rowBytes, nullptr, nullptr);
}
bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
@@ -62,9 +62,9 @@ bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t r
((planes[0]) && (planes[1]) && (planes[2]) &&
(0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2]));
bool isValidWithoutPlanes =
- ((NULL == planes) ||
- ((NULL == planes[0]) && (NULL == planes[1]) && (NULL == planes[2]))) &&
- ((NULL == rowBytes) ||
+ ((nullptr == planes) ||
+ ((nullptr == planes[0]) && (nullptr == planes[1]) && (nullptr == planes[2]))) &&
+ ((nullptr == rowBytes) ||
((0 == rowBytes[0]) && (0 == rowBytes[1]) && (0 == rowBytes[2])));
// Either we have all planes and rowBytes information or we have none of it
@@ -115,7 +115,7 @@ GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData() {
- return NULL;
+ return nullptr;
}
bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb,
@@ -138,8 +138,8 @@ SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory
}
SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
if (gFactory) {
if (SkImageGenerator* generator = gFactory(data)) {
diff --git a/src/core/SkImageGeneratorPriv.h b/src/core/SkImageGeneratorPriv.h
index 5d018bcb79..bf035967a2 100644
--- a/src/core/SkImageGeneratorPriv.h
+++ b/src/core/SkImageGeneratorPriv.h
@@ -17,7 +17,7 @@
* the generator. If it succeeds, it will modify destination
* bitmap.
*
- * If generator is NULL, will safely return false.
+ * If generator is nullptr, will safely return false.
*
* If this fails or when the SkDiscardablePixelRef that is
* installed into destination is destroyed, it will call
@@ -27,8 +27,8 @@
* @param destination Upon success, this bitmap will be
* configured and have a pixelref installed.
*
- * @param factory If not NULL, this object will be used as a
- * source of discardable memory when decoding. If NULL, then
+ * @param factory If not nullptr, this object will be used as a
+ * source of discardable memory when decoding. If nullptr, then
* SkDiscardableMemory::Create() will be called.
*
* @return true iff successful.
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 8429ef28c3..b90f858562 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -90,7 +90,7 @@ bool SkReadPixelsRec::trim(int srcWidth, int srcHeight) {
default:
break;
}
- if (NULL == fPixels || fRowBytes < fInfo.minRowBytes()) {
+ if (nullptr == fPixels || fRowBytes < fInfo.minRowBytes()) {
return false;
}
if (0 == fInfo.width() || 0 == fInfo.height()) {
diff --git a/src/core/SkLayerInfo.h b/src/core/SkLayerInfo.h
index 5d598ef50a..04ae1794a2 100644
--- a/src/core/SkLayerInfo.h
+++ b/src/core/SkLayerInfo.h
@@ -18,7 +18,7 @@ public:
// Information about a given saveLayer/restore block in an SkPicture
class BlockInfo {
public:
- BlockInfo() : fPicture(NULL), fPaint(NULL), fKey(NULL), fKeySize(0) {}
+ BlockInfo() : fPicture(nullptr), fPaint(nullptr), fKey(nullptr), fKeySize(0) {}
~BlockInfo() {
SkSafeUnref(fPicture);
delete fPaint;
@@ -27,8 +27,8 @@ public:
// The picture owning the layer. If the owning picture is the top-most
// one (i.e., the picture for which this SkLayerInfo was created) then
- // this pointer is NULL. If it is a nested picture then the pointer
- // is non-NULL and owns a ref on the picture.
+ // this pointer is nullptr. If it is a nested picture then the pointer
+ // is non-nullptr and owns a ref on the picture.
const SkPicture* fPicture;
// The device space bounds of this layer.
SkRect fBounds;
@@ -46,7 +46,7 @@ public:
// layer's top-left point to the origin (which must be part of the
// initial matrix).
SkMatrix fLocalMat;
- // The paint to use on restore. Can be NULL since it is optional.
+ // The paint to use on restore. Can be nullptr since it is optional.
const SkPaint* fPaint;
// The index of this saveLayer in the picture.
size_t fSaveLayerOpID;
diff --git a/src/core/SkLazyFnPtr.h b/src/core/SkLazyFnPtr.h
index 9e9bc1165c..153578201a 100644
--- a/src/core/SkLazyFnPtr.h
+++ b/src/core/SkLazyFnPtr.h
@@ -42,7 +42,7 @@ public:
F get() {
// First, try reading to see if it's already set.
F fn = (F)sk_atomic_load(&fPtr, sk_memory_order_relaxed);
- if (fn != NULL) {
+ if (fn != nullptr) {
return fn;
}
@@ -50,11 +50,11 @@ public:
fn = Choose();
// No particular memory barriers needed; we're not guarding anything but the pointer itself.
- F prev = (F)sk_atomic_cas(&fPtr, NULL, (void*)fn);
+ F prev = (F)sk_atomic_cas(&fPtr, nullptr, (void*)fn);
- // If prev != NULL, someone snuck in and set fPtr concurrently.
- // If prev == NULL, we did write fn to fPtr.
- return prev != NULL ? prev : fn;
+ // If prev != nullptr, someone snuck in and set fPtr concurrently.
+ // If prev == nullptr, we did write fn to fPtr.
+ return prev != nullptr ? prev : fn;
}
private:
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 0e20db44de..a8d346ab1e 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -176,22 +176,22 @@ public:
GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuilder();
// add uniforms
- const char* lightDirUniName = NULL;
+ const char* lightDirUniName = nullptr;
fLightDirUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"LightDir", &lightDirUniName);
- const char* lightColorUniName = NULL;
+ const char* lightColorUniName = nullptr;
fLightColorUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"LightColor", &lightColorUniName);
- const char* ambientColorUniName = NULL;
+ const char* ambientColorUniName = nullptr;
fAmbientColorUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"AmbientColor", &ambientColorUniName);
- const char* xformUniName = NULL;
+ const char* xformUniName = nullptr;
fXformUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"Xform", &xformUniName);
@@ -578,13 +578,13 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkBitmap diffuse;
if (!buf.readBitmap(&diffuse)) {
- return NULL;
+ return nullptr;
}
diffuse.setImmutable();
SkBitmap normal;
if (!buf.readBitmap(&normal)) {
- return NULL;
+ return nullptr;
}
normal.setImmutable();
@@ -597,7 +597,7 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkColor3f color;
if (!buf.readScalarArray(&color.fX, 3)) {
- return NULL;
+ return nullptr;
}
if (isAmbient) {
@@ -605,7 +605,7 @@ SkFlattenable* SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
} else {
SkVector3 dir;
if (!buf.readScalarArray(&dir.fX, 3)) {
- return NULL;
+ return nullptr;
}
builder.add(SkLight(color, dir));
}
@@ -665,7 +665,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
SkMatrix normTotalInv;
if (!this->computeNormTotalInverse(rec, &normTotalInv)) {
- return NULL;
+ return nullptr;
}
void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext);
@@ -677,7 +677,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
diffuseState->fOrigBitmap = fDiffuseMap;
if (!diffuseState->chooseProcs(diffTotalInv, *rec.fPaint)) {
diffuseState->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState);
@@ -690,7 +690,7 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
if (!normalState->chooseProcs(normTotalInv, *rec.fPaint)) {
diffuseState->~SkBitmapProcState();
normalState->~SkBitmapProcState();
- return NULL;
+ return nullptr;
}
return new (storage) LightingShaderContext(*this, rec, diffuseState, normalState);
diff --git a/src/core/SkLightingShader.h b/src/core/SkLightingShader.h
index d28648767d..f87db31edb 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -73,7 +73,7 @@ public:
@param ambient the linear (unpremul) ambient light color. Range is 0..1/channel.
@param localMatrix the matrix mapping the textures to the dest rect
- NULL will be returned if:
+ nullptr will be returned if:
either 'diffuse' or 'normal' are empty
either 'diffuse' or 'normal' are too big (> 65535 on a side)
'diffuse' and 'normal' aren't the same size
diff --git a/src/core/SkLocalMatrixShader.cpp b/src/core/SkLocalMatrixShader.cpp
index b9a0960873..ce5a7cad71 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -12,7 +12,7 @@ SkFlattenable* SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
buffer.readMatrix(&lm);
SkAutoTUnref<SkShader> shader(buffer.readShader());
if (!shader.get()) {
- return NULL;
+ return nullptr;
}
return SkShader::CreateLocalMatrixShader(shader, lm);
}
@@ -48,8 +48,8 @@ void SkLocalMatrixShader::toString(SkString* str) const {
#endif
SkShader* SkShader::CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) {
- if (NULL == proxy) {
- return NULL;
+ if (nullptr == proxy) {
+ return nullptr;
}
if (localMatrix.isIdentity()) {
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 491651080b..0196e046b1 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -27,7 +27,7 @@ static bool is_valid(const SkImageInfo& info, SkColorTable* ctable) {
// that expect the pixelref to succeed even when there is a mismatch
// with colortables. fix?
#if 0
- if (kIndex8_SkColorType == info.fColorType && NULL == ctable) {
+ if (kIndex8_SkColorType == info.fColorType && nullptr == ctable) {
return false;
}
if (kIndex8_SkColorType != info.fColorType && ctable) {
@@ -42,9 +42,9 @@ SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
size_t rowBytes,
SkColorTable* ctable) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
- return new SkMallocPixelRef(info, addr, rowBytes, ctable, NULL, NULL);
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, nullptr, nullptr);
}
@@ -52,16 +52,16 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
size_t requestedRowBytes,
SkColorTable* ctable) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
// only want to permit 31bits of rowBytes
int64_t minRB = (int64_t)info.minRowBytes64();
if (minRB < 0 || !sk_64_isS32(minRB)) {
- return NULL; // allocation will be too large
+ return nullptr; // allocation will be too large
}
if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) {
- return NULL; // cannot meet requested rowbytes
+ return nullptr; // cannot meet requested rowbytes
}
int32_t rowBytes;
@@ -73,17 +73,17 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
int64_t bigSize = (int64_t)info.height() * rowBytes;
if (!sk_64_isS32(bigSize)) {
- return NULL;
+ return nullptr;
}
size_t size = sk_64_asS32(bigSize);
SkASSERT(size >= info.getSafeSize(rowBytes));
void* addr = sk_malloc_flags(size, 0);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
- return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, NULL);
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, nullptr);
}
SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
@@ -93,7 +93,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
SkMallocPixelRef::ReleaseProc proc,
void* context) {
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
return new SkMallocPixelRef(info, addr, rowBytes, ctable, proc, context);
}
@@ -106,19 +106,19 @@ SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
size_t rowBytes,
SkColorTable* ctable,
SkData* data) {
- SkASSERT(data != NULL);
+ SkASSERT(data != nullptr);
if (!is_valid(info, ctable)) {
- return NULL;
+ return nullptr;
}
if ((rowBytes < info.minRowBytes())
|| (data->size() < info.getSafeSize(rowBytes))) {
- return NULL;
+ return nullptr;
}
data->ref();
SkMallocPixelRef* pr =
new SkMallocPixelRef(info, const_cast<void*>(data->data()), rowBytes, ctable,
sk_data_releaseproc, static_cast<void*>(data));
- SkASSERT(pr != NULL);
+ SkASSERT(pr != nullptr);
// We rely on the immutability of the pixels to make the
// const_cast okay.
pr->setImmutable();
@@ -131,14 +131,14 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
size_t rowBytes, SkColorTable* ctable,
bool ownsPixels)
: INHERITED(info)
- , fReleaseProc(ownsPixels ? sk_free_releaseproc : NULL)
- , fReleaseProcContext(NULL) {
+ , fReleaseProc(ownsPixels ? sk_free_releaseproc : nullptr)
+ , fReleaseProcContext(nullptr) {
// This constructor is now DEPRICATED.
SkASSERT(is_valid(info, ctable));
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- ctable = NULL;
+ ctable = nullptr;
}
fStorage = storage;
@@ -161,7 +161,7 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- ctable = NULL;
+ ctable = nullptr;
}
fStorage = storage;
@@ -175,7 +175,7 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
SkMallocPixelRef::~SkMallocPixelRef() {
SkSafeUnref(fCTable);
- if (fReleaseProc != NULL) {
+ if (fReleaseProc != nullptr) {
fReleaseProc(fStorage, fReleaseProcContext);
}
}
diff --git a/src/core/SkMaskCache.cpp b/src/core/SkMaskCache.cpp
index cc729c3bbb..da7b538d3e 100644
--- a/src/core/SkMaskCache.cpp
+++ b/src/core/SkMaskCache.cpp
@@ -64,7 +64,7 @@ struct RRectBlurRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -79,7 +79,7 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
MaskValue result;
RRectBlurKey key(sigma, rrect, style, quality);
if (!CHECK_LOCAL(localCache, find, Find, key, RRectBlurRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*mask = result.fMask;
@@ -159,7 +159,7 @@ struct RectsBlurRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -175,7 +175,7 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
MaskValue result;
RectsBlurKey key(sigma, style, quality, rects, count);
if (!CHECK_LOCAL(localCache, find, Find, key, RectsBlurRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*mask = result.fMask;
diff --git a/src/core/SkMaskCache.h b/src/core/SkMaskCache.h
index f98387b206..9df1bf8601 100644
--- a/src/core/SkMaskCache.h
+++ b/src/core/SkMaskCache.h
@@ -21,24 +21,24 @@ public:
* On success, return a ref to the SkCachedData that holds the pixels, and have mask
* already point to that memory.
*
- * On failure, return NULL.
+ * On failure, return nullptr.
*/
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRRect& rrect, SkMask* mask,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRect rects[], int count, SkMask* mask,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* Add a mask and its pixel-data to the cache.
*/
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
};
#endif
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 5e7cee6bd6..7c48bcacb9 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -222,11 +222,11 @@ bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix,
// cannot be used, return false to allow our caller to recover and perform
// the drawing another way.
NinePatch patch;
- patch.fMask.fImage = NULL;
+ patch.fMask.fImage = nullptr;
if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
clip.getBounds(),
&patch)) {
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
return false;
}
draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter);
@@ -246,7 +246,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds(), &patch)) {
case kFalse_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
return false;
case kTrue_FilterReturn:
@@ -255,7 +255,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
return true;
case kUnimplemented_FilterReturn:
- SkASSERT(NULL == patch.fMask.fImage);
+ SkASSERT(nullptr == patch.fMask.fImage);
// fall through
break;
}
@@ -270,7 +270,7 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
}
SkAutoMaskFreeImage autoSrc(srcM.fImage);
- if (!this->filterMask(&dstM, srcM, matrix, NULL)) {
+ if (!this->filterMask(&dstM, srcM, matrix, nullptr)) {
return false;
}
SkAutoMaskFreeImage autoDst(dstM.fImage);
@@ -351,7 +351,7 @@ bool SkMaskFilter::filterMaskGPU(GrTexture* src,
void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
SkMask srcM, dstM;
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
srcM.fBounds = src.roundOut();
srcM.fRowBytes = 0;
srcM.fFormat = SkMask::kA8_Format;
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index be5d034c81..16ea47b1b0 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -168,7 +168,7 @@ private:
* convert a linear alpha value for a given channel to a gamma correcting alpha
* value for that channel. This class is immutable.
*
- * If fR, fG, or fB is NULL, all of them will be. This indicates that no mask
+ * If fR, fG, or fB is nullptr, all of them will be. This indicates that no mask
* pre blend should be applied. SkTMaskPreBlend::isApplicable() is provided as
* a convenience function to test for the absence of this case.
*/
@@ -182,7 +182,7 @@ private:
friend class SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>;
public:
/** Creates a non applicable SkTMaskPreBlend. */
- SkTMaskPreBlend() : fParent(), fR(NULL), fG(NULL), fB(NULL) { }
+ SkTMaskPreBlend() : fParent(), fR(nullptr), fG(nullptr), fB(nullptr) { }
/**
* This copy contructor exists for correctness, but should never be called
@@ -193,7 +193,7 @@ public:
~SkTMaskPreBlend() { }
- /** True if this PreBlend should be applied. When false, fR, fG, and fB are NULL. */
+ /** True if this PreBlend should be applied. When false, fR, fG, and fB are nullptr. */
bool isApplicable() const { return SkToBool(this->fG); }
const uint8_t* fR;
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index f5e4e803f2..13a9ac28f0 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -858,7 +858,7 @@ bool SkMatrix::invertNonIdentity(SkMatrix* inv) const {
// translate only
inv->setTranslate(-fMat[kMTransX], -fMat[kMTransY]);
}
- } else { // inv is NULL, just check if we're invertible
+ } else { // inv is nullptr, just check if we're invertible
if (!fMat[kMScaleX] || !fMat[kMScaleY]) {
invertible = false;
}
@@ -878,7 +878,7 @@ bool SkMatrix::invertNonIdentity(SkMatrix* inv) const {
SkMatrix* tmp = inv;
SkMatrix storage;
- if (applyingInPlace || NULL == tmp) {
+ if (applyingInPlace || nullptr == tmp) {
tmp = &storage; // we either need to avoid trampling memory or have no memory
}
diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp
index b6f6fc8a43..823647f3de 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -72,7 +72,7 @@ bool SkMatrixImageFilter::onFilterImage(Proxy* proxy,
dstRect.roundOut(&dstBounds);
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dstBounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
diff --git a/src/core/SkMatrixImageFilter.h b/src/core/SkMatrixImageFilter.h
index 83f2cfaf33..86734b629c 100644
--- a/src/core/SkMatrixImageFilter.h
+++ b/src/core/SkMatrixImageFilter.h
@@ -24,13 +24,13 @@ public:
/** Construct a 2D transformation image filter.
* @param transform The matrix to apply when drawing the src bitmap
* @param filterLevel The quality of filtering to apply when scaling.
- * @param input The input image filter. If NULL, the src bitmap
+ * @param input The input image filter. If nullptr, the src bitmap
* passed to filterImage() is used instead.
*/
static SkMatrixImageFilter* Create(const SkMatrix& transform,
SkFilterQuality,
- SkImageFilter* input = NULL);
+ SkImageFilter* input = nullptr);
virtual ~SkMatrixImageFilter();
void computeFastBounds(const SkRect&, SkRect*) const override;
diff --git a/src/core/SkMetaData.cpp b/src/core/SkMetaData.cpp
index dfc2a94901..dd6ed05571 100644
--- a/src/core/SkMetaData.cpp
+++ b/src/core/SkMetaData.cpp
@@ -27,11 +27,11 @@ void* SkMetaData::RefCntProc(void* ptr, bool doRef) {
return ptr;
}
-SkMetaData::SkMetaData() : fRec(NULL)
+SkMetaData::SkMetaData() : fRec(nullptr)
{
}
-SkMetaData::SkMetaData(const SkMetaData& src) : fRec(NULL)
+SkMetaData::SkMetaData(const SkMetaData& src) : fRec(nullptr)
{
*this = src;
}
@@ -55,7 +55,7 @@ void SkMetaData::reset()
Rec::Free(rec);
rec = next;
}
- fRec = NULL;
+ fRec = nullptr;
}
SkMetaData& SkMetaData::operator=(const SkMetaData& src)
@@ -86,7 +86,7 @@ SkScalar* SkMetaData::setScalars(const char name[], int count, const SkScalar va
SkASSERT(count > 0);
if (count > 0)
return (SkScalar*)this->set(name, values, sizeof(SkScalar), kScalar_Type, count);
- return NULL;
+ return nullptr;
}
void SkMetaData::setString(const char name[], const char value[])
@@ -179,7 +179,7 @@ const SkScalar* SkMetaData::findScalars(const char name[], int* count, SkScalar
memcpy(values, rec->data(), rec->fDataCount * rec->fDataLen);
return (const SkScalar*)rec->data();
}
- return NULL;
+ return nullptr;
}
bool SkMetaData::findPtr(const char name[], void** ptr, PtrProc* proc) const {
@@ -201,8 +201,8 @@ bool SkMetaData::findPtr(const char name[], void** ptr, PtrProc* proc) const {
const char* SkMetaData::findString(const char name[]) const
{
const Rec* rec = this->find(name, kString_Type);
- SkASSERT(rec == NULL || rec->fDataLen == sizeof(char));
- return rec ? (const char*)rec->data() : NULL;
+ SkASSERT(rec == nullptr || rec->fDataLen == sizeof(char));
+ return rec ? (const char*)rec->data() : nullptr;
}
bool SkMetaData::findBool(const char name[], bool* value) const
@@ -227,7 +227,7 @@ const void* SkMetaData::findData(const char name[], size_t* length) const {
}
return rec->data();
}
- return NULL;
+ return nullptr;
}
const SkMetaData::Rec* SkMetaData::find(const char name[], Type type) const
@@ -239,12 +239,12 @@ const SkMetaData::Rec* SkMetaData::find(const char name[], Type type) const
return rec;
rec = rec->fNext;
}
- return NULL;
+ return nullptr;
}
bool SkMetaData::remove(const char name[], Type type) {
Rec* rec = fRec;
- Rec* prev = NULL;
+ Rec* prev = nullptr;
while (rec) {
Rec* next = rec->fNext;
if (rec->fType == type && !strcmp(rec->name(), name)) {
@@ -309,7 +309,7 @@ void SkMetaData::Iter::reset(const SkMetaData& metadata) {
}
const char* SkMetaData::Iter::next(SkMetaData::Type* t, int* count) {
- const char* name = NULL;
+ const char* name = nullptr;
if (fRec) {
if (t) {
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 8a62f88ab2..6e0aaed697 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -206,7 +206,7 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
proc_nocheck = downsample8_nocheck;
break;
default:
- return NULL; // don't build mipmaps for any other colortypes (yet)
+ return nullptr; // don't build mipmaps for any other colortypes (yet)
}
// whip through our loop to compute the exact size needed
@@ -226,29 +226,29 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
}
}
if (0 == countLevels) {
- return NULL;
+ return nullptr;
}
size_t storageSize = SkMipMap::AllocLevelsSize(countLevels, size);
if (0 == storageSize) {
- return NULL;
+ return nullptr;
}
SkAutoPixmapUnlock srcUnlocker;
if (!src.requestLock(&srcUnlocker)) {
- return NULL;
+ return nullptr;
}
const SkPixmap& srcPixmap = srcUnlocker.pixmap();
- // Try to catch where we might have returned NULL for src crbug.com/492818
- if (NULL == srcPixmap.addr()) {
+ // Try to catch where we might have returned nullptr for src crbug.com/492818
+ if (nullptr == srcPixmap.addr()) {
sk_throw();
}
SkMipMap* mipmap;
if (fact) {
SkDiscardableMemory* dm = fact(storageSize);
- if (NULL == dm) {
- return NULL;
+ if (nullptr == dm) {
+ return nullptr;
}
mipmap = new SkMipMap(storageSize, dm);
} else {
@@ -321,7 +321,7 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
///////////////////////////////////////////////////////////////////////////////
bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
- if (NULL == fLevels) {
+ if (nullptr == fLevels) {
return false;
}
diff --git a/src/core/SkMipMap.h b/src/core/SkMipMap.h
index e22c0a2181..36c17ba91e 100644
--- a/src/core/SkMipMap.h
+++ b/src/core/SkMipMap.h
@@ -31,7 +31,7 @@ public:
protected:
void onDataChange(void* oldData, void* newData) override {
- fLevels = (Level*)newData; // could be NULL
+ fLevels = (Level*)newData; // could be nullptr
}
private:
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 8cbb9ca60f..4003808310 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -37,7 +37,7 @@ void SkMultiPictureDraw::DrawData::init(SkCanvas* canvas, const SkPicture* pictu
if (paint) {
fPaint = new SkPaint(*paint);
} else {
- fPaint = NULL;
+ fPaint = nullptr;
}
}
@@ -68,8 +68,8 @@ void SkMultiPictureDraw::add(SkCanvas* canvas,
const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) {
- if (NULL == canvas || NULL == picture) {
- SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-NULL");
+ if (nullptr == canvas || nullptr == picture) {
+ SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-nullptr");
return;
}
@@ -179,7 +179,7 @@ void SkMultiPictureDraw::draw(bool flush) {
// Render the entire picture using new layers
GrRecordReplaceDraw(picture, canvas, context->getLayerCache(),
- initialMatrix, NULL);
+ initialMatrix, nullptr);
GrLayerHoister::UnlockLayers(context, needRendering);
GrLayerHoister::UnlockLayers(context, recycled);
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 7fd0b9d227..c1097204c4 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -40,16 +40,16 @@
//#define SK_REPORT_API_RANGE_CHECK
SkPaint::SkPaint() {
- fTypeface = NULL;
- fPathEffect = NULL;
- fShader = NULL;
- fXfermode = NULL;
- fMaskFilter = NULL;
- fColorFilter = NULL;
- fRasterizer = NULL;
- fLooper = NULL;
- fImageFilter = NULL;
- fAnnotation = NULL;
+ fTypeface = nullptr;
+ fPathEffect = nullptr;
+ fShader = nullptr;
+ fXfermode = nullptr;
+ fMaskFilter = nullptr;
+ fColorFilter = nullptr;
+ fRasterizer = nullptr;
+ fLooper = nullptr;
+ fImageFilter = nullptr;
+ fAnnotation = nullptr;
fTextSize = SkPaintDefaults_TextSize;
fTextScaleX = SK_Scalar1;
@@ -398,9 +398,9 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return 0;
}
- SkASSERT(textData != NULL);
+ SkASSERT(textData != nullptr);
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
switch (this->getTextEncoding()) {
case kUTF8_TextEncoding:
return SkUTF8_CountUnichars((const char*)textData, byteLength);
@@ -425,7 +425,7 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return SkToInt(byteLength >> 1);
}
- SkAutoGlyphCache autoCache(*this, NULL, NULL);
+ SkAutoGlyphCache autoCache(*this, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
const char* text = (const char*)textData;
@@ -465,7 +465,7 @@ bool SkPaint::containsText(const void* textData, size_t byteLength) const {
return true;
}
- SkASSERT(textData != NULL);
+ SkASSERT(textData != nullptr);
// handle this encoding before the setup for the glyphcache
if (this->getTextEncoding() == kGlyphID_TextEncoding) {
@@ -479,7 +479,7 @@ bool SkPaint::containsText(const void* textData, size_t byteLength) const {
return true;
}
- SkAutoGlyphCache autoCache(*this, NULL, NULL);
+ SkAutoGlyphCache autoCache(*this, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
switch (this->getTextEncoding()) {
@@ -525,11 +525,11 @@ void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar tex
return;
}
- SkASSERT(glyphs != NULL);
- SkASSERT(textData != NULL);
+ SkASSERT(glyphs != nullptr);
+ SkASSERT(textData != nullptr);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- SkAutoGlyphCache autoCache(*this, &props, NULL);
+ SkAutoGlyphCache autoCache(*this, &props, nullptr);
SkGlyphCache* cache = autoCache.getCache();
for (int index = 0; index < count; index++) {
@@ -541,24 +541,24 @@ void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar tex
static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getMetrics_utf16_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -568,8 +568,8 @@ static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -580,24 +580,24 @@ static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache,
static const SkGlyph& sk_getAdvance_utf8_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharAdvance(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getAdvance_utf16_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharAdvance(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -607,8 +607,8 @@ static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache,
static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache,
const char** text) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -644,32 +644,32 @@ SkMeasureCacheProc SkPaint::getMeasureCacheProc(bool needFullMetrics) const {
static const SkGlyph& sk_getMetrics_utf8_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text));
}
static const SkGlyph& sk_getMetrics_utf8_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF8_NextUnichar(text), x, y);
}
static const SkGlyph& sk_getMetrics_utf16_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text));
}
static const SkGlyph& sk_getMetrics_utf16_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text),
x, y);
@@ -677,8 +677,8 @@ static const SkGlyph& sk_getMetrics_utf16_xy(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_utf32_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -688,8 +688,8 @@ static const SkGlyph& sk_getMetrics_utf32_00(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_utf32_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const int32_t* ptr = *(const int32_t**)text;
SkUnichar uni = *ptr++;
@@ -699,8 +699,8 @@ static const SkGlyph& sk_getMetrics_utf32_xy(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_00(SkGlyphCache* cache,
const char** text, SkFixed, SkFixed) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -711,8 +711,8 @@ static const SkGlyph& sk_getMetrics_glyph_00(SkGlyphCache* cache,
static const SkGlyph& sk_getMetrics_glyph_xy(SkGlyphCache* cache,
const char** text, SkFixed x, SkFixed y) {
- SkASSERT(cache != NULL);
- SkASSERT(text != NULL);
+ SkASSERT(cache != nullptr);
+ SkASSERT(text != nullptr);
const uint16_t* ptr = *(const uint16_t**)text;
unsigned glyphID = *ptr;
@@ -835,7 +835,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
return 0;
}
- SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(NULL != bounds);
+ SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(nullptr != bounds);
int xyIndex;
JoinBoundsProc joinBoundsProc;
@@ -857,7 +857,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkAutoKern autokern;
- if (NULL == bounds) {
+ if (nullptr == bounds) {
if (this->isDevKernText()) {
int rsb;
for (; text < stop; n++) {
@@ -897,13 +897,13 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
SkScalar SkPaint::measureText(const void* textData, size_t length, SkRect* bounds) const {
const char* text = (const char*)textData;
- SkASSERT(text != NULL || length == 0);
+ SkASSERT(text != nullptr || length == 0);
SkCanonicalizePaint canon(*this);
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkScalar width = 0;
@@ -944,7 +944,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
return length;
}
- SkASSERT(textD != NULL);
+ SkASSERT(textD != nullptr);
const char* text = (const char*)textD;
const char* stop = text + length;
@@ -957,7 +957,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
maxWidth /= scale;
}
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc = paint.getMeasureCacheProc(false);
@@ -1022,18 +1022,18 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkMatrix zoomMatrix, *zoomPtr = NULL;
+ SkMatrix zoomMatrix, *zoomPtr = nullptr;
if (zoom) {
zoomMatrix.setScale(zoom, zoom);
zoomPtr = &zoomMatrix;
}
FontMetrics storage;
- if (NULL == metrics) {
+ if (nullptr == metrics) {
metrics = &storage;
}
- paint.descriptorProc(NULL, zoomPtr, FontMetricsDescProc, metrics, true);
+ paint.descriptorProc(nullptr, zoomPtr, FontMetricsDescProc, metrics, true);
if (scale) {
metrics->fTop = SkScalarMul(metrics->fTop, scale);
@@ -1068,7 +1068,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
SkASSERT(textData);
- if (NULL == widths && NULL == bounds) {
+ if (nullptr == widths && nullptr == bounds) {
return this->countText(textData, byteLength);
}
@@ -1076,10 +1076,10 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
const SkPaint& paint = canon.getPaint();
SkScalar scale = canon.getScale();
- SkAutoGlyphCache autoCache(paint, NULL, NULL);
+ SkAutoGlyphCache autoCache(paint, nullptr, nullptr);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc;
- glyphCacheProc = paint.getMeasureCacheProc(NULL != bounds);
+ glyphCacheProc = paint.getMeasureCacheProc(nullptr != bounds);
const char* text = (const char*)textData;
const char* stop = text + byteLength;
@@ -1168,10 +1168,10 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
void SkPaint::getTextPath(const void* textData, size_t length,
SkScalar x, SkScalar y, SkPath* path) const {
- SkASSERT(length == 0 || textData != NULL);
+ SkASSERT(length == 0 || textData != nullptr);
const char* text = (const char*)textData;
- if (text == NULL || length == 0 || path == NULL) {
+ if (text == nullptr || length == 0 || path == nullptr) {
return;
}
@@ -1196,10 +1196,10 @@ void SkPaint::getTextPath(const void* textData, size_t length,
void SkPaint::getPosTextPath(const void* textData, size_t length,
const SkPoint pos[], SkPath* path) const {
- SkASSERT(length == 0 || textData != NULL);
+ SkASSERT(length == 0 || textData != nullptr);
const char* text = (const char*)textData;
- if (text == NULL || length == 0 || path == NULL) {
+ if (text == nullptr || length == 0 || path == nullptr) {
return;
}
@@ -1213,7 +1213,7 @@ void SkPaint::getPosTextPath(const void* textData, size_t length,
unsigned int i = 0;
const SkPath* iterPath;
- while (iter.next(&iterPath, NULL)) {
+ while (iter.next(&iterPath, nullptr)) {
matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
if (iterPath) {
path->addPath(*iterPath, matrix);
@@ -1229,7 +1229,7 @@ SkRect SkPaint::getFontBounds() const {
m.postSkew(fTextSkewX, 0);
SkTypeface* typeface = this->getTypeface();
- if (NULL == typeface) {
+ if (nullptr == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
}
@@ -1240,7 +1240,7 @@ SkRect SkPaint::getFontBounds() const {
static void add_flattenable(SkDescriptor* desc, uint32_t tag,
SkWriteBuffer* buffer) {
- buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL));
+ buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), nullptr));
}
static SkMask::Format compute_mask_format(const SkPaint& paint) {
@@ -1329,10 +1329,10 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
const SkSurfaceProps* surfaceProps,
const SkMatrix* deviceMatrix,
Rec* rec) {
- SkASSERT(deviceMatrix == NULL || !deviceMatrix->hasPerspective());
+ SkASSERT(deviceMatrix == nullptr || !deviceMatrix->hasPerspective());
SkTypeface* typeface = paint.getTypeface();
- if (NULL == typeface) {
+ if (nullptr == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
}
rec->fFontID = typeface->uniqueID();
@@ -1498,8 +1498,8 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
*/
SK_DECLARE_STATIC_MUTEX(gMaskGammaCacheMutex);
-static SkMaskGamma* gLinearMaskGamma = NULL;
-static SkMaskGamma* gMaskGamma = NULL;
+static SkMaskGamma* gLinearMaskGamma = nullptr;
+static SkMaskGamma* gMaskGamma = nullptr;
static SkScalar gContrast = SK_ScalarMin;
static SkScalar gPaintGamma = SK_ScalarMin;
static SkScalar gDeviceGamma = SK_ScalarMin;
@@ -1510,7 +1510,7 @@ static SkScalar gDeviceGamma = SK_ScalarMin;
static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma) {
gMaskGammaCacheMutex.assertHeld();
if (0 == contrast && SK_Scalar1 == paintGamma && SK_Scalar1 == deviceGamma) {
- if (NULL == gLinearMaskGamma) {
+ if (nullptr == gLinearMaskGamma) {
gLinearMaskGamma = new SkMaskGamma;
}
return *gLinearMaskGamma;
@@ -1529,9 +1529,9 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
SkSafeUnref(gLinearMaskGamma);
- gLinearMaskGamma = NULL;
+ gLinearMaskGamma = nullptr;
SkSafeUnref(gMaskGamma);
- gMaskGamma = NULL;
+ gMaskGamma = nullptr;
SkDEBUGCODE(gContrast = SK_ScalarMin;)
SkDEBUGCODE(gPaintGamma = SK_ScalarMin;)
SkDEBUGCODE(gDeviceGamma = SK_ScalarMin;)
@@ -1975,7 +1975,7 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
if (flatFlags & kHasTypeface_FlatFlag) {
this->setTypeface(buffer.readTypeface());
} else {
- this->setTypeface(NULL);
+ this->setTypeface(nullptr);
}
if (flatFlags & kHasEffects_FlatFlag) {
@@ -1992,14 +1992,14 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
this->setAnnotation(SkAnnotation::Create(buffer))->unref();
}
} else {
- this->setPathEffect(NULL);
- this->setShader(NULL);
- this->setXfermode(NULL);
- this->setMaskFilter(NULL);
- this->setColorFilter(NULL);
- this->setRasterizer(NULL);
- this->setLooper(NULL);
- this->setImageFilter(NULL);
+ this->setPathEffect(nullptr);
+ this->setShader(nullptr);
+ this->setXfermode(nullptr);
+ this->setMaskFilter(nullptr);
+ this->setColorFilter(nullptr);
+ this->setRasterizer(nullptr);
+ this->setLooper(nullptr);
+ this->setImageFilter(nullptr);
}
}
@@ -2303,14 +2303,14 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
fGlyphCacheProc = paint.getMeasureCacheProc(true);
fPaint.setLinearText(true);
- fPaint.setMaskFilter(NULL); // don't want this affecting our path-cache lookup
+ fPaint.setMaskFilter(nullptr); // don't want this affecting our path-cache lookup
- if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
+ if (fPaint.getPathEffect() == nullptr && !has_thick_frame(fPaint)) {
applyStrokeAndPathEffects = false;
}
// can't use our canonical size if we need to apply patheffects
- if (fPaint.getPathEffect() == NULL) {
+ if (fPaint.getPathEffect() == nullptr) {
fPaint.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
fScale = paint.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
if (has_thick_frame(fPaint)) {
@@ -2322,13 +2322,13 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
if (!applyStrokeAndPathEffects) {
fPaint.setStyle(SkPaint::kFill_Style);
- fPaint.setPathEffect(NULL);
+ fPaint.setPathEffect(nullptr);
}
- fCache = fPaint.detachCache(NULL, NULL, false);
+ fCache = fPaint.detachCache(nullptr, nullptr, false);
SkPaint::Style style = SkPaint::kFill_Style;
- SkPathEffect* pe = NULL;
+ SkPathEffect* pe = nullptr;
if (!applyStrokeAndPathEffects) {
style = paint.getStyle(); // restore
@@ -2344,7 +2344,7 @@ SkTextToPathIter::SkTextToPathIter(const char text[], size_t length,
if (paint.getTextAlign() != SkPaint::kLeft_Align) { // need to measure first
int count;
SkScalar width = SkScalarMul(fPaint.measure_text(fCache, text, length,
- &count, NULL), fScale);
+ &count, nullptr), fScale);
if (paint.getTextAlign() == SkPaint::kCenter_Align) {
width = SkScalarHalf(width);
}
@@ -2376,7 +2376,7 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) {
}
} else {
if (path) {
- *path = NULL;
+ *path = nullptr;
}
}
if (xpos) {
@@ -2398,7 +2398,7 @@ static bool affects_alpha(const SkColorFilter* cf) {
static bool affects_alpha(const SkImageFilter* imf) {
// TODO: check if we should allow imagefilters to broadcast that they don't affect alpha
// ala colorfilters
- return imf != NULL;
+ return imf != nullptr;
}
bool SkPaint::nothingToDraw() const {
diff --git a/src/core/SkPaintPriv.h b/src/core/SkPaintPriv.h
index 708f861b70..a03f9b3390 100644
--- a/src/core/SkPaintPriv.h
+++ b/src/core/SkPaintPriv.h
@@ -23,7 +23,7 @@ public:
};
/**
- * Returns true if drawing with this paint (or NULL) will ovewrite all affected pixels.
+ * Returns true if drawing with this paint (or nullptr) will ovewrite all affected pixels.
*
* Note: returns conservative true, meaning it may return false even though the paint might
* in fact overwrite its pixels.
@@ -35,13 +35,13 @@ public:
}
/**
- * Returns true if drawing this bitmap with this paint (or NULL) will ovewrite all affected
+ * Returns true if drawing this bitmap with this paint (or nullptr) will ovewrite all affected
* pixels.
*/
static bool Overwrites(const SkBitmap&, const SkPaint* paint);
/**
- * Returns true if drawing this image with this paint (or NULL) will ovewrite all affected
+ * Returns true if drawing this image with this paint (or nullptr) will ovewrite all affected
* pixels.
*/
static bool Overwrites(const SkImage*, const SkPaint* paint);
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 05fc7305ce..8da15804de 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -137,7 +137,7 @@ void SkPath::resetFields() {
fFirstDirection = SkPathPriv::kUnknown_FirstDirection;
// We don't touch Android's fSourcePath. It's used to track texture garbage collection, so we
- // don't want to muck with it if it's been set to something non-NULL.
+ // don't want to muck with it if it's been set to something non-nullptr.
}
SkPath::SkPath(const SkPath& that)
@@ -385,7 +385,7 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
int corners = 0;
SkPoint first, last;
const SkPoint* pts = *ptsPtr;
- const SkPoint* savePts = NULL;
+ const SkPoint* savePts = nullptr;
first.set(0, 0);
last.set(0, 0);
int firstDirection = 0;
@@ -531,7 +531,7 @@ bool SkPath::isNestedFillRects(SkRect rects[2], Direction dirs[2]) const {
const SkPoint* pts = fPathRef->points();
const SkPoint* first = pts;
Direction testDirs[2];
- if (!isRectContour(true, &currVerb, &pts, NULL, &testDirs[0])) {
+ if (!isRectContour(true, &currVerb, &pts, nullptr, &testDirs[0])) {
return false;
}
const SkPoint* last = pts;
@@ -1434,7 +1434,7 @@ static void subdivide_cubic_to(SkPath* path, const SkPoint pts[4],
void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
SkDEBUGCODE(this->validate();)
- if (dst == NULL) {
+ if (dst == nullptr) {
dst = (SkPath*)this;
}
@@ -1522,15 +1522,15 @@ enum SegmentState {
SkPath::Iter::Iter() {
#ifdef SK_DEBUG
- fPts = NULL;
- fConicWeights = NULL;
+ fPts = nullptr;
+ fConicWeights = nullptr;
fMoveTo.fX = fMoveTo.fY = fLastPt.fX = fLastPt.fY = 0;
fForceClose = fCloseLine = false;
fSegmentState = kEmptyContour_SegmentState;
#endif
// need to init enough to make next() harmlessly return kDone_Verb
- fVerbs = NULL;
- fVerbStop = NULL;
+ fVerbs = nullptr;
+ fVerbStop = nullptr;
fNeedClose = false;
}
@@ -1551,7 +1551,7 @@ void SkPath::Iter::setPath(const SkPath& path, bool forceClose) {
}
bool SkPath::Iter::isClosedContour() const {
- if (fVerbs == NULL || fVerbs == fVerbStop) {
+ if (fVerbs == nullptr || fVerbs == fVerbStop) {
return false;
}
if (fForceClose) {
@@ -1617,7 +1617,7 @@ void SkPath::Iter::consumeDegenerateSegments(bool exact) {
// forward before the next move is seen
const uint8_t* lastMoveVerb = 0;
const SkPoint* lastMovePt = 0;
- const SkScalar* lastMoveWeight = NULL;
+ const SkScalar* lastMoveWeight = nullptr;
SkPoint lastPt = fLastPt;
while (fVerbs != fVerbStop) {
unsigned verb = *(fVerbs - 1); // fVerbs is one beyond the current verb
@@ -1776,12 +1776,12 @@ SkPath::Verb SkPath::Iter::doNext(SkPoint ptsParam[4]) {
SkPath::RawIter::RawIter() {
#ifdef SK_DEBUG
- fPts = NULL;
- fConicWeights = NULL;
+ fPts = nullptr;
+ fConicWeights = nullptr;
#endif
// need to init enough to make next() harmlessly return kDone_Verb
- fVerbs = NULL;
- fVerbStop = NULL;
+ fVerbs = nullptr;
+ fVerbStop = nullptr;
}
SkPath::RawIter::RawIter(const SkPath& path) {
@@ -1850,7 +1850,7 @@ SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
size_t SkPath::writeToMemory(void* storage) const {
SkDEBUGCODE(this->validate();)
- if (NULL == storage) {
+ if (nullptr == storage) {
const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
return SkAlign4(byteCount);
}
@@ -1913,7 +1913,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
buffer.skipToAlign4();
sizeRead = buffer.pos();
} else if (pathRef) {
- // If the buffer is not valid, pathRef should be NULL
+ // If the buffer is not valid, pathRef should be nullptr
sk_throw();
}
return sizeRead;
@@ -2006,11 +2006,11 @@ void SkPath::dump(SkWStream* wStream, bool forceClose, bool dumpAsHex) const {
}
void SkPath::dump() const {
- this->dump(NULL, false, false);
+ this->dump(nullptr, false, false);
}
void SkPath::dumpHex() const {
- this->dump(NULL, false, true);
+ this->dump(nullptr, false, true);
}
#ifdef SK_DEBUG
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index 17ae95e801..caff6df399 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -297,7 +297,7 @@ static void compute_pos_tan(const SkPoint pts[], int segType,
}
} break;
case kCubic_SegType:
- SkEvalCubicAt(pts, t, pos, tangent, NULL);
+ SkEvalCubicAt(pts, t, pos, tangent, nullptr);
if (tangent) {
tangent->normalize();
}
@@ -402,7 +402,7 @@ static void seg_to(const SkPoint pts[], int segType,
////////////////////////////////////////////////////////////////////////////////
SkPathMeasure::SkPathMeasure() {
- fPath = NULL;
+ fPath = nullptr;
fLength = -1; // signal we need to compute it
fForceClosed = false;
fFirstPtIndex = -1;
@@ -435,7 +435,7 @@ void SkPathMeasure::setPath(const SkPath* path, bool forceClosed) {
}
SkScalar SkPathMeasure::getLength() {
- if (fPath == NULL) {
+ if (fPath == nullptr) {
return 0;
}
if (fLength < 0) {
@@ -452,7 +452,7 @@ int SkTKSearch(const T base[], int count, const K& key) {
return ~0;
}
- SkASSERT(base != NULL); // base may be NULL if count is zero
+ SkASSERT(base != nullptr); // base may be nullptr if count is zero
int lo = 0;
int hi = count - 1;
@@ -511,7 +511,7 @@ const SkPathMeasure::Segment* SkPathMeasure::distanceToSegment(
bool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* pos,
SkVector* tangent) {
- if (NULL == fPath) {
+ if (nullptr == fPath) {
return false;
}
@@ -538,7 +538,7 @@ bool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* pos,
bool SkPathMeasure::getMatrix(SkScalar distance, SkMatrix* matrix,
MatrixFlags flags) {
- if (NULL == fPath) {
+ if (nullptr == fPath) {
return false;
}
@@ -584,7 +584,7 @@ bool SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst,
SkASSERT(seg <= stopSeg);
if (startWithMoveTo) {
- compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, startT, &p, NULL);
+ compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, startT, &p, nullptr);
dst->moveTo(p);
}
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index e3317a6e75..be7c66cc4b 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -35,8 +35,8 @@ SkPathRef::~SkPathRef() {
SkDEBUGCODE(this->validate();)
sk_free(fPoints);
- SkDEBUGCODE(fPoints = NULL;)
- SkDEBUGCODE(fVerbs = NULL;)
+ SkDEBUGCODE(fPoints = nullptr;)
+ SkDEBUGCODE(fVerbs = nullptr;)
SkDEBUGCODE(fVerbCnt = 0x9999999;)
SkDEBUGCODE(fPointCnt = 0xAAAAAAA;)
SkDEBUGCODE(fPointCnt = 0xBBBBBBB;)
@@ -130,7 +130,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
int32_t packed;
if (!buffer->readS32(&packed)) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1;
@@ -143,7 +143,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->readS32(&pointCount) ||
!buffer->readS32(&conicCount)) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->resetToSize(verbCount, pointCount, conicCount);
@@ -156,7 +156,7 @@ SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
!buffer->read(ref->fConicWeights.begin(), conicCount * sizeof(SkScalar)) ||
!buffer->read(&ref->fBounds, sizeof(SkRect))) {
delete ref;
- return NULL;
+ return nullptr;
}
ref->fBoundsIsDirty = false;
@@ -443,7 +443,7 @@ uint32_t SkPathRef::genID() const {
}
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (NULL == listener || this == empty.get()) {
+ if (nullptr == listener || this == empty.get()) {
delete listener;
return;
}
@@ -465,11 +465,11 @@ void SkPathRef::validate() const {
this->INHERITED::validate();
SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0);
SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPoints) >= 0);
- SkASSERT((NULL == fPoints) == (NULL == fVerbs));
- SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
- SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
- SkASSERT(!(NULL == fPoints && fPointCnt));
- SkASSERT(!(NULL == fVerbs && fVerbCnt));
+ SkASSERT((nullptr == fPoints) == (nullptr == fVerbs));
+ SkASSERT(!(nullptr == fPoints && 0 != fFreeSpace));
+ SkASSERT(!(nullptr == fPoints && 0 != fFreeSpace));
+ SkASSERT(!(nullptr == fPoints && fPointCnt));
+ SkASSERT(!(nullptr == fVerbs && fVerbCnt));
SkASSERT(this->currSize() ==
fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVerbCnt);
diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp
index 9fa6a64c4e..42d42c408c 100644
--- a/src/core/SkPictureContentInfo.cpp
+++ b/src/core/SkPictureContentInfo.cpp
@@ -45,7 +45,7 @@ bool SkPictureContentInfo::suitableForGpuRasterization(GrContext* context, const
}
void SkPictureContentInfo::onDrawPoints(size_t count, const SkPaint& paint) {
- if (paint.getPathEffect() != NULL) {
+ if (paint.getPathEffect() != nullptr) {
SkPathEffect::DashInfo info;
SkPathEffect::DashType dashType = paint.getPathEffect()->asADash(&info);
if (2 == count && SkPaint::kRound_Cap != paint.getStrokeCap() &&
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index e70cd66de8..2cc28410fe 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -80,14 +80,14 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
}
void SkPictureData::init() {
- fPictureRefs = NULL;
+ fPictureRefs = nullptr;
fPictureCount = 0;
- fTextBlobRefs = NULL;
+ fTextBlobRefs = nullptr;
fTextBlobCount = 0;
- fImageRefs = NULL;
+ fImageRefs = nullptr;
fImageCount = 0;
- fOpData = NULL;
- fFactoryPlayback = NULL;
+ fOpData = nullptr;
+ fFactoryPlayback = nullptr;
}
SkPictureData::~SkPictureData() {
@@ -133,7 +133,7 @@ static size_t compute_chunk_size(SkFlattenable::Factory* array, int count) {
for (int i = 0; i < count; i++) {
const char* name = SkFlattenable::FactoryToName(array[i]);
- if (NULL == name || 0 == *name) {
+ if (nullptr == name || 0 == *name) {
size += SkWStream::SizeOfPackedUInt(0);
} else {
size_t len = strlen(name);
@@ -171,7 +171,7 @@ void SkPictureData::WriteFactories(SkWStream* stream, const SkFactorySet& rec) {
for (int i = 0; i < count; i++) {
const char* name = SkFlattenable::FactoryToName(array[i]);
- if (NULL == name || 0 == *name) {
+ if (nullptr == name || 0 == *name) {
stream->writePackedUInt(0);
} else {
size_t len = strlen(name);
@@ -355,7 +355,7 @@ bool SkPictureData::parseStreamTag(SkStream* stream,
switch (tag) {
case SK_PICT_READER_TAG:
- SkASSERT(NULL == fOpData);
+ SkASSERT(nullptr == fOpData);
fOpData = SkData::NewFromStream(stream, size);
if (!fOpData) {
return false;
@@ -443,7 +443,7 @@ static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) {
int height = buffer.read32();
if (width <= 0 || height <= 0) { // SkImage never has a zero dimension
buffer.validate(false);
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkData> encoded(buffer.readByteArrayAsData());
@@ -451,7 +451,7 @@ static const SkImage* create_image_from_buffer(SkReadBuffer& buffer) {
int originY = buffer.read32();
if (0 == encoded->size() || originX < 0 || originY < 0) {
buffer.validate(false);
- return NULL;
+ return nullptr;
}
const SkIRect subset = SkIRect::MakeXYWH(originX, originY, width, height);
@@ -467,7 +467,7 @@ static const SkPicture* create_picture_from_buffer(SkReadBuffer& buffer) {
template <typename T>
bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
const T*** array, int* outCount, const T* (*factory)(SkReadBuffer&)) {
- if (!buffer.validate((0 == *outCount) && (NULL == *array))) {
+ if (!buffer.validate((0 == *outCount) && (nullptr == *array))) {
return false;
}
if (0 == inCount) {
@@ -479,7 +479,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
int i = 0;
for (; i < *outCount; i++) {
(*array)[i] = factory(buffer);
- if (NULL == (*array)[i]) {
+ if (nullptr == (*array)[i]) {
success = false;
break;
}
@@ -491,7 +491,7 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount,
}
// Delete the array
delete[] * array;
- *array = NULL;
+ *array = nullptr;
*outCount = 0;
return false;
}
@@ -542,10 +542,10 @@ bool SkPictureData::parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t
case SK_PICT_READER_TAG: {
SkAutoDataUnref data(SkData::NewUninitialized(size));
if (!buffer.readByteArray(data->writable_data(), size) ||
- !buffer.validate(NULL == fOpData)) {
+ !buffer.validate(nullptr == fOpData)) {
return false;
}
- SkASSERT(NULL == fOpData);
+ SkASSERT(nullptr == fOpData);
fOpData = data.detach();
} break;
case SK_PICT_PICTURE_TAG:
@@ -571,7 +571,7 @@ SkPictureData* SkPictureData::CreateFromStream(SkStream* stream,
}
if (!data->parseStream(stream, proc, topLevelTFPlayback)) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
@@ -582,7 +582,7 @@ SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
buffer.setVersion(info.fVersion);
if (!data->parseBuffer(buffer)) {
- return NULL;
+ return nullptr;
}
return data.detach();
}
@@ -631,11 +631,11 @@ bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char **reason,
GrPixelConfig config, SkScalar dpi) const {
- if (context != NULL) {
+ if (context != nullptr) {
return this->suitableForGpuRasterization(context, reason,
context->getRecommendedSampleCount(config, dpi));
} else {
- return this->suitableForGpuRasterization(NULL, reason);
+ return this->suitableForGpuRasterization(nullptr, reason);
}
}
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index a68a8c8317..4e4deef55a 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -111,7 +111,7 @@ public:
const SkPaint* getPaint(SkReader32* reader) const {
int index = reader->readInt();
if (index == 0) {
- return NULL;
+ return nullptr;
}
return &fPaints[index - 1];
}
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index 3556004a96..02d8592830 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -18,10 +18,10 @@
///////////////////////////////////////////////////////////////////////////////
-SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(NULL) {}
+SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(nullptr) {}
SkTypefacePlayback::~SkTypefacePlayback() {
- this->reset(NULL);
+ this->reset(nullptr);
}
void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
@@ -31,7 +31,7 @@ void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
}
delete[] fArray;
- if (rec!= NULL && rec->count() > 0) {
+ if (rec!= nullptr && rec->count() > 0) {
fCount = rec->count();
fArray = new SkRefCnt* [fCount];
rec->copyToArray(fArray);
@@ -40,12 +40,12 @@ void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
}
} else {
fCount = 0;
- fArray = NULL;
+ fArray = nullptr;
}
}
void SkTypefacePlayback::setCount(int count) {
- this->reset(NULL);
+ this->reset(nullptr);
fCount = count;
fArray = new SkRefCnt* [count];
@@ -61,10 +61,10 @@ SkRefCnt* SkTypefacePlayback::set(int index, SkRefCnt* obj) {
///////////////////////////////////////////////////////////////////////////////
SkFlatController::SkFlatController(uint32_t writeBufferFlags)
-: fBitmapHeap(NULL)
-, fTypefaceSet(NULL)
-, fTypefacePlayback(NULL)
-, fFactorySet(NULL)
+: fBitmapHeap(nullptr)
+, fTypefaceSet(nullptr)
+, fTypefacePlayback(nullptr)
+, fFactorySet(nullptr)
, fWriteBufferFlags(writeBufferFlags) {}
SkFlatController::~SkFlatController() {
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index 176f48625d..98a43ecb57 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -296,8 +296,8 @@ public:
// Unflatten this into result, using bitmapHeap and facePlayback for bitmaps and fonts if given
template <typename Traits, typename T>
void unflatten(T* result,
- SkBitmapHeap* bitmapHeap = NULL,
- SkTypefacePlayback* facePlayback = NULL) const {
+ SkBitmapHeap* bitmapHeap = nullptr,
+ SkTypefacePlayback* facePlayback = nullptr) const {
SkReadBuffer buffer(this->data(), fFlatSize);
if (bitmapHeap) {
@@ -411,28 +411,28 @@ public:
* Similar to find. Allows the caller to specify an SkFlatData to replace in
* the case of an add. Also tells the caller whether a new SkFlatData was
* added and whether the old one was replaced. The parameters added and
- * replaced are required to be non-NULL. Rather than returning the index of
+ * replaced are required to be non-nullptr. Rather than returning the index of
* the entry in the dictionary, it returns the actual SkFlatData.
*/
const SkFlatData* findAndReplace(const T& element,
const SkFlatData* toReplace,
bool* added,
bool* replaced) {
- SkASSERT(added != NULL && replaced != NULL);
+ SkASSERT(added != nullptr && replaced != nullptr);
const int oldCount = this->count();
SkFlatData* flat = this->findAndReturnMutableFlat(element);
*added = this->count() > oldCount;
// If we don't want to replace anything, we're done.
- if (!*added || toReplace == NULL) {
+ if (!*added || toReplace == nullptr) {
*replaced = false;
return flat;
}
// If we don't have the thing to replace, we're done.
const SkFlatData* found = fHash.find(*toReplace);
- if (found == NULL) {
+ if (found == nullptr) {
*replaced = false;
return flat;
}
@@ -469,7 +469,7 @@ public:
/**
* Find or insert a flattened version of element into the dictionary.
- * Caller does not take ownership of the result. This will not return NULL.
+ * Caller does not take ownership of the result. This will not return nullptr.
*/
const SkFlatData* findAndReturnFlat(const T& element) {
return this->findAndReturnMutableFlat(element);
@@ -484,7 +484,7 @@ private:
}
// Without a bitmap heap, we'll flatten bitmaps into paints. That's never what you want.
- SkASSERT(fController->getBitmapHeap() != NULL);
+ SkASSERT(fController->getBitmapHeap() != nullptr);
fScratch.setBitmapHeap(fController->getBitmapHeap());
fScratch.setTypefaceRecorder(fController->getTypefaceSet());
fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet());
@@ -497,7 +497,7 @@ private:
const SkFlatData& scratch = this->resetScratch(element, this->count()+1);
SkFlatData* candidate = fHash.find(scratch);
- if (candidate != NULL) {
+ if (candidate != nullptr) {
return candidate;
}
@@ -520,7 +520,7 @@ private:
// Reinterpret data in fScratch as an SkFlatData.
SkFlatData* scratch = (SkFlatData*)fScratch.getWriter32()->contiguousArray();
- SkASSERT(scratch != NULL);
+ SkASSERT(scratch != nullptr);
scratch->stampHeader(index, SkToS32(dataSize));
return *scratch;
}
@@ -534,7 +534,7 @@ private:
// Copy scratch into the new SkFlatData.
SkFlatData* scratch = (SkFlatData*)fScratch.getWriter32()->contiguousArray();
- SkASSERT(scratch != NULL);
+ SkASSERT(scratch != nullptr);
memcpy(detached, scratch, fScratch.bytesWritten());
// We can now reuse fScratch, and detached will live until fController dies.
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index eb7c476e96..b994071cbb 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -44,7 +44,7 @@ static const SkRect* get_rect_ptr(SkReader32* reader) {
if (reader->readBool()) {
return &reader->skipT<SkRect>();
} else {
- return NULL;
+ return nullptr;
}
}
@@ -164,13 +164,13 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const int count = reader->readU32();
const SkRSXform* xform = (const SkRSXform*)reader->skip(count * sizeof(SkRSXform));
const SkRect* tex = (const SkRect*)reader->skip(count * sizeof(SkRect));
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
SkXfermode::Mode mode = SkXfermode::kDst_Mode;
if (flags & DRAW_ATLAS_HAS_COLORS) {
colors = (const SkColor*)reader->skip(count * sizeof(SkColor));
mode = (SkXfermode::Mode)reader->readU32();
}
- const SkRect* cull = NULL;
+ const SkRect* cull = nullptr;
if (flags & DRAW_ATLAS_HAS_CULL) {
cull = (const SkRect*)reader->skip(sizeof(SkRect));
}
@@ -275,11 +275,11 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::kNumCtrlPts *
sizeof(SkPoint));
uint32_t flag = reader->readInt();
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
if (flag & DRAW_VERTICES_HAS_COLORS) {
colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor));
}
- const SkPoint* texCoords = NULL;
+ const SkPoint* texCoords = nullptr;
if (flag & DRAW_VERTICES_HAS_TEXS) {
texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorners *
sizeof(SkPoint));
@@ -418,9 +418,9 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
SkCanvas::VertexMode vmode = (SkCanvas::VertexMode)reader->readInt();
int vCount = reader->readInt();
const SkPoint* verts = (const SkPoint*)reader->skip(vCount * sizeof(SkPoint));
- const SkPoint* texs = NULL;
- const SkColor* colors = NULL;
- const uint16_t* indices = NULL;
+ const SkPoint* texs = nullptr;
+ const SkColor* colors = nullptr;
+ const uint16_t* indices = nullptr;
int iCount = 0;
if (flags & DRAW_VERTICES_HAS_TEXS) {
texs = (const SkPoint*)reader->skip(vCount * sizeof(SkPoint));
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 2281d16145..28561c7e3f 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -275,7 +275,7 @@ void SkPictureRecord::didConcat(const SkMatrix& matrix) {
void SkPictureRecord::recordConcat(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
// op + matrix
- size_t size = kUInt32Size + matrix.writeToMemory(NULL);
+ size_t size = kUInt32Size + matrix.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(CONCAT, &size);
this->addMatrix(matrix);
this->validate(initialOffset, size);
@@ -284,7 +284,7 @@ void SkPictureRecord::recordConcat(const SkMatrix& matrix) {
void SkPictureRecord::didSetMatrix(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
// op + matrix
- size_t size = kUInt32Size + matrix.writeToMemory(NULL);
+ size_t size = kUInt32Size + matrix.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
this->addMatrix(matrix);
this->validate(initialOffset, size);
@@ -440,7 +440,7 @@ void SkPictureRecord::onClipRegion(const SkRegion& region, SkRegion::Op op) {
size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) {
// op + clip params + region
- size_t size = 2 * kUInt32Size + region.writeToMemory(NULL);
+ size_t size = 2 * kUInt32Size + region.writeToMemory(nullptr);
// recordRestoreOffsetPlaceholder doesn't always write an offset
if (!fRestoreOffsetStack.isEmpty()) {
// + restore offset
@@ -694,7 +694,7 @@ void SkPictureRecord::onDrawTextOnPath(const void* text, size_t byteLength, cons
const SkMatrix* matrix, const SkPaint& paint) {
// op + paint index + length + 'length' worth of data + path index + matrix
const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
- size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(NULL);
+ size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(nullptr);
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
SkASSERT(initialOffset+get_paint_offset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten());
this->addPaint(paint);
@@ -726,12 +726,12 @@ void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma
size_t size = 2 * kUInt32Size;
size_t initialOffset;
- if (NULL == matrix && NULL == paint) {
+ if (nullptr == matrix && nullptr == paint) {
initialOffset = this->addDraw(DRAW_PICTURE, &size);
this->addPicture(picture);
} else {
const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
- size += m.writeToMemory(NULL) + kUInt32Size; // matrix + paint
+ size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint
initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size);
SkASSERT(initialOffset + get_paint_offset(DRAW_PICTURE_MATRIX_PAINT, size)
== fWriter.bytesWritten());
@@ -887,7 +887,7 @@ void SkPictureRecord::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[],
///////////////////////////////////////////////////////////////////////////////
SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) {
- return NULL;
+ return nullptr;
}
// If we already have a stored, can we reuse it instead of also storing b?
@@ -1028,7 +1028,7 @@ void SkPictureRecord::addRect(const SkRect& rect) {
}
void SkPictureRecord::addRectPtr(const SkRect* rect) {
- if (fWriter.writeBool(rect != NULL)) {
+ if (fWriter.writeBool(rect != nullptr)) {
fWriter.writeRect(*rect);
}
}
@@ -1038,7 +1038,7 @@ void SkPictureRecord::addIRect(const SkIRect& rect) {
}
void SkPictureRecord::addIRectPtr(const SkIRect* rect) {
- if (fWriter.writeBool(rect != NULL)) {
+ if (fWriter.writeBool(rect != nullptr)) {
*(SkIRect*)fWriter.reserve(sizeof(SkIRect)) = *rect;
}
}
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 8612aa77d3..6397ca00fa 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -25,7 +25,7 @@ SkPictureRecorder::SkPictureRecorder() {
SkPictureRecorder::~SkPictureRecorder() {}
SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect,
- SkBBHFactory* bbhFactory /* = NULL */,
+ SkBBHFactory* bbhFactory /* = nullptr */,
uint32_t recordFlags /* = 0 */) {
fCullRect = cullRect;
fFlags = recordFlags;
@@ -69,7 +69,7 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
SkDrawableList* drawableList = fRecorder->getDrawableList();
SkBigPicture::SnapshotArray* pictList =
- drawableList ? drawableList->newDrawableSnapshot() : NULL;
+ drawableList ? drawableList->newDrawableSnapshot() : nullptr;
if (fBBH.get()) {
if (saveLayerData) {
@@ -98,18 +98,18 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect) {
void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
- if (NULL == canvas) {
+ if (nullptr == canvas) {
return;
}
int drawableCount = 0;
- SkDrawable* const* drawables = NULL;
+ SkDrawable* const* drawables = nullptr;
SkDrawableList* drawableList = fRecorder->getDrawableList();
if (drawableList) {
drawableCount = drawableList->count();
drawables = drawableList->begin();
}
- SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, NULL/*bbh*/, NULL/*callback*/);
+ SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, nullptr/*bbh*/, nullptr/*callback*/);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -135,17 +135,17 @@ protected:
SkRect onGetBounds() override { return fBounds; }
void onDraw(SkCanvas* canvas) override {
- SkDrawable* const* drawables = NULL;
+ SkDrawable* const* drawables = nullptr;
int drawableCount = 0;
if (fDrawableList) {
drawables = fDrawableList->begin();
drawableCount = fDrawableList->count();
}
- SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, fBBH, NULL/*callback*/);
+ SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, fBBH, nullptr/*callback*/);
}
SkPicture* onNewPictureSnapshot() override {
- SkBigPicture::SnapshotArray* pictList = NULL;
+ SkBigPicture::SnapshotArray* pictList = nullptr;
if (fDrawableList) {
// TODO: should we plumb-down the BBHFactory and recordFlags from our host
// PictureRecorder?
@@ -157,7 +157,7 @@ protected:
if (fBBH && fDoSaveLayerInfo) {
saveLayerData.reset(new SkLayerInfo);
- SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor)
+ SkBBoxHierarchy* bbh = nullptr; // we've already computed fBBH (received in constructor)
// TODO: update saveLayer info computation to reuse the already computed
// bounds in 'fBBH'
SkRecordComputeLayers(fBounds, *fRecord, pictList, bbh, saveLayerData);
@@ -191,8 +191,8 @@ SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag));
// release our refs now, so only the drawable will be the owner.
- fRecord.reset(NULL);
- fBBH.reset(NULL);
+ fRecord.reset(nullptr);
+ fBBH.reset(nullptr);
return drawable;
}
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 569ef3d822..0b3c9e864b 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -85,12 +85,12 @@ struct BitmapShaderRec : public SkResourceCache::Rec {
result->reset(SkRef(rec.fShader.get()));
SkBitmap tile;
- if (rec.fShader.get()->isABitmap(&tile, NULL, NULL)) {
+ if (rec.fShader.get()->isABitmap(&tile, nullptr, nullptr)) {
// FIXME: this doesn't protect the pixels from being discarded as soon as we unlock.
// Should be handled via a pixel ref generator instead
// (https://code.google.com/p/skia/issues/detail?id=3220).
SkAutoLockPixels alp(tile, true);
- return tile.getPixels() != NULL;
+ return tile.getPixels() != nullptr;
}
return false;
}
@@ -99,8 +99,8 @@ struct BitmapShaderRec : public SkResourceCache::Rec {
static bool cache_try_alloc_pixels(SkBitmap* bitmap) {
SkBitmap::Allocator* allocator = SkResourceCache::GetAllocator();
- return NULL != allocator
- ? allocator->allocPixelRef(bitmap, NULL)
+ return nullptr != allocator
+ ? allocator->allocPixelRef(bitmap, nullptr)
: bitmap->tryAllocPixels();
}
@@ -141,7 +141,7 @@ SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Version)) {
// Older code blindly serialized pictures. We don't trust them.
buffer.validate(false);
- return NULL;
+ return nullptr;
}
// Newer code won't serialize pictures in disallow-cross-process-picture mode.
// Assert that they didn't serialize anything except a false here.
@@ -187,7 +187,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
//
// TODO: replace this with decomposeScale() -- but beware LayoutTest rebaselines!
//
- if (!SkDecomposeUpper2x2(m, NULL, &scale, NULL)) {
+ if (!SkDecomposeUpper2x2(m, nullptr, &scale, nullptr)) {
// Decomposition failed, use an approximation.
scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.getSkewX()),
SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.getSkewY()));
@@ -262,8 +262,8 @@ size_t SkPictureShader::contextSize() const {
SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const {
SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec.fLocalMatrix));
- if (NULL == bitmapShader.get()) {
- return NULL;
+ if (nullptr == bitmapShader.get()) {
+ return nullptr;
}
return PictureShaderContext::Create(storage, *this, rec, bitmapShader);
}
@@ -273,9 +273,9 @@ SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage,
const SkPictureShader& shader, const ContextRec& rec, SkShader* bitmapShader) {
PictureShaderContext* ctx = new (storage) PictureShaderContext(shader, rec, bitmapShader);
- if (NULL == ctx->fBitmapShaderContext) {
+ if (nullptr == ctx->fBitmapShaderContext) {
ctx->~PictureShaderContext();
- ctx = NULL;
+ ctx = nullptr;
}
return ctx;
}
@@ -349,7 +349,7 @@ bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai
if (!bitmapShader) {
return false;
}
- return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintColor,
+ return bitmapShader->asFragmentProcessor(context, paint, viewM, nullptr, paintColor,
procDataManager, fp);
}
#else
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 7bcaffe554..d7117617f6 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -95,7 +95,7 @@ static void validate_pixels_ctable(const SkImageInfo& info, const SkColorTable*
if (kIndex_8_SkColorType == info.colorType()) {
SkASSERT(ctable);
} else {
- SkASSERT(NULL == ctable);
+ SkASSERT(nullptr == ctable);
}
}
@@ -198,8 +198,8 @@ bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
}
if (fPreLocked) {
- result->fUnlockProc = NULL;
- result->fUnlockContext = NULL;
+ result->fUnlockProc = nullptr;
+ result->fUnlockContext = nullptr;
result->fCTable = fRec.fColorTable;
result->fPixels = fRec.fPixels;
result->fRowBytes = fRec.fRowBytes;
@@ -241,7 +241,7 @@ uint32_t SkPixelRef::getGenerationID() const {
}
void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (NULL == listener || !this->genIDIsUnique()) {
+ if (nullptr == listener || !this->genIDIsUnique()) {
// No point in tracking this if we're not going to call it.
delete listener;
return;
@@ -320,7 +320,7 @@ bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
void SkPixelRef::onNotifyPixelsChanged() { }
SkData* SkPixelRef::onRefEncodedData() {
- return NULL;
+ return nullptr;
}
bool SkPixelRef::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index 339dea0072..c63bef9c7d 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -12,7 +12,7 @@
#include "SkUtils.h"
void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx) {
- SkASSERT(pm.addr() != NULL);
+ SkASSERT(pm.addr() != nullptr);
this->unlock();
fPixmap = pm;
@@ -24,8 +24,8 @@ void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void*
/////////////////////////////////////////////////////////////////////////////////////////////////
void SkPixmap::reset() {
- fPixels = NULL;
- fCTable = NULL;
+ fPixels = nullptr;
+ fCTable = nullptr;
fRowBytes = 0;
fInfo = SkImageInfo::MakeUnknown();
}
@@ -43,7 +43,7 @@ void SkPixmap::reset(const SkImageInfo& info, const void* addr, size_t rowBytes,
bool SkPixmap::reset(const SkMask& src) {
if (SkMask::kA8_Format == src.fFormat) {
this->reset(SkImageInfo::MakeA8(src.fBounds.width(), src.fBounds.height()),
- src.fImage, src.fRowBytes, NULL);
+ src.fImage, src.fRowBytes, nullptr);
return true;
}
this->reset();
@@ -62,7 +62,7 @@ bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const {
SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width()));
SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height()));
- const void* pixels = NULL;
+ const void* pixels = nullptr;
if (fPixels) {
const size_t bpp = fInfo.bytesPerPixel();
pixels = (const uint8_t*)fPixels + r.fTop * fRowBytes + r.fLeft * bpp;
@@ -76,7 +76,7 @@ bool SkPixmap::readPixels(const SkImageInfo& requestedDstInfo, void* dstPixels,
if (kUnknown_SkColorType == requestedDstInfo.colorType()) {
return false;
}
- if (NULL == dstPixels || dstRB < requestedDstInfo.minRowBytes()) {
+ if (nullptr == dstPixels || dstRB < requestedDstInfo.minRowBytes()) {
return false;
}
if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) {
@@ -116,7 +116,7 @@ static uint16_t pack_8888_to_4444(unsigned a, unsigned r, unsigned g, unsigned b
}
bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const {
- if (NULL == fPixels) {
+ if (nullptr == fPixels) {
return false;
}
SkIRect area;
@@ -207,7 +207,7 @@ bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const {
//////////////////////////////////////////////////////////////////////////////////////////////////
-SkAutoPixmapStorage::SkAutoPixmapStorage() : fStorage(NULL) {}
+SkAutoPixmapStorage::SkAutoPixmapStorage() : fStorage(nullptr) {}
SkAutoPixmapStorage::~SkAutoPixmapStorage() {
this->freeStorage();
@@ -222,7 +222,7 @@ bool SkAutoPixmapStorage::tryAlloc(const SkImageInfo& info) {
return false;
}
void* pixels = sk_malloc_flags(size, 0);
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return false;
}
this->reset(info, pixels, rb);
diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp
index aae28d0e3f..be169d7b0d 100644
--- a/src/core/SkPtrRecorder.cpp
+++ b/src/core/SkPtrRecorder.cpp
@@ -23,7 +23,7 @@ bool SkPtrSet::Less(const Pair& a, const Pair& b) {
}
uint32_t SkPtrSet::find(void* ptr) const {
- if (NULL == ptr) {
+ if (nullptr == ptr) {
return 0;
}
@@ -39,7 +39,7 @@ uint32_t SkPtrSet::find(void* ptr) const {
}
uint32_t SkPtrSet::add(void* ptr) {
- if (NULL == ptr) {
+ if (nullptr == ptr) {
return 0;
}
diff --git a/src/core/SkPtrRecorder.h b/src/core/SkPtrRecorder.h
index 325471ea71..2d755e69e5 100644
--- a/src/core/SkPtrRecorder.h
+++ b/src/core/SkPtrRecorder.h
@@ -26,7 +26,7 @@ public:
/**
* Search for the specified ptr in the set. If it is found, return its
- * 32bit ID [1..N], or if not found, return 0. Always returns 0 for NULL.
+ * 32bit ID [1..N], or if not found, return 0. Always returns 0 for nullptr.
*/
uint32_t find(void*) const;
@@ -34,7 +34,7 @@ public:
* Add the specified ptr to the set, returning a unique 32bit ID for it
* [1...N]. Duplicate ptrs will return the same ID.
*
- * If the ptr is NULL, it is not added, and 0 is returned.
+ * If the ptr is nullptr, it is not added, and 0 is returned.
*/
uint32_t add(void*);
@@ -71,7 +71,7 @@ public:
* Return the next ptr in the set or null if the end was reached.
*/
void* next() {
- return fIndex < fSet.fList.count() ? fSet.fList[fIndex++].fPtr : NULL;
+ return fIndex < fSet.fList.count() ? fSet.fList[fIndex++].fPtr : nullptr;
}
private:
@@ -85,7 +85,7 @@ protected:
private:
struct Pair {
- void* fPtr; // never NULL
+ void* fPtr; // never nullptr
uint32_t fIndex; // 1...N
};
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index 0d1887d792..ef811215f4 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -359,7 +359,7 @@ static bool matrix_only_scale_and_translate(const SkMatrix& matrix) {
}
bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
diff --git a/src/core/SkRWBuffer.cpp b/src/core/SkRWBuffer.cpp
index 7c775135eb..e9147dc684 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -24,7 +24,7 @@ struct SkBufferBlock {
static SkBufferBlock* Alloc(size_t length) {
size_t capacity = LengthToCapacity(length);
SkBufferBlock* block = (SkBufferBlock*)sk_malloc_throw(sizeof(SkBufferBlock) + capacity);
- block->fNext = NULL;
+ block->fNext = nullptr;
block->fUsed = 0;
block->fCapacity = capacity;
return block;
@@ -68,7 +68,7 @@ struct SkBufferHead {
size_t size = sizeof(SkBufferHead) + capacity;
SkBufferHead* head = (SkBufferHead*)sk_malloc_throw(size);
head->fRefCnt = 1;
- head->fBlock.fNext = NULL;
+ head->fBlock.fNext = nullptr;
head->fBlock.fUsed = 0;
head->fBlock.fCapacity = capacity;
return head;
@@ -94,7 +94,7 @@ struct SkBufferHead {
}
}
- void validate(size_t minUsed, SkBufferBlock* tail = NULL) const {
+ void validate(size_t minUsed, SkBufferBlock* tail = nullptr) const {
#ifdef SK_DEBUG
SkASSERT(fRefCnt > 0);
size_t totalUsed = 0;
@@ -140,13 +140,13 @@ void SkROBuffer::Iter::reset(const SkROBuffer* buffer) {
fBlock = &buffer->fHead->fBlock;
fRemaining = buffer->fUsed;
} else {
- fBlock = NULL;
+ fBlock = nullptr;
fRemaining = 0;
}
}
const void* SkROBuffer::Iter::data() const {
- return fRemaining ? fBlock->startData() : NULL;
+ return fRemaining ? fBlock->startData() : nullptr;
}
size_t SkROBuffer::Iter::size() const {
@@ -161,7 +161,7 @@ bool SkROBuffer::Iter::next() {
return fRemaining != 0;
}
-SkRWBuffer::SkRWBuffer(size_t initialCapacity) : fHead(NULL), fTail(NULL), fTotalUsed(0) {}
+SkRWBuffer::SkRWBuffer(size_t initialCapacity) : fHead(nullptr), fTail(nullptr), fTotalUsed(0) {}
SkRWBuffer::~SkRWBuffer() {
this->validate();
@@ -176,7 +176,7 @@ void SkRWBuffer::append(const void* src, size_t length) {
fTotalUsed += length;
- if (NULL == fHead) {
+ if (nullptr == fHead) {
fHead = SkBufferHead::Alloc(length);
fTail = &fHead->fBlock;
}
@@ -199,12 +199,12 @@ void SkRWBuffer::append(const void* src, size_t length) {
void* SkRWBuffer::append(size_t length) {
this->validate();
if (0 == length) {
- return NULL;
+ return nullptr;
}
fTotalUsed += length;
- if (NULL == fHead) {
+ if (nullptr == fHead) {
fHead = SkBufferHead::Alloc(length);
fTail = &fHead->fBlock;
} else if (fTail->avail() < length) {
@@ -223,7 +223,7 @@ void SkRWBuffer::validate() const {
if (fHead) {
fHead->validate(fTotalUsed, fTail);
} else {
- SkASSERT(NULL == fTail);
+ SkASSERT(nullptr == fTail);
SkASSERT(0 == fTotalUsed);
}
}
diff --git a/src/core/SkRWBuffer.h b/src/core/SkRWBuffer.h
index 89cb425a7f..9d88a60203 100644
--- a/src/core/SkRWBuffer.h
+++ b/src/core/SkRWBuffer.h
@@ -34,7 +34,7 @@ public:
void reset(const SkROBuffer*);
/**
- * Return the current continuous block of memory, or NULL if the iterator is exhausted
+ * Return the current continuous block of memory, or nullptr if the iterator is exhausted
*/
const void* data() const;
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index 35197c1ad9..89c22e8601 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -313,7 +313,7 @@ bool SkRasterClip::op(const SkRect& r, const SkISize& size, SkRegion::Op op, boo
}
void SkRasterClip::translate(int dx, int dy, SkRasterClip* dst) const {
- if (NULL == dst) {
+ if (nullptr == dst) {
return;
}
@@ -386,8 +386,8 @@ void SkRasterClip::validate() const {
///////////////////////////////////////////////////////////////////////////////
SkAAClipBlitterWrapper::SkAAClipBlitterWrapper() {
- SkDEBUGCODE(fClipRgn = NULL;)
- SkDEBUGCODE(fBlitter = NULL;)
+ SkDEBUGCODE(fClipRgn = nullptr;)
+ SkDEBUGCODE(fBlitter = nullptr;)
}
SkAAClipBlitterWrapper::SkAAClipBlitterWrapper(const SkRasterClip& clip,
diff --git a/src/core/SkRasterizer.cpp b/src/core/SkRasterizer.cpp
index ab9e011761..87b9caa242 100644
--- a/src/core/SkRasterizer.cpp
+++ b/src/core/SkRasterizer.cpp
@@ -23,7 +23,7 @@ bool SkRasterizer::rasterize(const SkPath& fillPath, const SkMatrix& matrix,
srcM.fFormat = SkMask::kA8_Format;
srcM.fBounds.set(0, 0, 1, 1);
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
if (!filter->filterMask(&dstM, srcM, matrix, &margin)) {
return false;
}
@@ -42,6 +42,6 @@ bool SkRasterizer::onRasterize(const SkPath& fillPath, const SkMatrix& matrix,
SkPath devPath;
fillPath.transform(matrix, &devPath);
- return SkDraw::DrawToMask(devPath, clipBounds, NULL, NULL, mask, mode,
+ return SkDraw::DrawToMask(devPath, clipBounds, nullptr, nullptr, mask, mode,
SkPaint::kFill_Style);
}
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 58a4ac42db..00e3e2c1ce 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -24,16 +24,16 @@ static uint32_t default_flags() {
SkReadBuffer::SkReadBuffer() {
fFlags = default_flags();
fVersion = 0;
- fMemoryPtr = NULL;
+ fMemoryPtr = nullptr;
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -43,16 +43,16 @@ SkReadBuffer::SkReadBuffer(const void* data, size_t size) {
fFlags = default_flags();
fVersion = 0;
fReader.setMemory(data, size);
- fMemoryPtr = NULL;
+ fMemoryPtr = nullptr;
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -66,14 +66,14 @@ SkReadBuffer::SkReadBuffer(SkStream* stream) {
stream->read(fMemoryPtr, length);
fReader.setMemory(fMemoryPtr, length);
- fBitmapStorage = NULL;
- fTFArray = NULL;
+ fBitmapStorage = nullptr;
+ fTFArray = nullptr;
fTFCount = 0;
- fFactoryTDArray = NULL;
- fFactoryArray = NULL;
+ fFactoryTDArray = nullptr;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
- fBitmapDecoder = NULL;
+ fBitmapDecoder = nullptr;
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
fDecodedBitmapIndex = -1;
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
@@ -223,7 +223,7 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
const void* data = this->skip(length);
const int32_t xOffset = this->readInt();
const int32_t yOffset = this->readInt();
- if (fBitmapDecoder != NULL && fBitmapDecoder(data, length, bitmap)) {
+ if (fBitmapDecoder != nullptr && fBitmapDecoder(data, length, bitmap)) {
if (bitmap->width() == width && bitmap->height() == height) {
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
if (0 != xOffset || 0 != yOffset) {
@@ -281,7 +281,7 @@ SkTypeface* SkReadBuffer::readTypeface() {
if (index) {
SkDebugf("====== typeface index %d\n", index);
}
- return NULL;
+ return nullptr;
} else {
SkASSERT(fTFArray);
return fTFArray[index - 1];
@@ -293,12 +293,12 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
// TODO: confirm that ft matches the factory we decide to use
//
- SkFlattenable::Factory factory = NULL;
+ SkFlattenable::Factory factory = nullptr;
if (fFactoryCount > 0) {
int32_t index = fReader.readU32();
if (0 == index) {
- return NULL; // writer failed to give us the flattenable
+ return nullptr; // writer failed to give us the flattenable
}
index -= 1; // we stored the index-base-1
SkASSERT(index < fFactoryCount);
@@ -306,20 +306,20 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
} else if (fFactoryTDArray) {
int32_t index = fReader.readU32();
if (0 == index) {
- return NULL; // writer failed to give us the flattenable
+ return nullptr; // writer failed to give us the flattenable
}
index -= 1; // we stored the index-base-1
factory = (*fFactoryTDArray)[index];
} else {
factory = (SkFlattenable::Factory)readFunctionPtr();
- if (NULL == factory) {
- return NULL; // writer failed to give us the flattenable
+ if (nullptr == factory) {
+ return nullptr; // writer failed to give us the flattenable
}
}
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t sizeRecorded = fReader.readU32();
if (factory) {
size_t offset = fReader.offset();
@@ -351,7 +351,7 @@ void SkReadBuffer::skipFlattenable() {
return;
}
} else {
- if (NULL == this->readFunctionPtr()) {
+ if (nullptr == this->readFunctionPtr()) {
return;
}
}
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index 25640519a3..06b5a77abd 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -185,7 +185,7 @@ public:
* were created/written by the writer. SkPicture uses this.
*/
void setFactoryPlayback(SkFlattenable::Factory array[], int count) {
- fFactoryTDArray = NULL;
+ fFactoryTDArray = nullptr;
fFactoryArray = array;
fFactoryCount = count;
}
@@ -197,7 +197,7 @@ public:
*/
void setFactoryArray(SkTDArray<SkFlattenable::Factory>* array) {
fFactoryTDArray = array;
- fFactoryArray = NULL;
+ fFactoryArray = nullptr;
fFactoryCount = 0;
}
diff --git a/src/core/SkReader32.h b/src/core/SkReader32.h
index 3d874d170a..68dda23c6e 100644
--- a/src/core/SkReader32.h
+++ b/src/core/SkReader32.h
@@ -20,7 +20,7 @@ class SkString;
class SkReader32 : SkNoncopyable {
public:
- SkReader32() : fCurr(NULL), fStop(NULL), fBase(NULL) {}
+ SkReader32() : fCurr(nullptr), fStop(nullptr), fBase(nullptr) {}
SkReader32(const void* data, size_t size) {
this->setMemory(data, size);
}
@@ -94,7 +94,7 @@ public:
}
void read(void* dst, size_t size) {
- SkASSERT(0 == size || dst != NULL);
+ SkASSERT(0 == size || dst != nullptr);
SkASSERT(ptr_align_4(fCurr));
memcpy(dst, fCurr, size);
fCurr += SkAlign4(size);
@@ -124,10 +124,10 @@ public:
/**
* Read the length of a string (written by SkWriter32::writeString) into
- * len (if len is not NULL) and return the null-ternimated address of the
+ * len (if len is not nullptr) and return the null-ternimated address of the
* string within the reader's buffer.
*/
- const char* readString(size_t* len = NULL);
+ const char* readString(size_t* len = nullptr);
/**
* Read the string (written by SkWriter32::writeString) and return it in
@@ -152,7 +152,7 @@ private:
#ifdef SK_DEBUG
static bool ptr_align_4(const void* ptr) {
- return (((const char*)ptr - (const char*)NULL) & 3) == 0;
+ return (((const char*)ptr - (const char*)nullptr) & 3) == 0;
}
#endif
};
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index fe8f5f4933..1a033482e5 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -64,7 +64,7 @@ void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas,
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
stop = SkTMin(stop, record.count());
- SkRecords::Draw draw(canvas, drawablePicts, NULL, drawableCount, &initialCTM);
+ SkRecords::Draw draw(canvas, drawablePicts, nullptr, drawableCount, &initialCTM);
for (int i = start; i < stop; i++) {
record.visit<void>(i, draw);
}
@@ -123,10 +123,10 @@ template <> void Draw::draw(const DrawDrawable& r) {
SkASSERT(r.index >= 0);
SkASSERT(r.index < fDrawableCount);
if (fDrawables) {
- SkASSERT(NULL == fDrawablePicts);
+ SkASSERT(nullptr == fDrawablePicts);
fCanvas->drawDrawable(fDrawables[r.index], r.matrix);
} else {
- fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, NULL);
+ fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr);
}
}
@@ -280,7 +280,7 @@ private:
// The bounds of these ops must be calculated when we hit the Restore
// from the bounds of the ops in the same Save block.
- void trackBounds(const Save&) { this->pushSaveBlock(NULL); }
+ void trackBounds(const Save&) { this->pushSaveBlock(nullptr); }
void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); }
void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(); }
@@ -324,7 +324,7 @@ private:
// https://crbug.com/401593
SkXfermode* xfermode = paint->getXfermode();
SkXfermode::Mode mode;
- // SrcOver is ok, and is also the common case with a NULL xfermode.
+ // SrcOver is ok, and is also the common case with a nullptr xfermode.
// So we should make that the fast path and bypass the mode extraction
// and test.
if (xfermode && xfermode->asMode(&mode)) {
@@ -525,7 +525,7 @@ private:
}
Bounds bounds(const DrawDrawable& op) const {
- return this->adjustAndMap(op.worstCaseBounds, NULL);
+ return this->adjustAndMap(op.worstCaseBounds, nullptr);
}
static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
@@ -644,14 +644,14 @@ private:
template <typename T> void trackSaveLayers(const T& op) {
/* most ops aren't involved in saveLayers */
}
- void trackSaveLayers(const Save& s) { this->pushSaveLayerInfo(false, NULL, NULL); }
+ void trackSaveLayers(const Save& s) { this->pushSaveLayerInfo(false, nullptr, nullptr); }
void trackSaveLayers(const SaveLayer& sl) { this->pushSaveLayerInfo(true, sl.bounds, sl.paint); }
void trackSaveLayers(const Restore& r) { this->popSaveLayerInfo(); }
void trackSaveLayersForPicture(const SkPicture* picture, const SkPaint* paint) {
// For sub-pictures, we wrap their layer information within the parent
// picture's rendering hierarchy
- const SkLayerInfo* childData = NULL;
+ const SkLayerInfo* childData = nullptr;
if (const SkBigPicture* bp = picture->asSkBigPicture()) {
childData = static_cast<const SkLayerInfo*>(bp->accelData());
}
@@ -677,7 +677,7 @@ private:
SkLayerInfo::BlockInfo& dst = fAccelData->addBlock();
- // If src.fPicture is NULL the layer is in dp.picture; otherwise
+ // If src.fPicture is nullptr the layer is in dp.picture; otherwise
// it belongs to a sub-picture.
dst.fPicture = src.fPicture ? src.fPicture : picture;
dst.fPicture->ref();
@@ -710,7 +710,7 @@ private:
void trackSaveLayers(const DrawDrawable& dp) {
SkASSERT(fPictList);
SkASSERT(dp.index >= 0 && dp.index < fPictList->count());
- const SkPaint* paint = NULL; // drawables don't get a side-car paint
+ const SkPaint* paint = nullptr; // drawables don't get a side-car paint
this->trackSaveLayersForPicture(fPictList->begin()[dp.index], paint);
}
@@ -757,7 +757,7 @@ private:
SkLayerInfo::BlockInfo& block = fAccelData->addBlock();
- SkASSERT(NULL == block.fPicture); // This layer is in the top-most picture
+ SkASSERT(nullptr == block.fPicture); // This layer is in the top-most picture
block.fBounds = fFillBounds.getBounds(sli.fStartIndex);
block.fLocalMat = fFillBounds.ctm();
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index 5af74dc7db..c2db37aebd 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -45,7 +45,7 @@ class Draw : SkNoncopyable {
public:
explicit Draw(SkCanvas* canvas, SkPicture const* const drawablePicts[],
SkDrawable* const drawables[], int drawableCount,
- const SkMatrix* initialCTM = NULL)
+ const SkMatrix* initialCTM = nullptr)
: fInitialCTM(initialCTM ? *initialCTM : canvas->getTotalMatrix())
, fCanvas(canvas)
, fDrawablePicts(drawablePicts)
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 07aac3e467..8faa45ce56 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -151,13 +151,13 @@ struct SaveLayerDrawRestoreNooper {
bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
// A SaveLayer's bounds field is just a hint, so we should be free to ignore it.
SkPaint* layerPaint = pattern->first<SaveLayer>()->paint;
- if (NULL == layerPaint) {
+ if (nullptr == layerPaint) {
// There wasn't really any point to this SaveLayer at all.
return KillSaveLayerAndRestore(record, begin);
}
SkPaint* drawPaint = pattern->second<SkPaint>();
- if (drawPaint == NULL) {
+ if (drawPaint == nullptr) {
// We can just give the draw the SaveLayer's paint.
// TODO(mtklein): figure out how to do this clearly
return false;
@@ -197,7 +197,7 @@ struct SvgOpacityAndFilterLayerMergePass {
bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
SkPaint* opacityPaint = pattern->first<SaveLayer>()->paint;
- if (NULL == opacityPaint) {
+ if (nullptr == opacityPaint) {
// There wasn't really any point to this SaveLayer at all.
return KillSaveLayerAndRestore(record, begin);
}
@@ -205,7 +205,7 @@ struct SvgOpacityAndFilterLayerMergePass {
// This layer typically contains a filter, but this should work for layers with for other
// purposes too.
SkPaint* filterLayerPaint = pattern->fourth<SaveLayer>()->paint;
- if (filterLayerPaint == NULL) {
+ if (filterLayerPaint == nullptr) {
// We can just give the inner SaveLayer the paint of the outer SaveLayer.
// TODO(mtklein): figure out how to do this clearly
return false;
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index 174665afc3..ecc61b3aaa 100644
--- a/src/core/SkRecordPattern.h
+++ b/src/core/SkRecordPattern.h
@@ -19,7 +19,7 @@ namespace SkRecords {
template <typename T>
class Is {
public:
- Is() : fPtr(NULL) {}
+ Is() : fPtr(nullptr) {}
typedef T type;
type* get() { return fPtr; }
@@ -31,7 +31,7 @@ public:
template <typename U>
bool operator()(U*) {
- fPtr = NULL;
+ fPtr = nullptr;
return false;
}
@@ -43,7 +43,7 @@ private:
class IsDraw {
SK_CREATE_MEMBER_DETECTOR(paint);
public:
- IsDraw() : fPaint(NULL) {}
+ IsDraw() : fPaint(nullptr) {}
typedef SkPaint type;
type* get() { return fPaint; }
@@ -56,13 +56,13 @@ public:
template <typename T>
SK_WHEN(!HasMember_paint<T>, bool) operator()(T*) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
// SaveLayer has an SkPaint named paint, but it's not a draw.
bool operator()(SaveLayer*) {
- fPaint = NULL;
+ fPaint = nullptr;
return false;
}
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 0fe9e28848..9eccca164f 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -21,7 +21,7 @@ SkDrawableList::~SkDrawableList() {
SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
const int count = fArray.count();
if (0 == count) {
- return NULL;
+ return nullptr;
}
SkAutoTMalloc<const SkPicture*> pics(count);
for (int i = 0; i < count; ++i) {
@@ -60,9 +60,9 @@ void SkRecorder::reset(SkRecord* record, const SkRect& bounds,
}
void SkRecorder::forgetRecord() {
- fDrawableList.reset(NULL);
+ fDrawableList.reset(nullptr);
fApproxBytesUsedBySubPictures = 0;
- fRecord = NULL;
+ fRecord = nullptr;
}
// To make appending to fRecord a little less verbose.
@@ -82,8 +82,8 @@ void SkRecorder::forgetRecord() {
// (For most types we just pass by value and let copy constructors do their thing.)
template <typename T>
T* SkRecorder::copy(const T* src) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
return new (fRecord->alloc<T>()) T(*src);
}
@@ -92,8 +92,8 @@ T* SkRecorder::copy(const T* src) {
// It will work with POD or non-POD, though currently we only use it for POD.
template <typename T>
T* SkRecorder::copy(const T src[], size_t count) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
T* dst = fRecord->alloc<T>(count);
for (size_t i = 0; i < count; i++) {
@@ -107,8 +107,8 @@ T* SkRecorder::copy(const T src[], size_t count) {
// but I found no corresponding speedup for other arrays.
template <>
char* SkRecorder::copy(const char src[], size_t count) {
- if (NULL == src) {
- return NULL;
+ if (nullptr == src) {
+ return nullptr;
}
char* dst = fRecord->alloc<char>(count);
memcpy(dst, src, count);
@@ -302,8 +302,8 @@ void SkRecorder::onDrawVertices(VertexMode vmode,
vmode,
vertexCount,
this->copy(vertices, vertexCount),
- texs ? this->copy(texs, vertexCount) : NULL,
- colors ? this->copy(colors, vertexCount) : NULL,
+ texs ? this->copy(texs, vertexCount) : nullptr,
+ colors ? this->copy(colors, vertexCount) : nullptr,
xmode,
this->copy(indices, indexCount),
indexCount);
@@ -312,9 +312,9 @@ void SkRecorder::onDrawVertices(VertexMode vmode,
void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
APPEND(DrawPatch, paint,
- cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
- colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
- texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
+ cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : nullptr,
+ colors ? this->copy(colors, SkPatchUtils::kNumCorners) : nullptr,
+ texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : nullptr,
xmode);
}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 57b4568011..92197a0a3c 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -122,7 +122,7 @@ public:
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
- SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return NULL; }
+ SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return nullptr; }
void flushMiniRecorder();
diff --git a/src/core/SkRefDict.cpp b/src/core/SkRefDict.cpp
index 44eddf01a9..9364a39cc0 100644
--- a/src/core/SkRefDict.cpp
+++ b/src/core/SkRefDict.cpp
@@ -16,15 +16,15 @@ struct SkRefDict::Impl {
SkRefCnt* fData;
};
-SkRefDict::SkRefDict() : fImpl(NULL) {}
+SkRefDict::SkRefDict() : fImpl(nullptr) {}
SkRefDict::~SkRefDict() {
this->removeAll();
}
SkRefCnt* SkRefDict::find(const char name[]) const {
- if (NULL == name) {
- return NULL;
+ if (nullptr == name) {
+ return nullptr;
}
Impl* rec = fImpl;
@@ -34,16 +34,16 @@ SkRefCnt* SkRefDict::find(const char name[]) const {
}
rec = rec->fNext;
}
- return NULL;
+ return nullptr;
}
void SkRefDict::set(const char name[], SkRefCnt* data) {
- if (NULL == name) {
+ if (nullptr == name) {
return;
}
Impl* rec = fImpl;
- Impl* prev = NULL;
+ Impl* prev = nullptr;
while (rec) {
if (rec->fName.equals(name)) {
if (data) {
@@ -85,5 +85,5 @@ void SkRefDict::removeAll() {
delete rec;
rec = next;
}
- fImpl = NULL;
+ fImpl = nullptr;
}
diff --git a/src/core/SkRefDict.h b/src/core/SkRefDict.h
index 55b9bfe0cf..9583df1f12 100644
--- a/src/core/SkRefDict.h
+++ b/src/core/SkRefDict.h
@@ -22,15 +22,15 @@ public:
~SkRefDict();
/**
- * Return the data associated with name[], or NULL if no matching entry
+ * Return the data associated with name[], or nullptr if no matching entry
* is found. The reference-count of the entry is not affected.
*/
SkRefCnt* find(const char name[]) const;
/**
- * If data is NULL, remove (if present) the entry matching name and call
+ * If data is nullptr, remove (if present) the entry matching name and call
* prev_data->unref() on the data for the matching entry.
- * If data is not-NULL, replace the existing entry matching name and
+ * If data is not-nullptr, replace the existing entry matching name and
* call (prev_data->unref()), or add a new one. In either case,
* data->ref() is called.
*/
@@ -39,7 +39,7 @@ public:
/**
* Remove the matching entry (if found) and unref its data.
*/
- void remove(const char name[]) { this->set(name, NULL); }
+ void remove(const char name[]) { this->set(name, nullptr); }
/**
* Remove all entries, and unref() their associated data.
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index b87fbc87b8..3a542c6169 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -194,8 +194,8 @@ char* SkRegion::toString() {
// 4 ints, up to 10 digits each plus sign, 3 commas, '(', ')', SkRegion() and '\0'
const int max = (count*((11*4)+5))+11+1;
char* result = (char*)sk_malloc_throw(max);
- if (result == NULL) {
- return NULL;
+ if (result == nullptr) {
+ return nullptr;
}
count = sprintf(result, "SkRegion(");
iter.reset(*this);
@@ -408,7 +408,7 @@ bool SkRegion::contains(const SkRegion& rgn) const {
* A contains B is equivalent to
* B - A == 0
*/
- return !Oper(rgn, *this, kDifference_Op, NULL);
+ return !Oper(rgn, *this, kDifference_Op, nullptr);
}
const SkRegion::RunType* SkRegion::getRuns(RunType tmpStorage[],
@@ -498,7 +498,7 @@ bool SkRegion::intersects(const SkRegion& rgn) const {
}
// both of us are complex
- return Oper(*this, rgn, kIntersect_Op, NULL);
+ return Oper(*this, rgn, kIntersect_Op, nullptr);
}
///////////////////////////////////////////////////////////////////////////////
@@ -533,7 +533,7 @@ bool SkRegion::operator==(const SkRegion& b) const {
void SkRegion::translate(int dx, int dy, SkRegion* dst) const {
SkDEBUGCODE(this->validate();)
- if (NULL == dst) {
+ if (nullptr == dst) {
return;
}
if (this->isEmpty()) {
@@ -1074,7 +1074,7 @@ bool SkRegion::Oper(const SkRegion& rgnaOrig, const SkRegion& rgnbOrig, Op op,
// sk_memset32((uint32_t*)array.get(), 0x7FFFFFFF, dstCount);
#endif
- int count = operate(a_runs, b_runs, array.get(), op, NULL == result);
+ int count = operate(a_runs, b_runs, array.get(), op, nullptr == result);
SkASSERT(count <= dstCount);
if (result) {
@@ -1095,7 +1095,7 @@ bool SkRegion::op(const SkRegion& rgna, const SkRegion& rgnb, Op op) {
#include "SkBuffer.h"
size_t SkRegion::writeToMemory(void* storage) const {
- if (NULL == storage) {
+ if (nullptr == storage) {
size_t size = sizeof(int32_t); // -1 (empty), 0 (rect), runCount
if (!this->isEmpty()) {
size += sizeof(fBounds);
@@ -1295,7 +1295,7 @@ void SkRegion::Iterator::reset(const SkRegion& rgn) {
fDone = false;
if (rgn.isRect()) {
fRect = rgn.fBounds;
- fRuns = NULL;
+ fRuns = nullptr;
} else {
fRuns = rgn.fRunHead->readonly_runs();
fRect.set(fRuns[3], fRuns[0], fRuns[4], fRuns[1]);
@@ -1310,7 +1310,7 @@ void SkRegion::Iterator::next() {
return;
}
- if (fRuns == NULL) { // rect case
+ if (fRuns == nullptr) { // rect case
fDone = true;
return;
}
@@ -1402,7 +1402,7 @@ SkRegion::Spanerator::Spanerator(const SkRegion& rgn, int y, int left,
}
fLeft = left;
fRight = right;
- fRuns = NULL; // means we're a rect, not a rgn
+ fRuns = nullptr; // means we're a rect, not a rgn
fDone = false;
} else {
const SkRegion::RunType* runs = rgn.fRunHead->findScanline(y);
@@ -1433,7 +1433,7 @@ bool SkRegion::Spanerator::next(int* left, int* right) {
return false;
}
- if (fRuns == NULL) { // we're a rect
+ if (fRuns == nullptr) { // we're a rect
fDone = true; // ok, now we're done
if (left) {
*left = fLeft;
diff --git a/src/core/SkRegionPriv.h b/src/core/SkRegionPriv.h
index 9ddefc06cc..160c55d555 100644
--- a/src/core/SkRegionPriv.h
+++ b/src/core/SkRegionPriv.h
@@ -142,7 +142,7 @@ public:
/**
* Return the scanline that contains the Y value. This requires that the Y
* value is already known to be contained within the bounds of the region,
- * and so this routine never returns NULL.
+ * and so this routine never returns nullptr.
*
* It returns the beginning of the scanline, starting with its Bottom value.
*/
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index b07d679aa1..9289641c69 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -32,7 +32,7 @@ public:
bool init(int maxHeight, int maxTransitions, bool pathIsInverse);
void done() {
- if (fCurrScanline != NULL) {
+ if (fCurrScanline != nullptr) {
fCurrScanline->fXCount = (SkRegion::RunType)((int)(fCurrXPtr - fCurrScanline->firstX()));
if (!this->collapsWithPrev()) { // flush the last line
fCurrScanline = fCurrScanline->nextScanline();
@@ -94,7 +94,7 @@ private:
int fStorageCount;
bool collapsWithPrev() {
- if (fPrevScanline != NULL &&
+ if (fPrevScanline != nullptr &&
fPrevScanline->fLastY + 1 == fCurrScanline->fLastY &&
fPrevScanline->fXCount == fCurrScanline->fXCount &&
sk_memeq32(fPrevScanline->firstX(), fCurrScanline->firstX(), fCurrScanline->fXCount))
@@ -108,7 +108,7 @@ private:
};
SkRgnBuilder::SkRgnBuilder()
- : fStorage(NULL) {
+ : fStorage(nullptr) {
}
SkRgnBuilder::~SkRgnBuilder() {
@@ -147,17 +147,17 @@ bool SkRgnBuilder::init(int maxHeight, int maxTransitions, bool pathIsInverse) {
}
fStorage = (SkRegion::RunType*)sk_malloc_flags(sk_64_asS32(size), 0);
- if (NULL == fStorage) {
+ if (nullptr == fStorage) {
return false;
}
- fCurrScanline = NULL; // signal empty collection
- fPrevScanline = NULL; // signal first scanline
+ fCurrScanline = nullptr; // signal empty collection
+ fPrevScanline = nullptr; // signal first scanline
return true;
}
void SkRgnBuilder::blitH(int x, int y, int width) {
- if (fCurrScanline == NULL) { // first time
+ if (fCurrScanline == nullptr) { // first time
fTop = (SkRegion::RunType)(y);
fCurrScanline = (Scanline*)fStorage;
fCurrScanline->fLastY = (SkRegion::RunType)(y);
@@ -197,7 +197,7 @@ void SkRgnBuilder::blitH(int x, int y, int width) {
}
int SkRgnBuilder::computeRunCount() const {
- if (fCurrScanline == NULL) {
+ if (fCurrScanline == nullptr) {
return 0;
}
@@ -208,7 +208,7 @@ int SkRgnBuilder::computeRunCount() const {
}
void SkRgnBuilder::copyToRect(SkIRect* r) const {
- SkASSERT(fCurrScanline != NULL);
+ SkASSERT(fCurrScanline != nullptr);
// A rect's scanline is [bottom intervals left right sentinel] == 5
SkASSERT((const SkRegion::RunType*)fCurrScanline - fStorage == 5);
@@ -219,7 +219,7 @@ void SkRgnBuilder::copyToRect(SkIRect* r) const {
}
void SkRgnBuilder::copyToRgn(SkRegion::RunType runs[]) const {
- SkASSERT(fCurrScanline != NULL);
+ SkASSERT(fCurrScanline != nullptr);
SkASSERT((const SkRegion::RunType*)fCurrScanline - fStorage > 4);
const Scanline* line = (const Scanline*)fStorage;
@@ -397,7 +397,7 @@ struct Edge {
fY0 = (SkRegion::RunType)(y0);
fY1 = (SkRegion::RunType)(y1);
fFlags = 0;
- SkDEBUGCODE(fNext = NULL;)
+ SkDEBUGCODE(fNext = nullptr;)
}
int top() const {
@@ -423,7 +423,7 @@ static void find_link(Edge* base, Edge* stop) {
for (;;) {
e += 1;
if ((e->fFlags & Edge::kY1Link) == 0 && y0 == e->fY1) {
- SkASSERT(NULL == e->fNext);
+ SkASSERT(nullptr == e->fNext);
e->fNext = base;
e->fFlags = SkToU8(e->fFlags | Edge::kY1Link);
break;
@@ -436,7 +436,7 @@ static void find_link(Edge* base, Edge* stop) {
for (;;) {
e += 1;
if ((e->fFlags & Edge::kY0Link) == 0 && y1 == e->fY0) {
- SkASSERT(NULL == base->fNext);
+ SkASSERT(nullptr == base->fNext);
base->fNext = e;
e->fFlags = SkToU8(e->fFlags | Edge::kY0Link);
break;
@@ -484,7 +484,7 @@ struct EdgeLT {
};
bool SkRegion::getBoundaryPath(SkPath* path) const {
- // path could safely be NULL if we're empty, but the caller shouldn't
+ // path could safely be nullptr if we're empty, but the caller shouldn't
// *know* that
SkASSERT(path);
@@ -522,7 +522,7 @@ bool SkRegion::getBoundaryPath(SkPath* path) const {
#ifdef SK_DEBUG
for (e = start; e != stop; e++) {
- SkASSERT(e->fNext != NULL);
+ SkASSERT(e->fNext != nullptr);
SkASSERT(e->fFlags == Edge::kCompleteLink);
}
#endif
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 911a09071e..4d2453c71e 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -59,17 +59,17 @@ class SkResourceCache::Hash :
///////////////////////////////////////////////////////////////////////////////
void SkResourceCache::init() {
- fHead = NULL;
- fTail = NULL;
+ fHead = nullptr;
+ fTail = nullptr;
fHash = new Hash;
fTotalBytesUsed = 0;
fCount = 0;
fSingleAllocationByteLimit = 0;
- fAllocator = NULL;
+ fAllocator = nullptr;
// One of these should be explicit set by the caller after we return.
fTotalByteLimit = 0;
- fDiscardableFactory = NULL;
+ fDiscardableFactory = nullptr;
}
#include "SkDiscardableMemory.h"
@@ -116,20 +116,20 @@ bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
}
// A previous call to onUnlock may have deleted our DM, so check for that
- if (NULL == fDM) {
+ if (nullptr == fDM) {
return false;
}
if (!fDM->lock()) {
// since it failed, we delete it now, to free-up the resource
delete fDM;
- fDM = NULL;
+ fDM = nullptr;
return false;
}
SUCCESS:
rec->fPixels = fDM->data();
- rec->fColorTable = NULL;
+ rec->fColorTable = nullptr;
rec->fRowBytes = fRB;
return true;
}
@@ -164,7 +164,7 @@ bool SkResourceCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap, SkColo
}
SkDiscardableMemory* dm = fFactory(size);
- if (NULL == dm) {
+ if (nullptr == dm) {
return false;
}
@@ -371,7 +371,7 @@ SkCachedData* SkResourceCache::newCachedData(size_t bytes) {
if (fDiscardableFactory) {
SkDiscardableMemory* dm = fDiscardableFactory(bytes);
- return dm ? new SkCachedData(bytes, dm) : NULL;
+ return dm ? new SkCachedData(bytes, dm) : nullptr;
} else {
return new SkCachedData(sk_malloc_throw(bytes), bytes);
}
@@ -396,7 +396,7 @@ void SkResourceCache::detach(Rec* rec) {
next->fPrev = prev;
}
- rec->fNext = rec->fPrev = NULL;
+ rec->fNext = rec->fPrev = nullptr;
}
void SkResourceCache::moveToHead(Rec* rec) {
@@ -421,7 +421,7 @@ void SkResourceCache::moveToHead(Rec* rec) {
void SkResourceCache::addToHead(Rec* rec) {
this->validate();
- rec->fPrev = NULL;
+ rec->fPrev = nullptr;
rec->fNext = fHead;
if (fHead) {
fHead->fPrev = rec;
@@ -440,22 +440,22 @@ void SkResourceCache::addToHead(Rec* rec) {
#ifdef SK_DEBUG
void SkResourceCache::validate() const {
- if (NULL == fHead) {
- SkASSERT(NULL == fTail);
+ if (nullptr == fHead) {
+ SkASSERT(nullptr == fTail);
SkASSERT(0 == fTotalBytesUsed);
return;
}
if (fHead == fTail) {
- SkASSERT(NULL == fHead->fPrev);
- SkASSERT(NULL == fHead->fNext);
+ SkASSERT(nullptr == fHead->fPrev);
+ SkASSERT(nullptr == fHead->fNext);
SkASSERT(fHead->bytesUsed() == fTotalBytesUsed);
return;
}
- SkASSERT(NULL == fHead->fPrev);
+ SkASSERT(nullptr == fHead->fPrev);
SkASSERT(fHead->fNext);
- SkASSERT(NULL == fTail->fNext);
+ SkASSERT(nullptr == fTail->fNext);
SkASSERT(fTail->fPrev);
size_t used = 0;
@@ -506,7 +506,7 @@ size_t SkResourceCache::getEffectiveSingleAllocationByteLimit() const {
// if we're not discardable (i.e. we are fixed-budget) then cap the single-limit
// to our budget.
- if (NULL == fDiscardableFactory) {
+ if (nullptr == fDiscardableFactory) {
if (0 == limit) {
limit = fTotalByteLimit;
} else {
@@ -527,7 +527,7 @@ void SkResourceCache::checkMessages() {
///////////////////////////////////////////////////////////////////////////////
SK_DECLARE_STATIC_MUTEX(gMutex);
-static SkResourceCache* gResourceCache = NULL;
+static SkResourceCache* gResourceCache = nullptr;
static void cleanup_gResourceCache() {
// We'll clean this up in our own tests, but disable for clients.
// Chrome seems to have funky multi-process things going on in unit tests that
@@ -542,7 +542,7 @@ static void cleanup_gResourceCache() {
static SkResourceCache* get_cache() {
// gMutex is always held when this is called, so we don't need to be fancy in here.
gMutex.assertHeld();
- if (NULL == gResourceCache) {
+ if (nullptr == gResourceCache) {
#ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE
gResourceCache = new SkResourceCache(SkDiscardableMemory::Create);
#else
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 7267c6739b..813e2ee185 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -79,7 +79,7 @@ public:
// for memory usage diagnostics
virtual const char* getCategory() const = 0;
- virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
+ virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return nullptr; }
// for SkTDynamicHash::Traits
static uint32_t Hash(const Key& key) { return key.hash(); }
@@ -115,7 +115,7 @@ public:
/**
* Returns a locked/pinned SkDiscardableMemory instance for the specified
- * number of bytes, or NULL on failure.
+ * number of bytes, or nullptr on failure.
*/
typedef SkDiscardableMemory* (*DiscardableFactory)(size_t bytes);
@@ -153,13 +153,13 @@ public:
static void TestDumpMemoryStatistics();
/**
- * Returns the DiscardableFactory used by the global cache, or NULL.
+ * Returns the DiscardableFactory used by the global cache, or nullptr.
*/
static DiscardableFactory GetDiscardableFactory();
/**
* Use this allocator for bitmaps, so they can use ashmem when available.
- * Returns NULL if the ResourceCache has not been initialized with a DiscardableFactory.
+ * Returns nullptr if the ResourceCache has not been initialized with a DiscardableFactory.
*/
static SkBitmap::Allocator* GetAllocator();
@@ -250,7 +250,7 @@ private:
Hash* fHash;
DiscardableFactory fDiscardableFactory;
- // the allocator is NULL or one that matches discardables
+ // the allocator is nullptr or one that matches discardables
SkBitmap::Allocator* fAllocator;
size_t fTotalBytesUsed;
diff --git a/src/core/SkScalar.cpp b/src/core/SkScalar.cpp
index e8f6e93348..7cb0a8b148 100644
--- a/src/core/SkScalar.cpp
+++ b/src/core/SkScalar.cpp
@@ -13,8 +13,8 @@
SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[],
const SkScalar values[], int length) {
SkASSERT(length > 0);
- SkASSERT(keys != NULL);
- SkASSERT(values != NULL);
+ SkASSERT(keys != nullptr);
+ SkASSERT(values != nullptr);
#ifdef SK_DEBUG
for (int i = 1; i < length; i++)
SkASSERT(keys[i] >= keys[i-1]);
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 5f0f653ec6..70a9c30e3a 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -63,7 +63,7 @@ void SkGlyph::zeroMetrics() {
static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag,
SkFlattenable::Type ft) {
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t len;
const void* data = desc->findEntry(tag, &len);
@@ -76,7 +76,7 @@ static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag,
}
SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
- : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, NULL)))
+ : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr)))
, fTypeface(SkRef(typeface))
, fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_SkDescriptorTag,
@@ -86,7 +86,7 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
, fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_SkDescriptorTag,
SkFlattenable::kSkRasterizer_Type)))
// Initialize based on our settings. Subclasses can also force this.
- , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != NULL || fRasterizer != NULL)
+ , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || fRasterizer != nullptr)
, fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMaskPreBlend(fRec))
, fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec)
@@ -103,8 +103,8 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc)
rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill,
rec->fMaskFormat, rec->fStrokeJoin);
SkDebugf(" pathEffect %x maskFilter %x\n",
- desc->findEntry(kPathEffect_SkDescriptorTag, NULL),
- desc->findEntry(kMaskFilter_SkDescriptorTag, NULL));
+ desc->findEntry(kPathEffect_SkDescriptorTag, nullptr),
+ desc->findEntry(kMaskFilter_SkDescriptorTag, nullptr));
#endif
}
@@ -154,7 +154,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
if (fRasterizer) {
SkMask mask;
- if (fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL,
+ if (fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr,
fMaskFilter, &mask,
SkMask::kJustComputeBounds_CreateMode)) {
glyph->fLeft = mask.fBounds.fLeft;
@@ -206,12 +206,12 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
glyph->toMask(&src);
fRec.getMatrixFrom2x2(&matrix);
- src.fImage = NULL; // only want the bounds from the filter
- if (fMaskFilter->filterMask(&dst, src, matrix, NULL)) {
+ src.fImage = nullptr; // only want the bounds from the filter
+ if (fMaskFilter->filterMask(&dst, src, matrix, nullptr)) {
if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) {
goto SK_ERROR;
}
- SkASSERT(dst.fImage == NULL);
+ SkASSERT(dst.fImage == nullptr);
glyph->fLeft = dst.fBounds.fLeft;
glyph->fTop = dst.fBounds.fTop;
glyph->fWidth = SkToU16(dst.fBounds.width());
@@ -485,7 +485,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
// need the original bounds, sans our maskfilter
SkMaskFilter* mf = fMaskFilter;
- fMaskFilter = NULL; // temp disable
+ fMaskFilter = nullptr; // temp disable
this->getMetrics(&tmpGlyph);
fMaskFilter = mf; // restore
@@ -514,7 +514,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
mask.fFormat = SkMask::kA8_Format;
sk_bzero(glyph->fImage, mask.computeImageSize());
- if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL,
+ if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr,
fMaskFilter, &mask,
SkMask::kJustRenderImage_CreateMode)) {
return;
@@ -553,7 +553,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
fRec.getMatrixFrom2x2(&matrix);
- if (fMaskFilter->filterMask(&dstM, srcM, matrix, NULL)) {
+ if (fMaskFilter->filterMask(&dstM, srcM, matrix, nullptr)) {
int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width());
int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height());
int dstRB = origGlyph.rowBytes();
@@ -585,7 +585,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) {
}
void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) {
- this->internalGetPath(glyph, NULL, path, NULL);
+ this->internalGetPath(glyph, nullptr, path, nullptr);
}
void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) {
@@ -611,7 +611,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
}
}
- if (fRec.fFrameWidth > 0 || fPathEffect != NULL) {
+ if (fRec.fFrameWidth > 0 || fPathEffect != nullptr) {
// need the path in user-space, with only the point-size applied
// so that our stroking and effects will operate the same way they
// would if the user had extracted the path themself, and then
@@ -641,7 +641,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
if (fPathEffect) {
SkPath effectPath;
- if (fPathEffect->filterPath(&effectPath, localPath, &rec, NULL)) {
+ if (fPathEffect->filterPath(&effectPath, localPath, &rec, nullptr)) {
localPath.swap(effectPath);
}
}
@@ -668,7 +668,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
fillToDevMatrix->reset();
}
if (devPath) {
- if (fillPath == NULL) {
+ if (fillPath == nullptr) {
devPath->swap(path);
} else {
*devPath = path;
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 6addf736fc..302698ee4e 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -113,7 +113,7 @@ struct SkScalerContextRec {
* The 'total' matrix is also (optionally) available. This is useful in cases where the
* underlying library will not be used, often when working directly with font data.
*
- * The parameters 'scale' and 'remaining' are required, the other pointers may be NULL.
+ * The parameters 'scale' and 'remaining' are required, the other pointers may be nullptr.
*
* @param preMatrixScale the kind of scale to extract from the total matrix.
* @param scale the scale extracted from the total matrix (both values positive).
@@ -124,9 +124,9 @@ struct SkScalerContextRec {
*/
void computeMatrices(PreMatrixScale preMatrixScale,
SkVector* scale, SkMatrix* remaining,
- SkMatrix* remainingWithoutRotation = NULL,
- SkMatrix* remainingRotation = NULL,
- SkMatrix* total = NULL);
+ SkMatrix* remainingWithoutRotation = nullptr,
+ SkMatrix* remainingRotation = nullptr,
+ SkMatrix* total = nullptr);
inline SkPaint::Hinting getHinting() const;
inline void setHinting(SkPaint::Hinting);
@@ -319,7 +319,7 @@ private:
SkPath* devPath, SkMatrix* fillToDevMatrix);
// returns the right context from our link-list for this char. If no match
- // is found it returns NULL. If a match is found then the glyphID param is
+ // is found it returns nullptr. If a match is found then the glyphID param is
// set to the glyphID that maps to the provided char.
SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID);
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 3f95a6866c..6ea6b8b07e 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -686,7 +686,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
SkScanClipper clipper(blitter, clipRgn, ir);
const SkIRect* clipRect = clipper.getClipRect();
- if (clipper.getBlitter() == NULL) { // clipped out
+ if (clipper.getBlitter() == nullptr) { // clipped out
if (isInverse) {
blitter->blitRegion(*clipRgn);
}
@@ -700,7 +700,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
sk_blit_above(blitter, ir, *clipRgn);
}
- SkIRect superRect, *superClipRect = NULL;
+ SkIRect superRect, *superClipRect = nullptr;
if (clipRect) {
superRect.set( clipRect->fLeft << SHIFT, clipRect->fTop << SHIFT,
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 2bcb4c64c1..beddf63202 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -17,13 +17,13 @@
/* Our attempt to compute the worst case "bounds" for the horizontal and
vertical cases has some numerical bug in it, and we sometimes undervalue
our extends. The bug is that when this happens, we will set the clip to
- NULL (for speed), and thus draw outside of the clip by a pixel, which might
+ nullptr (for speed), and thus draw outside of the clip by a pixel, which might
only look bad, but it might also access memory outside of the valid range
allcoated for the device bitmap.
This define enables our fix to outset our "bounds" by 1, thus avoiding the
chance of the bug, but at the cost of sometimes taking the rectblitter
- case (i.e. not setting the clip to NULL) when we might not actually need
+ case (i.e. not setting the clip to nullptr) when we might not actually need
to. If we can improve/fix the actual calculations, then we can remove this
step.
*/
@@ -88,7 +88,7 @@ static void call_hline_blitter(SkBlitter* blitter, int x, int y, int count,
class SkAntiHairBlitter {
public:
- SkAntiHairBlitter() : fBlitter(NULL) {}
+ SkAntiHairBlitter() : fBlitter(nullptr) {}
virtual ~SkAntiHairBlitter() {}
SkBlitter* getBlitter() const { return fBlitter; }
@@ -340,7 +340,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
Horish_SkAntiHairBlitter horish_blitter;
VLine_SkAntiHairBlitter vline_blitter;
Vertish_SkAntiHairBlitter vertish_blitter;
- SkAntiHairBlitter* hairBlitter = NULL;
+ SkAntiHairBlitter* hairBlitter = nullptr;
if (SkAbs32(x1 - x0) > SkAbs32(y1 - y0)) { // mostly horizontal
if (x0 > x1) { // we want to go left-to-right
@@ -412,7 +412,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
return;
}
if (clip->fTop <= top && clip->fBottom >= bottom) {
- clip = NULL;
+ clip = nullptr;
}
}
} else { // mostly vertical
@@ -488,7 +488,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
return;
}
if (clip->fLeft <= left && clip->fRight >= right) {
- clip = NULL;
+ clip = nullptr;
}
}
}
@@ -526,7 +526,7 @@ void SkScan::AntiHairLineRgn(const SkPoint array[], int arrayCount, const SkRegi
return;
}
- SkASSERT(clip == NULL || !clip->getBounds().isEmpty());
+ SkASSERT(clip == nullptr || !clip->getBounds().isEmpty());
#ifdef TEST_GAMMA
build_gamma_table();
@@ -595,7 +595,7 @@ void SkScan::AntiHairLineRgn(const SkPoint array[], int arrayCount, const SkRegi
}
// fall through to no-clip case
}
- do_anti_hairline(x0, y0, x1, y1, NULL, blitter);
+ do_anti_hairline(x0, y0, x1, y1, nullptr, blitter);
}
}
@@ -699,7 +699,7 @@ static void antifillrect(const SkXRect& xr, SkBlitter* blitter) {
void SkScan::AntiFillXRect(const SkXRect& xr, const SkRegion* clip,
SkBlitter* blitter) {
- if (NULL == clip) {
+ if (nullptr == clip) {
antifillrect(xr, blitter);
} else {
SkIRect outerBounds;
@@ -745,7 +745,7 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip,
XRect_roundOut(xr, &outerBounds);
if (clip.quickContains(outerBounds)) {
- AntiFillXRect(xr, NULL, blitter);
+ AntiFillXRect(xr, nullptr, blitter);
} else {
SkAAClipBlitterWrapper wrapper(clip, blitter);
blitter = wrapper.getBlitter();
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index eeac5cdc2f..7a6e3ba187 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -355,7 +355,7 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
}
SkAAClipBlitterWrapper wrap;
- const SkRegion* clip = NULL;
+ const SkRegion* clip = nullptr;
{
const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1);
@@ -462,7 +462,7 @@ void SkScan::HairLine(const SkPoint pts[], int count, const SkRasterClip& clip,
if (clip.isBW()) {
HairLineRgn(pts, count, &clip.bwRgn(), blitter);
} else {
- const SkRegion* clipRgn = NULL;
+ const SkRegion* clipRgn = nullptr;
SkRect r;
r.set(pts, count);
@@ -483,7 +483,7 @@ void SkScan::AntiHairLine(const SkPoint pts[], int count, const SkRasterClip& cl
if (clip.isBW()) {
AntiHairLineRgn(pts, count, &clip.bwRgn(), blitter);
} else {
- const SkRegion* clipRgn = NULL;
+ const SkRegion* clipRgn = nullptr;
SkRect r;
r.set(pts, count);
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index b7db3b410d..fc79fc8537 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -346,7 +346,7 @@ public:
}
const SkPixmap* justAnOpaqueColor(uint32_t* value) override {
SkDEBUGFAIL("justAnOpaqueColor unexpected");
- return NULL;
+ return nullptr;
}
private:
@@ -437,14 +437,14 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
// this returns the first and last edge after they're sorted into a dlink list
SkEdge* edge = sort_edges(list, count, &last);
- headEdge.fPrev = NULL;
+ headEdge.fPrev = nullptr;
headEdge.fNext = edge;
headEdge.fFirstY = kEDGE_HEAD_Y;
headEdge.fX = SK_MinS32;
edge->fPrev = &headEdge;
tailEdge.fPrev = last;
- tailEdge.fNext = NULL;
+ tailEdge.fNext = nullptr;
tailEdge.fFirstY = kEDGE_TAIL_Y;
last->fNext = &tailEdge;
@@ -460,7 +460,7 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
}
InverseBlitter ib;
- PrePostProc proc = NULL;
+ PrePostProc proc = nullptr;
if (path.isInverseFillType()) {
ib.setBlitter(blitter, clipRgn.getBounds(), shiftEdgesUp);
@@ -468,9 +468,9 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
proc = PrePostInverseBlitterProc;
}
- if (path.isConvex() && (NULL == proc)) {
+ if (path.isConvex() && (nullptr == proc)) {
SkASSERT(count >= 2); // convex walker does not handle missing right edges
- walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, NULL);
+ walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, nullptr);
} else {
int rightEdge;
if (clipRect) {
@@ -518,8 +518,8 @@ void sk_blit_below(SkBlitter* blitter, const SkIRect& ir, const SkRegion& clip)
*/
SkScanClipper::SkScanClipper(SkBlitter* blitter, const SkRegion* clip,
const SkIRect& ir, bool skipRejectTest) {
- fBlitter = NULL; // null means blit nothing
- fClipRect = NULL;
+ fBlitter = nullptr; // null means blit nothing
+ fClipRect = nullptr;
if (clip) {
fClipRect = &clip->getBounds();
@@ -529,7 +529,7 @@ SkScanClipper::SkScanClipper(SkBlitter* blitter, const SkRegion* clip,
if (clip->isRect()) {
if (fClipRect->contains(ir)) {
- fClipRect = NULL;
+ fClipRect = nullptr;
} else {
// only need a wrapper blitter if we're horizontally clipped
if (fClipRect->fLeft > ir.fLeft || fClipRect->fRight < ir.fRight) {
@@ -653,14 +653,14 @@ static void sk_fill_triangle(const SkPoint pts[], const SkIRect* clipRect,
// this returns the first and last edge after they're sorted into a dlink list
SkEdge* edge = sort_edges(list, count, &last);
- headEdge.fPrev = NULL;
+ headEdge.fPrev = nullptr;
headEdge.fNext = edge;
headEdge.fFirstY = kEDGE_HEAD_Y;
headEdge.fX = SK_MinS32;
edge->fPrev = &headEdge;
tailEdge.fPrev = last;
- tailEdge.fNext = NULL;
+ tailEdge.fNext = nullptr;
tailEdge.fFirstY = kEDGE_TAIL_Y;
last->fNext = &tailEdge;
@@ -673,8 +673,8 @@ static void sk_fill_triangle(const SkPoint pts[], const SkIRect* clipRect,
if (clipRect && start_y < clipRect->fTop) {
start_y = clipRect->fTop;
}
- walk_convex_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, NULL);
-// walk_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, NULL);
+ walk_convex_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, nullptr);
+// walk_edges(&headEdge, SkPath::kEvenOdd_FillType, blitter, start_y, stop_y, nullptr);
}
void SkScan::FillTriangle(const SkPoint pts[], const SkRasterClip& clip,
diff --git a/src/core/SkSemaphore.cpp b/src/core/SkSemaphore.cpp
index 29d0e0148a..5efdd2e94f 100644
--- a/src/core/SkSemaphore.cpp
+++ b/src/core/SkSemaphore.cpp
@@ -25,15 +25,15 @@
HANDLE fSemaphore;
OSSemaphore() {
- fSemaphore = CreateSemaphore(NULL /*security attributes, optional*/,
+ fSemaphore = CreateSemaphore(nullptr /*security attributes, optional*/,
0 /*initial count*/,
MAXLONG /*max count*/,
- NULL /*name, optional*/);
+ nullptr /*name, optional*/);
}
~OSSemaphore() { CloseHandle(fSemaphore); }
void signal(int n) {
- ReleaseSemaphore(fSemaphore, n, NULL/*returns previous count, optional*/);
+ ReleaseSemaphore(fSemaphore, n, nullptr/*returns previous count, optional*/);
}
void wait() { WaitForSingleObject(fSemaphore, INFINITE/*timeout in ms*/); }
};
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 6da73fc45f..51a8017b5e 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -75,7 +75,7 @@ bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse
bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
SkColor storage;
- if (NULL == colorPtr) {
+ if (nullptr == colorPtr) {
colorPtr = &storage;
}
if (this->onAsLuminanceColor(colorPtr)) {
@@ -86,14 +86,14 @@ bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
}
SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const {
- if (!this->computeTotalInverse(rec, NULL)) {
- return NULL;
+ if (!this->computeTotalInverse(rec, nullptr)) {
+ return nullptr;
}
return this->onCreateContext(rec, storage);
}
SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const {
- return NULL;
+ return nullptr;
}
size_t SkShader::contextSize() const {
@@ -114,7 +114,7 @@ SkShader::Context::Context(const SkShader& shader, const ContextRec& rec)
SkShader::Context::~Context() {}
SkShader::Context::ShadeProc SkShader::Context::asAShadeProc(void** ctx) {
- return NULL;
+ return nullptr;
}
#include "SkColorPriv.h"
@@ -195,7 +195,7 @@ SkShader::Context::MatrixClass SkShader::Context::ComputeMatrixClass(const SkMat
MatrixClass mc = kLinear_MatrixClass;
if (mat.hasPerspective()) {
- if (mat.fixedStepInX(0, NULL, NULL)) {
+ if (mat.fixedStepInX(0, nullptr, nullptr)) {
mc = kFixedStepInX_MatrixClass;
} else {
mc = kPerspective_MatrixClass;
@@ -221,7 +221,7 @@ bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
}
SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const {
- return NULL;
+ return nullptr;
}
SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; }
@@ -230,7 +230,7 @@ SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader(
SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix) {
- return SkCreateBitmapShader(src, tmx, tmy, localMatrix, NULL);
+ return SkCreateBitmapShader(src, tmx, tmy, localMatrix, nullptr);
}
SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, TileMode tmy,
@@ -339,7 +339,7 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix&,
const SkMatrix*, GrColor* paintColor,
GrProcessorDataManager*, GrFragmentProcessor** fp) const {
- *fp = NULL;
+ *fp = nullptr;
SkColor skColor = fColor;
U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha());
*paintColor = SkColor2GrColor(SkColorSetA(skColor, newA));
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index a2c132a50f..c7977d36a5 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -21,7 +21,7 @@ template<typename T> void destroyT(void* ptr) {
* Template class for allocating small objects without additional heap memory
* allocations. kMaxObjects is a hard limit on the number of objects that can
* be allocated using this class. After that, attempts to create more objects
- * with this class will assert and return NULL.
+ * with this class will assert and return nullptr.
* kTotalBytes is the total number of bytes provided for storage for all
* objects created by this allocator. If an object to be created is larger
* than the storage (minus storage already used), it will be allocated on the
@@ -44,7 +44,7 @@ public:
Rec* rec = &fRecs[fNumObjects];
rec->fKillProc(rec->fObj);
// Safe to do if fObj is in fStorage, since fHeapStorage will
- // point to NULL.
+ // point to nullptr.
sk_free(rec->fHeapStorage);
}
}
@@ -54,14 +54,14 @@ public:
* SkSmallAllocator.
* Each version behaves the same but takes a different number of
* arguments.
- * Note: If kMaxObjects have been created by this SkSmallAllocator, NULL
+ * Note: If kMaxObjects have been created by this SkSmallAllocator, nullptr
* will be returned.
*/
template<typename T>
T* createT() {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T;
return static_cast<T*>(buf);
@@ -69,8 +69,8 @@ public:
template<typename T, typename A1> T* createT(const A1& a1) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1);
return static_cast<T*>(buf);
@@ -79,8 +79,8 @@ public:
template<typename T, typename A1, typename A2>
T* createT(const A1& a1, const A2& a2) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2);
return static_cast<T*>(buf);
@@ -89,8 +89,8 @@ public:
template<typename T, typename A1, typename A2, typename A3>
T* createT(const A1& a1, const A2& a2, const A3& a3) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2, a3);
return static_cast<T*>(buf);
@@ -99,8 +99,8 @@ public:
template<typename T, typename A1, typename A2, typename A3, typename A4>
T* createT(const A1& a1, const A2& a2, const A3& a3, const A4& a4) {
void* buf = this->reserveT<T>();
- if (NULL == buf) {
- return NULL;
+ if (nullptr == buf) {
+ return nullptr;
}
new (buf) T(a1, a2, a3, a4);
return static_cast<T*>(buf);
@@ -117,7 +117,7 @@ public:
SkASSERT(fNumObjects < kMaxObjects);
SkASSERT(storageRequired >= sizeof(T));
if (kMaxObjects == fNumObjects) {
- return NULL;
+ return nullptr;
}
const size_t storageRemaining = SkAlign4(kTotalBytes) - fStorageUsed;
storageRequired = SkAlign4(storageRequired);
@@ -133,7 +133,7 @@ public:
} else {
// There is space in fStorage.
rec->fStorageSize = storageRequired;
- rec->fHeapStorage = NULL;
+ rec->fHeapStorage = nullptr;
SkASSERT(SkIsAlign4(fStorageUsed));
rec->fObj = static_cast<void*>(fStorage + (fStorageUsed / 4));
fStorageUsed += storageRequired;
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index 962e2ac651..9c47844082 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -69,7 +69,7 @@ public:
SkSafeRef(fXfermode);
fBufferSize = 0;
- fBuffer = NULL;
+ fBuffer = nullptr;
unsigned flags32 = 0;
if (255 != paint.getAlpha()) {
@@ -137,7 +137,7 @@ public:
}
if (xfermode) {
- xfermode->xfer32(dst, tmp, width, NULL);
+ xfermode->xfer32(dst, tmp, width, nullptr);
} else {
fProc32(dst, tmp, width, fAlpha);
}
@@ -182,7 +182,7 @@ public:
colorFilter->filterSpan(buffer, width, buffer);
}
if (xfermode) {
- xfermode->xfer32(dst, buffer, width, NULL);
+ xfermode->xfer32(dst, buffer, width, nullptr);
} else {
fProc32(dst, buffer, width, fAlpha);
}
@@ -258,21 +258,21 @@ public:
SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkPixmap& source, const SkPaint& paint,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
- if (paint.getMaskFilter() != NULL) {
- return NULL;
+ if (paint.getMaskFilter() != nullptr) {
+ return nullptr;
}
U8CPU alpha = paint.getAlpha();
SkXfermode* xfermode = paint.getXfermode();
SkColorFilter* filter = paint.getColorFilter();
- SkSpriteBlitter* blitter = NULL;
+ SkSpriteBlitter* blitter = nullptr;
switch (source.colorType()) {
case kARGB_4444_SkColorType:
if (alpha != 0xFF) {
- return NULL; // we only have opaque sprites
+ return nullptr; // we only have opaque sprites
}
if (xfermode || filter) {
blitter = allocator->createT<Sprite_D32_S4444_XferFilter>(source, paint);
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 677dbaa365..4dd4164423 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -299,21 +299,21 @@ private:
SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkPixmap& source, const SkPaint& paint,
SkTBlitterAllocator* allocator) {
- SkASSERT(allocator != NULL);
+ SkASSERT(allocator != nullptr);
- if (paint.getMaskFilter() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getMaskFilter() != nullptr) { // may add cases for this
+ return nullptr;
}
- if (paint.getXfermode() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getXfermode() != nullptr) { // may add cases for this
+ return nullptr;
}
- if (paint.getColorFilter() != NULL) { // may add cases for this
- return NULL;
+ if (paint.getColorFilter() != nullptr) { // may add cases for this
+ return nullptr;
}
const SkAlphaType at = source.alphaType();
- SkSpriteBlitter* blitter = NULL;
+ SkSpriteBlitter* blitter = nullptr;
unsigned alpha = paint.getAlpha();
switch (source.colorType()) {
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 8b2e8ab4ce..5a66399f5e 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -181,7 +181,7 @@ bool SkWStream::writeStream(SkStream* stream, size_t length) {
///////////////////////////////////////////////////////////////////////////////
SkFILEStream::SkFILEStream(const char file[]) : fName(file), fOwnership(kCallerPasses_Ownership) {
- fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : NULL;
+ fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : nullptr;
}
SkFILEStream::SkFILEStream(FILE* file, Ownership ownership)
@@ -199,7 +199,7 @@ void SkFILEStream::setPath(const char path[]) {
fName.set(path);
if (fFILE) {
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
}
if (path) {
fFILE = sk_fopen(fName.c_str(), kRead_SkFILE_Flag);
@@ -224,13 +224,13 @@ bool SkFILEStream::rewind() {
}
// we hit an error
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
}
return false;
}
SkStreamAsset* SkFILEStream::duplicate() const {
- if (NULL == fFILE) {
+ if (nullptr == fFILE) {
return new SkMemoryStream();
}
@@ -246,8 +246,8 @@ SkStreamAsset* SkFILEStream::duplicate() const {
}
fData.reset(SkData::NewFromFILE(fFILE));
- if (NULL == fData.get()) {
- return NULL;
+ if (nullptr == fData.get()) {
+ return nullptr;
}
return new SkMemoryStream(fData);
}
@@ -275,8 +275,8 @@ size_t SkFILEStream::getLength() const {
}
const void* SkFILEStream::getMemoryBase() {
- if (NULL == fData.get()) {
- return NULL;
+ if (nullptr == fData.get()) {
+ return nullptr;
}
return fData->data();
}
@@ -307,7 +307,7 @@ SkMemoryStream::SkMemoryStream(const void* src, size_t size, bool copyData) {
}
SkMemoryStream::SkMemoryStream(SkData* data) {
- if (NULL == data) {
+ if (nullptr == data) {
fData = SkData::NewEmpty();
} else {
fData = data;
@@ -339,7 +339,7 @@ SkData* SkMemoryStream::copyToData() const {
SkData* SkMemoryStream::setData(SkData* data) {
fData->unref();
- if (NULL == data) {
+ if (nullptr == data) {
fData = SkData::NewEmpty();
} else {
fData = data;
@@ -368,7 +368,7 @@ size_t SkMemoryStream::read(void* buffer, size_t size) {
}
bool SkMemoryStream::peek(void* buffer, size_t size) const {
- SkASSERT(buffer != NULL);
+ SkASSERT(buffer != nullptr);
const size_t position = fOffset;
if (size > fData->size() - position) {
// The stream is not large enough to satisfy this request.
@@ -446,7 +446,7 @@ size_t SkFILEWStream::bytesWritten() const {
bool SkFILEWStream::write(const void* buffer, size_t size)
{
- if (fFILE == NULL) {
+ if (fFILE == nullptr) {
return false;
}
@@ -454,7 +454,7 @@ bool SkFILEWStream::write(const void* buffer, size_t size)
{
SkDEBUGCODE(SkDebugf("SkFILEWStream failed writing %d bytes\n", size);)
sk_fclose(fFILE);
- fFILE = NULL;
+ fFILE = nullptr;
return false;
}
return true;
@@ -500,7 +500,7 @@ struct SkDynamicMemoryWStream::Block {
void init(size_t size)
{
- fNext = NULL;
+ fNext = nullptr;
fCurr = this->start();
fStop = this->start() + size;
}
@@ -515,7 +515,7 @@ struct SkDynamicMemoryWStream::Block {
};
SkDynamicMemoryWStream::SkDynamicMemoryWStream()
- : fHead(NULL), fTail(NULL), fBytesWritten(0), fCopy(NULL)
+ : fHead(nullptr), fTail(nullptr), fBytesWritten(0), fCopy(nullptr)
{
}
@@ -530,12 +530,12 @@ void SkDynamicMemoryWStream::reset()
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
Block* next = block->fNext;
sk_free(block);
block = next;
}
- fHead = fTail = NULL;
+ fHead = fTail = nullptr;
fBytesWritten = 0;
}
@@ -548,7 +548,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t count)
size_t size;
- if (fTail != NULL && fTail->avail() > 0) {
+ if (fTail != nullptr && fTail->avail() > 0) {
size = SkTMin(fTail->avail(), count);
buffer = fTail->append(buffer, size);
SkASSERT(count >= size);
@@ -562,7 +562,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t count)
block->init(size);
block->append(buffer, count);
- if (fTail != NULL)
+ if (fTail != nullptr)
fTail->fNext = block;
else
fHead = fTail = block;
@@ -580,7 +580,7 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t offset, size_t cou
this->invalidateCopy();
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
if (offset < size) {
size_t part = offset + count > size ? size - offset : count;
@@ -601,7 +601,7 @@ bool SkDynamicMemoryWStream::read(void* buffer, size_t offset, size_t count)
if (offset + count > fBytesWritten)
return false; // test does not partially modify
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
if (offset < size) {
size_t part = offset + count > size ? size - offset : count;
@@ -624,7 +624,7 @@ void SkDynamicMemoryWStream::copyTo(void* dst) const
} else {
Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
size_t size = block->written();
memcpy(dst, block->start(), size);
dst = (void*)((char*)dst + size);
@@ -634,7 +634,7 @@ void SkDynamicMemoryWStream::copyTo(void* dst) const
}
void SkDynamicMemoryWStream::writeToStream(SkWStream* dst) const {
- for (Block* block = fHead; block != NULL; block = block->fNext) {
+ for (Block* block = fHead; block != nullptr; block = block->fNext) {
dst->write(block->start(), block->written());
}
}
@@ -650,7 +650,7 @@ void SkDynamicMemoryWStream::padToAlign4()
}
SkData* SkDynamicMemoryWStream::copyToData() const {
- if (NULL == fCopy) {
+ if (nullptr == fCopy) {
SkData* data = SkData::NewUninitialized(fBytesWritten);
// be sure to call copyTo() before we assign to fCopy
this->copyTo(data->writable_data());
@@ -662,7 +662,7 @@ SkData* SkDynamicMemoryWStream::copyToData() const {
void SkDynamicMemoryWStream::invalidateCopy() {
if (fCopy) {
fCopy->unref();
- fCopy = NULL;
+ fCopy = nullptr;
}
}
@@ -672,7 +672,7 @@ public:
virtual ~SkBlockMemoryRefCnt() {
SkDynamicMemoryWStream::Block* block = fHead;
- while (block != NULL) {
+ while (block != nullptr) {
SkDynamicMemoryWStream::Block* next = block->fNext;
sk_free(block);
block = next;
@@ -701,7 +701,7 @@ public:
count = fSize - fOffset;
}
size_t bytesLeftToRead = count;
- while (fCurrent != NULL) {
+ while (fCurrent != nullptr) {
size_t bytesLeftInCurrent = fCurrent->written() - fCurrentOffset;
size_t bytesFromCurrent = SkTMin(bytesLeftToRead, bytesLeftInCurrent);
if (buffer) {
@@ -726,7 +726,7 @@ public:
}
bool peek(void* buff, size_t size) const override {
- SkASSERT(buff != NULL);
+ SkASSERT(buff != nullptr);
if (fOffset + size > fSize) {
return false;
}
@@ -795,10 +795,10 @@ public:
}
const void* getMemoryBase() override {
- if (NULL == fBlockMemory->fHead->fNext) {
+ if (nullptr == fBlockMemory->fHead->fNext) {
return fBlockMemory->fHead->start();
}
- return NULL;
+ return nullptr;
}
private:
@@ -850,8 +850,8 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
static SkData* mmap_filename(const char path[]) {
SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag);
- if (NULL == file) {
- return NULL;
+ if (nullptr == file) {
+ return nullptr;
}
SkData* data = SkData::NewFromFILE(file);
@@ -870,15 +870,15 @@ SkStreamAsset* SkStream::NewFromFile(const char path[]) {
SkFILEStream* stream = new SkFILEStream(path);
if (!stream->isValid()) {
delete stream;
- stream = NULL;
+ stream = nullptr;
}
return stream;
}
// Declared in SkStreamPriv.h:
size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream) {
- SkASSERT(storage != NULL);
- SkASSERT(stream != NULL);
+ SkASSERT(storage != nullptr);
+ SkASSERT(stream != nullptr);
if (stream->hasLength()) {
const size_t length = stream->getLength();
@@ -908,7 +908,7 @@ size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream) {
// Declared in SkStreamPriv.h:
SkData* SkCopyStreamToData(SkStream* stream) {
- SkASSERT(stream != NULL);
+ SkASSERT(stream != nullptr);
if (stream->hasLength()) {
return SkData::NewFromStream(stream, stream->getLength());
@@ -926,7 +926,7 @@ SkData* SkCopyStreamToData(SkStream* stream) {
SkStreamRewindable* SkStreamRewindableFromSkStream(SkStream* stream) {
if (!stream) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkStreamRewindable> dupStream(stream->duplicate());
if (dupStream) {
diff --git a/src/core/SkStreamPriv.h b/src/core/SkStreamPriv.h
index d1af117674..b82f7d84e9 100644
--- a/src/core/SkStreamPriv.h
+++ b/src/core/SkStreamPriv.h
@@ -31,7 +31,7 @@ size_t SkCopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream);
* @param stream SkStream to be copied into data.
* @return SkData* The resulting SkData after the copy. This data
* will have a ref count of one upon return and belongs to the
- * caller. Returns NULL on failure.
+ * caller. Returns nullptr on failure.
*/
SkData *SkCopyStreamToData(SkStream* stream);
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index 5c63a8b515..9110d80eb9 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -256,7 +256,7 @@ SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) {
}
SkString::SkString(size_t len) {
- fRec = AllocRec(NULL, len);
+ fRec = AllocRec(nullptr, len);
}
SkString::SkString(const char text[]) {
@@ -295,7 +295,7 @@ bool SkString::equals(const char text[]) const {
}
bool SkString::equals(const char text[], size_t len) const {
- SkASSERT(len == 0 || text != NULL);
+ SkASSERT(len == 0 || text != nullptr);
return fRec->fLength == len && !memcmp(fRec->data(), text, len);
}
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index 2db5bba524..1689f9730b 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -296,11 +296,11 @@ void SkPathStroker::finishContour(bool close, bool currIsLine) {
// cap the end
fInner.getLastPt(&pt);
fCapper(&fOuter, fPrevPt, fPrevNormal, pt,
- currIsLine ? &fInner : NULL);
+ currIsLine ? &fInner : nullptr);
fOuter.reversePathTo(fInner);
// cap the start
fCapper(&fOuter, fFirstPt, -fFirstNormal, fFirstOuterPt,
- fPrevIsLine ? &fInner : NULL);
+ fPrevIsLine ? &fInner : nullptr);
fOuter.close();
}
}
@@ -553,7 +553,7 @@ SkPathStroker::ReductionType SkPathStroker::CheckCubicLinear(const SkPoint cubic
}
for (int index = 0; index < count; ++index) {
SkScalar t = tValues[index];
- SkEvalCubicAt(cubic, t, &reduction[index], NULL, NULL);
+ SkEvalCubicAt(cubic, t, &reduction[index], nullptr, nullptr);
}
static_assert(kQuad_ReductionType + 1 == kDegenerate_ReductionType, "enum_out_of_whack");
static_assert(kQuad_ReductionType + 2 == kDegenerate2_ReductionType, "enum_out_of_whack");
@@ -589,7 +589,7 @@ SkPathStroker::ReductionType SkPathStroker::CheckConicLinear(const SkConic& coni
return kLine_ReductionType;
}
#endif
- conic.evalAt(t, reduction, NULL);
+ conic.evalAt(t, reduction, nullptr);
return kDegenerate_ReductionType;
}
@@ -738,7 +738,7 @@ void SkPathStroker::conicQuadEnds(const SkConic& conic, SkQuadConstruct* quadPts
bool SkPathStroker::cubicPerpRay(const SkPoint cubic[4], SkScalar t, SkPoint* tPt, SkPoint* onPt,
SkPoint* tangent) const {
SkVector dxy;
- SkEvalCubicAt(cubic, t, tPt, &dxy, NULL);
+ SkEvalCubicAt(cubic, t, tPt, &dxy, nullptr);
if (dxy.fX == 0 && dxy.fY == 0) {
if (SkScalarNearlyZero(t)) {
dxy = cubic[2] - cubic[0];
@@ -779,7 +779,7 @@ bool SkPathStroker::cubicQuadEnds(const SkPoint cubic[4], SkQuadConstruct* quadP
bool SkPathStroker::cubicQuadMid(const SkPoint cubic[4], const SkQuadConstruct* quadPts,
SkPoint* mid) const {
SkPoint cubicMidPt;
- return this->cubicPerpRay(cubic, quadPts->fMidT, &cubicMidPt, mid, NULL);
+ return this->cubicPerpRay(cubic, quadPts->fMidT, &cubicMidPt, mid, nullptr);
}
// Given a quad and t, return the point on curve, its perpendicular, and the perpendicular tangent.
@@ -976,7 +976,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadCubic(const SkPoint cubic[4]
}
// project a ray from the curve to the stroke
SkPoint ray[2]; // points near midpoint on quad, midpoint on cubic
- if (!this->cubicPerpRay(cubic, quadPts->fMidT, &ray[1], &ray[0], NULL)) {
+ if (!this->cubicPerpRay(cubic, quadPts->fMidT, &ray[1], &ray[0], nullptr)) {
return kNormalError_ResultType;
}
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
@@ -994,7 +994,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadConic(const SkConic& conic,
}
// project a ray from the curve to the stroke
SkPoint ray[2]; // points near midpoint on quad, midpoint on conic
- this->conicPerpRay(conic, quadPts->fMidT, &ray[1], &ray[0], NULL);
+ this->conicPerpRay(conic, quadPts->fMidT, &ray[1], &ray[0], nullptr);
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
STROKER_DEBUG_PARAMS(fRecursionDepth));
}
@@ -1021,7 +1021,7 @@ SkPathStroker::ResultType SkPathStroker::compareQuadQuad(const SkPoint quad[3],
}
// project a ray from the curve to the stroke
SkPoint ray[2];
- this->quadPerpRay(quad, quadPts->fMidT, &ray[1], &ray[0], NULL);
+ this->quadPerpRay(quad, quadPts->fMidT, &ray[1], &ray[0], nullptr);
return this->strokeCloseEnough(quadPts->fQuad, ray, quadPts
STROKER_DEBUG_PARAMS(fRecursionDepth));
}
@@ -1429,7 +1429,7 @@ static void addBevel(SkPath* path, const SkRect& r, const SkRect& outer, SkPath:
void SkStroke::strokeRect(const SkRect& origRect, SkPath* dst,
SkPath::Direction dir) const {
- SkASSERT(dst != NULL);
+ SkASSERT(dst != nullptr);
dst->reset();
SkScalar radius = SkScalarHalf(fWidth);
diff --git a/src/core/SkTDPQueue.h b/src/core/SkTDPQueue.h
index a6784bb64b..1545f97995 100644
--- a/src/core/SkTDPQueue.h
+++ b/src/core/SkTDPQueue.h
@@ -15,7 +15,7 @@
* function that compares two Ts and returns true if the first is higher priority than the second.
*
* Optionally objects may know their index into the priority queue. The queue will update the index
- * as the objects move through the queue. This is enabled by using a non-NULL function for INDEX.
+ * as the objects move through the queue. This is enabled by using a non-nullptr function for INDEX.
* When an INDEX function is provided random deletes from the queue are allowed using remove().
* Additionally, the * priority is allowed to change as long as priorityDidChange() is called
* afterwards. In debug builds the index will be set to -1 before an element is removed from the
@@ -23,7 +23,7 @@
*/
template <typename T,
bool (*LESS)(const T&, const T&),
- int* (*INDEX)(const T&) = (int* (*)(const T&))NULL>
+ int* (*INDEX)(const T&) = (int* (*)(const T&))nullptr>
class SkTDPQueue : public SkNoncopyable {
public:
SkTDPQueue() {}
@@ -62,9 +62,9 @@ public:
this->validate();
}
- /** Random access removal. This requires that the INDEX function is non-NULL. */
+ /** Random access removal. This requires that the INDEX function is non-nullptr. */
void remove(T entry) {
- SkASSERT(NULL != INDEX);
+ SkASSERT(nullptr != INDEX);
int index = *INDEX(entry);
SkASSERT(index >= 0 && index < fArray.count());
this->validate();
@@ -84,7 +84,7 @@ public:
item's priority is changed to maintain correct ordering. Changing the priority is only
allowed if an INDEX function is provided. */
void priorityDidChange(T entry) {
- SkASSERT(NULL != INDEX);
+ SkASSERT(nullptr != INDEX);
int index = *INDEX(entry);
SkASSERT(index >= 0 && index < fArray.count());
this->validate(index);
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index 8def89b9ca..2fa37b54f7 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -22,7 +22,7 @@ template <typename T,
int kGrowPercent = 75> // Larger -> more memory efficient, but slower.
class SkTDynamicHash {
public:
- SkTDynamicHash() : fCount(0), fDeleted(0), fCapacity(0), fArray(NULL) {
+ SkTDynamicHash() : fCount(0), fDeleted(0), fCapacity(0), fArray(nullptr) {
SkASSERT(this->validate());
}
@@ -86,14 +86,14 @@ public:
int count() const { return fCount; }
- // Return the entry with this key if we have it, otherwise NULL.
+ // Return the entry with this key if we have it, otherwise nullptr.
T* find(const Key& key) const {
int index = this->firstIndex(key);
for (int round = 0; round < fCapacity; round++) {
SkASSERT(index >= 0 && index < fCapacity);
T* candidate = fArray[index];
if (Empty() == candidate) {
- return NULL;
+ return nullptr;
}
if (Deleted() != candidate && GetKey(*candidate) == key) {
return candidate;
@@ -101,12 +101,12 @@ public:
index = this->nextIndex(index, round);
}
SkASSERT(fCapacity == 0);
- return NULL;
+ return nullptr;
}
// Add an entry with this key. We require that no entry with newEntry's key is already present.
void add(T* newEntry) {
- SkASSERT(NULL == this->find(GetKey(*newEntry)));
+ SkASSERT(nullptr == this->find(GetKey(*newEntry)));
this->maybeGrow();
this->innerAdd(newEntry);
SkASSERT(this->validate());
@@ -132,7 +132,7 @@ public:
fDeleted = 0;
fCapacity = 0;
sk_free(fArray);
- fArray = NULL;
+ fArray = nullptr;
}
protected:
@@ -157,7 +157,7 @@ protected:
private:
// We have two special values to indicate an empty or deleted entry.
- static T* Empty() { return reinterpret_cast<T*>(0); } // i.e. NULL
+ static T* Empty() { return reinterpret_cast<T*>(0); } // i.e. nullptr
static T* Deleted() { return reinterpret_cast<T*>(1); } // Also an invalid pointer.
bool validate() const {
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index 3a91efeed5..ac7f0fa2ab 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -103,13 +103,13 @@ public:
}
/** Adds a new element to the list before the location indicated by the iterator. If the
- iterator refers to a NULL location then the new element is added at the tail */
+ iterator refers to a nullptr location then the new element is added at the tail */
T* addBefore(const T& t, const Iter& location) {
return new (this->internalAddBefore(location)) T(t);
}
/** Adds a new element to the list after the location indicated by the iterator. If the
- iterator refers to a NULL location then the new element is added at the head */
+ iterator refers to a nullptr location then the new element is added at the head */
T* addAfter(const T& t, const Iter& location) {
return new (this->internalAddAfter(location)) T(t);
}
@@ -222,7 +222,7 @@ public:
if (node) {
return reinterpret_cast<T*>(node->fObj);
} else {
- return NULL;
+ return nullptr;
}
}
};
diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp
index b22446bd98..a47dc14b5a 100755
--- a/src/core/SkTLS.cpp
+++ b/src/core/SkTLS.cpp
@@ -56,8 +56,8 @@ void SkTLS::Destructor(void* ptr) {
}
void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
- if (NULL == createProc) {
- return NULL;
+ if (nullptr == createProc) {
+ return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(true);
@@ -69,7 +69,7 @@ void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
SkASSERT(rec->fDeleteProc == deleteProc);
return rec->fData;
}
- } while ((rec = rec->fNext) != NULL);
+ } while ((rec = rec->fNext) != nullptr);
// not found, so create a new one
}
@@ -86,8 +86,8 @@ void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
}
void* SkTLS::Find(CreateProc createProc) {
- if (NULL == createProc) {
- return NULL;
+ if (nullptr == createProc) {
+ return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
@@ -98,20 +98,20 @@ void* SkTLS::Find(CreateProc createProc) {
if (rec->fCreateProc == createProc) {
return rec->fData;
}
- } while ((rec = rec->fNext) != NULL);
+ } while ((rec = rec->fNext) != nullptr);
}
- return NULL;
+ return nullptr;
}
void SkTLS::Delete(CreateProc createProc) {
- if (NULL == createProc) {
+ if (nullptr == createProc) {
return;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
SkTLSRec* curr = (SkTLSRec*)ptr;
- SkTLSRec* prev = NULL;
+ SkTLSRec* prev = nullptr;
while (curr) {
SkTLSRec* next = curr->fNext;
if (curr->fCreateProc == createProc) {
diff --git a/src/core/SkTLS.h b/src/core/SkTLS.h
index e94f835c55..ace2de59e6 100644
--- a/src/core/SkTLS.h
+++ b/src/core/SkTLS.h
@@ -20,7 +20,7 @@ public:
/**
* If Get() has previously been called with this CreateProc, then this
- * returns its cached data, otherwise it returns NULL. The CreateProc is
+ * returns its cached data, otherwise it returns nullptr. The CreateProc is
* never invoked in Find, it is only used as a key for searching the
* cache.
*/
@@ -52,8 +52,8 @@ private:
* Implemented by the platform, to return the value of our (one) slot per-thread
*
* If forceCreateTheSlot is true, then we must have created the "slot" for
- * our TLS, even though we know that the return value will be NULL in that
- * case (i.e. no-slot and first-time-slot both return NULL). This ensures
+ * our TLS, even though we know that the return value will be nullptr in that
+ * case (i.e. no-slot and first-time-slot both return nullptr). This ensures
* that after calling GetSpecific, we know that we can legally call
* SetSpecific.
*
diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h
index 5f8589d912..b0d04d5aa8 100644
--- a/src/core/SkTMultiMap.h
+++ b/src/core/SkTMultiMap.h
@@ -20,7 +20,7 @@ template <typename T,
typename HashTraits=T>
class SkTMultiMap {
struct ValueList {
- explicit ValueList(T* value) : fValue(value), fNext(NULL) {}
+ explicit ValueList(T* value) : fValue(value), fNext(nullptr) {}
static const Key& GetKey(const ValueList& e) { return HashTraits::GetKey(*e.fValue); }
static uint32_t Hash(const Key& key) { return HashTraits::Hash(key); }
@@ -58,7 +58,7 @@ public:
// Since we expect the caller to be fully aware of what is stored, just
// assert that the caller removes an existing value.
SkASSERT(list);
- ValueList* prev = NULL;
+ ValueList* prev = nullptr;
while (list->fValue != value) {
prev = list;
list = list->fNext;
@@ -70,7 +70,7 @@ public:
list->fNext = next->fNext;
delete next;
} else if (prev) {
- prev->fNext = NULL;
+ prev->fNext = nullptr;
delete list;
} else {
fHash.remove(key);
@@ -85,7 +85,7 @@ public:
if (list) {
return list->fValue;
}
- return NULL;
+ return nullptr;
}
template<class FindPredicate>
@@ -97,7 +97,7 @@ public:
}
list = list->fNext;
}
- return NULL;
+ return nullptr;
}
int count() const { return fCount; }
diff --git a/src/core/SkTSearch.cpp b/src/core/SkTSearch.cpp
index 64c70cb311..5b5f139042 100644
--- a/src/core/SkTSearch.cpp
+++ b/src/core/SkTSearch.cpp
@@ -22,7 +22,7 @@ int SkStrSearch(const char*const* base, int count, const char target[],
if (count <= 0)
return ~0;
- SkASSERT(base != NULL);
+ SkASSERT(base != nullptr);
int lo = 0;
int hi = count - 1;
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index 9462903427..97e3ff44a8 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -122,7 +122,7 @@ private:
// Send a poison pill to each thread.
SkAtomic<int> dummy(0);
for (int i = 0; i < fThreads.count(); i++) {
- this->add(NULL, NULL, &dummy);
+ this->add(nullptr, nullptr, &dummy);
}
// Wait for them all to swallow the pill and die.
for (int i = 0; i < fThreads.count(); i++) {
@@ -197,12 +197,12 @@ private:
friend struct SkTaskGroup::Enabler;
};
-ThreadPool* ThreadPool::gGlobal = NULL;
+ThreadPool* ThreadPool::gGlobal = nullptr;
} // namespace
SkTaskGroup::Enabler::Enabler(int threads) {
- SkASSERT(ThreadPool::gGlobal == NULL);
+ SkASSERT(ThreadPool::gGlobal == nullptr);
if (threads != 0) {
ThreadPool::gGlobal = new ThreadPool(threads);
}
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index d2b1605e95..68784f48b5 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -244,7 +244,7 @@ void SkTextBlob::flatten(SkWriteBuffer& buffer) const {
const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
int runCount = reader.read32();
if (runCount < 0) {
- return NULL;
+ return nullptr;
}
SkRect bounds;
@@ -255,7 +255,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
int glyphCount = reader.read32();
GlyphPositioning pos = static_cast<GlyphPositioning>(reader.read32());
if (glyphCount <= 0 || pos > kFull_Positioning) {
- return NULL;
+ return nullptr;
}
SkPoint offset;
@@ -263,7 +263,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
SkPaint font;
reader.readPaint(&font);
- const SkTextBlobBuilder::RunBuffer* buf = NULL;
+ const SkTextBlobBuilder::RunBuffer* buf = nullptr;
switch (pos) {
case kDefault_Positioning:
buf = &blobBuilder.allocRun(font, glyphCount, offset.x(), offset.y(), &bounds);
@@ -275,13 +275,13 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
buf = &blobBuilder.allocRunPos(font, glyphCount, &bounds);
break;
default:
- return NULL;
+ return nullptr;
}
if (!reader.readByteArray(buf->glyphs, glyphCount * sizeof(uint16_t)) ||
!reader.readByteArray(buf->pos,
glyphCount * sizeof(SkScalar) * ScalarsPerGlyph(pos))) {
- return NULL;
+ return nullptr;
}
}
@@ -359,7 +359,7 @@ SkTextBlobBuilder::SkTextBlobBuilder()
}
SkTextBlobBuilder::~SkTextBlobBuilder() {
- if (NULL != fStorage.get()) {
+ if (nullptr != fStorage.get()) {
// We are abandoning runs and must destruct the associated font data.
// The easiest way to accomplish that is to use the blob destructor.
build()->unref();
@@ -447,7 +447,7 @@ void SkTextBlobBuilder::reserve(size_t size) {
}
if (0 == fRunCount) {
- SkASSERT(NULL == fStorage.get());
+ SkASSERT(nullptr == fStorage.get());
SkASSERT(0 == fStorageSize);
SkASSERT(0 == fStorageUsed);
@@ -573,12 +573,12 @@ const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunPos(const SkPaint
}
const SkTextBlob* SkTextBlobBuilder::build() {
- SkASSERT((fRunCount > 0) == (NULL != fStorage.get()));
+ SkASSERT((fRunCount > 0) == (nullptr != fStorage.get()));
this->updateDeferredBounds();
if (0 == fRunCount) {
- SkASSERT(NULL == fStorage.get());
+ SkASSERT(nullptr == fStorage.get());
fStorageUsed = sizeof(SkTextBlob);
fStorage.realloc(fStorageUsed);
}
diff --git a/src/core/SkTraceEvent.h b/src/core/SkTraceEvent.h
index 96b6620b2c..05dc340fa2 100644
--- a/src/core/SkTraceEvent.h
+++ b/src/core/SkTraceEvent.h
@@ -395,7 +395,7 @@ AddTraceEvent(
unsigned char flags) {
return TRACE_EVENT_API_ADD_TRACE_EVENT(
phase, category_group_enabled, name, id,
- kZeroNumArgs, NULL, NULL, NULL, flags);
+ kZeroNumArgs, nullptr, nullptr, nullptr, flags);
}
template<class ARG1_TYPE>
@@ -444,7 +444,7 @@ AddTraceEvent(
class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
public:
// Note: members of data_ intentionally left uninitialized. See Initialize.
- ScopedTracer() : p_data_(NULL) {}
+ ScopedTracer() : p_data_(nullptr) {}
~ScopedTracer() {
if (p_data_ && *data_.category_group_enabled)
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 7da1118cd4..81daf2f610 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -21,7 +21,7 @@ SkTypeface::SkTypeface(const SkFontStyle& style, SkFontID fontID, bool isFixedPi
SkTypeface::~SkTypeface() { }
-SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) = NULL;
+SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) = nullptr;
///////////////////////////////////////////////////////////////////////////////
@@ -31,14 +31,14 @@ public:
protected:
SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { }
- SkStreamAsset* onOpenStream(int* ttcIndex) const override { return NULL; }
+ SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; }
SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override {
- return NULL;
+ return nullptr;
}
void onFilterRec(SkScalerContextRec*) const override { }
virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
PerGlyphInfo,
- const uint32_t*, uint32_t) const override { return NULL; }
+ const uint32_t*, uint32_t) const override { return nullptr; }
void onGetFontDescriptor(SkFontDescriptor*, bool*) const override { }
virtual int onCharsToGlyphs(const void* chars, Encoding encoding,
uint16_t glyphs[], int glyphCount) const override {
@@ -78,7 +78,7 @@ SkTypeface* sk_create_default_typeface(int style) {
SkAutoMutexAcquire lock(&gCreateDefaultMutex);
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
- SkTypeface* t = fm->legacyCreateTypeface(NULL, style);
+ SkTypeface* t = fm->legacyCreateTypeface(nullptr, style);
return t ? t : SkEmptyTypeface::Create();
}
@@ -99,7 +99,7 @@ SkTypeface* SkTypeface::RefDefault(Style style) {
}
uint32_t SkTypeface::UniqueID(const SkTypeface* face) {
- if (NULL == face) {
+ if (nullptr == face) {
face = GetDefaultTypeface();
}
return face->uniqueID();
@@ -118,7 +118,7 @@ SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
return result;
}
}
- if (NULL == name) {
+ if (nullptr == name) {
return RefDefault(style);
}
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
@@ -202,7 +202,7 @@ SkTypeface* SkTypeface::Deserialize(SkStream* stream) {
///////////////////////////////////////////////////////////////////////////////
int SkTypeface::countTables() const {
- return this->onGetTableTags(NULL);
+ return this->onGetTableTags(nullptr);
}
int SkTypeface::getTableTags(SkFontTableTag tags[]) const {
@@ -210,7 +210,7 @@ int SkTypeface::getTableTags(SkFontTableTag tags[]) const {
}
size_t SkTypeface::getTableSize(SkFontTableTag tag) const {
- return this->onGetTableData(tag, 0, ~0U, NULL);
+ return this->onGetTableData(tag, 0, ~0U, nullptr);
}
size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length,
@@ -220,7 +220,7 @@ size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length
SkStreamAsset* SkTypeface::openStream(int* ttcIndex) const {
int ttcIndexStorage;
- if (NULL == ttcIndex) {
+ if (nullptr == ttcIndex) {
// So our subclasses don't need to check for null param
ttcIndex = &ttcIndexStorage;
}
@@ -235,7 +235,7 @@ SkFontData* SkTypeface::createFontData() const {
SkFontData* SkTypeface::onCreateFontData() const {
int index;
SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index));
- return new SkFontData(stream.detach(), index, NULL, 0);
+ return new SkFontData(stream.detach(), index, nullptr, 0);
};
int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding,
@@ -243,7 +243,7 @@ int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding,
if (glyphCount <= 0) {
return 0;
}
- if (NULL == chars || (unsigned)encoding > kUTF32_Encoding) {
+ if (nullptr == chars || (unsigned)encoding > kUTF32_Encoding) {
if (glyphs) {
sk_bzero(glyphs, glyphCount * sizeof(glyphs[0]));
}
@@ -264,13 +264,13 @@ int SkTypeface::getUnitsPerEm() const {
bool SkTypeface::getKerningPairAdjustments(const uint16_t glyphs[], int count,
int32_t adjustments[]) const {
SkASSERT(count >= 0);
- // check for the only legal way to pass a NULL.. everything is 0
+ // check for the only legal way to pass a nullptr.. everything is 0
// in which case they just want to know if this face can possibly support
// kerning (true) or never (false).
- if (NULL == glyphs || NULL == adjustments) {
- SkASSERT(NULL == glyphs);
+ if (nullptr == glyphs || nullptr == adjustments) {
+ SkASSERT(nullptr == glyphs);
SkASSERT(0 == count);
- SkASSERT(NULL == adjustments);
+ SkASSERT(nullptr == adjustments);
}
return this->onGetKerningPairAdjustments(glyphs, count, adjustments);
}
@@ -352,7 +352,7 @@ bool SkTypeface::onComputeBounds(SkRect* bounds) const {
paint.setLinearText(true);
SkScalerContext::Rec rec;
- SkScalerContext::MakeRec(paint, NULL, NULL, &rec);
+ SkScalerContext::MakeRec(paint, nullptr, nullptr, &rec);
SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
SkDescriptor* desc = ad.getDesc();
diff --git a/src/core/SkTypefaceCache.cpp b/src/core/SkTypefaceCache.cpp
index 49779fcbe3..5fe080d05d 100644
--- a/src/core/SkTypefaceCache.cpp
+++ b/src/core/SkTypefaceCache.cpp
@@ -45,7 +45,7 @@ SkTypeface* SkTypefaceCache::findByProcAndRef(FindProc proc, void* ctx) const {
}
curr += 1;
}
- return NULL;
+ return nullptr;
}
void SkTypefaceCache::purge(int numToPurge) {
@@ -113,6 +113,6 @@ static bool DumpProc(SkTypeface* face, const SkFontStyle& s, void* ctx) {
void SkTypefaceCache::Dump() {
#ifdef SK_DEBUG
SkAutoMutexAcquire ama(gMutex);
- (void)Get().findByProcAndRef(DumpProc, NULL);
+ (void)Get().findByProcAndRef(DumpProc, nullptr);
#endif
}
diff --git a/src/core/SkTypefaceCache.h b/src/core/SkTypefaceCache.h
index 792958679c..f39b0d7a44 100644
--- a/src/core/SkTypefaceCache.h
+++ b/src/core/SkTypefaceCache.h
@@ -44,7 +44,7 @@ public:
/**
* Iterate through the cache, calling proc(typeface, ctx) with each
* typeface. If proc returns true, then we return that typeface (this
- * ref()s the typeface). If it never returns true, we return NULL.
+ * ref()s the typeface). If it never returns true, we return nullptr.
*/
SkTypeface* findByProcAndRef(FindProc proc, void* ctx) const;
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index eecf122100..b3f698b4e7 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -155,7 +155,7 @@ size_t SkUTF8_FromUnichar(SkUnichar uni, char utf8[]) {
*--utf8 = (char)(~(0xFF >> count) | uni);
}
- SkASSERT(utf8 == NULL || orig == SkUTF8_ToUnichar(utf8));
+ SkASSERT(utf8 == nullptr || orig == SkUTF8_ToUnichar(utf8));
return count;
}
@@ -260,14 +260,14 @@ size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues,
return 0;
}
- SkASSERT(utf16 != NULL);
+ SkASSERT(utf16 != nullptr);
const uint16_t* stop = utf16 + numberOf16BitValues;
size_t size = 0;
- if (utf8 == NULL) { // just count
+ if (utf8 == nullptr) { // just count
while (utf16 < stop) {
- size += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), NULL);
+ size += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), nullptr);
}
} else {
char* start = utf8;
diff --git a/src/core/SkUtilsArm.cpp b/src/core/SkUtilsArm.cpp
index 9fd19a56a7..9dc4e5472a 100644
--- a/src/core/SkUtilsArm.cpp
+++ b/src/core/SkUtilsArm.cpp
@@ -88,7 +88,7 @@ static bool sk_cpu_arm_check_neon(void) {
char* line = (char*) memmem(buffer, buffer_end - buffer,
features, features_len);
- if (line == NULL) { // Weird, no Features line, bad kernel?
+ if (line == nullptr) { // Weird, no Features line, bad kernel?
SkDebugf("Could not find a line starting with 'Features'"
"in /proc/cpuinfo ?\n");
break;
@@ -98,7 +98,7 @@ static bool sk_cpu_arm_check_neon(void) {
// Find the end of the current line
char* line_end = (char*) memchr(line, '\n', buffer_end - line);
- if (line_end == NULL)
+ if (line_end == nullptr)
line_end = buffer_end;
// Now find an instance of 'neon' in the flags list. We want to
@@ -108,7 +108,7 @@ static bool sk_cpu_arm_check_neon(void) {
const size_t neon_len = sizeof(neon)-1;
const char* flag = (const char*) memmem(line, line_end - line,
neon, neon_len);
- if (flag == NULL)
+ if (flag == nullptr)
break;
// Ensure it is followed by a space or a newline.
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index fd00e7d989..e00613b8b5 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -111,7 +111,7 @@ void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEnc
this->validate(encodingType == encoding);
*length = this->readInt();
const void* ptr = this->skip(SkAlign4(*length));
- void* data = NULL;
+ void* data = nullptr;
if (!fError) {
data = sk_malloc_throw(*length);
memcpy(data, ptr, *length);
@@ -214,7 +214,7 @@ uint32_t SkValidatingReadBuffer::getArrayCount() {
SkTypeface* SkValidatingReadBuffer::readTypeface() {
// TODO: Implement this (securely) when needed
- return NULL;
+ return nullptr;
}
bool SkValidatingReadBuffer::validateAvailable(size_t size) {
@@ -225,24 +225,24 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
SkString name;
this->readString(&name);
if (fError) {
- return NULL;
+ return nullptr;
}
// Is this the type we wanted ?
const char* cname = name.c_str();
SkFlattenable::Type baseType;
if (!SkFlattenable::NameToType(cname, &baseType) || (baseType != type)) {
- return NULL;
+ return nullptr;
}
SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
- if (NULL == factory) {
- return NULL; // writer failed to give us the flattenable
+ if (nullptr == factory) {
+ return nullptr; // writer failed to give us the flattenable
}
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
- SkFlattenable* obj = NULL;
+ SkFlattenable* obj = nullptr;
uint32_t sizeRecorded = this->readUInt();
if (factory) {
size_t offset = fReader.offset();
@@ -253,7 +253,7 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
if (fError) {
// we could try to fix up the offset...
SkSafeUnref(obj);
- obj = NULL;
+ obj = nullptr;
}
} else {
// we must skip the remaining data
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index 5d395d4841..f95370585d 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -28,17 +28,17 @@ struct SkVarAlloc::Block {
SkVarAlloc::SkVarAlloc(size_t minLgSize)
: fBytesAllocated(0)
- , fByte(NULL)
+ , fByte(nullptr)
, fRemaining(0)
, fLgSize(minLgSize)
- , fBlock(NULL) {}
+ , fBlock(nullptr) {}
SkVarAlloc::SkVarAlloc(size_t minLgSize, char* storage, size_t len)
: fBytesAllocated(0)
, fByte(storage)
, fRemaining(len)
, fLgSize(minLgSize)
- , fBlock(NULL) {}
+ , fBlock(nullptr) {}
SkVarAlloc::~SkVarAlloc() {
Block* b = fBlock;
diff --git a/src/core/SkVertState.cpp b/src/core/SkVertState.cpp
index f23b1083fe..7c3047ec40 100644
--- a/src/core/SkVertState.cpp
+++ b/src/core/SkVertState.cpp
@@ -101,6 +101,6 @@ VertState::Proc VertState::chooseProc(SkCanvas::VertexMode mode) {
case SkCanvas::kTriangleFan_VertexMode:
return fIndices ? TriangleFanX : TriangleFan;
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/core/SkVertState.h b/src/core/SkVertState.h
index ecf1773dc7..ab794521b0 100644
--- a/src/core/SkVertState.h
+++ b/src/core/SkVertState.h
@@ -22,7 +22,7 @@ struct VertState {
/**
* Construct a VertState from a vertex count, index array, and index count.
- * If the vertices are unindexed pass NULL for indices.
+ * If the vertices are unindexed pass nullptr for indices.
*/
VertState(int vCount, const uint16_t indices[], int indexCount)
: fIndices(indices) {
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index faa7f00b08..7ddc77f93b 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -17,19 +17,19 @@
SkWriteBuffer::SkWriteBuffer(uint32_t flags)
: fFlags(flags)
- , fFactorySet(NULL)
- , fNamedFactorySet(NULL)
- , fBitmapHeap(NULL)
- , fTFSet(NULL) {
+ , fFactorySet(nullptr)
+ , fNamedFactorySet(nullptr)
+ , fBitmapHeap(nullptr)
+ , fTFSet(nullptr) {
}
SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags)
: fFlags(flags)
- , fFactorySet(NULL)
- , fNamedFactorySet(NULL)
+ , fFactorySet(nullptr)
+ , fNamedFactorySet(nullptr)
, fWriter(storage, storageSize)
- , fBitmapHeap(NULL)
- , fTFSet(NULL) {
+ , fBitmapHeap(nullptr)
+ , fTFSet(nullptr) {
}
SkWriteBuffer::~SkWriteBuffer() {
@@ -165,12 +165,12 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
// the size of the encoded data. A non-zero size signifies that encoded data was written.
// 3. Call SkBitmap::flatten. After writing a boolean value of false, signifying that a heap was
// not used, write a zero to signify that the data was not encoded.
- bool useBitmapHeap = fBitmapHeap != NULL;
+ bool useBitmapHeap = fBitmapHeap != nullptr;
// Write a bool: true if the SkBitmapHeap is to be used, in which case the reader must use an
// SkBitmapHeapReader to read the SkBitmap. False if the bitmap was serialized another way.
this->writeBool(useBitmapHeap);
if (useBitmapHeap) {
- SkASSERT(NULL == fPixelSerializer);
+ SkASSERT(nullptr == fPixelSerializer);
int32_t slot = fBitmapHeap->insert(bitmap);
fWriter.write32(slot);
// crbug.com/155875
@@ -187,7 +187,7 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
if (pixelRef) {
// see if the pixelref already has an encoded version
SkAutoDataUnref existingData(pixelRef->refEncodedData());
- if (existingData.get() != NULL) {
+ if (existingData.get() != nullptr) {
// Assumes that if the client did not set a serializer, they are
// happy to get the encoded data.
if (!fPixelSerializer || fPixelSerializer->useEncodedData(existingData->data(),
@@ -201,11 +201,11 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
SkAutoPixmapUnlock result;
if (fPixelSerializer && bitmap.requestLock(&result)) {
const SkPixmap& pmap = result.pixmap();
- SkASSERT(NULL == fBitmapHeap);
+ SkASSERT(nullptr == fBitmapHeap);
SkAutoDataUnref data(fPixelSerializer->encodePixels(pmap.info(),
pmap.addr(),
pmap.rowBytes()));
- if (data.get() != NULL) {
+ if (data.get() != nullptr) {
// if we have to "encode" the bitmap, then we assume there is no
// offset to share, since we are effectively creating a new pixelref
write_encoded_bitmap(this, data, SkIPoint::Make(0, 0));
@@ -247,7 +247,7 @@ void SkWriteBuffer::writeImage(const SkImage* image) {
}
void SkWriteBuffer::writeTypeface(SkTypeface* obj) {
- if (NULL == obj || NULL == fTFSet) {
+ if (nullptr == obj || nullptr == fTFSet) {
fWriter.write32(0);
} else {
fWriter.write32(fTFSet->add(obj));
@@ -256,18 +256,18 @@ void SkWriteBuffer::writeTypeface(SkTypeface* obj) {
SkFactorySet* SkWriteBuffer::setFactoryRecorder(SkFactorySet* rec) {
SkRefCnt_SafeAssign(fFactorySet, rec);
- if (fNamedFactorySet != NULL) {
+ if (fNamedFactorySet != nullptr) {
fNamedFactorySet->unref();
- fNamedFactorySet = NULL;
+ fNamedFactorySet = nullptr;
}
return rec;
}
SkNamedFactorySet* SkWriteBuffer::setNamedFactoryRecorder(SkNamedFactorySet* rec) {
SkRefCnt_SafeAssign(fNamedFactorySet, rec);
- if (fFactorySet != NULL) {
+ if (fFactorySet != nullptr) {
fFactorySet->unref();
- fFactorySet = NULL;
+ fFactorySet = nullptr;
}
return rec;
}
@@ -279,9 +279,9 @@ SkRefCntSet* SkWriteBuffer::setTypefaceRecorder(SkRefCntSet* rec) {
void SkWriteBuffer::setBitmapHeap(SkBitmapHeap* bitmapHeap) {
SkRefCnt_SafeAssign(fBitmapHeap, bitmapHeap);
- if (bitmapHeap != NULL) {
- SkASSERT(NULL == fPixelSerializer);
- fPixelSerializer.reset(NULL);
+ if (bitmapHeap != nullptr) {
+ SkASSERT(nullptr == fPixelSerializer);
+ fPixelSerializer.reset(nullptr);
}
}
@@ -289,9 +289,9 @@ void SkWriteBuffer::setPixelSerializer(SkPixelSerializer* serializer) {
fPixelSerializer.reset(serializer);
if (serializer) {
serializer->ref();
- SkASSERT(NULL == fBitmapHeap);
+ SkASSERT(nullptr == fBitmapHeap);
SkSafeUnref(fBitmapHeap);
- fBitmapHeap = NULL;
+ fBitmapHeap = nullptr;
}
}
@@ -306,19 +306,19 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
* The distinction is important, since 0-index is 32bits (always), but a
* 0-functionptr might be 32 or 64 bits.
*/
- if (NULL == flattenable) {
+ if (nullptr == flattenable) {
if (this->isValidating()) {
this->writeString("");
- } else if (fFactorySet != NULL || fNamedFactorySet != NULL) {
+ } else if (fFactorySet != nullptr || fNamedFactorySet != nullptr) {
this->write32(0);
} else {
- this->writeFunctionPtr(NULL);
+ this->writeFunctionPtr(nullptr);
}
return;
}
SkFlattenable::Factory factory = flattenable->getFactory();
- SkASSERT(factory != NULL);
+ SkASSERT(factory != nullptr);
/*
* We can write 1 of 3 versions of the flattenable:
diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp
index a1a8b8800a..457cff49ab 100644
--- a/src/core/SkWriter32.cpp
+++ b/src/core/SkWriter32.cpp
@@ -37,7 +37,7 @@ size_t SkReader32::readIntoString(SkString* copy) {
}
void SkWriter32::writeString(const char str[], size_t len) {
- if (NULL == str) {
+ if (nullptr == str) {
str = "";
len = 0;
}
@@ -64,7 +64,7 @@ size_t SkWriter32::WriteStringSize(const char* str, size_t len) {
}
void SkWriter32::growToAtLeast(size_t size) {
- const bool wasExternal = (fExternal != NULL) && (fData == fExternal);
+ const bool wasExternal = (fExternal != nullptr) && (fData == fExternal);
fCapacity = 4096 + SkTMax(size, fCapacity + (fCapacity / 2));
fInternal.realloc(fCapacity);
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 17ce215c7a..1d409866bb 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -666,7 +666,7 @@ bool SkXfermode::asXPFactory(GrXPFactory**) const {
#include "effects/GrPorterDuffXferProcessor.h"
bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) {
- if (NULL == xfermode) {
+ if (nullptr == xfermode) {
if (xpf) {
*xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode);
}
@@ -691,7 +691,7 @@ void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
dst[i] = this->xferColor(src[i], dst[i]);
}
@@ -715,7 +715,7 @@ void SkXfermode::xfer16(uint16_t* dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
dst[i] = SkPixel32ToPixel16_ToU16(this->xferColor(src[i], dstC));
@@ -740,7 +740,7 @@ void SkXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
const SkAlpha* SK_RESTRICT aa) const {
SkASSERT(dst && src && count >= 0);
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor res = this->xferColor(src[i], (dst[i] << SK_A32_SHIFT));
dst[i] = SkToU8(SkGetPackedA32(res));
@@ -775,7 +775,7 @@ bool SkXfermode::isOpaque(SkXfermode::SrcColorOpacity opacityType) const {
SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) {
uint32_t mode32 = buffer.read32();
if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) {
- return NULL;
+ return nullptr;
}
return SkXfermode::Create((SkXfermode::Mode)mode32);
}
@@ -840,7 +840,7 @@ void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
dst[i] = proc(src[i], dst[i]);
}
@@ -868,7 +868,7 @@ void SkProcCoeffXfermode::xfer16(uint16_t* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
dst[i] = SkPixel32ToPixel16_ToU16(proc(src[i], dstC));
@@ -897,7 +897,7 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
SkXfermodeProc proc = fProc;
if (proc) {
- if (NULL == aa) {
+ if (nullptr == aa) {
for (int i = count - 1; i >= 0; --i) {
SkPMColor res = proc(src[i], dst[i] << SK_A32_SHIFT);
dst[i] = SkToU8(SkGetPackedA32(res));
@@ -1017,20 +1017,20 @@ SkXfermode* SkXfermode::Create(Mode mode) {
if ((unsigned)mode >= kModeCount) {
// report error
- return NULL;
+ return nullptr;
}
- // Skia's "default" mode is srcover. NULL in SkPaint is interpreted as srcover
- // so we can just return NULL from the factory.
+ // Skia's "default" mode is srcover. nullptr in SkPaint is interpreted as srcover
+ // so we can just return nullptr from the factory.
if (kSrcOver_Mode == mode) {
- return NULL;
+ return nullptr;
}
return SkSafeRef(cached[mode]);
}
SkXfermodeProc SkXfermode::GetProc(Mode mode) {
- SkXfermodeProc proc = NULL;
+ SkXfermodeProc proc = nullptr;
if ((unsigned)mode < kModeCount) {
proc = gProcCoeffs[mode].fProc;
}
@@ -1062,7 +1062,7 @@ bool SkXfermode::ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst) {
}
bool SkXfermode::AsMode(const SkXfermode* xfer, Mode* mode) {
- if (NULL == xfer) {
+ if (nullptr == xfer) {
if (mode) {
*mode = kSrcOver_Mode;
}
@@ -1081,7 +1081,7 @@ bool SkXfermode::IsMode(const SkXfermode* xfer, Mode mode) {
}
bool SkXfermode::SupportsCoverageAsAlpha(const SkXfermode* xfer) {
- // if xfer is NULL we treat it as srcOver which always supports coverageAsAlpha
+ // if xfer is nullptr we treat it as srcOver which always supports coverageAsAlpha
if (!xfer) {
return true;
}
@@ -1090,7 +1090,7 @@ bool SkXfermode::SupportsCoverageAsAlpha(const SkXfermode* xfer) {
}
bool SkXfermode::IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType) {
- // if xfer is NULL we treat it as srcOver which is opaque if our src is opaque
+ // if xfer is nullptr we treat it as srcOver which is opaque if our src is opaque
if (!xfer) {
return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
}
diff --git a/src/core/SkYUVPlanesCache.cpp b/src/core/SkYUVPlanesCache.cpp
index f013599cc5..336b581246 100644
--- a/src/core/SkYUVPlanesCache.cpp
+++ b/src/core/SkYUVPlanesCache.cpp
@@ -59,7 +59,7 @@ struct YUVPlanesRec : public SkResourceCache::Rec {
SkCachedData* tmpData = rec.fValue.fData;
tmpData->ref();
- if (NULL == tmpData->data()) {
+ if (nullptr == tmpData->data()) {
tmpData->unref();
return false;
}
@@ -75,7 +75,7 @@ SkCachedData* SkYUVPlanesCache::FindAndRef(uint32_t genID, Info* info,
YUVValue result;
YUVPlanesKey key(genID);
if (!CHECK_LOCAL(localCache, find, Find, key, YUVPlanesRec::Visitor, &result)) {
- return NULL;
+ return nullptr;
}
*info = result.fInfo;
diff --git a/src/core/SkYUVPlanesCache.h b/src/core/SkYUVPlanesCache.h
index aa9b89e2a5..a024192d07 100644
--- a/src/core/SkYUVPlanesCache.h
+++ b/src/core/SkYUVPlanesCache.h
@@ -35,16 +35,16 @@ public:
/**
* On success, return a ref to the SkCachedData that holds the pixels.
*
- * On failure, return NULL.
+ * On failure, return nullptr.
*/
static SkCachedData* FindAndRef(uint32_t genID, Info* info,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
/**
* Add a pixelRef ID and its YUV planes data to the cache.
*/
static void Add(uint32_t genID, SkCachedData* data, Info* info,
- SkResourceCache* localCache = NULL);
+ SkResourceCache* localCache = nullptr);
};
#endif
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 2b15cd9f4a..74fda4b3b8 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -52,7 +52,7 @@
//Dummy representation of a GUID from createId.
#define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX"
-//Length of GUID representation from createId, including NULL terminator.
+//Length of GUID representation from createId, including nullptr terminator.
#define GUID_ID_LEN SK_ARRAY_COUNT(L_GUID_ID)
/**
@@ -122,7 +122,7 @@ SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory)
HRVM(CoCreateInstance(
CLSID_XpsOMObjectFactory,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&this->fXpsFactory)),
"Could not create factory for layer.");
@@ -136,9 +136,9 @@ SkXPSDevice::~SkXPSDevice() {
SkXPSDevice::TypefaceUse::TypefaceUse()
: typefaceId(0xffffffff)
- , fontData(NULL)
- , xpsFont(NULL)
- , glyphsUsed(NULL) {
+ , fontData(nullptr)
+ , xpsFont(nullptr)
+ , glyphsUsed(nullptr) {
}
SkXPSDevice::TypefaceUse::~TypefaceUse() {
@@ -153,7 +153,7 @@ bool SkXPSDevice::beginPortfolio(SkWStream* outputStream) {
//Create XPS Factory.
HRBM(CoCreateInstance(
CLSID_XpsOMObjectFactory,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&this->fXpsFactory)),
"Could not create XPS factory.");
@@ -193,7 +193,7 @@ HRESULT SkXPSDevice::createXpsThumbnail(IXpsOMPage* page,
SkTScopedComPtr<IXpsOMThumbnailGenerator> thumbnailGenerator;
HRM(CoCreateInstance(
CLSID_XpsOMThumbnailGenerator,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&thumbnailGenerator)),
"Could not create thumbnail generator.");
@@ -257,10 +257,10 @@ HRESULT SkXPSDevice::initXpsDocumentWriter(IXpsOMImageResource* image) {
TRUE,
XPS_INTERLEAVING_OFF, //XPS_INTERLEAVING_ON,
partUri.get(),
- NULL,
+ nullptr,
image,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&this->fPackageWriter),
"Could not create package writer.");
}
@@ -273,10 +273,10 @@ HRESULT SkXPSDevice::initXpsDocumentWriter(IXpsOMImageResource* image) {
&partUri),
"Could not create fixed document part uri.");
HRM(this->fPackageWriter->StartNewDocument(partUri.get(),
- NULL,
- NULL,
- NULL,
- NULL),
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr),
"Could not start document.");
}
@@ -328,7 +328,7 @@ bool SkXPSDevice::endSheet() {
"Could not add scale canvas to page.");
//Create the package writer if it hasn't been created yet.
- if (NULL == this->fPackageWriter.get()) {
+ if (nullptr == this->fPackageWriter.get()) {
SkTScopedComPtr<IXpsOMImageResource> image;
//Ignore return, thumbnail is completely optional.
this->createXpsThumbnail(page.get(), 0, &image);
@@ -338,10 +338,10 @@ bool SkXPSDevice::endSheet() {
HRBM(this->fPackageWriter->AddPage(page.get(),
&pageSize,
- NULL,
- NULL,
- NULL,
- NULL),
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr),
"Could not write the page.");
this->fCurrentXpsCanvas.reset();
@@ -357,7 +357,7 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) {
int ttcCount = (current->ttcIndex + 1);
//The following are declared with the types required by CreateFontPackage.
- unsigned char *fontPackageBufferRaw = NULL;
+ unsigned char *fontPackageBufferRaw = nullptr;
unsigned long fontPackageBufferSize;
unsigned long bytesWritten;
unsigned long result = CreateFontPackage(
@@ -377,7 +377,7 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) {
sk_malloc_throw,
sk_realloc_throw,
sk_free,
- NULL);
+ nullptr);
SkAutoTMalloc<unsigned char> fontPackageBuffer(fontPackageBufferRaw);
if (result != NO_ERROR) {
SkDEBUGF(("CreateFontPackage Error %lu", result));
@@ -535,7 +535,7 @@ HRESULT SkXPSDevice::createXpsTransform(const SkMatrix& matrix,
IXpsOMMatrixTransform** xpsTransform) {
SkScalar affine[6];
if (!matrix.asAffine(affine)) {
- *xpsTransform = NULL;
+ *xpsTransform = nullptr;
return S_FALSE;
}
XPS_MATRIX rawXpsMatrix = {
@@ -575,7 +575,7 @@ HRESULT SkXPSDevice::createXpsSolidColorBrush(const SkColor skColor,
IXpsOMBrush** xpsBrush) {
XPS_COLOR xpsColor = xps_color(skColor);
SkTScopedComPtr<IXpsOMSolidColorBrush> solidBrush;
- HRM(this->fXpsFactory->CreateSolidColorBrush(&xpsColor, NULL, &solidBrush),
+ HRM(this->fXpsFactory->CreateSolidColorBrush(&xpsColor, nullptr, &solidBrush),
"Could not create solid color brush.");
HRM(solidBrush->SetOpacity(alpha / 255.0f), "Could not set opacity.");
HRM(solidBrush->QueryInterface<IXpsOMBrush>(xpsBrush), "QI Fail.");
@@ -840,7 +840,7 @@ HRESULT SkXPSDevice::createXpsGradientStop(const SkColor skColor,
IXpsOMGradientStop** xpsGradStop) {
XPS_COLOR gradStopXpsColor = xps_color(skColor);
HRM(this->fXpsFactory->CreateGradientStop(&gradStopXpsColor,
- NULL,
+ nullptr,
SkScalarToFLOAT(offset),
xpsGradStop),
"Could not create gradient stop.");
@@ -990,7 +990,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
IXpsOMBrush** brush,
const SkMatrix* parentTransform) {
const SkShader *shader = skPaint.getShader();
- if (NULL == shader) {
+ if (nullptr == shader) {
HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush));
return S_OK;
}
@@ -998,8 +998,8 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
//Gradient shaders.
SkShader::GradientInfo info;
info.fColorCount = 0;
- info.fColors = NULL;
- info.fColorOffsets = NULL;
+ info.fColors = nullptr;
+ info.fColorOffsets = nullptr;
SkShader::GradientType gradientType = shader->asAGradient(&info);
if (SkShader::kNone_GradientType == gradientType) {
@@ -1200,7 +1200,7 @@ void SkXPSDevice::drawRRect(const SkDraw& d,
const SkPaint& paint) {
SkPath path;
path.addRRect(rr);
- this->drawPath(d, path, paint, NULL, true);
+ this->drawPath(d, path, paint, nullptr, true);
}
void SkXPSDevice::internalDrawRect(const SkDraw& d,
@@ -1209,7 +1209,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d,
const SkPaint& paint) {
//Exit early if there is nothing to draw.
if (d.fClip->isEmpty() ||
- (paint.getAlpha() == 0 && paint.getXfermode() == NULL)) {
+ (paint.getAlpha() == 0 && paint.getXfermode() == nullptr)) {
return;
}
@@ -1218,7 +1218,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d,
SkPath tmp;
tmp.addRect(r);
tmp.setFillType(SkPath::kWinding_FillType);
- this->drawPath(d, tmp, paint, NULL, true);
+ this->drawPath(d, tmp, paint, nullptr, true);
return;
}
@@ -1525,7 +1525,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
// nothing to draw
if (d.fClip->isEmpty() ||
- (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) {
+ (paint->getAlpha() == 0 && paint->getXfermode() == nullptr)) {
return;
}
@@ -1558,7 +1558,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
bool fill = paint->getFillPath(*skeletalPath, fillablePath);
SkPaint* writablePaint = paint.writable();
- writablePaint->setPathEffect(NULL);
+ writablePaint->setPathEffect(nullptr);
if (fill) {
writablePaint->setStyle(SkPaint::kFill_Style);
} else {
@@ -1610,7 +1610,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
d.fClip->getBounds(),
&clipIRect);
- SkMask* mask = NULL;
+ SkMask* mask = nullptr;
//[Fillable-path -> Mask]
SkMask rasteredMask;
@@ -1628,11 +1628,11 @@ void SkXPSDevice::drawPath(const SkDraw& d,
//[Mask -> Mask]
SkMask filteredMask;
if (filter &&
- filter->filterMask(&filteredMask, *mask, *d.fMatrix, NULL)) {
+ filter->filterMask(&filteredMask, *mask, *d.fMatrix, nullptr)) {
mask = &filteredMask;
} else {
- filteredMask.fImage = NULL;
+ filteredMask.fImage = nullptr;
}
SkAutoMaskFreeImage filteredAmi(filteredMask.fImage);
@@ -1656,7 +1656,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
SkPath* pixelPath = pathIsMutable ? fillablePath : &modifiedPath;
fillablePath->transform(matrix, pixelPath);
- SkMask* mask = NULL;
+ SkMask* mask = nullptr;
//[Pixel-path -> Mask]
SkMask rasteredMask;
@@ -1677,10 +1677,10 @@ void SkXPSDevice::drawPath(const SkDraw& d,
if (filter->filterMask(&filteredMask,
rasteredMask,
matrix,
- NULL)) {
+ nullptr)) {
mask = &filteredMask;
} else {
- filteredMask.fImage = NULL;
+ filteredMask.fImage = nullptr;
}
SkAutoMaskFreeImage filteredAmi(filteredMask.fImage);
@@ -2004,7 +2004,7 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d,
HR(this->createXpsBrush(
paint,
&xpsFillBrush,
- useCanvasForClip ? NULL : &transform));
+ useCanvasForClip ? nullptr : &transform));
HRM(glyphs->SetFillBrushLocal(xpsFillBrush.get()),
"Could not set fill brush.");
@@ -2132,7 +2132,7 @@ void SkXPSDevice::drawText(const SkDraw& d,
if (text_must_be_pathed(paint, *d.fMatrix)) {
SkPath path;
paint.getTextPath(text, byteLen, x, y, &path);
- this->drawPath(d, path, paint, NULL, true);
+ this->drawPath(d, path, paint, nullptr, true);
//TODO: add automation "text"
return;
}
@@ -2163,7 +2163,7 @@ void SkXPSDevice::drawText(const SkDraw& d,
this->fXpsFactory.get(),
this->fCurrentXpsCanvas.get(),
typeface,
- NULL,
+ nullptr,
procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(),
&origin,
SkScalarToFLOAT(paint.getTextSize()),
@@ -2182,7 +2182,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d,
SkPath path;
//TODO: make this work, Draw currently does not handle as well.
//paint.getTextPath(text, byteLength, x, y, &path);
- //this->drawPath(d, path, paint, NULL, true);
+ //this->drawPath(d, path, paint, nullptr, true);
//TODO: add automation "text"
return;
}
@@ -2213,7 +2213,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d,
this->fXpsFactory.get(),
this->fCurrentXpsCanvas.get(),
typeface,
- NULL,
+ nullptr,
procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(),
&origin,
SkScalarToFLOAT(paint.getTextSize()),
@@ -2253,7 +2253,7 @@ SkBaseDevice* SkXPSDevice::onCreateDevice(const CreateInfo& info, const SkPaint*
//Conditional for bug compatibility with PDF device.
#if 0
if (SkBaseDevice::kGeneral_Usage == info.fUsage) {
- return NULL;
+ return nullptr;
SK_CRASH();
//To what stream do we write?
//SkXPSDevice* dev = new SkXPSDevice(this);
diff --git a/src/doc/SkDocument.cpp b/src/doc/SkDocument.cpp
index 5b2237d18a..fa25e44f86 100644
--- a/src/doc/SkDocument.cpp
+++ b/src/doc/SkDocument.cpp
@@ -21,7 +21,7 @@ SkDocument::~SkDocument() {
SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height,
const SkRect* content) {
if (width <= 0 || height <= 0) {
- return NULL;
+ return nullptr;
}
SkRect outer = SkRect::MakeWH(width, height);
@@ -29,7 +29,7 @@ SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height,
if (content) {
inner = *content;
if (!inner.intersect(outer)) {
- return NULL;
+ return nullptr;
}
} else {
inner = outer;
@@ -44,11 +44,11 @@ SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height,
this->endPage();
break;
case kClosed_State:
- return NULL;
+ return nullptr;
}
}
SkDEBUGFAIL("never get here");
- return NULL;
+ return nullptr;
}
void SkDocument::endPage() {
@@ -68,9 +68,9 @@ bool SkDocument::close() {
if (fDoneProc) {
fDoneProc(fStream, false);
}
- // we don't own the stream, but we mark it NULL since we can
+ // we don't own the stream, but we mark it nullptr since we can
// no longer write to it.
- fStream = NULL;
+ fStream = nullptr;
return success;
}
case kInPage_State:
@@ -89,7 +89,7 @@ void SkDocument::abort() {
if (fDoneProc) {
fDoneProc(fStream, true);
}
- // we don't own the stream, but we mark it NULL since we can
+ // we don't own the stream, but we mark it nullptr since we can
// no longer write to it.
- fStream = NULL;
+ fStream = nullptr;
}
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp
index 1741239bcc..6c47379951 100644
--- a/src/doc/SkDocument_PDF.cpp
+++ b/src/doc/SkDocument_PDF.cpp
@@ -318,7 +318,7 @@ protected:
void onEndPage() override {
SkASSERT(fCanvas.get());
fCanvas->flush();
- fCanvas.reset(NULL);
+ fCanvas.reset(nullptr);
}
bool onClose(SkWStream* stream) override {
@@ -345,14 +345,14 @@ private:
///////////////////////////////////////////////////////////////////////////////
SkDocument* SkDocument::CreatePDF(SkWStream* stream, SkScalar dpi) {
- return stream ? new SkDocument_PDF(stream, NULL, dpi) : NULL;
+ return stream ? new SkDocument_PDF(stream, nullptr, dpi) : nullptr;
}
SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) {
SkFILEWStream* stream = new SkFILEWStream(path);
if (!stream->isValid()) {
delete stream;
- return NULL;
+ return nullptr;
}
auto delete_wstream = [](SkWStream* stream, bool) { delete stream; };
return new SkDocument_PDF(stream, delete_wstream, dpi);
diff --git a/src/doc/SkDocument_PDF_None.cpp b/src/doc/SkDocument_PDF_None.cpp
index 4759acf2a0..f146cba018 100644
--- a/src/doc/SkDocument_PDF_None.cpp
+++ b/src/doc/SkDocument_PDF_None.cpp
@@ -5,5 +5,5 @@
* found in the LICENSE file.
*/
#include "SkDocument.h"
-SkDocument* SkDocument::CreatePDF(SkWStream*, SkScalar) { return NULL; }
-SkDocument* SkDocument::CreatePDF(const char path[], SkScalar) { return NULL; }
+SkDocument* SkDocument::CreatePDF(SkWStream*, SkScalar) { return nullptr; }
+SkDocument* SkDocument::CreatePDF(const char path[], SkScalar) { return nullptr; }
diff --git a/src/doc/SkDocument_XPS.cpp b/src/doc/SkDocument_XPS.cpp
index 943d0a882a..57fa0b80c6 100644
--- a/src/doc/SkDocument_XPS.cpp
+++ b/src/doc/SkDocument_XPS.cpp
@@ -42,7 +42,7 @@ protected:
void onEndPage() override {
SkASSERT(fCanvas.get());
fCanvas->flush();
- fCanvas.reset(NULL);
+ fCanvas.reset(nullptr);
fDevice.endSheet();
}
@@ -63,7 +63,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
SkDocument* SkDocument::CreateXPS(SkWStream* stream, SkScalar dpi) {
- return stream ? new SkDocument_XPS(stream, NULL, dpi) : NULL;
+ return stream ? new SkDocument_XPS(stream, nullptr, dpi) : nullptr;
}
static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
@@ -71,7 +71,7 @@ static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
SkDocument* SkDocument::CreateXPS(const char path[], SkScalar dpi) {
SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
if (!stream->isValid()) {
- return NULL;
+ return nullptr;
}
return new SkDocument_XPS(stream.detach(), delete_wstream, dpi);
}
diff --git a/src/doc/SkDocument_XPS_None.cpp b/src/doc/SkDocument_XPS_None.cpp
index 01055e5cf0..9d51ea25d7 100644
--- a/src/doc/SkDocument_XPS_None.cpp
+++ b/src/doc/SkDocument_XPS_None.cpp
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "SkDocument.h"
-SkDocument* SkDocument::CreateXPS(SkWStream*, SkScalar) { return NULL; }
-SkDocument* SkDocument::CreateXPS(const char path[], SkScalar) { return NULL; }
+SkDocument* SkDocument::CreateXPS(SkWStream*, SkScalar) { return nullptr; }
+SkDocument* SkDocument::CreateXPS(const char path[], SkScalar) { return nullptr; }
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 3af9887f9c..d630a8ed6c 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -160,7 +160,7 @@ SkFlattenable* SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) {
Style style = (Style)buffer.readUInt();
return SkPath1DPathEffect::Create(path, advance, phase, style);
}
- return NULL;
+ return nullptr;
}
void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const {
@@ -177,7 +177,7 @@ SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
switch (fStyle) {
case kTranslate_Style: {
SkPoint pos;
- if (meas.getPosTan(distance, &pos, NULL)) {
+ if (meas.getPosTan(distance, &pos, nullptr)) {
dst->addPath(fPath, pos.fX, pos.fY);
}
} break;
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index f6d146169a..0f96cdf59a 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -282,7 +282,7 @@ bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
GrPaint grPaint;
grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRegion::Iterator iter(fRegion);
- drawContext->clear(maskTexture->asRenderTarget(), NULL, 0x0, true);
+ drawContext->clear(maskTexture->asRenderTarget(), nullptr, 0x0, true);
while (!iter.done()) {
SkRect rect = SkRect::Make(iter.rect());
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index b8959ddac5..7db6b47d66 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -105,7 +105,7 @@ void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[],
SkScalar k4 = fK[3] * 255;
for (int i = 0; i < count; ++i) {
- if ((NULL == aaCoverage) || aaCoverage[i]) {
+ if ((nullptr == aaCoverage) || aaCoverage[i]) {
SkPMColor sc = src[i];
SkPMColor dc = dst[i];
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 279e36d3fb..7732917e42 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -27,7 +27,7 @@ static void add_arithmetic_code(GrGLFragmentBuilder* fsBuilder,
const char* kUni,
bool enforcePMColor) {
// We don't try to optimize for this case at all
- if (NULL == inputColor) {
+ if (nullptr == inputColor) {
fsBuilder->codeAppend("const vec4 src = vec4(1);");
} else {
fsBuilder->codeAppendf("vec4 src = %s;", inputColor);
diff --git a/src/effects/SkBitmapSource.cpp b/src/effects/SkBitmapSource.cpp
index ecaffcf7c9..5b1934f68a 100644
--- a/src/effects/SkBitmapSource.cpp
+++ b/src/effects/SkBitmapSource.cpp
@@ -43,7 +43,7 @@ SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
buffer.readRect(&dst);
SkBitmap bitmap;
if (!buffer.readBitmap(&bitmap)) {
- return NULL;
+ return nullptr;
}
return SkBitmapSource::Create(bitmap, src, dst, filterQuality);
}
@@ -69,7 +69,7 @@ bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context&
const SkIRect dstIRect = dstRect.roundOut();
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstIRect.width(), dstIRect.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index ceb210d52d..9f10ff5250 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -36,7 +36,7 @@ void SkBlurDrawLooper::initEffects() {
fBlur = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, fSigma, flags);
} else {
- fBlur = NULL;
+ fBlur = nullptr;
}
if (fBlurFlags & kOverrideColor_BlurFlag) {
@@ -47,7 +47,7 @@ void SkBlurDrawLooper::initEffects() {
fColorFilter = SkColorFilter::CreateModeFilter(opaqueColor,
SkXfermode::kSrcIn_Mode);
} else {
- fColorFilter = NULL;
+ fColorFilter = nullptr;
}
}
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index 4d366fe9ff..0fc554fdd2 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -530,7 +530,7 @@ bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
dst->fRowBytes = dst->fBounds.width();
dst->fFormat = SkMask::kA8_Format;
- dst->fImage = NULL;
+ dst->fImage = nullptr;
if (src.fImage) {
size_t dstSize = dst->computeImageSize();
@@ -754,7 +754,7 @@ bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst,
dst->fRowBytes = dst->fBounds.width();
dst->fFormat = SkMask::kA8_Format;
- dst->fImage = NULL;
+ dst->fImage = nullptr;
int sw = SkScalarFloorToInt(src.width());
int sh = SkScalarFloorToInt(src.height());
@@ -769,7 +769,7 @@ bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst,
}
return true;
}
- uint8_t *profile = NULL;
+ uint8_t *profile = nullptr;
ComputeBlurProfile(sigma, &profile);
SkAutoTDeleteArray<uint8_t> ada(profile);
@@ -890,7 +890,7 @@ bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
dst->fRowBytes = dst->fBounds.width();
dst->fFormat = SkMask::kA8_Format;
- dst->fImage = NULL;
+ dst->fImage = nullptr;
if (src.fImage) {
diff --git a/src/effects/SkBlurMask.h b/src/effects/SkBlurMask.h
index 71f60d91fa..5c2a82ee1b 100644
--- a/src/effects/SkBlurMask.h
+++ b/src/effects/SkBlurMask.h
@@ -16,11 +16,11 @@
class SkBlurMask {
public:
static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src, SkBlurStyle,
- SkIPoint *margin = NULL,
+ SkIPoint *margin = nullptr,
SkMask::CreateMode createMode =
SkMask::kComputeBoundsAndRenderImage_CreateMode);
static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src, SkBlurStyle,
- SkIPoint *margin = NULL,
+ SkIPoint *margin = nullptr,
SkMask::CreateMode createMode =
SkMask::kComputeBoundsAndRenderImage_CreateMode);
@@ -32,12 +32,12 @@ public:
static bool BoxBlur(SkMask* dst, const SkMask& src,
SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
- SkIPoint* margin = NULL, bool force_quality=false);
+ SkIPoint* margin = nullptr, bool force_quality=false);
// the "ground truth" blur does a gaussian convolution; it's slow
// but useful for comparison purposes.
static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src, SkBlurStyle,
- SkIPoint* margin = NULL);
+ SkIPoint* margin = nullptr);
// If radius > 0, return the corresponding sigma, else return 0
static SkScalar ConvertRadiusToSigma(SkScalar radius);
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index dc2a40a30d..f2bcf3ed0d 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -125,13 +125,13 @@ const SkScalar SkBlurMaskFilterImpl::kMAX_BLUR_SIGMA = SkIntToScalar(128);
SkMaskFilter* SkBlurMaskFilter::Create(SkBlurStyle style, SkScalar sigma, uint32_t flags) {
if (!SkScalarIsFinite(sigma) || sigma <= 0) {
- return NULL;
+ return nullptr;
}
if ((unsigned)style > (unsigned)kLastEnum_SkBlurStyle) {
- return NULL;
+ return nullptr;
}
if (flags > SkBlurMaskFilter::kAll_BlurFlag) {
- return NULL;
+ return nullptr;
}
return new SkBlurMaskFilterImpl(sigma, style, flags);
}
@@ -192,14 +192,14 @@ bool SkBlurMaskFilterImpl::filterRRectMask(SkMask* dst, const SkRRect& r,
#include "SkCanvas.h"
static bool prepare_to_draw_into_mask(const SkRect& bounds, SkMask* mask) {
- SkASSERT(mask != NULL);
+ SkASSERT(mask != nullptr);
mask->fBounds = bounds.roundOut();
mask->fRowBytes = SkAlign4(mask->fBounds.width());
mask->fFormat = SkMask::kA8_Format;
const size_t size = mask->computeImageSize();
mask->fImage = SkMask::AllocImage(size);
- if (NULL == mask->fImage) {
+ if (nullptr == mask->fImage) {
return false;
}
@@ -316,7 +316,7 @@ SkMaskFilter::FilterReturn
SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& matrix,
const SkIRect& clipBounds,
NinePatch* patch) const {
- SkASSERT(patch != NULL);
+ SkASSERT(patch != nullptr);
switch (rrect.getType()) {
case SkRRect::kEmpty_Type:
// Nothing to draw.
@@ -353,7 +353,7 @@ SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
SkIPoint margin;
SkMask srcM, dstM;
srcM.fBounds = rrect.rect().roundOut();
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
srcM.fFormat = SkMask::kA8_Format;
srcM.fRowBytes = 0;
@@ -442,7 +442,7 @@ SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
patch->fOuterRect = dstM.fBounds;
patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1;
patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1;
- SkASSERT(NULL == patch->fCache);
+ SkASSERT(nullptr == patch->fCache);
patch->fCache = cache; // transfer ownership to patch
return kTrue_FilterReturn;
}
@@ -473,7 +473,7 @@ SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count,
SkIPoint margin;
SkMask srcM, dstM;
srcM.fBounds = rects[0].roundOut();
- srcM.fImage = NULL;
+ srcM.fImage = nullptr;
srcM.fFormat = SkMask::kA8_Format;
srcM.fRowBytes = 0;
@@ -572,7 +572,7 @@ SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count,
patch->fMask.fBounds.offsetTo(0, 0);
patch->fOuterRect = dstM.fBounds;
patch->fCenter = center;
- SkASSERT(NULL == patch->fCache);
+ SkASSERT(nullptr == patch->fCache);
patch->fCache = cache; // transfer ownership to patch
return kTrue_FilterReturn;
}
@@ -592,7 +592,7 @@ SkFlattenable* SkBlurMaskFilterImpl::CreateProc(SkReadBuffer& buffer) {
if (style <= kLastEnum_SkBlurStyle) {
return SkBlurMaskFilter::Create((SkBlurStyle)style, sigma, flags);
}
- return NULL;
+ return nullptr;
}
void SkBlurMaskFilterImpl::flatten(SkWriteBuffer& buffer) const {
@@ -616,21 +616,21 @@ public:
*/
static GrFragmentProcessor* Create(GrTextureProvider *textureProvider, const SkRect& rect,
float sigma) {
- GrTexture *blurProfileTexture = NULL;
+ GrTexture *blurProfileTexture = nullptr;
int doubleProfileSize = SkScalarCeilToInt(12*sigma);
if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.height()) {
// if the blur sigma is too large so the gaussian overlaps the whole
// rect in either direction, fall back to CPU path for now.
- return NULL;
+ return nullptr;
}
bool createdBlurProfileTexture = CreateBlurProfileTexture(
textureProvider, sigma, &blurProfileTexture);
SkAutoTUnref<GrTexture> hunref(blurProfileTexture);
if (!createdBlurProfileTexture) {
- return NULL;
+ return nullptr;
}
return new GrRectBlurEffect(rect, sigma, blurProfileTexture);
}
@@ -762,19 +762,19 @@ bool GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* textureProvid
builder[0] = profileSize;
builder.finish();
- uint8_t *profile = NULL;
- SkAutoTDeleteArray<uint8_t> ada(NULL);
+ uint8_t *profile = nullptr;
+ SkAutoTDeleteArray<uint8_t> ada(nullptr);
*blurProfileTexture = textureProvider->findAndRefTextureByUniqueKey(key);
- if (NULL == *blurProfileTexture) {
+ if (nullptr == *blurProfileTexture) {
SkBlurMask::ComputeBlurProfile(sigma, &profile);
ada.reset(profile);
*blurProfileTexture = textureProvider->createTexture(texDesc, true, profile, 0);
- if (NULL == *blurProfileTexture) {
+ if (nullptr == *blurProfileTexture) {
return false;
}
textureProvider->assignUniqueKeyToTexture(key, *blurProfileTexture);
@@ -906,7 +906,7 @@ private:
GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, float sigma,
const SkRRect& rrect) {
if (!rrect.isSimpleCircular()) {
- return NULL;
+ return nullptr;
}
// Make sure we can successfully ninepatch this rrect -- the blur sigma has to be
@@ -917,7 +917,7 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, f
unsigned int cornerRadius = SkScalarCeilToInt(rrect.getSimpleRadii().x());
if (cornerRadius + blurRadius > rrect.width()/2 ||
cornerRadius + blurRadius > rrect.height()/2) {
- return NULL;
+ return nullptr;
}
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
@@ -951,12 +951,12 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, f
SkPath path;
path.addRRect( smallRRect );
- SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask,
+ SkDraw::DrawToMask(path, &mask.fBounds, nullptr, nullptr, &mask,
SkMask::kJustRenderImage_CreateMode, SkPaint::kFill_Style);
SkMask blurredMask;
SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHigh_SkBlurQuality,
- NULL, true );
+ nullptr, true );
unsigned int texSide = smallRectSide + 2*blurRadius;
GrSurfaceDesc texDesc;
@@ -968,7 +968,7 @@ GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, f
texProvider->createTexture(texDesc, true, blurredMask.fImage, 0));
SkMask::FreeImage(blurredMask.fImage);
if (!blurNinePatchTexture) {
- return NULL;
+ return nullptr;
}
texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture);
}
@@ -1165,7 +1165,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
return false;
}
- if (NULL == maskRect) {
+ if (nullptr == maskRect) {
// don't need to compute maskRect
return true;
}
@@ -1202,7 +1202,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
*result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOverwriteSrc,
clipRect, false, xformedSigma, xformedSigma);
- if (NULL == *result) {
+ if (nullptr == *result) {
return false;
}
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index d1857f991b..c5d4fc5a35 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -43,12 +43,12 @@ static const int MAX_CUBE_SIZE = 64;
static bool is_valid_3D_lut(SkData* cubeData, int cubeDimension) {
size_t minMemorySize = sizeof(uint8_t) * 4 * cubeDimension * cubeDimension * cubeDimension;
return (cubeDimension >= MIN_CUBE_SIZE) && (cubeDimension <= MAX_CUBE_SIZE) &&
- (NULL != cubeData) && (cubeData->size() >= minMemorySize);
+ (nullptr != cubeData) && (cubeData->size() >= minMemorySize);
}
SkColorFilter* SkColorCubeFilter::Create(SkData* cubeData, int cubeDimension) {
if (!is_valid_3D_lut(cubeData, cubeDimension)) {
- return NULL;
+ return nullptr;
}
return new SkColorCubeFilter(cubeData, cubeDimension);
@@ -67,9 +67,9 @@ uint32_t SkColorCubeFilter::getFlags() const {
SkColorCubeFilter::ColorCubeProcesingCache::ColorCubeProcesingCache(int cubeDimension)
: fCubeDimension(cubeDimension)
, fLutsInited(false) {
- fColorToIndex[0] = fColorToIndex[1] = NULL;
- fColorToFactors[0] = fColorToFactors[1] = NULL;
- fColorToScalar = NULL;
+ fColorToIndex[0] = fColorToIndex[1] = nullptr;
+ fColorToFactors[0] = fColorToFactors[1] = nullptr;
+ fColorToScalar = nullptr;
}
void SkColorCubeFilter::ColorCubeProcesingCache::getProcessingLuts(
@@ -77,11 +77,11 @@ void SkColorCubeFilter::ColorCubeProcesingCache::getProcessingLuts(
const SkScalar** colorToScalar) {
SkOnce(&fLutsInited, &fLutsMutex,
SkColorCubeFilter::ColorCubeProcesingCache::initProcessingLuts, this);
- SkASSERT((fColorToIndex[0] != NULL) &&
- (fColorToIndex[1] != NULL) &&
- (fColorToFactors[0] != NULL) &&
- (fColorToFactors[1] != NULL) &&
- (fColorToScalar != NULL));
+ SkASSERT((fColorToIndex[0] != nullptr) &&
+ (fColorToIndex[1] != nullptr) &&
+ (fColorToFactors[0] != nullptr) &&
+ (fColorToFactors[1] != nullptr) &&
+ (fColorToScalar != nullptr));
(*colorToIndex)[0] = fColorToIndex[0];
(*colorToIndex)[1] = fColorToIndex[1];
(*colorToFactors)[0] = fColorToFactors[0];
@@ -138,7 +138,7 @@ SkFlattenable* SkColorCubeFilter::CreateProc(SkReadBuffer& buffer) {
int cubeDimension = buffer.readInt();
SkAutoDataUnref cubeData(buffer.readByteArrayAsData());
if (!buffer.validate(is_valid_3D_lut(cubeData, cubeDimension))) {
- return NULL;
+ return nullptr;
}
return Create(cubeData, cubeDimension);
}
@@ -161,7 +161,7 @@ void SkColorCubeFilter::toString(SkString* str) const {
class GrColorCubeEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(GrTexture* colorCube) {
- return (NULL != colorCube) ? new GrColorCubeEffect(colorCube) : NULL;
+ return (nullptr != colorCube) ? new GrColorCubeEffect(colorCube) : nullptr;
}
virtual ~GrColorCubeEffect();
@@ -239,7 +239,7 @@ GrColorCubeEffect::GLProcessor::~GLProcessor() {
}
void GrColorCubeEffect::GLProcessor::emitCode(EmitArgs& args) {
- if (NULL == args.fInputColor) {
+ if (nullptr == args.fInputColor) {
args.fInputColor = "vec4(1)";
}
@@ -327,13 +327,13 @@ bool SkColorCubeFilter::asFragmentProcessors(GrContext* context, GrProcessorData
}
}
- GrFragmentProcessor* frag = textureCube ? GrColorCubeEffect::Create(textureCube) : NULL;
+ GrFragmentProcessor* frag = textureCube ? GrColorCubeEffect::Create(textureCube) : nullptr;
if (frag) {
if (array) {
*array->append() = frag;
} else {
frag->unref();
- SkDEBUGCODE(frag = NULL;)
+ SkDEBUGCODE(frag = nullptr;)
}
return true;
}
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 20dee8e639..e5f64ce2f9 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -17,8 +17,8 @@
SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf,
SkImageFilter* input, const CropRect* cropRect) {
- if (NULL == cf) {
- return NULL;
+ if (nullptr == cf) {
+ return nullptr;
}
SkColorFilter* inputCF;
@@ -71,7 +71,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device.get());
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index 5560183153..c3fa730d00 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -132,7 +132,7 @@ public:
SkXfermode::Coeff srcCoeff, dstCoeff;
if (!SkXfermode::ModeAsCoeff(mode, &srcCoeff, &dstCoeff)) {
// SkDebugf("Failing to create color filter for mode %d\n", mode);
- return NULL;
+ return nullptr;
}
return new ModeColorFilterEffect(c, mode);
}
@@ -161,7 +161,7 @@ public:
SkXfermode::Mode mode = args.fFp.cast<ModeColorFilterEffect>().mode();
SkASSERT(SkXfermode::kDst_Mode != mode);
- const char* colorFilterColorUniName = NULL;
+ const char* colorFilterColorUniName = nullptr;
if (args.fFp.cast<ModeColorFilterEffect>().willUseFilterColor()) {
fFilterColorUni = args.fBuilder->addUniform(
GrGLProgramBuilder::kFragment_Visibility,
@@ -363,7 +363,7 @@ bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*
*array->append() = frag;
} else {
frag->unref();
- SkDEBUGCODE(frag = NULL;)
+ SkDEBUGCODE(frag = nullptr;)
}
return true;
}
@@ -403,7 +403,7 @@ private:
SkColorFilter* SkColorFilter::CreateModeFilter(SkColor color, SkXfermode::Mode mode) {
if (!SkIsValidMode(mode)) {
- return NULL;
+ return nullptr;
}
unsigned alpha = SkColorGetA(color);
@@ -431,7 +431,7 @@ SkColorFilter* SkColorFilter::CreateModeFilter(SkColor color, SkXfermode::Mode m
SkXfermode::kXor_Mode == mode ||
SkXfermode::kDarken_Mode == mode)) ||
(0xFF == alpha && SkXfermode::kDstIn_Mode == mode)) {
- return NULL;
+ return nullptr;
}
switch (mode) {
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 46c9b26298..8dc603042c 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -197,7 +197,7 @@ void SkColorMatrixFilter::initState(const SkScalar* SK_RESTRICT src) {
array[SkColorMatrix::kB_Trans]) {
fProc = shiftIs16 ? Add16 : Add;
} else {
- fProc = NULL; // identity
+ fProc = nullptr; // identity
}
}
@@ -262,7 +262,7 @@ static Sk4f clamp_0_1(const Sk4f& value) {
void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const {
Proc proc = fProc;
- if (NULL == proc) {
+ if (nullptr == proc) {
if (src != dst) {
memcpy(dst, src, count * sizeof(SkPMColor));
}
@@ -360,7 +360,7 @@ SkFlattenable* SkColorMatrixFilter::CreateProc(SkReadBuffer& buffer) {
if (buffer.readScalarArray(matrix.fMat, 20)) {
return Create(matrix);
}
- return NULL;
+ return nullptr;
}
bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const {
@@ -377,7 +377,7 @@ SkColorFilter* SkColorMatrixFilter::newComposed(const SkColorFilter* innerFilter
SkColorMatrix::SetConcat(concat, fMatrix.fMat, innerMatrix);
return SkColorMatrixFilter::Create(concat);
}
- return NULL;
+ return nullptr;
}
#if SK_SUPPORT_GPU
@@ -411,7 +411,7 @@ public:
kVec4f_GrSLType, kDefault_GrSLPrecision,
"ColorMatrixVector");
- if (NULL == args.fInputColor) {
+ if (nullptr == args.fInputColor) {
// could optimize this case, but we aren't for now.
args.fInputColor = "vec4(1)";
}
@@ -542,7 +542,7 @@ bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrProcessorDataManage
*array->append() = frag;
} else {
frag->unref();
- SkDEBUGCODE(frag = NULL;)
+ SkDEBUGCODE(frag = nullptr;)
}
return true;
}
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 62e6771356..2927f970aa 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -58,7 +58,7 @@ static void outset_for_stroke(SkRect* rect, const SkStrokeRec& rec) {
static bool cull_line(SkPoint* pts, const SkStrokeRec& rec,
const SkMatrix& ctm, const SkRect* cullRect,
const SkScalar intervalLength) {
- if (NULL == cullRect) {
+ if (nullptr == cullRect) {
SkASSERT(false); // Shouldn't ever occur in practice
return false;
}
@@ -367,7 +367,7 @@ SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) {
if (buffer.readScalarArray(intervals.get(), count)) {
return Create(intervals.get(), SkToInt(count), phase);
}
- return NULL;
+ return nullptr;
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 62fca7b14d..9044284300 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -169,7 +169,7 @@ SkDisplacementMapEffect* SkDisplacementMapEffect::Create(ChannelSelectorType xCh
const CropRect* cropRect) {
if (!channel_selector_type_is_valid(xChannelSelector) ||
!channel_selector_type_is_valid(yChannelSelector)) {
- return NULL;
+ return nullptr;
}
SkImageFilter* inputs[2] = { displacement, color };
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index fb3ea319c6..c856bd17e8 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -68,7 +68,7 @@ bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device.get());
diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp
index fcb6a2a607..2607e255d9 100644
--- a/src/effects/SkEmbossMaskFilter.cpp
+++ b/src/effects/SkEmbossMaskFilter.cpp
@@ -35,8 +35,8 @@ SkMaskFilter* SkBlurMaskFilter::CreateEmboss(const SkScalar direction[3],
SkMaskFilter* SkBlurMaskFilter::CreateEmboss(SkScalar blurSigma, const SkScalar direction[3],
SkScalar ambient, SkScalar specular) {
- if (direction == NULL) {
- return NULL;
+ if (direction == nullptr) {
+ return nullptr;
}
// ambient should be 0...1 as a scalar
@@ -87,7 +87,7 @@ bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src,
margin->set(SkScalarCeilToInt(3*sigma), SkScalarCeilToInt(3*sigma));
}
- if (src.fImage == NULL) {
+ if (src.fImage == nullptr) {
return true;
}
@@ -131,7 +131,7 @@ SkFlattenable* SkEmbossMaskFilter::CreateProc(SkReadBuffer& buffer) {
const SkScalar sigma = buffer.readScalar();
return Create(sigma, light);
}
- return NULL;
+ return nullptr;
}
void SkEmbossMaskFilter::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 2b6b310819..8b0e5fb799 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -192,11 +192,11 @@ GrTexture* GaussianBlur(GrContext* context,
tempTexture = temp2.get();
}
- if (NULL == dstTexture || NULL == tempTexture) {
- return NULL;
+ if (nullptr == dstTexture || nullptr == tempTexture) {
+ return nullptr;
}
- GrDrawContext* srcDrawContext = NULL;
+ GrDrawContext* srcDrawContext = nullptr;
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
GrPaint paint;
@@ -226,7 +226,7 @@ GrTexture* GaussianBlur(GrContext* context,
GrDrawContext* dstDrawContext = context->drawContext();
if (!dstDrawContext) {
- return NULL;
+ return nullptr;
}
dstDrawContext->drawNonAARectToRect(dstTexture->asRenderTarget(), clip, paint,
SkMatrix::I(), dstRect, srcRect);
@@ -249,7 +249,7 @@ GrTexture* GaussianBlur(GrContext* context,
GrDrawContext* dstDrawContext = context->drawContext();
if (!dstDrawContext) {
- return NULL;
+ return nullptr;
}
convolve_gaussian_2d(dstDrawContext, dstTexture->asRenderTarget(), clip, srcRect, dstRect,
srcTexture, radiusX, radiusY, sigmaX, sigmaY, cropToRect, srcIRect);
@@ -266,7 +266,7 @@ GrTexture* GaussianBlur(GrContext* context,
if (!srcDrawContext) {
srcDrawContext = context->drawContext();
if (!srcDrawContext) {
- return NULL;
+ return nullptr;
}
}
@@ -280,7 +280,7 @@ GrTexture* GaussianBlur(GrContext* context,
GrDrawContext* dstDrawContext = context->drawContext();
if (!dstDrawContext) {
- return NULL;
+ return nullptr;
}
convolve_gaussian(dstDrawContext, dstTexture->asRenderTarget(), clip, srcRect, dstRect,
srcTexture, Gr1DKernelEffect::kX_Direction, radiusX, sigmaX,
@@ -298,7 +298,7 @@ GrTexture* GaussianBlur(GrContext* context,
if (!srcDrawContext) {
srcDrawContext = context->drawContext();
if (!srcDrawContext) {
- return NULL;
+ return nullptr;
}
}
@@ -313,7 +313,7 @@ GrTexture* GaussianBlur(GrContext* context,
GrDrawContext* dstDrawContext = context->drawContext();
if (!dstDrawContext) {
- return NULL;
+ return nullptr;
}
convolve_gaussian(dstDrawContext, dstTexture->asRenderTarget(), clip, srcRect,
dstRect, srcTexture, Gr1DKernelEffect::kY_Direction, radiusY, sigmaY,
@@ -350,7 +350,7 @@ GrTexture* GaussianBlur(GrContext* context,
GrDrawContext* dstDrawContext = context->drawContext();
if (!dstDrawContext) {
- return NULL;
+ return nullptr;
}
dstDrawContext->drawNonAARectToRect(dstTexture->asRenderTarget(), clip, paint,
SkMatrix::I(), dstRect, srcRect);
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index 622088ff73..b5f26a3811 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -22,8 +22,8 @@ SkLayerDrawLooper::LayerInfo::LayerInfo() {
}
SkLayerDrawLooper::SkLayerDrawLooper()
- : fRecs(NULL),
- fTopRec(NULL),
+ : fRecs(nullptr),
+ fTopRec(nullptr),
fCount(0) {
}
@@ -134,7 +134,7 @@ SkLayerDrawLooper::LayerDrawLooperContext::LayerDrawLooperContext(
bool SkLayerDrawLooper::LayerDrawLooperContext::next(SkCanvas* canvas,
SkPaint* paint) {
canvas->restore();
- if (NULL == fCurrRec) {
+ if (nullptr == fCurrRec) {
return false;
}
@@ -167,7 +167,7 @@ bool SkLayerDrawLooper::asABlurShadow(BlurShadowRec* bsRec) const {
return false;
}
const SkMaskFilter* mf = rec->fPaint.getMaskFilter();
- if (NULL == mf) {
+ if (nullptr == mf) {
return false;
}
SkMaskFilter::BlurRec maskBlur;
@@ -293,8 +293,8 @@ void SkLayerDrawLooper::toString(SkString* str) const {
#endif
SkLayerDrawLooper::Builder::Builder()
- : fRecs(NULL),
- fTopRec(NULL),
+ : fRecs(nullptr),
+ fTopRec(nullptr),
fCount(0) {
}
@@ -314,7 +314,7 @@ SkPaint* SkLayerDrawLooper::Builder::addLayer(const LayerInfo& info) {
rec->fNext = fRecs;
rec->fInfo = info;
fRecs = rec;
- if (NULL == fTopRec) {
+ if (nullptr == fTopRec) {
fTopRec = rec;
}
@@ -332,9 +332,9 @@ SkPaint* SkLayerDrawLooper::Builder::addLayerOnTop(const LayerInfo& info) {
fCount += 1;
Rec* rec = new Rec;
- rec->fNext = NULL;
+ rec->fNext = nullptr;
rec->fInfo = info;
- if (NULL == fRecs) {
+ if (nullptr == fRecs) {
fRecs = rec;
} else {
SkASSERT(fTopRec);
@@ -351,8 +351,8 @@ SkLayerDrawLooper* SkLayerDrawLooper::Builder::detachLooper() {
looper->fRecs = fRecs;
fCount = 0;
- fRecs = NULL;
- fTopRec = NULL;
+ fRecs = nullptr;
+ fTopRec = nullptr;
return looper;
}
diff --git a/src/effects/SkLayerRasterizer.cpp b/src/effects/SkLayerRasterizer.cpp
index d5ebb24a74..6c08afc6f5 100644
--- a/src/effects/SkLayerRasterizer.cpp
+++ b/src/effects/SkLayerRasterizer.cpp
@@ -36,7 +36,7 @@ static void clean_up_layers(SkDeque* layers) {
SkDeque::F2BIter iter(*layers);
SkLayerRasterizer_Rec* rec;
- while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL)
+ while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr)
rec->fPaint.~SkPaint();
delete layers;
@@ -55,7 +55,7 @@ static bool compute_bounds(const SkDeque& layers, const SkPath& path,
bounds->set(SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32);
- while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) {
+ while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) {
const SkPaint& paint = rec->fPaint;
SkPath fillPath, devPath;
const SkPath* p = &path;
@@ -136,7 +136,7 @@ bool SkLayerRasterizer::onRasterize(const SkPath& path, const SkMatrix& matrix,
SkDeque::F2BIter iter(*fLayers);
SkLayerRasterizer_Rec* rec;
- while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) {
+ while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) {
drawMatrix = translatedMatrix;
drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY);
draw.drawPath(path, rec->fPaint);
@@ -172,7 +172,7 @@ void SkLayerRasterizer::flatten(SkWriteBuffer& buffer) const {
SkDeque::F2BIter iter(*fLayers);
const SkLayerRasterizer_Rec* rec;
- while ((rec = (const SkLayerRasterizer_Rec*)iter.next()) != NULL) {
+ while ((rec = (const SkLayerRasterizer_Rec*)iter.next()) != nullptr) {
buffer.writePaint(rec->fPaint);
buffer.writePoint(rec->fOffset);
}
@@ -182,7 +182,7 @@ SkLayerRasterizer::Builder::Builder() : fLayers(new SkDeque(sizeof(SkLayerRaster
SkLayerRasterizer::Builder::~Builder()
{
- if (fLayers != NULL) {
+ if (fLayers != nullptr) {
clean_up_layers(fLayers);
}
}
@@ -199,24 +199,24 @@ void SkLayerRasterizer::Builder::addLayer(const SkPaint& paint, SkScalar dx,
SkLayerRasterizer* SkLayerRasterizer::Builder::detachRasterizer() {
SkLayerRasterizer* rasterizer;
if (0 == fLayers->count()) {
- rasterizer = NULL;
+ rasterizer = nullptr;
delete fLayers;
} else {
rasterizer = new SkLayerRasterizer(fLayers);
}
- fLayers = NULL;
+ fLayers = nullptr;
return rasterizer;
}
SkLayerRasterizer* SkLayerRasterizer::Builder::snapshotRasterizer() const {
if (0 == fLayers->count()) {
- return NULL;
+ return nullptr;
}
SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec), fLayers->count());
SkDeque::F2BIter iter(*fLayers);
const SkLayerRasterizer_Rec* recOrig;
SkDEBUGCODE(int count = 0;)
- while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != NULL) {
+ while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullptr) {
SkDEBUGCODE(count++);
SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(layers->push_back());
new (&recCopy->fPaint) SkPaint(recOrig->fPaint);
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 2bb1582a3c..dd56751382 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -754,7 +754,7 @@ public:
return new GrGLDistantLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
- return NULL;
+ return nullptr;
#endif
}
bool requiresFragmentPosition() const override { return false; }
@@ -813,7 +813,7 @@ public:
return new GrGLPointLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
- return NULL;
+ return nullptr;
#endif
}
bool requiresFragmentPosition() const override { return true; }
@@ -927,7 +927,7 @@ public:
return new GrGLSpotLight;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
- return NULL;
+ return nullptr;
#endif
}
bool requiresFragmentPosition() const override { return true; }
@@ -1039,7 +1039,7 @@ void SkImageFilterLight::flattenLight(SkWriteBuffer& buffer) const {
default:
SkDEBUGFAIL("Unknown LightType.");
buffer.validate(false);
- return NULL;
+ return nullptr;
}
}
///////////////////////////////////////////////////////////////////////////////
@@ -1137,16 +1137,16 @@ SkImageFilter* SkDiffuseLightingImageFilter::Create(SkImageFilterLight* light,
SkScalar kd,
SkImageFilter* input,
const CropRect* cropRect) {
- if (NULL == light) {
- return NULL;
+ if (nullptr == light) {
+ return nullptr;
}
if (!SkScalarIsFinite(surfaceScale) || !SkScalarIsFinite(kd)) {
- return NULL;
+ return nullptr;
}
// According to the spec, kd can be any non-negative number :
// http://www.w3.org/TR/SVG/filters.html#feDiffuseLightingElement
if (kd < 0) {
- return NULL;
+ return nullptr;
}
return new SkDiffuseLightingImageFilter(light, surfaceScale, kd, input, cropRect);
}
@@ -1275,16 +1275,16 @@ SkImageFilter* SkSpecularLightingImageFilter::Create(SkImageFilterLight* light,
SkScalar shininess,
SkImageFilter* input,
const CropRect* cropRect) {
- if (NULL == light) {
- return NULL;
+ if (nullptr == light) {
+ return nullptr;
}
if (!SkScalarIsFinite(surfaceScale) || !SkScalarIsFinite(ks) || !SkScalarIsFinite(shininess)) {
- return NULL;
+ return nullptr;
}
// According to the spec, ks can be any non-negative number :
// http://www.w3.org/TR/SVG/filters.html#feSpecularLightingElement
if (ks < 0) {
- return NULL;
+ return nullptr;
}
return new SkSpecularLightingImageFilter(light, surfaceScale, ks, shininess, input, cropRect);
}
@@ -1433,7 +1433,7 @@ SkImageFilterLight* create_random_light(SkRandom* random) {
}
default:
SkFAIL("Unexpected value.");
- return NULL;
+ return nullptr;
}
}
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index caa2a208d2..21f7c0528d 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -68,7 +68,7 @@ public:
static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder* b) {}
virtual void emitCode(EmitArgs& args) override {
- if (NULL == args.fInputColor) {
+ if (nullptr == args.fInputColor) {
args.fInputColor = "vec4(1)";
}
@@ -117,7 +117,7 @@ bool SkLumaColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*
*array->append() = frag;
} else {
frag->unref();
- SkDEBUGCODE(frag = NULL;)
+ SkDEBUGCODE(frag = nullptr;)
}
return true;
}
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 8bebd20aa9..1e1ec45f70 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -245,11 +245,11 @@ SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in
SkImageFilter* input) {
if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
- return NULL;
+ return nullptr;
}
// Negative numbers in src rect are not supported
if (srcRect.fLeft < 0 || srcRect.fTop < 0) {
- return NULL;
+ return nullptr;
}
return new SkMagnifierImageFilter(srcRect, inset, input);
}
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 1c44fed4e2..c2ad9ead2f 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -57,17 +57,17 @@ SkMatrixConvolutionImageFilter* SkMatrixConvolutionImageFilter::Create(
SkImageFilter* input,
const CropRect* cropRect) {
if (kernelSize.width() < 1 || kernelSize.height() < 1) {
- return NULL;
+ return nullptr;
}
if (gMaxKernelSize / kernelSize.fWidth < kernelSize.fHeight) {
- return NULL;
+ return nullptr;
}
if (!kernel) {
- return NULL;
+ return nullptr;
}
if ((kernelOffset.fX < 0) || (kernelOffset.fX >= kernelSize.fWidth) ||
(kernelOffset.fY < 0) || (kernelOffset.fY >= kernelSize.fHeight)) {
- return NULL;
+ return nullptr;
}
return new SkMatrixConvolutionImageFilter(kernelSize, kernel, gain, bias, kernelOffset,
tileMode, convolveAlpha, input, cropRect);
@@ -82,11 +82,11 @@ SkFlattenable* SkMatrixConvolutionImageFilter::CreateProc(SkReadBuffer& buffer)
const int64_t kernelArea = sk_64_mul(kernelSize.width(), kernelSize.height());
if (!buffer.validate(kernelArea == count)) {
- return NULL;
+ return nullptr;
}
SkAutoSTArray<16, SkScalar> kernel(count);
if (!buffer.readScalarArray(kernel.get(), count)) {
- return NULL;
+ return nullptr;
}
SkScalar gain = buffer.readScalar();
SkScalar bias = buffer.readScalar();
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 4c5404d5fb..6e06b25945 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -24,7 +24,7 @@ void SkMergeImageFilter::initAllocModes() {
fModes = SkTCast<uint8_t*>(sk_malloc_throw(size));
}
} else {
- fModes = NULL;
+ fModes = nullptr;
}
}
@@ -36,7 +36,7 @@ void SkMergeImageFilter::initModes(const SkXfermode::Mode modes[]) {
fModes[i] = SkToU8(modes[i]);
}
} else {
- fModes = NULL;
+ fModes = nullptr;
}
}
@@ -71,7 +71,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const int y0 = bounds.top();
SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
SkCanvas canvas(dst);
@@ -96,7 +96,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
if (fModes) {
paint.setXfermodeMode((SkXfermode::Mode)fModes[i]);
} else {
- paint.setXfermode(NULL);
+ paint.setXfermode(nullptr);
}
canvas.drawSprite(*srcPtr, pos.x() - x0, pos.y() - y0, &paint);
didProduceResult = true;
@@ -114,7 +114,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
SkFlattenable* SkMergeImageFilter::CreateProc(SkReadBuffer& buffer) {
Common common;
if (!common.unflatten(buffer, -1)) {
- return NULL;
+ return nullptr;
}
const int count = common.inputCount();
@@ -123,23 +123,23 @@ SkFlattenable* SkMergeImageFilter::CreateProc(SkReadBuffer& buffer) {
SkAutoSTArray<4, SkXfermode::Mode> modes(count);
SkAutoSTArray<4, uint8_t> modes8(count);
if (!buffer.readByteArray(modes8.get(), count)) {
- return NULL;
+ return nullptr;
}
for (int i = 0; i < count; ++i) {
modes[i] = (SkXfermode::Mode)modes8[i];
buffer.validate(SkIsValidMode(modes[i]));
}
if (!buffer.isValid()) {
- return NULL;
+ return nullptr;
}
return Create(common.inputs(), count, modes.get(), &common.cropRect());
}
- return Create(common.inputs(), count, NULL, &common.cropRect());
+ return Create(common.inputs(), count, nullptr, &common.cropRect());
}
void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeBool(fModes != NULL);
+ buffer.writeBool(fModes != nullptr);
if (fModes) {
buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index b8efd2dcc8..cde29c0f4c 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -570,7 +570,7 @@ bool apply_morphology(const SkBitmap& input,
if (radius.fWidth > 0) {
GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
- if (NULL == scratch) {
+ if (nullptr == scratch) {
return false;
}
GrDrawContext* dstDrawContext = context->drawContext();
@@ -593,7 +593,7 @@ bool apply_morphology(const SkBitmap& input,
}
if (radius.fHeight > 0) {
GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
- if (NULL == scratch) {
+ if (nullptr == scratch) {
return false;
}
GrDrawContext* dstDrawContext = context->drawContext();
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp
index 1944e58922..551902b7da 100644
--- a/src/effects/SkOffsetImageFilter.cpp
+++ b/src/effects/SkOffsetImageFilter.cpp
@@ -47,7 +47,7 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device);
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 2ca86c70f5..af6622be4d 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -272,7 +272,7 @@ SkPerlinNoiseShader::SkPerlinNoiseShader(SkPerlinNoiseShader::Type type,
, fBaseFrequencyY(baseFrequencyY)
, fNumOctaves(numOctaves > 255 ? 255 : numOctaves/*[0,255] octaves allowed*/)
, fSeed(seed)
- , fTileSize(NULL == tileSize ? SkISize::Make(0, 0) : *tileSize)
+ , fTileSize(nullptr == tileSize ? SkISize::Make(0, 0) : *tileSize)
, fStitchTiles(!fTileSize.isEmpty())
{
SkASSERT(numOctaves >= 0 && numOctaves < 256);
@@ -297,7 +297,7 @@ SkFlattenable* SkPerlinNoiseShader::CreateProc(SkReadBuffer& buffer) {
case kTurbulence_Type:
return SkPerlinNoiseShader::CreateTubulence(freqX, freqY, octaves, seed, &tileSize);
default:
- return NULL;
+ return nullptr;
}
}
@@ -607,16 +607,16 @@ GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* d) {
SkShader* shader = d->fRandom->nextBool() ?
SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed,
- stitchTiles ? &tileSize : NULL) :
+ stitchTiles ? &tileSize : nullptr) :
SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed,
- stitchTiles ? &tileSize : NULL);
+ stitchTiles ? &tileSize : nullptr);
SkPaint paint;
GrColor paintColor;
GrFragmentProcessor* effect;
GrPaint grPaint;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, grPaint.getProcessorDataManager(),
&effect));
@@ -644,7 +644,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
"alpha");
const char* alphaUni = args.fBuilder->getUniformCStr(fAlphaUni);
- const char* stitchDataUni = NULL;
+ const char* stitchDataUni = nullptr;
if (fStitchTiles) {
fStitchDataUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
@@ -966,9 +966,9 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
SkPerlinNoiseShader::PaintingData* paintingData =
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
SkAutoTUnref<GrTexture> permutationsTexture(
- GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), NULL));
+ GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), nullptr));
SkAutoTUnref<GrTexture> noiseTexture(
- GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), NULL));
+ GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), nullptr));
SkMatrix m = viewM;
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
@@ -983,7 +983,7 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
m, paint.getAlpha());
} else {
delete paintingData;
- *fp = NULL;
+ *fp = nullptr;
}
return true;
}
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp
index bf1ba8d7eb..d85024e225 100644
--- a/src/effects/SkPictureImageFilter.cpp
+++ b/src/effects/SkPictureImageFilter.cpp
@@ -14,7 +14,7 @@
#include "SkValidationUtils.h"
SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture)
- : INHERITED(0, 0, NULL)
+ : INHERITED(0, 0, nullptr)
, fPicture(SkSafeRef(picture))
, fCropRect(picture ? picture->cullRect() : SkRect::MakeEmpty())
, fPictureResolution(kDeviceSpace_PictureResolution)
@@ -24,7 +24,7 @@ SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture)
SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect,
PictureResolution pictureResolution,
SkFilterQuality filterQuality)
- : INHERITED(0, 0, NULL)
+ : INHERITED(0, 0, nullptr)
, fPicture(SkSafeRef(picture))
, fCropRect(cropRect)
, fPictureResolution(pictureResolution)
@@ -71,7 +71,7 @@ void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnabled()) {
buffer.writeBool(false);
} else {
- bool hasPicture = (fPicture != NULL);
+ bool hasPicture = (fPicture != nullptr);
buffer.writeBool(hasPicture);
if (hasPicture) {
fPicture->flatten(buffer);
@@ -104,7 +104,7 @@ bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Co
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index 6309d35f45..f9e70705c5 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -20,16 +20,16 @@ SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe
flags = 0x0;
}
CropRect cropRect(rect, flags);
- return s ? new SkRectShaderImageFilter(s, &cropRect) : NULL;
+ return s ? new SkRectShaderImageFilter(s, &cropRect) : nullptr;
}
SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect) {
SkASSERT(s);
- return s ? new SkRectShaderImageFilter(s, cropRect) : NULL;
+ return s ? new SkRectShaderImageFilter(s, cropRect) : nullptr;
}
SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect)
- : INHERITED(0, NULL, cropRect)
+ : INHERITED(0, nullptr, cropRect)
, fShader(SkRef(s)) {
}
@@ -60,7 +60,7 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(),
bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device.get());
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index e20f92292a..f0245b7cfa 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -17,7 +17,7 @@ class SkTable_ColorFilter : public SkColorFilter {
public:
SkTable_ColorFilter(const uint8_t tableA[], const uint8_t tableR[],
const uint8_t tableG[], const uint8_t tableB[]) {
- fBitmap = NULL;
+ fBitmap = nullptr;
fFlags = 0;
uint8_t* dst = fStorage;
@@ -215,10 +215,10 @@ SkFlattenable* SkTable_ColorFilter::CreateProc(SkReadBuffer& buffer) {
uint8_t packedStorage[5*256];
size_t packedSize = buffer.getArrayCount();
if (!buffer.validate(packedSize <= sizeof(packedStorage))) {
- return NULL;
+ return nullptr;
}
if (!buffer.readByteArray(packedStorage, packedSize)) {
- return NULL;
+ return nullptr;
}
uint8_t unpackedStorage[4*256];
@@ -226,13 +226,13 @@ SkFlattenable* SkTable_ColorFilter::CreateProc(SkReadBuffer& buffer) {
unpackedStorage, sizeof(unpackedStorage));
// now check that we got the size we expected
if (!buffer.validate(unpackedSize == count*256)) {
- return NULL;
+ return nullptr;
}
- const uint8_t* a = NULL;
- const uint8_t* r = NULL;
- const uint8_t* g = NULL;
- const uint8_t* b = NULL;
+ const uint8_t* a = nullptr;
+ const uint8_t* r = nullptr;
+ const uint8_t* g = nullptr;
+ const uint8_t* b = nullptr;
const uint8_t* ptr = unpackedStorage;
if (flags & kA_Flag) {
@@ -256,7 +256,7 @@ SkFlattenable* SkTable_ColorFilter::CreateProc(SkReadBuffer& buffer) {
bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const {
if (table) {
- if (NULL == fBitmap) {
+ if (nullptr == fBitmap) {
SkBitmap* bmp = new SkBitmap;
bmp->allocPixels(SkImageInfo::MakeA8(256, 4));
uint8_t* bitmapPixels = bmp->getAddr8(0, 0);
@@ -290,12 +290,12 @@ static void combine_tables(uint8_t res[256], const uint8_t outer[256], const uin
SkColorFilter* SkTable_ColorFilter::newComposed(const SkColorFilter* innerFilter) const {
SkBitmap innerBM;
if (!innerFilter->asComponentTable(&innerBM)) {
- return NULL;
+ return nullptr;
}
innerBM.lockPixels();
- if (NULL == innerBM.getPixels()) {
- return NULL;
+ if (nullptr == innerBM.getPixels()) {
+ return nullptr;
}
const uint8_t* table = fStorage;
@@ -419,7 +419,7 @@ void GLColorTableEffect::emitCode(EmitArgs& args) {
static const float kColorScaleFactor = 255.0f / 256.0f;
static const float kColorOffsetFactor = 1.0f / 512.0f;
GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
- if (NULL == args.fInputColor) {
+ if (nullptr == args.fInputColor) {
// the input color is solid white (all ones).
static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
fsBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
@@ -473,9 +473,9 @@ GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap bitma
int row = atlas->lockRow(bitmap);
SkAutoTUnref<GrTexture> texture;
if (-1 == row) {
- atlas = NULL;
- // Passing params=NULL because this effect does no tiling or filtering.
- texture.reset(GrRefCachedBitmapTexture(context, bitmap, NULL));
+ atlas = nullptr;
+ // Passing params=nullptr because this effect does no tiling or filtering.
+ texture.reset(GrRefCachedBitmapTexture(context, bitmap, nullptr));
} else {
texture.reset(SkRef(atlas->getTexture()));
}
@@ -557,10 +557,10 @@ GrFragmentProcessor* ColorTableEffect::TestCreate(GrProcessorTestData* d) {
}
}
SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB(
- (flags & (1 << 0)) ? luts[0] : NULL,
- (flags & (1 << 1)) ? luts[1] : NULL,
- (flags & (1 << 2)) ? luts[2] : NULL,
- (flags & (1 << 3)) ? luts[3] : NULL
+ (flags & (1 << 0)) ? luts[0] : nullptr,
+ (flags & (1 << 1)) ? luts[1] : nullptr,
+ (flags & (1 << 2)) ? luts[2] : nullptr,
+ (flags & (1 << 3)) ? luts[3] : nullptr
));
SkTDArray<GrFragmentProcessor*> array;
@@ -568,7 +568,7 @@ GrFragmentProcessor* ColorTableEffect::TestCreate(GrProcessorTestData* d) {
SkASSERT(1 == array.count()); // TableColorFilter only returns 1
return array[0];
}
- return NULL;
+ return nullptr;
}
bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context,
@@ -583,7 +583,7 @@ bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context,
*array->append() = frag;
} else {
frag->unref();
- SkDEBUGCODE(frag = NULL;)
+ SkDEBUGCODE(frag = nullptr;)
}
return true;
}
diff --git a/src/effects/SkTableMaskFilter.cpp b/src/effects/SkTableMaskFilter.cpp
index dc9b335fd4..999b998e32 100644
--- a/src/effects/SkTableMaskFilter.cpp
+++ b/src/effects/SkTableMaskFilter.cpp
@@ -33,7 +33,7 @@ bool SkTableMaskFilter::filterMask(SkMask* dst, const SkMask& src,
dst->fBounds = src.fBounds;
dst->fRowBytes = SkAlign4(dst->fBounds.width());
dst->fFormat = SkMask::kA8_Format;
- dst->fImage = NULL;
+ dst->fImage = nullptr;
if (src.fImage) {
dst->fImage = SkMask::AllocImage(dst->computeImageSize());
@@ -77,7 +77,7 @@ void SkTableMaskFilter::flatten(SkWriteBuffer& wb) const {
SkFlattenable* SkTableMaskFilter::CreateProc(SkReadBuffer& buffer) {
uint8_t table[256];
if (!buffer.readByteArray(table, 256)) {
- return NULL;
+ return nullptr;
}
return Create(table);
}
diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp
index 43b43a58fc..432b576c15 100755
--- a/src/effects/SkTestImageFilters.cpp
+++ b/src/effects/SkTestImageFilters.cpp
@@ -49,7 +49,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// downsample
{
SkBaseDevice* dev = proxy->createDevice(dstW, dstH);
- if (NULL == dev) {
+ if (nullptr == dev) {
return false;
}
OwnDeviceCanvas canvas(dev);
@@ -64,7 +64,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// upscale
{
SkBaseDevice* dev = proxy->createDevice(src.width(), src.height());
- if (NULL == dev) {
+ if (nullptr == dev) {
return false;
}
OwnDeviceCanvas canvas(dev);
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 9292b26103..5e633a3556 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -19,7 +19,7 @@
SkTileImageFilter* SkTileImageFilter::Create(const SkRect& srcRect, const SkRect& dstRect,
SkImageFilter* input) {
if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) {
- return NULL;
+ return nullptr;
}
return new SkTileImageFilter(srcRect, dstRect, input);
}
@@ -60,7 +60,7 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(w, h));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device);
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index f62773a250..7c4a94b949 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -77,7 +77,7 @@ bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
}
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
- if (NULL == device.get()) {
+ if (nullptr == device.get()) {
return false;
}
SkCanvas canvas(device);
@@ -123,7 +123,7 @@ void SkXfermodeImageFilter::toString(SkString* str) const {
#if SK_SUPPORT_GPU
bool SkXfermodeImageFilter::canFilterImageGPU() const {
- return fMode && fMode->asFragmentProcessor(NULL, NULL, NULL) && !cropRectIsSet();
+ return fMode && fMode->asFragmentProcessor(nullptr, nullptr, nullptr) && !cropRectIsSet();
}
bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
@@ -139,7 +139,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
}
GrTexture* backgroundTex = background.getTexture();
- if (NULL == backgroundTex) {
+ if (nullptr == backgroundTex) {
SkASSERT(false);
return false;
}
@@ -153,7 +153,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
GrTexture* foregroundTex = foreground.getTexture();
GrContext* context = foregroundTex->getContext();
- GrFragmentProcessor* xferProcessor = NULL;
+ GrFragmentProcessor* xferProcessor = nullptr;
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
diff --git a/src/effects/gradients/SkGradientBitmapCache.cpp b/src/effects/gradients/SkGradientBitmapCache.cpp
index 90fa3d54ad..24e7f5816b 100644
--- a/src/effects/gradients/SkGradientBitmapCache.cpp
+++ b/src/effects/gradients/SkGradientBitmapCache.cpp
@@ -18,8 +18,8 @@ struct SkGradientBitmapCache::Entry {
SkBitmap fBitmap;
Entry(const void* buffer, size_t size, const SkBitmap& bm)
- : fPrev(NULL),
- fNext(NULL),
+ : fPrev(nullptr),
+ fNext(nullptr),
fBitmap(bm) {
fBuffer = sk_malloc_throw(size);
fSize = size;
@@ -35,7 +35,7 @@ struct SkGradientBitmapCache::Entry {
SkGradientBitmapCache::SkGradientBitmapCache(int max) : fMaxEntries(max) {
fEntryCount = 0;
- fHead = fTail = NULL;
+ fHead = fTail = nullptr;
this->validate();
}
@@ -70,7 +70,7 @@ SkGradientBitmapCache::Entry* SkGradientBitmapCache::detach(Entry* entry) const
}
void SkGradientBitmapCache::attachToHead(Entry* entry) const {
- entry->fPrev = NULL;
+ entry->fPrev = nullptr;
entry->fNext = fHead;
if (fHead) {
fHead->fPrev = entry;
@@ -121,8 +121,8 @@ void SkGradientBitmapCache::validate() const {
SkASSERT(fEntryCount >= 0 && fEntryCount <= fMaxEntries);
if (fEntryCount > 0) {
- SkASSERT(NULL == fHead->fPrev);
- SkASSERT(NULL == fTail->fNext);
+ SkASSERT(nullptr == fHead->fPrev);
+ SkASSERT(nullptr == fTail->fNext);
if (fEntryCount == 1) {
SkASSERT(fHead == fTail);
@@ -145,8 +145,8 @@ void SkGradientBitmapCache::validate() const {
}
SkASSERT(0 == count);
} else {
- SkASSERT(NULL == fHead);
- SkASSERT(NULL == fTail);
+ SkASSERT(nullptr == fHead);
+ SkASSERT(nullptr == fTail);
}
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 8bef3e3109..2f89352435 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -49,7 +49,7 @@ bool SkGradientShaderBase::DescriptorScope::unflatten(SkReadBuffer& buffer) {
return false;
}
} else {
- fPos = NULL;
+ fPos = nullptr;
}
fTileMode = (SkShader::TileMode)buffer.read32();
@@ -59,7 +59,7 @@ bool SkGradientShaderBase::DescriptorScope::unflatten(SkReadBuffer& buffer) {
fLocalMatrix = &fLocalMatrixStorage;
buffer.readMatrix(&fLocalMatrixStorage);
} else {
- fLocalMatrix = NULL;
+ fLocalMatrix = nullptr;
}
return buffer.isValid();
}
@@ -130,7 +130,7 @@ SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatri
fOrigPos = (SkScalar*)(fOrigColors + fColorCount);
fRecs = (Rec*)(fOrigPos + fColorCount);
} else {
- fOrigPos = NULL;
+ fOrigPos = nullptr;
fRecs = (Rec*)(fOrigColors + fColorCount);
}
@@ -175,7 +175,7 @@ SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatri
recs += 1;
}
} else { // assume even distribution
- fOrigPos = NULL;
+ fOrigPos = nullptr;
SkFixed dp = SK_Fixed1 / (desc.fCount - 1);
SkFixed p = dp;
@@ -194,7 +194,7 @@ SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatri
fOrigPos[0] = SkScalarPin(desc.fPos[0], 0, 1);
fOrigPos[1] = SkScalarPin(desc.fPos[1], fOrigPos[0], 1);
if (0 == fOrigPos[0] && 1 == fOrigPos[1]) {
- fOrigPos = NULL;
+ fOrigPos = nullptr;
}
}
this->initCommon();
@@ -223,7 +223,7 @@ void SkGradientShaderBase::flatten(SkWriteBuffer& buffer) const {
desc.fGradFlags = fGradFlags;
const SkMatrix& m = this->getLocalMatrix();
- desc.fLocalMatrix = m.isIdentity() ? NULL : &m;
+ desc.fLocalMatrix = m.isIdentity() ? nullptr : &m;
desc.flatten(buffer);
}
@@ -324,10 +324,10 @@ SkGradientShaderBase::GradientShaderCache::GradientShaderCache(
, fCache32Inited(false)
{
// Only initialize the cache in getCache16/32.
- fCache16 = NULL;
- fCache32 = NULL;
- fCache16Storage = NULL;
- fCache32PixelRef = NULL;
+ fCache16 = nullptr;
+ fCache32 = nullptr;
+ fCache16Storage = nullptr;
+ fCache32PixelRef = nullptr;
}
SkGradientShaderBase::GradientShaderCache::~GradientShaderCache() {
@@ -535,7 +535,7 @@ void SkGradientShaderBase::GradientShaderCache::initCache16(GradientShaderCache*
const int entryCount = kCache16Count * 2;
const size_t allocSize = sizeof(uint16_t) * entryCount;
- SkASSERT(NULL == cache->fCache16Storage);
+ SkASSERT(nullptr == cache->fCache16Storage);
cache->fCache16Storage = (uint16_t*)sk_malloc_throw(allocSize);
cache->fCache16 = cache->fCache16Storage;
if (cache->fShader.fColorCount == 2) {
@@ -567,8 +567,8 @@ void SkGradientShaderBase::GradientShaderCache::initCache32(GradientShaderCache*
const int kNumberOfDitherRows = 4;
const SkImageInfo info = SkImageInfo::MakeN32Premul(kCache32Count, kNumberOfDitherRows);
- SkASSERT(NULL == cache->fCache32PixelRef);
- cache->fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL);
+ SkASSERT(nullptr == cache->fCache32PixelRef);
+ cache->fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, nullptr);
cache->fCache32 = (SkPMColor*)cache->fCache32PixelRef->getAddr();
if (cache->fShader.fColorCount == 2) {
Build32bitCache(cache->fCache32, cache->fShader.fOrigColors[0],
@@ -647,7 +647,7 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap) const {
static const int MAX_NUM_CACHED_GRADIENT_BITMAPS = 32;
SkAutoMutexAcquire ama(gGradientCacheMutex);
- if (NULL == gCache) {
+ if (nullptr == gCache) {
gCache = new SkGradientBitmapCache(MAX_NUM_CACHED_GRADIENT_BITMAPS);
}
size_t size = count * sizeof(int32_t);
@@ -737,7 +737,7 @@ void SkGradientShaderBase::toString(SkString* str) const {
// Return true if these parameters are valid/legal/safe to construct a gradient
//
static bool valid_grad(const SkColor colors[], const SkScalar pos[], int count, unsigned tileMode) {
- return NULL != colors && count >= 1 && tileMode < (unsigned)SkShader::kTileModeCount;
+ return nullptr != colors && count >= 1 && tileMode < (unsigned)SkShader::kTileModeCount;
}
// assumes colors is SkColor* and pos is SkScalar*
@@ -747,7 +747,7 @@ static bool valid_grad(const SkColor colors[], const SkScalar pos[], int count,
if (1 == count) { \
tmp[0] = tmp[1] = colors[0]; \
colors = tmp; \
- pos = NULL; \
+ pos = nullptr; \
count = 2; \
} \
} while (0)
@@ -770,10 +770,10 @@ SkShader* SkGradientShader::CreateLinear(const SkPoint pts[2],
uint32_t flags,
const SkMatrix* localMatrix) {
if (!pts) {
- return NULL;
+ return nullptr;
}
if (!valid_grad(colors, pos, colorCount, mode)) {
- return NULL;
+ return nullptr;
}
EXPAND_1_COLOR(colorCount);
@@ -789,10 +789,10 @@ SkShader* SkGradientShader::CreateRadial(const SkPoint& center, SkScalar radius,
uint32_t flags,
const SkMatrix* localMatrix) {
if (radius <= 0) {
- return NULL;
+ return nullptr;
}
if (!valid_grad(colors, pos, colorCount, mode)) {
- return NULL;
+ return nullptr;
}
EXPAND_1_COLOR(colorCount);
@@ -812,10 +812,10 @@ SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
uint32_t flags,
const SkMatrix* localMatrix) {
if (startRadius < 0 || endRadius < 0) {
- return NULL;
+ return nullptr;
}
if (!valid_grad(colors, pos, colorCount, mode)) {
- return NULL;
+ return nullptr;
}
if (start == end && startRadius == endRadius) {
return SkShader::CreateEmptyShader();
@@ -844,7 +844,7 @@ SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
}
desc_init(&desc, colorsNew.get(), posNew.get(), colorCount, mode, flags, localMatrix);
} else {
- desc_init(&desc, colorsNew.get(), NULL, colorCount, mode, flags, localMatrix);
+ desc_init(&desc, colorsNew.get(), nullptr, colorCount, mode, flags, localMatrix);
}
return new SkTwoPointConicalGradient(end, endRadius, start, startRadius, flipGradient,
@@ -859,7 +859,7 @@ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
uint32_t flags,
const SkMatrix* localMatrix) {
if (!valid_grad(colors, pos, colorCount, SkShader::kClamp_TileMode)) {
- return NULL;
+ return nullptr;
}
EXPAND_1_COLOR(colorCount);
@@ -1168,7 +1168,7 @@ int GrGradientEffect::RandomGradientParams(SkRandom* random,
// if one color, omit stops, otherwise randomly decide whether or not to
if (outColors == 1 || (outColors >= 2 && random->nextBool())) {
- *stops = NULL;
+ *stops = nullptr;
}
SkScalar stop = 0.f;
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index d081d6feaa..38b506be7e 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -137,7 +137,7 @@ public:
unsigned getAlpha() const { return fCacheAlpha; }
private:
- // Working pointers. If either is NULL, we need to recompute the corresponding cache values.
+ // Working pointers. If either is nullptr, we need to recompute the corresponding cache values.
uint16_t* fCache16;
SkPMColor* fCache32;
@@ -358,7 +358,7 @@ protected:
The function decides whether stop values should be used or not. The return value indicates
the number of colors, which will be capped by kMaxRandomGradientColors. colors should be
sized to be at least kMaxRandomGradientColors. stops is a pointer to an array of at least
- size kMaxRandomGradientColors. It may be updated to NULL, indicating that NULL should be
+ size kMaxRandomGradientColors. It may be updated to nullptr, indicating that nullptr should be
passed to the gradient factory rather than the array.
*/
static const int kMaxRandomGradientColors = 4;
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index a5be417637..86142fda73 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -63,7 +63,7 @@ SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc)
SkFlattenable* SkLinearGradient::CreateProc(SkReadBuffer& buffer) {
DescriptorScope desc;
if (!desc.unflatten(buffer)) {
- return NULL;
+ return nullptr;
}
SkPoint pts[2];
pts[0] = buffer.readPoint();
@@ -228,7 +228,7 @@ void SkLinearGradient::LinearGradientContext::shadeSpan(int x, int y, SkPMColor*
if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
SkFixed dxStorage[1];
- (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
+ (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, nullptr);
// todo: do we need a real/high-precision value for dx here?
dx = SkFixedToGradFixed(dxStorage[0]);
} else {
@@ -401,7 +401,7 @@ void SkLinearGradient::LinearGradientContext::shadeSpan16(int x, int y,
if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
SkFixed dxStorage[1];
- (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
+ (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, nullptr);
// todo: do we need a real/high-precision value for dx here?
dx = SkFixedToGradFixed(dxStorage[0]);
} else {
@@ -523,7 +523,7 @@ GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d) {
GrColor paintColor;
GrFragmentProcessor* fp;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 7e249496ce..3a1a21e83c 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -237,7 +237,7 @@ SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
DescriptorScope desc;
if (!desc.unflatten(buffer)) {
- return NULL;
+ return nullptr;
}
const SkPoint center = buffer.readPoint();
const SkScalar radius = buffer.readScalar();
@@ -495,7 +495,7 @@ GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d) {
GrColor paintColor;
GrFragmentProcessor* fp;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 9e44b70298..c6699e87e0 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -33,7 +33,7 @@ SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const {
SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
DescriptorScope desc;
if (!desc.unflatten(buffer)) {
- return NULL;
+ return nullptr;
}
const SkPoint center = buffer.readPoint();
return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, desc.fPos,
@@ -240,7 +240,7 @@ GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
GrFragmentProcessor* fp;
GrColor paintColor;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 7e5edf2569..41b5c1bbae 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -312,7 +312,7 @@ SkShader::GradientType SkTwoPointConicalGradient::asAGradient(
SkFlattenable* SkTwoPointConicalGradient::CreateProc(SkReadBuffer& buffer) {
DescriptorScope desc;
if (!desc.unflatten(buffer)) {
- return NULL;
+ return nullptr;
}
SkPoint c1 = buffer.readPoint();
SkPoint c2 = buffer.readPoint();
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index cdc18629cf..30f0fdf6a1 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -213,14 +213,14 @@ GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
GrFragmentProcessor* fp;
GrColor paintColor;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&)
- : fVSVaryingName(NULL)
- , fFSVaryingName(NULL)
+ : fVSVaryingName(nullptr)
+ , fFSVaryingName(nullptr)
, fCachedRadius(-SK_ScalarMax)
, fCachedDiffRadius(-SK_ScalarMax) {}
@@ -493,15 +493,15 @@ GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorTestDat
GrColor paintColor;
GrPaint grPaint;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager,
&effect));
return effect;
}
GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor& processor)
- : fVSVaryingName(NULL)
- , fFSVaryingName(NULL)
+ : fVSVaryingName(nullptr)
+ , fFSVaryingName(nullptr)
, fCachedFocal(SK_ScalarMax) {
const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtConicalEffect>();
fIsFlipped = data.isFlipped();
@@ -705,14 +705,14 @@ GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTestData
GrColor paintColor;
GrFragmentProcessor* fp;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&)
- : fVSVaryingName(NULL)
- , fFSVaryingName(NULL)
+ : fVSVaryingName(nullptr)
+ , fFSVaryingName(nullptr)
, fCachedFocal(SK_ScalarMax) {}
void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) {
@@ -952,14 +952,14 @@ CircleInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
GrColor paintColor;
GrFragmentProcessor* fp;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor& processor)
- : fVSVaryingName(NULL)
- , fFSVaryingName(NULL)
+ : fVSVaryingName(nullptr)
+ , fFSVaryingName(nullptr)
, fCachedCenterX(SK_ScalarMax)
, fCachedCenterY(SK_ScalarMax)
, fCachedA(SK_ScalarMax)
@@ -1183,14 +1183,14 @@ GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessorTestDa
GrColor paintColor;
GrFragmentProcessor* fp;
SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
- GrTest::TestMatrix(d->fRandom), NULL,
+ GrTest::TestMatrix(d->fRandom), nullptr,
&paintColor, d->fProcDataManager, &fp));
return fp;
}
GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcessor& processor)
- : fVSVaryingName(NULL)
- , fFSVaryingName(NULL)
+ : fVSVaryingName(nullptr)
+ , fFSVaryingName(nullptr)
, fCachedCenterX(SK_ScalarMax)
, fCachedCenterY(SK_ScalarMax)
, fCachedA(SK_ScalarMax)
@@ -1301,12 +1301,12 @@ GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
const SkMatrix* localMatrix) {
SkMatrix matrix;
if (!shader.getLocalMatrix().invert(&matrix)) {
- return NULL;
+ return nullptr;
}
if (localMatrix) {
SkMatrix inv;
if (!localMatrix->invert(&inv)) {
- return NULL;
+ return nullptr;
}
matrix.postConcat(inv);
}
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index 72a5a618a8..de309d311b 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -60,7 +60,7 @@ static SkFontConfigInterface* RefFCI() {
// look for the last substring after a '/' and return that, or return null.
static const char* find_just_name(const char* str) {
const char* last = strrchr(str, '/');
- return last ? last + 1 : NULL;
+ return last ? last + 1 : nullptr;
}
static bool is_lower(char c) {
@@ -123,7 +123,7 @@ static FcPattern** MatchFont(FcFontSet* font_set,
}
if (iter == stop || !match_name(*iter, post_config_family)) {
- return NULL;
+ return nullptr;
}
FcPattern** firstIter = iter++;
@@ -202,11 +202,11 @@ void SkFontStyleSet_FC::getStyle(int index, SkFontStyle* style,
}
SkTypeface* SkFontStyleSet_FC::createTypeface(int index) {
- return NULL;
+ return nullptr;
}
SkTypeface* SkFontStyleSet_FC::matchStyle(const SkFontStyle& pattern) {
- return NULL;
+ return nullptr;
}
class SkFontMgr_fontconfig : public SkFontMgr {
@@ -245,7 +245,7 @@ protected:
#if 0
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
#endif
- FcConfigSubstitute(NULL, pattern, FcMatchPattern);
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
const char* post_config_family = get_name(pattern, FC_FAMILY);
@@ -254,7 +254,7 @@ protected:
FcFontSet* font_set = FcFontSort(0, pattern, 0, 0, &result);
if (!font_set) {
FcPatternDestroy(pattern);
- return NULL;
+ return nullptr;
}
int count;
@@ -262,7 +262,7 @@ protected:
if (!match) {
FcPatternDestroy(pattern);
FcFontSetDestroy(font_set);
- return NULL;
+ return nullptr;
}
FcPatternDestroy(pattern);
@@ -281,32 +281,32 @@ protected:
}
SkTypeface* onMatchFamilyStyle(const char familyName[],
- const SkFontStyle&) const override { return NULL; }
+ const SkFontStyle&) const override { return nullptr; }
SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
const char* bcp47[], int bcp47Count,
SkUnichar character) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onMatchFaceStyle(const SkTypeface*,
- const SkFontStyle&) const override { return NULL; }
+ const SkFontStyle&) const override { return nullptr; }
- SkTypeface* onCreateFromData(SkData*, int ttcIndex) const override { return NULL; }
+ SkTypeface* onCreateFromData(SkData*, int ttcIndex) const override { return nullptr; }
SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(bareStream);
const size_t length = stream->getLength();
if (!length) {
- return NULL;
+ return nullptr;
}
if (length >= 1024 * 1024 * 1024) {
- return NULL; // don't accept too large fonts (>= 1GB) for safety.
+ return nullptr; // don't accept too large fonts (>= 1GB) for safety.
}
// TODO should the caller give us the style or should we get it from freetype?
SkFontStyle style;
bool isFixedWidth = false;
- if (!fScanner.scanFont(stream, 0, NULL, &style, &isFixedWidth, NULL)) {
- return NULL;
+ if (!fScanner.scanFont(stream, 0, nullptr, &style, &isFixedWidth, nullptr)) {
+ return nullptr;
}
SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, stream.detach());
@@ -315,7 +315,7 @@ protected:
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : NULL;
+ return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char familyName[],
@@ -327,5 +327,5 @@ protected:
SkFontMgr* SkFontMgr::Factory() {
SkFontConfigInterface* fci = RefFCI();
- return fci ? new SkFontMgr_fontconfig(fci) : NULL;
+ return fci ? new SkFontMgr_fontconfig(fci) : nullptr;
}
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 33c79c86c7..132130f0d8 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -175,8 +175,8 @@ void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const
SkFontStyleSet* SkFontMgr_Indirect::onCreateStyleSet(int index) const {
SkRemotableFontIdentitySet* set = fProxy->getIndex(index);
- if (NULL == set) {
- return NULL;
+ if (nullptr == set) {
+ return nullptr;
}
return new SkStyleSet_Indirect(this, index, set);
}
@@ -187,7 +187,7 @@ SkFontStyleSet* SkFontMgr_Indirect::onMatchFamily(const char familyName[]) const
SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& id) const {
if (id.fDataId == SkFontIdentity::kInvalidDataId) {
- return NULL;
+ return nullptr;
}
SkAutoMutexAcquire ama(fDataCacheMutex);
@@ -202,7 +202,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
{
return entry.fTypeface;
}
- if (dataTypeface.get() == NULL &&
+ if (dataTypeface.get() == nullptr &&
!entry.fTypeface->weak_expired() && entry.fTypeface->try_ref())
{
dataTypeface.reset(entry.fTypeface);
@@ -217,22 +217,22 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
}
// No exact match, but did find a data match.
- if (dataTypeface.get() != NULL) {
- SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(NULL));
- if (stream.get() != NULL) {
+ if (dataTypeface.get() != nullptr) {
+ SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
+ if (stream.get() != nullptr) {
return fImpl->createFromStream(stream.detach(), dataTypefaceIndex);
}
}
// No data match, request data and add entry.
SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId));
- if (stream.get() == NULL) {
- return NULL;
+ if (stream.get() == nullptr) {
+ return nullptr;
}
SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.detach(), id.fTtcIndex));
- if (typeface.get() == NULL) {
- return NULL;
+ if (typeface.get() == nullptr) {
+ return nullptr;
}
DataEntry& newEntry = fDataCache.push_back();
@@ -291,11 +291,11 @@ SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
SkAutoTUnref<SkTypeface> face(this->matchFamilyStyle(familyName, style));
- if (NULL == face.get()) {
- face.reset(this->matchFamilyStyle(NULL, style));
+ if (nullptr == face.get()) {
+ face.reset(this->matchFamilyStyle(nullptr, style));
}
- if (NULL == face.get()) {
+ if (nullptr == face.get()) {
SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style);
face.reset(this->createTypefaceFromFontId(fontId));
}
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp
index ee78381436..368f26983c 100644
--- a/src/fonts/SkTestScalerContext.cpp
+++ b/src/fonts/SkTestScalerContext.cpp
@@ -24,7 +24,7 @@ SkTestFont::SkTestFont(const SkTestFontData& fontData)
, fWidths(fontData.fWidths)
, fMetrics(fontData.fMetrics)
, fName(fontData.fName)
- , fPaths(NULL)
+ , fPaths(nullptr)
{
init(fontData.fPoints, fontData.fVerbs);
#ifdef SK_DEBUG
@@ -173,7 +173,7 @@ SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const
SkString familyName(fTestFont->fName);
SkString language("und"); //undetermined
SkASSERT(0); // incomplete
- return NULL;
+ return nullptr;
// return new SkOTUtils::LocalizedStrings_SingleName(familyName, language);
}
diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h
index 95316d7d5b..fe5c8d6ffc 100644
--- a/src/fonts/SkTestScalerContext.h
+++ b/src/fonts/SkTestScalerContext.h
@@ -74,7 +74,7 @@ protected:
uint32_t glyphIDsCount) const override;
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
- return NULL;
+ return nullptr;
}
void onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const override;
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 668a09a01c..296f6daf84 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -673,7 +673,7 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
return d->fCaps->shaderCaps()->shaderDerivativeSupport() ?
QuadEdgeEffect::Create(GrRandomColor(d->fRandom),
GrTest::TestMatrix(d->fRandom),
- d->fRandom->nextBool()) : NULL;
+ d->fRandom->nextBool()) : nullptr;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 7a51149ed5..45a3d65179 100644
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -62,7 +62,7 @@ void GrAADistanceFieldPathRenderer::HandleEviction(GrBatchAtlas::AtlasID id, voi
}
////////////////////////////////////////////////////////////////////////////////
-GrAADistanceFieldPathRenderer::GrAADistanceFieldPathRenderer() : fAtlas(NULL) {}
+GrAADistanceFieldPathRenderer::GrAADistanceFieldPathRenderer() : fAtlas(nullptr) {}
GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
PathDataList::Iter iter;
@@ -226,7 +226,7 @@ private:
// TODO: handle stroked vs. filled version of same path
PathData::Key key = { args.fPath.getGenerationID(), desiredDimension };
args.fPathData = fPathCache->find(key);
- if (NULL == args.fPathData || !atlas->hasID(args.fPathData->fID)) {
+ if (nullptr == args.fPathData || !atlas->hasID(args.fPathData->fID)) {
// Remove the stale cache entry
if (args.fPathData) {
fPathCache->remove(args.fPathData->fKey);
@@ -281,7 +281,7 @@ private:
fBatch.fColor = color;
fBatch.fViewMatrix = viewMatrix;
fGeoData.push_back(geometry);
- fGeoData.back().fPathData = NULL;
+ fGeoData.back().fPathData = nullptr;
fAtlas = atlas;
fPathCache = pathCache;
@@ -558,7 +558,7 @@ struct PathTestStruct {
typedef GrAADistanceFieldPathRenderer::PathCache PathCache;
typedef GrAADistanceFieldPathRenderer::PathData PathData;
typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList;
- PathTestStruct() : fContextID(SK_InvalidGenID), fAtlas(NULL) {}
+ PathTestStruct() : fContextID(SK_InvalidGenID), fAtlas(nullptr) {}
~PathTestStruct() { this->reset(); }
void reset() {
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index f2f9563f26..e102db27a0 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -622,7 +622,7 @@ bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const
return false;
}
- if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, NULL)) {
+ if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, nullptr)) {
return false;
}
@@ -798,8 +798,8 @@ void AAHairlineBatch::onPrepareDraws(Target* target) {
bool hasPerspective = this->viewMatrix().hasPerspective();
const SkMatrix* geometryProcessorViewM = &SkMatrix::I();
const SkMatrix* geometryProcessorLocalM = &invert;
- const SkMatrix* toDevice = NULL;
- const SkMatrix* toSrc = NULL;
+ const SkMatrix* toDevice = nullptr;
+ const SkMatrix* toSrc = nullptr;
if (hasPerspective) {
geometryProcessorViewM = &this->viewMatrix();
geometryProcessorLocalM = &SkMatrix::I();
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 64f6533be4..c5d2dc3d38 100644
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -29,7 +29,7 @@ public:
GrAllocator(size_t itemSize, int itemsPerBlock, void* initialBlock)
: fItemSize(itemSize)
, fItemsPerBlock(itemsPerBlock)
- , fOwnFirstBlock(NULL == initialBlock)
+ , fOwnFirstBlock(nullptr == initialBlock)
, fCount(0)
, fInsertionIndexInBlock(0) {
SkASSERT(itemsPerBlock > 0);
@@ -192,7 +192,7 @@ public:
protected:
/**
* Set first block of memory to write into. Must be called before any other methods.
- * This requires that you have passed NULL in the constructor.
+ * This requires that you have passed nullptr in the constructor.
*
* @param initialBlock optional memory to use for the first block.
* Must be at least itemSize*itemsPerBlock sized.
@@ -237,7 +237,7 @@ public:
* @param itemsPerBlock the number of items to allocate at once
*/
explicit GrTAllocator(int itemsPerBlock)
- : fAllocator(sizeof(T), itemsPerBlock, NULL) {}
+ : fAllocator(sizeof(T), itemsPerBlock, nullptr) {}
/**
* Adds an item and returns it.
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index e2803020ae..3eb74f074b 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -22,9 +22,9 @@ static int g_UploadCount = 0;
GrPlot::GrPlot()
: fID(-1)
- , fTexture(NULL)
- , fRects(NULL)
- , fAtlas(NULL)
+ , fTexture(nullptr)
+ , fRects(nullptr)
+ , fAtlas(nullptr)
, fBytesPerPixel(1)
, fDirty(false)
, fBatchUploads(false)
@@ -34,7 +34,7 @@ GrPlot::GrPlot()
GrPlot::~GrPlot() {
delete[] fPlotData;
- fPlotData = NULL;
+ fPlotData = nullptr;
delete fRects;
}
@@ -45,7 +45,7 @@ void GrPlot::init(GrAtlas* atlas, int id, int offX, int offY, int width, int hei
fAtlas = atlas;
fOffset.set(offX * width, offY * height);
fBytesPerPixel = bpp;
- fPlotData = NULL;
+ fPlotData = nullptr;
fDirtyRect.setEmpty();
fDirty = false;
fBatchUploads = batchUploads;
@@ -66,7 +66,7 @@ bool GrPlot::addSubImage(int width, int height, const void* image, SkIPoint16* l
// once the plot is nearly full we will revert to uploading each subimage individually
int plotWidth = fRects->width();
int plotHeight = fRects->height();
- if (fBatchUploads && NULL == fPlotData && 0.0f == percentFull) {
+ if (fBatchUploads && nullptr == fPlotData && 0.0f == percentFull) {
fPlotData = new unsigned char[fBytesPerPixel * plotWidth * plotHeight];
memset(fPlotData, 0, fBytesPerPixel*plotWidth*plotHeight);
}
@@ -122,7 +122,7 @@ GrAtlas::GrAtlas(GrGpu* gpu, GrPixelConfig config, GrSurfaceFlags flags,
fNumPlotsX = numPlotsX;
fNumPlotsY = numPlotsY;
fBatchUploads = batchUploads;
- fTexture = NULL;
+ fTexture = nullptr;
int textureWidth = fBackingTextureSize.width();
int textureHeight = fBackingTextureSize.height();
@@ -186,7 +186,7 @@ GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage,
}
// before we get a new plot, make sure we have a backing texture
- if (NULL == fTexture) {
+ if (nullptr == fTexture) {
// TODO: Update this to use the cache rather than directly creating a texture.
GrSurfaceDesc desc;
desc.fFlags = fFlags;
@@ -194,9 +194,9 @@ GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage,
desc.fHeight = fBackingTextureSize.height();
desc.fConfig = fPixelConfig;
- fTexture = fGpu->createTexture(desc, true, NULL, 0);
- if (NULL == fTexture) {
- return NULL;
+ fTexture = fGpu->createTexture(desc, true, nullptr, 0);
+ if (nullptr == fTexture) {
+ return nullptr;
}
}
@@ -218,7 +218,7 @@ GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage,
}
// If the above fails, then the current plot list has no room
- return NULL;
+ return nullptr;
}
void GrAtlas::RemovePlot(ClientPlotUsage* usage, const GrPlot* plot) {
diff --git a/src/gpu/GrAtlas.h b/src/gpu/GrAtlas.h
index 5ef2dab82b..aaec0b02d9 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -92,7 +92,7 @@ public:
// Adds a width x height subimage to the atlas. Upon success it returns
// the containing GrPlot and absolute location in the backing texture.
- // NULL is returned if the subimage cannot fit in the atlas.
+ // nullptr is returned if the subimage cannot fit in the atlas.
// If provided, the image data will either be immediately uploaded or
// written to the CPU-side backing bitmap.
GrPlot* addToAtlas(ClientPlotUsage*, int width, int height, const void* image, SkIPoint16* loc);
diff --git a/src/gpu/GrAtlasTextBlob.h b/src/gpu/GrAtlasTextBlob.h
index 2c8aa57238..4232043fe3 100644
--- a/src/gpu/GrAtlasTextBlob.h
+++ b/src/gpu/GrAtlasTextBlob.h
@@ -93,7 +93,7 @@ struct GrAtlasTextBlob : public SkRefCnt {
}
// Distance field text cannot draw coloremoji, and so has to fall back. However,
// though the distance field text and the coloremoji may share the same run, they
- // will have different descriptors. If fOverrideDescriptor is non-NULL, then it
+ // will have different descriptors. If fOverrideDescriptor is non-nullptr, then it
// will be used in place of the run's descriptor to regen texture coords
// TODO we could have a descriptor cache, it would reduce the size of these blobs
// significantly, and then the subrun could just have a refed pointer to the
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 61cd2a1efa..06d6675ebd 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -104,7 +104,7 @@ GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
// vertexStride
static_assert(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize,
"vertex_attribute_changed");
- fCurrStrike = NULL;
+ fCurrStrike = nullptr;
fCache = context->getTextBlobCache();
}
@@ -537,7 +537,7 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
subRun.fUseLCDText = runPaint.isLCDRenderText();
subRun.fDrawAsDistanceFields = true;
- SkGlyphCache* cache = this->setupCache(&cacheBlob->fRuns[run], dfPaint, NULL, true);
+ SkGlyphCache* cache = this->setupCache(&cacheBlob->fRuns[run], dfPaint, nullptr, true);
SkTDArray<char> fallbackTxt;
SkTDArray<SkScalar> fallbackPos;
@@ -704,7 +704,7 @@ GrAtlasTextContext::setupDFBlob(int glyphCount, const SkPaint& origPaint,
subRun.fUseLCDText = origPaint.isLCDRenderText();
subRun.fDrawAsDistanceFields = true;
- *cache = this->setupCache(&blob->fRuns[0], *dfPaint, NULL, true);
+ *cache = this->setupCache(&blob->fRuns[0], *dfPaint, nullptr, true);
return blob;
}
@@ -823,14 +823,14 @@ void GrAtlasTextContext::internalDrawBMPText(GrAtlasTextBlob* blob, int runIndex
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
SkScalar x, SkScalar y, const SkIRect& clipRect) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0) {
+ if (text == nullptr || byteLength == 0) {
return;
}
- fCurrStrike = NULL;
+ fCurrStrike = nullptr;
SkDrawCacheProc glyphCacheProc = skPaint.getDrawCacheProc();
// Get GrFontScaler from cache
@@ -912,15 +912,15 @@ void GrAtlasTextContext::internalDrawBMPPosText(GrAtlasTextBlob* blob, int runIn
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkIRect& clipRect) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
// nothing to draw
- if (text == NULL || byteLength == 0) {
+ if (text == nullptr || byteLength == 0) {
return;
}
- fCurrStrike = NULL;
+ fCurrStrike = nullptr;
SkDrawCacheProc glyphCacheProc = skPaint.getDrawCacheProc();
// Get GrFontScaler from cache
@@ -1069,16 +1069,16 @@ void GrAtlasTextContext::internalDrawDFText(GrAtlasTextBlob* blob, int runIndex,
SkTDArray<SkScalar>* fallbackPos,
SkPoint* offset,
const SkPaint& origPaint) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
- if (text == NULL || byteLength == 0) {
+ if (text == nullptr || byteLength == 0) {
return;
}
SkDrawCacheProc glyphCacheProc = origPaint.getDrawCacheProc();
SkAutoDescriptor desc;
- origPaint.getScalerContextDescriptor(&desc, fSurfaceProps, NULL, true);
+ origPaint.getScalerContextDescriptor(&desc, fSurfaceProps, nullptr, true);
SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(origPaint.getTypeface(),
desc.getDesc());
@@ -1143,15 +1143,15 @@ void GrAtlasTextContext::internalDrawDFPosText(GrAtlasTextBlob* blob, int runInd
SkTDArray<char>* fallbackTxt,
SkTDArray<SkScalar>* fallbackPos) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
// nothing to draw
- if (text == NULL || byteLength == 0) {
+ if (text == nullptr || byteLength == 0) {
return;
}
- fCurrStrike = NULL;
+ fCurrStrike = nullptr;
SkDrawCacheProc glyphCacheProc = skPaint.getDrawCacheProc();
GrFontScaler* fontScaler = GetGrFontScaler(cache);
@@ -1364,7 +1364,7 @@ inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph*
GrFontScaler* scaler, const SkGlyph& skGlyph,
SkScalar x, SkScalar y, SkScalar scale,
bool applyVM) {
- if (NULL == glyph->fPath) {
+ if (nullptr == glyph->fPath) {
const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
if (!glyphPath) {
return;
@@ -1624,10 +1624,10 @@ private:
// We cache some values to avoid going to the glyphcache for the same fontScaler twice
// in a row
- const SkDescriptor* desc = NULL;
- SkGlyphCache* cache = NULL;
- GrFontScaler* scaler = NULL;
- SkTypeface* typeface = NULL;
+ const SkDescriptor* desc = nullptr;
+ SkGlyphCache* cache = nullptr;
+ GrFontScaler* scaler = nullptr;
+ SkTypeface* typeface = nullptr;
for (int i = 0; i < fGeoCount; i++) {
Geometry& args = fGeoData[i];
@@ -1668,7 +1668,7 @@ private:
// it. These ids will still be valid as long as we hold the ref. When we are done
// updating our cache of the GrGlyph*s, we drop our ref on the old strike
bool regenerateGlyphs = false;
- GrBatchTextStrike* strike = NULL;
+ GrBatchTextStrike* strike = nullptr;
if (regenerateTextureCoords) {
info.fBulkUseToken.reset();
@@ -2231,7 +2231,7 @@ void GrAtlasTextContext::flush(GrAtlasTextBlob* cacheBlob,
DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
static uint32_t gContextID = SK_InvalidGenID;
- static GrAtlasTextContext* gTextContext = NULL;
+ static GrAtlasTextContext* gTextContext = nullptr;
static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
if (context->uniqueID() != gContextID) {
@@ -2253,9 +2253,9 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
desc.fHeight = 1024;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, true, NULL, 0));
+ SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, true, nullptr, 0));
SkASSERT(texture);
- SkASSERT(NULL != texture->asRenderTarget());
+ SkASSERT(nullptr != texture->asRenderTarget());
GrRenderTarget* rt = texture->asRenderTarget();
// Setup dummy SkPaint / GrPaint
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index 1607ed12f6..ebd0907841 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -131,14 +131,14 @@ private:
, fIndex(-1)
, fGenID(-1)
, fID(0)
- , fData(NULL)
+ , fData(nullptr)
, fWidth(0)
, fHeight(0)
, fX(0)
, fY(0)
- , fTexture(NULL)
- , fRects(NULL)
- , fAtlas(NULL)
+ , fTexture(nullptr)
+ , fRects(nullptr)
+ , fAtlas(nullptr)
, fBytesPerPixel(1)
#ifdef SK_DEBUG
, fDirty(false)
@@ -149,7 +149,7 @@ private:
~BatchPlot() {
sk_free(fData);
- fData = NULL;
+ fData = nullptr;
delete fRects;
}
@@ -166,7 +166,7 @@ private:
fAtlas = atlas;
fOffset.set(offX * width, offY * height);
fBytesPerPixel = bpp;
- fData = NULL;
+ fData = nullptr;
fDirtyRect.setEmpty();
SkDEBUGCODE(fDirty = false;)
fTexture = texture;
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index 4e23540924..544e1b03a0 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -46,7 +46,7 @@ public:
// Adds a width x height subimage to the atlas. Upon success it returns
// the containing GrPlot and absolute location in the backing texture.
- // NULL is returned if the subimage cannot fit in the atlas.
+ // nullptr is returned if the subimage cannot fit in the atlas.
// If provided, the image data will be written to the CPU-side backing bitmap.
// NOTE: If the client intends to refer to the atlas, they should immediately call 'setUseToken'
// with the currentToken from the batch target, otherwise the next call to addToAtlas might
diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
index e8c2183232..de8047b948 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -40,9 +40,9 @@ bool GrBatchFontCache::initAtlas(GrMaskFormat format) {
GrBatchFontCache::GrBatchFontCache(GrContext* context)
: fContext(context)
- , fPreserveStrike(NULL) {
+ , fPreserveStrike(nullptr) {
for (int i = 0; i < kMaskFormatCount; ++i) {
- fAtlases[i] = NULL;
+ fAtlases[i] = nullptr;
}
// setup default atlas configs
@@ -84,7 +84,7 @@ void GrBatchFontCache::freeAll() {
fCache.rewind();
for (int i = 0; i < kMaskFormatCount; ++i) {
delete fAtlases[i];
- fAtlases[i] = NULL;
+ fAtlases[i] = nullptr;
}
}
@@ -131,7 +131,7 @@ void GrBatchFontCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs
for (int i = 0; i < kMaskFormatCount; i++) {
if (fAtlases[i]) {
delete fAtlases[i];
- fAtlases[i] = NULL;
+ fAtlases[i] = nullptr;
}
}
memcpy(fAtlasConfigs, configs, sizeof(fAtlasConfigs));
@@ -169,11 +169,11 @@ GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe
SkIRect bounds;
if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) {
if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) {
- return NULL;
+ return nullptr;
}
} else {
if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) {
- return NULL;
+ return nullptr;
}
}
GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph);
diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h
index 5d57221b68..946356656b 100644
--- a/src/gpu/GrBatchFontCache.h
+++ b/src/gpu/GrBatchFontCache.h
@@ -33,7 +33,7 @@ public:
inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
GrFontScaler* scaler) {
GrGlyph* glyph = fCache.find(packed);
- if (NULL == glyph) {
+ if (nullptr == glyph) {
glyph = this->generateGlyph(skGlyph, packed, scaler);
}
return glyph;
@@ -46,7 +46,7 @@ public:
inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
GrMaskFormat expectedMaskFormat, GrFontScaler* scaler) {
GrGlyph* glyph = fCache.find(packed);
- if (NULL == glyph) {
+ if (nullptr == glyph) {
glyph = this->generateGlyph(skGlyph, packed, scaler);
glyph->fMaskFormat = expectedMaskFormat;
}
@@ -109,7 +109,7 @@ public:
// interactions with the cache since the strike was received.
inline GrBatchTextStrike* getStrike(GrFontScaler* scaler) {
GrBatchTextStrike* strike = fCache.find(*(scaler->getKey()));
- if (NULL == strike) {
+ if (nullptr == strike) {
strike = this->generateStrike(scaler);
}
return strike;
@@ -117,14 +117,14 @@ public:
void freeAll();
- // if getTexture returns NULL, the client must not try to use other functions on the
+ // if getTexture returns nullptr, the client must not try to use other functions on the
// GrBatchFontCache which use the atlas. This function *must* be called first, before other
// functions which use the atlas.
GrTexture* getTexture(GrMaskFormat format) {
if (this->initAtlas(format)) {
return this->getAtlas(format)->getTexture();
}
- return NULL;
+ return nullptr;
}
bool hasGlyph(GrGlyph* glyph) {
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index ede386afb2..a6eeae6f6b 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -66,7 +66,7 @@ static bool draw_with_mask_filter(GrDrawContext* drawContext,
}
SkAutoMaskFreeImage autoSrc(srcM.fImage);
- if (!filter->filterMask(&dstM, srcM, viewMatrix, NULL)) {
+ if (!filter->filterMask(&dstM, srcM, viewMatrix, nullptr)) {
return false;
}
// this will free-up dstM when we're done (allocated in filterMask())
@@ -116,18 +116,18 @@ static GrTexture* create_mask_GPU(GrContext* context,
}
GrTexture* mask = context->textureProvider()->createApproxTexture(desc);
- if (NULL == mask) {
- return NULL;
+ if (nullptr == mask) {
+ return nullptr;
}
SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
GrDrawContext* drawContext = context->drawContext();
if (!drawContext) {
- return NULL;
+ return nullptr;
}
- drawContext->clear(mask->asRenderTarget(), NULL, 0x0, true);
+ drawContext->clear(mask->asRenderTarget(), nullptr, 0x0, true);
GrPaint tempPaint;
tempPaint.setAntiAlias(doAA);
@@ -170,7 +170,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
if (prePathMatrix) {
// stroking, path effects, and blurs are supposed to be applied *after* the prePathMatrix.
// The pre-path-matrix also should not affect shading.
- if (NULL == paint.getMaskFilter() && NULL == pathEffect && NULL == paint.getShader() &&
+ if (nullptr == paint.getMaskFilter() && nullptr == pathEffect && nullptr == paint.getShader() &&
(strokeInfo.isFillStyle() || strokeInfo.isHairlineStyle())) {
viewMatrix.preConcat(*prePathMatrix);
} else {
@@ -195,7 +195,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
return;
}
- const SkRect* cullRect = NULL; // TODO: what is our bounds?
+ const SkRect* cullRect = nullptr; // TODO: what is our bounds?
if (!strokeInfo.isDashed() && pathEffect && pathEffect->filterPath(effectPath.init(), *pathPtr,
&strokeInfo, cullRect)) {
pathPtr = effectPath.get();
diff --git a/src/gpu/GrBufferedDrawTarget.cpp b/src/gpu/GrBufferedDrawTarget.cpp
index c733f0ce84..7ba6a2d70f 100644
--- a/src/gpu/GrBufferedDrawTarget.cpp
+++ b/src/gpu/GrBufferedDrawTarget.cpp
@@ -54,7 +54,7 @@ void GrBufferedDrawTarget::onReset() {
fPathIndexBuffer.rewind();
fPathTransformBuffer.rewind();
- fPrevState.reset(NULL);
+ fPrevState.reset(nullptr);
// Note, fPrevState points into fPipelineBuffer's allocation, so we have to reset first.
// Furthermore, we have to reset fCommands before fPipelineBuffer too.
if (fDrawID % kPipelineBufferHighWaterMark) {
@@ -76,7 +76,7 @@ GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
StateForPathDraw* state = this->allocState(primProc);
if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCreateArgs(), opts)) {
this->unallocState(state);
- return NULL;
+ return nullptr;
}
state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts);
diff --git a/src/gpu/GrBufferedDrawTarget.h b/src/gpu/GrBufferedDrawTarget.h
index 82421ab194..5a80a3ccfb 100644
--- a/src/gpu/GrBufferedDrawTarget.h
+++ b/src/gpu/GrBufferedDrawTarget.h
@@ -41,7 +41,7 @@ protected:
memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), count * indexBytes);
const int xformBytes = GrPathRendering::PathTransformSize(transformType) * sizeof(float);
- *xformsLocation = NULL;
+ *xformsLocation = nullptr;
if (0 != xformBytes) {
*xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformBytes,
@@ -59,7 +59,7 @@ private:
typedef GrTargetCommands::StateForPathDraw StateForPathDraw;
- StateForPathDraw* allocState(const GrPrimitiveProcessor* primProc = NULL) {
+ StateForPathDraw* allocState(const GrPrimitiveProcessor* primProc = nullptr) {
void* allocation = fPipelineBuffer.alloc(sizeof(StateForPathDraw),
SkChunkAlloc::kThrow_AllocFailType);
return new (allocation) StateForPathDraw(primProc);
diff --git a/src/gpu/GrClipMaskCache.h b/src/gpu/GrClipMaskCache.h
index edba54d372..56b0e978dd 100644
--- a/src/gpu/GrClipMaskCache.h
+++ b/src/gpu/GrClipMaskCache.h
@@ -92,7 +92,7 @@ public:
if (fStack.empty()) {
SkASSERT(false);
- return NULL;
+ return nullptr;
}
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
@@ -104,7 +104,7 @@ public:
if (fStack.empty()) {
SkASSERT(false);
- return NULL;
+ return nullptr;
}
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
@@ -135,7 +135,7 @@ public:
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
- if (NULL == back->fLastMask) {
+ if (nullptr == back->fLastMask) {
return -1;
}
@@ -151,7 +151,7 @@ public:
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
- if (NULL == back->fLastMask) {
+ if (nullptr == back->fLastMask) {
return -1;
}
@@ -175,7 +175,7 @@ public:
void purgeResources() {
SkDeque::F2BIter iter(fStack);
for (GrClipStackFrame* frame = (GrClipStackFrame*) iter.next();
- frame != NULL;
+ frame != nullptr;
frame = (GrClipStackFrame*) iter.next()) {
frame->reset();
}
@@ -208,7 +208,7 @@ private:
GrSurfaceDesc desc;
- fLastMask.reset(NULL);
+ fLastMask.reset(nullptr);
fLastBound.setEmpty();
}
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index c9362fa208..7184fe2d3d 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -73,7 +73,7 @@ bool path_needs_SW_renderer(GrContext* context,
GrPathRendererChain::kColorAntiAlias_DrawType :
GrPathRendererChain::kColor_DrawType;
- return NULL == context->getPathRenderer(gpu, &pipelineBuilder, viewMatrix, *path, stroke,
+ return nullptr == context->getPathRenderer(gpu, &pipelineBuilder, viewMatrix, *path, stroke,
false, type);
}
}
@@ -210,7 +210,7 @@ bool GrClipMaskManager::installClipEffects(
}
if (failed) {
- arfps->set(NULL);
+ arfps->set(nullptr);
}
return !failed;
}
@@ -298,7 +298,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
devBounds))) {
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(-clip.origin());
- if (NULL == devBounds ||
+ if (nullptr == devBounds ||
!SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) {
scissorState->set(scissorSpaceIBounds);
}
@@ -309,7 +309,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
// If MSAA is enabled we can do everything in the stencil buffer.
if (0 == rt->numColorSamples() && requiresAA) {
- GrTexture* result = NULL;
+ GrTexture* result = nullptr;
// The top-left of the mask corresponds to the top-left corner of the bounds.
SkVector clipToMaskOffset = {
@@ -422,14 +422,14 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
path.toggleInverseFillType();
}
GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle);
- if (NULL == pr) {
+ if (nullptr == pr) {
GrPathRendererChain::DrawType type;
type = element->isAA() ? GrPathRendererChain::kColorAntiAlias_DrawType :
GrPathRendererChain::kColor_DrawType;
pr = this->getContext()->getPathRenderer(fClipTarget, pipelineBuilder, viewMatrix,
path, stroke, false, type);
}
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
GrPathRenderer::DrawPathArgs args;
@@ -518,12 +518,12 @@ GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
}
////////////////////////////////////////////////////////////////////////////////
-// Return the texture currently in the cache if it exists. Otherwise, return NULL
+// Return the texture currently in the cache if it exists. Otherwise, return nullptr
GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID,
const SkIRect& clipSpaceIBounds) {
bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds);
if (!cached) {
- return NULL;
+ return nullptr;
}
return fAACache.getLastMask();
@@ -531,7 +531,7 @@ GrTexture* GrClipMaskManager::getCachedMaskTexture(int32_t elementsGenID,
////////////////////////////////////////////////////////////////////////////////
// Allocate a texture in the texture cache. This function returns the texture
-// allocated (or NULL on error).
+// allocated (or nullptr on error).
GrTexture* GrClipMaskManager::allocMaskTexture(int32_t elementsGenID,
const SkIRect& clipSpaceIBounds,
bool willUpload) {
@@ -572,9 +572,9 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
// There's no texture in the cache. Let's try to allocate it then.
result = this->allocMaskTexture(elementsGenID, clipSpaceIBounds, false);
- if (NULL == result) {
+ if (nullptr == result) {
fAACache.reset();
- return NULL;
+ return nullptr;
}
// Set the matrix so that rendered clip elements are transformed to mask space from clip
@@ -609,7 +609,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setClip(clip);
- GrPathRenderer* pr = NULL;
+ GrPathRenderer* pr = nullptr;
bool useTemp = !this->canStencilAndDrawElement(&pipelineBuilder, result, &pr, element);
GrTexture* dst;
// This is the bounds of the clip element in the space of the alpha-mask. The temporary
@@ -632,7 +632,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
maskSpaceIBounds.fBottom));
if (!temp) {
fAACache.reset();
- return NULL;
+ return nullptr;
}
}
dst = temp;
@@ -659,7 +659,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
if (!this->drawElement(&pipelineBuilder, translate, dst, element, pr)) {
fAACache.reset();
- return NULL;
+ return nullptr;
}
if (useTemp) {
@@ -720,7 +720,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
SkASSERT(rt);
GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStencilAttachment();
- if (NULL == stencilAttachment) {
+ if (nullptr == stencilAttachment) {
return false;
}
@@ -774,7 +774,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle);
SkRegion::Op op = element->getOp();
- GrPathRenderer* pr = NULL;
+ GrPathRenderer* pr = nullptr;
SkPath clipPath;
if (Element::kRect_Type == element->getType()) {
stencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
@@ -793,7 +793,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
false,
GrPathRendererChain::kStencilOnly_DrawType,
&stencilSupport);
- if (NULL == pr) {
+ if (nullptr == pr) {
return false;
}
}
@@ -1135,9 +1135,9 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
// Allocate clip mask texture
result = this->allocMaskTexture(elementsGenID, clipSpaceIBounds, true);
- if (NULL == result) {
+ if (nullptr == result) {
fAACache.reset();
- return NULL;
+ return nullptr;
}
helper.toTexture(result);
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 1fd3d9648a..a70ebcebe2 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -116,7 +116,7 @@ private:
const SkIRect& clipSpaceIBounds);
// Returns the cached mask texture if it matches the elementsGenID and the clipSpaceIBounds.
- // Returns NULL if not found.
+ // Returns nullptr if not found.
GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSpaceIBounds);
// Handles allocation (if needed) of a clip alpha-mask texture for both the sw-upload
@@ -136,7 +136,7 @@ private:
const SkMatrix& viewMatrix,
GrTexture* target,
const SkClipStack::Element*,
- GrPathRenderer* pr = NULL);
+ GrPathRenderer* pr = nullptr);
// Determines whether it is possible to draw the element to both the stencil buffer and the
// alpha mask simultaneously. If so and the element is a path a compatible path renderer is
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 0e0131312b..2fea2cbbce 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -55,7 +55,7 @@
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this)
#define RETURN_IF_ABANDONED if (fDrawingMgr.abandoned()) { return; }
#define RETURN_FALSE_IF_ABANDONED if (fDrawingMgr.abandoned()) { return false; }
-#define RETURN_NULL_IF_ABANDONED if (fDrawingMgr.abandoned()) { return NULL; }
+#define RETURN_NULL_IF_ABANDONED if (fDrawingMgr.abandoned()) { return nullptr; }
////////////////////////////////////////////////////////////////////////////////
@@ -114,7 +114,7 @@ void GrContext::DrawingMgr::flush() {
GrDrawContext* GrContext::DrawingMgr::drawContext(const SkSurfaceProps* surfaceProps) {
if (this->abandoned()) {
- return NULL;
+ return nullptr;
}
const SkSurfaceProps props(SkSurfacePropsCopyOrDefault(surfaceProps));
@@ -144,7 +144,7 @@ GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext,
return context;
} else {
context->unref();
- return NULL;
+ return nullptr;
}
}
@@ -158,13 +158,13 @@ static int32_t next_id() {
}
GrContext::GrContext() : fUniqueID(next_id()) {
- fGpu = NULL;
- fCaps = NULL;
- fResourceCache = NULL;
- fResourceProvider = NULL;
- fPathRendererChain = NULL;
- fSoftwarePathRenderer = NULL;
- fBatchFontCache = NULL;
+ fGpu = nullptr;
+ fCaps = nullptr;
+ fResourceCache = nullptr;
+ fResourceProvider = nullptr;
+ fPathRendererChain = nullptr;
+ fSoftwarePathRenderer = nullptr;
+ fBatchFontCache = nullptr;
fFlushToReduceCacheSize = false;
}
@@ -308,7 +308,7 @@ void GrContext::flush(int flagsBitfield) {
bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
const void* inPixels, size_t outRowBytes, void* outPixels) {
SkSrcPixelInfo srcPI;
- if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, NULL)) {
+ if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, nullptr)) {
return false;
}
srcPI.fAlphaType = kUnpremul_SkAlphaType;
@@ -385,7 +385,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
// If premultiplying was the only reason for the draw, fall back to a straight write.
if (!fp) {
if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference) {
- tempTexture.reset(NULL);
+ tempTexture.reset(nullptr);
}
} else {
applyPremulToSrc = false;
@@ -429,7 +429,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
paint.addColorFragmentProcessor(fp);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, matrix, rect, NULL);
+ drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, matrix, rect, nullptr);
if (kFlushWrites_PixelOp & pixelOpsFlags) {
this->flushSurfaceWrites(surface);
@@ -523,7 +523,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
} else if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference) {
// We only wanted to do the draw in order to perform the unpremul so don't
// bother.
- temp.reset(NULL);
+ temp.reset(nullptr);
}
}
if (!fp && temp) {
@@ -536,7 +536,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
GrDrawContext* drawContext = this->drawContext();
drawContext->drawRect(temp->asRenderTarget(), GrClip::WideOpen(), paint,
- SkMatrix::I(), rect, NULL);
+ SkMatrix::I(), rect, nullptr);
surfaceToRead.reset(SkRef(temp.get()));
left = 0;
top = 0;
@@ -564,7 +564,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
// Perform umpremul conversion if we weren't able to perform it as a draw.
if (unpremul) {
SkDstPixelInfo dstPI;
- if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, NULL)) {
+ if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, nullptr)) {
return false;
}
dstPI.fAlphaType = kUnpremul_SkAlphaType;
@@ -708,7 +708,7 @@ const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrProcessorDataManager
return GrConfigConversionEffect::Create(procDataManager, texture, swapRAndB, pmToUPM,
matrix);
} else {
- return NULL;
+ return nullptr;
}
}
@@ -726,7 +726,7 @@ const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrProcessorDataManager
return GrConfigConversionEffect::Create(procDataManager, texture, swapRAndB, upmToPM,
matrix);
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp
index 1f371302f4..d84e589f84 100755
--- a/src/gpu/GrContextFactory.cpp
+++ b/src/gpu/GrContextFactory.cpp
@@ -55,8 +55,8 @@ GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI)
glCtx.reset(SkDebugGLContext::Create(forcedGpuAPI));
break;
}
- if (NULL == glCtx.get()) {
- return NULL;
+ if (nullptr == glCtx.get()) {
+ return nullptr;
}
SkASSERT(glCtx->isValid());
@@ -66,11 +66,11 @@ GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI)
if (kNVPR_GLContextType != type) {
glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface));
if (!glInterface) {
- return NULL;
+ return nullptr;
}
} else {
if (!glInterface->hasExtension("GL_NV_path_rendering")) {
- return NULL;
+ return nullptr;
}
}
@@ -82,7 +82,7 @@ GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI)
grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions));
#endif
if (!grCtx.get()) {
- return NULL;
+ return nullptr;
}
// Warn if path rendering support is not available for the NVPR type.
if (kNVPR_GLContextType == type) {
diff --git a/src/gpu/GrContextFactory.h b/src/gpu/GrContextFactory.h
index 7fd4b77ce0..b557f98fea 100644
--- a/src/gpu/GrContextFactory.h
+++ b/src/gpu/GrContextFactory.h
@@ -116,7 +116,7 @@ public:
// Returns the GLContext of the given type. If it has not been created yet,
- // NULL is returned instead.
+ // nullptr is returned instead.
SkGLContext* getGLContext(GLContextType type) {
for (int i = 0; i < fContexts.count(); ++i) {
if (fContexts[i].fType == type) {
@@ -124,7 +124,7 @@ public:
}
}
- return NULL;
+ return nullptr;
}
const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; }
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index d3363ef602..2017173e6b 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -194,10 +194,10 @@ private:
uint8_t coverage,
bool localCoordsWillBeRead,
bool coverageWillBeIgnored)
- : fInPosition(NULL)
- , fInColor(NULL)
- , fInLocalCoords(NULL)
- , fInCoverage(NULL)
+ : fInPosition(nullptr)
+ , fInColor(nullptr)
+ , fInLocalCoords(nullptr)
+ , fInCoverage(nullptr)
, fColor(color)
, fViewMatrix(viewMatrix)
, fLocalMatrix(localMatrix)
@@ -310,7 +310,7 @@ const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace(
SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType);
if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) {
SkDebugf("Could not invert\n");
- return NULL;
+ return nullptr;
}
if (localCoords.hasLocalMatrix()) {
diff --git a/src/gpu/GrDefaultGeoProcFactory.h b/src/gpu/GrDefaultGeoProcFactory.h
index 2d8055843f..bf2db40ecd 100644
--- a/src/gpu/GrDefaultGeoProcFactory.h
+++ b/src/gpu/GrDefaultGeoProcFactory.h
@@ -107,11 +107,11 @@ namespace GrDefaultGeoProcFactory {
kHasExplicit_Type,
kHasTransformed_Type,
};
- LocalCoords(Type type) : fType(type), fMatrix(NULL) {}
+ LocalCoords(Type type) : fType(type), fMatrix(nullptr) {}
LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(matrix) {
SkASSERT(kUnused_Type != type);
}
- bool hasLocalMatrix() const { return NULL != fMatrix; }
+ bool hasLocalMatrix() const { return nullptr != fMatrix; }
Type fType;
const SkMatrix* fMatrix;
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index cf3f0d336d..f4ce7c85a5 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -321,10 +321,10 @@ private:
return;
}
- const GrIndexBuffer* indexBuffer = NULL;
+ const GrIndexBuffer* indexBuffer = nullptr;
int firstIndex = 0;
- void* indices = NULL;
+ void* indices = nullptr;
if (isIndexed) {
indices = target->makeIndexSpace(maxIndices, &indexBuffer, &firstIndex);
@@ -569,7 +569,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
if (stencilOnly) {
passes[0] = &gDirectToStencil;
} else {
- passes[0] = NULL;
+ passes[0] = nullptr;
}
lastPassIsBounds = false;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
@@ -579,7 +579,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
if (stencilOnly) {
passes[0] = &gDirectToStencil;
} else {
- passes[0] = NULL;
+ passes[0] = nullptr;
}
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
lastPassIsBounds = false;
@@ -710,7 +710,7 @@ bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
// this class can draw any path with any fill but doesn't do any anti-aliasing.
return !args.fAntiAlias && (args.fStroke->isFillStyle() ||
IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix,
- NULL));
+ nullptr));
}
bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 7a508c7f65..e56a729d22 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -24,7 +24,7 @@
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fContext)
#define RETURN_IF_ABANDONED if (!fDrawTarget) { return; }
#define RETURN_FALSE_IF_ABANDONED if (!fDrawTarget) { return false; }
-#define RETURN_NULL_IF_ABANDONED if (!fDrawTarget) { return NULL; }
+#define RETURN_NULL_IF_ABANDONED if (!fDrawTarget) { return nullptr; }
class AutoCheckFlush {
public:
@@ -40,7 +40,7 @@ GrDrawContext::GrDrawContext(GrContext* context,
const SkSurfaceProps& surfaceProps)
: fContext(context)
, fDrawTarget(SkRef(drawTarget))
- , fTextContext(NULL)
+ , fTextContext(nullptr)
, fSurfaceProps(surfaceProps) {
}
@@ -230,7 +230,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
GrPipelineBuilder pipelineBuilder(paint, rt, clip);
- SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getWidth();
+ SkScalar width = nullptr == strokeInfo ? -1 : strokeInfo->getWidth();
// Check if this is a full RT draw and can be replaced with a clear. We don't bother checking
// cases where the RT is fully inside a stroke.
@@ -259,7 +259,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
// Will it blend?
GrColor clearColor;
if (paint.isConstantBlendedColor(&clearColor)) {
- fDrawTarget->clear(NULL, clearColor, true, rt);
+ fDrawTarget->clear(nullptr, clearColor, true, rt);
return;
}
}
@@ -699,7 +699,7 @@ void GrDrawContext::internalDrawPath(GrDrawTarget* target,
*strokeInfoPtr, false, type);
GrStrokeInfo dashlessStrokeInfo(strokeInfo, false);
- if (NULL == pr && strokeInfo.isDashed()) {
+ if (nullptr == pr && strokeInfo.isDashed()) {
// It didn't work above, so try again with dashed stroke converted to a dashless stroke.
if (!strokeInfo.applyDashToPath(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) {
return;
@@ -713,8 +713,8 @@ void GrDrawContext::internalDrawPath(GrDrawTarget* target,
false, type);
}
- if (NULL == pr) {
- if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMatrix, NULL) &&
+ if (nullptr == pr) {
+ if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMatrix, nullptr) &&
!strokeInfoPtr->isFillStyle()) {
// It didn't work above, so try again with stroke converted to a fill.
if (!tmpPath.isValid()) {
@@ -737,7 +737,7 @@ void GrDrawContext::internalDrawPath(GrDrawTarget* target,
true, type);
}
- if (NULL == pr) {
+ if (nullptr == pr) {
#ifdef SK_DEBUG
SkDebugf("Unable to find path renderer compatible with path.\n");
#endif
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 805cfafc57..f3dd2db0bb 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -203,7 +203,7 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
- if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) {
+ if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, nullptr)) {
return;
}
@@ -253,7 +253,7 @@ void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
// instead for it to just copy the entire dst. Realistically this is a moot
// point, because any context that supports NV_path_rendering will also
// support NV_blend_equation_advanced.
- GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, batch, NULL, this);
+ GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, batch, nullptr, this);
if (!pipelineInfo.valid()) {
return;
@@ -286,7 +286,7 @@ void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder,
GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
- if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) {
+ if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, nullptr)) {
return;
}
@@ -300,7 +300,7 @@ void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder,
// instead for it to just copy the entire dst. Realistically this is a moot
// point, because any context that supports NV_path_rendering will also
// support NV_blend_equation_advanced.
- GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pathProc, NULL, this);
+ GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pathProc, nullptr, this);
if (!pipelineInfo.valid()) {
return;
}
@@ -460,7 +460,7 @@ GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc);
if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPOI,
fArgs.fCoveragePOI, &fArgs.fDstTexture, devBounds)) {
- fArgs.fPipelineBuilder = NULL;
+ fArgs.fPipelineBuilder = nullptr;
}
}
@@ -476,7 +476,7 @@ GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(batch);
if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPOI,
fArgs.fCoveragePOI, &fArgs.fDstTexture, devBounds)) {
- fArgs.fPipelineBuilder = NULL;
+ fArgs.fPipelineBuilder = nullptr;
}
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 48ac06d94e..13cf990aed 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -114,9 +114,9 @@ public:
*
* @param rect the rect to draw
* @param localRect optional rect that specifies local coords to map onto
- * rect. If NULL then rect serves as the local coords.
+ * rect. If nullptr then rect serves as the local coords.
* @param localMatrix Optional local matrix. The local coordinates are specified by localRect,
- * or if it is NULL by rect. This matrix applies to the coordinate implied by
+ * or if it is nullptr by rect. This matrix applies to the coordinate implied by
* that rectangle before it is input to GrCoordTransforms that read local
* coordinates
*/
@@ -153,7 +153,7 @@ public:
/**
* Clear the passed in render target. Ignores the GrPipelineBuilder and clip. Clears the whole
- * thing if rect is NULL, otherwise just the rect. If canIgnoreRect is set then the entire
+ * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is set then the entire
* render target can be optionally cleared.
*/
void clear(const SkIRect* rect,
diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp
index d923c7dc2a..c8412027c0 100644
--- a/src/gpu/GrFontScaler.cpp
+++ b/src/gpu/GrFontScaler.cpp
@@ -15,7 +15,7 @@
GrFontScaler::GrFontScaler(SkGlyphCache* strike) {
fStrike = strike;
- fKey = NULL;
+ fKey = nullptr;
}
GrFontScaler::~GrFontScaler() {
@@ -40,7 +40,7 @@ GrMaskFormat GrFontScaler::getMaskFormat() const {
}
const GrFontDescKey* GrFontScaler::getKey() {
- if (NULL == fKey) {
+ if (nullptr == fKey) {
fKey = new GrFontDescKey(fStrike->getDescriptor());
}
return fKey;
@@ -117,7 +117,7 @@ bool GrFontScaler::getPackedGlyphImage(const SkGlyph& glyph, int width, int heig
SkASSERT(glyph.fWidth == width);
SkASSERT(glyph.fHeight == height);
const void* src = fStrike->findImage(glyph);
- if (NULL == src) {
+ if (nullptr == src) {
return false;
}
@@ -171,7 +171,7 @@ bool GrFontScaler::getPackedGlyphDFImage(const SkGlyph& glyph, int width, int he
SkASSERT(glyph.fWidth + 2*SK_DistanceFieldPad == width);
SkASSERT(glyph.fHeight + 2*SK_DistanceFieldPad == height);
const void* image = fStrike->findImage(glyph);
- if (NULL == image) {
+ if (nullptr == image) {
return false;
}
// now generate the distance field
diff --git a/src/gpu/GrGeometryBuffer.h b/src/gpu/GrGeometryBuffer.h
index adccbf80e4..56a6cae3fb 100644
--- a/src/gpu/GrGeometryBuffer.h
+++ b/src/gpu/GrGeometryBuffer.h
@@ -48,7 +48,7 @@ public:
* Note that buffer mapping does not go through GrContext and therefore is
* not serialized with other operations.
*
- * @return a pointer to the data or NULL if the map fails.
+ * @return a pointer to the data or nullptr if the map fails.
*/
void* map() { return (fMapPtr = this->onMap()); }
@@ -60,14 +60,14 @@ public:
void unmap() {
SkASSERT(fMapPtr);
this->onUnmap();
- fMapPtr = NULL;
+ fMapPtr = nullptr;
}
/**
- * Returns the same ptr that map() returned at time of map or NULL if the
+ * Returns the same ptr that map() returned at time of map or nullptr if the
* is not mapped.
*
- * @return ptr to mapped buffer data or NULL if buffer is not mapped.
+ * @return ptr to mapped buffer data or nullptr if buffer is not mapped.
*/
void* mapPtr() const { return fMapPtr; }
@@ -101,7 +101,7 @@ public:
protected:
GrGeometryBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacked)
: INHERITED(gpu, kCached_LifeCycle)
- , fMapPtr(NULL)
+ , fMapPtr(nullptr)
, fGpuMemorySize(gpuMemorySize)
, fDynamic(dynamic)
, fCPUBacked(cpuBacked) {}
diff --git a/src/gpu/GrGlyph.h b/src/gpu/GrGlyph.h
index 6a4166f5ff..55e925f09d 100644
--- a/src/gpu/GrGlyph.h
+++ b/src/gpu/GrGlyph.h
@@ -41,7 +41,7 @@ struct GrGlyph {
void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat format) {
fID = GrBatchAtlas::kInvalidAtlasID;
- fPath = NULL;
+ fPath = nullptr;
fPackedID = packed;
fBounds.set(bounds);
fMaskFormat = format;
@@ -52,7 +52,7 @@ struct GrGlyph {
void free() {
if (fPath) {
delete fPath;
- fPath = NULL;
+ fPath = nullptr;
}
}
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 6a1c1dd5c9..2fdfbc4242 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -71,30 +71,30 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted,
GrSurfaceDesc desc = origDesc;
if (!this->caps()->isConfigTexturable(desc.fConfig)) {
- return NULL;
+ return nullptr;
}
bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
- return NULL;
+ return nullptr;
}
// We currently do not support multisampled textures
if (!isRT && desc.fSampleCnt > 0) {
- return NULL;
+ return nullptr;
}
- GrTexture *tex = NULL;
+ GrTexture *tex = nullptr;
if (isRT) {
int maxRTSize = this->caps()->maxRenderTargetSize();
if (desc.fWidth > maxRTSize || desc.fHeight > maxRTSize) {
- return NULL;
+ return nullptr;
}
} else {
int maxSize = this->caps()->maxTextureSize();
if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
- return NULL;
+ return nullptr;
}
}
@@ -114,7 +114,7 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted,
if (!this->caps()->npotTextureTileSupport() &&
(!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) {
- return NULL;
+ return nullptr;
}
this->handleDirtyContext();
@@ -136,7 +136,7 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted,
}
bool GrGpu::attachStencilAttachmentToRenderTarget(GrRenderTarget* rt) {
- SkASSERT(NULL == rt->renderTargetPriv().getStencilAttachment());
+ SkASSERT(nullptr == rt->renderTargetPriv().getStencilAttachment());
GrUniqueKey sbKey;
int width = rt->width();
@@ -180,14 +180,14 @@ bool GrGpu::attachStencilAttachmentToRenderTarget(GrRenderTarget* rt) {
GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwnership ownership) {
this->handleDirtyContext();
GrTexture* tex = this->onWrapBackendTexture(desc, ownership);
- if (NULL == tex) {
- return NULL;
+ if (nullptr == tex) {
+ return nullptr;
}
// TODO: defer this and attach dynamically
GrRenderTarget* tgt = tex->asRenderTarget();
if (tgt && !this->attachStencilAttachmentToRenderTarget(tgt)) {
tex->unref();
- return NULL;
+ return nullptr;
} else {
return tex;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 783376d768..290e981dc3 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -38,7 +38,7 @@ class GrGpu : public SkRefCnt {
public:
/**
* Create an instance of GrGpu that matches the specified backend. If the requested backend is
- * not supported (at compile-time or run-time) this returns NULL. The context will not be
+ * not supported (at compile-time or run-time) this returns nullptr. The context will not be
* fully constructed and should not be used by GrGpu until after this function returns.
*/
static GrGpu* Create(GrBackend, GrBackendContext, const GrContextOptions&, GrContext* context);
@@ -83,13 +83,13 @@ public:
* @param srcData texel data to load texture. Begins with full-size
* palette data for paletted textures. For compressed
* formats it contains the compressed pixel data. Otherwise,
- * it contains width*height texels. If NULL texture data
+ * it contains width*height texels. If nullptr texture data
* is uninitialized.
* @param rowBytes the number of bytes between consecutive rows. Zero
* means rows are tightly packed. This field is ignored
* for compressed formats.
*
- * @return The texture object if successful, otherwise NULL.
+ * @return The texture object if successful, otherwise nullptr.
*/
GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted,
const void* srcData, size_t rowBytes);
@@ -112,7 +112,7 @@ public:
* by either GrVertexBuffer::map() or
* GrVertexBuffer::updateData().
*
- * @return The vertex buffer if successful, otherwise NULL.
+ * @return The vertex buffer if successful, otherwise nullptr.
*/
GrVertexBuffer* createVertexBuffer(size_t size, bool dynamic);
@@ -124,7 +124,7 @@ public:
* by either GrIndexBuffer::map() or
* GrIndexBuffer::updateData().
*
- * @return The index buffer if successful, otherwise NULL.
+ * @return The index buffer if successful, otherwise nullptr.
*/
GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic);
@@ -257,10 +257,10 @@ public:
void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget);
/**
- * Discards the contents render target. NULL indicates that the current render target should
+ * Discards the contents render target. nullptr indicates that the current render target should
* be discarded.
**/
- virtual void discard(GrRenderTarget* = NULL) = 0;
+ virtual void discard(GrRenderTarget* = nullptr) = 0;
/**
* This is can be called before allocating a texture to be a dst for copySurface. It will
@@ -393,7 +393,7 @@ public:
bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
// This is only to be used in GL-specific tests.
- virtual const GrGLContext* glContextForTesting() const { return NULL; }
+ virtual const GrGLContext* glContextForTesting() const { return nullptr; }
protected:
// Functions used to map clip-respecting stencil tests into normal
diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp
index 854e484747..f769ce4c57 100644
--- a/src/gpu/GrGpuFactory.cpp
+++ b/src/gpu/GrGpuFactory.cpp
@@ -13,7 +13,7 @@
#include "gl/GrGLConfig.h"
#include "gl/GrGLGpu.h"
-static CreateGpuProc gGpuFactories[kBackendCount] = { GrGLGpu::Create, NULL };
+static CreateGpuProc gGpuFactories[kBackendCount] = { GrGLGpu::Create, nullptr };
#ifdef SK_VULKAN
extern GrGpu* vk_gpu_create(GrBackendContext backendContext, const GrContextOptions& options,
@@ -31,7 +31,7 @@ GrGpu* GrGpu::Create(GrBackend backend,
GrContext* context) {
SkASSERT((int)backend < kBackendCount);
if (!gGpuFactories[backend]) {
- return NULL;
+ return nullptr;
}
return (gGpuFactories[backend])(backendContext, options, context);
}
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 53782a7704..df8301c506 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -40,7 +40,7 @@ void GrGpuResource::release() {
SkASSERT(fGpu);
this->onRelease();
get_resource_cache(fGpu)->resourceAccess().removeResource(this);
- fGpu = NULL;
+ fGpu = nullptr;
fGpuMemorySize = 0;
}
@@ -48,7 +48,7 @@ void GrGpuResource::abandon() {
SkASSERT(fGpu);
this->onAbandon();
get_resource_cache(fGpu)->resourceAccess().removeResource(this);
- fGpu = NULL;
+ fGpu = nullptr;
fGpuMemorySize = 0;
}
@@ -62,7 +62,7 @@ const GrContext* GrGpuResource::getContext() const {
if (fGpu) {
return fGpu->getContext();
} else {
- return NULL;
+ return nullptr;
}
}
@@ -70,7 +70,7 @@ GrContext* GrGpuResource::getContext() {
if (fGpu) {
return fGpu->getContext();
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
index 9e0e6f8e50..405679d4f1 100644
--- a/src/gpu/GrGpuResourceRef.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -8,13 +8,13 @@
#include "GrGpuResourceRef.h"
GrGpuResourceRef::GrGpuResourceRef() {
- fResource = NULL;
+ fResource = nullptr;
fOwnRef = false;
fPendingIO = false;
}
GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType) {
- fResource = NULL;
+ fResource = nullptr;
fOwnRef = false;
fPendingIO = false;
this->setResource(resource, ioType);
@@ -47,7 +47,7 @@ void GrGpuResourceRef::reset() {
if (fOwnRef) {
fResource->unref();
fOwnRef = false;
- fResource = NULL;
+ fResource = nullptr;
}
}
@@ -55,8 +55,8 @@ void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) {
SkASSERT(!fPendingIO);
SkASSERT(SkToBool(fResource) == fOwnRef);
SkSafeUnref(fResource);
- if (NULL == resource) {
- fResource = NULL;
+ if (nullptr == resource) {
+ fResource = nullptr;
fOwnRef = false;
} else {
fResource = resource;
diff --git a/src/gpu/GrInOrderCommandBuilder.cpp b/src/gpu/GrInOrderCommandBuilder.cpp
index f69dbb49cc..b9387e9486 100644
--- a/src/gpu/GrInOrderCommandBuilder.cpp
+++ b/src/gpu/GrInOrderCommandBuilder.cpp
@@ -34,7 +34,7 @@ GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(GrBatch* batch,
if (previous->batch()->combineIfPossible(batch, caps)) {
GrBATCH_INFO("\tBatching with (%s, %u)\n",
previous->batch()->name(), previous->batch()->uniqueID());
- return NULL;
+ return nullptr;
}
}
@@ -88,7 +88,7 @@ GrInOrderCommandBuilder::recordDrawPaths(State* state,
&previous->fTransforms[previous->fCount * xformSize] == savedTransforms)) {
// Combine this DrawPaths call with the one previous.
previous->fCount += count;
- return NULL;
+ return nullptr;
}
}
}
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index e894c3023e..f33384c3e9 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -25,7 +25,7 @@ void GrCachedLayer::validate(const GrTexture* backingTexture) const {
}
} else {
SkASSERT(fRect.isEmpty());
- SkASSERT(NULL == fPlot);
+ SkASSERT(nullptr == fPlot);
SkASSERT(!fLocked); // layers without a texture cannot be locked
}
@@ -68,7 +68,7 @@ public:
}
}
void setBackingTexture(GrTexture* backingTexture) {
- SkASSERT(NULL == fBackingTexture || fBackingTexture == backingTexture);
+ SkASSERT(nullptr == fBackingTexture || fBackingTexture == backingTexture);
fBackingTexture = backingTexture;
}
@@ -100,7 +100,7 @@ GrLayerCache::~GrLayerCache() {
}
void GrLayerCache::initAtlas() {
- SkASSERT(NULL == fAtlas.get());
+ SkASSERT(nullptr == fAtlas.get());
GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots);
SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight);
@@ -155,7 +155,7 @@ GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID,
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySize));
- if (NULL == layer) {
+ if (nullptr == layer) {
layer = this->createLayer(pictureID, start, stop,
srcIR, dstIR, initialMat,
key, keySize, paint);
@@ -167,7 +167,7 @@ GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID,
bool GrLayerCache::tryToAtlas(GrCachedLayer* layer,
const GrSurfaceDesc& desc,
bool* needsRendering) {
- SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : NULL, layer);)
+ SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : nullptr, layer);)
SkASSERT(PlausiblyAtlasable(desc.fWidth, desc.fHeight));
SkASSERT(0 == desc.fSampleCnt);
@@ -198,7 +198,7 @@ bool GrLayerCache::tryToAtlas(GrCachedLayer* layer,
}
// Not in the atlas - will it fit?
GrPictureInfo* pictInfo = fPictureHash.find(layer->pictureID());
- if (NULL == pictInfo) {
+ if (nullptr == pictInfo) {
pictInfo = new GrPictureInfo(layer->pictureID());
fPictureHash.add(pictInfo);
}
@@ -207,7 +207,7 @@ bool GrLayerCache::tryToAtlas(GrCachedLayer* layer,
for (int i = 0; i < 2; ++i) { // extra pass in case we fail to add but are able to purge
GrPlot* plot = fAtlas->addToAtlas(&pictInfo->fPlotUsage,
desc.fWidth, desc.fHeight,
- NULL, &loc);
+ nullptr, &loc);
// addToAtlas can allocate the backing texture
SkDEBUGCODE(avl.setBackingTexture(fAtlas->getTexture()));
if (plot) {
@@ -267,9 +267,9 @@ bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
}
void GrLayerCache::unlock(GrCachedLayer* layer) {
- SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : NULL, layer);)
+ SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : nullptr, layer);)
- if (NULL == layer || !layer->locked()) {
+ if (nullptr == layer || !layer->locked()) {
// invalid or not locked
return;
}
@@ -298,12 +298,12 @@ void GrLayerCache::unlock(GrCachedLayer* layer) {
}
}
- layer->setPlot(NULL);
- layer->setTexture(NULL, SkIRect::MakeEmpty());
+ layer->setPlot(nullptr);
+ layer->setTexture(nullptr, SkIRect::MakeEmpty());
#endif
} else {
- layer->setTexture(NULL, SkIRect::MakeEmpty());
+ layer->setTexture(nullptr, SkIRect::MakeEmpty());
}
layer->setLocked(false);
@@ -318,7 +318,7 @@ void GrLayerCache::validate() const {
for (; !iter.done(); ++iter) {
const GrCachedLayer* layer = &(*iter);
- layer->validate(fAtlas.get() ? fAtlas->getTexture() : NULL);
+ layer->validate(fAtlas.get() ? fAtlas->getTexture() : nullptr);
const GrPictureInfo* pictInfo = fPictureHash.find(layer->pictureID());
if (!pictInfo) {
@@ -489,7 +489,7 @@ void GrLayerCache::writeLayersToDisk(const SkString& dirName) {
if (fAtlas) {
GrTexture* atlasTexture = fAtlas->getTexture();
- if (NULL != atlasTexture) {
+ if (nullptr != atlasTexture) {
SkString fileName(dirName);
fileName.append("\\atlas.png");
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index 4ab0fa4eff..0fb23f2298 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -158,11 +158,11 @@ public:
, fSrcIR(srcIR)
, fDstIR(dstIR)
, fOffset(SkIPoint::Make(0, 0))
- , fPaint(paint ? new SkPaint(*paint) : NULL)
- , fFilter(NULL)
- , fTexture(NULL)
+ , fPaint(paint ? new SkPaint(*paint) : nullptr)
+ , fFilter(nullptr)
+ , fTexture(nullptr)
, fRect(SkIRect::MakeEmpty())
- , fPlot(NULL)
+ , fPlot(nullptr)
, fUses(0)
, fLocked(false) {
SkASSERT(SK_InvalidGenID != pictureID);
@@ -170,7 +170,7 @@ public:
if (fPaint) {
if (fPaint->getImageFilter()) {
fFilter = SkSafeRef(fPaint->getImageFilter());
- fPaint->setImageFilter(NULL);
+ fPaint->setImageFilter(nullptr);
}
}
}
@@ -207,7 +207,7 @@ public:
const SkIPoint& offset() const { return fOffset; }
void setPlot(GrPlot* plot) {
- SkASSERT(NULL == plot || NULL == fPlot);
+ SkASSERT(nullptr == plot || nullptr == fPlot);
fPlot = plot;
}
GrPlot* plot() { return fPlot; }
@@ -237,7 +237,7 @@ private:
SkIPoint fOffset;
// The paint used when dropping the layer down into the owning canvas.
- // Can be NULL. This class makes a copy for itself.
+ // Can be nullptr. This class makes a copy for itself.
SkPaint* fPaint;
// The imagefilter that needs to be applied to the layer prior to it being
@@ -250,11 +250,11 @@ private:
// For both atlased and non-atlased layers 'fRect' contains the bound of
// the layer in whichever texture it resides. It is empty when 'fTexture'
- // is NULL.
+ // is nullptr.
SkIRect fRect;
// For atlased layers, fPlot stores the atlas plot in which the layer rests.
- // It is always NULL for non-atlased layers.
+ // It is always nullptr for non-atlased layers.
GrPlot* fPlot;
// The number of actively hoisted layers using this cached image (e.g.,
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 59a4da1b23..baeb3784ed 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -130,7 +130,7 @@ void GrLayerHoister::FindLayersToAtlas(GrContext* context,
GrLayerCache* layerCache = context->getLayerCache();
layerCache->processDeletedPictures();
- const SkBigPicture::AccelData* topLevelData = NULL;
+ const SkBigPicture::AccelData* topLevelData = nullptr;
if (const SkBigPicture* bp = topLevelPicture->asSkBigPicture()) {
topLevelData = bp->accelData();
}
@@ -188,7 +188,7 @@ void GrLayerHoister::FindLayersToHoist(GrContext* context,
layerCache->processDeletedPictures();
- const SkBigPicture::AccelData* topLevelData = NULL;
+ const SkBigPicture::AccelData* topLevelData = nullptr;
if (const SkBigPicture* bp = topLevelPicture->asSkBigPicture()) {
topLevelData = bp->accelData();
}
diff --git a/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index e59ed83d27..cc26452c19 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -25,8 +25,8 @@ GrMemoryPool::GrMemoryPool(size_t preallocSize, size_t minAllocSize) {
fHead = CreateBlock(fPreallocSize);
fTail = fHead;
- fHead->fNext = NULL;
- fHead->fPrev = NULL;
+ fHead->fNext = nullptr;
+ fHead->fPrev = nullptr;
VALIDATE;
};
@@ -48,8 +48,8 @@ void* GrMemoryPool::allocate(size_t size) {
BlockHeader* block = CreateBlock(blockSize);
block->fPrev = fTail;
- block->fNext = NULL;
- SkASSERT(NULL == fTail->fNext);
+ block->fNext = nullptr;
+ SkASSERT(nullptr == fTail->fNext);
fTail->fNext = block;
fTail = block;
fSize += block->fSize;
@@ -117,7 +117,7 @@ GrMemoryPool::BlockHeader* GrMemoryPool::CreateBlock(size_t size) {
block->fLiveCount = 0;
block->fFreeSize = size;
block->fCurrPtr = reinterpret_cast<intptr_t>(block) + kHeaderSize;
- block->fPrevPtr = 0; // gcc warns on assigning NULL to an intptr_t.
+ block->fPrevPtr = 0; // gcc warns on assigning nullptr to an intptr_t.
block->fSize = paddedSize;
return block;
}
@@ -129,7 +129,7 @@ void GrMemoryPool::DeleteBlock(BlockHeader* block) {
void GrMemoryPool::validate() {
#ifdef SK_DEBUG
BlockHeader* block = fHead;
- BlockHeader* prev = NULL;
+ BlockHeader* prev = nullptr;
SkASSERT(block);
int allocCount = 0;
do {
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 48476122cb..e2a4e9a21a 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -1046,13 +1046,13 @@ static GrDrawBatch* create_ellipse_batch(GrColor color,
// we only handle thick strokes for near-circular ellipses
if (scaledStroke.length() > SK_ScalarHalf &&
(SK_ScalarHalf*xRadius > yRadius || SK_ScalarHalf*yRadius > xRadius)) {
- return NULL;
+ return nullptr;
}
// we don't handle it if curvature of the stroke is less than curvature of the ellipse
if (scaledStroke.fX*(yRadius*yRadius) < (scaledStroke.fY*scaledStroke.fY)*xRadius ||
scaledStroke.fY*(xRadius*xRadius) < (scaledStroke.fX*scaledStroke.fX)*yRadius) {
- return NULL;
+ return nullptr;
}
// this is legit only if scale & translation (which should be the case at the moment)
@@ -1286,13 +1286,13 @@ static GrDrawBatch* create_diellipse_batch(GrColor color,
// we only handle thick strokes for near-circular ellipses
if (strokeWidth > SK_ScalarHalf &&
(SK_ScalarHalf*xRadius > yRadius || SK_ScalarHalf*yRadius > xRadius)) {
- return NULL;
+ return nullptr;
}
// we don't handle it if curvature of the stroke is less than curvature of the ellipse
if (strokeWidth*(yRadius*yRadius) < (strokeWidth*strokeWidth)*xRadius ||
strokeWidth*(xRadius*xRadius) < (strokeWidth*strokeWidth)*yRadius) {
- return NULL;
+ return nullptr;
}
// set inner radius (if needed)
@@ -1415,7 +1415,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
kInverseFillBW_GrProcessorEdgeType;
// TODO this needs to be a geometry processor
GrFragmentProcessor* fp = GrRRectEffect::Create(edgeType, *inner);
- if (NULL == fp) {
+ if (nullptr == fp) {
return false;
}
arfps.set(&pipelineBuilder);
@@ -1437,7 +1437,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
GrPrimitiveEdgeType edgeType = applyAA ? kFillAA_GrProcessorEdgeType :
kFillBW_GrProcessorEdgeType;
GrFragmentProcessor* effect = GrRRectEffect::Create(edgeType, *outer);
- if (NULL == effect) {
+ if (nullptr == effect) {
return false;
}
if (!arfps.isSet()) {
@@ -1863,7 +1863,7 @@ static GrDrawBatch* create_rrect_batch(GrColor color,
// if half of strokewidth is greater than radius, we don't handle that right now
if (SK_ScalarHalf*scaledStroke.fX > xRadius || SK_ScalarHalf*scaledStroke.fY > yRadius) {
- return NULL;
+ return nullptr;
}
}
@@ -1873,7 +1873,7 @@ static GrDrawBatch* create_rrect_batch(GrColor color,
// We could consider falling back to rect rendering here, since a tiny radius is
// indistinguishable from a square corner.
if (!isStrokeOnly && (SK_ScalarHalf > xRadius || SK_ScalarHalf > yRadius)) {
- return NULL;
+ return nullptr;
}
// if the corners are circles, use the circle renderer
@@ -1931,13 +1931,13 @@ static GrDrawBatch* create_rrect_batch(GrColor color,
// we only handle thick strokes for near-circular ellipses
if (scaledStroke.length() > SK_ScalarHalf &&
(SK_ScalarHalf*xRadius > yRadius || SK_ScalarHalf*yRadius > xRadius)) {
- return NULL;
+ return nullptr;
}
// we don't handle it if curvature of the stroke is less than curvature of the ellipse
if (scaledStroke.fX*(yRadius*yRadius) < (scaledStroke.fY*scaledStroke.fY)*xRadius ||
scaledStroke.fY*(xRadius*xRadius) < (scaledStroke.fX*scaledStroke.fX)*yRadius) {
- return NULL;
+ return nullptr;
}
// this is legit only if scale & translation (which should be the case at the moment)
diff --git a/src/gpu/GrPathRange.h b/src/gpu/GrPathRange.h
index 0ba3996ecf..a2483c13c2 100644
--- a/src/gpu/GrPathRange.h
+++ b/src/gpu/GrPathRange.h
@@ -72,7 +72,7 @@ public:
#ifdef SK_DEBUG
virtual bool isEqualTo(const SkDescriptor& desc) const {
- return NULL != fPathGenerator.get() && fPathGenerator->isEqualTo(desc);
+ return nullptr != fPathGenerator.get() && fPathGenerator->isEqualTo(desc);
}
#endif
protected:
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 62193f30c1..e408762d0a 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -80,7 +80,7 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
return fChain[i];
}
}
- return NULL;
+ return nullptr;
}
void GrPathRendererChain::init() {
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp
index 710b828ac9..d98d9d2f30 100644
--- a/src/gpu/GrPathRendering.cpp
+++ b/src/gpu/GrPathRendering.cpp
@@ -57,9 +57,9 @@ private:
GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
const SkDescriptor* desc,
const GrStrokeInfo& stroke) {
- if (NULL == typeface) {
+ if (nullptr == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
- SkASSERT(NULL != typeface);
+ SkASSERT(nullptr != typeface);
}
if (desc) {
diff --git a/src/gpu/GrPathUtils.h b/src/gpu/GrPathUtils.h
index 8e52e332df..385cc0e470 100644
--- a/src/gpu/GrPathUtils.h
+++ b/src/gpu/GrPathUtils.h
@@ -129,11 +129,11 @@ namespace GrPathUtils {
// the double point: ls and ms. We chop the cubic at these values if they are between 0 and 1.
// Return value:
// Value of 3: ls and ms are both between (0,1), and dst will contain the three cubics,
- // dst[0..3], dst[3..6], and dst[6..9] if dst is not NULL
+ // dst[0..3], dst[3..6], and dst[6..9] if dst is not nullptr
// Value of 2: Only one of ls and ms are between (0,1), and dst will contain the two cubics,
- // dst[0..3] and dst[3..6] if dst is not NULL
+ // dst[0..3] and dst[3..6] if dst is not nullptr
// Value of 1: Neither ls or ms are between (0,1), and dst will contain the one original cubic,
- // dst[0..3] if dst is not NULL
+ // dst[0..3] if dst is not nullptr
//
// Optional KLM Calculation:
// The function can also return the KLM linear functionals for the chopped cubic implicit form
@@ -153,8 +153,8 @@ namespace GrPathUtils {
// Notice that the klm lines are calculated in the same space as the input control points.
// If you transform the points the lines will also need to be transformed. This can be done
// by mapping the lines with the inverse-transpose of the matrix used to map the points.
- int chopCubicAtLoopIntersection(const SkPoint src[4], SkPoint dst[10] = NULL,
- SkScalar klm[9] = NULL, SkScalar klm_rev[3] = NULL);
+ int chopCubicAtLoopIntersection(const SkPoint src[4], SkPoint dst[10] = nullptr,
+ SkScalar klm[9] = nullptr, SkScalar klm_rev[3] = nullptr);
// Input is p which holds the 4 control points of a non-rational cubic Bezier curve.
// Output is the coefficients of the three linear functionals K, L, & M which
diff --git a/src/gpu/GrPendingProgramElement.h b/src/gpu/GrPendingProgramElement.h
index 7285ecba00..69e459f08e 100644
--- a/src/gpu/GrPendingProgramElement.h
+++ b/src/gpu/GrPendingProgramElement.h
@@ -18,7 +18,7 @@
*/
template <typename T> class GrPendingProgramElement : SkNoncopyable {
public:
- GrPendingProgramElement() : fObj(NULL) { };
+ GrPendingProgramElement() : fObj(nullptr) { };
// Adds a pending execution on obj.
explicit GrPendingProgramElement(T* obj) : fObj(obj) {
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index 0af0eab271..54242e7a12 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -80,7 +80,7 @@ void GrPipelineBuilder::AutoRestoreFragmentProcessorState::set(
fPipelineBuilder->getProcessorDataManager()->restoreToSaveMarker(/*fSaveMarker*/);
}
fPipelineBuilder = const_cast<GrPipelineBuilder*>(pipelineBuilder);
- if (NULL != pipelineBuilder) {
+ if (nullptr != pipelineBuilder) {
fColorEffectCnt = pipelineBuilder->numColorFragmentProcessors();
fCoverageEffectCnt = pipelineBuilder->numCoverageFragmentProcessors();
SkDEBUGCODE(++pipelineBuilder->fBlockEffectRemovalCnt;)
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 47b996ad3d..0ac6485095 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -114,20 +114,20 @@ public:
class AutoRestoreFragmentProcessorState : public ::SkNoncopyable {
public:
AutoRestoreFragmentProcessorState()
- : fPipelineBuilder(NULL)
+ : fPipelineBuilder(nullptr)
, fColorEffectCnt(0)
, fCoverageEffectCnt(0)
, fSaveMarker(0) {}
AutoRestoreFragmentProcessorState(const GrPipelineBuilder& ds)
- : fPipelineBuilder(NULL)
+ : fPipelineBuilder(nullptr)
, fColorEffectCnt(0)
, fCoverageEffectCnt(0)
, fSaveMarker(0) {
this->set(&ds);
}
- ~AutoRestoreFragmentProcessorState() { this->set(NULL); }
+ ~AutoRestoreFragmentProcessorState() { this->set(nullptr); }
void set(const GrPipelineBuilder* ds);
@@ -257,11 +257,11 @@ public:
*/
class AutoRestoreStencil : public ::SkNoncopyable {
public:
- AutoRestoreStencil() : fPipelineBuilder(NULL) {}
+ AutoRestoreStencil() : fPipelineBuilder(nullptr) {}
- AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(NULL) { this->set(&ds); }
+ AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(nullptr) { this->set(&ds); }
- ~AutoRestoreStencil() { this->set(NULL); }
+ ~AutoRestoreStencil() { this->set(nullptr); }
void set(const GrPipelineBuilder* ds) {
if (fPipelineBuilder) {
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 6c886aeb63..bd769e4140 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -193,7 +193,7 @@ public:
struct Attribute {
Attribute()
- : fName(NULL)
+ : fName(nullptr)
, fType(kFloat_GrVertexAttribType)
, fOffset(0) {}
Attribute(const char* name, GrVertexAttribType type,
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index 5f0adb1601..bca9255856 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -64,7 +64,7 @@ public:
const SkMatrix& initialMatrix,
SkPicture::AbortCallback* callback,
const int* opIndices, int numIndices)
- : INHERITED(canvas, drawablePicts, NULL, drawableCount)
+ : INHERITED(canvas, drawablePicts, nullptr, drawableCount)
, fCanvas(canvas)
, fLayerCache(layerCache)
, fTopLevelPicture(topLevelPicture)
@@ -79,7 +79,7 @@ public:
int draw() {
const SkBBoxHierarchy* bbh = fPicture->bbh();
const SkRecord* record = fPicture->record();
- if (NULL == record) {
+ if (nullptr == record) {
return 0;
}
@@ -218,9 +218,9 @@ int GrRecordReplaceDraw(const SkPicture* picture,
if (const SkBigPicture* bp = picture->asSkBigPicture()) {
// TODO: drawablePicts?
- ReplaceDraw draw(canvas, layerCache, NULL, 0,
+ ReplaceDraw draw(canvas, layerCache, nullptr, 0,
bp, bp,
- initialMatrix, callback, NULL, 0);
+ initialMatrix, callback, nullptr, 0);
return draw.draw();
} else {
// TODO: can we assume / assert this doesn't happen?
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index ca97098794..137c83e411 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -34,7 +34,7 @@ static void reduced_stack_walker(const SkClipStack& stack,
int numAAElements = 0;
while ((kUnknown_InitialState == *initialState)) {
const Element* element = iter.prev();
- if (NULL == element) {
+ if (nullptr == element) {
*initialState = GrReducedClip::kAllIn_InitialState;
break;
}
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index 21899c73aa..a0ce08a043 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -27,10 +27,10 @@ public:
* the list of elements is returned in resultGenID. The initial state of the
* query rectangle before the first clip element is applied is returned via
* initialState. Optionally, the caller can request a tighter bounds on the
- * clip be returned via tighterBounds. If not NULL, tighterBounds will
+ * clip be returned via tighterBounds. If not nullptr, tighterBounds will
* always be contained by queryBounds after return. If tighterBounds is
* specified then it is assumed that the caller will implicitly clip against
- * it. If the caller specifies non-NULL for requiresAA then it will indicate
+ * it. If the caller specifies non-nullptr for requiresAA then it will indicate
* whether anti-aliasing is required to process any of the elements in the
* result.
*
@@ -42,8 +42,8 @@ public:
ElementList* result,
int32_t* resultGenID,
InitialState* initialState,
- SkIRect* tighterBounds = NULL,
- bool* requiresAA = NULL);
+ SkIRect* tighterBounds = nullptr,
+ bool* requiresAA = nullptr);
};
#endif
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 59a7ae5a2a..090834912a 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -18,7 +18,7 @@
void GrRenderTarget::discard() {
// go through context so that all necessary flushing occurs
GrContext* context = this->getContext();
- GrDrawContext* drawContext = context ? context->drawContext() : NULL;
+ GrDrawContext* drawContext = context ? context->drawContext() : nullptr;
if (!drawContext) {
return;
}
@@ -51,13 +51,13 @@ void GrRenderTarget::overrideResolveRect(const SkIRect rect) {
}
void GrRenderTarget::onRelease() {
- this->renderTargetPriv().didAttachStencilAttachment(NULL);
+ this->renderTargetPriv().didAttachStencilAttachment(nullptr);
INHERITED::onRelease();
}
void GrRenderTarget::onAbandon() {
- this->renderTargetPriv().didAttachStencilAttachment(NULL);
+ this->renderTargetPriv().didAttachStencilAttachment(nullptr);
INHERITED::onAbandon();
}
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp
index af34998613..b0f9ee2f39 100644
--- a/src/gpu/GrReorderCommandBuilder.cpp
+++ b/src/gpu/GrReorderCommandBuilder.cpp
@@ -50,7 +50,7 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrBatch* batch,
if (previous->batch()->combineIfPossible(batch, caps)) {
GrBATCH_INFO("\t\tCombining with (%s, B%u)\n",
previous->batch()->name(), previous->batch()->uniqueID());
- return NULL;
+ return nullptr;
}
if (intersect(previous->batch()->bounds(), batch->bounds())) {
diff --git a/src/gpu/GrReorderCommandBuilder.h b/src/gpu/GrReorderCommandBuilder.h
index a1c7fae67b..a5d6e487dc 100644
--- a/src/gpu/GrReorderCommandBuilder.h
+++ b/src/gpu/GrReorderCommandBuilder.h
@@ -31,7 +31,7 @@ public:
const GrStencilSettings&,
const GrPipelineOptimizations&) override {
SkFAIL("Unsupported\n");
- return NULL;
+ return nullptr;
}
private:
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 85a302186d..e605856b70 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -72,13 +72,13 @@ GrResourceCache::GrResourceCache(const GrCaps* caps)
, fBytes(0)
, fBudgetedCount(0)
, fBudgetedBytes(0)
- , fOverBudgetCB(NULL)
- , fOverBudgetData(NULL)
- , fFlushTimestamps(NULL)
+ , fOverBudgetCB(nullptr)
+ , fOverBudgetData(nullptr)
+ , fFlushTimestamps(nullptr)
, fLastFlushTimestampIndex(0)
, fPreferVRAMUseOverFlushes(caps->preferVRAMUseOverFlushes()) {
SkDEBUGCODE(fCount = 0;)
- SkDEBUGCODE(fNewlyPurgeableResourceForValidation = NULL;)
+ SkDEBUGCODE(fNewlyPurgeableResourceForValidation = nullptr;)
this->resetFlushTimestamps();
}
@@ -106,7 +106,7 @@ void GrResourceCache::resetFlushTimestamps() {
static const int kMaxSupportedTimestampHistory = 128;
if (fMaxUnusedFlushes > kMaxSupportedTimestampHistory) {
- fFlushTimestamps = NULL;
+ fFlushTimestamps = nullptr;
return;
}
@@ -259,7 +259,7 @@ GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& sc
this->validate();
return resource;
} else if (flags & kRequireNoPendingIO_ScratchFlag) {
- return NULL;
+ return nullptr;
}
// We would prefer to consume more available VRAM rather than flushing
// immediately, but on ANGLE this can lead to starving of the GPU.
@@ -267,7 +267,7 @@ GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& sc
// kPrefer is specified, we didn't find a resource without pending io,
// but there is still space in our budget for the resource so force
// the caller to allocate a new resource.
- return NULL;
+ return nullptr;
}
}
resource = fScratchMap.find(scratchKey, AvailableForScratchUse(false));
@@ -302,7 +302,7 @@ void GrResourceCache::changeUniqueKey(GrGpuResource* resource, const GrUniqueKey
if (resource->getUniqueKey().isValid()) {
SkASSERT(resource == fUniqueHash.find(resource->getUniqueKey()));
fUniqueHash.remove(resource->getUniqueKey());
- SkASSERT(NULL == fUniqueHash.find(resource->getUniqueKey()));
+ SkASSERT(nullptr == fUniqueHash.find(resource->getUniqueKey()));
}
// If another resource has the new key, remove its key then install the key on this resource.
@@ -319,7 +319,7 @@ void GrResourceCache::changeUniqueKey(GrGpuResource* resource, const GrUniqueKey
old->cacheAccess().removeUniqueKey();
}
}
- SkASSERT(NULL == fUniqueHash.find(newKey));
+ SkASSERT(nullptr == fUniqueHash.find(newKey));
resource->cacheAccess().setUniqueKey(newKey);
fUniqueHash.add(resource);
} else {
@@ -363,7 +363,7 @@ void GrResourceCache::notifyCntReachedZero(GrGpuResource* resource, uint32_t fla
}
#endif
resource->cacheAccess().setTimestamp(this->getNextTimestamp());
- SkDEBUGCODE(fNewlyPurgeableResourceForValidation = NULL);
+ SkDEBUGCODE(fNewlyPurgeableResourceForValidation = nullptr);
}
if (!SkToBool(ResourceAccess::kAllCntsReachedZero_RefNotificationFlag & flags)) {
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index e328c666a0..d3ab8ccfa1 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -32,10 +32,10 @@ const GrIndexBuffer* GrResourceProvider::createInstancedIndexBuffer(const uint16
GrIndexBuffer* buffer = this->createIndexBuffer(bufferSize, kStatic_BufferUsage,
kNoPendingIO_Flag);
if (!buffer) {
- return NULL;
+ return nullptr;
}
uint16_t* data = (uint16_t*) buffer->map();
- bool useTempData = (NULL == data);
+ bool useTempData = (nullptr == data);
if (useTempData) {
data = new uint16_t[reps * patternSize];
}
@@ -49,7 +49,7 @@ const GrIndexBuffer* GrResourceProvider::createInstancedIndexBuffer(const uint16
if (useTempData) {
if (!buffer->updateData(data, bufferSize)) {
buffer->unref();
- return NULL;
+ return nullptr;
}
delete[] data;
} else {
@@ -88,7 +88,7 @@ GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, const SkDesc
GrIndexBuffer* GrResourceProvider::createIndexBuffer(size_t size, BufferUsage usage,
uint32_t flags) {
if (this->isAbandoned()) {
- return NULL;
+ return nullptr;
}
bool noPendingIO = SkToBool(flags & kNoPendingIO_Flag);
@@ -117,7 +117,7 @@ GrIndexBuffer* GrResourceProvider::createIndexBuffer(size_t size, BufferUsage us
GrVertexBuffer* GrResourceProvider::createVertexBuffer(size_t size, BufferUsage usage,
uint32_t flags) {
if (this->isAbandoned()) {
- return NULL;
+ return nullptr;
}
bool noPendingIO = SkToBool(flags & kNoPendingIO_Flag);
@@ -159,7 +159,7 @@ GrBatchAtlas* GrResourceProvider::createAtlas(GrPixelConfig config,
static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
GrTexture* texture = this->createApproxTexture(desc, kFlags);
if (!texture) {
- return NULL;
+ return nullptr;
}
return new GrBatchAtlas(texture, numPlotsX, numPlotsY);
}
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index f0f28ff2cc..72efab1cef 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -50,7 +50,7 @@ public:
* @param vertCount number of vertices the pattern references
* @param key Key to be assigned to the index buffer.
*
- * @return The index buffer if successful, otherwise NULL.
+ * @return The index buffer if successful, otherwise nullptr.
*/
const GrIndexBuffer* findOrCreateInstancedIndexBuffer(const uint16_t* pattern,
int patternSize,
@@ -129,7 +129,7 @@ public:
* @param data User supplied data which will be passed into func whenver an
* eviction occurs
*
- * @return An initialized GrBatchAtlas, or NULL if creation fails
+ * @return An initialized GrBatchAtlas, or nullptr if creation fails
*/
GrBatchAtlas* createAtlas(GrPixelConfig, int width, int height, int numPlotsX, int numPlotsY,
GrBatchAtlas::EvictionFunc func, void* data);
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index ce00ad93e3..e5ee52c615 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -70,7 +70,7 @@ static inline GrPixelConfig fmt_to_config(SkTextureCompressor::Format fmt) {
static bool choose_compressed_fmt(const GrCaps* caps,
SkTextureCompressor::Format *fmt) {
- if (NULL == fmt) {
+ if (nullptr == fmt) {
return false;
}
@@ -142,7 +142,7 @@ void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegio
paint.setAntiAlias(antiAlias);
SkTBlitterAllocator allocator;
- SkBlitter* blitter = NULL;
+ SkBlitter* blitter = nullptr;
if (kBlitter_CompressionMode == fCompressionMode) {
SkASSERT(fCompressedBuffer.get());
blitter = SkTextureCompressor::CreateBlitterForFormat(
@@ -197,7 +197,7 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds,
fCompressedFormat, cmpWidth, cmpHeight);
SkASSERT(cmpSz > 0);
- SkASSERT(NULL == fCompressedBuffer.get());
+ SkASSERT(nullptr == fCompressedBuffer.get());
fCompressedBuffer.reset(cmpSz);
fCompressionMode = kBlitter_CompressionMode;
}
@@ -259,7 +259,7 @@ void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
// Since we're uploading to it, and it's compressed, 'texture' shouldn't
// have a render target.
- SkASSERT(NULL == texture->asRenderTarget());
+ SkASSERT(nullptr == texture->asRenderTarget());
texture->writePixels(0, 0, desc.fWidth, desc.fHeight,
desc.fConfig, data, rowbytes,
@@ -316,7 +316,7 @@ void GrSWMaskHelper::toSDF(unsigned char* sdf) {
/**
* Software rasterizes path to A8 mask (possibly using the context's matrix)
* and uploads the result to a scratch texture. Returns the resulting
- * texture on success; NULL on failure.
+ * texture on success; nullptr on failure.
*/
GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
const SkPath& path,
@@ -327,14 +327,14 @@ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
GrSWMaskHelper helper(context);
if (!helper.init(resultBounds, matrix)) {
- return NULL;
+ return nullptr;
}
helper.draw(path, stroke, SkRegion::kReplace_Op, antiAlias, 0xFF);
GrTexture* texture(helper.createTexture());
if (!texture) {
- return NULL;
+ return nullptr;
}
helper.toTexture(texture);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 613228ebcc..f54d3b09e6 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////////////////
bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- if (NULL == fContext) {
+ if (nullptr == fContext) {
return false;
}
if (args.fStroke->isDashed()) {
@@ -36,7 +36,7 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
return false;
}
@@ -105,7 +105,7 @@ void draw_around_inv_path(GrDrawTarget* target,
////////////////////////////////////////////////////////////////////////////////
// return true on success; false on failure
bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
- if (NULL == fContext) {
+ if (nullptr == fContext) {
return false;
}
@@ -123,7 +123,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.fStroke,
devPathBounds,
args.fAntiAlias, args.fViewMatrix));
- if (NULL == texture) {
+ if (nullptr == texture) {
return false;
}
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index a5e34ff3f3..1a32e3fb75 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -37,7 +37,7 @@ GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour
if (caps.shaderCaps()->pathRenderingSupport()) {
return new GrStencilAndCoverPathRenderer(resourceProvider);
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index d63df88e83..78c3a2a8df 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -55,7 +55,7 @@ bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
return false;
}
if (SkPathEffect* pe = skPaint.getPathEffect()) {
- if (pe->asADash(NULL) != SkPathEffect::kDash_DashType) {
+ if (pe->asADash(nullptr) != SkPathEffect::kDash_DashType) {
return false;
}
}
@@ -69,7 +69,7 @@ bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
// No color bitmap fonts.
SkScalerContext::Rec rec;
- SkScalerContext::MakeRec(skPaint, &fSurfaceProps, NULL, &rec);
+ SkScalerContext::MakeRec(skPaint, &fSurfaceProps, nullptr, &rec);
return rec.getFormat() != SkMask::kARGB32_Format;
}
@@ -82,9 +82,9 @@ void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
size_t byteLength,
SkScalar x, SkScalar y,
const SkIRect& regionClipBounds) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
- if (text == NULL || byteLength == 0 /*|| fRC->isEmpty()*/) {
+ if (text == nullptr || byteLength == 0 /*|| fRC->isEmpty()*/) {
return;
}
@@ -177,11 +177,11 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
int scalarsPerPosition,
const SkPoint& offset,
const SkIRect& regionClipBounds) {
- SkASSERT(byteLength == 0 || text != NULL);
+ SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
// nothing to draw
- if (text == NULL || byteLength == 0/* || fRC->isEmpty()*/) {
+ if (text == nullptr || byteLength == 0/* || fRC->isEmpty()*/) {
return;
}
@@ -237,11 +237,11 @@ static GrPathRange* get_gr_glyphs(GrContext* ctx,
SkAutoTUnref<GrPathRange> glyphs(
static_cast<GrPathRange*>(
ctx->resourceProvider()->findAndRefResourceByUniqueKey(glyphKey)));
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
glyphs.reset(ctx->resourceProvider()->createGlyphs(typeface, desc, stroke));
ctx->resourceProvider()->assignUniqueKeyToResource(glyphKey, glyphs);
} else {
- SkASSERT(NULL == desc || glyphs->isEqualTo(*desc));
+ SkASSERT(nullptr == desc || glyphs->isEqualTo(*desc));
}
return glyphs.detach();
@@ -371,9 +371,9 @@ void GrStencilAndCoverTextContext::init(GrRenderTarget* rt,
fViewMatrix.preConcat(textMatrix);
fLocalMatrix = textMatrix;
- fGlyphCache = fSkPaint.detachCache(&fSurfaceProps, NULL, true /*ignoreGamma*/);
+ fGlyphCache = fSkPaint.detachCache(&fSurfaceProps, nullptr, true /*ignoreGamma*/);
fGlyphs = canUseRawPaths ?
- get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStroke) :
+ get_gr_glyphs(fContext, fSkPaint.getTypeface(), nullptr, fStroke) :
get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->getTypeface(),
&fGlyphCache->getDescriptor(), fStroke);
}
@@ -486,10 +486,10 @@ void GrStencilAndCoverTextContext::finish() {
this->flush();
fGlyphs->unref();
- fGlyphs = NULL;
+ fGlyphs = nullptr;
SkGlyphCache::AttachCache(fGlyphCache);
- fGlyphCache = NULL;
+ fGlyphCache = nullptr;
fViewMatrix = fContextInitialMatrix;
}
diff --git a/src/gpu/GrStrokeInfo.cpp b/src/gpu/GrStrokeInfo.cpp
index 03483afec7..f3c809d46b 100644
--- a/src/gpu/GrStrokeInfo.cpp
+++ b/src/gpu/GrStrokeInfo.cpp
@@ -17,7 +17,7 @@ bool GrStrokeInfo::applyDashToPath(SkPath* dst, GrStrokeInfo* dstStrokeInfo,
info.fCount = fIntervals.count();
info.fPhase = fDashPhase;
GrStrokeInfo filteredStroke(*this, false);
- if (SkDashPath::FilterDashPath(dst, src, &filteredStroke, NULL, info)) {
+ if (SkDashPath::FilterDashPath(dst, src, &filteredStroke, nullptr, info)) {
*dstStrokeInfo = filteredStroke;
return true;
}
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 89cbf4a546..a7be0f47d9 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -96,7 +96,7 @@ bool GrSurface::writePixels(int left, int top, int width, int height,
uint32_t pixelOpsFlags) {
// go through context so that all necessary flushing occurs
GrContext* context = this->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return false;
}
return context->writeSurfacePixels(this, left, top, width, height, config, buffer, rowBytes,
@@ -108,7 +108,7 @@ bool GrSurface::readPixels(int left, int top, int width, int height,
uint32_t pixelOpsFlags) {
// go through context so that all necessary flushing occurs
GrContext* context = this->getContext();
- if (NULL == context) {
+ if (nullptr == context) {
return false;
}
return context->readSurfacePixels(this, left, top, width, height, config, buffer,
diff --git a/src/gpu/GrTRecorder.h b/src/gpu/GrTRecorder.h
index deb007fb36..a838ad2955 100644
--- a/src/gpu/GrTRecorder.h
+++ b/src/gpu/GrTRecorder.h
@@ -54,9 +54,9 @@ public:
and after calls to reset().
*/
GrTRecorder(int initialSizeInBytes)
- : fHeadBlock(MemBlock::Alloc(LengthOf(initialSizeInBytes), NULL)),
+ : fHeadBlock(MemBlock::Alloc(LengthOf(initialSizeInBytes), nullptr)),
fTailBlock(fHeadBlock),
- fLastItem(NULL) {}
+ fLastItem(nullptr) {}
~GrTRecorder() {
this->reset();
@@ -112,17 +112,17 @@ private:
template<typename TItem> void* alloc_back(int dataLength);
struct MemBlock : SkNoncopyable {
- /** Allocates a new block and appends it to prev if not NULL. The length param is in units
+ /** Allocates a new block and appends it to prev if not nullptr. The length param is in units
of TAlign. */
static MemBlock* Alloc(int length, MemBlock* prev) {
MemBlock* block = reinterpret_cast<MemBlock*>(
sk_malloc_throw(sizeof(TAlign) * (length_of<MemBlock>::kValue + length)));
block->fLength = length;
block->fBack = 0;
- block->fNext = NULL;
+ block->fNext = nullptr;
block->fPrev = prev;
if (prev) {
- SkASSERT(NULL == prev->fNext);
+ SkASSERT(nullptr == prev->fNext);
prev->fNext = block;
}
return block;
@@ -132,7 +132,7 @@ private:
static void Free(MemBlock* block) {
if (block && block->fPrev) {
SkASSERT(block->fPrev->fNext == block);
- block->fPrev->fNext = NULL;
+ block->fPrev->fNext = nullptr;
}
while (block) {
MemBlock* next = block->fNext;
@@ -180,7 +180,7 @@ void GrTRecorder<TBase, TAlign>::pop_back() {
if (!header->fPrevLength) {
// We popped the first entry in the recorder.
SkASSERT(0 == fTailBlock->fBack);
- fLastItem = NULL;
+ fLastItem = nullptr;
return;
}
while (!fTailBlock->fBack) {
@@ -250,7 +250,7 @@ void* GrTRecorder<TBase, TAlign>::alloc_back(int dataLength) {
template<typename TBase, typename TAlign>
class GrTRecorder<TBase, TAlign>::Iter {
public:
- Iter(GrTRecorder& recorder) : fBlock(recorder.fHeadBlock), fPosition(0), fItem(NULL) {}
+ Iter(GrTRecorder& recorder) : fBlock(recorder.fHeadBlock), fPosition(0), fItem(nullptr) {}
bool next() {
while (fPosition >= fBlock->fBack) {
@@ -344,7 +344,7 @@ void GrTRecorder<TBase, TAlign>::reset() {
MemBlock::Free(fTailBlock->fNext);
} else if (fTailBlock->fNext) {
MemBlock::Free(fTailBlock->fNext->fNext);
- fTailBlock->fNext->fNext = NULL;
+ fTailBlock->fNext->fNext = nullptr;
}
for (MemBlock* block = fHeadBlock; block; block = block->fNext) {
@@ -352,7 +352,7 @@ void GrTRecorder<TBase, TAlign>::reset() {
}
fTailBlock = fHeadBlock;
- fLastItem = NULL;
+ fLastItem = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h
index 9b52837dd4..4f804c31b9 100644
--- a/src/gpu/GrTargetCommands.h
+++ b/src/gpu/GrTargetCommands.h
@@ -76,7 +76,7 @@ private:
// TODO: This can be just a pipeline once paths are in batch, and it should live elsewhere
struct StateForPathDraw : public SkNVRefCnt<StateForPathDraw> {
// TODO get rid of the prim proc parameter when we use batch everywhere
- StateForPathDraw(const GrPrimitiveProcessor* primProc = NULL)
+ StateForPathDraw(const GrPrimitiveProcessor* primProc = nullptr)
: fPrimitiveProcessor(primProc)
, fCompiled(false) {}
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 55af04480a..46fa280cfd 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -125,7 +125,7 @@ void remove(T* t, T** head, T** tail) {
} else if (tail) {
*tail = t->*Prev;
}
- t->*Prev = t->*Next = NULL;
+ t->*Prev = t->*Next = nullptr;
}
/**
@@ -141,9 +141,9 @@ void remove(T* t, T** head, T** tail) {
struct Vertex {
Vertex(const SkPoint& point)
- : fPoint(point), fPrev(NULL), fNext(NULL)
- , fFirstEdgeAbove(NULL), fLastEdgeAbove(NULL)
- , fFirstEdgeBelow(NULL), fLastEdgeBelow(NULL)
+ : fPoint(point), fPrev(nullptr), fNext(nullptr)
+ , fFirstEdgeAbove(nullptr), fLastEdgeAbove(nullptr)
+ , fFirstEdgeBelow(nullptr), fLastEdgeBelow(nullptr)
, fProcessed(false)
#if LOGGING_ENABLED
, fID (-1.0f)
@@ -209,7 +209,7 @@ SkPoint* emit_triangle(Vertex* v0, Vertex* v1, Vertex* v2, SkPoint* data) {
}
struct EdgeList {
- EdgeList() : fHead(NULL), fTail(NULL) {}
+ EdgeList() : fHead(nullptr), fTail(nullptr) {}
Edge* fHead;
Edge* fTail;
};
@@ -237,14 +237,14 @@ struct Edge {
: fWinding(winding)
, fTop(top)
, fBottom(bottom)
- , fLeft(NULL)
- , fRight(NULL)
- , fPrevEdgeAbove(NULL)
- , fNextEdgeAbove(NULL)
- , fPrevEdgeBelow(NULL)
- , fNextEdgeBelow(NULL)
- , fLeftPoly(NULL)
- , fRightPoly(NULL) {
+ , fLeft(nullptr)
+ , fRight(nullptr)
+ , fPrevEdgeAbove(nullptr)
+ , fNextEdgeAbove(nullptr)
+ , fPrevEdgeBelow(nullptr)
+ , fNextEdgeBelow(nullptr)
+ , fLeftPoly(nullptr)
+ , fRightPoly(nullptr) {
recompute();
}
int fWinding; // 1 == edge goes downward; -1 = edge goes upward.
@@ -313,11 +313,11 @@ struct Edge {
struct Poly {
Poly(int winding)
: fWinding(winding)
- , fHead(NULL)
- , fTail(NULL)
- , fActive(NULL)
- , fNext(NULL)
- , fPartner(NULL)
+ , fHead(nullptr)
+ , fTail(nullptr)
+ , fActive(nullptr)
+ , fNext(nullptr)
+ , fPartner(nullptr)
, fCount(0)
{
#if LOGGING_ENABLED
@@ -330,10 +330,10 @@ struct Poly {
struct MonotonePoly {
MonotonePoly()
: fSide(kNeither_Side)
- , fHead(NULL)
- , fTail(NULL)
- , fPrev(NULL)
- , fNext(NULL) {}
+ , fHead(nullptr)
+ , fTail(nullptr)
+ , fPrev(nullptr)
+ , fNext(nullptr) {}
Side fSide;
Vertex* fHead;
Vertex* fTail;
@@ -347,7 +347,7 @@ struct Poly {
} else {
done = side != fSide;
}
- if (fHead == NULL) {
+ if (fHead == nullptr) {
fHead = fTail = newV;
} else if (fSide == kRight_Side) {
newV->fPrev = fTail;
@@ -395,7 +395,7 @@ struct Poly {
Poly* partner = fPartner;
Poly* poly = this;
if (partner) {
- fPartner = partner->fPartner = NULL;
+ fPartner = partner->fPartner = nullptr;
}
if (!fActive) {
fActive = ALLOC_NEW(MonotonePoly, (), alloc);
@@ -425,7 +425,7 @@ struct Poly {
void end(Vertex* v, SkChunkAlloc& alloc) {
LOG("end() %d at %g, %g\n", fID, v->fPoint.fX, v->fPoint.fY);
if (fPartner) {
- fPartner = fPartner->fPartner = NULL;
+ fPartner = fPartner->fPartner = nullptr;
}
addVertex(v, fActive->fSide == kLeft_Side ? kRight_Side : kLeft_Side, alloc);
}
@@ -434,7 +434,7 @@ struct Poly {
return data;
}
LOG("emit() %d, size %d\n", fID, fCount);
- for (MonotonePoly* m = fHead; m != NULL; m = m->fNext) {
+ for (MonotonePoly* m = fHead; m != nullptr; m = m->fNext) {
data = m->emit(data);
}
return data;
@@ -548,8 +548,8 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
bool done = false;
*isLinear = true;
SkPath::Iter iter(path, false);
- Vertex* prev = NULL;
- Vertex* head = NULL;
+ Vertex* prev = nullptr;
+ Vertex* head = nullptr;
if (path.isInverseFillType()) {
SkPoint quad[4];
clipBounds.toQuad(quad);
@@ -559,7 +559,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
head->fPrev = prev;
prev->fNext = head;
*contours++ = head;
- head = prev = NULL;
+ head = prev = nullptr;
}
SkAutoConicToQuads converter;
while (!done) {
@@ -583,7 +583,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
prev->fNext = head;
*contours++ = head;
}
- head = prev = NULL;
+ head = prev = nullptr;
prev = append_point_to_contour(pts[0], prev, &head, alloc);
break;
case SkPath::kLine_Verb: {
@@ -610,7 +610,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
prev->fNext = head;
*contours++ = head;
}
- head = prev = NULL;
+ head = prev = nullptr;
break;
case SkPath::kDone_Verb:
if (head) {
@@ -666,9 +666,9 @@ void find_enclosing_edges(Vertex* v, EdgeList* edges, Edge** left, Edge** right)
*right = v->fLastEdgeAbove->fRight;
return;
}
- Edge* next = NULL;
+ Edge* next = nullptr;
Edge* prev;
- for (prev = edges->fTail; prev != NULL; prev = prev->fLeft) {
+ for (prev = edges->fTail; prev != nullptr; prev = prev->fLeft) {
if (prev->isLeftOf(v)) {
break;
}
@@ -680,9 +680,9 @@ void find_enclosing_edges(Vertex* v, EdgeList* edges, Edge** left, Edge** right)
}
void find_enclosing_edges(Edge* edge, EdgeList* edges, Comparator& c, Edge** left, Edge** right) {
- Edge* prev = NULL;
+ Edge* prev = nullptr;
Edge* next;
- for (next = edges->fHead; next != NULL; next = next->fRight) {
+ for (next = edges->fHead; next != nullptr; next = next->fRight) {
if ((c.sweep_gt(edge->fTop->fPoint, next->fTop->fPoint) && next->isRightOf(edge->fTop)) ||
(c.sweep_gt(next->fTop->fPoint, edge->fTop->fPoint) && edge->isLeftOf(next->fTop)) ||
(c.sweep_lt(edge->fBottom->fPoint, next->fBottom->fPoint) &&
@@ -717,7 +717,7 @@ void insert_edge_above(Edge* edge, Vertex* v, Comparator& c) {
return;
}
LOG("insert edge (%g -> %g) above vertex %g\n", edge->fTop->fID, edge->fBottom->fID, v->fID);
- Edge* prev = NULL;
+ Edge* prev = nullptr;
Edge* next;
for (next = v->fFirstEdgeAbove; next; next = next->fNextEdgeAbove) {
if (next->isRightOf(edge->fTop)) {
@@ -735,7 +735,7 @@ void insert_edge_below(Edge* edge, Vertex* v, Comparator& c) {
return;
}
LOG("insert edge (%g -> %g) below vertex %g\n", edge->fTop->fID, edge->fBottom->fID, v->fID);
- Edge* prev = NULL;
+ Edge* prev = nullptr;
Edge* next;
for (next = v->fFirstEdgeBelow; next; next = next->fNextEdgeBelow) {
if (next->isRightOf(edge->fBottom)) {
@@ -910,22 +910,22 @@ void merge_vertices(Vertex* src, Vertex* dst, Vertex** head, Comparator& c, SkCh
src->fID, dst->fID);
for (Edge* edge = src->fFirstEdgeAbove; edge;) {
Edge* next = edge->fNextEdgeAbove;
- set_bottom(edge, dst, NULL, c);
+ set_bottom(edge, dst, nullptr, c);
edge = next;
}
for (Edge* edge = src->fFirstEdgeBelow; edge;) {
Edge* next = edge->fNextEdgeBelow;
- set_top(edge, dst, NULL, c);
+ set_top(edge, dst, nullptr, c);
edge = next;
}
- remove<Vertex, &Vertex::fPrev, &Vertex::fNext>(src, head, NULL);
+ remove<Vertex, &Vertex::fPrev, &Vertex::fNext>(src, head, nullptr);
}
Vertex* check_for_intersection(Edge* edge, Edge* other, EdgeList* activeEdges, Comparator& c,
SkChunkAlloc& alloc) {
SkPoint p;
if (!edge || !other) {
- return NULL;
+ return nullptr;
}
if (edge->intersect(*other, &p)) {
Vertex* v;
@@ -973,7 +973,7 @@ Vertex* check_for_intersection(Edge* edge, Edge* other, EdgeList* activeEdges, C
}
return v;
}
- return NULL;
+ return nullptr;
}
void sanitize_contours(Vertex** contours, int contourCnt) {
@@ -983,7 +983,7 @@ void sanitize_contours(Vertex** contours, int contourCnt) {
if (coincident(v->fPrev->fPoint, v->fPoint)) {
LOG("vertex %g,%g coincident; removing\n", v->fPoint.fX, v->fPoint.fY);
if (v->fPrev == v) {
- contours[i] = NULL;
+ contours[i] = nullptr;
break;
}
v->fPrev->fNext = v->fNext;
@@ -1001,7 +1001,7 @@ void sanitize_contours(Vertex** contours, int contourCnt) {
}
void merge_coincident_vertices(Vertex** vertices, Comparator& c, SkChunkAlloc& alloc) {
- for (Vertex* v = (*vertices)->fNext; v != NULL; v = v->fNext) {
+ for (Vertex* v = (*vertices)->fNext; v != nullptr; v = v->fNext) {
if (c.sweep_lt(v->fPoint, v->fPrev->fPoint)) {
v->fPoint = v->fPrev->fPoint;
}
@@ -1014,10 +1014,10 @@ void merge_coincident_vertices(Vertex** vertices, Comparator& c, SkChunkAlloc& a
// Stage 2: convert the contours to a mesh of edges connecting the vertices.
Vertex* build_edges(Vertex** contours, int contourCnt, Comparator& c, SkChunkAlloc& alloc) {
- Vertex* vertices = NULL;
- Vertex* prev = NULL;
+ Vertex* vertices = nullptr;
+ Vertex* prev = nullptr;
for (int i = 0; i < contourCnt; ++i) {
- for (Vertex* v = contours[i]; v != NULL;) {
+ for (Vertex* v = contours[i]; v != nullptr;) {
Vertex* vNext = v->fNext;
Edge* edge = new_edge(v->fPrev, v, alloc, c);
if (edge->fWinding > 0) {
@@ -1027,7 +1027,7 @@ Vertex* build_edges(Vertex** contours, int contourCnt, Comparator& c, SkChunkAll
insert_edge_below(edge, v, c);
insert_edge_above(edge, v->fPrev, c);
}
- merge_collinear_edges(edge, NULL, c);
+ merge_collinear_edges(edge, nullptr, c);
if (prev) {
prev->fNext = v;
v->fPrev = prev;
@@ -1040,7 +1040,7 @@ Vertex* build_edges(Vertex** contours, int contourCnt, Comparator& c, SkChunkAll
}
}
if (prev) {
- prev->fNext = vertices->fPrev = NULL;
+ prev->fNext = vertices->fPrev = nullptr;
}
return vertices;
}
@@ -1054,14 +1054,14 @@ void front_back_split(Vertex* v, Vertex** pFront, Vertex** pBack) {
Vertex* slow;
if (!v || !v->fNext) {
*pFront = v;
- *pBack = NULL;
+ *pBack = nullptr;
} else {
slow = v;
fast = v->fNext;
- while (fast != NULL) {
+ while (fast != nullptr) {
fast = fast->fNext;
- if (fast != NULL) {
+ if (fast != nullptr) {
slow = slow->fNext;
fast = fast->fNext;
}
@@ -1069,8 +1069,8 @@ void front_back_split(Vertex* v, Vertex** pFront, Vertex** pBack) {
*pFront = v;
*pBack = slow->fNext;
- slow->fNext->fPrev = NULL;
- slow->fNext = NULL;
+ slow->fNext->fPrev = nullptr;
+ slow->fNext = nullptr;
}
}
@@ -1090,7 +1090,7 @@ void merge_sort(Vertex** head, Comparator& c) {
}
inline void append_vertex(Vertex* v, Vertex** head, Vertex** tail) {
- insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, NULL, head, tail);
+ insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, nullptr, head, tail);
}
inline void append_vertex_list(Vertex* v, Vertex** head, Vertex** tail) {
@@ -1098,8 +1098,8 @@ inline void append_vertex_list(Vertex* v, Vertex** head, Vertex** tail) {
}
Vertex* sorted_merge(Vertex* a, Vertex* b, Comparator& c) {
- Vertex* head = NULL;
- Vertex* tail = NULL;
+ Vertex* head = nullptr;
+ Vertex* tail = nullptr;
while (a && b) {
if (c.sweep_lt(a->fPoint, b->fPoint)) {
@@ -1126,21 +1126,21 @@ Vertex* sorted_merge(Vertex* a, Vertex* b, Comparator& c) {
void simplify(Vertex* vertices, Comparator& c, SkChunkAlloc& alloc) {
LOG("simplifying complex polygons\n");
EdgeList activeEdges;
- for (Vertex* v = vertices; v != NULL; v = v->fNext) {
+ for (Vertex* v = vertices; v != nullptr; v = v->fNext) {
if (!v->fFirstEdgeAbove && !v->fFirstEdgeBelow) {
continue;
}
#if LOGGING_ENABLED
LOG("\nvertex %g: (%g,%g)\n", v->fID, v->fPoint.fX, v->fPoint.fY);
#endif
- Edge* leftEnclosingEdge = NULL;
- Edge* rightEnclosingEdge = NULL;
+ Edge* leftEnclosingEdge = nullptr;
+ Edge* rightEnclosingEdge = nullptr;
bool restartChecks;
do {
restartChecks = false;
find_enclosing_edges(v, &activeEdges, &leftEnclosingEdge, &rightEnclosingEdge);
if (v->fFirstEdgeBelow) {
- for (Edge* edge = v->fFirstEdgeBelow; edge != NULL; edge = edge->fNextEdgeBelow) {
+ for (Edge* edge = v->fFirstEdgeBelow; edge != nullptr; edge = edge->fNextEdgeBelow) {
if (check_for_intersection(edge, leftEnclosingEdge, &activeEdges, c, alloc)) {
restartChecks = true;
break;
@@ -1178,25 +1178,25 @@ void simplify(Vertex* vertices, Comparator& c, SkChunkAlloc& alloc) {
Poly* tessellate(Vertex* vertices, SkChunkAlloc& alloc) {
LOG("tessellating simple polygons\n");
EdgeList activeEdges;
- Poly* polys = NULL;
- for (Vertex* v = vertices; v != NULL; v = v->fNext) {
+ Poly* polys = nullptr;
+ for (Vertex* v = vertices; v != nullptr; v = v->fNext) {
if (!v->fFirstEdgeAbove && !v->fFirstEdgeBelow) {
continue;
}
#if LOGGING_ENABLED
LOG("\nvertex %g: (%g,%g)\n", v->fID, v->fPoint.fX, v->fPoint.fY);
#endif
- Edge* leftEnclosingEdge = NULL;
- Edge* rightEnclosingEdge = NULL;
+ Edge* leftEnclosingEdge = nullptr;
+ Edge* rightEnclosingEdge = nullptr;
find_enclosing_edges(v, &activeEdges, &leftEnclosingEdge, &rightEnclosingEdge);
- Poly* leftPoly = NULL;
- Poly* rightPoly = NULL;
+ Poly* leftPoly = nullptr;
+ Poly* rightPoly = nullptr;
if (v->fFirstEdgeAbove) {
leftPoly = v->fFirstEdgeAbove->fLeftPoly;
rightPoly = v->fLastEdgeAbove->fRightPoly;
} else {
- leftPoly = leftEnclosingEdge ? leftEnclosingEdge->fRightPoly : NULL;
- rightPoly = rightEnclosingEdge ? rightEnclosingEdge->fLeftPoly : NULL;
+ leftPoly = leftEnclosingEdge ? leftEnclosingEdge->fRightPoly : nullptr;
+ rightPoly = rightEnclosingEdge ? rightEnclosingEdge->fLeftPoly : nullptr;
}
#if LOGGING_ENABLED
LOG("edges above:\n");
@@ -1232,7 +1232,7 @@ Poly* tessellate(Vertex* vertices, SkChunkAlloc& alloc) {
remove_edge(v->fLastEdgeAbove, &activeEdges);
if (!v->fFirstEdgeBelow) {
if (leftPoly && rightPoly && leftPoly != rightPoly) {
- SkASSERT(leftPoly->fPartner == NULL && rightPoly->fPartner == NULL);
+ SkASSERT(leftPoly->fPartner == nullptr && rightPoly->fPartner == nullptr);
rightPoly->fPartner = leftPoly;
leftPoly->fPartner = rightPoly;
}
@@ -1282,7 +1282,7 @@ Poly* tessellate(Vertex* vertices, SkChunkAlloc& alloc) {
}
#if LOGGING_ENABLED
LOG("\nactive edges:\n");
- for (Edge* e = activeEdges.fHead; e != NULL; e = e->fRight) {
+ for (Edge* e = activeEdges.fHead; e != nullptr; e = e->fRight) {
LOG("%g -> %g, lpoly %d, rpoly %d\n", e->fTop->fID, e->fBottom->fID,
e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRightPoly->fID : -1);
}
@@ -1307,14 +1307,14 @@ Poly* contours_to_polys(Vertex** contours, int contourCnt, Comparator& c, SkChun
sanitize_contours(contours, contourCnt);
Vertex* vertices = build_edges(contours, contourCnt, c, alloc);
if (!vertices) {
- return NULL;
+ return nullptr;
}
// Sort vertices in Y (secondarily in X).
merge_sort(&vertices, c);
merge_coincident_vertices(&vertices, c, alloc);
#if LOGGING_ENABLED
- for (Vertex* v = vertices; v != NULL; v = v->fNext) {
+ for (Vertex* v = vertices; v != nullptr; v = v->fNext) {
static float gID = 0.0f;
v->fID = gID++;
}
@@ -1379,7 +1379,7 @@ bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons
// This path renderer can draw all fill styles, all stroke styles except hairlines, but does
// not do antialiasing. It can do convex and concave paths, but we'll leave the convex ones to
// simpler algorithms.
- return !IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, NULL) &&
+ return !IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, nullptr) &&
!args.fAntiAlias && !args.fPath->isConvex();
}
@@ -1619,7 +1619,7 @@ private:
bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkASSERT(!args.fAntiAlias);
const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
- if (NULL == rt) {
+ if (nullptr == rt) {
return false;
}
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 1f5e2ce9f6..566ae54459 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -213,25 +213,25 @@ private:
GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle lifeCycle,
const void* srcData, size_t rowBytes) override {
- return NULL;
+ return nullptr;
}
GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle,
const void* srcData) override {
- return NULL;
+ return nullptr;
}
GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&,
- GrWrapOwnership) override { return NULL; }
+ GrWrapOwnership) override { return nullptr; }
GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
GrWrapOwnership) override {
- return NULL;
+ return nullptr;
}
- GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override { return NULL; }
+ GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override { return nullptr; }
- GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override { return NULL; }
+ GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override { return nullptr; }
void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override {}
@@ -290,7 +290,7 @@ GrContext* GrContext::CreateMockContext() {
void GrContext::initMockContext() {
GrContextOptions options;
options.fGeometryBufferMapThreshold = 0;
- SkASSERT(NULL == fGpu);
+ SkASSERT(nullptr == fGpu);
fGpu = new MockGpu(this, options);
SkASSERT(fGpu);
this->initCommon();
diff --git a/src/gpu/GrTextBlobCache.h b/src/gpu/GrTextBlobCache.h
index ee1f0d9211..5f24e2ac16 100644
--- a/src/gpu/GrTextBlobCache.h
+++ b/src/gpu/GrTextBlobCache.h
@@ -112,12 +112,12 @@ public:
private:
typedef SkTInternalLList<GrAtlasTextBlob> BitmapBlobList;
- void checkPurge(GrAtlasTextBlob* blob = NULL) {
+ void checkPurge(GrAtlasTextBlob* blob = nullptr) {
// If we are overbudget, then unref until we are below budget again
if (fPool.size() > fBudget) {
BitmapBlobList::Iter iter;
iter.init(fBlobList, BitmapBlobList::Iter::kTail_IterStart);
- GrAtlasTextBlob* lruBlob = NULL;
+ GrAtlasTextBlob* lruBlob = nullptr;
while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob != blob) {
fCache.remove(lruBlob->fKey);
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 387b7ebc6a..bae8a72fb2 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -22,7 +22,7 @@
GrTextContext::GrTextContext(GrContext* context, GrDrawContext* drawContext,
const SkSurfaceProps& surfaceProps)
- : fFallbackTextContext(NULL)
+ : fFallbackTextContext(nullptr)
, fContext(context)
, fSurfaceProps(surfaceProps)
, fDrawContext(drawContext) {
@@ -200,10 +200,10 @@ void GrTextContext::drawPosTextAsPath(GrRenderTarget* rt,
// Temporarily jam in kFill, so we only ever ask for the raw outline from the cache.
paint.setStyle(SkPaint::kFill_Style);
- paint.setPathEffect(NULL);
+ paint.setPathEffect(nullptr);
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
- SkAutoGlyphCache autoCache(paint, &fSurfaceProps, NULL);
+ SkAutoGlyphCache autoCache(paint, &fSurfaceProps, nullptr);
SkGlyphCache* cache = autoCache.getCache();
const char* stop = text + byteLength;
@@ -266,12 +266,12 @@ static void GlyphCacheAuxProc(void* data) {
GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) {
void* auxData;
- GrFontScaler* scaler = NULL;
+ GrFontScaler* scaler = nullptr;
if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
scaler = (GrFontScaler*)auxData;
}
- if (NULL == scaler) {
+ if (nullptr == scaler) {
scaler = new GrFontScaler(cache);
cache->setAuxProc(GlyphCacheAuxProc, scaler);
}
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index 253fe032ed..26384abbd2 100644
--- a/src/gpu/GrTextureProvider.cpp
+++ b/src/gpu/GrTextureProvider.cpp
@@ -20,11 +20,11 @@ enum ScratchTextureFlags {
GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budgeted,
const void* srcData, size_t rowBytes) {
if (this->isAbandoned()) {
- return NULL;
+ return nullptr;
}
if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) &&
!fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
- return NULL;
+ return nullptr;
}
if (!GrPixelConfigIsCompressed(desc.fConfig)) {
static const uint32_t kFlags = kExact_ScratchTextureFlag |
@@ -50,11 +50,11 @@ GrTexture* GrTextureProvider::createApproxTexture(const GrSurfaceDesc& desc) {
GrTexture* GrTextureProvider::internalCreateApproxTexture(const GrSurfaceDesc& desc,
uint32_t scratchFlags) {
if (this->isAbandoned()) {
- return NULL;
+ return nullptr;
}
// Currently we don't recycle compressed textures as scratch.
if (GrPixelConfigIsCompressed(desc.fConfig)) {
- return NULL;
+ return nullptr;
} else {
return this->refScratchTexture(desc, scratchFlags);
}
@@ -100,22 +100,22 @@ GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& inDesc,
}
if (!(kNoCreate_ScratchTextureFlag & flags)) {
- return fGpu->createTexture(*desc, true, NULL, 0);
+ return fGpu->createTexture(*desc, true, nullptr, 0);
}
- return NULL;
+ return nullptr;
}
GrTexture* GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& desc,
GrWrapOwnership ownership) {
if (this->isAbandoned()) {
- return NULL;
+ return nullptr;
}
return fGpu->wrapBackendTexture(desc, ownership);
}
GrRenderTarget* GrTextureProvider::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
- return this->isAbandoned() ? NULL : fGpu->wrapBackendRenderTarget(desc,
+ return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(desc,
kBorrow_GrWrapOwnership);
}
@@ -131,5 +131,5 @@ bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons
}
GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKey& key) {
- return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key);
+ return this->isAbandoned() ? nullptr : fCache->findAndRefUniqueResource(key);
}
diff --git a/src/gpu/GrVertices.h b/src/gpu/GrVertices.h
index 10b2679da4..03ede07d15 100644
--- a/src/gpu/GrVertices.h
+++ b/src/gpu/GrVertices.h
@@ -53,7 +53,7 @@ public:
SkASSERT(startVertex >= 0);
fPrimitiveType = primType;
fVertexBuffer.reset(vertexBuffer);
- fIndexBuffer.reset(NULL);
+ fIndexBuffer.reset(nullptr);
fStartVertex = startVertex;
fStartIndex = 0;
fVertexCount = vertexCount;
@@ -154,7 +154,7 @@ public:
const GrNonInstancedVertices* next() {
if (!fInstancesRemaining) {
- return NULL;
+ return nullptr;
}
fInstanceBatch.fStartVertex += fInstanceBatch.fVertexCount;
int instances = SkTMin(fInstancesRemaining, fVertices->fMaxInstancesPerDraw);
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 722f7444e5..b9c2f7ceca 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -100,7 +100,7 @@ public:
// Either get the texture directly from the bitmap, or else use the cache and
// remember to unref it.
if (GrTexture* bmpTexture = bitmap.getTexture()) {
- fTexture.reset(NULL);
+ fTexture.reset(nullptr);
return bmpTexture;
} else {
fTexture.reset(GrRefCachedBitmapTexture(context, bitmap, params));
@@ -153,11 +153,11 @@ SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, const SkSurfaceProps* props
SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height,
const SkSurfaceProps* props, InitContents init) {
if (!rt || rt->wasDestroyed()) {
- return NULL;
+ return nullptr;
}
unsigned flags;
- if (!CheckAlphaTypeAndGetFlags(NULL, init, &flags)) {
- return NULL;
+ if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) {
+ return nullptr;
}
return new SkGpuDevice(rt, width, height, props, flags);
}
@@ -167,12 +167,12 @@ SkGpuDevice* SkGpuDevice::Create(GrContext* context, SkSurface::Budgeted budgete
const SkSurfaceProps* props, InitContents init) {
unsigned flags;
if (!CheckAlphaTypeAndGetFlags(&info, init, &flags)) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<GrRenderTarget> rt(CreateRenderTarget(context, budgeted, info, sampleCount));
- if (NULL == rt) {
- return NULL;
+ if (nullptr == rt) {
+ return nullptr;
}
return new SkGpuDevice(rt, info.width(), info.height(), props, flags);
@@ -182,7 +182,7 @@ SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
const SkSurfaceProps* props, unsigned flags)
: INHERITED(SkSurfacePropsCopyOrDefault(props))
{
- fDrawProcs = NULL;
+ fDrawProcs = nullptr;
fContext = SkRef(rt->getContext());
fNeedClear = SkToBool(flags & kNeedClear_Flag);
@@ -203,11 +203,11 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B
const SkImageInfo& origInfo, int sampleCount) {
if (kUnknown_SkColorType == origInfo.colorType() ||
origInfo.width() < 0 || origInfo.height() < 0) {
- return NULL;
+ return nullptr;
}
if (!context) {
- return NULL;
+ return nullptr;
}
SkColorType ct = origInfo.colorType();
@@ -230,11 +230,11 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B
desc.fConfig = SkImageInfo2GrPixelConfig(info);
desc.fSampleCnt = sampleCount;
GrTexture* texture = context->textureProvider()->createTexture(
- desc, SkToBool(budgeted), NULL, 0);
- if (NULL == texture) {
- return NULL;
+ desc, SkToBool(budgeted), nullptr, 0);
+ if (nullptr == texture) {
+ return nullptr;
}
- SkASSERT(NULL != texture->asRenderTarget());
+ SkASSERT(nullptr != texture->asRenderTarget());
return texture->asRenderTarget();
}
@@ -310,7 +310,7 @@ void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {
void SkGpuDevice::onDetachFromCanvas() {
INHERITED::onDetachFromCanvas();
fClip.reset();
- fClipStack.reset(NULL);
+ fClipStack.reset(nullptr);
}
// call this every draw call, to ensure that the context reflects our state,
@@ -349,7 +349,7 @@ void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) {
SkAutoTUnref<GrRenderTarget> newRT(CreateRenderTarget(
fRenderTarget->getContext(), budgeted, this->imageInfo(), fRenderTarget->desc().fSampleCnt));
- if (NULL == newRT) {
+ if (nullptr == newRT) {
return;
}
@@ -464,9 +464,9 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
gPointMode2PrimtiveType[mode],
SkToS32(count),
(SkPoint*)pts,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
0);
}
@@ -511,7 +511,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
return;
}
@@ -587,7 +587,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
SkPath path;
path.setIsVolatile(true);
path.addRRect(rect);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
return;
}
@@ -608,7 +608,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
return;
}
- if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) {
+ if (nullptr == paint.getMaskFilter() && nullptr == paint.getPathEffect()) {
fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, outer, inner);
return;
}
@@ -620,7 +620,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
@@ -649,7 +649,7 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval,
SkPath path;
path.setIsVolatile(true);
path.addOval(oval);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
return;
}
@@ -719,7 +719,7 @@ static void determine_clipped_src_rect(const GrRenderTarget* rt,
const SkBitmap& bitmap,
const SkRect* srcRectPtr,
SkIRect* clippedSrcIRect) {
- clip.getConservativeBounds(rt, clippedSrcIRect, NULL);
+ clip.getConservativeBounds(rt, clippedSrcIRect, nullptr);
SkMatrix inv;
if (!viewMatrix.invert(&inv)) {
clippedSrcIRect->setEmpty();
@@ -780,7 +780,7 @@ bool SkGpuDevice::shouldTileBitmap(const SkBitmap& bitmap,
// a texture
size_t bmpSize = bitmap.getSize();
size_t cacheSize;
- fContext->getResourceCacheLimits(NULL, &cacheSize);
+ fContext->getResourceCacheLimits(nullptr, &cacheSize);
if (bmpSize < cacheSize / 2) {
return false;
}
@@ -805,7 +805,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
concat.setConcat(*draw->fMatrix, m);
draw.writable()->fMatrix = &concat;
}
- this->drawBitmapCommon(*draw, bitmap, NULL, NULL, paint, SkCanvas::kStrict_SrcRectConstraint);
+ this->drawBitmapCommon(*draw, bitmap, nullptr, nullptr, paint, SkCanvas::kStrict_SrcRectConstraint);
}
// This method outsets 'iRect' by 'outset' all around and then clamps its extents to
@@ -1007,7 +1007,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
SkSize dstSize;
// If there is no src rect, or the src rect contains the entire bitmap then we're effectively
// in the (easier) bleed case, so update flags.
- if (NULL == srcRectPtr) {
+ if (nullptr == srcRectPtr) {
SkScalar w = SkIntToScalar(bitmap.width());
SkScalar h = SkIntToScalar(bitmap.height());
dstSize.fWidth = w;
@@ -1246,7 +1246,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
GrTexture* texture;
AutoBitmapTexture abt(fContext, bitmap, &params, &texture);
- if (NULL == texture) {
+ if (nullptr == texture) {
return;
}
@@ -1350,7 +1350,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
GrTexture* texture;
// draw sprite uses the default texture params
- AutoBitmapTexture abt(fContext, bitmap, NULL, &texture);
+ AutoBitmapTexture abt(fContext, bitmap, nullptr, &texture);
if (!texture) {
return;
}
@@ -1462,7 +1462,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
GrRenderTarget* devRT = dev->accessRenderTarget();
GrTexture* devTex;
- if (NULL == (devTex = devRT->asTexture())) {
+ if (nullptr == (devTex = devRT->asTexture())) {
return;
}
@@ -1537,7 +1537,7 @@ bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
GrTexture* texture;
// We assume here that the filter will not attempt to tile the src. Otherwise, this cache lookup
// must be pushed upstack.
- AutoBitmapTexture abt(fContext, src, NULL, &texture);
+ AutoBitmapTexture abt(fContext, src, nullptr, &texture);
if (!texture) {
return false;
}
@@ -1592,14 +1592,14 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext);
const uint16_t* outIndices;
- SkAutoTDeleteArray<uint16_t> outAlloc(NULL);
+ SkAutoTDeleteArray<uint16_t> outAlloc(nullptr);
GrPrimitiveType primType;
GrPaint grPaint;
- // If both textures and vertex-colors are NULL, strokes hairlines with the paint's color.
- if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) {
+ // If both textures and vertex-colors are nullptr, strokes hairlines with the paint's color.
+ if ((nullptr == texs || nullptr == paint.getShader()) && nullptr == colors) {
- texs = NULL;
+ texs = nullptr;
SkPaint copy(paint);
copy.setStyle(SkPaint::kStroke_Style);
@@ -1607,13 +1607,13 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
// we ignore the shader if texs is null.
if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, copy,
- SkColor2GrColor(copy.getColor()), NULL == colors, &grPaint)) {
+ SkColor2GrColor(copy.getColor()), nullptr == colors, &grPaint)) {
return;
}
primType = kLines_GrPrimitiveType;
int triangleCount = 0;
- int n = (NULL == indices) ? vertexCount : indexCount;
+ int n = (nullptr == indices) ? vertexCount : indexCount;
switch (vmode) {
case SkCanvas::kTriangles_VertexMode:
triangleCount = n / 3;
@@ -1647,15 +1647,15 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
outIndices = indices;
primType = gVertexMode2PrimitiveType[vmode];
- if (NULL == texs || NULL == paint.getShader()) {
+ if (nullptr == texs || nullptr == paint.getShader()) {
if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint,
SkColor2GrColor(paint.getColor()),
- NULL == colors, &grPaint)) {
+ nullptr == colors, &grPaint)) {
return;
}
} else {
if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix,
- NULL == colors, &grPaint)) {
+ nullptr == colors, &grPaint)) {
return;
}
}
@@ -1822,7 +1822,7 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
SkErrorInternals::SetError( kInternalError_SkError,
"---- failed to create gpu device texture [%d %d]\n",
cinfo.fInfo.width(), cinfo.fInfo.height());
- return NULL;
+ return nullptr;
}
}
@@ -1841,7 +1841,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
return false;
}
- const SkBigPicture::AccelData* data = NULL;
+ const SkBigPicture::AccelData* data = nullptr;
if (const SkBigPicture* bp = mainPicture->asSkBigPicture()) {
data = bp->accelData();
}
@@ -1887,7 +1887,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
// Render the entire picture using new layers
GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(),
- initialMatrix, NULL);
+ initialMatrix, nullptr);
GrLayerHoister::UnlockLayers(fContext, needRendering);
GrLayerHoister::UnlockLayers(fContext, recycled);
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 8d557bc6b6..5f876a3135 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -50,7 +50,7 @@ public:
/**
* New device that will create an offscreen renderTarget based on the ImageInfo and
* sampleCount. The Budgeted param controls whether the device's backing store counts against
- * the resource cache budget. On failure, returns NULL.
+ * the resource cache budget. On failure, returns nullptr.
*/
static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInfo&,
int sampleCount, const SkSurfaceProps*, InitContents);
@@ -60,7 +60,7 @@ public:
SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), kPossible_TileUsage,
props.pixelGeometry()),
- NULL);
+ nullptr);
return static_cast<SkGpuDevice*>(dev);
}
@@ -184,7 +184,7 @@ private:
void drawBitmapCommon(const SkDraw&,
const SkBitmap& bitmap,
const SkRect* srcRectPtr,
- const SkSize* dstSizePtr, // ignored iff srcRectPtr == NULL
+ const SkSize* dstSizePtr, // ignored iff srcRectPtr == nullptr
const SkPaint&,
SkCanvas::SrcRectConstraint);
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index f55aa6a5fd..ca78ff14e1 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -280,24 +280,24 @@ GrTexture* stretch_texture(GrTexture* inputTexture, const Stretch& stretch,
} else if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
rtDesc.fConfig = kSkia8888_GrPixelConfig;
} else {
- return NULL;
+ return nullptr;
}
} else if (kRGB_GrColorComponentFlags ==
(kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(rtDesc.fConfig))) {
if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
rtDesc.fConfig = kSkia8888_GrPixelConfig;
} else {
- return NULL;
+ return nullptr;
}
} else {
- return NULL;
+ return nullptr;
}
}
- GrTexture* stretched = create_texture_for_bmp(context, optionalKey, rtDesc, pixelRef, NULL, 0);
+ GrTexture* stretched = create_texture_for_bmp(context, optionalKey, rtDesc, pixelRef, nullptr, 0);
if (!stretched) {
- return NULL;
+ return nullptr;
}
GrPaint paint;
@@ -314,7 +314,7 @@ GrTexture* stretch_texture(GrTexture* inputTexture, const Stretch& stretch,
GrDrawContext* drawContext = context->drawContext();
if (!drawContext) {
- return NULL;
+ return nullptr;
}
drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOpen(), paint,
@@ -329,8 +329,8 @@ static GrTexture *load_etc1_texture(GrContext* ctx, const GrUniqueKey& optionalK
SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData());
// Is this even encoded data?
- if (NULL == data) {
- return NULL;
+ if (nullptr == data) {
+ return nullptr;
}
// Is this a valid PKM encoded data?
@@ -343,7 +343,7 @@ static GrTexture *load_etc1_texture(GrContext* ctx, const GrUniqueKey& optionalK
// then we don't know how to scale the image to match it...
if (encodedWidth != static_cast<uint32_t>(bm.width()) ||
encodedHeight != static_cast<uint32_t>(bm.height())) {
- return NULL;
+ return nullptr;
}
// Everything seems good... skip ahead to the data.
@@ -354,19 +354,19 @@ static GrTexture *load_etc1_texture(GrContext* ctx, const GrUniqueKey& optionalK
// Is it actually an ETC1 texture?
if (!ktx.isCompressedFormat(SkTextureCompressor::kETC1_Format)) {
- return NULL;
+ return nullptr;
}
// Does the data match the dimensions of the bitmap? If not,
// then we don't know how to scale the image to match it...
if (ktx.width() != bm.width() || ktx.height() != bm.height()) {
- return NULL;
+ return nullptr;
}
bytes = ktx.pixelData();
desc.fConfig = kETC1_GrPixelConfig;
} else {
- return NULL;
+ return nullptr;
}
return create_texture_for_bmp(ctx, optionalKey, desc, bm.pixelRef(), bytes, 0);
@@ -377,10 +377,10 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
const SkBitmap& bm, const GrSurfaceDesc& desc) {
// Subsets are not supported, the whole pixelRef is loaded when using YUV decoding
SkPixelRef* pixelRef = bm.pixelRef();
- if ((NULL == pixelRef) ||
+ if ((nullptr == pixelRef) ||
(pixelRef->info().width() != bm.info().width()) ||
(pixelRef->info().height() != bm.info().height())) {
- return NULL;
+ return nullptr;
}
const bool useCache = optionalKey.isValid();
@@ -399,8 +399,8 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
} else {
// Fetch yuv plane sizes for memory allocation. Here, width and height can be
// rounded up to JPEG block size and be larger than the image's width and height.
- if (!pixelRef->getYUV8Planes(yuvInfo.fSize, NULL, NULL, NULL)) {
- return NULL;
+ if (!pixelRef->getYUV8Planes(yuvInfo.fSize, nullptr, nullptr, nullptr)) {
+ return nullptr;
}
// Allocate the memory for YUV
@@ -423,7 +423,7 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
// Get the YUV planes and update plane sizes to actual image size
if (!pixelRef->getYUV8Planes(yuvInfo.fSize, planes, yuvInfo.fRowBytes,
&yuvInfo.fColorSpace)) {
- return NULL;
+ return nullptr;
}
if (useCache) {
@@ -449,16 +449,16 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
if (!yuvTextures[i] ||
!yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight,
yuvDesc.fConfig, planes[i], yuvInfo.fRowBytes[i])) {
- return NULL;
+ return nullptr;
}
}
GrSurfaceDesc rtDesc = desc;
rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag;
- GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRef, NULL, 0);
+ GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRef, nullptr, 0);
if (!result) {
- return NULL;
+ return nullptr;
}
GrRenderTarget* renderTarget = result->asRenderTarget();
@@ -475,7 +475,7 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
GrDrawContext* drawContext = ctx->drawContext();
if (!drawContext) {
- return NULL;
+ return nullptr;
}
drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I(), r);
@@ -488,7 +488,7 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
const GrUniqueKey& optionalKey) {
if (origBitmap.width() < ctx->caps()->minTextureSize() ||
origBitmap.height() < ctx->caps()->minTextureSize()) {
- return NULL;
+ return nullptr;
}
SkBitmap tmpBitmap;
@@ -541,7 +541,7 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
SkAutoLockPixels alp(*bitmap);
if (!bitmap->readyToDraw()) {
- return NULL;
+ return nullptr;
}
return create_texture_for_bmp(ctx, optionalKey, desc, origBitmap.pixelRef(),
@@ -680,7 +680,7 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx,
"---- failed to create texture for cache [%d %d]\n",
bitmap.width(), bitmap.height());
- return NULL;
+ return nullptr;
}
// TODO: make this be the canonical signature, and turn the version that takes GrTextureParams*
@@ -785,7 +785,7 @@ bool SkPaint2GrPaintNoShader(GrContext* context, GrRenderTarget* rt, const SkPai
grPaint->setAntiAlias(skPaint.isAntiAlias());
SkXfermode* mode = skPaint.getXfermode();
- GrXPFactory* xpFactory = NULL;
+ GrXPFactory* xpFactory = nullptr;
if (!SkXfermode::AsXPFactory(mode, &xpFactory)) {
// Fall back to src-over
// return false here?
@@ -844,7 +844,7 @@ bool SkPaint2GrPaintNoShader(GrContext* context, GrRenderTarget* rt, const SkPai
bool SkPaint2GrPaint(GrContext* context, GrRenderTarget* rt, const SkPaint& skPaint,
const SkMatrix& viewM, bool constantColor, GrPaint* grPaint) {
SkShader* shader = skPaint.getShader();
- if (NULL == shader) {
+ if (nullptr == shader) {
return SkPaint2GrPaintNoShader(context, rt, skPaint, SkColor2GrColor(skPaint.getColor()),
constantColor, grPaint);
}
@@ -857,8 +857,8 @@ bool SkPaint2GrPaint(GrContext* context, GrRenderTarget* rt, const SkPaint& skPa
{
// Allow the shader to modify paintColor and also create an effect to be installed as
// the first color effect on the GrPaint.
- GrFragmentProcessor* fp = NULL;
- if (!shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintColor,
+ GrFragmentProcessor* fp = nullptr;
+ if (!shader->asFragmentProcessor(context, skPaint, viewM, nullptr, &paintColor,
grPaint->getProcessorDataManager(), &fp)) {
return false;
}
@@ -882,7 +882,7 @@ SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
const GrPixelConfig config = tex->config();
SkColorType ct;
SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- if (!GrPixelConfig2ColorAndProfileType(config, &ct, NULL)) {
+ if (!GrPixelConfig2ColorAndProfileType(config, &ct, nullptr)) {
ct = kUnknown_SkColorType;
}
return SkImageInfo::Make(w, h, ct, at);
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 50b1269b37..6e014feded 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -25,17 +25,17 @@ SkROLockPixelsPixelRef::~SkROLockPixelsPixelRef() {}
bool SkROLockPixelsPixelRef::onNewLockPixels(LockRec* rec) {
fBitmap.reset();
// SkDebugf("---------- calling readpixels in support of lockpixels\n");
- if (!this->onReadPixels(&fBitmap, NULL)) {
+ if (!this->onReadPixels(&fBitmap, nullptr)) {
SkDebugf("SkROLockPixelsPixelRef::onLockPixels failed!\n");
return false;
}
fBitmap.lockPixels();
- if (NULL == fBitmap.getPixels()) {
+ if (nullptr == fBitmap.getPixels()) {
return false;
}
rec->fPixels = fBitmap.getPixels();
- rec->fColorTable = NULL;
+ rec->fColorTable = nullptr;
rec->fRowBytes = fBitmap.rowBytes();
return true;
}
@@ -52,12 +52,12 @@ bool SkROLockPixelsPixelRef::onLockPixelsAreWritable() const {
static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorType dstCT,
SkColorProfileType dstPT, const SkIRect* subset) {
- if (NULL == texture || kUnknown_SkColorType == dstCT) {
- return NULL;
+ if (nullptr == texture || kUnknown_SkColorType == dstCT) {
+ return nullptr;
}
GrContext* context = texture->getContext();
- if (NULL == context) {
- return NULL;
+ if (nullptr == context) {
+ return nullptr;
}
GrSurfaceDesc desc;
@@ -77,9 +77,9 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType, dstPT);
- GrTexture* dst = context->textureProvider()->createTexture(desc, false, NULL, 0);
- if (NULL == dst) {
- return NULL;
+ GrTexture* dst = context->textureProvider()->createTexture(desc, false, nullptr, 0);
+ if (nullptr == dst) {
+ return nullptr;
}
// Blink is relying on the above copy being sent to GL immediately in the case when the source
@@ -102,7 +102,7 @@ SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface) : INHERI
// render target but not vice versa. So we ref the texture to keep both alive for
// the lifetime of this pixel ref.
fSurface = SkSafeRef(surface->asTexture());
- if (NULL == fSurface) {
+ if (nullptr == fSurface) {
fSurface = SkSafeRef(surface);
}
@@ -120,7 +120,7 @@ GrTexture* SkGrPixelRef::getTexture() {
if (fSurface) {
return fSurface->asTexture();
}
- return NULL;
+ return nullptr;
}
void SkGrPixelRef::onNotifyPixelsChanged() {
@@ -132,8 +132,8 @@ void SkGrPixelRef::onNotifyPixelsChanged() {
SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, SkColorProfileType dstPT,
const SkIRect* subset) {
- if (NULL == fSurface) {
- return NULL;
+ if (nullptr == fSurface) {
+ return nullptr;
}
// Note that when copying a render-target-backed pixel ref, we
@@ -147,7 +147,7 @@ SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, SkColorProfileType dstPT,
static bool tryAllocBitmapPixels(SkBitmap* bitmap) {
SkBitmap::Allocator* allocator = SkBitmapCache::GetAllocator();
- if (NULL != allocator) {
+ if (nullptr != allocator) {
return allocator->allocPixelRef(bitmap, 0);
} else {
// DiscardableMemory is not available, fallback to default allocator
@@ -156,7 +156,7 @@ static bool tryAllocBitmapPixels(SkBitmap* bitmap) {
}
bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
- if (NULL == fSurface || fSurface->wasDestroyed()) {
+ if (nullptr == fSurface || fSurface->wasDestroyed()) {
return false;
}
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 7ca24ea8f4..69fd0ef65b 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -237,7 +237,7 @@ public:
const GrPipelineOptimizations& opts) {
generate_aa_fill_rect_geometry(vertices, vertexStride,
geo.fColor, geo.fViewMatrix, geo.fRect, geo.fDevRect, opts,
- NULL);
+ nullptr);
}
};
diff --git a/src/gpu/batches/GrCopySurfaceBatch.cpp b/src/gpu/batches/GrCopySurfaceBatch.cpp
index b4e7ce2fbd..098f7c7704 100644
--- a/src/gpu/batches/GrCopySurfaceBatch.cpp
+++ b/src/gpu/batches/GrCopySurfaceBatch.cpp
@@ -73,7 +73,7 @@ GrBatch* GrCopySurfaceBatch::Create(GrSurface* dst, GrSurface* src, const SkIRec
dstPoint,
&clippedSrcRect,
&clippedDstPoint)) {
- return NULL;
+ return nullptr;
}
return new GrCopySurfaceBatch(dst, src, clippedSrcRect, clippedDstPoint);
}
diff --git a/src/gpu/batches/GrDrawVerticesBatch.cpp b/src/gpu/batches/GrDrawVerticesBatch.cpp
index bca7d230bc..f79b6859df 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.cpp
+++ b/src/gpu/batches/GrDrawVerticesBatch.cpp
@@ -134,10 +134,10 @@ void GrDrawVerticesBatch::onPrepareDraws(Target* target) {
return;
}
- const GrIndexBuffer* indexBuffer = NULL;
+ const GrIndexBuffer* indexBuffer = nullptr;
int firstIndex = 0;
- uint16_t* indices = NULL;
+ uint16_t* indices = nullptr;
if (this->hasIndices()) {
indices = target->makeIndexSpace(this->indexCount(), &indexBuffer, &firstIndex);
diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp
index d61b51145a..5d10a72595 100644
--- a/src/gpu/batches/GrVertexBatch.cpp
+++ b/src/gpu/batches/GrVertexBatch.cpp
@@ -22,7 +22,7 @@ void* GrVertexBatch::InstancedHelper::init(Target* target, GrPrimitiveType primT
int instancesToDraw) {
SkASSERT(target);
if (!indexBuffer) {
- return NULL;
+ return nullptr;
}
const GrVertexBuffer* vertexBuffer;
int firstVertex;
@@ -30,7 +30,7 @@ void* GrVertexBatch::InstancedHelper::init(Target* target, GrPrimitiveType primT
void* vertices = target->makeVertexSpace(vertexStride, vertexCount, &vertexBuffer, &firstVertex);
if (!vertices) {
SkDebugf("Vertices could not be allocated for instanced rendering.");
- return NULL;
+ return nullptr;
}
SkASSERT(vertexBuffer);
size_t ibSize = indexBuffer->gpuMemorySize();
@@ -53,7 +53,7 @@ void* GrVertexBatch::QuadHelper::init(Target* target, size_t vertexStride,
target->resourceProvider()->refQuadIndexBuffer());
if (!quadIndexBuffer) {
SkDebugf("Could not get quad index buffer.");
- return NULL;
+ return nullptr;
}
return this->INHERITED::init(target, kTriangles_GrPrimitiveType, vertexStride,
quadIndexBuffer, kVerticesPerQuad, kIndicesPerQuad, quadsToDraw);
diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h
index 0ff5ac18bc..5ec9683b89 100644
--- a/src/gpu/batches/GrVertexBatch.h
+++ b/src/gpu/batches/GrVertexBatch.h
@@ -51,7 +51,7 @@ protected:
class QuadHelper : private InstancedHelper {
public:
QuadHelper() : INHERITED() {}
- /** Finds the cached quad index buffer and reserves vertex space. Returns NULL on failure
+ /** Finds the cached quad index buffer and reserves vertex space. Returns nullptr on failure
and on sucess a pointer to the vertex data that the caller should populate before
calling issueDraws(). */
void* init(Target* batchTarget, size_t vertexStride, int quadsToDraw);
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 23f18998d1..92cf9a2594 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -226,7 +226,7 @@ GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) {
gp = GrConicEffect::Create(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
edgeType, *d->fCaps,
GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool());
- } while (NULL == gp);
+ } while (nullptr == gp);
return gp;
}
@@ -435,7 +435,7 @@ GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) {
edgeType, *d->fCaps,
GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
- } while (NULL == gp);
+ } while (nullptr == gp);
return gp;
}
@@ -653,7 +653,7 @@ GrGeometryProcessor* GrCubicEffect::TestCreate(GrProcessorTestData* d) {
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrCubicEffect::Create(GrRandomColor(d->fRandom),
GrTest::TestMatrix(d->fRandom), edgeType, *d->fCaps);
- } while (NULL == gp);
+ } while (nullptr == gp);
return gp;
}
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index b78c3f3113..1c76c64f5b 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -68,13 +68,13 @@ public:
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
localMatrix, usesLocalCoords);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrConicEffect(color, viewMatrix, coverage,
kHairlineAA_GrProcessorEdgeType, localMatrix,
@@ -83,7 +83,7 @@ public:
return new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
localMatrix, usesLocalCoords);
default:
- return NULL;
+ return nullptr;
}
}
@@ -151,13 +151,13 @@ public:
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
localMatrix, usesLocalCoords);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrQuadEffect(color, viewMatrix, coverage,
kHairlineAA_GrProcessorEdgeType, localMatrix,
@@ -166,7 +166,7 @@ public:
return new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
localMatrix, usesLocalCoords);
default:
- return NULL;
+ return nullptr;
}
}
@@ -233,18 +233,18 @@ public:
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrCubicEffect(color, viewMatrix, kFillAA_GrProcessorEdgeType);
case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
- return NULL;
+ return nullptr;
}
return new GrCubicEffect(color, viewMatrix, kHairlineAA_GrProcessorEdgeType);
case kFillBW_GrProcessorEdgeType:
return new GrCubicEffect(color, viewMatrix, kFillBW_GrProcessorEdgeType);
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index ff2d60e431..18382a3a7d 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -34,8 +34,8 @@ public:
*/
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
const SkScalar coefficients[16],
- const SkRect* domain = NULL) {
- if (NULL == domain) {
+ const SkRect* domain = nullptr) {
+ if (nullptr == domain) {
static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode };
return Create(procDataManager, tex, coefficients,
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 3b4f24cb62..85d08629ac 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -127,7 +127,7 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fTextureAccess(texture, params)
- , fInColor(NULL)
+ , fInColor(nullptr)
, fMaskFormat(format) {
this->initClassID<GrBitmapTextGeoProc>();
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index cee0f2f02b..838dc1ccea 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -182,11 +182,11 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
desc.fHeight = 256;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(desc, true, NULL, 0));
+ SkAutoTUnref<GrTexture> readTex(context->textureProvider()->createTexture(desc, true, nullptr, 0));
if (!readTex.get()) {
return;
}
- SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(desc, true, NULL, 0));
+ SkAutoTUnref<GrTexture> tempTex(context->textureProvider()->createTexture(desc, true, nullptr, 0));
if (!tempTex.get()) {
return;
}
@@ -303,7 +303,7 @@ const GrFragmentProcessor* GrConfigConversionEffect::Create(GrProcessorDataManag
kBGRA_8888_GrPixelConfig != texture->config() &&
kNone_PMConversion != pmConversion) {
// The PM conversions assume colors are 0..255
- return NULL;
+ return nullptr;
}
return new GrConfigConversionEffect(procDataManager, texture, swapRedAndBlue, pmConversion,
matrix);
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 92ec518a76..2504fd4ccc 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -71,7 +71,7 @@ GrFragmentProcessor* AARectEffect::TestCreate(GrProcessorTestData* d) {
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
fp = AARectEffect::Create(edgeType, rect);
- } while (NULL == fp);
+ } while (nullptr == fp);
return fp;
}
@@ -243,15 +243,15 @@ void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps
GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const SkPath& path,
const SkVector* offset) {
if (kHairlineAA_GrProcessorEdgeType == type) {
- return NULL;
+ return nullptr;
}
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
!path.isConvex()) {
- return NULL;
+ return nullptr;
}
if (path.countPoints() > kMaxEdges) {
- return NULL;
+ return nullptr;
}
SkPoint pts[kMaxEdges];
@@ -261,7 +261,7 @@ GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const
SkAssertResult(SkPathPriv::CheapComputeFirstDirection(path, &dir));
SkVector t;
- if (NULL == offset) {
+ if (nullptr == offset) {
t.set(0, 0);
} else {
t = *offset;
@@ -293,7 +293,7 @@ GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const
GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, const SkRect& rect) {
if (kHairlineAA_GrProcessorEdgeType == edgeType){
- return NULL;
+ return nullptr;
}
return AARectEffect::Create(edgeType, rect);
}
@@ -351,6 +351,6 @@ GrFragmentProcessor* GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
fp = GrConvexPolyEffect::Create(edgeType, count, edges);
- } while (NULL == fp);
+ } while (nullptr == fp);
return fp;
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 68cd9ecc99..9e7f1542c2 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -41,18 +41,18 @@ public:
static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, int n,
const SkScalar edges[]) {
if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeType) {
- return NULL;
+ return nullptr;
}
return new GrConvexPolyEffect(edgeType, n, edges);
}
/**
* Creates an effect that clips against the path. If the path is not a convex polygon, is
- * inverse filled, or has too many edges, this will return NULL. If offset is non-NULL, then
+ * inverse filled, or has too many edges, this will return nullptr. If offset is non-nullptr, then
* the path is translated by the vector.
*/
static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPath&,
- const SkVector* offset = NULL);
+ const SkVector* offset = nullptr);
/**
* Creates an effect that fills inside the rect with AA edges..
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index 8a7c83bbfb..8c45d22727 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -216,7 +216,7 @@ GrXPFactory* GrCoverageSetOpXPFactory::Create(SkRegion::Op regionOp, bool invert
break;
}
default:
- return NULL;
+ return nullptr;
}
}
@@ -231,7 +231,7 @@ GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
// modulation table. Note that an inverted table still won't work if there are coverage procs.
if (fInvertCoverage && hasMixedSamples) {
SkASSERT(false);
- return NULL;
+ return nullptr;
}
return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 1fcdb12d2b..58591e5810 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -298,7 +298,7 @@ static void emit_custom_xfermode_code(SkXfermode::Mode mode,
const char* inputColor,
const char* dstColor) {
// We don't try to optimize for this case at all
- if (NULL == inputColor) {
+ if (nullptr == inputColor) {
fsBuilder->codeAppendf("const vec4 ones = vec4(1);");
inputColor = "ones";
}
@@ -434,7 +434,7 @@ static void emit_custom_xfermode_code(SkXfermode::Mode mode,
GrFragmentProcessor* GrCustomXfermode::CreateFP(GrProcessorDataManager* procDataManager,
SkXfermode::Mode mode, GrTexture* background) {
if (!GrCustomXfermode::IsSupportedMode(mode)) {
- return NULL;
+ return nullptr;
} else {
return new GrCustomXferFP(procDataManager, mode, background);
}
@@ -569,7 +569,7 @@ private:
GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
if (!GrCustomXfermode::IsSupportedMode(mode)) {
- return NULL;
+ return nullptr;
} else {
return new GrCustomXPFactory(mode);
}
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 89fa423deb..ed6473796d 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -103,7 +103,7 @@ static void calc_dash_scaling(SkScalar* parallelScale, SkScalar* perpScale,
// calculates the rotation needed to aligned pts to the x axis with pts[0] < pts[1]
// Stores the rotation matrix in rotMatrix, and the mapped points in ptsRot
-static void align_to_x_axis(const SkPoint pts[2], SkMatrix* rotMatrix, SkPoint ptsRot[2] = NULL) {
+static void align_to_x_axis(const SkPoint pts[2], SkMatrix* rotMatrix, SkPoint ptsRot[2] = nullptr) {
SkVector vec = pts[1] - pts[0];
SkScalar mag = vec.length();
SkScalar inv = mag ? SkScalarInvert(mag) : 0;
@@ -695,7 +695,7 @@ static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, cons
align_to_x_axis(pts, &rotMatrix, geometry.fPtsRot);
if(!rotMatrix.invert(&geometry.fSrcRotInv)) {
SkDebugf("Failed to create invertible rotation matrix!\n");
- return NULL;
+ return nullptr;
}
} else {
geometry.fSrcRotInv.reset();
@@ -1212,7 +1212,7 @@ static GrGeometryProcessor* create_dash_gp(GrColor color,
SkMatrix invert;
if (usesLocalCoords && !viewMatrix.invert(&invert)) {
SkDebugf("Failed to invert\n");
- return NULL;
+ return nullptr;
}
switch (cap) {
@@ -1221,7 +1221,7 @@ static GrGeometryProcessor* create_dash_gp(GrColor color,
case kNonRound_DashCap:
return DashingLineEffect::Create(color, dashAAMode, invert, usesLocalCoords);
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 5d6df72951..d0c1a3fcd8 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -45,7 +45,7 @@ public:
#ifdef SK_GAMMA_APPLY_TO_A8
// adjust based on gamma
- const char* distanceAdjustUniName = NULL;
+ const char* distanceAdjustUniName = nullptr;
// width, height, 1/(3*width)
fDistanceAdjustUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision,
@@ -222,7 +222,7 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
, fDistanceAdjust(distanceAdjust)
#endif
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
- , fInColor(NULL)
+ , fInColor(nullptr)
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
this->initClassID<GrDistanceFieldA8TextGeoProc>();
@@ -322,7 +322,7 @@ public:
this->emitTransforms(args.fPB, gpArgs->fPositionVar, dfTexEffect.inPosition()->fName,
args.fTransformsIn, args.fTransformsOut);
- const char* textureSizeUniName = NULL;
+ const char* textureSizeUniName = nullptr;
fTextureSizeUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"TextureSize", &textureSizeUniName);
@@ -446,7 +446,7 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
, fViewMatrix(viewMatrix)
, fTextureAccess(texture, params)
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
- , fInColor(NULL)
+ , fInColor(nullptr)
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
this->initClassID<GrDistanceFieldPathGeoProc>();
@@ -606,7 +606,7 @@ public:
"vec3(" SK_DistanceFieldMultiplier ")*(distance - vec3(" SK_DistanceFieldThreshold"));");
// adjust width based on gamma
- const char* distanceAdjustUniName = NULL;
+ const char* distanceAdjustUniName = nullptr;
fDistanceAdjustUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"DistanceAdjust", &distanceAdjustUniName);
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index dec6ae2bad..0f3df7d66c 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -360,7 +360,7 @@ GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const {
GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const SkRect& oval) {
if (kHairlineAA_GrProcessorEdgeType == edgeType) {
- return NULL;
+ return nullptr;
}
SkScalar w = oval.width();
SkScalar h = oval.height();
@@ -373,5 +373,5 @@ GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const Sk
return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval.fTop + h), w, h);
}
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 4a86aab9c9..ff857f4e0d 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -600,11 +600,11 @@ PDLCDXferProcessor::PDLCDXferProcessor(GrColor blendConstant, uint8_t alpha)
GrXferProcessor* PDLCDXferProcessor::Create(SkXfermode::Mode xfermode,
const GrProcOptInfo& colorPOI) {
if (SkXfermode::kSrcOver_Mode != xfermode) {
- return NULL;
+ return nullptr;
}
if (kRGBA_GrColorComponentFlags != colorPOI.validFlags()) {
- return NULL;
+ return nullptr;
}
GrColor blendConstant = GrUnPreMulColor(colorPOI.color());
@@ -673,7 +673,7 @@ GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode xfermode) {
GR_STATIC_ASSERT(SK_ARRAY_COUNT(gFactories) == SkXfermode::kLastCoeffMode + 1);
if (xfermode < 0 || xfermode > SkXfermode::kLastCoeffMode) {
- return NULL;
+ return nullptr;
}
return SkRef(gFactories[xfermode]);
}
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 62c6d3bf49..af0f1fc8fd 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -79,7 +79,7 @@ GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType,
uint32_t circularCornerFlags,
const SkRRect& rrect) {
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
- return NULL;
+ return nullptr;
}
return new CircularRRectEffect(edgeType, circularCornerFlags, rrect);
}
@@ -118,7 +118,7 @@ GrFragmentProcessor* CircularRRectEffect::TestCreate(GrProcessorTestData* d) {
GrPrimitiveEdgeType et =
(GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
fp = GrRRectEffect::Create(et, rrect);
- } while (NULL == fp);
+ } while (nullptr == fp);
return fp;
}
@@ -407,7 +407,7 @@ private:
GrFragmentProcessor*
EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
- return NULL;
+ return nullptr;
}
return new EllipticalRRectEffect(edgeType, rrect);
}
@@ -464,7 +464,7 @@ GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) {
GrPrimitiveEdgeType et =
(GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
fp = GrRRectEffect::Create(et, rrect);
- } while (NULL == fp);
+ } while (nullptr == fp);
return fp;
}
@@ -706,15 +706,15 @@ GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
// If we got here then we squashed some but not all the radii to zero. (If all
// had been squashed cornerFlags would be 0.) The elliptical effect doesn't
// support some rounded and some square corners.
- return NULL;
+ return nullptr;
}
if (rrect.isNinePatch()) {
return EllipticalRRectEffect::Create(edgeType, rrect);
}
- return NULL;
+ return nullptr;
}
}
}
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/effects/GrRRectEffect.h b/src/gpu/effects/GrRRectEffect.h
index d3901f3933..63e08a4424 100644
--- a/src/gpu/effects/GrRRectEffect.h
+++ b/src/gpu/effects/GrRRectEffect.h
@@ -18,7 +18,7 @@ class SkRRect;
namespace GrRRectEffect {
/**
* Creates an effect that performs anti-aliased clipping against a SkRRect. It doesn't support
- * all varieties of SkRRect so the caller must check for a NULL return.
+ * all varieties of SkRRect so the caller must check for a nullptr return.
*/
GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&);
};
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 11760fb62b..f4c5e9cb06 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -108,7 +108,7 @@ public:
* @param outcolor name of vec4 variable to hold the sampled color.
* @param inCoords name of vec2 variable containing the coords to be used with the domain.
* It is assumed that this is a variable and not an expression.
- * @param inModulateColor if non-NULL the sampled color will be modulated with this
+ * @param inModulateColor if non-nullptr the sampled color will be modulated with this
* expression before being written to outColor.
*/
void sampleTexture(GrGLShaderBuilder* builder,
@@ -116,7 +116,7 @@ public:
const char* outColor,
const SkString& inCoords,
const GrGLProcessor::TextureSampler sampler,
- const char* inModulateColor = NULL);
+ const char* inModulateColor = nullptr);
/**
* Call this from GrGLProcessor::setData() to upload uniforms necessary for the texture
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 6aeaf6f184..ca688d821b 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -22,11 +22,11 @@ class GrTextureStripAtlas::Hash : public SkTDynamicHash<GrTextureStripAtlas::Atl
int32_t GrTextureStripAtlas::gCacheCount = 0;
-GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = NULL;
+GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = nullptr;
GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() {
- if (NULL == gAtlasCache) {
+ if (nullptr == gAtlasCache) {
gAtlasCache = new Hash;
}
@@ -47,13 +47,13 @@ void GrTextureStripAtlas::CleanUp(const GrContext*, void* info) {
if (0 == GetCache()->count()) {
delete gAtlasCache;
- gAtlasCache = NULL;
+ gAtlasCache = nullptr;
}
}
GrTextureStripAtlas* GrTextureStripAtlas::GetAtlas(const GrTextureStripAtlas::Desc& desc) {
AtlasEntry* entry = GetCache()->find(desc);
- if (NULL == entry) {
+ if (nullptr == entry) {
entry = new AtlasEntry;
entry->fAtlas = new GrTextureStripAtlas(desc);
@@ -72,10 +72,10 @@ GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc)
, fLockedRows(0)
, fDesc(desc)
, fNumRows(desc.fHeight / desc.fRowHeight)
- , fTexture(NULL)
+ , fTexture(nullptr)
, fRows(new AtlasRow[fNumRows])
- , fLRUFront(NULL)
- , fLRUBack(NULL) {
+ , fLRUFront(nullptr)
+ , fLRUBack(nullptr) {
SkASSERT(fNumRows * fDesc.fRowHeight == fDesc.fHeight);
this->initLRU();
fNormalizedYHeight = SK_Scalar1 / fDesc.fHeight;
@@ -118,11 +118,11 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) {
++fLockedRows;
- if (NULL == row) {
+ if (nullptr == row) {
// force a flush, which should unlock all the rows; then try again
fDesc.fContext->flush();
row = this->getLRU();
- if (NULL == row) {
+ if (nullptr == row) {
--fLockedRows;
return -1;
}
@@ -201,8 +201,8 @@ void GrTextureStripAtlas::lockTexture() {
builder.finish();
fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key);
- if (NULL == fTexture) {
- fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, true, NULL, 0);
+ if (nullptr == fTexture) {
+ fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, true, nullptr, 0);
if (!fTexture) {
return;
}
@@ -217,26 +217,26 @@ void GrTextureStripAtlas::lockTexture() {
void GrTextureStripAtlas::unlockTexture() {
SkASSERT(fTexture && 0 == fLockedRows);
fTexture->unref();
- fTexture = NULL;
+ fTexture = nullptr;
}
void GrTextureStripAtlas::initLRU() {
- fLRUFront = NULL;
- fLRUBack = NULL;
+ fLRUFront = nullptr;
+ fLRUBack = nullptr;
// Initially all the rows are in the LRU list
for (int i = 0; i < fNumRows; ++i) {
fRows[i].fKey = kEmptyAtlasRowKey;
- fRows[i].fNext = NULL;
- fRows[i].fPrev = NULL;
+ fRows[i].fNext = nullptr;
+ fRows[i].fPrev = nullptr;
this->appendLRU(fRows + i);
}
- SkASSERT(NULL == fLRUFront || NULL == fLRUFront->fPrev);
- SkASSERT(NULL == fLRUBack || NULL == fLRUBack->fNext);
+ SkASSERT(nullptr == fLRUFront || nullptr == fLRUFront->fPrev);
+ SkASSERT(nullptr == fLRUBack || nullptr == fLRUBack->fNext);
}
void GrTextureStripAtlas::appendLRU(AtlasRow* row) {
- SkASSERT(NULL == row->fPrev && NULL == row->fNext);
- if (NULL == fLRUFront && NULL == fLRUBack) {
+ SkASSERT(nullptr == row->fPrev && nullptr == row->fNext);
+ if (nullptr == fLRUFront && nullptr == fLRUBack) {
fLRUFront = row;
fLRUBack = row;
} else {
@@ -252,23 +252,23 @@ void GrTextureStripAtlas::removeFromLRU(AtlasRow* row) {
row->fPrev->fNext = row->fNext;
row->fNext->fPrev = row->fPrev;
} else {
- if (NULL == row->fNext) {
+ if (nullptr == row->fNext) {
SkASSERT(row == fLRUBack);
fLRUBack = row->fPrev;
if (fLRUBack) {
- fLRUBack->fNext = NULL;
+ fLRUBack->fNext = nullptr;
}
}
- if (NULL == row->fPrev) {
+ if (nullptr == row->fPrev) {
SkASSERT(row == fLRUFront);
fLRUFront = row->fNext;
if (fLRUFront) {
- fLRUFront->fPrev = NULL;
+ fLRUFront->fPrev = nullptr;
}
}
}
- row->fNext = NULL;
- row->fPrev = NULL;
+ row->fNext = nullptr;
+ row->fPrev = nullptr;
}
int GrTextureStripAtlas::searchByKey(uint32_t key) {
@@ -294,10 +294,10 @@ void GrTextureStripAtlas::validate() {
int lruCount = 0;
// Validate LRU pointers, and count LRU entries
- SkASSERT(NULL == fLRUFront || NULL == fLRUFront->fPrev);
- SkASSERT(NULL == fLRUBack || NULL == fLRUBack->fNext);
- for (AtlasRow* r = fLRUFront; r != NULL; r = r->fNext) {
- if (NULL == r->fNext) {
+ SkASSERT(nullptr == fLRUFront || nullptr == fLRUFront->fPrev);
+ SkASSERT(nullptr == fLRUBack || nullptr == fLRUBack->fNext);
+ for (AtlasRow* r = fLRUFront; r != nullptr; r = r->fNext) {
+ if (nullptr == r->fNext) {
SkASSERT(r == fLRUBack);
} else {
SkASSERT(r->fNext->fPrev == r);
@@ -314,7 +314,7 @@ void GrTextureStripAtlas::validate() {
++freeRows;
bool inLRU = false;
// Step through the LRU and make sure it's present
- for (AtlasRow* r = fLRUFront; r != NULL; r = r->fNext) {
+ for (AtlasRow* r = fLRUFront; r != nullptr; r = r->fNext) {
if (r == &fRows[i]) {
inLRU = true;
break;
@@ -341,7 +341,7 @@ void GrTextureStripAtlas::validate() {
// If we have locked rows, we should have a locked texture, otherwise
// it should be unlocked
if (fLockedRows == 0) {
- SkASSERT(NULL == fTexture);
+ SkASSERT(nullptr == fTexture);
} else {
SkASSERT(fTexture);
}
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index 98ac52a2d0..91ce61c232 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -83,7 +83,7 @@ private:
* together to represent LRU status
*/
struct AtlasRow : SkNoncopyable {
- AtlasRow() : fKey(kEmptyAtlasRowKey), fLocks(0), fNext(NULL), fPrev(NULL) { }
+ AtlasRow() : fKey(kEmptyAtlasRowKey), fLocks(0), fNext(nullptr), fPrev(nullptr) { }
// GenerationID of the bitmap that is represented by this row, 0xffffffff means "empty"
uint32_t fKey;
// How many times this has been locked (0 == unlocked)
@@ -107,7 +107,7 @@ private:
void initLRU();
/**
- * Grabs the least recently used free row out of the LRU list, returns NULL if no rows are free.
+ * Grabs the least recently used free row out of the LRU list, returns nullptr if no rows are free.
*/
AtlasRow* getLRU();
@@ -145,7 +145,7 @@ private:
static uint32_t Hash(const Desc& desc) { return SkChecksum::Murmur3(&desc, sizeof(Desc)); }
// AtlasEntry proper
- AtlasEntry() : fAtlas(NULL) {}
+ AtlasEntry() : fAtlas(nullptr) {}
~AtlasEntry() { delete fAtlas; }
Desc fDesc;
GrTextureStripAtlas* fAtlas;
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 84be8c3b4f..ba975f7c02 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -64,7 +64,7 @@ public:
virtual void emitCode(EmitArgs& args) override {
GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
- const char* yuvMatrix = NULL;
+ const char* yuvMatrix = nullptr;
fMatrixUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kMat44f_GrSLType, kDefault_GrSLPrecision,
"YUVMatrix", &yuvMatrix);
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index adb11df809..f19a1cb075 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -16,13 +16,13 @@
const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
- if (NULL == GetString) {
- return NULL;
+ if (nullptr == GetString) {
+ return nullptr;
}
const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
- if (NULL == verStr) {
- return NULL;
+ if (nullptr == verStr) {
+ return nullptr;
}
GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);
@@ -32,7 +32,7 @@ const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
} else if (kGL_GrGLStandard == standard) {
return GrGLAssembleGLInterface(ctx, get);
}
- return NULL;
+ return nullptr;
}
const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
@@ -40,9 +40,9 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetStringi);
GET_PROC_LOCAL(GetIntegerv);
- // GetStringi may be NULL depending on the GL version.
- if (NULL == GetString || NULL == GetIntegerv) {
- return NULL;
+ // GetStringi may be nullptr depending on the GL version.
+ if (nullptr == GetString || nullptr == GetIntegerv) {
+ return nullptr;
}
const char* versionString = (const char*) GetString(GR_GL_VERSION);
@@ -50,12 +50,12 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) {
// We must have array and element_array buffer objects.
- return NULL;
+ return nullptr;
}
GrGLExtensions extensions;
if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
- return NULL;
+ return nullptr;
}
GrGLInterface* interface = new GrGLInterface();
@@ -266,7 +266,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
} else {
// we must have FBOs
delete interface;
- return NULL;
+ return nullptr;
}
if (extensions.has("GL_NV_path_rendering")) {
@@ -469,22 +469,22 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
- if (NULL == GetString) {
- return NULL;
+ if (nullptr == GetString) {
+ return nullptr;
}
const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
GrGLVersion version = GrGLGetVersionFromString(verStr);
if (version < GR_GL_VER(2,0)) {
- return NULL;
+ return nullptr;
}
GET_PROC_LOCAL(GetIntegerv);
GET_PROC_LOCAL(GetStringi);
GrGLExtensions extensions;
if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
- return NULL;
+ return nullptr;
}
GrGLInterface* interface = new GrGLInterface;
@@ -670,10 +670,10 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC(PushGroupMarker);
GET_PROC(PopGroupMarker);
// The below check is here because a device has been found that has the extension string but
- // returns NULL from the eglGetProcAddress for the functions
- if (NULL == functions->fInsertEventMarker ||
- NULL == functions->fPushGroupMarker ||
- NULL == functions->fPopGroupMarker) {
+ // returns nullptr from the eglGetProcAddress for the functions
+ if (nullptr == functions->fInsertEventMarker ||
+ nullptr == functions->fPushGroupMarker ||
+ nullptr == functions->fPopGroupMarker) {
extensions.remove("GL_EXT_debug_marker");
}
}
diff --git a/src/gpu/gl/GrGLBufferImpl.cpp b/src/gpu/gl/GrGLBufferImpl.cpp
index 0e2990e7f9..52ef946cff 100644
--- a/src/gpu/gl/GrGLBufferImpl.cpp
+++ b/src/gpu/gl/GrGLBufferImpl.cpp
@@ -23,7 +23,7 @@
GrGLBufferImpl::GrGLBufferImpl(GrGLGpu* gpu, const Desc& desc, GrGLenum bufferType)
: fDesc(desc)
, fBufferType(bufferType)
- , fMapPtr(NULL) {
+ , fMapPtr(nullptr) {
if (0 == desc.fID) {
if (gpu->caps()->mustClearUploadedBufferData()) {
fCPUData = sk_calloc_throw(desc.fSizeInBytes);
@@ -32,7 +32,7 @@ GrGLBufferImpl::GrGLBufferImpl(GrGLGpu* gpu, const Desc& desc, GrGLenum bufferTy
}
fGLSizeInBytes = 0;
} else {
- fCPUData = NULL;
+ fCPUData = nullptr;
// We assume that the GL buffer was created at the desc's size initially.
fGLSizeInBytes = fDesc.fSizeInBytes;
}
@@ -44,7 +44,7 @@ void GrGLBufferImpl::release(GrGLGpu* gpu) {
// make sure we've not been abandoned or already released
if (fCPUData) {
sk_free(fCPUData);
- fCPUData = NULL;
+ fCPUData = nullptr;
} else if (fDesc.fID) {
GL_CALL(gpu, DeleteBuffers(1, &fDesc.fID));
if (GR_GL_ARRAY_BUFFER == fBufferType) {
@@ -56,16 +56,16 @@ void GrGLBufferImpl::release(GrGLGpu* gpu) {
fDesc.fID = 0;
fGLSizeInBytes = 0;
}
- fMapPtr = NULL;
+ fMapPtr = nullptr;
VALIDATE();
}
void GrGLBufferImpl::abandon() {
fDesc.fID = 0;
fGLSizeInBytes = 0;
- fMapPtr = NULL;
+ fMapPtr = nullptr;
sk_free(fCPUData);
- fCPUData = NULL;
+ fCPUData = nullptr;
VALIDATE();
}
@@ -89,14 +89,14 @@ void* GrGLBufferImpl::map(GrGLGpu* gpu) {
switch (gpu->glCaps().mapBufferType()) {
case GrGLCaps::kNone_MapBufferType:
VALIDATE();
- return NULL;
+ return nullptr;
case GrGLCaps::kMapBuffer_MapBufferType:
this->bind(gpu);
// Let driver know it can discard the old data
if (GR_GL_USE_BUFFER_DATA_NULL_HINT || fDesc.fSizeInBytes != fGLSizeInBytes) {
fGLSizeInBytes = fDesc.fSizeInBytes;
GL_CALL(gpu,
- BufferData(fBufferType, fGLSizeInBytes, NULL,
+ BufferData(fBufferType, fGLSizeInBytes, nullptr,
fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
}
GR_GL_CALL_RET(gpu->glInterface(), fMapPtr,
@@ -108,7 +108,7 @@ void* GrGLBufferImpl::map(GrGLGpu* gpu) {
if (fDesc.fSizeInBytes != fGLSizeInBytes) {
fGLSizeInBytes = fDesc.fSizeInBytes;
GL_CALL(gpu,
- BufferData(fBufferType, fGLSizeInBytes, NULL,
+ BufferData(fBufferType, fGLSizeInBytes, nullptr,
fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
}
static const GrGLbitfield kAccess = GR_GL_MAP_INVALIDATE_BUFFER_BIT |
@@ -124,7 +124,7 @@ void* GrGLBufferImpl::map(GrGLGpu* gpu) {
if (fDesc.fSizeInBytes != fGLSizeInBytes) {
fGLSizeInBytes = fDesc.fSizeInBytes;
GL_CALL(gpu,
- BufferData(fBufferType, fGLSizeInBytes, NULL,
+ BufferData(fBufferType, fGLSizeInBytes, nullptr,
fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
}
GR_GL_CALL_RET(gpu->glInterface(),
@@ -156,7 +156,7 @@ void GrGLBufferImpl::unmap(GrGLGpu* gpu) {
break;
}
}
- fMapPtr = NULL;
+ fMapPtr = nullptr;
}
bool GrGLBufferImpl::isMapped() const {
@@ -182,19 +182,19 @@ bool GrGLBufferImpl::updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInB
GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) srcSizeInBytes, src, usage));
} else {
// Before we call glBufferSubData we give the driver a hint using
- // glBufferData with NULL. This makes the old buffer contents
+ // glBufferData with nullptr. This makes the old buffer contents
// inaccessible to future draws. The GPU may still be processing
// draws that reference the old contents. With this hint it can
// assign a different allocation for the new contents to avoid
// flushing the gpu past draws consuming the old contents.
fGLSizeInBytes = fDesc.fSizeInBytes;
- GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, NULL, usage));
+ GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, nullptr, usage));
GL_CALL(gpu, BufferSubData(fBufferType, 0, (GrGLsizeiptr) srcSizeInBytes, src));
}
#else
// Note that we're cheating on the size here. Currently no methods
// allow a partial update that preserves contents of non-updated
- // portions of the buffer (map() does a glBufferData(..size, NULL..))
+ // portions of the buffer (map() does a glBufferData(..size, nullptr..))
bool doSubData = false;
#if GR_GL_MAC_BUFFER_OBJECT_PERFOMANCE_WORKAROUND
static int N = 0;
@@ -209,7 +209,7 @@ bool GrGLBufferImpl::updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInB
// exactly matches the buffer size into a glBufferData. So we tack 1
// extra byte onto the glBufferData.
fGLSizeInBytes = srcSizeInBytes + 1;
- GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, NULL, usage));
+ GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, nullptr, usage));
GL_CALL(gpu, BufferSubData(fBufferType, 0, srcSizeInBytes, src));
} else {
fGLSizeInBytes = srcSizeInBytes;
@@ -223,7 +223,7 @@ 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) == (fCPUData));
- SkASSERT(NULL == fCPUData || 0 == fGLSizeInBytes);
- SkASSERT(NULL == fMapPtr || fCPUData || fGLSizeInBytes == fDesc.fSizeInBytes);
- SkASSERT(NULL == fCPUData || NULL == fMapPtr || fCPUData == fMapPtr);
+ SkASSERT(nullptr == fCPUData || 0 == fGLSizeInBytes);
+ SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes == fDesc.fSizeInBytes);
+ SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr);
}
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 19d6a8092d..ea2daeed1e 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -538,11 +538,11 @@ bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrG
// additions are detected by checking the existence of the function.
// We also use *Then* functions that not all drivers might have. Check
// them for consistency.
- if (NULL == gli->fFunctions.fStencilThenCoverFillPath ||
- NULL == gli->fFunctions.fStencilThenCoverStrokePath ||
- NULL == gli->fFunctions.fStencilThenCoverFillPathInstanced ||
- NULL == gli->fFunctions.fStencilThenCoverStrokePathInstanced ||
- NULL == gli->fFunctions.fProgramPathFragmentInputGen) {
+ if (nullptr == gli->fFunctions.fStencilThenCoverFillPath ||
+ nullptr == gli->fFunctions.fStencilThenCoverStrokePath ||
+ nullptr == gli->fFunctions.fStencilThenCoverFillPathInstanced ||
+ nullptr == gli->fFunctions.fStencilThenCoverStrokePathInstanced ||
+ nullptr == gli->fFunctions.fProgramPathFragmentInputGen) {
return false;
}
return true;
@@ -1192,7 +1192,7 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
if (kGeometry_GrShaderType != s) {
GrShaderType shaderType = static_cast<GrShaderType>(s);
GrGLenum glShader = shader_type_to_gl_shader(shaderType);
- GrShaderCaps::PrecisionInfo* first = NULL;
+ GrShaderCaps::PrecisionInfo* first = nullptr;
glslCaps->fShaderPrecisionVaries = false;
for (int p = 0; p < kGrSLPrecisionCount; ++p) {
GrSLPrecision precision = static_cast<GrSLPrecision>(p);
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index b4fb3ea219..9e70b472c5 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -13,7 +13,7 @@
GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContextOptions& options) {
// We haven't validated the GrGLInterface yet, so check for GetString function pointer
if (!interface->fFunctions.fGetString) {
- return NULL;
+ return nullptr;
}
ConstructorArgs args;
args.fInterface = interface;
@@ -27,16 +27,16 @@ GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
const char* renderer = reinterpret_cast<const char*>(rendererUByte);
if (!interface->validate()) {
- return NULL;
+ return nullptr;
}
args.fGLVersion = GrGLGetVersionFromString(ver);
if (GR_GL_INVALID_VER == args.fGLVersion) {
- return NULL;
+ return nullptr;
}
if (!GrGLGetGLSLGeneration(interface, &args.fGLSLGeneration)) {
- return NULL;
+ return nullptr;
}
args.fVendor = GrGLGetVendor(interface);
diff --git a/src/gpu/gl/GrGLCreateNativeInterface_none.cpp b/src/gpu/gl/GrGLCreateNativeInterface_none.cpp
index e0c72c539d..0a0f279f16 100644
--- a/src/gpu/gl/GrGLCreateNativeInterface_none.cpp
+++ b/src/gpu/gl/GrGLCreateNativeInterface_none.cpp
@@ -8,5 +8,5 @@
#include "gl/GrGLInterface.h"
const GrGLInterface* GrGLCreateNativeInterface() {
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 37d0285009..1ed5f65e5c 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -22,7 +22,7 @@ class BufferObj {
public:
- BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {
+ BufferObj(GrGLuint id) : fID(id), fDataPtr(nullptr), fSize(0), fMapped(false) {
}
~BufferObj() { delete[] fDataPtr; }
@@ -58,11 +58,11 @@ public:
BufferManager() : fFreeListHead(kFreeListEnd) {}
~BufferManager() {
- // NULL out the entries that are really free list links rather than ptrs before deleting.
+ // nullptr out the entries that are really free list links rather than ptrs before deleting.
intptr_t curr = fFreeListHead;
while (kFreeListEnd != curr) {
intptr_t next = reinterpret_cast<intptr_t>(fBuffers[SkToS32(curr)]);
- fBuffers[SkToS32(curr)] = NULL;
+ fBuffers[SkToS32(curr)] = nullptr;
curr = next;
}
@@ -260,7 +260,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr o
buffer->setMapped(true);
return buffer->dataPtr();
}
- return NULL;
+ return nullptr;
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
@@ -283,7 +283,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access)
}
SkASSERT(false);
- return NULL; // no buffer bound to target
+ return nullptr; // no buffer bound to target
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target,
diff --git a/src/gpu/gl/GrGLDefaultInterface_none.cpp b/src/gpu/gl/GrGLDefaultInterface_none.cpp
index 84c7f7c321..f9e52470bc 100644
--- a/src/gpu/gl/GrGLDefaultInterface_none.cpp
+++ b/src/gpu/gl/GrGLDefaultInterface_none.cpp
@@ -8,5 +8,5 @@
#include "gl/GrGLInterface.h"
const GrGLInterface* GrGLDefaultInterface() {
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp
index f2d54ff687..6d716d190f 100644
--- a/src/gpu/gl/GrGLExtensions.cpp
+++ b/src/gpu/gl/GrGLExtensions.cpp
@@ -48,7 +48,7 @@ bool GrGLExtensions::init(GrGLStandard standard,
fInitialized = false;
fStrings->reset();
- if (NULL == getString) {
+ if (nullptr == getString) {
return false;
}
@@ -62,7 +62,7 @@ bool GrGLExtensions::init(GrGLStandard standard,
bool indexed = version >= GR_GL_VER(3, 0);
if (indexed) {
- if (NULL == getStringi || NULL == getIntegerv) {
+ if (nullptr == getStringi || nullptr == getIntegerv) {
return false;
}
GrGLint extensionCnt = 0;
@@ -74,7 +74,7 @@ bool GrGLExtensions::init(GrGLStandard standard,
}
} else {
const char* extensions = (const char*) getString(GR_GL_EXTENSIONS);
- if (NULL == extensions) {
+ if (nullptr == extensions) {
return false;
}
while (true) {
@@ -133,7 +133,7 @@ void GrGLExtensions::add(const char ext[]) {
}
void GrGLExtensions::print(const char* sep) const {
- if (NULL == sep) {
+ if (nullptr == sep) {
sep = " ";
}
int cnt = fStrings->count();
diff --git a/src/gpu/gl/GrGLFragmentProcessor.h b/src/gpu/gl/GrGLFragmentProcessor.h
index 05ee375a9a..b8e2afc1bb 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.h
+++ b/src/gpu/gl/GrGLFragmentProcessor.h
@@ -38,7 +38,7 @@ public:
@param outputColor A predefined vec4 in the FS in which the stage should place its output
color (or coverage).
@param inputColor A vec4 that holds the input color to the stage in the FS. This may be
- NULL in which case the implied input is solid white (all ones).
+ nullptr in which case the implied input is solid white (all ones).
TODO: Better system for communicating optimization info (e.g. input
color is solid white, trans black, known to be opaque, etc.) that allows
the processor to communicate back similar known info about its output.
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 92cfba1c7d..1a2896350e 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -169,13 +169,13 @@ GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions&
glInterface->ref();
}
if (!glInterface) {
- return NULL;
+ return nullptr;
}
GrGLContext* glContext = GrGLContext::Create(glInterface, options);
if (glContext) {
return new GrGLGpu(glContext, context);
}
- return NULL;
+ return nullptr;
}
static bool gPrintStartupSpew;
@@ -398,17 +398,17 @@ static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
GrWrapOwnership ownership) {
- if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) {
- return NULL;
+ if (!this->configToGLFormats(desc.fConfig, false, nullptr, nullptr, nullptr)) {
+ return nullptr;
}
if (0 == desc.fTextureHandle) {
- return NULL;
+ return nullptr;
}
int maxSize = this->caps()->maxTextureSize();
if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
- return NULL;
+ return nullptr;
}
GrGLTexture::IDDesc idDesc;
@@ -442,19 +442,19 @@ GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
surfDesc.fOrigin = desc.fOrigin;
}
- GrGLTexture* texture = NULL;
+ GrGLTexture* texture = nullptr;
if (renderTarget) {
GrGLRenderTarget::IDDesc rtIDDesc;
if (!this->createRenderTargetObjects(surfDesc, GrGpuResource::kUncached_LifeCycle,
idDesc.fTextureID, &rtIDDesc)) {
- return NULL;
+ return nullptr;
}
texture = new GrGLTextureRenderTarget(this, surfDesc, idDesc, rtIDDesc);
} else {
texture = new GrGLTexture(this, surfDesc, idDesc);
}
- if (NULL == texture) {
- return NULL;
+ if (nullptr == texture) {
+ return nullptr;
}
return texture;
@@ -564,7 +564,7 @@ bool GrGLGpu::onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes) {
- if (NULL == buffer) {
+ if (nullptr == buffer) {
return false;
}
@@ -813,7 +813,7 @@ bool GrGLGpu::uploadCompressedTexData(const GrSurfaceDesc& desc,
// We only need the internal format for compressed 2D textures.
GrGLenum internalFormat = 0;
- if (!this->configToGLFormats(desc.fConfig, false, &internalFormat, NULL, NULL)) {
+ if (!this->configToGLFormats(desc.fConfig, false, &internalFormat, nullptr, nullptr)) {
return false;
}
@@ -926,8 +926,8 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
// ES2 and ES3 require sized internal formats for rb storage.
kGLES_GrGLStandard == this->glStandard(),
&msColorFormat,
- NULL,
- NULL)) {
+ nullptr,
+ nullptr)) {
goto FAILED;
}
} else {
@@ -1001,7 +1001,7 @@ FAILED:
// good to set a break-point here to know when createTexture fails
static GrTexture* return_null_texture() {
// SkDEBUGFAIL("null texture");
- return NULL;
+ return nullptr;
}
#if 0 && defined(SK_DEBUG)
@@ -1294,7 +1294,7 @@ bool GrGLGpu::attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, GrR
GrGLuint fbo = glrt->renderFBOID();
- if (NULL == sb) {
+ if (nullptr == sb) {
if (rt->renderTargetPriv().getStencilAttachment()) {
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
@@ -1372,17 +1372,17 @@ GrVertexBuffer* GrGLGpu::onCreateVertexBuffer(size_t size, bool dynamic) {
GL_ALLOC_CALL(this->glInterface(),
BufferData(GR_GL_ARRAY_BUFFER,
(GrGLsizeiptr) desc.fSizeInBytes,
- NULL, // data ptr
+ nullptr, // data ptr
desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
GL_CALL(DeleteBuffers(1, &desc.fID));
this->notifyVertexBufferDelete(desc.fID);
- return NULL;
+ return nullptr;
}
GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, desc);
return vertexBuffer;
}
- return NULL;
+ return nullptr;
}
}
@@ -1404,17 +1404,17 @@ GrIndexBuffer* GrGLGpu::onCreateIndexBuffer(size_t size, bool dynamic) {
GL_ALLOC_CALL(this->glInterface(),
BufferData(GR_GL_ELEMENT_ARRAY_BUFFER,
(GrGLsizeiptr) desc.fSizeInBytes,
- NULL, // data ptr
+ nullptr, // data ptr
desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
GL_CALL(DeleteBuffers(1, &desc.fID));
this->notifyIndexBufferDelete(desc.fID);
- return NULL;
+ return nullptr;
}
GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, desc);
return indexBuffer;
}
- return NULL;
+ return nullptr;
}
}
@@ -1489,7 +1489,7 @@ bool GrGLGpu::flushGLState(const DrawArgs& args) {
// This must come after textures are flushed because a texture may need
// to be msaa-resolved (which will modify bound FBO state).
- this->flushRenderTarget(glRT, NULL);
+ this->flushRenderTarget(glRT, nullptr);
return true;
}
@@ -1503,7 +1503,7 @@ void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc,
SkASSERT(vbuf);
SkASSERT(!vbuf->isMapped());
- GrGLIndexBuffer* ibuf = NULL;
+ GrGLIndexBuffer* ibuf = nullptr;
if (vertices.isIndexed()) {
SkASSERT(indexOffsetInBytes);
@@ -1638,7 +1638,7 @@ void GrGLGpu::discard(GrRenderTarget* renderTarget) {
}
void GrGLGpu::clearStencil(GrRenderTarget* target) {
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
@@ -1799,7 +1799,7 @@ bool GrGLGpu::onReadPixels(GrSurface* surface,
GrGLenum format = 0;
GrGLenum type = 0;
bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin();
- if (!this->configToGLFormats(config, false, NULL, &format, &type)) {
+ if (!this->configToGLFormats(config, false, nullptr, &format, &type)) {
return false;
}
@@ -1947,7 +1947,7 @@ void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
}
}
}
- if (NULL == bound || !bound->isEmpty()) {
+ if (nullptr == bound || !bound->isEmpty()) {
target->flagAsNeedingResolve(bound);
}
@@ -2409,13 +2409,13 @@ bool GrGLGpu::configToGLFormats(GrPixelConfig config,
GrGLenum* externalFormat,
GrGLenum* externalType) const {
GrGLenum dontCare;
- if (NULL == internalFormat) {
+ if (nullptr == internalFormat) {
internalFormat = &dontCare;
}
- if (NULL == externalFormat) {
+ if (nullptr == externalFormat) {
externalFormat = &dontCare;
}
- if (NULL == externalType) {
+ if (nullptr == externalType) {
externalType = &dontCare;
}
@@ -2670,7 +2670,7 @@ inline bool can_copy_texsubimage(const GrSurface* dst,
GrGLuint GrGLGpu::bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect* viewport,
TempFBOTarget tempFBOTarget) {
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(surface->asRenderTarget());
- if (NULL == rt) {
+ if (nullptr == rt) {
SkASSERT(surface->asTexture());
GrGLuint texID = static_cast<GrGLTexture*>(surface->asTexture())->textureID();
GrGLuint* tempFBOID;
@@ -2736,7 +2736,7 @@ bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
return true;
}
return false;
- } else if (NULL == src->asRenderTarget()) {
+ } else if (nullptr == src->asRenderTarget()) {
// CopyTexSubImage2D or fbo blit would require creating a temp fbo for the src.
return false;
}
@@ -3147,7 +3147,7 @@ GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw(
const GrGLIndexBuffer* ibuffer) {
SkASSERT(vbuffer);
GrGLuint vbufferID = vbuffer->bufferID();
- GrGLuint* ibufferIDPtr = NULL;
+ GrGLuint* ibufferIDPtr = nullptr;
GrGLuint ibufferID;
if (ibuffer) {
ibufferID = ibuffer->bufferID();
@@ -3158,7 +3158,7 @@ GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw(
GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBufferToDraw(GrGLGpu* gpu,
GrGLuint vbufferID) {
- return this->internalBind(gpu, vbufferID, NULL);
+ return this->internalBind(gpu, vbufferID, nullptr);
}
GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw(GrGLGpu* gpu,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 4be8a76fba..f6d6a471e9 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -254,7 +254,7 @@ private:
void setScratchTextureUnit();
// bounds is region that may be modified and therefore has to be resolved.
- // NULL means whole target. Can be an empty rect.
+ // nullptr means whole target. Can be an empty rect.
void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds);
void flushStencil(const GrStencilSettings&);
@@ -339,7 +339,7 @@ private:
*/
class HWGeometryState {
public:
- HWGeometryState() { fVBOVertexArray = NULL; this->invalidate(); }
+ HWGeometryState() { fVBOVertexArray = nullptr; this->invalidate(); }
~HWGeometryState() { delete fVBOVertexArray; }
@@ -418,7 +418,7 @@ private:
/**
* Binds the vertex array object that should be used to render from the vertex buffer.
* The vertex array is bound and its attrib array state object is returned. The vertex
- * buffer is bound. The index buffer (if non-NULL) is bound to the vertex array. The
+ * buffer is bound. The index buffer (if non-nullptr) is bound to the vertex array. The
* returned GrGLAttribArrayState should be used to set vertex attribute arrays.
*/
GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu,
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index c6b673b95b..d74b54aeba 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -23,7 +23,7 @@ typedef GrGLProgramDataManager::UniformHandle UniformHandle;
struct GrGLGpu::ProgramCache::Entry {
- Entry() : fProgram(NULL), fLRUStamp(0) {}
+ Entry() : fProgram(nullptr), fLRUStamp(0) {}
SkAutoTUnref<GrGLProgram> fProgram;
unsigned int fLRUStamp;
@@ -52,7 +52,7 @@ GrGLGpu::ProgramCache::ProgramCache(GrGLGpu* gpu)
#endif
{
for (int i = 0; i < 1 << kHashBits; ++i) {
- fHashTable[i] = NULL;
+ fHashTable[i] = nullptr;
}
}
@@ -95,7 +95,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
++fTotalRequests;
#endif
- Entry* entry = NULL;
+ Entry* entry = nullptr;
uint32_t hashIdx = args.fDesc->getChecksum();
hashIdx ^= hashIdx >> 16;
@@ -110,7 +110,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
}
int entryIdx;
- if (NULL == entry) {
+ if (nullptr == entry) {
entryIdx = this->search(*args.fDesc);
if (entryIdx >= 0) {
entry = fEntries[entryIdx];
@@ -120,14 +120,14 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
}
}
- if (NULL == entry) {
+ if (nullptr == entry) {
// We have a cache miss
#ifdef PROGRAM_CACHE_STATS
++fCacheMisses;
#endif
GrGLProgram* program = GrGLProgramBuilder::CreateProgram(args, fGpu);
- if (NULL == program) {
- return NULL;
+ if (nullptr == program) {
+ return nullptr;
}
int purgeIdx = 0;
if (fCount < kMaxEntries) {
@@ -145,7 +145,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
entry = fEntries[purgeIdx];
int purgedHashIdx = entry->fProgram->getDesc().getChecksum() & ((1 << kHashBits) - 1);
if (fHashTable[purgedHashIdx] == entry) {
- fHashTable[purgedHashIdx] = NULL;
+ fHashTable[purgedHashIdx] = nullptr;
}
}
SkASSERT(fEntries[purgeIdx] == entry);
diff --git a/src/gpu/gl/GrGLIndexBuffer.cpp b/src/gpu/gl/GrGLIndexBuffer.cpp
index 52cf5f87f7..d60d391085 100644
--- a/src/gpu/gl/GrGLIndexBuffer.cpp
+++ b/src/gpu/gl/GrGLIndexBuffer.cpp
@@ -31,7 +31,7 @@ void* GrGLIndexBuffer::onMap() {
if (!this->wasDestroyed()) {
return fImpl.map(this->getGpuGL());
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index fca7bf2d2f..ec51797c7e 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -39,27 +39,27 @@ const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
newInterface->fExtensions.remove("GL_NV_path_rendering");
- newInterface->fFunctions.fPathCommands = NULL;
- newInterface->fFunctions.fPathParameteri = NULL;
- newInterface->fFunctions.fPathParameterf = NULL;
- newInterface->fFunctions.fGenPaths = NULL;
- newInterface->fFunctions.fDeletePaths = NULL;
- newInterface->fFunctions.fIsPath = NULL;
- newInterface->fFunctions.fPathStencilFunc = NULL;
- newInterface->fFunctions.fStencilFillPath = NULL;
- newInterface->fFunctions.fStencilStrokePath = NULL;
- newInterface->fFunctions.fStencilFillPathInstanced = NULL;
- newInterface->fFunctions.fStencilStrokePathInstanced = NULL;
- newInterface->fFunctions.fCoverFillPath = NULL;
- newInterface->fFunctions.fCoverStrokePath = NULL;
- newInterface->fFunctions.fCoverFillPathInstanced = NULL;
- newInterface->fFunctions.fCoverStrokePathInstanced = NULL;
- newInterface->fFunctions.fStencilThenCoverFillPath = NULL;
- newInterface->fFunctions.fStencilThenCoverStrokePath = NULL;
- newInterface->fFunctions.fStencilThenCoverFillPathInstanced = NULL;
- newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = NULL;
- newInterface->fFunctions.fProgramPathFragmentInputGen = NULL;
- newInterface->fFunctions.fBindFragmentInputLocation = NULL;
+ newInterface->fFunctions.fPathCommands = nullptr;
+ newInterface->fFunctions.fPathParameteri = nullptr;
+ newInterface->fFunctions.fPathParameterf = nullptr;
+ newInterface->fFunctions.fGenPaths = nullptr;
+ newInterface->fFunctions.fDeletePaths = nullptr;
+ newInterface->fFunctions.fIsPath = nullptr;
+ newInterface->fFunctions.fPathStencilFunc = nullptr;
+ newInterface->fFunctions.fStencilFillPath = nullptr;
+ newInterface->fFunctions.fStencilStrokePath = nullptr;
+ newInterface->fFunctions.fStencilFillPathInstanced = nullptr;
+ newInterface->fFunctions.fStencilStrokePathInstanced = nullptr;
+ newInterface->fFunctions.fCoverFillPath = nullptr;
+ newInterface->fFunctions.fCoverStrokePath = nullptr;
+ newInterface->fFunctions.fCoverFillPathInstanced = nullptr;
+ newInterface->fFunctions.fCoverStrokePathInstanced = nullptr;
+ newInterface->fFunctions.fStencilThenCoverFillPath = nullptr;
+ newInterface->fFunctions.fStencilThenCoverStrokePath = nullptr;
+ newInterface->fFunctions.fStencilThenCoverFillPathInstanced = nullptr;
+ newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = nullptr;
+ newInterface->fFunctions.fProgramPathFragmentInputGen = nullptr;
+ newInterface->fFunctions.fBindFragmentInputLocation = nullptr;
return newInterface;
}
@@ -107,105 +107,105 @@ bool GrGLInterface::validate() const {
}
// functions that are always required
- if (NULL == fFunctions.fActiveTexture ||
- NULL == fFunctions.fAttachShader ||
- NULL == fFunctions.fBindAttribLocation ||
- NULL == fFunctions.fBindBuffer ||
- NULL == fFunctions.fBindTexture ||
- NULL == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0
- NULL == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0
- NULL == fFunctions.fBlendFunc ||
- NULL == fFunctions.fBufferData ||
- NULL == fFunctions.fBufferSubData ||
- NULL == fFunctions.fClear ||
- NULL == fFunctions.fClearColor ||
- NULL == fFunctions.fClearStencil ||
- NULL == fFunctions.fColorMask ||
- NULL == fFunctions.fCompileShader ||
- NULL == fFunctions.fCopyTexSubImage2D ||
- NULL == fFunctions.fCreateProgram ||
- NULL == fFunctions.fCreateShader ||
- NULL == fFunctions.fCullFace ||
- NULL == fFunctions.fDeleteBuffers ||
- NULL == fFunctions.fDeleteProgram ||
- NULL == fFunctions.fDeleteShader ||
- NULL == fFunctions.fDeleteTextures ||
- NULL == fFunctions.fDepthMask ||
- NULL == fFunctions.fDisable ||
- NULL == fFunctions.fDisableVertexAttribArray ||
- NULL == fFunctions.fDrawArrays ||
- NULL == fFunctions.fDrawElements ||
- NULL == fFunctions.fEnable ||
- NULL == fFunctions.fEnableVertexAttribArray ||
- NULL == fFunctions.fFrontFace ||
- NULL == fFunctions.fGenBuffers ||
- NULL == fFunctions.fGenTextures ||
- NULL == fFunctions.fGetBufferParameteriv ||
- NULL == fFunctions.fGenerateMipmap ||
- NULL == fFunctions.fGetError ||
- NULL == fFunctions.fGetIntegerv ||
- NULL == fFunctions.fGetProgramInfoLog ||
- NULL == fFunctions.fGetProgramiv ||
- NULL == fFunctions.fGetShaderInfoLog ||
- NULL == fFunctions.fGetShaderiv ||
- NULL == fFunctions.fGetString ||
- NULL == fFunctions.fGetUniformLocation ||
+ if (nullptr == fFunctions.fActiveTexture ||
+ nullptr == fFunctions.fAttachShader ||
+ nullptr == fFunctions.fBindAttribLocation ||
+ nullptr == fFunctions.fBindBuffer ||
+ nullptr == fFunctions.fBindTexture ||
+ nullptr == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0
+ nullptr == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0
+ nullptr == fFunctions.fBlendFunc ||
+ nullptr == fFunctions.fBufferData ||
+ nullptr == fFunctions.fBufferSubData ||
+ nullptr == fFunctions.fClear ||
+ nullptr == fFunctions.fClearColor ||
+ nullptr == fFunctions.fClearStencil ||
+ nullptr == fFunctions.fColorMask ||
+ nullptr == fFunctions.fCompileShader ||
+ nullptr == fFunctions.fCopyTexSubImage2D ||
+ nullptr == fFunctions.fCreateProgram ||
+ nullptr == fFunctions.fCreateShader ||
+ nullptr == fFunctions.fCullFace ||
+ nullptr == fFunctions.fDeleteBuffers ||
+ nullptr == fFunctions.fDeleteProgram ||
+ nullptr == fFunctions.fDeleteShader ||
+ nullptr == fFunctions.fDeleteTextures ||
+ nullptr == fFunctions.fDepthMask ||
+ nullptr == fFunctions.fDisable ||
+ nullptr == fFunctions.fDisableVertexAttribArray ||
+ nullptr == fFunctions.fDrawArrays ||
+ nullptr == fFunctions.fDrawElements ||
+ nullptr == fFunctions.fEnable ||
+ nullptr == fFunctions.fEnableVertexAttribArray ||
+ nullptr == fFunctions.fFrontFace ||
+ nullptr == fFunctions.fGenBuffers ||
+ nullptr == fFunctions.fGenTextures ||
+ nullptr == fFunctions.fGetBufferParameteriv ||
+ nullptr == fFunctions.fGenerateMipmap ||
+ nullptr == fFunctions.fGetError ||
+ nullptr == fFunctions.fGetIntegerv ||
+ nullptr == fFunctions.fGetProgramInfoLog ||
+ nullptr == fFunctions.fGetProgramiv ||
+ nullptr == fFunctions.fGetShaderInfoLog ||
+ nullptr == fFunctions.fGetShaderiv ||
+ nullptr == fFunctions.fGetString ||
+ nullptr == fFunctions.fGetUniformLocation ||
#if 0 // Not included in Chrome yet
- NULL == fFunctions.fIsTexture ||
+ nullptr == fFunctions.fIsTexture ||
#endif
- NULL == fFunctions.fLinkProgram ||
- NULL == fFunctions.fLineWidth ||
- NULL == fFunctions.fPixelStorei ||
- NULL == fFunctions.fReadPixels ||
- NULL == fFunctions.fScissor ||
- NULL == fFunctions.fShaderSource ||
- NULL == fFunctions.fStencilFunc ||
- NULL == fFunctions.fStencilMask ||
- NULL == fFunctions.fStencilOp ||
- NULL == fFunctions.fTexImage2D ||
- NULL == fFunctions.fTexParameteri ||
- NULL == fFunctions.fTexParameteriv ||
- NULL == fFunctions.fTexSubImage2D ||
- NULL == fFunctions.fUniform1f ||
- NULL == fFunctions.fUniform1i ||
- NULL == fFunctions.fUniform1fv ||
- NULL == fFunctions.fUniform1iv ||
- NULL == fFunctions.fUniform2f ||
- NULL == fFunctions.fUniform2i ||
- NULL == fFunctions.fUniform2fv ||
- NULL == fFunctions.fUniform2iv ||
- NULL == fFunctions.fUniform3f ||
- NULL == fFunctions.fUniform3i ||
- NULL == fFunctions.fUniform3fv ||
- NULL == fFunctions.fUniform3iv ||
- NULL == fFunctions.fUniform4f ||
- NULL == fFunctions.fUniform4i ||
- NULL == fFunctions.fUniform4fv ||
- NULL == fFunctions.fUniform4iv ||
- NULL == fFunctions.fUniformMatrix2fv ||
- NULL == fFunctions.fUniformMatrix3fv ||
- NULL == fFunctions.fUniformMatrix4fv ||
- NULL == fFunctions.fUseProgram ||
- NULL == fFunctions.fVertexAttrib1f ||
- NULL == fFunctions.fVertexAttrib2fv ||
- NULL == fFunctions.fVertexAttrib3fv ||
- NULL == fFunctions.fVertexAttrib4fv ||
- NULL == fFunctions.fVertexAttribPointer ||
- NULL == fFunctions.fViewport ||
- NULL == fFunctions.fBindFramebuffer ||
- NULL == fFunctions.fBindRenderbuffer ||
- NULL == fFunctions.fCheckFramebufferStatus ||
- NULL == fFunctions.fDeleteFramebuffers ||
- NULL == fFunctions.fDeleteRenderbuffers ||
- NULL == fFunctions.fFinish ||
- NULL == fFunctions.fFlush ||
- NULL == fFunctions.fFramebufferRenderbuffer ||
- NULL == fFunctions.fFramebufferTexture2D ||
- NULL == fFunctions.fGetFramebufferAttachmentParameteriv ||
- NULL == fFunctions.fGetRenderbufferParameteriv ||
- NULL == fFunctions.fGenFramebuffers ||
- NULL == fFunctions.fGenRenderbuffers ||
- NULL == fFunctions.fRenderbufferStorage) {
+ nullptr == fFunctions.fLinkProgram ||
+ nullptr == fFunctions.fLineWidth ||
+ nullptr == fFunctions.fPixelStorei ||
+ nullptr == fFunctions.fReadPixels ||
+ nullptr == fFunctions.fScissor ||
+ nullptr == fFunctions.fShaderSource ||
+ nullptr == fFunctions.fStencilFunc ||
+ nullptr == fFunctions.fStencilMask ||
+ nullptr == fFunctions.fStencilOp ||
+ nullptr == fFunctions.fTexImage2D ||
+ nullptr == fFunctions.fTexParameteri ||
+ nullptr == fFunctions.fTexParameteriv ||
+ nullptr == fFunctions.fTexSubImage2D ||
+ nullptr == fFunctions.fUniform1f ||
+ nullptr == fFunctions.fUniform1i ||
+ nullptr == fFunctions.fUniform1fv ||
+ nullptr == fFunctions.fUniform1iv ||
+ nullptr == fFunctions.fUniform2f ||
+ nullptr == fFunctions.fUniform2i ||
+ nullptr == fFunctions.fUniform2fv ||
+ nullptr == fFunctions.fUniform2iv ||
+ nullptr == fFunctions.fUniform3f ||
+ nullptr == fFunctions.fUniform3i ||
+ nullptr == fFunctions.fUniform3fv ||
+ nullptr == fFunctions.fUniform3iv ||
+ nullptr == fFunctions.fUniform4f ||
+ nullptr == fFunctions.fUniform4i ||
+ nullptr == fFunctions.fUniform4fv ||
+ nullptr == fFunctions.fUniform4iv ||
+ nullptr == fFunctions.fUniformMatrix2fv ||
+ nullptr == fFunctions.fUniformMatrix3fv ||
+ nullptr == fFunctions.fUniformMatrix4fv ||
+ nullptr == fFunctions.fUseProgram ||
+ nullptr == fFunctions.fVertexAttrib1f ||
+ nullptr == fFunctions.fVertexAttrib2fv ||
+ nullptr == fFunctions.fVertexAttrib3fv ||
+ nullptr == fFunctions.fVertexAttrib4fv ||
+ nullptr == fFunctions.fVertexAttribPointer ||
+ nullptr == fFunctions.fViewport ||
+ nullptr == fFunctions.fBindFramebuffer ||
+ nullptr == fFunctions.fBindRenderbuffer ||
+ nullptr == fFunctions.fCheckFramebufferStatus ||
+ nullptr == fFunctions.fDeleteFramebuffers ||
+ nullptr == fFunctions.fDeleteRenderbuffers ||
+ nullptr == fFunctions.fFinish ||
+ nullptr == fFunctions.fFlush ||
+ nullptr == fFunctions.fFramebufferRenderbuffer ||
+ nullptr == fFunctions.fFramebufferTexture2D ||
+ nullptr == fFunctions.fGetFramebufferAttachmentParameteriv ||
+ nullptr == fFunctions.fGetRenderbufferParameteriv ||
+ nullptr == fFunctions.fGenFramebuffers ||
+ nullptr == fFunctions.fGenRenderbuffers ||
+ nullptr == fFunctions.fRenderbufferStorage) {
RETURN_FALSE_INTERFACE
}
@@ -222,50 +222,50 @@ bool GrGLInterface::validate() const {
// On the desktop we assume they are available if the extension
// is present or GL version is high enough.
if (kGLES_GrGLStandard == fStandard) {
- if (NULL == fFunctions.fStencilFuncSeparate ||
- NULL == fFunctions.fStencilMaskSeparate ||
- NULL == fFunctions.fStencilOpSeparate) {
+ if (nullptr == fFunctions.fStencilFuncSeparate ||
+ nullptr == fFunctions.fStencilMaskSeparate ||
+ nullptr == fFunctions.fStencilOpSeparate) {
RETURN_FALSE_INTERFACE
}
} else if (kGL_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(2,0)) {
- if (NULL == fFunctions.fStencilFuncSeparate ||
- NULL == fFunctions.fStencilMaskSeparate ||
- NULL == fFunctions.fStencilOpSeparate) {
+ if (nullptr == fFunctions.fStencilFuncSeparate ||
+ nullptr == fFunctions.fStencilMaskSeparate ||
+ nullptr == fFunctions.fStencilOpSeparate) {
RETURN_FALSE_INTERFACE
}
}
- if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) {
+ if (glVer >= GR_GL_VER(3,0) && nullptr == fFunctions.fBindFragDataLocation) {
RETURN_FALSE_INTERFACE
}
if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) {
- if (NULL == fFunctions.fDrawBuffers) {
+ if (nullptr == fFunctions.fDrawBuffers) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) {
- if (NULL == fFunctions.fGenQueries ||
- NULL == fFunctions.fDeleteQueries ||
- NULL == fFunctions.fBeginQuery ||
- NULL == fFunctions.fEndQuery ||
- NULL == fFunctions.fGetQueryiv ||
- NULL == fFunctions.fGetQueryObjectiv ||
- NULL == fFunctions.fGetQueryObjectuiv) {
+ if (nullptr == fFunctions.fGenQueries ||
+ nullptr == fFunctions.fDeleteQueries ||
+ nullptr == fFunctions.fBeginQuery ||
+ nullptr == fFunctions.fEndQuery ||
+ nullptr == fFunctions.fGetQueryiv ||
+ nullptr == fFunctions.fGetQueryObjectiv ||
+ nullptr == fFunctions.fGetQueryObjectuiv) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(3,3) ||
fExtensions.has("GL_ARB_timer_query") ||
fExtensions.has("GL_EXT_timer_query")) {
- if (NULL == fFunctions.fGetQueryObjecti64v ||
- NULL == fFunctions.fGetQueryObjectui64v) {
+ if (nullptr == fFunctions.fGetQueryObjecti64v ||
+ nullptr == fFunctions.fGetQueryObjectui64v) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
- if (NULL == fFunctions.fQueryCounter) {
+ if (nullptr == fFunctions.fQueryCounter) {
RETURN_FALSE_INTERFACE
}
}
@@ -275,9 +275,9 @@ bool GrGLInterface::validate() const {
if (kGL_GrGLStandard != fStandard ||
(glVer >= GR_GL_VER(1,3)) ||
fExtensions.has("GL_ARB_texture_compression")) {
- if (NULL == fFunctions.fCompressedTexImage2D
+ if (nullptr == fFunctions.fCompressedTexImage2D
#if 0
- || NULL == fFunctions.fCompressedTexSubImage2D
+ || nullptr == fFunctions.fCompressedTexSubImage2D
#endif
) {
RETURN_FALSE_INTERFACE
@@ -286,9 +286,9 @@ bool GrGLInterface::validate() const {
// part of desktop GL, but not ES
if (kGL_GrGLStandard == fStandard &&
- (NULL == fFunctions.fGetTexLevelParameteriv ||
- NULL == fFunctions.fDrawBuffer ||
- NULL == fFunctions.fReadBuffer)) {
+ (nullptr == fFunctions.fGetTexLevelParameteriv ||
+ nullptr == fFunctions.fDrawBuffer ||
+ nullptr == fFunctions.fReadBuffer)) {
RETURN_FALSE_INTERFACE
}
@@ -298,12 +298,12 @@ bool GrGLInterface::validate() const {
if (glVer >= GR_GL_VER(4,2) ||
fExtensions.has("GL_ARB_texture_storage") ||
fExtensions.has("GL_EXT_texture_storage")) {
- if (NULL == fFunctions.fTexStorage2D) {
+ if (nullptr == fFunctions.fTexStorage2D) {
RETURN_FALSE_INTERFACE
}
}
} else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) {
- if (NULL == fFunctions.fTexStorage2D) {
+ if (nullptr == fFunctions.fTexStorage2D) {
RETURN_FALSE_INTERFACE
}
}
@@ -313,19 +313,19 @@ bool GrGLInterface::validate() const {
if (glVer >= GR_GL_VER(4,5) ||
fExtensions.has("GL_ARB_texture_barrier") ||
fExtensions.has("GL_NV_texture_barrier")) {
- if (NULL == fFunctions.fTextureBarrier) {
+ if (nullptr == fFunctions.fTextureBarrier) {
RETURN_FALSE_INTERFACE
}
}
} else if (fExtensions.has("GL_NV_texture_barrier")) {
- if (NULL == fFunctions.fTextureBarrier) {
+ if (nullptr == fFunctions.fTextureBarrier) {
RETURN_FALSE_INTERFACE
}
}
if (fExtensions.has("GL_KHR_blend_equation_advanced") ||
fExtensions.has("GL_NV_blend_equation_advanced")) {
- if (NULL == fFunctions.fBlendBarrier) {
+ if (nullptr == fFunctions.fBlendBarrier) {
RETURN_FALSE_INTERFACE
}
}
@@ -333,7 +333,7 @@ bool GrGLInterface::validate() const {
if (fExtensions.has("GL_EXT_discard_framebuffer")) {
// FIXME: Remove this once Chromium is updated to provide this function
#if 0
- if (NULL == fFunctions.fDiscardFramebuffer) {
+ if (nullptr == fFunctions.fDiscardFramebuffer) {
RETURN_FALSE_INTERFACE
}
#endif
@@ -343,37 +343,37 @@ bool GrGLInterface::validate() const {
if (kGL_GrGLStandard == fStandard) {
// GL 3.0 and the ARB extension have multisample + blit
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
- if (NULL == fFunctions.fRenderbufferStorageMultisample ||
- NULL == fFunctions.fBlitFramebuffer) {
+ if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
+ nullptr == fFunctions.fBlitFramebuffer) {
RETURN_FALSE_INTERFACE
}
} else {
if (fExtensions.has("GL_EXT_framebuffer_blit") &&
- NULL == fFunctions.fBlitFramebuffer) {
+ nullptr == fFunctions.fBlitFramebuffer) {
RETURN_FALSE_INTERFACE
}
if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
- NULL == fFunctions.fRenderbufferStorageMultisample) {
+ nullptr == fFunctions.fRenderbufferStorageMultisample) {
RETURN_FALSE_INTERFACE
}
}
} else {
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
- if (NULL == fFunctions.fRenderbufferStorageMultisample ||
- NULL == fFunctions.fBlitFramebuffer) {
+ if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
+ nullptr == fFunctions.fBlitFramebuffer) {
RETURN_FALSE_INTERFACE
}
}
if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
- if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
- NULL == fFunctions.fResolveMultisampleFramebuffer) {
+ if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
+ nullptr == fFunctions.fResolveMultisampleFramebuffer) {
RETURN_FALSE_INTERFACE
}
}
if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
- if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
- NULL == fFunctions.fFramebufferTexture2DMultisample) {
+ if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
+ nullptr == fFunctions.fFramebufferTexture2DMultisample) {
RETURN_FALSE_INTERFACE
}
}
@@ -383,8 +383,8 @@ bool GrGLInterface::validate() const {
// buffer mapping was part of original VBO extension
// which we require.
if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) {
- if (NULL == fFunctions.fMapBuffer ||
- NULL == fFunctions.fUnmapBuffer) {
+ if (nullptr == fFunctions.fMapBuffer ||
+ nullptr == fFunctions.fUnmapBuffer) {
RETURN_FALSE_INTERFACE
}
}
@@ -392,14 +392,14 @@ bool GrGLInterface::validate() const {
// Dual source blending
if (kGL_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended")) {
- if (NULL == fFunctions.fBindFragDataLocationIndexed) {
+ if (nullptr == fFunctions.fBindFragDataLocationIndexed) {
RETURN_FALSE_INTERFACE
}
}
} else {
if (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended")) {
- if (NULL == fFunctions.fBindFragDataLocation ||
- NULL == fFunctions.fBindFragDataLocationIndexed) {
+ if (nullptr == fFunctions.fBindFragDataLocation ||
+ nullptr == fFunctions.fBindFragDataLocationIndexed) {
RETURN_FALSE_INTERFACE
}
}
@@ -408,60 +408,60 @@ bool GrGLInterface::validate() const {
// glGetStringi was added in version 3.0 of both desktop and ES.
if (glVer >= GR_GL_VER(3, 0)) {
- if (NULL == fFunctions.fGetStringi) {
+ if (nullptr == fFunctions.fGetStringi) {
RETURN_FALSE_INTERFACE
}
}
if (kGL_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
- if (NULL == fFunctions.fBindVertexArray ||
- NULL == fFunctions.fDeleteVertexArrays ||
- NULL == fFunctions.fGenVertexArrays) {
+ if (nullptr == fFunctions.fBindVertexArray ||
+ nullptr == fFunctions.fDeleteVertexArrays ||
+ nullptr == fFunctions.fGenVertexArrays) {
RETURN_FALSE_INTERFACE
}
}
} else {
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
- if (NULL == fFunctions.fBindVertexArray ||
- NULL == fFunctions.fDeleteVertexArrays ||
- NULL == fFunctions.fGenVertexArrays) {
+ if (nullptr == fFunctions.fBindVertexArray ||
+ nullptr == fFunctions.fDeleteVertexArrays ||
+ nullptr == fFunctions.fGenVertexArrays) {
RETURN_FALSE_INTERFACE
}
}
}
if (fExtensions.has("GL_EXT_debug_marker")) {
- if (NULL == fFunctions.fInsertEventMarker ||
- NULL == fFunctions.fPushGroupMarker ||
- NULL == fFunctions.fPopGroupMarker) {
+ if (nullptr == fFunctions.fInsertEventMarker ||
+ nullptr == fFunctions.fPushGroupMarker ||
+ nullptr == fFunctions.fPopGroupMarker) {
RETURN_FALSE_INTERFACE
}
}
if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
fExtensions.has("GL_ARB_invalidate_subdata")) {
- if (NULL == fFunctions.fInvalidateBufferData ||
- NULL == fFunctions.fInvalidateBufferSubData ||
- NULL == fFunctions.fInvalidateFramebuffer ||
- NULL == fFunctions.fInvalidateSubFramebuffer ||
- NULL == fFunctions.fInvalidateTexImage ||
- NULL == fFunctions.fInvalidateTexSubImage) {
+ if (nullptr == fFunctions.fInvalidateBufferData ||
+ nullptr == fFunctions.fInvalidateBufferSubData ||
+ nullptr == fFunctions.fInvalidateFramebuffer ||
+ nullptr == fFunctions.fInvalidateSubFramebuffer ||
+ nullptr == fFunctions.fInvalidateTexImage ||
+ nullptr == fFunctions.fInvalidateTexSubImage) {
RETURN_FALSE_INTERFACE;
}
} else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) {
// ES 3.0 adds the framebuffer functions but not the others.
- if (NULL == fFunctions.fInvalidateFramebuffer ||
- NULL == fFunctions.fInvalidateSubFramebuffer) {
+ if (nullptr == fFunctions.fInvalidateFramebuffer ||
+ nullptr == fFunctions.fInvalidateSubFramebuffer) {
RETURN_FALSE_INTERFACE;
}
}
if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) {
- if (NULL == fFunctions.fMapBufferSubData ||
- NULL == fFunctions.fMapTexSubImage2D ||
- NULL == fFunctions.fUnmapBufferSubData ||
- NULL == fFunctions.fUnmapTexSubImage2D) {
+ if (nullptr == fFunctions.fMapBufferSubData ||
+ nullptr == fFunctions.fMapTexSubImage2D ||
+ nullptr == fFunctions.fUnmapBufferSubData ||
+ nullptr == fFunctions.fUnmapTexSubImage2D) {
RETURN_FALSE_INTERFACE;
}
}
@@ -470,8 +470,8 @@ bool GrGLInterface::validate() const {
if (glVer >= GR_GL_VER(3,0) ||
(kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) ||
(kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) {
- if (NULL == fFunctions.fMapBufferRange ||
- NULL == fFunctions.fFlushMappedBufferRange) {
+ if (nullptr == fFunctions.fMapBufferRange ||
+ nullptr == fFunctions.fFlushMappedBufferRange) {
RETURN_FALSE_INTERFACE;
}
}
@@ -479,7 +479,7 @@ bool GrGLInterface::validate() const {
if ((kGL_GrGLStandard == fStandard &&
(glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) ||
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) {
- if (NULL == fFunctions.fGetProgramResourceLocation) {
+ if (nullptr == fFunctions.fGetProgramResourceLocation) {
RETURN_FALSE_INTERFACE
}
}
@@ -487,59 +487,59 @@ bool GrGLInterface::validate() const {
if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) ||
fExtensions.has("GL_ARB_ES2_compatibility")) {
#if 0 // Enable this once Chrome gives us the function ptr
- if (NULL == fFunctions.fGetShaderPrecisionFormat) {
+ if (nullptr == fFunctions.fGetShaderPrecisionFormat) {
RETURN_FALSE_INTERFACE
}
#endif
}
if (fExtensions.has("GL_NV_path_rendering") || fExtensions.has("GL_CHROMIUM_path_rendering")) {
- if (NULL == fFunctions.fMatrixLoadf ||
- NULL == fFunctions.fMatrixLoadIdentity ||
- NULL == fFunctions.fPathCommands ||
- NULL == fFunctions.fPathParameteri ||
- NULL == fFunctions.fPathParameterf ||
- NULL == fFunctions.fGenPaths ||
- NULL == fFunctions.fDeletePaths ||
- NULL == fFunctions.fIsPath ||
- NULL == fFunctions.fPathStencilFunc ||
- NULL == fFunctions.fStencilFillPath ||
- NULL == fFunctions.fStencilStrokePath ||
- NULL == fFunctions.fStencilFillPathInstanced ||
- NULL == fFunctions.fStencilStrokePathInstanced ||
- NULL == fFunctions.fCoverFillPath ||
- NULL == fFunctions.fCoverStrokePath ||
- NULL == fFunctions.fCoverFillPathInstanced ||
- NULL == fFunctions.fCoverStrokePathInstanced
+ if (nullptr == fFunctions.fMatrixLoadf ||
+ nullptr == fFunctions.fMatrixLoadIdentity ||
+ nullptr == fFunctions.fPathCommands ||
+ nullptr == fFunctions.fPathParameteri ||
+ nullptr == fFunctions.fPathParameterf ||
+ nullptr == fFunctions.fGenPaths ||
+ nullptr == fFunctions.fDeletePaths ||
+ nullptr == fFunctions.fIsPath ||
+ nullptr == fFunctions.fPathStencilFunc ||
+ nullptr == fFunctions.fStencilFillPath ||
+ nullptr == fFunctions.fStencilStrokePath ||
+ nullptr == fFunctions.fStencilFillPathInstanced ||
+ nullptr == fFunctions.fStencilStrokePathInstanced ||
+ nullptr == fFunctions.fCoverFillPath ||
+ nullptr == fFunctions.fCoverStrokePath ||
+ nullptr == fFunctions.fCoverFillPathInstanced ||
+ nullptr == fFunctions.fCoverStrokePathInstanced
#if 0
// List of functions that Skia uses, but which have been added since the initial release
// of NV_path_rendering driver. We do not want to fail interface validation due to
// missing features, we will just not use the extension.
// Update this list -> update GrGLCaps::hasPathRenderingSupport too.
- || NULL == fFunctions.fStencilThenCoverFillPath ||
- NULL == fFunctions.fStencilThenCoverStrokePath ||
- NULL == fFunctions.fStencilThenCoverFillPathInstanced ||
- NULL == fFunctions.fStencilThenCoverStrokePathInstanced ||
- NULL == fFunctions.fProgramPathFragmentInputGen
+ || nullptr == fFunctions.fStencilThenCoverFillPath ||
+ nullptr == fFunctions.fStencilThenCoverStrokePath ||
+ nullptr == fFunctions.fStencilThenCoverFillPathInstanced ||
+ nullptr == fFunctions.fStencilThenCoverStrokePathInstanced ||
+ nullptr == fFunctions.fProgramPathFragmentInputGen
#endif
) {
RETURN_FALSE_INTERFACE
}
if (fExtensions.has("GL_CHROMIUM_path_rendering")) {
- if (NULL == fFunctions.fBindFragmentInputLocation) {
+ if (nullptr == fFunctions.fBindFragmentInputLocation) {
RETURN_FALSE_INTERFACE
}
}
}
if (fExtensions.has("GL_EXT_raster_multisample")) {
- if (NULL == fFunctions.fRasterSamples) {
+ if (nullptr == fFunctions.fRasterSamples) {
RETURN_FALSE_INTERFACE
}
}
if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
- if (NULL == fFunctions.fCoverageModulation) {
+ if (nullptr == fFunctions.fCoverageModulation) {
RETURN_FALSE_INTERFACE
}
}
@@ -548,8 +548,8 @@ bool GrGLInterface::validate() const {
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) ||
fExtensions.has("GL_ARB_draw_instanced") ||
fExtensions.has("GL_EXT_draw_instanced")) {
- if (NULL == fFunctions.fDrawArraysInstanced ||
- NULL == fFunctions.fDrawElementsInstanced) {
+ if (nullptr == fFunctions.fDrawArraysInstanced ||
+ nullptr == fFunctions.fDrawElementsInstanced) {
RETURN_FALSE_INTERFACE
}
}
@@ -558,144 +558,144 @@ bool GrGLInterface::validate() const {
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) ||
fExtensions.has("GL_ARB_instanced_arrays") ||
fExtensions.has("GL_EXT_instanced_arrays")) {
- if (NULL == fFunctions.fVertexAttribDivisor) {
+ if (nullptr == fFunctions.fVertexAttribDivisor) {
RETURN_FALSE_INTERFACE
}
}
if (fExtensions.has("GL_NV_bindless_texture")) {
- if (NULL == fFunctions.fGetTextureHandle ||
- NULL == fFunctions.fGetTextureSamplerHandle ||
- NULL == fFunctions.fMakeTextureHandleResident ||
- NULL == fFunctions.fMakeTextureHandleNonResident ||
- NULL == fFunctions.fGetImageHandle ||
- NULL == fFunctions.fMakeImageHandleResident ||
- NULL == fFunctions.fMakeImageHandleNonResident ||
- NULL == fFunctions.fIsTextureHandleResident ||
- NULL == fFunctions.fIsImageHandleResident ||
- NULL == fFunctions.fUniformHandleui64 ||
- NULL == fFunctions.fUniformHandleui64v ||
- NULL == fFunctions.fProgramUniformHandleui64 ||
- NULL == fFunctions.fProgramUniformHandleui64v) {
+ if (nullptr == fFunctions.fGetTextureHandle ||
+ nullptr == fFunctions.fGetTextureSamplerHandle ||
+ nullptr == fFunctions.fMakeTextureHandleResident ||
+ nullptr == fFunctions.fMakeTextureHandleNonResident ||
+ nullptr == fFunctions.fGetImageHandle ||
+ nullptr == fFunctions.fMakeImageHandleResident ||
+ nullptr == fFunctions.fMakeImageHandleNonResident ||
+ nullptr == fFunctions.fIsTextureHandleResident ||
+ nullptr == fFunctions.fIsImageHandleResident ||
+ nullptr == fFunctions.fUniformHandleui64 ||
+ nullptr == fFunctions.fUniformHandleui64v ||
+ nullptr == fFunctions.fProgramUniformHandleui64 ||
+ nullptr == fFunctions.fProgramUniformHandleui64v) {
RETURN_FALSE_INTERFACE
}
}
if (kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) {
- if (NULL == fFunctions.fTextureParameteri ||
- NULL == fFunctions.fTextureParameteriv ||
- NULL == fFunctions.fTextureParameterf ||
- NULL == fFunctions.fTextureParameterfv ||
- NULL == fFunctions.fTextureImage1D ||
- NULL == fFunctions.fTextureImage2D ||
- NULL == fFunctions.fTextureSubImage1D ||
- NULL == fFunctions.fTextureSubImage2D ||
- NULL == fFunctions.fCopyTextureImage1D ||
- NULL == fFunctions.fCopyTextureImage2D ||
- NULL == fFunctions.fCopyTextureSubImage1D ||
- NULL == fFunctions.fCopyTextureSubImage2D ||
- NULL == fFunctions.fGetTextureImage ||
- NULL == fFunctions.fGetTextureParameterfv ||
- NULL == fFunctions.fGetTextureParameteriv ||
- NULL == fFunctions.fGetTextureLevelParameterfv ||
- NULL == fFunctions.fGetTextureLevelParameteriv) {
+ if (nullptr == fFunctions.fTextureParameteri ||
+ nullptr == fFunctions.fTextureParameteriv ||
+ nullptr == fFunctions.fTextureParameterf ||
+ nullptr == fFunctions.fTextureParameterfv ||
+ nullptr == fFunctions.fTextureImage1D ||
+ nullptr == fFunctions.fTextureImage2D ||
+ nullptr == fFunctions.fTextureSubImage1D ||
+ nullptr == fFunctions.fTextureSubImage2D ||
+ nullptr == fFunctions.fCopyTextureImage1D ||
+ nullptr == fFunctions.fCopyTextureImage2D ||
+ nullptr == fFunctions.fCopyTextureSubImage1D ||
+ nullptr == fFunctions.fCopyTextureSubImage2D ||
+ nullptr == fFunctions.fGetTextureImage ||
+ nullptr == fFunctions.fGetTextureParameterfv ||
+ nullptr == fFunctions.fGetTextureParameteriv ||
+ nullptr == fFunctions.fGetTextureLevelParameterfv ||
+ nullptr == fFunctions.fGetTextureLevelParameteriv) {
RETURN_FALSE_INTERFACE
}
if (glVer >= GR_GL_VER(1,2)) {
- if (NULL == fFunctions.fTextureImage3D ||
- NULL == fFunctions.fTextureSubImage3D ||
- NULL == fFunctions.fCopyTextureSubImage3D ||
- NULL == fFunctions.fCompressedTextureImage3D ||
- NULL == fFunctions.fCompressedTextureImage2D ||
- NULL == fFunctions.fCompressedTextureImage1D ||
- NULL == fFunctions.fCompressedTextureSubImage3D ||
- NULL == fFunctions.fCompressedTextureSubImage2D ||
- NULL == fFunctions.fCompressedTextureSubImage1D ||
- NULL == fFunctions.fGetCompressedTextureImage) {
+ if (nullptr == fFunctions.fTextureImage3D ||
+ nullptr == fFunctions.fTextureSubImage3D ||
+ nullptr == fFunctions.fCopyTextureSubImage3D ||
+ nullptr == fFunctions.fCompressedTextureImage3D ||
+ nullptr == fFunctions.fCompressedTextureImage2D ||
+ nullptr == fFunctions.fCompressedTextureImage1D ||
+ nullptr == fFunctions.fCompressedTextureSubImage3D ||
+ nullptr == fFunctions.fCompressedTextureSubImage2D ||
+ nullptr == fFunctions.fCompressedTextureSubImage1D ||
+ nullptr == fFunctions.fGetCompressedTextureImage) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(1,5)) {
- if (NULL == fFunctions.fNamedBufferData ||
- NULL == fFunctions.fNamedBufferSubData ||
- NULL == fFunctions.fMapNamedBuffer ||
- NULL == fFunctions.fUnmapNamedBuffer ||
- NULL == fFunctions.fGetNamedBufferParameteriv ||
- NULL == fFunctions.fGetNamedBufferPointerv ||
- NULL == fFunctions.fGetNamedBufferSubData) {
+ if (nullptr == fFunctions.fNamedBufferData ||
+ nullptr == fFunctions.fNamedBufferSubData ||
+ nullptr == fFunctions.fMapNamedBuffer ||
+ nullptr == fFunctions.fUnmapNamedBuffer ||
+ nullptr == fFunctions.fGetNamedBufferParameteriv ||
+ nullptr == fFunctions.fGetNamedBufferPointerv ||
+ nullptr == fFunctions.fGetNamedBufferSubData) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(2,0)) {
- if (NULL == fFunctions.fProgramUniform1f ||
- NULL == fFunctions.fProgramUniform2f ||
- NULL == fFunctions.fProgramUniform3f ||
- NULL == fFunctions.fProgramUniform4f ||
- NULL == fFunctions.fProgramUniform1i ||
- NULL == fFunctions.fProgramUniform2i ||
- NULL == fFunctions.fProgramUniform3i ||
- NULL == fFunctions.fProgramUniform4i ||
- NULL == fFunctions.fProgramUniform1fv ||
- NULL == fFunctions.fProgramUniform2fv ||
- NULL == fFunctions.fProgramUniform3fv ||
- NULL == fFunctions.fProgramUniform4fv ||
- NULL == fFunctions.fProgramUniform1iv ||
- NULL == fFunctions.fProgramUniform2iv ||
- NULL == fFunctions.fProgramUniform3iv ||
- NULL == fFunctions.fProgramUniform4iv ||
- NULL == fFunctions.fProgramUniformMatrix2fv ||
- NULL == fFunctions.fProgramUniformMatrix3fv ||
- NULL == fFunctions.fProgramUniformMatrix4fv) {
+ if (nullptr == fFunctions.fProgramUniform1f ||
+ nullptr == fFunctions.fProgramUniform2f ||
+ nullptr == fFunctions.fProgramUniform3f ||
+ nullptr == fFunctions.fProgramUniform4f ||
+ nullptr == fFunctions.fProgramUniform1i ||
+ nullptr == fFunctions.fProgramUniform2i ||
+ nullptr == fFunctions.fProgramUniform3i ||
+ nullptr == fFunctions.fProgramUniform4i ||
+ nullptr == fFunctions.fProgramUniform1fv ||
+ nullptr == fFunctions.fProgramUniform2fv ||
+ nullptr == fFunctions.fProgramUniform3fv ||
+ nullptr == fFunctions.fProgramUniform4fv ||
+ nullptr == fFunctions.fProgramUniform1iv ||
+ nullptr == fFunctions.fProgramUniform2iv ||
+ nullptr == fFunctions.fProgramUniform3iv ||
+ nullptr == fFunctions.fProgramUniform4iv ||
+ nullptr == fFunctions.fProgramUniformMatrix2fv ||
+ nullptr == fFunctions.fProgramUniformMatrix3fv ||
+ nullptr == fFunctions.fProgramUniformMatrix4fv) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(2,1)) {
- if (NULL == fFunctions.fProgramUniformMatrix2x3fv ||
- NULL == fFunctions.fProgramUniformMatrix3x2fv ||
- NULL == fFunctions.fProgramUniformMatrix2x4fv ||
- NULL == fFunctions.fProgramUniformMatrix4x2fv ||
- NULL == fFunctions.fProgramUniformMatrix3x4fv ||
- NULL == fFunctions.fProgramUniformMatrix4x3fv) {
+ if (nullptr == fFunctions.fProgramUniformMatrix2x3fv ||
+ nullptr == fFunctions.fProgramUniformMatrix3x2fv ||
+ nullptr == fFunctions.fProgramUniformMatrix2x4fv ||
+ nullptr == fFunctions.fProgramUniformMatrix4x2fv ||
+ nullptr == fFunctions.fProgramUniformMatrix3x4fv ||
+ nullptr == fFunctions.fProgramUniformMatrix4x3fv) {
RETURN_FALSE_INTERFACE
}
}
if (glVer >= GR_GL_VER(3,0)) {
- if (NULL == fFunctions.fNamedRenderbufferStorage ||
- NULL == fFunctions.fGetNamedRenderbufferParameteriv ||
- NULL == fFunctions.fNamedRenderbufferStorageMultisample ||
- NULL == fFunctions.fCheckNamedFramebufferStatus ||
- NULL == fFunctions.fNamedFramebufferTexture1D ||
- NULL == fFunctions.fNamedFramebufferTexture2D ||
- NULL == fFunctions.fNamedFramebufferTexture3D ||
- NULL == fFunctions.fNamedFramebufferRenderbuffer ||
- NULL == fFunctions.fGetNamedFramebufferAttachmentParameteriv ||
- NULL == fFunctions.fGenerateTextureMipmap ||
- NULL == fFunctions.fFramebufferDrawBuffer ||
- NULL == fFunctions.fFramebufferDrawBuffers ||
- NULL == fFunctions.fFramebufferReadBuffer ||
- NULL == fFunctions.fGetFramebufferParameteriv ||
- NULL == fFunctions.fNamedCopyBufferSubData ||
- NULL == fFunctions.fVertexArrayVertexOffset ||
- NULL == fFunctions.fVertexArrayColorOffset ||
- NULL == fFunctions.fVertexArrayEdgeFlagOffset ||
- NULL == fFunctions.fVertexArrayIndexOffset ||
- NULL == fFunctions.fVertexArrayNormalOffset ||
- NULL == fFunctions.fVertexArrayTexCoordOffset ||
- NULL == fFunctions.fVertexArrayMultiTexCoordOffset ||
- NULL == fFunctions.fVertexArrayFogCoordOffset ||
- NULL == fFunctions.fVertexArraySecondaryColorOffset ||
- NULL == fFunctions.fVertexArrayVertexAttribOffset ||
- NULL == fFunctions.fVertexArrayVertexAttribIOffset ||
- NULL == fFunctions.fEnableVertexArray ||
- NULL == fFunctions.fDisableVertexArray ||
- NULL == fFunctions.fEnableVertexArrayAttrib ||
- NULL == fFunctions.fDisableVertexArrayAttrib ||
- NULL == fFunctions.fGetVertexArrayIntegerv ||
- NULL == fFunctions.fGetVertexArrayPointerv ||
- NULL == fFunctions.fGetVertexArrayIntegeri_v ||
- NULL == fFunctions.fGetVertexArrayPointeri_v ||
- NULL == fFunctions.fMapNamedBufferRange ||
- NULL == fFunctions.fFlushMappedNamedBufferRange) {
+ if (nullptr == fFunctions.fNamedRenderbufferStorage ||
+ nullptr == fFunctions.fGetNamedRenderbufferParameteriv ||
+ nullptr == fFunctions.fNamedRenderbufferStorageMultisample ||
+ nullptr == fFunctions.fCheckNamedFramebufferStatus ||
+ nullptr == fFunctions.fNamedFramebufferTexture1D ||
+ nullptr == fFunctions.fNamedFramebufferTexture2D ||
+ nullptr == fFunctions.fNamedFramebufferTexture3D ||
+ nullptr == fFunctions.fNamedFramebufferRenderbuffer ||
+ nullptr == fFunctions.fGetNamedFramebufferAttachmentParameteriv ||
+ nullptr == fFunctions.fGenerateTextureMipmap ||
+ nullptr == fFunctions.fFramebufferDrawBuffer ||
+ nullptr == fFunctions.fFramebufferDrawBuffers ||
+ nullptr == fFunctions.fFramebufferReadBuffer ||
+ nullptr == fFunctions.fGetFramebufferParameteriv ||
+ nullptr == fFunctions.fNamedCopyBufferSubData ||
+ nullptr == fFunctions.fVertexArrayVertexOffset ||
+ nullptr == fFunctions.fVertexArrayColorOffset ||
+ nullptr == fFunctions.fVertexArrayEdgeFlagOffset ||
+ nullptr == fFunctions.fVertexArrayIndexOffset ||
+ nullptr == fFunctions.fVertexArrayNormalOffset ||
+ nullptr == fFunctions.fVertexArrayTexCoordOffset ||
+ nullptr == fFunctions.fVertexArrayMultiTexCoordOffset ||
+ nullptr == fFunctions.fVertexArrayFogCoordOffset ||
+ nullptr == fFunctions.fVertexArraySecondaryColorOffset ||
+ nullptr == fFunctions.fVertexArrayVertexAttribOffset ||
+ nullptr == fFunctions.fVertexArrayVertexAttribIOffset ||
+ nullptr == fFunctions.fEnableVertexArray ||
+ nullptr == fFunctions.fDisableVertexArray ||
+ nullptr == fFunctions.fEnableVertexArrayAttrib ||
+ nullptr == fFunctions.fDisableVertexArrayAttrib ||
+ nullptr == fFunctions.fGetVertexArrayIntegerv ||
+ nullptr == fFunctions.fGetVertexArrayPointerv ||
+ nullptr == fFunctions.fGetVertexArrayIntegeri_v ||
+ nullptr == fFunctions.fGetVertexArrayPointeri_v ||
+ nullptr == fFunctions.fMapNamedBufferRange ||
+ nullptr == fFunctions.fFlushMappedNamedBufferRange) {
RETURN_FALSE_INTERFACE
}
}
@@ -703,13 +703,13 @@ bool GrGLInterface::validate() const {
if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
fExtensions.has("GL_KHR_debug")) {
- if (NULL == fFunctions.fDebugMessageControl ||
- NULL == fFunctions.fDebugMessageInsert ||
- NULL == fFunctions.fDebugMessageCallback ||
- NULL == fFunctions.fGetDebugMessageLog ||
- NULL == fFunctions.fPushDebugGroup ||
- NULL == fFunctions.fPopDebugGroup ||
- NULL == fFunctions.fObjectLabel) {
+ if (nullptr == fFunctions.fDebugMessageControl ||
+ nullptr == fFunctions.fDebugMessageInsert ||
+ nullptr == fFunctions.fDebugMessageCallback ||
+ nullptr == fFunctions.fGetDebugMessageLog ||
+ nullptr == fFunctions.fPushDebugGroup ||
+ nullptr == fFunctions.fPopDebugGroup ||
+ nullptr == fFunctions.fObjectLabel) {
RETURN_FALSE_INTERFACE
}
}
diff --git a/src/gpu/gl/GrGLNameAllocator.cpp b/src/gpu/gl/GrGLNameAllocator.cpp
index 49d4564fb9..03123a6d86 100644
--- a/src/gpu/gl/GrGLNameAllocator.cpp
+++ b/src/gpu/gl/GrGLNameAllocator.cpp
@@ -64,7 +64,7 @@ public:
*
* @param removedCount A pointer that receives the size of the contiguous
range that was removed.
- * @return The resulting SparseNameRange after the removal (or NULL if it
+ * @return The resulting SparseNameRange after the removal (or nullptr if it
* became empty). Note that this call is destructive, so the
* original SparseNameRange will no longer be valid afterward. The
* caller must always update its pointer with the new
@@ -100,7 +100,7 @@ public:
*
* @param name The name to free. Not-allocated names are silently ignored
* the same way they are in the OpenGL spec.
- * @return The resulting SparseNameRange after the free (or NULL if it
+ * @return The resulting SparseNameRange after the free (or nullptr if it
* became empty). Note that this call is destructive, so the
* original SparseNameRange will no longer be valid afterward. The
* caller must always update its pointer with the new
@@ -146,7 +146,7 @@ public:
GrGLuint removedCount;
fRight.reset(fRight->removeLeftmostContiguousRange(&removedCount));
*outName = fLeft->appendNames(1 + removedCount);
- if (NULL == fRight.get()) {
+ if (nullptr == fRight.get()) {
return fLeft.detach();
}
this->updateStats();
@@ -162,7 +162,7 @@ public:
SparseNameRange* SK_WARN_UNUSED_RESULT removeLeftmostContiguousRange(GrGLuint* removedCount) override {
fLeft.reset(fLeft->removeLeftmostContiguousRange(removedCount));
- if (NULL == fLeft) {
+ if (nullptr == fLeft) {
return fRight.detach();
}
this->updateStats();
@@ -188,7 +188,7 @@ public:
SparseNameRange* SK_WARN_UNUSED_RESULT free(GrGLuint name) override {
if (name < fLeft->end()) {
fLeft.reset(fLeft->free(name));
- if (NULL == fLeft) {
+ if (nullptr == fLeft) {
// fLeft became empty after the free.
return fRight.detach();
}
@@ -196,7 +196,7 @@ public:
return this->rebalance();
} else {
fRight.reset(fRight->free(name));
- if (NULL == fRight) {
+ if (nullptr == fRight) {
// fRight became empty after the free.
return fLeft.detach();
}
@@ -287,7 +287,7 @@ public:
SparseNameRange* SK_WARN_UNUSED_RESULT removeLeftmostContiguousRange(GrGLuint* removedCount) override {
*removedCount = fEnd - fFirst;
- return NULL;
+ return nullptr;
}
GrGLuint appendNames(GrGLuint count) override {
@@ -311,7 +311,7 @@ public:
if (fFirst == name) {
++fFirst;
- return (fEnd == fFirst) ? NULL : this->takeRef();
+ return (fEnd == fFirst) ? nullptr : this->takeRef();
}
if (fEnd == name + 1) {
@@ -337,7 +337,7 @@ GrGLNameAllocator::~GrGLNameAllocator() {
}
GrGLuint GrGLNameAllocator::allocateName() {
- if (NULL == fAllocatedNames.get()) {
+ if (nullptr == fAllocatedNames.get()) {
fAllocatedNames.reset(new ContiguousNameRange(fFirstName, fFirstName + 1));
return fFirstName;
}
diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp
index f47f254424..113c47d054 100644
--- a/src/gpu/gl/GrGLNoOpInterface.cpp
+++ b/src/gpu/gl/GrGLNoOpInterface.cpp
@@ -642,7 +642,7 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) {
return (const GrGLubyte*)"The Debug (Non-)Renderer";
default:
SkFAIL("Unexpected name passed to GetString");
- return NULL;
+ return nullptr;
}
}
@@ -652,11 +652,11 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i)
if (static_cast<size_t>(i) <= SK_ARRAY_COUNT(kExtensions)) {
return (const GrGLubyte*) kExtensions[i];
} else {
- return NULL;
+ return nullptr;
}
default:
SkFAIL("Unexpected name passed to GetStringi");
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 9a4aa0cbef..1dfeaee7b3 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -166,7 +166,7 @@ void GrGLPath::InitPathObject(GrGLGpu* gpu,
GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, pathCommands.count(), &pathCommands[0],
pathCoords.count(), GR_GL_FLOAT, &pathCoords[0]));
} else {
- GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, 0, NULL, 0, GR_GL_FLOAT, NULL));
+ GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, 0, nullptr, 0, GR_GL_FLOAT, nullptr));
}
if (stroke.needToApply()) {
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
index 071fa4269e..bd213d4e09 100644
--- a/src/gpu/gl/GrGLPathRange.cpp
+++ b/src/gpu/gl/GrGLPathRange.cpp
@@ -46,7 +46,7 @@ void GrGLPathRange::init() {
void GrGLPathRange::onInitPath(int index, const SkPath& origSkPath) const {
GrGLGpu* gpu = static_cast<GrGLGpu*>(this->getGpu());
- if (NULL == gpu) {
+ if (nullptr == gpu) {
return;
}
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 22b12bf988..78f78baf9d 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -63,14 +63,14 @@ GrGLPathRendering::GrGLPathRendering(GrGLGpu* gpu)
: GrPathRendering(gpu) {
const GrGLInterface* glInterface = gpu->glInterface();
fCaps.bindFragmentInputSupport =
- NULL != glInterface->fFunctions.fBindFragmentInputLocation;
+ nullptr != glInterface->fFunctions.fBindFragmentInputLocation;
}
GrGLPathRendering::~GrGLPathRendering() {
}
void GrGLPathRendering::abandonGpuResources() {
- fPathNameAllocator.reset(NULL);
+ fPathNameAllocator.reset(nullptr);
}
void GrGLPathRendering::resetContext() {
@@ -101,7 +101,7 @@ void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
this->setProjectionMatrix(*args.fViewMatrix, size, rt->origin());
gpu->flushScissor(*args.fScissor, rt->getViewport(), rt->origin());
gpu->flushHWAAState(rt, args.fUseHWAA);
- gpu->flushRenderTarget(rt, NULL);
+ gpu->flushRenderTarget(rt, nullptr);
const GrGLPath* glPath = static_cast<const GrGLPath*>(path);
@@ -236,7 +236,7 @@ GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) {
return name;
}
- if (NULL == fPathNameAllocator.get()) {
+ if (nullptr == fPathNameAllocator.get()) {
static const int range = 65536;
GrGLuint firstName;
GL_CALL_RET(firstName, GenPaths(range));
@@ -259,14 +259,14 @@ void GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) {
if (range > 1) {
// It is not supported to delete names in ranges that were allocated
// individually using GrGLPathNameAllocator.
- SkASSERT(NULL == fPathNameAllocator.get() ||
+ SkASSERT(nullptr == fPathNameAllocator.get() ||
path + range <= fPathNameAllocator->firstName() ||
path >= fPathNameAllocator->endName());
GL_CALL(DeletePaths(path, range));
return;
}
- if (NULL == fPathNameAllocator.get() ||
+ if (nullptr == fPathNameAllocator.get() ||
path < fPathNameAllocator->firstName() ||
path >= fPathNameAllocator->endName()) {
// If we aren't inside fPathNameAllocator's range then this name was
@@ -276,7 +276,7 @@ void GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) {
}
// Make the path empty to save memory, but don't free the name in the driver.
- GL_CALL(PathCommands(path, 0, NULL, 0, GR_GL_FLOAT, NULL));
+ GL_CALL(PathCommands(path, 0, nullptr, 0, GR_GL_FLOAT, nullptr));
fPathNameAllocator->free(path);
}
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 34276e2c40..5579701796 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -63,8 +63,8 @@ void GrGLCheckErr(const GrGLInterface* gl,
///////////////////////////////////////////////////////////////////////////////
GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) {
- if (NULL == versionString) {
- SkDebugf("NULL GL version string.");
+ if (nullptr == versionString) {
+ SkDebugf("nullptr GL version string.");
return kNone_GrGLStandard;
}
@@ -165,8 +165,8 @@ void GrGLGetDriverInfo(GrGLStandard standard,
}
GrGLVersion GrGLGetVersionFromString(const char* versionString) {
- if (NULL == versionString) {
- SkDebugf("NULL GL version string.");
+ if (nullptr == versionString) {
+ SkDebugf("nullptr GL version string.");
return GR_GL_INVALID_VER;
}
@@ -200,8 +200,8 @@ GrGLVersion GrGLGetVersionFromString(const char* versionString) {
}
GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) {
- if (NULL == versionString) {
- SkDebugf("NULL GLSL version string.");
+ if (nullptr == versionString) {
+ SkDebugf("nullptr GLSL version string.");
return GR_GLSL_INVALID_VER;
}
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index 265b5b35ea..8cfa8d6550 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -75,7 +75,7 @@ GrGLVertexArray::GrGLVertexArray(GrGLint id, int attribCount)
GrGLAttribArrayState* GrGLVertexArray::bind(GrGLGpu* gpu) {
if (0 == fID) {
- return NULL;
+ return nullptr;
}
gpu->bindVertexArray(fID);
return &fAttribArrays;
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h
index afb23c5d20..66bc14297e 100644
--- a/src/gpu/gl/GrGLVertexArray.h
+++ b/src/gpu/gl/GrGLVertexArray.h
@@ -137,7 +137,7 @@ public:
GrGLVertexArray(GrGLint id, int attribCount);
/**
- * Binds this vertex array. If the ID has been deleted or abandoned then NULL is returned.
+ * Binds this vertex array. If the ID has been deleted or abandoned then nullptr is returned.
* Otherwise, the GrGLAttribArrayState that is tracking this vertex array's attrib bindings is
* returned.
*/
diff --git a/src/gpu/gl/GrGLVertexBuffer.cpp b/src/gpu/gl/GrGLVertexBuffer.cpp
index 61936f25bf..cd9d52a280 100644
--- a/src/gpu/gl/GrGLVertexBuffer.cpp
+++ b/src/gpu/gl/GrGLVertexBuffer.cpp
@@ -31,7 +31,7 @@ void* GrGLVertexBuffer::onMap() {
if (!this->wasDestroyed()) {
return fImpl.map(this->getGpuGL());
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/src/gpu/gl/SkGLContext.cpp b/src/gpu/gl/SkGLContext.cpp
index 75fbf2bac5..ec318cb80d 100644
--- a/src/gpu/gl/SkGLContext.cpp
+++ b/src/gpu/gl/SkGLContext.cpp
@@ -49,8 +49,8 @@ SkGLContext::~SkGLContext() {
SkASSERT(0 == fFrameFences[i]);
}
#endif
- SkASSERT(NULL == fGL.get());
- SkASSERT(NULL == fFenceSync.get());
+ SkASSERT(nullptr == fGL.get());
+ SkASSERT(nullptr == fFenceSync.get());
}
void SkGLContext::init(const GrGLInterface* gl, SkGpuFenceSync* fenceSync) {
@@ -67,10 +67,10 @@ void SkGLContext::teardown() {
fFrameFences[i] = 0;
}
}
- fFenceSync.reset(NULL);
+ fFenceSync.reset(nullptr);
}
- fGL.reset(NULL);
+ fGL.reset(nullptr);
}
void SkGLContext::makeCurrent() const {
@@ -112,7 +112,7 @@ SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL
SK_GL_RET(*ctx, versionStr, GetString(GR_GL_VERSION));
GrGLVersion version = GrGLGetVersionFromString(reinterpret_cast<const char*>(versionStr));
if (version < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync")) {
- return NULL;
+ return nullptr;
}
ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>(
ctx->onPlatformGetProcAddress("glFenceSync"));
@@ -122,7 +122,7 @@ SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL
ctx->onPlatformGetProcAddress("glDeleteSync"));
} else {
if (!ctx->gl()->hasExtension("GL_APPLE_sync")) {
- return NULL;
+ return nullptr;
}
ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>(
ctx->onPlatformGetProcAddress("glFenceSyncAPPLE"));
@@ -133,7 +133,7 @@ SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL
}
if (!ret->fGLFenceSync || !ret->fGLClientWaitSync || !ret->fGLDeleteSync) {
- return NULL;
+ return nullptr;
}
return ret.detach();
diff --git a/src/gpu/gl/SkNullGLContext.cpp b/src/gpu/gl/SkNullGLContext.cpp
index dddea763ad..877eed9d77 100644
--- a/src/gpu/gl/SkNullGLContext.cpp
+++ b/src/gpu/gl/SkNullGLContext.cpp
@@ -21,7 +21,7 @@ class BufferObj {
public:
- BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {}
+ BufferObj(GrGLuint id) : fID(id), fDataPtr(nullptr), fSize(0), fMapped(false) {}
~BufferObj() { delete[] fDataPtr; }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
@@ -56,11 +56,11 @@ public:
BufferManager() : fFreeListHead(kFreeListEnd) {}
~BufferManager() {
- // NULL out the entries that are really free list links rather than ptrs before deleting.
+ // nullptr out the entries that are really free list links rather than ptrs before deleting.
intptr_t curr = fFreeListHead;
while (kFreeListEnd != curr) {
intptr_t next = reinterpret_cast<intptr_t>(fBuffers[SkToS32(curr)]);
- fBuffers[SkToS32(curr)] = NULL;
+ fBuffers[SkToS32(curr)] = nullptr;
curr = next;
}
@@ -254,7 +254,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr o
buffer->setMapped(true);
return buffer->dataPtr();
}
- return NULL;
+ return nullptr;
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
@@ -277,7 +277,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access)
}
SkASSERT(false);
- return NULL; // no buffer bound to target
+ return nullptr; // no buffer bound to target
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target,
@@ -499,7 +499,7 @@ static GrGLInterface* create_null_interface(State* state) {
static void* create_tls() {
State** current = new State*;
- *current = NULL;
+ *current = nullptr;
return current;
}
@@ -534,12 +534,12 @@ static void set_current_context_from_interface(const GrGLInterface* interface) {
SkNullGLContext* SkNullGLContext::Create(GrGLStandard forcedGpuAPI) {
if (kGLES_GrGLStandard == forcedGpuAPI) {
- return NULL;
+ return nullptr;
}
SkNullGLContext* ctx = new SkNullGLContext;
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
index 4569cc8f23..39a6673b99 100644
--- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
+++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
@@ -13,7 +13,7 @@
#include <GLES2/gl2.h>
static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) {
- SkASSERT(NULL == ctx);
+ SkASSERT(nullptr == ctx);
// Some older drivers on Android have busted eglGetProcAdddress Functions that
// will return the wrong pointer for built in GLES2 functions. This set of functions
// was generated on a Xoom by finding mismatches between the function pulled in via gl2.h and
@@ -225,5 +225,5 @@ static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) {
}
const GrGLInterface* GrGLCreateNativeInterface() {
- return GrGLAssembleInterface(NULL, android_get_gl_proc);
+ return GrGLAssembleInterface(nullptr, android_get_gl_proc);
}
diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
index e4f5467842..4f26c06afe 100644
--- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
+++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
@@ -24,15 +24,15 @@ static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) {
const GrGLInterface* GrGLCreateANGLEInterface() {
- static HMODULE ghANGLELib = NULL;
+ static HMODULE ghANGLELib = nullptr;
- if (NULL == ghANGLELib) {
+ if (nullptr == ghANGLELib) {
// We load the ANGLE library and never let it go
ghANGLELib = LoadLibrary("libGLESv2.dll");
}
- if (NULL == ghANGLELib) {
+ if (nullptr == ghANGLELib) {
// We can't setup the interface correctly w/o the DLL
- return NULL;
+ return nullptr;
}
return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc);
diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp
index db34c563ea..8ebdcb661e 100644
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp
@@ -80,7 +80,7 @@ SkANGLEGLContext::SkANGLEGLContext()
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
- fContext = eglCreateContext(fDisplay, surfaceConfig, NULL, contextAttribs);
+ fContext = eglCreateContext(fDisplay, surfaceConfig, nullptr, contextAttribs);
static const EGLint surfaceAttribs[] = {
@@ -94,7 +94,7 @@ SkANGLEGLContext::SkANGLEGLContext()
eglMakeCurrent(fDisplay, fSurface, fSurface, fContext);
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateANGLEInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Could not create ANGLE GL interface!\n");
this->destroyGLContext();
return;
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
index 8746fffb8b..912de0a645 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
@@ -112,7 +112,7 @@ class GrGLXPFragmentBuilder : public GrGLFragmentBuilder {
public:
GrGLXPFragmentBuilder(GrGLProgramBuilder* program) : INHERITED(program) {}
- /** Returns the variable name that holds the color of the destination pixel. This may be NULL if
+ /** Returns the variable name that holds the color of the destination pixel. This may be nullptr if
no effect advertised that it will read the destination. */
virtual const char* dstColor() = 0;
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index d0eb4d4865..e6e93e9f28 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -43,7 +43,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
GrGLSLExpr4 inputCoverage;
if (!pb->emitAndInstallProcs(&inputColor, &inputCoverage)) {
- return NULL;
+ return nullptr;
}
return pb->finalize();
@@ -69,8 +69,8 @@ GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const DrawArgs& args)
, fFS(this, args.fDesc->header().fFragPosKey)
, fOutOfStage(true)
, fStageIndex(-1)
- , fGeometryProcessor(NULL)
- , fXferProcessor(NULL)
+ , fGeometryProcessor(nullptr)
+ , fXferProcessor(nullptr)
, fArgs(args)
, fGpu(gpu)
, fUniforms(kVarsPerBlock)
@@ -252,7 +252,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp,
openBrace.printf("{ // Stage %d, %s\n", fStageIndex, fp.name());
fFS.codeAppend(openBrace.c_str());
- this->emitAndInstallProc(fp, index, output->c_str(), input.isOnes() ? NULL : input.c_str());
+ this->emitAndInstallProc(fp, index, output->c_str(), input.isOnes() ? nullptr : input.c_str());
fFS.codeAppend("}");
}
@@ -390,7 +390,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
GrGLuint programID;
GL_CALL_RET(programID, CreateProgram());
if (0 == programID) {
- return NULL;
+ return nullptr;
}
// compile shaders and bind attributes / uniforms
@@ -398,7 +398,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) {
this->cleanupProgram(programID, shadersToDelete);
- return NULL;
+ return nullptr;
}
// NVPR actually requires a vertex shader to compile
@@ -409,7 +409,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
if (!fFS.compileAndAttachShaders(programID, &shadersToDelete)) {
this->cleanupProgram(programID, shadersToDelete);
- return NULL;
+ return nullptr;
}
this->bindProgramResourceLocations(programID);
@@ -432,7 +432,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
}
void GrGLProgramBuilder::bindProgramResourceLocations(GrGLuint programID) {
- bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != NULL;
+ bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != nullptr;
if (usingBindUniform) {
int count = fUniforms.count();
for (int i = 0; i < count; ++i) {
@@ -469,7 +469,7 @@ bool GrGLProgramBuilder::checkLinkStatus(GrGLuint programID) {
}
void GrGLProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) {
- bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != NULL;
+ bool usingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != nullptr;
if (!usingBindUniform) {
int count = fUniforms.count();
for (int i = 0; i < count; ++i) {
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 06d0fa0744..1d5e5fbcfe 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -49,14 +49,14 @@ public:
/** Add a uniform variable to the current program, that has visibility in one or more shaders.
visibility is a bitfield of ShaderVisibility values indicating from which shaders the
uniform should be accessible. At least one bit must be set. Geometry shader uniforms are not
- supported at this time. The actual uniform name will be mangled. If outName is not NULL then
+ supported at this time. The actual uniform name will be mangled. If outName is not nullptr then
it will refer to the final uniform name after return. Use the addUniformArray variant to add
an array of uniforms. */
UniformHandle addUniform(uint32_t visibility,
GrSLType type,
GrSLPrecision precision,
const char* name,
- const char** outName = NULL) {
+ const char** outName = nullptr) {
return this->addUniformArray(visibility, type, precision, name, 0, outName);
}
@@ -66,7 +66,7 @@ public:
GrSLPrecision precision,
const char* name,
int arrayCount,
- const char** outName = NULL) = 0;
+ const char** outName = nullptr) = 0;
virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const = 0;
@@ -105,8 +105,8 @@ protected:
};
GrGLVarying(GrSLType type, Varying varying)
- : fVarying(varying), fType(type), fVsOut(NULL), fGsIn(NULL), fGsOut(NULL),
- fFsIn(NULL) {}
+ : fVarying(varying), fType(type), fVsOut(nullptr), fGsIn(nullptr), fGsOut(nullptr),
+ fFsIn(nullptr) {}
Varying fVarying;
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.cpp b/src/gpu/gl/builders/GrGLShaderBuilder.cpp
index f0408afe21..84c3c6522c 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLShaderBuilder.cpp
@@ -58,7 +58,7 @@ GrGLShaderBuilder::GrGLShaderBuilder(GrGLProgramBuilder* program)
// We push back some dummy pointers which will later become our header
for (int i = 0; i <= kCode; i++) {
fShaderStrings.push_back();
- fCompilerStrings.push_back(NULL);
+ fCompilerStrings.push_back(nullptr);
fCompilerStringLengths.push_back(0);
}
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.h b/src/gpu/gl/builders/GrGLShaderBuilder.h
index 4a6d2e13d8..427c6590ac 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.h
+++ b/src/gpu/gl/builders/GrGLShaderBuilder.h
@@ -57,7 +57,7 @@ public:
/** Does the work of appendTextureLookup and modulates the result by modulation. The result is
always a vec4. modulation and the swizzle specified by TextureSampler must both be vec4 or
- float. If modulation is "" or NULL it this function acts as though appendTextureLookup were
+ float. If modulation is "" or nullptr it this function acts as though appendTextureLookup were
called. */
void appendTextureLookupAndModulate(const char* modulation,
const TextureSampler&,
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index 983de21021..0189932cac 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -15,7 +15,7 @@
GrGLVertexBuilder::GrGLVertexBuilder(GrGLProgramBuilder* program)
: INHERITED(program)
- , fRtAdjustName(NULL) {
+ , fRtAdjustName(nullptr) {
}
void GrGLVertexBuilder::addVarying(const char* name, GrGLVarying* v) {
diff --git a/src/gpu/gl/debug/GrBufferObj.h b/src/gpu/gl/debug/GrBufferObj.h
index 3c7a30b6d3..65b1caf820 100644
--- a/src/gpu/gl/debug/GrBufferObj.h
+++ b/src/gpu/gl/debug/GrBufferObj.h
@@ -19,7 +19,7 @@ class GrBufferObj : public GrFakeRefObj {
public:
GrBufferObj()
: GrFakeRefObj()
- , fDataPtr(NULL)
+ , fDataPtr(nullptr)
, fMapped(false)
, fBound(false)
, fSize(0)
diff --git a/src/gpu/gl/debug/GrDebugGL.cpp b/src/gpu/gl/debug/GrDebugGL.cpp
index ad06862bd7..2de349bc38 100644
--- a/src/gpu/gl/debug/GrDebugGL.cpp
+++ b/src/gpu/gl/debug/GrDebugGL.cpp
@@ -16,7 +16,7 @@
#include "GrTextureUnitObj.h"
#include "GrVertexArrayObj.h"
-GrDebugGL* GrDebugGL::gObj = NULL;
+GrDebugGL* GrDebugGL::gObj = nullptr;
int GrDebugGL::gStaticRefCount = 0;
GrDebugGL::Create GrDebugGL::gFactoryFunc[kObjTypeCount] = {
GrTextureObj::createGrTextureObj,
@@ -34,13 +34,13 @@ GrDebugGL::GrDebugGL()
: fPackRowLength(0)
, fUnPackRowLength(0)
, fCurTextureUnit(0)
- , fArrayBuffer(NULL)
- , fElementArrayBuffer(NULL)
- , fFrameBuffer(NULL)
- , fRenderBuffer(NULL)
- , fProgram(NULL)
- , fTexture(NULL)
- , fVertexArray(NULL)
+ , fArrayBuffer(nullptr)
+ , fElementArrayBuffer(nullptr)
+ , fFrameBuffer(nullptr)
+ , fRenderBuffer(nullptr)
+ , fProgram(nullptr)
+ , fTexture(nullptr)
+ , fVertexArray(nullptr)
, fAbandoned(false) {
for (int i = 0; i < kDefaultMaxTextureUnits; ++i) {
@@ -67,13 +67,13 @@ GrDebugGL::~GrDebugGL() {
}
fObjects.reset();
- fArrayBuffer = NULL;
- fElementArrayBuffer = NULL;
- fFrameBuffer = NULL;
- fRenderBuffer = NULL;
- fProgram = NULL;
- fTexture = NULL;
- fVertexArray = NULL;
+ fArrayBuffer = nullptr;
+ fElementArrayBuffer = nullptr;
+ fFrameBuffer = nullptr;
+ fRenderBuffer = nullptr;
+ fProgram = nullptr;
+ fTexture = nullptr;
+ fVertexArray = nullptr;
}
GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) {
@@ -87,7 +87,7 @@ GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) {
}
}
- return NULL;
+ return nullptr;
}
void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) {
diff --git a/src/gpu/gl/debug/GrDebugGL.h b/src/gpu/gl/debug/GrDebugGL.h
index ae6a978363..2560879b4f 100644
--- a/src/gpu/gl/debug/GrDebugGL.h
+++ b/src/gpu/gl/debug/GrDebugGL.h
@@ -92,7 +92,7 @@ public:
// someone should admit to actually using this class
SkASSERT(0 < gStaticRefCount);
- if (NULL == gObj) {
+ if (nullptr == gObj) {
gObj = new GrDebugGL;
}
@@ -110,7 +110,7 @@ public:
gStaticRefCount--;
if (0 == gStaticRefCount) {
delete gObj;
- gObj = NULL;
+ gObj = nullptr;
}
}
diff --git a/src/gpu/gl/debug/GrFrameBufferObj.h b/src/gpu/gl/debug/GrFrameBufferObj.h
index 794450c136..42a0effe07 100644
--- a/src/gpu/gl/debug/GrFrameBufferObj.h
+++ b/src/gpu/gl/debug/GrFrameBufferObj.h
@@ -22,15 +22,15 @@ public:
GrFrameBufferObj()
: GrFakeRefObj()
, fBound(false)
- , fColorBuffer(NULL)
- , fDepthBuffer(NULL)
- , fStencilBuffer(NULL) {
+ , fColorBuffer(nullptr)
+ , fDepthBuffer(nullptr)
+ , fStencilBuffer(nullptr) {
}
virtual ~GrFrameBufferObj() {
- fColorBuffer = NULL;
- fDepthBuffer = NULL;
- fStencilBuffer = NULL;
+ fColorBuffer = nullptr;
+ fDepthBuffer = nullptr;
+ fStencilBuffer = nullptr;
}
void setBound() { fBound = true; }
@@ -48,9 +48,9 @@ public:
void deleteAction() override {
- setColor(NULL);
- setDepth(NULL);
- setStencil(NULL);
+ setColor(nullptr);
+ setDepth(nullptr);
+ setStencil(nullptr);
this->INHERITED::deleteAction();
}
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index ef52fb6763..75b673688d 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -84,7 +84,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target,
GR_GL_STATIC_DRAW == usage ||
GR_GL_DYNAMIC_DRAW == usage);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -241,7 +241,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
if (textures[j] == pTU->getTexture()->getID()) {
// this ID is the current texture - revert the binding to 0
- pTU->setTexture(NULL);
+ pTU->setTexture(nullptr);
}
}
}
@@ -258,15 +258,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
if (frameBuffer->getColor() &&
textures[i] == frameBuffer->getColor()->getID()) {
- frameBuffer->setColor(NULL);
+ frameBuffer->setColor(nullptr);
}
if (frameBuffer->getDepth() &&
textures[i] == frameBuffer->getDepth()->getID()) {
- frameBuffer->setDepth(NULL);
+ frameBuffer->setDepth(nullptr);
}
if (frameBuffer->getStencil() &&
textures[i] == frameBuffer->getStencil()->getID()) {
- frameBuffer->setStencil(NULL);
+ frameBuffer->setStencil(nullptr);
}
}
}
@@ -298,7 +298,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
if (frameBuffers[i] ==
GrDebugGL::getInstance()->getFrameBuffer()->getID()) {
// this ID is the current frame buffer - rebind to the default
- GrDebugGL::getInstance()->setFrameBuffer(NULL);
+ GrDebugGL::getInstance()->setFrameBuffer(nullptr);
}
}
}
@@ -326,7 +326,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
GrDebugGL::getInstance()->getRenderBuffer()->getID()) {
// this ID is the current render buffer - make no
// render buffer be bound
- GrDebugGL::getInstance()->setRenderBuffer(NULL);
+ GrDebugGL::getInstance()->setRenderBuffer(nullptr);
}
}
}
@@ -343,15 +343,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x,
if (frameBuffer->getColor() &&
renderBuffers[i] == frameBuffer->getColor()->getID()) {
- frameBuffer->setColor(NULL);
+ frameBuffer->setColor(nullptr);
}
if (frameBuffer->getDepth() &&
renderBuffers[i] == frameBuffer->getDepth()->getID()) {
- frameBuffer->setDepth(NULL);
+ frameBuffer->setDepth(nullptr);
}
if (frameBuffer->getStencil() &&
renderBuffers[i] == frameBuffer->getStencil()->getID()) {
- frameBuffer->setStencil(NULL);
+ frameBuffer->setStencil(nullptr);
}
}
}
@@ -552,7 +552,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLui
// Deleting the current vertex array binds object 0
if (GrDebugGL::getInstance()->getVertexArray() == array) {
- GrDebugGL::getInstance()->setVertexArray(NULL);
+ GrDebugGL::getInstance()->setVertexArray(nullptr);
}
if (array->getRefCount()) {
@@ -599,13 +599,13 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* i
if (GrDebugGL::getInstance()->getArrayBuffer() &&
ids[i] == GrDebugGL::getInstance()->getArrayBuffer()->getID()) {
// this ID is the current array buffer
- GrDebugGL::getInstance()->setArrayBuffer(NULL);
+ GrDebugGL::getInstance()->setArrayBuffer(nullptr);
}
if (GrDebugGL::getInstance()->getElementArrayBuffer() &&
ids[i] ==
GrDebugGL::getInstance()->getElementArrayBuffer()->getID()) {
// this ID is the current element array buffer
- GrDebugGL::getInstance()->setElementArrayBuffer(NULL);
+ GrDebugGL::getInstance()->setElementArrayBuffer(nullptr);
}
}
@@ -631,7 +631,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
GrAlwaysAssert(!SkToBool(GR_GL_MAP_READ_BIT & access));
GrAlwaysAssert((GR_GL_MAP_INVALIDATE_BUFFER_BIT | GR_GL_MAP_INVALIDATE_RANGE_BIT) & access);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -652,13 +652,13 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
}
GrAlwaysAssert(false);
- return NULL; // no buffer bound to the target
+ return nullptr; // no buffer bound to the target
}
GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) {
GrAlwaysAssert(GR_GL_WRITE_ONLY == access);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -682,7 +682,7 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
GR_GL_ELEMENT_ARRAY_BUFFER == target);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -711,7 +711,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target,
GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
GR_GL_ELEMENT_ARRAY_BUFFER == target);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -742,7 +742,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
GrAlwaysAssert(GR_GL_BUFFER_SIZE == value ||
GR_GL_BUFFER_USAGE == value);
- GrBufferObj *buffer = NULL;
+ GrBufferObj *buffer = nullptr;
switch (target) {
case GR_GL_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getArrayBuffer();
@@ -784,7 +784,7 @@ public:
GrDebugGLInterface()
- : fWrapped(NULL) {
+ : fWrapped(nullptr) {
GrDebugGL::staticRef();
}
diff --git a/src/gpu/gl/debug/GrTextureUnitObj.h b/src/gpu/gl/debug/GrTextureUnitObj.h
index 7d9ed2e6df..b0254a0fc1 100644
--- a/src/gpu/gl/debug/GrTextureUnitObj.h
+++ b/src/gpu/gl/debug/GrTextureUnitObj.h
@@ -22,7 +22,7 @@ public:
GrTextureUnitObj()
: GrFakeRefObj()
, fNumber(0)
- , fTexture(NULL) {
+ , fTexture(nullptr) {
}
void setNumber(GrGLenum number) {
diff --git a/src/gpu/gl/debug/SkDebugGLContext.h b/src/gpu/gl/debug/SkDebugGLContext.h
index 0a61f72cb2..abbcf559c5 100644
--- a/src/gpu/gl/debug/SkDebugGLContext.h
+++ b/src/gpu/gl/debug/SkDebugGLContext.h
@@ -16,14 +16,14 @@ public:
static SkDebugGLContext* Create(GrGLStandard forcedGpuAPI) {
if (kGLES_GrGLStandard == forcedGpuAPI) {
- return NULL;
+ return nullptr;
}
return new SkDebugGLContext;
}
private:
void onPlatformMakeCurrent() const override {}
void onPlatformSwapBuffers() const override {}
- GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return NULL; }
+ GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; }
SkDebugGLContext();
};
diff --git a/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp b/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
index ddc9e693a4..703e39d097 100644
--- a/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
+++ b/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
@@ -13,10 +13,10 @@
#include <GLES2/gl2.h>
static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) {
- SkASSERT(NULL == ctx);
+ SkASSERT(nullptr == ctx);
return eglGetProcAddress(name);
}
const GrGLInterface* GrGLCreateNativeInterface() {
- return GrGLAssembleInterface(NULL, egl_get_gl_proc);
+ return GrGLAssembleInterface(nullptr, egl_get_gl_proc);
}
diff --git a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
index 9bdedf7ef0..d1335d355f 100644
--- a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
+++ b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
@@ -93,7 +93,7 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI)
SkAutoTUnref<const GrGLInterface> gl;
- for (; NULL == gl.get() && api < apiLimit; ++api) {
+ for (; nullptr == gl.get() && api < apiLimit; ++api) {
fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
EGLint majorVersion;
@@ -133,7 +133,7 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI)
continue;
}
- fContext = eglCreateContext(fDisplay, surfaceConfig, NULL, kAPIs[api].fContextAttribs);
+ fContext = eglCreateContext(fDisplay, surfaceConfig, nullptr, kAPIs[api].fContextAttribs);
if (EGL_NO_CONTEXT == fContext) {
SkDebugf("eglCreateContext failed. EGL Error: 0x%08x\n", eglGetError());
continue;
@@ -159,7 +159,7 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI)
}
gl.reset(GrGLCreateNativeInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Failed to create gl interface.\n");
this->destroyGLContext();
continue;
@@ -234,13 +234,13 @@ static bool supports_egl_extension(EGLDisplay display, const char* extension) {
SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) {
if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) {
- return NULL;
+ return nullptr;
}
return new SkEGLFenceSync(display);
}
SkPlatformGpuFence SkEGLFenceSync::insertFence() const {
- return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, NULL);
+ return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr);
}
bool SkEGLFenceSync::flushAndWaitFence(SkPlatformGpuFence platformFence) const {
@@ -262,7 +262,7 @@ SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp b/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
index 19eec7e8ac..e3d37bd80f 100644
--- a/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
+++ b/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
@@ -13,15 +13,15 @@
#include <GL/glx.h>
static GrGLFuncPtr glx_get(void* ctx, const char name[]) {
- SkASSERT(NULL == ctx);
+ SkASSERT(nullptr == ctx);
SkASSERT(glXGetCurrentContext());
return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
}
const GrGLInterface* GrGLCreateNativeInterface() {
- if (NULL == glXGetCurrentContext()) {
- return NULL;
+ if (nullptr == glXGetCurrentContext()) {
+ return nullptr;
}
- return GrGLAssembleInterface(NULL, glx_get);
+ return GrGLAssembleInterface(nullptr, glx_get);
}
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
index cabd4431eb..8c58a53702 100644
--- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
+++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
@@ -63,8 +63,8 @@ private:
};
GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
- : fContext(NULL)
- , fDisplay(NULL)
+ : fContext(nullptr)
+ , fDisplay(nullptr)
, fPixmap(0)
, fGlxPixmap(0) {
@@ -270,7 +270,7 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
}
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Failed to create gl interface");
this->destroyGLContext();
return;
@@ -297,7 +297,7 @@ void GLXGLContext::destroyGLContext() {
if (fContext) {
glXDestroyContext(fDisplay, fContext);
- fContext = NULL;
+ fContext = nullptr;
}
if (fGlxPixmap) {
@@ -311,7 +311,7 @@ void GLXGLContext::destroyGLContext() {
}
XCloseDisplay(fDisplay);
- fDisplay = NULL;
+ fDisplay = nullptr;
}
}
@@ -335,7 +335,7 @@ SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
index ccbc50f5ee..c85f05c07e 100644
--- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
+++ b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
@@ -25,7 +25,7 @@ public:
}
void* handle() const {
- return NULL == fLibrary ? RTLD_DEFAULT : fLibrary;
+ return nullptr == fLibrary ? RTLD_DEFAULT : fLibrary;
}
private:
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index a0c50c7409..9a2abfe066 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -27,7 +27,7 @@ public:
}
void* handle() const {
- return NULL == fLibrary ? RTLD_DEFAULT : fLibrary;
+ return nullptr == fLibrary ? RTLD_DEFAULT : fLibrary;
}
private:
diff --git a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
index 4754c01557..fa4126a62c 100644
--- a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
@@ -29,7 +29,7 @@ private:
};
MacGLContext::MacGLContext()
- : fContext(NULL)
+ : fContext(nullptr)
, fGLLibrary(RTLD_DEFAULT) {
CGLPixelFormatAttribute attributes[] = {
#if MAC_OS_X_VERSION_10_7
@@ -43,15 +43,15 @@ MacGLContext::MacGLContext()
CGLChoosePixelFormat(attributes, &pixFormat, &npix);
- if (NULL == pixFormat) {
+ if (nullptr == pixFormat) {
SkDebugf("CGLChoosePixelFormat failed.");
return;
}
- CGLCreateContext(pixFormat, NULL, &fContext);
+ CGLCreateContext(pixFormat, nullptr, &fContext);
CGLReleasePixelFormat(pixFormat);
- if (NULL == fContext) {
+ if (nullptr == fContext) {
SkDebugf("CGLCreateContext failed.");
return;
}
@@ -59,7 +59,7 @@ MacGLContext::MacGLContext()
CGLSetCurrentContext(fContext);
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Context could not create GL interface.\n");
this->destroyGLContext();
return;
@@ -85,7 +85,7 @@ MacGLContext::~MacGLContext() {
void MacGLContext::destroyGLContext() {
if (fContext) {
CGLReleaseContext(fContext);
- fContext = NULL;
+ fContext = nullptr;
}
if (RTLD_DEFAULT != fGLLibrary) {
dlclose(fGLLibrary);
@@ -108,12 +108,12 @@ GrGLFuncPtr MacGLContext::onPlatformGetProcAddress(const char* procName) const {
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
if (kGLES_GrGLStandard == forcedGpuAPI) {
- return NULL;
+ return nullptr;
}
MacGLContext* ctx = new MacGLContext;
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
index ab48718f6d..734c1fea0c 100644
--- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
+++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
@@ -12,14 +12,14 @@
#include "osmesa_wrapper.h"
static GrGLFuncPtr osmesa_get(void* ctx, const char name[]) {
- SkASSERT(NULL == ctx);
+ SkASSERT(nullptr == ctx);
SkASSERT(OSMesaGetCurrentContext());
return OSMesaGetProcAddress(name);
}
const GrGLInterface* GrGLCreateMesaInterface() {
- if (NULL == OSMesaGetCurrentContext()) {
- return NULL;
+ if (nullptr == OSMesaGetCurrentContext()) {
+ return nullptr;
}
- return GrGLAssembleInterface(NULL, osmesa_get);
+ return GrGLAssembleInterface(nullptr, osmesa_get);
}
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp
index 701cc0d320..730206e560 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.cpp
+++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp
@@ -14,16 +14,16 @@
static const GrGLint gBOGUS_SIZE = 16;
SkMesaGLContext::SkMesaGLContext()
- : fContext(static_cast<Context>(NULL))
- , fImage(NULL) {
+ : fContext(static_cast<Context>(nullptr))
+ , fImage(nullptr) {
GR_STATIC_ASSERT(sizeof(Context) == sizeof(OSMesaContext));
/* Create an RGBA-mode context */
#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
/* specify Z, stencil, accum sizes */
- fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL);
+ fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, nullptr);
#else
- fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL);
+ fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, nullptr);
#endif
if (!fContext) {
SkDebugf("OSMesaCreateContext failed!\n");
@@ -51,7 +51,7 @@ SkMesaGLContext::SkMesaGLContext()
}
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateMesaInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Could not create GL interface!\n");
this->destroyGLContext();
return;
@@ -74,12 +74,12 @@ SkMesaGLContext::~SkMesaGLContext() {
void SkMesaGLContext::destroyGLContext() {
if (fImage) {
sk_free(fImage);
- fImage = NULL;
+ fImage = nullptr;
}
if (fContext) {
OSMesaDestroyContext((OSMesaContext)fContext);
- fContext = static_cast<Context>(NULL);
+ fContext = static_cast<Context>(nullptr);
}
}
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.h b/src/gpu/gl/mesa/SkMesaGLContext.h
index 1548bfd8ee..a58f1c890e 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.h
+++ b/src/gpu/gl/mesa/SkMesaGLContext.h
@@ -21,12 +21,12 @@ public:
static SkMesaGLContext* Create(GrGLStandard forcedGpuAPI) {
if (kGLES_GrGLStandard == forcedGpuAPI) {
- return NULL;
+ return nullptr;
}
SkMesaGLContext* ctx = new SkMesaGLContext;
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp b/src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp
index 5cb4423897..21f30019a9 100644
--- a/src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp
+++ b/src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp
@@ -8,7 +8,7 @@
#include "gl/SkGLContext.h"
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index cba380b74d..c2fcca5469 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -42,7 +42,7 @@ public:
if ((proc = (GrGLFuncPtr) wglGetProcAddress(name))) {
return proc;
}
- return NULL;
+ return nullptr;
}
private:
@@ -62,18 +62,18 @@ static GrGLFuncPtr win_get_gl_proc(void* ctx, const char name[]) {
* Otherwise, a springboard would be needed that hides the calling convention.
*/
const GrGLInterface* GrGLCreateNativeInterface() {
- if (NULL == wglGetCurrentContext()) {
- return NULL;
+ if (nullptr == wglGetCurrentContext()) {
+ return nullptr;
}
GLProcGetter getter;
if (!getter.isInitialized()) {
- return NULL;
+ return nullptr;
}
GrGLGetStringProc getString = (GrGLGetStringProc)getter.getProc("glGetString");
- if (NULL == getString) {
- return NULL;
+ if (nullptr == getString) {
+ return nullptr;
}
const char* verStr = reinterpret_cast<const char*>(getString(GR_GL_VERSION));
GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);
@@ -83,5 +83,5 @@ const GrGLInterface* GrGLCreateNativeInterface() {
} else if (kGL_GrGLStandard == standard) {
return GrGLAssembleGLInterface(&getter, win_get_gl_proc);
}
- return NULL;
+ return nullptr;
}
diff --git a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
index 0517f73ee4..f795f52554 100644
--- a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
+++ b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
@@ -39,23 +39,23 @@ private:
ATOM WinGLContext::gWC = 0;
WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI)
- : fWindow(NULL)
- , fDeviceContext(NULL)
+ : fWindow(nullptr)
+ , fDeviceContext(nullptr)
, fGlRenderContext(0)
- , fPbufferContext(NULL) {
- HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
+ , fPbufferContext(nullptr) {
+ HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(nullptr);
if (!gWC) {
WNDCLASS wc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hbrBackground = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hbrBackground = nullptr;
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
wc.hInstance = hInstance;
wc.lpfnWndProc = (WNDPROC) DefWindowProc;
wc.lpszClassName = TEXT("Griffin");
- wc.lpszMenuName = NULL;
+ wc.lpszMenuName = nullptr;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
gWC = RegisterClass(&wc);
@@ -69,8 +69,8 @@ WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI)
TEXT("The Invisible Man"),
WS_OVERLAPPEDWINDOW,
0, 0, 1, 1,
- NULL, NULL,
- hInstance, NULL))) {
+ nullptr, nullptr,
+ hInstance, nullptr))) {
SkDebugf("Could not create window.\n");
return;
}
@@ -91,7 +91,7 @@ WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI)
HDC dc;
HGLRC glrc;
- if (NULL == fPbufferContext) {
+ if (nullptr == fPbufferContext) {
if (!(fGlRenderContext = SkCreateWGLContext(fDeviceContext, 0, contextType))) {
SkDebugf("Could not create rendering context.\n");
this->destroyGLContext();
@@ -116,7 +116,7 @@ WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI)
}
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
- if (NULL == gl.get()) {
+ if (nullptr == gl.get()) {
SkDebugf("Could not create GL interface.\n");
this->destroyGLContext();
return;
@@ -155,7 +155,7 @@ void WinGLContext::onPlatformMakeCurrent() const {
HDC dc;
HGLRC glrc;
- if (NULL == fPbufferContext) {
+ if (nullptr == fPbufferContext) {
dc = fDeviceContext;
glrc = fGlRenderContext;
} else {
@@ -171,7 +171,7 @@ void WinGLContext::onPlatformMakeCurrent() const {
void WinGLContext::onPlatformSwapBuffers() const {
HDC dc;
- if (NULL == fPbufferContext) {
+ if (nullptr == fPbufferContext) {
dc = fDeviceContext;
} else {
dc = fPbufferContext->getDC();
@@ -191,7 +191,7 @@ SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
WinGLContext* ctx = new WinGLContext(forcedGpuAPI);
if (!ctx->isValid()) {
delete ctx;
- return NULL;
+ return nullptr;
}
return ctx;
}
diff --git a/src/gpu/glsl/GrGLSL.h b/src/gpu/glsl/GrGLSL.h
index efe31fe2dd..87b3d2daa4 100644
--- a/src/gpu/glsl/GrGLSL.h
+++ b/src/gpu/glsl/GrGLSL.h
@@ -135,7 +135,7 @@ protected:
* Argument expr is a simple expression or a parenthesized expression. */
// TODO: make explicit once effects input Exprs.
GrGLSLExpr(const char expr[]) {
- if (NULL == expr) { // TODO: remove this once effects input Exprs.
+ if (nullptr == expr) { // TODO: remove this once effects input Exprs.
fType = kOnes_ExprType;
} else {
fType = kFullExpr_ExprType;
diff --git a/src/gpu/glsl/GrGLSLCaps.cpp b/src/gpu/glsl/GrGLSLCaps.cpp
index e8624998cb..38105ef1ce 100755
--- a/src/gpu/glsl/GrGLSLCaps.cpp
+++ b/src/gpu/glsl/GrGLSLCaps.cpp
@@ -17,8 +17,8 @@ GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) {
fFBFetchSupport = false;
fFBFetchNeedsCustomOutput = false;
fBindlessTextureSupport = false;
- fFBFetchColorName = NULL;
- fFBFetchExtensionString = NULL;
+ fFBFetchColorName = nullptr;
+ fFBFetchExtensionString = nullptr;
fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
}
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 3cefec267a..05b6d45c04 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -35,10 +35,10 @@ SkImage::SkImage(int width, int height, uint32_t uniqueID)
const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const {
SkImageInfo infoStorage;
size_t rowBytesStorage;
- if (NULL == info) {
+ if (nullptr == info) {
info = &infoStorage;
}
- if (NULL == rowBytes) {
+ if (nullptr == rowBytes) {
rowBytes = &rowBytesStorage;
}
return as_IB(this)->onPeekPixels(info, rowBytes);
@@ -64,7 +64,7 @@ SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
if (as_IB(this)->getROPixels(&bm)) {
return SkImageEncoder::EncodeData(bm, type, quality);
}
- return NULL;
+ return nullptr;
}
SkData* SkImage::refEncoded() const {
@@ -72,15 +72,15 @@ SkData* SkImage::refEncoded() const {
}
SkImage* SkImage::NewFromEncoded(SkData* encoded, const SkIRect* subset) {
- if (NULL == encoded || 0 == encoded->size()) {
- return NULL;
+ if (nullptr == encoded || 0 == encoded->size()) {
+ return nullptr;
}
SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded);
- return generator ? SkImage::NewFromGenerator(generator, subset) : NULL;
+ return generator ? SkImage::NewFromGenerator(generator, subset) : nullptr;
}
SkSurface* SkImage::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) const {
- if (NULL == props) {
+ if (nullptr == props) {
props = &as_IB(this)->props();
}
return as_IB(this)->onNewSurface(info, *props);
@@ -95,21 +95,21 @@ const char* SkImage::toString(SkString* str) const {
SkImage* SkImage::newImage(int newWidth, int newHeight, const SkIRect* subset,
SkFilterQuality quality) const {
if (newWidth <= 0 || newHeight <= 0) {
- return NULL;
+ return nullptr;
}
const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
if (subset) {
if (!bounds.contains(*subset)) {
- return NULL;
+ return nullptr;
}
if (bounds == *subset) {
- subset = NULL; // and fall through to check below
+ subset = nullptr; // and fall through to check below
}
}
- if (NULL == subset && this->width() == newWidth && this->height() == newHeight) {
+ if (nullptr == subset && this->width() == newWidth && this->height() == newHeight) {
return SkRef(const_cast<SkImage*>(this));
}
@@ -140,7 +140,7 @@ GrBackendObject SkImage::getTextureHandle(bool flushPendingGrContextIO) const {
#else
-GrTexture* SkImage::getTexture() const { return NULL; }
+GrTexture* SkImage::getTexture() const { return nullptr; }
bool SkImage::isTextureBacked() const { return false; }
@@ -186,9 +186,9 @@ SkImage* SkImage_Base::onNewImage(int newWidth, int newHeight, const SkIRect* su
const bool opaque = this->isOpaque();
const SkImageInfo info = SkImageInfo::Make(newWidth, newHeight, kN32_SkColorType,
opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
- SkAutoTUnref<SkSurface> surface(this->newSurface(info, NULL));
+ SkAutoTUnref<SkSurface> surface(this->newSurface(info, nullptr));
if (!surface.get()) {
- return NULL;
+ return nullptr;
}
SkRect src;
@@ -231,8 +231,8 @@ bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY) const {
SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) {
SkPixelRef* pr = bm.pixelRef();
- if (NULL == pr) {
- return NULL;
+ if (nullptr == pr) {
+ return nullptr;
}
#if SK_SUPPORT_GPU
@@ -241,8 +241,8 @@ SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) {
if (!bm.isImmutable()) {
const bool notBudgeted = false;
tex = GrDeepCopyTexture(tex, notBudgeted);
- if (NULL == tex) {
- return NULL;
+ if (nullptr == tex) {
+ return nullptr;
}
unrefCopy.reset(tex);
}
@@ -297,15 +297,15 @@ bool SkImage::isLazyGenerated() const {
SkImage* SkImage::NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType,
TextureReleaseProc, ReleaseContext) {
- return NULL;
+ return nullptr;
}
SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
- return NULL;
+ return nullptr;
}
SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
- return NULL;
+ return nullptr;
}
#endif
diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h
index bc4a7b04ad..4b92e946e3 100644
--- a/src/image/SkImagePriv.h
+++ b/src/image/SkImagePriv.h
@@ -33,7 +33,7 @@ extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
*
* If the bitmap's colortype cannot be converted into a corresponding
* SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
- * NULL.
+ * nullptr.
*/
enum ForceCopyMode {
kNo_ForceCopyMode,
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 46cd3de3db..2e3fb9a34a 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -45,14 +45,14 @@ public:
virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const = 0;
virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const {
- return NULL;
+ return nullptr;
}
// Default impl calls onDraw
virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY) const;
- virtual GrTexture* getTexture() const { return NULL; }
+ virtual GrTexture* getTexture() const { return nullptr; }
// return a read-only copy of the pixels. We promise to not modify them,
// but only inspect them (or encode them).
@@ -60,12 +60,12 @@ public:
virtual SkShader* onNewShader(SkShader::TileMode,
SkShader::TileMode,
- const SkMatrix* localMatrix) const { return NULL; }
+ const SkMatrix* localMatrix) const { return nullptr; }
- // newWidth > 0, newHeight > 0, subset either NULL or a proper subset of this bounds
+ // newWidth > 0, newHeight > 0, subset either nullptr or a proper subset of this bounds
virtual SkImage* onNewImage(int newWidth, int newHeight, const SkIRect* subset,
SkFilterQuality) const;
- virtual SkData* onRefEncoded() const { return NULL; }
+ virtual SkData* onRefEncoded() const { return nullptr; }
virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d758795d43..6655e39c17 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -16,7 +16,7 @@
SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
int sampleCountForNewSurfaces, SkSurface::Budgeted budgeted)
- : INHERITED(w, h, uniqueID, NULL)
+ : INHERITED(w, h, uniqueID, nullptr)
, fTexture(SkRef(tex))
, fSampleCountForNewSurfaces(sampleCountForNewSurfaces)
, fAlphaType(at)
@@ -36,7 +36,7 @@ SkSurface* SkImage_Gpu::onNewSurface(const SkImageInfo& info, const SkSurfacePro
GrContext* ctx = tex->getContext();
if (!ctx) {
// the texture may have been abandoned, so we have to check
- return NULL;
+ return nullptr;
}
// TODO: Change signature of onNewSurface to take a budgeted param.
const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted;
@@ -138,11 +138,11 @@ static SkImage* new_wrapped_texture_common(GrContext* ctx, const GrBackendTextur
SkImage::TextureReleaseProc releaseProc,
SkImage::ReleaseContext releaseCtx) {
if (desc.fWidth <= 0 || desc.fHeight <= 0) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<GrTexture> tex(ctx->textureProvider()->wrapBackendTexture(desc, ownership));
if (!tex) {
- return NULL;
+ return nullptr;
}
if (releaseProc) {
tex->setRelease(releaseProc, releaseCtx);
@@ -159,25 +159,25 @@ SkImage* SkImage::NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& des
SkImage* SkImage::NewFromAdoptedTexture(GrContext* ctx, const GrBackendTextureDesc& desc,
SkAlphaType at) {
- return new_wrapped_texture_common(ctx, desc, at, kAdopt_GrWrapOwnership, NULL, NULL);
+ return new_wrapped_texture_common(ctx, desc, at, kAdopt_GrWrapOwnership, nullptr, nullptr);
}
SkImage* SkImage::NewFromTextureCopy(GrContext* ctx, const GrBackendTextureDesc& desc,
SkAlphaType at) {
if (desc.fWidth <= 0 || desc.fHeight <= 0) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<GrTexture> src(ctx->textureProvider()->wrapBackendTexture(
desc, kBorrow_GrWrapOwnership));
if (!src) {
- return NULL;
+ return nullptr;
}
const bool isBudgeted = true;
SkAutoTUnref<GrTexture> dst(GrDeepCopyTexture(src, isBudgeted));
if (!dst) {
- return NULL;
+ return nullptr;
}
const SkSurface::Budgeted budgeted = SkSurface::kYes_Budgeted;
@@ -195,7 +195,7 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
if (yuvSizes[0].fWidth <= 0 || yuvSizes[0].fHeight <= 0 ||
yuvSizes[1].fWidth <= 0 || yuvSizes[1].fHeight <= 0 ||
yuvSizes[2].fWidth <= 0 || yuvSizes[2].fHeight <= 0) {
- return NULL;
+ return nullptr;
}
static const GrPixelConfig kConfig = kAlpha_8_GrPixelConfig;
GrBackendTextureDesc yDesc;
@@ -229,7 +229,7 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
SkAutoTUnref<GrTexture> vTex(ctx->textureProvider()->wrapBackendTexture(
vDesc, kBorrow_GrWrapOwnership));
if (!yTex || !uTex || !vTex) {
- return NULL;
+ return nullptr;
}
GrSurfaceDesc dstDesc;
@@ -243,7 +243,7 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, true));
if (!dst) {
- return NULL;
+ return nullptr;
}
GrPaint paint;
@@ -267,9 +267,9 @@ GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
GrContext* ctx = src->getContext();
GrSurfaceDesc desc = src->desc();
- GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, NULL, 0);
+ GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullptr, 0);
if (!dst) {
- return NULL;
+ return nullptr;
}
const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 3486114d58..015f98a646 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -39,7 +39,7 @@ public:
}
const bool needsCT = kIndex_8_SkColorType == info.colorType();
- const bool hasCT = NULL != ctable;
+ const bool hasCT = nullptr != ctable;
if (needsCT != hasCT) {
return false;
}
@@ -98,7 +98,7 @@ public:
}
private:
- SkImage_Raster() : INHERITED(0, 0, kNeedNewImageUniqueID, NULL) {
+ SkImage_Raster() : INHERITED(0, 0, kNeedNewImageUniqueID, nullptr) {
fBitmap.setImmutable();
}
@@ -156,7 +156,7 @@ bool SkImage_Raster::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s
const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, size_t* rowBytesPtr) const {
const SkImageInfo info = fBitmap.info();
if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels()) {
- return NULL;
+ return nullptr;
}
*infoPtr = info;
*rowBytesPtr = fBitmap.rowBytes();
@@ -172,7 +172,7 @@ SkData* SkImage_Raster::onRefEncoded() const {
if (prInfo.width() == bmInfo.width() && prInfo.height() == bmInfo.height()) {
return pr->refEncodedData();
}
- return NULL;
+ return nullptr;
}
bool SkImage_Raster::getROPixels(SkBitmap* dst) const {
@@ -186,72 +186,72 @@ SkImage* SkImage::NewRasterCopy(const SkImageInfo& info, const void* pixels, siz
SkColorTable* ctable) {
size_t size;
if (!SkImage_Raster::ValidArgs(info, rowBytes, ctable, &size) || !pixels) {
- return NULL;
+ return nullptr;
}
// Here we actually make a copy of the caller's pixel data
SkAutoDataUnref data(SkData::NewWithCopy(pixels, size));
- return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
+ return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
}
SkImage* SkImage::NewRasterData(const SkImageInfo& info, SkData* data, size_t rowBytes) {
size_t size;
- if (!SkImage_Raster::ValidArgs(info, rowBytes, NULL, &size) || !data) {
- return NULL;
+ if (!SkImage_Raster::ValidArgs(info, rowBytes, nullptr, &size) || !data) {
+ return nullptr;
}
// did they give us enough data?
if (data->size() < size) {
- return NULL;
+ return nullptr;
}
- SkColorTable* ctable = NULL;
- return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
+ SkColorTable* ctable = nullptr;
+ return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
}
SkImage* SkImage::NewFromRaster(const SkImageInfo& info, const void* pixels, size_t rowBytes,
RasterReleaseProc proc, ReleaseContext ctx) {
size_t size;
- if (!SkImage_Raster::ValidArgs(info, rowBytes, NULL, &size) || !pixels) {
- return NULL;
+ if (!SkImage_Raster::ValidArgs(info, rowBytes, nullptr, &size) || !pixels) {
+ return nullptr;
}
- SkColorTable* ctable = NULL;
+ SkColorTable* ctable = nullptr;
SkAutoDataUnref data(SkData::NewWithProc(pixels, size, proc, ctx));
- return new SkImage_Raster(info, data, rowBytes, ctable, NULL);
+ return new SkImage_Raster(info, data, rowBytes, ctable, nullptr);
}
SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* subset) {
SkBitmap bitmap;
- if (!SkInstallDiscardablePixelRef(generator, subset, &bitmap, NULL)) {
- return NULL;
+ if (!SkInstallDiscardablePixelRef(generator, subset, &bitmap, nullptr)) {
+ return nullptr;
}
if (0 == bitmap.width() || 0 == bitmap.height()) {
- return NULL;
+ return nullptr;
}
- return new SkImage_Raster(bitmap, NULL);
+ return new SkImage_Raster(bitmap, nullptr);
}
SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
const SkIPoint& pixelRefOrigin, size_t rowBytes,
const SkSurfaceProps* props) {
- if (!SkImage_Raster::ValidArgs(info, rowBytes, NULL, NULL)) {
- return NULL;
+ if (!SkImage_Raster::ValidArgs(info, rowBytes, nullptr, nullptr)) {
+ return nullptr;
}
return new SkImage_Raster(info, pr, pixelRefOrigin, rowBytes, props);
}
SkImage* SkNewImageFromRasterBitmap(const SkBitmap& bm, const SkSurfaceProps* props,
ForceCopyMode forceCopy) {
- SkASSERT(NULL == bm.getTexture());
+ SkASSERT(nullptr == bm.getTexture());
- if (!SkImage_Raster::ValidArgs(bm.info(), bm.rowBytes(), NULL, NULL)) {
- return NULL;
+ if (!SkImage_Raster::ValidArgs(bm.info(), bm.rowBytes(), nullptr, nullptr)) {
+ return nullptr;
}
- SkImage* image = NULL;
+ SkImage* image = nullptr;
if (kYes_ForceCopyMode == forceCopy || !bm.isImmutable()) {
SkBitmap tmp(bm);
tmp.lockPixels();
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 8c356a8080..0315f6cc84 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -57,21 +57,21 @@ SkSurfaceProps::SkSurfaceProps(const SkSurfaceProps& other)
SkSurface_Base::SkSurface_Base(int width, int height, const SkSurfaceProps* props)
: INHERITED(width, height, props)
{
- fCachedCanvas = NULL;
- fCachedImage = NULL;
+ fCachedCanvas = nullptr;
+ fCachedImage = nullptr;
}
SkSurface_Base::SkSurface_Base(const SkImageInfo& info, const SkSurfaceProps* props)
: INHERITED(info, props)
{
- fCachedCanvas = NULL;
- fCachedImage = NULL;
+ fCachedCanvas = nullptr;
+ fCachedImage = nullptr;
}
SkSurface_Base::~SkSurface_Base() {
// in case the canvas outsurvives us, we null the callback
if (fCachedCanvas) {
- fCachedCanvas->setSurfaceBase(NULL);
+ fCachedCanvas->setSurfaceBase(nullptr);
}
SkSafeUnref(fCachedImage);
@@ -107,7 +107,7 @@ void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
// regardless of copy-on-write, we must drop our cached image now, so
// that the next request will get our new contents.
fCachedImage->unref();
- fCachedImage = NULL;
+ fCachedImage = nullptr;
if (unique) {
// Our content isn't held by any image now, so we can consider that content mutable.
@@ -200,22 +200,22 @@ bool SkSurface::getRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess
#if !SK_SUPPORT_GPU
SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*) {
- return NULL;
+ return nullptr;
}
SkSurface* SkSurface::NewRenderTarget(GrContext*, Budgeted, const SkImageInfo&, int,
const SkSurfaceProps*) {
- return NULL;
+ return nullptr;
}
SkSurface* SkSurface::NewFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
const SkSurfaceProps*) {
- return NULL;
+ return nullptr;
}
SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext*, const GrBackendRenderTargetDesc&,
const SkSurfaceProps*) {
- return NULL;
+ return nullptr;
}
#endif
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 8f0eef3b60..7658409ad7 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -77,7 +77,7 @@ public:
inline SkCanvas* getCachedCanvas();
inline SkImage* getCachedImage(Budgeted);
- bool hasCachedImage() const { return fCachedImage != NULL; }
+ bool hasCachedImage() const { return fCachedImage != nullptr; }
// called by SkSurface to compute a new genID
uint32_t newGenerationID();
@@ -99,7 +99,7 @@ private:
};
SkCanvas* SkSurface_Base::getCachedCanvas() {
- if (NULL == fCachedCanvas) {
+ if (nullptr == fCachedCanvas) {
fCachedCanvas = this->onNewCanvas();
if (fCachedCanvas) {
fCachedCanvas->setSurfaceBase(this);
@@ -109,7 +109,7 @@ SkCanvas* SkSurface_Base::getCachedCanvas() {
}
SkImage* SkSurface_Base::getCachedImage(Budgeted budgeted) {
- if (NULL == fCachedImage) {
+ if (nullptr == fCachedImage) {
fCachedImage = this->onNewImageSnapshot(budgeted);
SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 34671f72fc..c0c6b6eed0 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -81,7 +81,7 @@ SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) {
const SkImageInfo info = fDevice->imageInfo();
const int sampleCount = fDevice->accessRenderTarget()->numColorSamples();
- SkImage* image = NULL;
+ SkImage* image = nullptr;
GrTexture* tex = fDevice->accessRenderTarget()->asTexture();
if (tex) {
image = new SkImage_Gpu(info.width(), info.height(), kNeedNewImageUniqueID,
@@ -120,7 +120,7 @@ SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf
SkAutoTUnref<SkGpuDevice> device(
SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents));
if (!device) {
- return NULL;
+ return nullptr;
}
return new SkSurface_Gpu(device);
}
@@ -130,28 +130,28 @@ SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sampleCount, props,
SkGpuDevice::kClear_InitContents));
if (!device) {
- return NULL;
+ return nullptr;
}
return new SkSurface_Gpu(device);
}
SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendTextureDesc& desc,
const SkSurfaceProps* props) {
- if (NULL == context) {
- return NULL;
+ if (nullptr == context) {
+ return nullptr;
}
if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTexture(desc,
kBorrow_GrWrapOwnership));
if (!surface) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget(), props,
SkGpuDevice::kUninit_InitContents));
if (!device) {
- return NULL;
+ return nullptr;
}
return new SkSurface_Gpu(device);
}
@@ -159,17 +159,17 @@ SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendT
SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context,
const GrBackendRenderTargetDesc& desc,
const SkSurfaceProps* props) {
- if (NULL == context) {
- return NULL;
+ if (nullptr == context) {
+ return nullptr;
}
SkAutoTUnref<GrRenderTarget> rt(context->textureProvider()->wrapBackendRenderTarget(desc));
if (!rt) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props,
SkGpuDevice::kUninit_InitContents));
if (!device) {
- return NULL;
+ return nullptr;
}
return new SkSurface_Gpu(device);
}
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 3c88f7a4c8..7ee09c1eed 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -87,7 +87,7 @@ SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t
const SkSurfaceProps* props)
: INHERITED(info, props)
{
- fBitmap.installPixels(info, pixels, rb, NULL, releaseProc, context);
+ fBitmap.installPixels(info, pixels, rb, nullptr, releaseProc, context);
fWeOwnThePixels = false; // We are "Direct"
}
@@ -143,7 +143,7 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
if (SkBitmapImageGetPixelRef(this->getCachedImage(kNo_Budgeted)) == fBitmap.pixelRef()) {
SkASSERT(fWeOwnThePixels);
if (kDiscard_ContentChangeMode == mode) {
- fBitmap.setPixelRef(NULL);
+ fBitmap.setPixelRef(nullptr);
fBitmap.allocPixels();
} else {
SkBitmap prev(fBitmap);
@@ -162,14 +162,14 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
SkSurface* SkSurface::NewRasterDirectReleaseProc(const SkImageInfo& info, void* pixels, size_t rb,
void (*releaseProc)(void* pixels, void* context),
void* context, const SkSurfaceProps* props) {
- if (NULL == releaseProc) {
- context = NULL;
+ if (nullptr == releaseProc) {
+ context = nullptr;
}
if (!SkSurface_Raster::Valid(info, rb)) {
- return NULL;
+ return nullptr;
}
- if (NULL == pixels) {
- return NULL;
+ if (nullptr == pixels) {
+ return nullptr;
}
return new SkSurface_Raster(info, pixels, rb, releaseProc, context, props);
@@ -177,17 +177,17 @@ SkSurface* SkSurface::NewRasterDirectReleaseProc(const SkImageInfo& info, void*
SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
const SkSurfaceProps* props) {
- return NewRasterDirectReleaseProc(info, pixels, rowBytes, NULL, NULL, props);
+ return NewRasterDirectReleaseProc(info, pixels, rowBytes, nullptr, nullptr, props);
}
SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* props) {
if (!SkSurface_Raster::Valid(info)) {
- return NULL;
+ return nullptr;
}
- SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL));
- if (NULL == pr.get()) {
- return NULL;
+ SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
+ if (nullptr == pr.get()) {
+ return nullptr;
}
return new SkSurface_Raster(pr, props);
}
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index 5d71ab88b5..8cfacc3fba 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -61,20 +61,20 @@ public:
, fRowBytes(rowBytes)
{}
- bool isReady() { return (fTarget != NULL); }
+ bool isReady() { return (fTarget != nullptr); }
virtual bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) {
- if (NULL == fTarget || !equal_modulo_alpha(fInfo, bm->info())) {
+ if (nullptr == fTarget || !equal_modulo_alpha(fInfo, bm->info())) {
// Call default allocator.
- return bm->tryAllocPixels(NULL, ct);
+ return bm->tryAllocPixels(nullptr, ct);
}
// TODO(halcanary): verify that all callers of this function
// will respect new RowBytes. Will be moot once rowbytes belongs
// to PixelRef.
- bm->installPixels(fInfo, fTarget, fRowBytes, ct, NULL, NULL);
+ bm->installPixels(fInfo, fTarget, fRowBytes, ct, nullptr, nullptr);
- fTarget = NULL; // never alloc same pixels twice!
+ fTarget = nullptr; // never alloc same pixels twice!
return true;
}
@@ -118,8 +118,8 @@ DecodingImageGenerator::DecodingImageGenerator(
, fSampleSize(sampleSize)
, fDitherImage(ditherImage)
{
- SkASSERT(stream != NULL);
- SkSafeRef(fData); // may be NULL.
+ SkASSERT(stream != nullptr);
+ SkSafeRef(fData); // may be nullptr.
}
DecodingImageGenerator::~DecodingImageGenerator() {
@@ -129,11 +129,11 @@ DecodingImageGenerator::~DecodingImageGenerator() {
SkData* DecodingImageGenerator::onRefEncodedData() {
// This functionality is used in `gm --serialize`
// Does not encode options.
- if (NULL == fData) {
+ if (nullptr == fData) {
// TODO(halcanary): SkStreamRewindable needs a refData() function
// which returns a cheap copy of the underlying data.
if (!fStream->rewind()) {
- return NULL;
+ return nullptr;
}
size_t length = fStream->getLength();
if (length) {
@@ -154,7 +154,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
SkAssertResult(fStream->rewind());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
return false;
}
decoder->setDitherImage(fDitherImage);
@@ -166,7 +166,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
decoder->setAllocator(&allocator);
const SkImageDecoder::Result decodeResult = decoder->decode(fStream, &bitmap, info.colorType(),
SkImageDecoder::kDecodePixels_Mode);
- decoder->setAllocator(NULL);
+ decoder->setAllocator(nullptr);
if (SkImageDecoder::kFailure == decodeResult) {
return false;
}
@@ -190,7 +190,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
return false;
}
SkColorTable* ctable = bitmap.getColorTable();
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
const int count = ctable->count();
@@ -207,14 +207,14 @@ bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
}
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
return false;
}
return decoder->decodeYUV8Planes(fStream, sizes, planes, rowBytes, colorSpace);
}
-// A contructor-type function that returns NULL on failure. This
+// A contructor-type function that returns nullptr on failure. This
// prevents the returned SkImageGenerator from ever being in a bad
// state. Called by both Create() functions
SkImageGenerator* CreateDecodingImageGenerator(
@@ -225,17 +225,17 @@ SkImageGenerator* CreateDecodingImageGenerator(
SkAutoTDelete<SkStreamRewindable> autoStream(stream); // always delete this
SkAssertResult(autoStream->rewind());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(autoStream));
- if (NULL == decoder.get()) {
- return NULL;
+ if (nullptr == decoder.get()) {
+ return nullptr;
}
SkBitmap bitmap;
decoder->setSampleSize(opts.fSampleSize);
decoder->setRequireUnpremultipliedColors(opts.fRequireUnpremul);
if (!decoder->decode(stream, &bitmap, SkImageDecoder::kDecodeBounds_Mode)) {
- return NULL;
+ return nullptr;
}
if (kUnknown_SkColorType == bitmap.colorType()) {
- return NULL;
+ return nullptr;
}
SkImageInfo info = bitmap.info();
@@ -243,7 +243,7 @@ SkImageGenerator* CreateDecodingImageGenerator(
if (opts.fUseRequestedColorType && (opts.fRequestedColorType != info.colorType())) {
if (!bitmap.canCopyTo(opts.fRequestedColorType)) {
SkASSERT(bitmap.colorType() != opts.fRequestedColorType);
- return NULL; // Can not translate to needed config.
+ return nullptr; // Can not translate to needed config.
}
info = info.makeColorType(opts.fRequestedColorType);
}
@@ -254,7 +254,7 @@ SkImageGenerator* CreateDecodingImageGenerator(
SkAlphaType newAlphaType = info.alphaType();
if (!SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &newAlphaType)) {
- return NULL;
+ return nullptr;
}
return new DecodingImageGenerator(data, autoStream.detach(), info.makeAlphaType(newAlphaType),
@@ -268,21 +268,21 @@ SkImageGenerator* CreateDecodingImageGenerator(
SkImageGenerator* SkDecodingImageGenerator::Create(
SkData* data,
const SkDecodingImageGenerator::Options& opts) {
- SkASSERT(data != NULL);
- if (NULL == data) {
- return NULL;
+ SkASSERT(data != nullptr);
+ if (nullptr == data) {
+ return nullptr;
}
SkStreamRewindable* stream = new SkMemoryStream(data);
- SkASSERT(stream != NULL);
+ SkASSERT(stream != nullptr);
return CreateDecodingImageGenerator(data, stream, opts);
}
SkImageGenerator* SkDecodingImageGenerator::Create(
SkStreamRewindable* stream,
const SkDecodingImageGenerator::Options& opts) {
- SkASSERT(stream != NULL);
- if (stream == NULL) {
- return NULL;
+ SkASSERT(stream != nullptr);
+ if (stream == nullptr) {
+ return nullptr;
}
- return CreateDecodingImageGenerator(NULL, stream, opts);
+ return CreateDecodingImageGenerator(nullptr, stream, opts);
}
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 0be295cbba..daeee9f0b9 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -15,8 +15,8 @@
#include "SkCanvas.h"
SkImageDecoder::SkImageDecoder()
- : fPeeker(NULL)
- , fAllocator(NULL)
+ : fPeeker(nullptr)
+ , fAllocator(nullptr)
, fSampleSize(1)
, fDefaultPref(kUnknown_SkColorType)
, fPreserveSrcDepth(false)
@@ -32,7 +32,7 @@ SkImageDecoder::~SkImageDecoder() {
}
void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) {
- if (NULL == other) {
+ if (nullptr == other) {
return;
}
other->setPeeker(fPeeker);
@@ -188,7 +188,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
if (dst->isNull()) {
dst->setInfo(src->info().makeWH(w, h));
- if (!this->allocPixelRef(dst, NULL)) {
+ if (!this->allocPixelRef(dst, nullptr)) {
SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
return false;
}
diff --git a/src/images/SkImageDecoder_FactoryDefault.cpp b/src/images/SkImageDecoder_FactoryDefault.cpp
index e959c8b69b..77c0a0ac57 100644
--- a/src/images/SkImageDecoder_FactoryDefault.cpp
+++ b/src/images/SkImageDecoder_FactoryDefault.cpp
@@ -27,10 +27,10 @@ SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
if (movie) {
return movie;
}
- // we must rewind only if we got NULL, since we gave the stream to the
+ // we must rewind only if we got nullptr, since we gave the stream to the
// movie, who may have already started reading from it
stream->rewind();
curr = curr->next();
}
- return NULL;
+ return nullptr;
}
diff --git a/src/images/SkImageDecoder_FactoryRegistrar.cpp b/src/images/SkImageDecoder_FactoryRegistrar.cpp
index 68202a96d9..36034d20ad 100644
--- a/src/images/SkImageDecoder_FactoryRegistrar.cpp
+++ b/src/images/SkImageDecoder_FactoryRegistrar.cpp
@@ -19,7 +19,7 @@ template SkImageDecoder_DecodeReg* SkImageDecoder_DecodeReg::gHead;
SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
SkImageDecoder* image_decoder_from_stream(SkStreamRewindable* stream) {
- SkImageDecoder* codec = NULL;
+ SkImageDecoder* codec = nullptr;
const SkImageDecoder_DecodeReg* curr = SkImageDecoder_DecodeReg::Head();
while (curr) {
codec = curr->factory()(stream);
@@ -32,7 +32,7 @@ SkImageDecoder* image_decoder_from_stream(SkStreamRewindable* stream) {
if (!rewindSuceeded) {
SkDEBUGF(("Unable to rewind the image stream."));
delete codec;
- return NULL;
+ return nullptr;
}
if (codec) {
@@ -40,14 +40,14 @@ SkImageDecoder* image_decoder_from_stream(SkStreamRewindable* stream) {
}
curr = curr->next();
}
- return NULL;
+ return nullptr;
}
template SkImageDecoder_FormatReg* SkImageDecoder_FormatReg::gHead;
SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable* stream) {
const SkImageDecoder_FormatReg* curr = SkImageDecoder_FormatReg::Head();
- while (curr != NULL) {
+ while (curr != nullptr) {
Format format = curr->factory()(stream);
if (!stream->rewind()) {
SkErrorInternals::SetError(kInvalidOperation_SkError,
diff --git a/src/images/SkImageDecoder_astc.cpp b/src/images/SkImageDecoder_astc.cpp
index cb29b4da54..e1a6a06fa7 100644
--- a/src/images/SkImageDecoder_astc.cpp
+++ b/src/images/SkImageDecoder_astc.cpp
@@ -135,7 +135,7 @@ SkImageDecoder::Result SkASTCImageDecoder::onDecode(SkStream* stream, SkBitmap*
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return kFailure;
}
@@ -188,7 +188,7 @@ static SkImageDecoder* sk_libastc_dfactory(SkStreamRewindable* stream) {
if (is_astc(stream)) {
return new SkASTCImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory);
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index a7e1a70e60..a95ab6f602 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -50,7 +50,7 @@ private:
SkImageDecoder::Result SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
// TODO: Implement SkStream::copyToData() that's cheap for memory and file streams
SkAutoDataUnref data(SkCopyStreamToData(stream));
- if (NULL == data) {
+ if (nullptr == data) {
return kFailure;
}
@@ -118,7 +118,7 @@ SkImageDecoder::Result SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* b
}
// If we've made it this far, then we know how to grok the data.
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return kFailure;
}
@@ -311,7 +311,7 @@ static SkImageDecoder* sk_libktx_dfactory(SkStreamRewindable* stream) {
if (SkKTXFile::is_ktx(stream)) {
return new SkKTXImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder::Format get_format_ktx(SkStreamRewindable* stream) {
@@ -322,7 +322,7 @@ static SkImageDecoder::Format get_format_ktx(SkStreamRewindable* stream) {
}
SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kKTX_Type == t) ? new SkKTXImageEncoder : NULL;
+ return (SkImageEncoder::kKTX_Type == t) ? new SkKTXImageEncoder : nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory);
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index 38845086c7..179162356a 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -48,7 +48,7 @@ static SkImageDecoder* sk_libbmp_dfactory(SkStreamRewindable* stream) {
if (is_bmp(stream)) {
return new SkBMPImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libbmp_dfactory);
@@ -74,7 +74,7 @@ public:
fWidth = width;
fHeight = height;
if (fJustBounds) {
- return NULL;
+ return nullptr;
}
fRGB.setCount(width * height * 3); // 3 == r, g, b
@@ -139,7 +139,7 @@ SkImageDecoder::Result SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* b
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return kFailure;
}
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 65172acd24..ef55a8f2e0 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -77,8 +77,8 @@ public:
if (gStartingIterlaceYValue +
SK_ARRAY_COUNT(gStartingIterlaceYValue) == fStartYPtr) {
// we done
- SkDEBUGCODE(fStartYPtr = NULL;)
- SkDEBUGCODE(fDeltaYPtr = NULL;)
+ SkDEBUGCODE(fStartYPtr = nullptr;)
+ SkDEBUGCODE(fDeltaYPtr = nullptr;)
y = 0;
} else {
y = *fStartYPtr++;
@@ -114,21 +114,21 @@ void CheckFreeExtension(SavedImage* Image) {
}
}
-// return NULL on failure
+// return nullptr on failure
static const ColorMapObject* find_colormap(const GifFileType* gif) {
const ColorMapObject* cmap = gif->Image.ColorMap;
- if (NULL == cmap) {
+ if (nullptr == cmap) {
cmap = gif->SColorMap;
}
- if (NULL == cmap) {
+ if (nullptr == cmap) {
// no colormap found
- return NULL;
+ return nullptr;
}
// some sanity checks
if (cmap && ((unsigned)cmap->ColorCount > 256 ||
cmap->ColorCount != (1 << cmap->BitsPerPixel))) {
- cmap = NULL;
+ cmap = nullptr;
}
return cmap;
}
@@ -197,7 +197,7 @@ static void sanitize_indexed_bitmap(SkBitmap* bm) {
SkAutoLockPixels alp(*bm);
if (bm->getPixels()) {
SkColorTable* ct = bm->getColorTable(); // Index8 must have it.
- SkASSERT(ct != NULL);
+ SkASSERT(ct != nullptr);
uint32_t count = ct->count();
SkASSERT(count > 0);
SkASSERT(count <= 0x100);
@@ -235,7 +235,7 @@ int close_gif(GifFileType* gif) {
#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
return DGifCloseFile(gif);
#else
- return DGifCloseFile(gif, NULL);
+ return DGifCloseFile(gif, nullptr);
#endif
}
}//namespace
@@ -244,16 +244,16 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
#if GIFLIB_MAJOR < 5
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
#else
- GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc, NULL);
+ GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc, nullptr);
#endif
- if (NULL == gif) {
+ if (nullptr == gif) {
return error_return(*bm, "DGifOpen");
}
SkAutoTCallIProc<GifFileType, close_gif> acp(gif);
SavedImage temp_save;
- temp_save.ExtensionBlocks=NULL;
+ temp_save.ExtensionBlocks=nullptr;
temp_save.ExtensionBlockCount=0;
SkAutoTCallVProc<SavedImage, CheckFreeExtension> acp2(&temp_save);
@@ -337,7 +337,7 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
// Declare colorPtr here for scope.
SkPMColor colorPtr[256]; // storage for worst-case
const ColorMapObject* cmap = find_colormap(gif);
- if (cmap != NULL) {
+ if (cmap != nullptr) {
SkASSERT(cmap->ColorCount == (1 << (cmap->BitsPerPixel)));
colorCount = cmap->ColorCount;
if (colorCount > 256) {
@@ -350,7 +350,7 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
cmap->Colors[index].Blue);
}
} else {
- // find_colormap() returned NULL. Some (rare, broken)
+ // find_colormap() returned nullptr. Some (rare, broken)
// GIFs don't have a color table, so we force one.
gif_warning(*bm, "missing colormap");
colorCount = 256;
@@ -471,7 +471,7 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
return error_return(*bm, "DGifGetExtension");
}
- while (extData != NULL) {
+ while (extData != nullptr) {
/* Create an extension block with our data */
#if GIFLIB_MAJOR < 5
if (AddExtensionBlock(&temp_save, extData[0],
@@ -526,7 +526,7 @@ static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) {
if (is_gif(stream)) {
return new SkGIFImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory);
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index 78f41d9c0e..e8b4bc5c31 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -127,7 +127,7 @@ SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* b
{
SkMemoryStream subStream(buf + offset, size, false);
SkAutoTDelete<SkImageDecoder> otherDecoder(SkImageDecoder::Factory(&subStream));
- if (otherDecoder.get() != NULL) {
+ if (otherDecoder.get() != nullptr) {
// Disallow nesting ICO files within one another
// FIXME: Can ICO files contain other formats besides PNG?
if (otherDecoder->getFormat() == SkImageDecoder::kICO_Format) {
@@ -167,7 +167,7 @@ SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* b
void (*placePixel)(const int pixelNo, const unsigned char* buf,
const int xorOffset, int& x, int y, const int w,
- SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors) = NULL;
+ SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors) = nullptr;
switch (bitCount)
{
case 1:
@@ -212,7 +212,7 @@ SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* b
//this array represents the colortable
//if i allow other types of bitmaps, it may actually be used as a part of the bitmap
- SkPMColor* colors = NULL;
+ SkPMColor* colors = nullptr;
int blue, green, red;
if (colorCount)
{
@@ -252,7 +252,7 @@ SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* b
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL))
+ if (!this->allocPixelRef(bm, nullptr))
{
delete[] colors;
return kFailure;
@@ -437,7 +437,7 @@ static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) {
if (is_ico(stream)) {
return new SkICOImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index d403b7451d..4b0d18b8e4 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -65,8 +65,8 @@ static void do_nothing_output_message(j_common_ptr) {
}
static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* src_mgr) {
- SkASSERT(cinfo != NULL);
- SkASSERT(src_mgr != NULL);
+ SkASSERT(cinfo != nullptr);
+ SkASSERT(src_mgr != nullptr);
jpeg_create_decompress(cinfo);
cinfo->src = src_mgr;
/* To suppress warnings with a SK_DEBUG binary, set the
@@ -205,7 +205,7 @@ class SkJPEGImageDecoder : public SkImageDecoder {
public:
#ifdef SK_BUILD_FOR_ANDROID
SkJPEGImageDecoder() {
- fImageIndex = NULL;
+ fImageIndex = nullptr;
fImageWidth = 0;
fImageHeight = 0;
}
@@ -250,7 +250,7 @@ private:
/* Automatically clean up after throwing an exception */
class JPEGAutoClean {
public:
- JPEGAutoClean(): cinfo_ptr(NULL) {}
+ JPEGAutoClean(): cinfo_ptr(nullptr) {}
~JPEGAutoClean() {
if (cinfo_ptr) {
jpeg_destroy_decompress(cinfo_ptr);
@@ -372,8 +372,8 @@ static void convert_CMYK_to_RGB(uint8_t* scanline, unsigned int width) {
* Common code for setting the error manager.
*/
static void set_error_mgr(jpeg_decompress_struct* cinfo, skjpeg_error_mgr* errorManager) {
- SkASSERT(cinfo != NULL);
- SkASSERT(errorManager != NULL);
+ SkASSERT(cinfo != nullptr);
+ SkASSERT(errorManager != nullptr);
cinfo->err = jpeg_std_error(errorManager);
errorManager->error_exit = skjpeg_error_exit;
}
@@ -384,7 +384,7 @@ static void set_error_mgr(jpeg_decompress_struct* cinfo, skjpeg_error_mgr* error
* resulting bitmap.
*/
static void turn_off_visual_optimizations(jpeg_decompress_struct* cinfo) {
- SkASSERT(cinfo != NULL);
+ SkASSERT(cinfo != nullptr);
/* this gives about 30% performance improvement. In theory it may
reduce the visual quality, in practice I'm not seeing a difference
*/
@@ -398,7 +398,7 @@ static void turn_off_visual_optimizations(jpeg_decompress_struct* cinfo) {
* Common code for setting the dct method.
*/
static void set_dct_method(const SkImageDecoder& decoder, jpeg_decompress_struct* cinfo) {
- SkASSERT(cinfo != NULL);
+ SkASSERT(cinfo != nullptr);
#ifdef DCT_IFAST_SUPPORTED
if (decoder.getPreferQualityOverSpeed()) {
cinfo->dct_method = JDCT_ISLOW;
@@ -411,7 +411,7 @@ static void set_dct_method(const SkImageDecoder& decoder, jpeg_decompress_struct
}
SkColorType SkJPEGImageDecoder::getBitmapColorType(jpeg_decompress_struct* cinfo) {
- SkASSERT(cinfo != NULL);
+ SkASSERT(cinfo != nullptr);
SrcDepth srcDepth = k32Bit_SrcDepth;
if (JCS_GRAYSCALE == cinfo->jpeg_color_space) {
@@ -471,7 +471,7 @@ SkColorType SkJPEGImageDecoder::getBitmapColorType(jpeg_decompress_struct* cinfo
static void adjust_out_color_space_and_dither(jpeg_decompress_struct* cinfo,
SkColorType colorType,
const SkImageDecoder& decoder) {
- SkASSERT(cinfo != NULL);
+ SkASSERT(cinfo != nullptr);
#ifdef ANDROID_RGB
cinfo->dither_mode = JDITHER_NONE;
if (JCS_CMYK == cinfo->out_color_space) {
@@ -511,7 +511,7 @@ static void fill_below_level(int y, SkBitmap* bitmap) {
static bool get_src_config(const jpeg_decompress_struct& cinfo,
SkScaledBitmapSampler::SrcConfig* sc,
int* srcBytesPerPixel) {
- SkASSERT(sc != NULL && srcBytesPerPixel != NULL);
+ SkASSERT(sc != nullptr && srcBytesPerPixel != nullptr);
if (JCS_CMYK == cinfo.out_color_space) {
// In this case we will manually convert the CMYK values to RGB
*sc = SkScaledBitmapSampler::kRGBX;
@@ -634,7 +634,7 @@ SkImageDecoder::Result SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap*
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return return_failure(cinfo, *bm, "allocPixelRef");
}
@@ -930,7 +930,7 @@ bool SkJPEGImageDecoder::onDecodeYUV8Planes(SkStream* stream, SkISize componentS
update_components_sizes(cinfo, componentSizes, kActualSize_SizeType);
jpeg_finish_decompress(&cinfo);
- if (NULL != colorSpace) {
+ if (nullptr != colorSpace) {
*colorSpace = kJPEG_SkYUVColorSpace;
}
@@ -1004,7 +1004,7 @@ bool SkJPEGImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int *width
}
bool SkJPEGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
- if (NULL == fImageIndex) {
+ if (nullptr == fImageIndex) {
return false;
}
jpeg_decompress_struct* cinfo = fImageIndex->cinfo();
@@ -1063,7 +1063,7 @@ bool SkJPEGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
((startX - rect.x()) / actualSampleSize == 0) &&
((startY - rect.y()) / actualSampleSize == 0);
if (swapOnly) {
- if (!this->allocPixelRef(&bitmap, NULL)) {
+ if (!this->allocPixelRef(&bitmap, nullptr)) {
return return_false(*cinfo, bitmap, "allocPixelRef");
}
} else {
@@ -1333,7 +1333,7 @@ static WriteScanline ChooseWriter(const SkBitmap& bm) {
case kIndex_8_SkColorType:
return Write_Index_YUV;
default:
- return NULL;
+ return nullptr;
}
}
@@ -1345,7 +1345,7 @@ protected:
#endif
SkAutoLockPixels alp(bm);
- if (NULL == bm.getPixels()) {
+ if (nullptr == bm.getPixels()) {
return false;
}
@@ -1364,7 +1364,7 @@ protected:
// Keep after setjmp or mark volatile.
const WriteScanline writer = ChooseWriter(bm);
- if (NULL == writer) {
+ if (nullptr == writer) {
return false;
}
@@ -1391,7 +1391,7 @@ protected:
const int width = bm.width();
uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3);
- const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
+ const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : nullptr;
const void* srcRow = bm.getPixels();
while (cinfo.next_scanline < cinfo.image_height) {
@@ -1436,7 +1436,7 @@ static SkImageDecoder* sk_libjpeg_dfactory(SkStreamRewindable* stream) {
if (is_jpeg(stream)) {
return new SkJPEGImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder::Format get_format_jpeg(SkStreamRewindable* stream) {
@@ -1447,7 +1447,7 @@ static SkImageDecoder::Format get_format_jpeg(SkStreamRewindable* stream) {
}
static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : NULL;
+ return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr;
}
static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index bccdfc8cf5..31ec4dd48a 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -26,19 +26,19 @@
/* These were dropped in libpng >= 1.4 */
#ifndef png_infopp_NULL
-#define png_infopp_NULL NULL
+#define png_infopp_NULL nullptr
#endif
#ifndef png_bytepp_NULL
-#define png_bytepp_NULL NULL
+#define png_bytepp_NULL nullptr
#endif
#ifndef int_p_NULL
-#define int_p_NULL NULL
+#define int_p_NULL nullptr
#endif
#ifndef png_flush_ptr_NULL
-#define png_flush_ptr_NULL NULL
+#define png_flush_ptr_NULL nullptr
#endif
#if defined(SK_DEBUG)
@@ -62,7 +62,7 @@ public:
, fPng_ptr(png_ptr)
, fInfo_ptr(info_ptr)
, fColorType(kUnknown_SkColorType) {
- SkASSERT(stream != NULL);
+ SkASSERT(stream != nullptr);
}
~SkPNGImageIndex() {
if (fPng_ptr) {
@@ -79,7 +79,7 @@ public:
class SkPNGImageDecoder : public SkImageDecoder {
public:
SkPNGImageDecoder() {
- fImageIndex = NULL;
+ fImageIndex = nullptr;
}
Format getFormat() const override {
return kPNG_Format;
@@ -205,7 +205,7 @@ static bool hasTransparencyInPalette(png_structp png_ptr, png_infop info_ptr) {
int num_trans;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
+ png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, nullptr);
return num_trans > 0;
}
return false;
@@ -219,13 +219,13 @@ bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp,
png_infop *info_ptrp) {
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
- * you can supply NULL for the last three parameters. We also supply the
+ * you can supply nullptr for the last three parameters. We also supply the
* the compiler header file version, so that we know if the application
* was compiled with a compatible version of the library. */
png_error_ptr user_warning_fn =
- (c_suppressPNGImageDecoderWarnings) ? (&do_nothing_warning_fn) : NULL;
- /* NULL means to leave as default library behavior. */
+ (c_suppressPNGImageDecoderWarnings) ? (&do_nothing_warning_fn) : nullptr;
+ /* nullptr means to leave as default library behavior. */
/* c_suppressPNGImageDecoderWarnings default depends on SK_DEBUG. */
/* To suppress warnings with a SK_DEBUG binary, set the
* environment variable "skia_images_png_suppressDecoderWarnings"
@@ -233,9 +233,9 @@ bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp,
* SK_CONF_SET("images.png.suppressDecoderWarnings", true); */
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
- NULL, sk_error_fn, user_warning_fn);
+ nullptr, sk_error_fn, user_warning_fn);
// png_voidp user_error_ptr, user_error_fn, user_warning_fn);
- if (png_ptr == NULL) {
+ if (png_ptr == nullptr) {
return false;
}
@@ -243,7 +243,7 @@ bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp,
/* Allocate/initialize the memory for image information. */
png_infop info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
+ if (info_ptr == nullptr) {
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
return false;
}
@@ -348,7 +348,7 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
// to |= PNG_COLOR_MASK_ALPHA, but all of its pixels are in fact opaque. We care, since we
// draw lots faster if we can flag the bitmap has being opaque
bool reallyHasAlpha = false;
- SkColorTable* colorTable = NULL;
+ SkColorTable* colorTable = nullptr;
if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
decodePalette(png_ptr, info_ptr, bitDepth, &hasAlpha, &reallyHasAlpha, &colorTable);
@@ -357,7 +357,7 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
SkAutoUnref aur(colorTable);
if (!this->allocPixelRef(decodedBitmap,
- kIndex_8_SkColorType == colorType ? colorTable : NULL)) {
+ kIndex_8_SkColorType == colorType ? colorTable : nullptr)) {
return kFailure;
}
@@ -402,7 +402,7 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
- if (colorTable != NULL) {
+ if (colorTable != nullptr) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
} else if (kAlpha_8_SkColorType == colorType) {
@@ -420,7 +420,7 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
- const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
+ const SkPMColor* colors = colorTable ? colorTable->readColors() : nullptr;
if (!sampler.begin(decodedBitmap, sc, *this, colors)) {
return kFailure;
}
@@ -532,14 +532,14 @@ bool SkPNGImageDecoder::getBitmapColorType(png_structp png_ptr, png_infop info_p
*colorTypep = kIndex_8_SkColorType;
}
} else {
- png_color_16p transpColor = NULL;
+ png_color_16p transpColor = nullptr;
int numTransp = 0;
- png_get_tRNS(png_ptr, info_ptr, NULL, &numTransp, &transpColor);
+ png_get_tRNS(png_ptr, info_ptr, nullptr, &numTransp, &transpColor);
bool valid = png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS);
- if (valid && numTransp == 1 && transpColor != NULL) {
+ if (valid && numTransp == 1 && transpColor != nullptr) {
/* Compute our transparent color, which we'll match against later.
We don't really handle 16bit components properly here, since we
do our compare *after* the values have been knocked down to 8bit
@@ -627,7 +627,7 @@ bool SkPNGImageDecoder::getBitmapColorType(png_structp png_ptr, png_infop info_p
*colorTypep = kN32_SkColorType;
}
- if (fImageIndex != NULL) {
+ if (fImageIndex != nullptr) {
if (kUnknown_SkColorType == fImageIndex->fColorType) {
// This is the first time for this subset decode. From now on,
// all decodes must be in the same colortype.
@@ -672,7 +672,7 @@ bool SkPNGImageDecoder::decodePalette(png_structp png_ptr, png_infop info_ptr,
SkPMColor* colorPtr = colorStorage;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- png_get_tRNS(png_ptr, info_ptr, &trans, &numTrans, NULL);
+ png_get_tRNS(png_ptr, info_ptr, &trans, &numTrans, nullptr);
*hasAlphap = (numTrans > 0);
} else {
numTrans = 0;
@@ -761,7 +761,7 @@ bool SkPNGImageDecoder::onBuildTileIndex(SkStreamRewindable* sk_stream, int *wid
}
bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
- if (NULL == fImageIndex) {
+ if (nullptr == fImageIndex) {
return false;
}
@@ -805,7 +805,7 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
// to |= PNG_COLOR_MASK_ALPHA, but all of its pixels are in fact opaque. We care, since we
// draw lots faster if we can flag the bitmap has being opaque
bool reallyHasAlpha = false;
- SkColorTable* colorTable = NULL;
+ SkColorTable* colorTable = nullptr;
if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
decodePalette(png_ptr, info_ptr, bitDepth, &hasAlpha, &reallyHasAlpha, &colorTable);
@@ -822,11 +822,11 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
(h == decodedBitmap.height()) && bm->isNull();
const bool needColorTable = kIndex_8_SkColorType == colorType;
if (swapOnly) {
- if (!this->allocPixelRef(&decodedBitmap, needColorTable ? colorTable : NULL)) {
+ if (!this->allocPixelRef(&decodedBitmap, needColorTable ? colorTable : nullptr)) {
return false;
}
} else {
- if (!decodedBitmap.tryAllocPixels(NULL, needColorTable ? colorTable : NULL)) {
+ if (!decodedBitmap.tryAllocPixels(nullptr, needColorTable ? colorTable : nullptr)) {
return false;
}
}
@@ -882,7 +882,7 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
- if (colorTable != NULL) {
+ if (colorTable != nullptr) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
} else if (kAlpha_8_SkColorType == colorType) {
@@ -900,7 +900,7 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
- const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
+ const SkPMColor* colors = colorTable ? colorTable->readColors() : nullptr;
if (!sampler.begin(&decodedBitmap, sc, *this, colors)) {
return false;
}
@@ -1025,7 +1025,7 @@ static transform_scanline_proc choose_proc(SkColorType ct, bool hasAlpha) {
}
}
sk_throw();
- return NULL;
+ return nullptr;
}
// return the minimum legal bitdepth (by png standards) for this many colortable
@@ -1053,7 +1053,7 @@ static int computeBitDepth(int colorCount) {
static inline int pack_palette(SkColorTable* ctable,
png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
- const SkPMColor* SK_RESTRICT colors = ctable ? ctable->readColors() : NULL;
+ const SkPMColor* SK_RESTRICT colors = ctable ? ctable->readColors() : nullptr;
const int ctCount = ctable->count();
int i, num_trans = 0;
@@ -1182,14 +1182,14 @@ bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap,
png_structp png_ptr;
png_infop info_ptr;
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, sk_error_fn,
- NULL);
- if (NULL == png_ptr) {
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, sk_error_fn,
+ nullptr);
+ if (nullptr == png_ptr) {
return false;
}
info_ptr = png_create_info_struct(png_ptr);
- if (NULL == info_ptr) {
+ if (nullptr == info_ptr) {
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
return false;
}
@@ -1226,7 +1226,7 @@ bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap,
int numTrans = pack_palette(ct, paletteColors, trans, hasAlpha);
png_set_PLTE(png_ptr, info_ptr, paletteColors, ct->count());
if (numTrans > 0) {
- png_set_tRNS(png_ptr, info_ptr, trans, numTrans, NULL);
+ png_set_tRNS(png_ptr, info_ptr, trans, numTrans, nullptr);
}
}
#ifdef PNG_sBIT_SUPPORTED
@@ -1271,7 +1271,7 @@ SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) {
if (is_png(stream)) {
return new SkPNGImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder::Format get_format_png(SkStreamRewindable* stream) {
@@ -1282,7 +1282,7 @@ static SkImageDecoder::Format get_format_png(SkStreamRewindable* stream) {
}
SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : NULL;
+ return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr;
}
static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index e0c1d645e7..6fe4771d9d 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -137,7 +137,7 @@ class AutoTimeMillis {
public:
AutoTimeMillis(const char label[]) :
fLabel(label) {
- if (NULL == fLabel) {
+ if (nullptr == fLabel) {
fLabel = "";
}
fNow = SkTime::GetMSecs();
@@ -196,8 +196,8 @@ static WEBP_CSP_MODE webp_decode_mode(const SkBitmap* decodedBitmap, bool premul
// Incremental WebP image decoding. Reads input buffer of 64K size iteratively
// and decodes this block to appropriate color-space as per config object.
static bool webp_idecode(SkStream* stream, WebPDecoderConfig* config) {
- WebPIDecoder* idec = WebPIDecode(NULL, 0, config);
- if (NULL == idec) {
+ WebPIDecoder* idec = WebPIDecode(nullptr, 0, config);
+ if (nullptr == idec) {
WebPFreeDecBuffer(&config->output);
return false;
}
@@ -210,7 +210,7 @@ static bool webp_idecode(SkStream* stream, WebPDecoderConfig* config) {
SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_BUFFER_SZ;
SkAutoMalloc srcStorage(readBufferSize);
unsigned char* input = (uint8_t*)srcStorage.get();
- if (NULL == input) {
+ if (nullptr == input) {
WebPIDelete(idec);
WebPFreeDecBuffer(&config->output);
return false;
@@ -374,7 +374,7 @@ bool SkWEBPImageDecoder::onDecodeSubset(SkBitmap* decodedBitmap,
}
// alloc from native heap if it is a temp bitmap. (prevent GC)
bool allocResult = (bitmap == decodedBitmap)
- ? allocPixelRef(bitmap, NULL)
+ ? allocPixelRef(bitmap, nullptr)
: bitmap->tryAllocPixels();
if (!allocResult) {
return return_false(*decodedBitmap, "allocPixelRef");
@@ -425,7 +425,7 @@ SkImageDecoder::Result SkWEBPImageDecoder::onDecode(SkStream* stream, SkBitmap*
return kSuccess;
}
- if (!this->allocPixelRef(decodedBitmap, NULL)) {
+ if (!this->allocPixelRef(decodedBitmap, nullptr)) {
return return_failure(*decodedBitmap, "allocPixelRef");
}
@@ -571,7 +571,7 @@ static ScanlineImporter ChooseImporter(SkColorType ct, bool hasAlpha, int* bpp
*bpp = 3;
return Index8_To_RGB;
default:
- return NULL;
+ return nullptr;
}
}
@@ -594,7 +594,7 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
const bool hasAlpha = !bm.isOpaque();
int bpp = -1;
const ScanlineImporter scanline_import = ChooseImporter(bm.colorType(), hasAlpha, &bpp);
- if (NULL == scanline_import) {
+ if (nullptr == scanline_import) {
return false;
}
if (-1 == bpp) {
@@ -602,7 +602,7 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
}
SkAutoLockPixels alp(bm);
- if (NULL == bm.getPixels()) {
+ if (nullptr == bm.getPixels()) {
return false;
}
@@ -618,7 +618,7 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
pic.writer = stream_writer;
pic.custom_ptr = (void*)stream;
- const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
+ const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : nullptr;
const uint8_t* src = (uint8_t*)bm.getPixels();
const int rgbStride = pic.width * bpp;
@@ -653,7 +653,7 @@ DEFINE_ENCODER_CREATOR(WEBPImageEncoder);
static SkImageDecoder* sk_libwebp_dfactory(SkStreamRewindable* stream) {
int width, height, hasAlpha;
if (!webp_parse_header(stream, &width, &height, &hasAlpha)) {
- return NULL;
+ return nullptr;
}
// Magic matches, call decoder
@@ -669,7 +669,7 @@ static SkImageDecoder::Format get_format_webp(SkStreamRewindable* stream) {
}
static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
- return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : NULL;
+ return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : nullptr;
}
static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
diff --git a/src/images/SkImageDecoder_pkm.cpp b/src/images/SkImageDecoder_pkm.cpp
index f407308d8b..71004614f5 100644
--- a/src/images/SkImageDecoder_pkm.cpp
+++ b/src/images/SkImageDecoder_pkm.cpp
@@ -57,7 +57,7 @@ SkImageDecoder::Result SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* b
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return kFailure;
}
@@ -113,7 +113,7 @@ static SkImageDecoder* sk_libpkm_dfactory(SkStreamRewindable* stream) {
if (is_pkm(stream)) {
return new SkPKMImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory);
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index 82127c3c7b..335966b29a 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -158,7 +158,7 @@ static SkImageDecoder* sk_wbmp_dfactory(SkStreamRewindable* stream) {
if (head.init(stream)) {
return new SkWBMPImageDecoder;
}
- return NULL;
+ return nullptr;
}
static SkImageDecoder::Format get_format_wbmp(SkStreamRewindable* stream) {
diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp
index a6f109a207..cc1b73baa5 100644
--- a/src/images/SkImageEncoder.cpp
+++ b/src/images/SkImageEncoder.cpp
@@ -31,7 +31,7 @@ SkData* SkImageEncoder::encodeData(const SkBitmap& bm, int quality) {
if (this->onEncode(&stream, bm, quality)) {
return stream.copyToData();
}
- return NULL;
+ return nullptr;
}
bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap& bm, Type t,
@@ -48,15 +48,15 @@ bool SkImageEncoder::EncodeStream(SkWStream* stream, const SkBitmap& bm, Type t,
SkData* SkImageEncoder::EncodeData(const SkBitmap& bm, Type t, int quality) {
SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
- return enc.get() ? enc.get()->encodeData(bm, quality) : NULL;
+ return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
}
SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes,
Type t, int quality) {
SkBitmap bm;
if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
- return enc.get() ? enc.get()->encodeData(bm, quality) : NULL;
+ return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
}
diff --git a/src/images/SkImageEncoder_Factory.cpp b/src/images/SkImageEncoder_Factory.cpp
index 2931d12eae..8d4cc6541b 100644
--- a/src/images/SkImageEncoder_Factory.cpp
+++ b/src/images/SkImageEncoder_Factory.cpp
@@ -11,13 +11,13 @@
template SkImageEncoder_EncodeReg* SkImageEncoder_EncodeReg::gHead;
SkImageEncoder* SkImageEncoder::Create(Type t) {
- SkImageEncoder* codec = NULL;
+ SkImageEncoder* codec = nullptr;
const SkImageEncoder_EncodeReg* curr = SkImageEncoder_EncodeReg::Head();
while (curr) {
- if ((codec = curr->factory()(t)) != NULL) {
+ if ((codec = curr->factory()(t)) != nullptr) {
return codec;
}
curr = curr->next();
}
- return NULL;
+ return nullptr;
}
diff --git a/src/images/SkImageEncoder_argb.cpp b/src/images/SkImageEncoder_argb.cpp
index 9da15cfb16..3cd0388412 100644
--- a/src/images/SkImageEncoder_argb.cpp
+++ b/src/images/SkImageEncoder_argb.cpp
@@ -82,23 +82,23 @@ static ScanlineImporter ChooseImporter(SkColorType ct) {
case kIndex_8_SkColorType:
return Index8_To_ARGB;
default:
- return NULL;
+ return nullptr;
}
}
bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int) {
const ScanlineImporter scanline_import = ChooseImporter(bitmap.colorType());
- if (NULL == scanline_import) {
+ if (nullptr == scanline_import) {
return false;
}
SkAutoLockPixels alp(bitmap);
const uint8_t* src = (uint8_t*)bitmap.getPixels();
- if (NULL == bitmap.getPixels()) {
+ if (nullptr == bitmap.getPixels()) {
return false;
}
- const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->readColors() : NULL;
+ const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->readColors() : nullptr;
const int argbStride = bitmap.width() * 4;
SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
diff --git a/src/images/SkJpegUtility.cpp b/src/images/SkJpegUtility.cpp
index 937c5ec6f6..10249ea8bf 100644
--- a/src/images/SkJpegUtility.cpp
+++ b/src/images/SkJpegUtility.cpp
@@ -47,7 +47,7 @@ static boolean sk_seek_input_data(j_decompress_ptr cinfo, long byte_offset) {
static boolean sk_fill_input_buffer(j_decompress_ptr cinfo) {
skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
- if (src->fDecoder != NULL && src->fDecoder->shouldCancelDecode()) {
+ if (src->fDecoder != nullptr && src->fDecoder->shouldCancelDecode()) {
return FALSE;
}
size_t bytes = src->fStream->read(src->fBuffer, skjpeg_source_mgr::kBufferSize);
diff --git a/src/images/SkMovie.cpp b/src/images/SkMovie.cpp
index 2a1339f36e..9749011a81 100644
--- a/src/images/SkMovie.cpp
+++ b/src/images/SkMovie.cpp
@@ -91,5 +91,5 @@ SkMovie* SkMovie::DecodeMemory(const void* data, size_t length) {
SkMovie* SkMovie::DecodeFile(const char path[]) {
SkAutoTDelete<SkStreamRewindable> stream(SkStream::NewFromFile(path));
- return stream.get() ? SkMovie::DecodeStream(stream) : NULL;
+ return stream.get() ? SkMovie::DecodeStream(stream) : nullptr;
}
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index c40f552cea..103107961b 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -48,15 +48,15 @@ SkGIFMovie::SkGIFMovie(SkStream* stream)
#if GIFLIB_MAJOR < 5
fGIF = DGifOpen( stream, Decode );
#else
- fGIF = DGifOpen( stream, Decode, NULL );
+ fGIF = DGifOpen( stream, Decode, nullptr );
#endif
- if (NULL == fGIF)
+ if (nullptr == fGIF)
return;
if (DGifSlurp(fGIF) != GIF_OK)
{
- DGifCloseFile(fGIF, NULL);
- fGIF = NULL;
+ DGifCloseFile(fGIF, nullptr);
+ fGIF = nullptr;
}
fCurrIndex = -1;
fLastDrawIndex = -1;
@@ -66,7 +66,7 @@ SkGIFMovie::SkGIFMovie(SkStream* stream)
SkGIFMovie::~SkGIFMovie()
{
if (fGIF)
- DGifCloseFile(fGIF, NULL);
+ DGifCloseFile(fGIF, nullptr);
}
static SkMSec savedimage_duration(const SavedImage* image)
@@ -85,7 +85,7 @@ static SkMSec savedimage_duration(const SavedImage* image)
bool SkGIFMovie::onGetInfo(Info* info)
{
- if (NULL == fGIF)
+ if (nullptr == fGIF)
return false;
SkMSec dur = 0;
@@ -101,7 +101,7 @@ bool SkGIFMovie::onGetInfo(Info* info)
bool SkGIFMovie::onSetTime(SkMSec time)
{
- if (NULL == fGIF)
+ if (nullptr == fGIF)
return false;
SkMSec dur = 0;
@@ -239,12 +239,12 @@ static void drawFrame(SkBitmap* bm, const SavedImage* frame, const ColorMapObjec
}
}
- if (frame->ImageDesc.ColorMap != NULL) {
+ if (frame->ImageDesc.ColorMap != nullptr) {
// use local color table
cmap = frame->ImageDesc.ColorMap;
}
- if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
+ if (cmap == nullptr || cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
SkDEBUGFAIL("bad colortable setup");
return;
}
@@ -345,7 +345,7 @@ static void disposeFrameIfNeeded(SkBitmap* bm, const SavedImage* cur, const Save
bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
{
const GifFileType* gif = fGIF;
- if (NULL == gif)
+ if (nullptr == gif)
return false;
if (gif->ImageCount < 1) {
@@ -392,7 +392,7 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
}
SkColor bgColor = SkPackARGB32(0, 0, 0, 0);
- if (gif->SColorMap != NULL) {
+ if (gif->SColorMap != nullptr) {
const GifColorType& col = gif->SColorMap->Colors[fGIF->SBackGroundColor];
bgColor = SkColorSetARGB(0xFF, col.Red, col.Green, col.Blue);
}
@@ -404,7 +404,7 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
bool trans;
int disposal;
getTransparencyAndDisposalMethod(cur, &trans, &disposal);
- if (!trans && gif->SColorMap != NULL) {
+ if (!trans && gif->SColorMap != nullptr) {
fPaintingColor = bgColor;
} else {
fPaintingColor = SkColorSetARGB(0, 0, 0, 0);
@@ -446,7 +446,7 @@ SkMovie* Factory(SkStreamRewindable* stream) {
return new SkGIFMovie(stream);
}
}
- return NULL;
+ return nullptr;
}
static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory);
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index 1d8d98dafd..5ffd648893 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -343,7 +343,7 @@ static SkScaledBitmapSampler::RowProc
get_RGBA_to_4444_proc(const SkScaledBitmapSampler::Options& opts) {
if (!opts.fPremultiplyAlpha) {
// Unpremultiplied is not supported for 4444
- return NULL;
+ return nullptr;
}
if (opts.fSkipZeros) {
if (opts.fDither) {
@@ -515,7 +515,7 @@ static SkScaledBitmapSampler::RowProc
get_index_to_4444_proc(const SkScaledBitmapSampler::Options& opts) {
// Unpremul not allowed
if (!opts.fPremultiplyAlpha) {
- return NULL;
+ return nullptr;
}
if (opts.fSkipZeros) {
if (opts.fDither) {
@@ -548,7 +548,7 @@ static SkScaledBitmapSampler::RowProc
get_index_to_index_proc(const SkScaledBitmapSampler::Options& opts) {
// Unpremul not allowed
if (!opts.fPremultiplyAlpha) {
- return NULL;
+ return nullptr;
}
// Ignore dither and skip zeroes
return Sample_Index_DI;
@@ -563,14 +563,14 @@ static bool Sample_Gray_DA8(void* SK_RESTRICT dstRow,
// except we assume that there is alpha for speed, since an A8
// bitmap with no alpha is not interesting.
(void) Sample_Index_DI(dstRow, src, width, deltaSrc, /* y unused */ 0,
- /* ctable unused */ NULL);
+ /* ctable unused */ nullptr);
return true;
}
static SkScaledBitmapSampler::RowProc
get_gray_to_A8_proc(const SkScaledBitmapSampler::Options& opts) {
if (!opts.fPremultiplyAlpha) {
- return NULL;
+ return nullptr;
}
// Ignore skip and dither.
return Sample_Gray_DA8;
@@ -583,9 +583,9 @@ typedef SkScaledBitmapSampler::RowProc (*RowProcChooser)(const SkScaledBitmapSam
SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
int sampleSize) {
- fCTable = NULL;
- fDstRow = NULL;
- fRowProc = NULL;
+ fCTable = nullptr;
+ fDstRow = nullptr;
+ fRowProc = nullptr;
if (width <= 0 || height <= 0) {
sk_throw();
@@ -631,7 +631,7 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc,
get_RGBx_to_8888_proc,
get_RGBA_to_8888_proc,
get_index_to_8888_proc,
- NULL, // 565 to 8888
+ nullptr, // 565 to 8888
get_gray_to_565_proc,
get_RGBx_to_565_proc,
@@ -643,19 +643,19 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc,
get_RGBx_to_4444_proc,
get_RGBA_to_4444_proc,
get_index_to_4444_proc,
- NULL, // 565 to 4444
+ nullptr, // 565 to 4444
- NULL, // gray to index
- NULL, // rgbx to index
- NULL, // rgba to index
+ nullptr, // gray to index
+ nullptr, // rgbx to index
+ nullptr, // rgba to index
get_index_to_index_proc,
- NULL, // 565 to index
+ nullptr, // 565 to index
get_gray_to_A8_proc,
- NULL, // rgbx to a8
- NULL, // rgba to a8
- NULL, // index to a8
- NULL, // 565 to a8
+ nullptr, // rgbx to a8
+ nullptr, // rgba to a8
+ nullptr, // index to a8
+ nullptr, // 565 to a8
};
// The jump between dst configs in the table
@@ -716,15 +716,15 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc,
}
RowProcChooser chooser = gProcChoosers[index];
- if (NULL == chooser) {
- fRowProc = NULL;
+ if (nullptr == chooser) {
+ fRowProc = nullptr;
} else {
fRowProc = chooser(opts);
}
fDstRow = (char*)dst->getPixels();
fDstRowBytes = dst->rowBytes();
fCurrY = 0;
- return fRowProc != NULL;
+ return fRowProc != nullptr;
}
bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc,
@@ -794,41 +794,41 @@ public:
// ~D~U D~U ~DU DU
SkScaledBitmapSampler::RowProc gTestProcs[] = {
// Gray
- Sample_Gray_DA8, Sample_Gray_DA8, NULL, NULL, // to A8
- NULL, NULL, NULL, NULL, // to Index8
+ Sample_Gray_DA8, Sample_Gray_DA8, nullptr, nullptr, // to A8
+ nullptr, nullptr, nullptr, nullptr, // to Index8
Sample_Gray_D565, Sample_Gray_D565_D, Sample_Gray_D565, Sample_Gray_D565_D, // to 565
Sample_Gray_D4444, Sample_Gray_D4444_D, Sample_Gray_D4444, Sample_Gray_D4444_D, // to 4444
Sample_Gray_D8888, Sample_Gray_D8888, Sample_Gray_D8888, Sample_Gray_D8888, // to 8888
// Index
- NULL, NULL, NULL, NULL, // to A8
- Sample_Index_DI, Sample_Index_DI, NULL, NULL, // to Index8
+ nullptr, nullptr, nullptr, nullptr, // to A8
+ Sample_Index_DI, Sample_Index_DI, nullptr, nullptr, // to Index8
Sample_Index_D565, Sample_Index_D565_D, Sample_Index_D565, Sample_Index_D565_D, // to 565
- Sample_Index_D4444, Sample_Index_D4444_D, NULL, NULL, // to 4444
+ Sample_Index_D4444, Sample_Index_D4444_D, nullptr, nullptr, // to 4444
Sample_Index_D8888, Sample_Index_D8888, Sample_Index_D8888, Sample_Index_D8888, // to 8888
// RGB
- NULL, NULL, NULL, NULL, // to A8
- NULL, NULL, NULL, NULL, // to Index8
+ nullptr, nullptr, nullptr, nullptr, // to A8
+ nullptr, nullptr, nullptr, nullptr, // to Index8
Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Sample_RGBx_D565_D, // to 565
Sample_RGBx_D4444, Sample_RGBx_D4444_D, Sample_RGBx_D4444, Sample_RGBx_D4444_D, // to 4444
Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, // to 8888
// RGBx is the same as RGB
- NULL, NULL, NULL, NULL, // to A8
- NULL, NULL, NULL, NULL, // to Index8
+ nullptr, nullptr, nullptr, nullptr, // to A8
+ nullptr, nullptr, nullptr, nullptr, // to Index8
Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Sample_RGBx_D565_D, // to 565
Sample_RGBx_D4444, Sample_RGBx_D4444_D, Sample_RGBx_D4444, Sample_RGBx_D4444_D, // to 4444
Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, Sample_RGBx_D8888, // to 8888
// RGBA
- NULL, NULL, NULL, NULL, // to A8
- NULL, NULL, NULL, NULL, // to Index8
+ nullptr, nullptr, nullptr, nullptr, // to A8
+ nullptr, nullptr, nullptr, nullptr, // to Index8
Sample_RGBx_D565, Sample_RGBx_D565_D, Sample_RGBx_D565, Sample_RGBx_D565_D, // to 565
- Sample_RGBA_D4444, Sample_RGBA_D4444_D, NULL, NULL, // to 4444
+ Sample_RGBA_D4444, Sample_RGBA_D4444_D, nullptr, nullptr, // to 4444
Sample_RGBA_D8888, Sample_RGBA_D8888, Sample_RGBA_D8888_Unpremul, Sample_RGBA_D8888_Unpremul, // to 8888
// RGB_565
- NULL, NULL, NULL, NULL, // to A8
- NULL, NULL, NULL, NULL, // to Index8
+ nullptr, nullptr, nullptr, nullptr, // to A8
+ nullptr, nullptr, nullptr, nullptr, // to Index8
Sample_D565_D565, Sample_D565_D565, Sample_D565_D565, Sample_D565_D565, // to 565
- NULL, NULL, NULL, NULL, // to 4444
- NULL, NULL, NULL, NULL, // to 8888
+ nullptr, nullptr, nullptr, nullptr, // to 4444
+ nullptr, nullptr, nullptr, nullptr, // to 8888
};
// Dummy class that allows instantiation of an ImageDecoder, so begin can query its fields.
diff --git a/src/images/SkScaledBitmapSampler.h b/src/images/SkScaledBitmapSampler.h
index 90c4142bdf..198dc07572 100644
--- a/src/images/SkScaledBitmapSampler.h
+++ b/src/images/SkScaledBitmapSampler.h
@@ -49,9 +49,9 @@ public:
// prepares iterator to process the src colors and write them into dst.
// Returns false if the request cannot be fulfulled.
bool begin(SkBitmap* dst, SrcConfig sc, const SkImageDecoder& decoder,
- const SkPMColor* = NULL);
+ const SkPMColor* = nullptr);
bool begin(SkBitmap* dst, SrcConfig sc, const Options& opts,
- const SkPMColor* = NULL);
+ const SkPMColor* = nullptr);
// call with row of src pixels, for y = 0...scaledHeight-1.
// returns true if the row had non-opaque alpha in it
bool next(const uint8_t* SK_RESTRICT src);
diff --git a/src/images/bmpdecoderhelper.cpp b/src/images/bmpdecoderhelper.cpp
index 5a1b39ac90..9171b5d527 100644
--- a/src/images/bmpdecoderhelper.cpp
+++ b/src/images/bmpdecoderhelper.cpp
@@ -163,7 +163,7 @@ bool BmpDecoderHelper::DecodeImage(const char* p,
}
output_ = callback->SetSize(width_, height_);
- if (NULL == output_) {
+ if (nullptr == output_) {
return true; // meaning we succeeded, but they want us to stop now
}
diff --git a/src/images/bmpdecoderhelper.h b/src/images/bmpdecoderhelper.h
index a0116de833..b448734bbc 100644
--- a/src/images/bmpdecoderhelper.h
+++ b/src/images/bmpdecoderhelper.h
@@ -57,7 +57,7 @@ class BmpDecoderCallback {
/**
* This is called once for an image. It is passed the width and height and
* should return the address of a buffer that is large enough to store
- * all of the resulting pixels (widht * height * 3 bytes). If it returns NULL,
+ * all of the resulting pixels (widht * height * 3 bytes). If it returns nullptr,
* then the decoder will abort, but return true, as the caller has received
* valid dimensions.
*/
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index f65e5454a7..692e4ea3d6 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -11,8 +11,8 @@
bool SkCachingPixelRef::Install(SkImageGenerator* generator,
SkBitmap* dst) {
- SkASSERT(dst != NULL);
- if (NULL == generator) {
+ SkASSERT(dst != nullptr);
+ if (nullptr == generator) {
return false;
}
const SkImageInfo info = generator->getInfo();
@@ -32,7 +32,7 @@ SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
, fImageGenerator(generator)
, fErrorInDecoding(false)
, fRowBytes(rowBytes) {
- SkASSERT(fImageGenerator != NULL);
+ SkASSERT(fImageGenerator != nullptr);
}
SkCachingPixelRef::~SkCachingPixelRef() {
delete fImageGenerator;
@@ -62,9 +62,9 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
// Now bitmap should contain a concrete PixelRef of the decoded image.
void* pixels = fLockedBitmap.getPixels();
- SkASSERT(pixels != NULL);
+ SkASSERT(pixels != nullptr);
rec->fPixels = pixels;
- rec->fColorTable = NULL;
+ rec->fColorTable = nullptr;
rec->fRowBytes = fLockedBitmap.rowBytes();
return true;
}
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 898d7661fb..17b8c23d95 100644
--- a/src/lazy/SkDiscardableMemoryPool.cpp
+++ b/src/lazy/SkDiscardableMemoryPool.cpp
@@ -29,7 +29,7 @@ public:
/**
* Without mutex, will be not be thread safe.
*/
- DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = NULL);
+ DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = nullptr);
virtual ~DiscardableMemoryPool();
SkDiscardableMemory* create(size_t bytes) override;
@@ -99,8 +99,8 @@ PoolDiscardableMemory::PoolDiscardableMemory(DiscardableMemoryPool* pool,
, fLocked(true)
, fPointer(pointer)
, fBytes(bytes) {
- SkASSERT(fPool != NULL);
- SkASSERT(fPointer != NULL);
+ SkASSERT(fPool != nullptr);
+ SkASSERT(fPointer != nullptr);
SkASSERT(fBytes > 0);
fPool->ref();
}
@@ -146,7 +146,7 @@ DiscardableMemoryPool::~DiscardableMemoryPool() {
}
void DiscardableMemoryPool::dumpDownTo(size_t budget) {
- if (fMutex != NULL) {
+ if (fMutex != nullptr) {
fMutex->assertHeld();
}
if (fUsed <= budget) {
@@ -158,9 +158,9 @@ void DiscardableMemoryPool::dumpDownTo(size_t budget) {
while ((fUsed > budget) && (cur)) {
if (!cur->fLocked) {
PoolDiscardableMemory* dm = cur;
- SkASSERT(dm->fPointer != NULL);
+ SkASSERT(dm->fPointer != nullptr);
sk_free(dm->fPointer);
- dm->fPointer = NULL;
+ dm->fPointer = nullptr;
SkASSERT(fUsed >= dm->fBytes);
fUsed -= dm->fBytes;
cur = iter.prev();
@@ -175,8 +175,8 @@ void DiscardableMemoryPool::dumpDownTo(size_t budget) {
SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) {
void* addr = sk_malloc_flags(bytes, 0);
- if (NULL == addr) {
- return NULL;
+ if (nullptr == addr) {
+ return nullptr;
}
PoolDiscardableMemory* dm = new PoolDiscardableMemory(this, addr, bytes);
SkAutoMutexAcquire autoMutexAcquire(fMutex);
@@ -189,9 +189,9 @@ SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) {
void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) {
SkAutoMutexAcquire autoMutexAcquire(fMutex);
// This is called by dm's destructor.
- if (dm->fPointer != NULL) {
+ if (dm->fPointer != nullptr) {
sk_free(dm->fPointer);
- dm->fPointer = NULL;
+ dm->fPointer = nullptr;
SkASSERT(fUsed >= dm->fBytes);
fUsed -= dm->fBytes;
fList.remove(dm);
@@ -201,8 +201,8 @@ void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) {
}
bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) {
- SkASSERT(dm != NULL);
- if (NULL == dm->fPointer) {
+ SkASSERT(dm != nullptr);
+ if (nullptr == dm->fPointer) {
#if SK_LAZY_CACHE_STATS
SkAutoMutexAcquire autoMutexAcquire(fMutex);
++fCacheMisses;
@@ -210,7 +210,7 @@ bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) {
return false;
}
SkAutoMutexAcquire autoMutexAcquire(fMutex);
- if (NULL == dm->fPointer) {
+ if (nullptr == dm->fPointer) {
// May have been purged while waiting for lock.
#if SK_LAZY_CACHE_STATS
++fCacheMisses;
@@ -227,7 +227,7 @@ bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) {
}
void DiscardableMemoryPool::unlock(PoolDiscardableMemory* dm) {
- SkASSERT(dm != NULL);
+ SkASSERT(dm != nullptr);
SkAutoMutexAcquire autoMutexAcquire(fMutex);
dm->fLocked = false;
this->dumpDownTo(fBudget);
diff --git a/src/lazy/SkDiscardableMemoryPool.h b/src/lazy/SkDiscardableMemoryPool.h
index 33c176d3f2..92ba48bcb4 100644
--- a/src/lazy/SkDiscardableMemoryPool.h
+++ b/src/lazy/SkDiscardableMemoryPool.h
@@ -53,7 +53,7 @@ public:
* Without mutex, will be not be thread safe.
*/
static SkDiscardableMemoryPool* Create(
- size_t size, SkBaseMutex* mutex = NULL);
+ size_t size, SkBaseMutex* mutex = nullptr);
};
/**
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 01bfd83eee..9ac9819e92 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -17,10 +17,10 @@ SkDiscardablePixelRef::SkDiscardablePixelRef(const SkImageInfo& info,
, fGenerator(generator)
, fDMFactory(fact)
, fRowBytes(rowBytes)
- , fDiscardableMemory(NULL)
+ , fDiscardableMemory(nullptr)
, fDiscardableMemoryIsLocked(false)
{
- SkASSERT(fGenerator != NULL);
+ SkASSERT(fGenerator != nullptr);
SkASSERT(fRowBytes > 0);
// The SkImageGenerator contract requires fGenerator to always
// decode the same image on each call to getPixels().
@@ -39,7 +39,7 @@ SkDiscardablePixelRef::~SkDiscardablePixelRef() {
}
bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
- if (fDiscardableMemory != NULL) {
+ if (fDiscardableMemory != nullptr) {
if (fDiscardableMemory->lock()) {
fDiscardableMemoryIsLocked = true;
rec->fPixels = fDiscardableMemory->data();
@@ -48,20 +48,20 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
return true;
}
delete fDiscardableMemory;
- fDiscardableMemory = NULL;
+ fDiscardableMemory = nullptr;
fDiscardableMemoryIsLocked = false;
}
const size_t size = this->info().getSafeSize(fRowBytes);
- if (fDMFactory != NULL) {
+ if (fDMFactory != nullptr) {
fDiscardableMemory = fDMFactory->create(size);
fDiscardableMemoryIsLocked = true;
} else {
fDiscardableMemory = SkDiscardableMemory::Create(size);
fDiscardableMemoryIsLocked = true;
}
- if (NULL == fDiscardableMemory) {
+ if (nullptr == fDiscardableMemory) {
fDiscardableMemoryIsLocked = false;
return false; // Memory allocation failed.
}
@@ -75,7 +75,7 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
fDiscardableMemory->unlock();
fDiscardableMemoryIsLocked = false;
delete fDiscardableMemory;
- fDiscardableMemory = NULL;
+ fDiscardableMemory = nullptr;
return false;
}
@@ -87,7 +87,7 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
if (colorCount > 0) {
fCTable.reset(new SkColorTable(colors, colorCount));
} else {
- fCTable.reset(NULL);
+ fCTable.reset(nullptr);
}
rec->fPixels = pixels;
@@ -104,7 +104,7 @@ void SkDiscardablePixelRef::onUnlockPixels() {
bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, const SkIRect* subset, SkBitmap* dst,
SkDiscardableMemory::Factory* factory) {
SkAutoTDelete<SkImageGenerator> autoGenerator(generator);
- if (NULL == autoGenerator.get()) {
+ if (nullptr == autoGenerator.get()) {
return false;
}
@@ -145,10 +145,10 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, const SkIRect* su
// These are the public API
bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) {
- return SkInstallDiscardablePixelRef(generator, NULL, dst, NULL);
+ return SkInstallDiscardablePixelRef(generator, nullptr, dst, nullptr);
}
bool SkInstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded);
- return generator ? SkInstallDiscardablePixelRef(generator, NULL, dst, NULL) : false;
+ return generator ? SkInstallDiscardablePixelRef(generator, nullptr, dst, nullptr) : false;
}
diff --git a/src/opts/SkBitmapProcState_arm_neon.cpp b/src/opts/SkBitmapProcState_arm_neon.cpp
index fa302429d6..d1f71c270c 100644
--- a/src/opts/SkBitmapProcState_arm_neon.cpp
+++ b/src/opts/SkBitmapProcState_arm_neon.cpp
@@ -96,11 +96,11 @@ const SkBitmapProcState::SampleProc16 gSkBitmapProcStateSample16_neon[] = {
SI8_D16_filter_DX_neon,
// Don't support 4444 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support A8 -> 565
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
// Don't support G8 -> 565 (but we could)
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp
index f55a09938c..68d920d8d8 100644
--- a/src/opts/SkBitmapProcState_opts_SSE2.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp
@@ -14,7 +14,7 @@
void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s,
const uint32_t* xy,
int count, uint32_t* colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkASSERT(kN32_SkColorType == s.fPixmap.colorType());
SkASSERT(s.fAlphaScale == 256);
@@ -120,7 +120,7 @@ void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s,
void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s,
const uint32_t* xy,
int count, uint32_t* colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkASSERT(kN32_SkColorType == s.fPixmap.colorType());
SkASSERT(s.fAlphaScale < 256);
@@ -640,7 +640,7 @@ void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s,
void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s,
const uint32_t* xy,
int count, uint16_t* colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkASSERT(kN32_SkColorType == s.fPixmap.colorType());
SkASSERT(s.fPixmap.isOpaque());
diff --git a/src/opts/SkBitmapProcState_opts_SSSE3.cpp b/src/opts/SkBitmapProcState_opts_SSSE3.cpp
index 15a9664c08..8e381eb3c2 100644
--- a/src/opts/SkBitmapProcState_opts_SSSE3.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSSE3.cpp
@@ -393,7 +393,7 @@ template<bool has_alpha>
void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s,
const uint32_t* xy,
int count, uint32_t* colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkASSERT(kN32_SkColorType == s.fPixmap.colorType());
if (has_alpha) {
@@ -585,7 +585,7 @@ template<bool has_alpha>
void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s,
const uint32_t* xy,
int count, uint32_t* colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
SkASSERT(kN32_SkColorType == s.fPixmap.colorType());
if (has_alpha) {
diff --git a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
index 6b8195c660..dac4e20381 100644
--- a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
+++ b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp
@@ -15,7 +15,7 @@
static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, uint16_t* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const uint16_t* SK_RESTRICT table = s.fPixmap.ctable()->read16BitCache();
@@ -147,7 +147,7 @@ static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, SkPMColor* SK_RESTRICT colors) {
- SkASSERT(count > 0 && colors != NULL);
+ SkASSERT(count > 0 && colors != nullptr);
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors();
@@ -380,10 +380,10 @@ void SkBitmapProcState::platformProcs() {
case kIndex_8_SkColorType:
if (justDx && kNone_SkFilterQuality == fFilterLevel) {
fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp;
- fShaderProc16 = NULL;
+ fShaderProc16 = nullptr;
if (isOpaque) {
fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp;
- fShaderProc32 = NULL;
+ fShaderProc32 = nullptr;
}
}
break;
diff --git a/src/opts/SkBlitMask_opts_arm.cpp b/src/opts/SkBlitMask_opts_arm.cpp
index e58be5c4a5..c5a9ea4f3e 100644
--- a/src/opts/SkBlitMask_opts_arm.cpp
+++ b/src/opts/SkBlitMask_opts_arm.cpp
@@ -22,5 +22,5 @@ SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType dstCT,
SkMask::Format maskFormat,
RowFlags flags) {
- return NULL;
+ return nullptr;
}
diff --git a/src/opts/SkBlitMask_opts_none.cpp b/src/opts/SkBlitMask_opts_none.cpp
index 5c318c731b..f26ee783bd 100644
--- a/src/opts/SkBlitMask_opts_none.cpp
+++ b/src/opts/SkBlitMask_opts_none.cpp
@@ -8,11 +8,11 @@
#include "SkBlitMask.h"
SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
- return NULL;
+ return nullptr;
}
SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType dstCT,
SkMask::Format maskFormat,
RowFlags flags) {
- return NULL;
+ return nullptr;
}
diff --git a/src/opts/SkBlitRow_opts_arm.cpp b/src/opts/SkBlitRow_opts_arm.cpp
index d51b24b42e..5770c1f1d7 100644
--- a/src/opts/SkBlitRow_opts_arm.cpp
+++ b/src/opts/SkBlitRow_opts_arm.cpp
@@ -11,15 +11,15 @@
#include "SkBlitRow_opts_arm_neon.h"
static const SkBlitRow::Proc16 sk_blitrow_platform_565_procs_arm[] = {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
};
static const SkBlitRow::ColorProc16 sk_blitrow_platform_565_colorprocs_arm[] = {
- NULL, NULL,
+ nullptr, nullptr,
};
static const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm[] = {
- NULL, NULL, NULL, NULL,
+ nullptr, nullptr, nullptr, nullptr,
};
SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) {
@@ -35,6 +35,6 @@ SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
}
SkBlitRow::Color32Proc SkBlitRow::PlatformColor32Proc() {
- #define sk_blitrow_color32_arm NULL
+ #define sk_blitrow_color32_arm nullptr
return SK_ARM_NEON_WRAP(sk_blitrow_color32_arm);
}
diff --git a/src/opts/SkBlitRow_opts_arm_neon.cpp b/src/opts/SkBlitRow_opts_arm_neon.cpp
index 4db82a5070..d5260afd50 100644
--- a/src/opts/SkBlitRow_opts_arm_neon.cpp
+++ b/src/opts/SkBlitRow_opts_arm_neon.cpp
@@ -1541,14 +1541,14 @@ const SkBlitRow::Proc16 sk_blitrow_platform_565_procs_arm_neon[] = {
#if 0
S32A_D565_Blend_neon,
#else
- NULL, // https://code.google.com/p/skia/issues/detail?id=2797
+ nullptr, // https://code.google.com/p/skia/issues/detail?id=2797
#endif
// dither
S32_D565_Opaque_Dither_neon,
S32_D565_Blend_Dither_neon,
S32A_D565_Opaque_Dither_neon,
- NULL, // S32A_D565_Blend_Dither
+ nullptr, // S32A_D565_Blend_Dither
};
const SkBlitRow::ColorProc16 sk_blitrow_platform_565_colorprocs_arm_neon[] = {
@@ -1559,7 +1559,7 @@ const SkBlitRow::ColorProc16 sk_blitrow_platform_565_colorprocs_arm_neon[] = {
};
const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[] = {
- NULL, // S32_Opaque,
+ nullptr, // S32_Opaque,
S32_Blend_BlitRow32_neon, // S32_Blend,
/*
* We have two choices for S32A_Opaque procs. The one reads the src alpha
@@ -1579,7 +1579,7 @@ const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[] = {
#ifdef SK_CPU_ARM32
S32A_Blend_BlitRow32_neon // S32A_Blend
#else
- NULL
+ nullptr
#endif
};
diff --git a/src/opts/SkBlitRow_opts_mips_dsp.cpp b/src/opts/SkBlitRow_opts_mips_dsp.cpp
index c6747f0960..e25f7c5f19 100644
--- a/src/opts/SkBlitRow_opts_mips_dsp.cpp
+++ b/src/opts/SkBlitRow_opts_mips_dsp.cpp
@@ -920,7 +920,7 @@ void blitmask_d565_opaque_mips(int width, int height, uint16_t* device,
const SkBlitRow::Proc16 platform_565_procs_mips_dsp[] = {
// no dither
- NULL,
+ nullptr,
S32_D565_Blend_mips_dsp,
S32A_D565_Opaque_mips_dsp,
S32A_D565_Blend_mips_dsp,
@@ -929,14 +929,14 @@ const SkBlitRow::Proc16 platform_565_procs_mips_dsp[] = {
S32_D565_Opaque_Dither_mips_dsp,
S32_D565_Blend_Dither_mips_dsp,
S32A_D565_Opaque_Dither_mips_dsp,
- NULL,
+ nullptr,
};
static const SkBlitRow::Proc32 platform_32_procs_mips_dsp[] = {
- NULL, // S32_Opaque,
+ nullptr, // S32_Opaque,
S32_Blend_BlitRow32_mips_dsp, // S32_Blend,
- NULL, // S32A_Opaque,
- NULL, // S32A_Blend,
+ nullptr, // S32A_Opaque,
+ nullptr, // S32A_Blend,
};
SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) {
@@ -944,7 +944,7 @@ SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) {
}
SkBlitRow::ColorProc16 SkBlitRow::PlatformColorFactory565(unsigned flags) {
- return NULL;
+ return nullptr;
}
SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
diff --git a/src/opts/SkBlitRow_opts_none.cpp b/src/opts/SkBlitRow_opts_none.cpp
index 86bb2219f3..03298e888e 100644
--- a/src/opts/SkBlitRow_opts_none.cpp
+++ b/src/opts/SkBlitRow_opts_none.cpp
@@ -10,15 +10,15 @@
// Platform impl of Platform_procs with no overrides
SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) {
- return NULL;
+ return nullptr;
}
SkBlitRow::ColorProc16 SkBlitRow::PlatformColorFactory565(unsigned flags) {
- return NULL;
+ return nullptr;
}
SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
- return NULL;
+ return nullptr;
}
-SkBlitRow::Color32Proc SkBlitRow::PlatformColor32Proc() { return NULL; }
+SkBlitRow::Color32Proc SkBlitRow::PlatformColor32Proc() { return nullptr; }
diff --git a/src/opts/SkXfermode_opts.h b/src/opts/SkXfermode_opts.h
index 673387b86a..7005d593af 100644
--- a/src/opts/SkXfermode_opts.h
+++ b/src/opts/SkXfermode_opts.h
@@ -201,7 +201,7 @@ public:
, fAAProc4(aaproc4) {}
void xfer32(SkPMColor dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override {
- if (NULL == aa) {
+ if (nullptr == aa) {
Sk4px::MapDstSrc(n, dst, src, [&](const Sk4px& dst4, const Sk4px& src4) {
return fProc4(src4, dst4);
});
@@ -214,7 +214,7 @@ public:
}
void xfer16(uint16_t dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override {
- if (NULL == aa) {
+ if (nullptr == aa) {
Sk4px::MapDstSrc(n, dst, src, [&](const Sk4px& dst4, const Sk4px& src4) {
return fProc4(src4, dst4);
});
diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp
index 2e140e8df6..d3450c1dfc 100644
--- a/src/opts/opts_check_x86.cpp
+++ b/src/opts/opts_check_x86.cpp
@@ -190,26 +190,26 @@ void SkBitmapProcState::platformProcs() {
static const SkBlitRow::Proc16 platform_16_procs[] = {
S32_D565_Opaque_SSE2, // S32_D565_Opaque
- NULL, // S32_D565_Blend
+ nullptr, // S32_D565_Blend
S32A_D565_Opaque_SSE2, // S32A_D565_Opaque
- NULL, // S32A_D565_Blend
+ nullptr, // S32A_D565_Blend
S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither
- NULL, // S32_D565_Blend_Dither
+ nullptr, // S32_D565_Blend_Dither
S32A_D565_Opaque_Dither_SSE2, // S32A_D565_Opaque_Dither
- NULL, // S32A_D565_Blend_Dither
+ nullptr, // S32A_D565_Blend_Dither
};
SkBlitRow::Proc16 SkBlitRow::PlatformFactory565(unsigned flags) {
if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
return platform_16_procs[flags];
} else {
- return NULL;
+ return nullptr;
}
}
static const SkBlitRow::ColorProc16 platform_565_colorprocs_SSE2[] = {
Color32A_D565_SSE2, // Color32A_D565,
- NULL, // Color32A_D565_Dither
+ nullptr, // Color32A_D565_Dither
};
SkBlitRow::ColorProc16 SkBlitRow::PlatformColorFactory565(unsigned flags) {
@@ -221,19 +221,19 @@ SkBlitRow::ColorProc16 SkBlitRow::PlatformColorFactory565(unsigned flags) {
if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
return platform_565_colorprocs_SSE2[flags];
} else {
- return NULL;
+ return nullptr;
}
}
static const SkBlitRow::Proc32 platform_32_procs_SSE2[] = {
- NULL, // S32_Opaque,
+ nullptr, // S32_Opaque,
S32_Blend_BlitRow32_SSE2, // S32_Blend,
S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque
S32A_Blend_BlitRow32_SSE2, // S32A_Blend,
};
static const SkBlitRow::Proc32 platform_32_procs_SSE4[] = {
- NULL, // S32_Opaque,
+ nullptr, // S32_Opaque,
S32_Blend_BlitRow32_SSE2, // S32_Blend,
S32A_Opaque_BlitRow32_SSE4, // S32A_Opaque
S32A_Blend_BlitRow32_SSE2, // S32A_Blend,
@@ -246,7 +246,7 @@ SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
return platform_32_procs_SSE2[flags];
} else {
- return NULL;
+ return nullptr;
}
}
@@ -260,11 +260,11 @@ SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
return SkBlitLCD16Row_SSE2;
}
} else {
- return NULL;
+ return nullptr;
}
}
SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType, SkMask::Format, RowFlags) {
- return NULL;
+ return nullptr;
}
diff --git a/src/pathops/SkDConicLineIntersection.cpp b/src/pathops/SkDConicLineIntersection.cpp
index c9d825d56c..e6d775f76e 100644
--- a/src/pathops/SkDConicLineIntersection.cpp
+++ b/src/pathops/SkDConicLineIntersection.cpp
@@ -25,8 +25,8 @@ public:
LineConicIntersections(const SkDConic& c)
: fConic(c)
- SkDEBUGPARAMS(fLine(NULL))
- SkDEBUGPARAMS(fIntersections(NULL))
+ SkDEBUGPARAMS(fLine(nullptr))
+ SkDEBUGPARAMS(fIntersections(nullptr))
SkDEBUGPARAMS(fAllowNear(false)) {
}
@@ -39,7 +39,7 @@ public:
for (int index = 0; index < last; ) {
double conicMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
SkDPoint conicMidPt = fConic.ptAtT(conicMidT);
- double t = fLine->nearPoint(conicMidPt, NULL);
+ double t = fLine->nearPoint(conicMidPt, nullptr);
if (t < 0) {
++index;
continue;
@@ -186,7 +186,7 @@ protected:
if (fIntersections->hasT(conicT)) {
continue;
}
- double lineT = fLine->nearPoint(fConic[cIndex], NULL);
+ double lineT = fLine->nearPoint(fConic[cIndex], nullptr);
if (lineT < 0) {
continue;
}
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
index ee1e3d3a34..cbdce7789a 100644
--- a/src/pathops/SkDCubicLineIntersection.cpp
+++ b/src/pathops/SkDCubicLineIntersection.cpp
@@ -98,7 +98,7 @@ public:
for (int index = 0; index < last; ) {
double cubicMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
SkDPoint cubicMidPt = fCubic.ptAtT(cubicMidT);
- double t = fLine.nearPoint(cubicMidPt, NULL);
+ double t = fLine.nearPoint(cubicMidPt, nullptr);
if (t < 0) {
++index;
continue;
@@ -285,7 +285,7 @@ public:
if (fIntersections->hasT(cubicT)) {
continue;
}
- double lineT = fLine.nearPoint(fCubic[cIndex], NULL);
+ double lineT = fLine.nearPoint(fCubic[cIndex], nullptr);
if (lineT < 0) {
continue;
}
diff --git a/src/pathops/SkDLineIntersection.cpp b/src/pathops/SkDLineIntersection.cpp
index bfbbc7e07e..6fbac978b6 100644
--- a/src/pathops/SkDLineIntersection.cpp
+++ b/src/pathops/SkDLineIntersection.cpp
@@ -235,12 +235,12 @@ int SkIntersections::horizontal(const SkDLine& line, double left, double right,
}
}
if (fAllowNear || result == 2) {
- if ((t = line.nearPoint(leftPt, NULL)) >= 0) {
+ if ((t = line.nearPoint(leftPt, nullptr)) >= 0) {
insert(t, (double) flipped, leftPt);
}
if (left != right) {
const SkDPoint rightPt = { right, y };
- if ((t = line.nearPoint(rightPt, NULL)) >= 0) {
+ if ((t = line.nearPoint(rightPt, nullptr)) >= 0) {
insert(t, (double) !flipped, rightPt);
}
for (int index = 0; index < 2; ++index) {
@@ -311,12 +311,12 @@ int SkIntersections::vertical(const SkDLine& line, double top, double bottom,
}
}
if (fAllowNear || result == 2) {
- if ((t = line.nearPoint(topPt, NULL)) >= 0) {
+ if ((t = line.nearPoint(topPt, nullptr)) >= 0) {
insert(t, (double) flipped, topPt);
}
if (top != bottom) {
SkDPoint bottomPt = { x, bottom };
- if ((t = line.nearPoint(bottomPt, NULL)) >= 0) {
+ if ((t = line.nearPoint(bottomPt, nullptr)) >= 0) {
insert(t, (double) !flipped, bottomPt);
}
for (int index = 0; index < 2; ++index) {
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp
index 5e3596ec20..64eb86848e 100644
--- a/src/pathops/SkDQuadLineIntersection.cpp
+++ b/src/pathops/SkDQuadLineIntersection.cpp
@@ -103,8 +103,8 @@ public:
LineQuadraticIntersections(const SkDQuad& q)
: fQuad(q)
- SkDEBUGPARAMS(fLine(NULL))
- SkDEBUGPARAMS(fIntersections(NULL))
+ SkDEBUGPARAMS(fLine(nullptr))
+ SkDEBUGPARAMS(fIntersections(nullptr))
SkDEBUGPARAMS(fAllowNear(false)) {
}
@@ -117,7 +117,7 @@ public:
for (int index = 0; index < last; ) {
double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
SkDPoint quadMidPt = fQuad.ptAtT(quadMidT);
- double t = fLine->nearPoint(quadMidPt, NULL);
+ double t = fLine->nearPoint(quadMidPt, nullptr);
if (t < 0) {
++index;
continue;
@@ -291,7 +291,7 @@ protected:
if (fIntersections->hasT(quadT)) {
continue;
}
- double lineT = fLine->nearPoint(fQuad[qIndex], NULL);
+ double lineT = fLine->nearPoint(fQuad[qIndex], nullptr);
if (lineT < 0) {
continue;
}
diff --git a/src/pathops/SkIntersectionHelper.h b/src/pathops/SkIntersectionHelper.h
index 79de034706..647b94b35f 100644
--- a/src/pathops/SkIntersectionHelper.h
+++ b/src/pathops/SkIntersectionHelper.h
@@ -25,7 +25,7 @@ public:
bool advance() {
fSegment = fSegment->next();
- return fSegment != NULL;
+ return fSegment != nullptr;
}
SkScalar bottom() const {
@@ -76,7 +76,7 @@ public:
bool startAfter(const SkIntersectionHelper& after) {
fSegment = after.fSegment->next();
- return fSegment != NULL;
+ return fSegment != nullptr;
}
SkScalar top() const {
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp
index ac596fd408..bb10e53b8b 100644
--- a/src/pathops/SkOpAngle.cpp
+++ b/src/pathops/SkOpAngle.cpp
@@ -349,7 +349,7 @@ bool SkOpAngle::computeSector() {
goto recomputeSector;
} while (!oSpan->final() && (oSpan = oSpan->upCast()->next()));
checkEnd = stepUp ? !checkEnd->final()
- ? checkEnd->upCast()->next() : NULL
+ ? checkEnd->upCast()->next() : nullptr
: checkEnd->prev();
} while (checkEnd);
recomputeSector:
@@ -659,7 +659,7 @@ void SkOpAngle::insert(SkOpAngle* angle) {
}
return;
}
- bool singleton = NULL == fNext;
+ bool singleton = nullptr == fNext;
if (singleton) {
fNext = this;
}
@@ -703,7 +703,7 @@ void SkOpAngle::insert(SkOpAngle* angle) {
SkOpSpanBase* SkOpAngle::lastMarked() const {
if (fLastMarked) {
if (fLastMarked->chased()) {
- return NULL;
+ return nullptr;
}
fLastMarked->setChased(true);
}
@@ -759,7 +759,7 @@ bool SkOpAngle::merge(SkOpAngle* angle) {
} while (working != angle);
do {
SkOpAngle* next = working->fNext;
- working->fNext = NULL;
+ working->fNext = nullptr;
insert(working);
working = next;
} while (working != angle);
@@ -877,7 +877,7 @@ void SkOpAngle::set(SkOpSpanBase* start, SkOpSpanBase* end) {
fStart = start;
fComputedEnd = fEnd = end;
SkASSERT(start != end);
- fNext = NULL;
+ fNext = nullptr;
fComputeSector = fComputedSector = fCheckCoincidence = false;
setSpans();
setSector();
@@ -929,7 +929,7 @@ void SkOpAngle::setCurveHullSweep() {
void SkOpAngle::setSpans() {
fUnorderable = false;
- fLastMarked = NULL;
+ fLastMarked = nullptr;
if (!fStart) {
fUnorderable = true;
return;
diff --git a/src/pathops/SkOpBuilder.cpp b/src/pathops/SkOpBuilder.cpp
index 24a157afc5..4f53dee056 100644
--- a/src/pathops/SkOpBuilder.cpp
+++ b/src/pathops/SkOpBuilder.cpp
@@ -44,7 +44,7 @@ void FixWinding(SkPath* path) {
}
SkChunkAlloc allocator(4096);
SkOpContourHead contourHead;
- SkOpGlobalState globalState(NULL, &contourHead SkDEBUGPARAMS(NULL));
+ SkOpGlobalState globalState(nullptr, &contourHead SkDEBUGPARAMS(nullptr));
SkOpEdgeBuilder builder(*path, &contourHead, &allocator, &globalState);
builder.finish(&allocator);
SkASSERT(contourHead.next());
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index 46d06e9e0b..fb2de5ac60 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -217,7 +217,7 @@ bool SkOpCoincidence::addMissing(SkChunkAlloc* allocator) {
}
bool result;
fTop = outer;
- fHead = NULL;
+ fHead = nullptr;
do {
// addifmissing can modify the list that this is walking
// maybe save head so that walker can iterate over old data unperturbed
@@ -467,7 +467,7 @@ bool SkOpCoincidence::apply() {
void SkOpCoincidence::detach(SkCoincidentSpans* remove) {
SkCoincidentSpans* coin = fHead;
- SkCoincidentSpans* prev = NULL;
+ SkCoincidentSpans* prev = nullptr;
SkCoincidentSpans* next;
do {
next = coin->fNext;
@@ -505,7 +505,7 @@ bool SkOpCoincidence::expand() {
expanded = true;
}
}
- SkOpSpanBase* next = end->final() ? NULL : end->upCast()->next();
+ SkOpSpanBase* next = end->final() ? nullptr : end->upCast()->next();
if (next && (oppPtT = next->contains(oppSegment))) {
double midT = (end->t() + next->t()) / 2;
if (segment->isClose(midT, oppSegment)) {
@@ -519,7 +519,7 @@ bool SkOpCoincidence::expand() {
}
void SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps, SkChunkAlloc* allocator) const {
- overlaps->fHead = overlaps->fTop = NULL;
+ overlaps->fHead = overlaps->fTop = nullptr;
SkDEBUGCODE_(overlaps->debugSetGlobalState(fDebugState));
SkCoincidentSpans* outer = fHead;
while (outer) {
diff --git a/src/pathops/SkOpCoincidence.h b/src/pathops/SkOpCoincidence.h
index 83ba70a0f9..86c6577739 100644
--- a/src/pathops/SkOpCoincidence.h
+++ b/src/pathops/SkOpCoincidence.h
@@ -27,9 +27,9 @@ struct SkCoincidentSpans {
class SkOpCoincidence {
public:
SkOpCoincidence()
- : fHead(NULL)
- , fTop(NULL)
- SkDEBUGPARAMS(fDebugState(NULL))
+ : fHead(nullptr)
+ , fTop(nullptr)
+ SkDEBUGPARAMS(fDebugState(nullptr))
{
}
@@ -43,19 +43,19 @@ public:
SkOpPtT* oppPtTEnd, bool flipped);
const SkOpAngle* debugAngle(int id) const {
- return SkDEBUGRELEASE(fDebugState->debugAngle(id), NULL);
+ return SkDEBUGRELEASE(fDebugState->debugAngle(id), nullptr);
}
SkOpContour* debugContour(int id) {
- return SkDEBUGRELEASE(fDebugState->debugContour(id), NULL);
+ return SkDEBUGRELEASE(fDebugState->debugContour(id), nullptr);
}
const SkOpPtT* debugPtT(int id) const {
- return SkDEBUGRELEASE(fDebugState->debugPtT(id), NULL);
+ return SkDEBUGRELEASE(fDebugState->debugPtT(id), nullptr);
}
const SkOpSegment* debugSegment(int id) const {
- return SkDEBUGRELEASE(fDebugState->debugSegment(id), NULL);
+ return SkDEBUGRELEASE(fDebugState->debugSegment(id), nullptr);
}
void debugSetGlobalState(SkOpGlobalState* debugState) {
@@ -65,7 +65,7 @@ public:
void debugShowCoincidence() const;
const SkOpSpanBase* debugSpan(int id) const {
- return SkDEBUGRELEASE(fDebugState->debugSpan(id), NULL);
+ return SkDEBUGRELEASE(fDebugState->debugSpan(id), nullptr);
}
void detach(SkCoincidentSpans* );
diff --git a/src/pathops/SkOpContour.cpp b/src/pathops/SkOpContour.cpp
index 18b6328a7e..2e4b2ca56a 100644
--- a/src/pathops/SkOpContour.cpp
+++ b/src/pathops/SkOpContour.cpp
@@ -34,7 +34,7 @@ SkOpSegment* SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4],
default:
SkASSERT(0);
}
- return NULL;
+ return nullptr;
}
void SkOpContour::toPath(SkPathWriter* path) const {
@@ -66,5 +66,5 @@ SkOpSegment* SkOpContour::undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase**
segment->undoneSpan(startPtr, endPtr);
return segment;
} while ((segment = segment->next()));
- return NULL;
+ return nullptr;
}
diff --git a/src/pathops/SkOpContour.h b/src/pathops/SkOpContour.h
index 7ef68b0377..b4200080b2 100644
--- a/src/pathops/SkOpContour.h
+++ b/src/pathops/SkOpContour.h
@@ -81,7 +81,7 @@ public:
SkOpContour* appendContour(SkChunkAlloc* allocator) {
SkOpContour* contour = SkOpTAllocator<SkOpContour>::New(allocator);
- contour->setNext(NULL);
+ contour->setNext(nullptr);
SkOpContour* prev = this;
SkOpContour* next;
while ((next = prev->next())) {
@@ -129,23 +129,23 @@ public:
#endif
const SkOpAngle* debugAngle(int id) const {
- return SkDEBUGRELEASE(this->globalState()->debugAngle(id), NULL);
+ return SkDEBUGRELEASE(this->globalState()->debugAngle(id), nullptr);
}
SkOpContour* debugContour(int id) {
- return SkDEBUGRELEASE(this->globalState()->debugContour(id), NULL);
+ return SkDEBUGRELEASE(this->globalState()->debugContour(id), nullptr);
}
const SkOpPtT* debugPtT(int id) const {
- return SkDEBUGRELEASE(this->globalState()->debugPtT(id), NULL);
+ return SkDEBUGRELEASE(this->globalState()->debugPtT(id), nullptr);
}
const SkOpSegment* debugSegment(int id) const {
- return SkDEBUGRELEASE(this->globalState()->debugSegment(id), NULL);
+ return SkDEBUGRELEASE(this->globalState()->debugSegment(id), nullptr);
}
const SkOpSpanBase* debugSpan(int id) const {
- return SkDEBUGRELEASE(this->globalState()->debugSpan(id), NULL);
+ return SkDEBUGRELEASE(this->globalState()->debugSpan(id), nullptr);
}
SkOpGlobalState* globalState() const {
@@ -155,7 +155,7 @@ public:
void debugValidate() const {
#if DEBUG_VALIDATE
const SkOpSegment* segment = &fHead;
- const SkOpSegment* prior = NULL;
+ const SkOpSegment* prior = nullptr;
do {
segment->debugValidate();
SkASSERT(segment->prev() == prior);
@@ -302,7 +302,7 @@ public:
SkASSERT(fCount == 0);
return;
}
- SkASSERT(contour->fNext == NULL);
+ SkASSERT(contour->fNext == nullptr);
SkOpContour* prev = this;
SkOpContour* next;
while ((next = prev->next()) != contour) {
@@ -310,12 +310,12 @@ public:
prev = next;
}
SkASSERT(prev);
- prev->setNext(NULL);
+ prev->setNext(nullptr);
}
void reset() {
- fTail = NULL;
- fNext = NULL;
+ fTail = nullptr;
+ fNext = nullptr;
fCount = 0;
fDone = false;
fTopsFound = false;
diff --git a/src/pathops/SkOpEdgeBuilder.h b/src/pathops/SkOpEdgeBuilder.h
index f81f727784..f11e0e4c89 100644
--- a/src/pathops/SkOpEdgeBuilder.h
+++ b/src/pathops/SkOpEdgeBuilder.h
@@ -37,7 +37,7 @@ public:
void complete() {
if (fCurrentContour && fCurrentContour->count()) {
fCurrentContour->complete();
- fCurrentContour = NULL;
+ fCurrentContour = nullptr;
}
}
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index a52ef4ace1..99af13a04e 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -50,7 +50,7 @@ SkOpAngle* SkOpSegment::activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr
if (SkOpAngle* result = activeAngleOther(start, startPtr, endPtr, done)) {
return result;
}
- return NULL;
+ return nullptr;
}
SkOpAngle* SkOpSegment::activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr,
@@ -91,7 +91,7 @@ SkOpAngle* SkOpSegment::activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** sta
SkASSERT(downSpan->done());
}
}
- return NULL;
+ return nullptr;
}
SkOpAngle* SkOpSegment::activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr,
@@ -297,7 +297,7 @@ void SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end,
}
SkOpPtT* SkOpSegment::addMissing(double t, SkOpSegment* opp, SkChunkAlloc* allocator) {
- SkOpSpanBase* existing = NULL;
+ SkOpSpanBase* existing = nullptr;
SkOpSpanBase* test = &fHead;
double testT;
do {
@@ -373,7 +373,7 @@ SkOpPtT* SkOpSegment::addT(double t, AllowAlias allowAlias, SkChunkAlloc* alloca
SkASSERT(span != &fTail);
} while ((span = span->upCast()->next()));
SkASSERT(0);
- return NULL;
+ return nullptr;
}
// choose a solitary t and pt value; remove aliases; align the opposite ends
@@ -519,7 +519,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
SkOpAngle::IncludeType includeType) {
SkASSERT(includeType != SkOpAngle::kUnaryXor);
SkOpAngle* firstAngle = this->spanToAngle(end, start);
- if (NULL == firstAngle || NULL == firstAngle->next()) {
+ if (nullptr == firstAngle || nullptr == firstAngle->next()) {
return SK_NaN32;
}
// if all angles have a computed winding,
@@ -528,7 +528,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
// there's nothing to do
// if two orderable angles are adjacent, and both are next to orderable angles,
// and one has winding computed, transfer to the other
- SkOpAngle* baseAngle = NULL;
+ SkOpAngle* baseAngle = nullptr;
bool tryReverse = false;
// look for counterclockwise transfers
SkOpAngle* angle = firstAngle->previous();
@@ -541,7 +541,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
SkASSERT(prior->next() == angle);
SkASSERT(angle->next() == next);
if (prior->unorderable() || angle->unorderable() || next->unorderable()) {
- baseAngle = NULL;
+ baseAngle = nullptr;
continue;
}
int testWinding = angle->starter()->windSum();
@@ -552,7 +552,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
}
if (baseAngle) {
ComputeOneSum(baseAngle, angle, includeType);
- baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : NULL;
+ baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : nullptr;
}
} while (next != firstAngle);
if (baseAngle && SK_MinS32 == firstAngle->starter()->windSum()) {
@@ -560,7 +560,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
tryReverse = true;
}
if (tryReverse) {
- baseAngle = NULL;
+ baseAngle = nullptr;
SkOpAngle* prior = firstAngle;
do {
angle = prior;
@@ -568,7 +568,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
SkASSERT(prior->next() == angle);
next = angle->next();
if (prior->unorderable() || angle->unorderable() || next->unorderable()) {
- baseAngle = NULL;
+ baseAngle = nullptr;
continue;
}
int testWinding = angle->starter()->windSum();
@@ -578,7 +578,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end,
}
if (baseAngle) {
ComputeOneSumReverse(baseAngle, angle, includeType);
- baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : NULL;
+ baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : nullptr;
}
} while (prior != firstAngle);
}
@@ -646,7 +646,7 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa
#endif
SkOpSpan* startSpan = start->starter(end);
if (startSpan->done()) {
- return NULL;
+ return nullptr;
}
markDone(startSpan);
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev();
@@ -663,13 +663,13 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa
if (!sortable) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
SkOpAngle* angle = this->spanToAngle(end, start);
if (angle->unorderable()) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
#if DEBUG_SORT
SkDebugf("%s\n", __FUNCTION__);
@@ -679,14 +679,14 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa
if (sumMiWinding == SK_MinS32) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
int sumSuWinding = updateOppWinding(end, start);
if (operand()) {
SkTSwap<int>(sumMiWinding, sumSuWinding);
}
SkOpAngle* nextAngle = angle->next();
- const SkOpAngle* foundAngle = NULL;
+ const SkOpAngle* foundAngle = nullptr;
bool foundDone = false;
// iterate through the angle, and compute everyone's winding
SkOpSegment* nextSegment;
@@ -724,7 +724,7 @@ SkOpSegment* SkOpSegment::findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBa
} while ((nextAngle = nextAngle->next()) != angle);
start->segment()->markDone(start->starter(end));
if (!foundAngle) {
- return NULL;
+ return nullptr;
}
*nextStart = foundAngle->start();
*nextEnd = foundAngle->end();
@@ -751,7 +751,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase,
#endif
SkOpSpan* startSpan = start->starter(end);
if (startSpan->done()) {
- return NULL;
+ return nullptr;
}
markDone(startSpan);
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev();
@@ -768,13 +768,13 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase,
if (!sortable) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
SkOpAngle* angle = this->spanToAngle(end, start);
if (angle->unorderable()) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
#if DEBUG_SORT
SkDebugf("%s\n", __FUNCTION__);
@@ -782,7 +782,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase,
#endif
int sumWinding = updateWinding(end, start);
SkOpAngle* nextAngle = angle->next();
- const SkOpAngle* foundAngle = NULL;
+ const SkOpAngle* foundAngle = nullptr;
bool foundDone = false;
// iterate through the angle, and compute everyone's winding
SkOpSegment* nextSegment;
@@ -820,7 +820,7 @@ SkOpSegment* SkOpSegment::findNextWinding(SkTDArray<SkOpSpanBase*>* chase,
} while ((nextAngle = nextAngle->next()) != angle);
start->segment()->markDone(start->starter(end));
if (!foundAngle) {
- return NULL;
+ return nullptr;
}
*nextStart = foundAngle->start();
*nextEnd = foundAngle->end();
@@ -847,7 +847,7 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n
#endif
SkOpSpan* startSpan = start->starter(end);
if (startSpan->done()) {
- return NULL;
+ return nullptr;
}
markDone(startSpan);
*nextEnd = step > 0 ? (*nextStart)->upCast()->next() : (*nextStart)->prev();
@@ -863,14 +863,14 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n
if (!angle || angle->unorderable()) {
*unsortable = true;
markDone(start->starter(end));
- return NULL;
+ return nullptr;
}
#if DEBUG_SORT
SkDebugf("%s\n", __FUNCTION__);
angle->debugLoop();
#endif
SkOpAngle* nextAngle = angle->next();
- const SkOpAngle* foundAngle = NULL;
+ const SkOpAngle* foundAngle = nullptr;
bool foundDone = false;
// iterate through the angle, and compute everyone's winding
SkOpSegment* nextSegment;
@@ -888,7 +888,7 @@ SkOpSegment* SkOpSegment::findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** n
} while (nextAngle != angle);
start->segment()->markDone(start->starter(end));
if (!foundAngle) {
- return NULL;
+ return nullptr;
}
*nextStart = foundAngle->start();
*nextEnd = foundAngle->end();
@@ -906,7 +906,7 @@ SkOpGlobalState* SkOpSegment::globalState() const {
void SkOpSegment::init(SkPoint pts[], SkScalar weight, SkOpContour* contour, SkPath::Verb verb) {
fContour = contour;
- fNext = NULL;
+ fNext = nullptr;
fOriginal[0] = pts[0];
fOriginal[1] = pts[SkPathOpsVerbToPoints(verb)];
fPts = pts;
@@ -918,7 +918,7 @@ void SkOpSegment::init(SkPoint pts[], SkScalar weight, SkOpContour* contour, SkP
fTopsFound = false;
fVisited = false;
SkOpSpan* zeroSpan = &fHead;
- zeroSpan->init(this, NULL, 0, fPts[0]);
+ zeroSpan->init(this, nullptr, 0, fPts[0]);
SkOpSpanBase* oneSpan = &fTail;
zeroSpan->setNext(oneSpan);
oneSpan->initBase(this, zeroSpan, 1, fPts[SkPathOpsVerbToPoints(fVerb)]);
@@ -955,7 +955,7 @@ SkOpSpanBase* SkOpSegment::markAndChaseDone(SkOpSpanBase* start, SkOpSpanBase* e
int step = start->step(end);
SkOpSpan* minSpan = start->starter(end);
markDone(minSpan);
- SkOpSpanBase* last = NULL;
+ SkOpSpanBase* last = nullptr;
SkOpSegment* other = this;
while ((other = other->nextChase(&start, &step, &minSpan, &last))) {
if (other->done()) {
@@ -972,7 +972,7 @@ bool SkOpSegment::markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, in
SkOpSpan* spanStart = start->starter(end);
int step = start->step(end);
bool success = markWinding(spanStart, winding);
- SkOpSpanBase* last = NULL;
+ SkOpSpanBase* last = nullptr;
SkOpSegment* other = this;
while ((other = other->nextChase(&start, &step, &spanStart, &last))) {
if (spanStart->windSum() != SK_MinS32) {
@@ -993,7 +993,7 @@ bool SkOpSegment::markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end,
SkOpSpan* spanStart = start->starter(end);
int step = start->step(end);
bool success = markWinding(spanStart, winding, oppWinding);
- SkOpSpanBase* last = NULL;
+ SkOpSpanBase* last = nullptr;
SkOpSegment* other = this;
while ((other = other->nextChase(&start, &step, &spanStart, &last))) {
if (spanStart->windSum() != SK_MinS32) {
@@ -1051,7 +1051,7 @@ SkOpSpanBase* SkOpSegment::markAngle(int maxWinding, int sumWinding, int oppMaxW
if (oppMaxWinding != oppSumWinding && UseInnerWinding(oppMaxWinding, oppSumWinding)) {
oppMaxWinding = oppSumWinding;
}
- SkOpSpanBase* last = NULL;
+ SkOpSpanBase* last = nullptr;
// caller doesn't require that this marks anything
(void) markAndChaseWinding(angle->start(), angle->end(), maxWinding, oppMaxWinding, &last);
#if DEBUG_WINDING
@@ -1126,7 +1126,7 @@ static SkOpSegment* set_last(SkOpSpanBase** last, SkOpSpanBase* endSpan) {
if (last) {
*last = endSpan;
}
- return NULL;
+ return nullptr;
}
SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpSpan** minPtr,
@@ -1139,9 +1139,9 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS
SkOpSpanBase* foundSpan;
SkOpSpanBase* otherEnd;
SkOpSegment* other;
- if (angle == NULL) {
+ if (angle == nullptr) {
if (endSpan->t() != 0 && endSpan->t() != 1) {
- return NULL;
+ return nullptr;
}
SkOpPtT* otherPtT = endSpan->ptT()->next();
other = otherPtT->segment();
@@ -1153,8 +1153,8 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS
return set_last(last, endSpan);
}
const SkOpAngle* next = angle->next();
- if (NULL == next) {
- return NULL;
+ if (nullptr == next) {
+ return nullptr;
}
#if DEBUG_WINDING
if (angle->debugSign() != next->debugSign() && !angle->segment()->contour()->isXor()
@@ -1172,7 +1172,7 @@ SkOpSegment* SkOpSegment::nextChase(SkOpSpanBase** startPtr, int* stepPtr, SkOpS
}
SkASSERT(*startPtr);
if (!otherEnd) {
- return NULL;
+ return nullptr;
}
// SkASSERT(otherEnd >= 0);
SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast();
@@ -1212,7 +1212,7 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc
if (this->done()) {
return false;
}
- SkOpSpan* prior = NULL;
+ SkOpSpan* prior = nullptr;
SkOpSpanBase* spanBase = &fHead;
do {
SkOpPtT* ptT = spanBase->ptT(), * spanStopPtT = ptT;
@@ -1244,9 +1244,9 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc
if (spanBase->containsCoinEnd(opp)) {
continue;
}
- SkOpPtT* priorPtT = NULL, * priorStopPtT;
+ SkOpPtT* priorPtT = nullptr, * priorStopPtT;
// find prior span containing opp segment
- SkOpSegment* priorOpp = NULL;
+ SkOpSegment* priorOpp = nullptr;
SkOpSpan* priorTest = spanBase->prev();
while (!priorOpp && priorTest) {
priorStopPtT = priorPtT = priorTest->ptT();
@@ -1293,7 +1293,7 @@ bool SkOpSegment::missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc
SkTSwap(priorPtT, ptT);
}
}
- } while ((spanBase = spanBase->final() ? NULL : spanBase->upCast()->next()));
+ } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next()));
clear_visited(&fHead);
return false;
}
@@ -1339,7 +1339,7 @@ void SkOpSegment::moveMultiples() {
}
SkOpSpanBase* oppNext = oppSpan;
SkOpSpanBase* oppLast = oppSpan;
- while ((oppNext = oppNext->final() ? NULL : oppNext->upCast()->next())) {
+ while ((oppNext = oppNext->final() ? nullptr : oppNext->upCast()->next())) {
if (!roughly_equal(oppNext->t(), oppSpan->t())) {
break;
}
@@ -1393,7 +1393,7 @@ void SkOpSegment::moveMultiples() {
} while ((testPtT = testPtT->next()) != startPtT);
checkNextSpan:
;
- } while ((test = test->final() ? NULL : test->upCast()->next()));
+ } while ((test = test->final() ? nullptr : test->upCast()->next()));
debugValidate();
}
@@ -1416,7 +1416,7 @@ void SkOpSegment::moveNearby() {
}
do { // iterate through all spans associated with start
SkOpPtT* startBase = spanS->ptT();
- next = test->final() ? NULL : test->upCast()->next();
+ next = test->final() ? nullptr : test->upCast()->next();
do {
SkOpPtT* testBase = test->ptT();
do {
@@ -1506,7 +1506,7 @@ void SkOpSegment::sortAngles() {
SkOpSpanBase* span = &this->fHead;
do {
SkOpAngle* fromAngle = span->fromAngle();
- SkOpAngle* toAngle = span->final() ? NULL : span->upCast()->toAngle();
+ SkOpAngle* toAngle = span->final() ? nullptr : span->upCast()->toAngle();
if (!fromAngle && !toAngle) {
continue;
}
@@ -1560,11 +1560,11 @@ void SkOpSegment::sortAngles() {
}
} while ((ptT = ptT->next()) != stopPtT);
if (baseAngle->loopCount() == 1) {
- span->setFromAngle(NULL);
+ span->setFromAngle(nullptr);
if (toAngle) {
- span->upCast()->setToAngle(NULL);
+ span->upCast()->setToAngle(nullptr);
}
- baseAngle = NULL;
+ baseAngle = nullptr;
}
#if DEBUG_SORT
SkASSERT(!baseAngle || baseAngle->loopCount() > 1);
diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h
index a3f5989824..d1cd29aa9e 100644
--- a/src/pathops/SkOpSegment.h
+++ b/src/pathops/SkOpSegment.h
@@ -222,7 +222,7 @@ public:
}
SkOpSegment* isSimple(SkOpSpanBase** end, int* step) {
- return nextChase(end, step, NULL, NULL);
+ return nextChase(end, step, nullptr, nullptr);
}
bool isVertical() const {
diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp
index df3ef3c9b3..4d437f7f88 100755
--- a/src/pathops/SkOpSpan.cpp
+++ b/src/pathops/SkOpSpan.cpp
@@ -44,7 +44,7 @@ SkOpPtT* SkOpPtT::contains(const SkOpSegment* check) {
return ptT;
}
}
- return NULL;
+ return nullptr;
}
SkOpContour* SkOpPtT::contour() const {
@@ -65,7 +65,7 @@ SkOpPtT* SkOpPtT::doppelganger() {
ptT = ptT->fNext;
} while (stopPtT != ptT);
SkASSERT(0);
- return NULL;
+ return nullptr;
}
SkOpPtT* SkOpPtT::find(SkOpSegment* segment) {
@@ -78,7 +78,7 @@ SkOpPtT* SkOpPtT::find(SkOpSegment* segment) {
ptT = ptT->fNext;
} while (stopPtT != ptT);
SkASSERT(0);
- return NULL;
+ return nullptr;
}
SkOpGlobalState* SkOpPtT::globalState() const {
@@ -127,7 +127,7 @@ SkOpPtT* SkOpPtT::remove() {
prev = next;
} while (prev != this);
SkASSERT(0);
- return NULL;
+ return nullptr;
}
void SkOpPtT::removeNext(SkOpPtT* kept) {
@@ -252,7 +252,7 @@ SkOpPtT* SkOpSpanBase::contains(const SkOpSegment* segment) {
return walk;
}
}
- return NULL;
+ return nullptr;
}
bool SkOpSpanBase::containsCoinEnd(const SkOpSegment* segment) const {
@@ -278,7 +278,7 @@ void SkOpSpanBase::initBase(SkOpSegment* segment, SkOpSpan* prev, double t, cons
fSegment = segment;
fPtT.init(this, t, pt, false);
fCoinEnd = this;
- fFromAngle = NULL;
+ fFromAngle = nullptr;
fPrev = prev;
fSpanAdds = 0;
fAligned = true;
@@ -354,7 +354,7 @@ void SkOpSpan::init(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoin
SkASSERT(t != 1);
initBase(segment, prev, t, pt);
fCoincident = this;
- fToAngle = NULL;
+ fToAngle = nullptr;
fWindSum = fOppSum = SK_MinS32;
fWindValue = 1;
fOppValue = 0;
diff --git a/src/pathops/SkOpSpan.h b/src/pathops/SkOpSpan.h
index 2a11c96dd7..a2115df4d7 100644
--- a/src/pathops/SkOpSpan.h
+++ b/src/pathops/SkOpSpan.h
@@ -105,11 +105,11 @@ public:
SkOpPtT* start1 = s1->fT < e1->fT ? s1 : e1;
SkOpPtT* start2 = s2->fT < e2->fT ? s2 : e2;
*sOut = between(s1->fT, start2->fT, e1->fT) ? start2
- : between(s2->fT, start1->fT, e2->fT) ? start1 : NULL;
+ : between(s2->fT, start1->fT, e2->fT) ? start1 : nullptr;
SkOpPtT* end1 = s1->fT < e1->fT ? e1 : s1;
SkOpPtT* end2 = s2->fT < e2->fT ? e2 : s2;
*eOut = between(s1->fT, end2->fT, e1->fT) ? end2
- : between(s2->fT, end1->fT, e2->fT) ? end1 : NULL;
+ : between(s2->fT, end1->fT, e2->fT) ? end1 : nullptr;
if (*sOut == *eOut) {
SkASSERT(start1->fT >= end2->fT || start2->fT >= end1->fT);
return false;
@@ -341,11 +341,11 @@ public:
}
SkOpSpan* upCastable() {
- return final() ? NULL : upCast();
+ return final() ? nullptr : upCast();
}
const SkOpSpan* upCastable() const {
- return final() ? NULL : upCast();
+ return final() ? nullptr : upCast();
}
private:
diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp
index c53f458d1a..58bcacd2fd 100644
--- a/src/pathops/SkPathOpsCommon.cpp
+++ b/src/pathops/SkPathOpsCommon.cpp
@@ -18,7 +18,7 @@ const SkOpAngle* AngleWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* windi
const SkOpAngle* angle = segment->spanToAngle(start, end);
if (!angle) {
*windingPtr = SK_MinS32;
- return NULL;
+ return nullptr;
}
bool computeWinding = false;
const SkOpAngle* firstAngle = angle;
@@ -70,7 +70,7 @@ SkOpSegment* FindUndone(SkOpContourHead* contourList, SkOpSpanBase** startPtr,
return result;
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
SkOpSegment* FindChase(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** startPtr,
@@ -81,7 +81,7 @@ SkOpSegment* FindChase(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** startPtr,
SkOpSegment* segment = span->segment();
*startPtr = span->ptT()->next()->span();
bool done = true;
- *endPtr = NULL;
+ *endPtr = nullptr;
if (SkOpAngle* last = segment->activeAngle(*startPtr, startPtr, endPtr, &done)) {
*startPtr = last->start();
*endPtr = last->end();
@@ -107,7 +107,7 @@ SkOpSegment* FindChase(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** startPtr,
segment = angle->segment();
sumWinding = segment->updateWindingReverse(angle);
}
- SkOpSegment* first = NULL;
+ SkOpSegment* first = nullptr;
const SkOpAngle* firstAngle = angle;
while ((angle = angle->next()) != firstAngle) {
segment = angle->segment();
@@ -138,7 +138,7 @@ SkOpSegment* FindChase(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** startPtr,
return first;
}
}
- return NULL;
+ return nullptr;
}
#if DEBUG_ACTIVE_SPANS
@@ -175,7 +175,7 @@ bool SortContourList(SkOpContourHead** contourList, bool evenOdd, bool oppEvenOd
contour->setNext(next);
contour = next;
}
- contour->setNext(NULL);
+ contour->setNext(nullptr);
return true;
}
@@ -198,7 +198,7 @@ public:
void Assemble(const SkPathWriter& path, SkPathWriter* simple) {
SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune
SkOpContourHead contour;
- SkOpGlobalState globalState(NULL, &contour SkDEBUGPARAMS(NULL));
+ SkOpGlobalState globalState(nullptr, &contour SkDEBUGPARAMS(nullptr));
#if DEBUG_SHOW_TEST_NAME
SkDebugf("</div>\n");
#endif
diff --git a/src/pathops/SkPathOpsCurve.h b/src/pathops/SkPathOpsCurve.h
index c830e66d4d..97e20be2b1 100644
--- a/src/pathops/SkPathOpsCurve.h
+++ b/src/pathops/SkPathOpsCurve.h
@@ -108,7 +108,7 @@ static SkDPoint dcubic_xy_at_t(const SkPoint a[4], SkScalar , double t) {
}
static SkDPoint (* const CurveDPointAtT[])(const SkPoint[], SkScalar , double ) = {
- NULL,
+ nullptr,
dline_xy_at_t,
dquad_xy_at_t,
dconic_xy_at_t,
@@ -132,7 +132,7 @@ static SkPoint fcubic_xy_at_t(const SkPoint a[4], SkScalar weight, double t) {
}
static SkPoint (* const CurvePointAtT[])(const SkPoint[], SkScalar , double ) = {
- NULL,
+ nullptr,
fline_xy_at_t,
fquad_xy_at_t,
fconic_xy_at_t,
@@ -164,7 +164,7 @@ static SkDVector dcubic_dxdy_at_t(const SkPoint a[4], SkScalar , double t) {
}
static SkDVector (* const CurveDSlopeAtT[])(const SkPoint[], SkScalar , double ) = {
- NULL,
+ nullptr,
dline_dxdy_at_t,
dquad_dxdy_at_t,
dconic_dxdy_at_t,
@@ -188,7 +188,7 @@ static SkVector fcubic_dxdy_at_t(const SkPoint a[4], SkScalar weight, double t)
}
static SkVector (* const CurveSlopeAtT[])(const SkPoint[], SkScalar , double ) = {
- NULL,
+ nullptr,
fline_dxdy_at_t,
fquad_dxdy_at_t,
fconic_dxdy_at_t,
@@ -225,7 +225,7 @@ static bool cubic_is_vertical(const SkPoint a[4], SkScalar , double startT, doub
}
static bool (* const CurveIsVertical[])(const SkPoint[], SkScalar , double , double) = {
- NULL,
+ nullptr,
line_is_vertical,
quad_is_vertical,
conic_is_vertical,
@@ -262,7 +262,7 @@ static void cubic_intersect_ray(const SkPoint a[4], SkScalar , const SkDLine& ra
static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkDLine& ,
SkIntersections* ) = {
- NULL,
+ nullptr,
line_intersect_ray,
quad_intersect_ray,
conic_intersect_ray,
@@ -312,8 +312,8 @@ static int cubic_intercept_v(const SkPoint a[3], SkScalar , SkScalar x, double*
}
static int (* const CurveIntercept[])(const SkPoint[] , SkScalar , SkScalar , double* ) = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
line_intercept_h,
line_intercept_v,
quad_intercept_h,
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index 813f237c77..141041ad36 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -163,7 +163,7 @@ SkDCubic SkDQuad::debugToCubic() const {
#include "SkOpSegment.h"
SkOpAngle* SkOpSegment::debugLastAngle() {
- SkOpAngle* result = NULL;
+ SkOpAngle* result = nullptr;
SkOpSpan* span = this->head();
do {
if (span->toAngle()) {
@@ -414,7 +414,7 @@ void SkOpSegment::debugValidate() const {
#if DEBUG_VALIDATE
const SkOpSpanBase* span = &fHead;
double lastT = -1;
- const SkOpSpanBase* prev = NULL;
+ const SkOpSpanBase* prev = nullptr;
int count = 0;
int done = 0;
do {
@@ -645,7 +645,7 @@ void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool incl
SkPath::RawIter iter(path);
#define SUPPORT_RECT_CONTOUR_DETECTION 0
#if SUPPORT_RECT_CONTOUR_DETECTION
- int rectCount = path.isRectContours() ? path.rectContours(NULL, NULL) : 0;
+ int rectCount = path.isRectContours() ? path.rectContours(nullptr, nullptr) : 0;
if (rectCount > 0) {
SkTDArray<SkRect> rects;
SkTDArray<SkPath::Direction> directions;
diff --git a/src/pathops/SkPathOpsOp.cpp b/src/pathops/SkPathOpsOp.cpp
index 12a9578dd3..be7fae7a8f 100644
--- a/src/pathops/SkPathOpsOp.cpp
+++ b/src/pathops/SkPathOpsOp.cpp
@@ -19,7 +19,7 @@ static SkOpSegment* findChaseOp(SkTDArray<SkOpSpanBase*>& chase, SkOpSpanBase**
*startPtr = span->ptT()->prev()->span();
SkOpSegment* segment = (*startPtr)->segment();
bool done = true;
- *endPtr = NULL;
+ *endPtr = nullptr;
if (SkOpAngle* last = segment->activeAngle(*startPtr, startPtr, endPtr, &done)) {
*startPtr = last->start();
*endPtr = last->end();
@@ -48,7 +48,7 @@ static SkOpSegment* findChaseOp(SkTDArray<SkOpSpanBase*>& chase, SkOpSpanBase**
SkTSwap<int>(sumMiWinding, sumSuWinding);
}
}
- SkOpSegment* first = NULL;
+ SkOpSegment* first = nullptr;
const SkOpAngle* firstAngle = angle;
while ((angle = angle->next()) != firstAngle) {
segment = angle->segment();
@@ -81,7 +81,7 @@ static SkOpSegment* findChaseOp(SkTDArray<SkOpSpanBase*>& chase, SkOpSpanBase**
return first;
}
}
- return NULL;
+ return nullptr;
}
static bool bridgeOp(SkOpContourHead* contourList, const SkPathOp op,
@@ -304,5 +304,5 @@ bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result,
}
bool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) {
- return OpDebug(one, two, op, result, true SkDEBUGPARAMS(NULL));
+ return OpDebug(one, two, op, result, true SkDEBUGPARAMS(nullptr));
}
diff --git a/src/pathops/SkPathOpsSimplify.cpp b/src/pathops/SkPathOpsSimplify.cpp
index 8c07653320..14fde4f9a4 100644
--- a/src/pathops/SkPathOpsSimplify.cpp
+++ b/src/pathops/SkPathOpsSimplify.cpp
@@ -167,7 +167,7 @@ bool Simplify(const SkPath& path, SkPath* result) {
SkOpCoincidence coincidence;
SkOpContour contour;
SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour);
- SkOpGlobalState globalState(&coincidence, contourList SkDEBUGPARAMS(NULL));
+ SkOpGlobalState globalState(&coincidence, contourList SkDEBUGPARAMS(nullptr));
#if DEBUG_SORT
SkPathOpsDebug::gSortCount = SkPathOpsDebug::gSortCountDefault;
#endif
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index 6ea01be191..e8a0fd499b 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -112,7 +112,7 @@ public:
void initBounds(const TCurve& );
bool isBounded() const {
- return fBounded != NULL;
+ return fBounded != nullptr;
}
bool linearsIntersect(SkTSpan<OppCurve, TCurve>* span);
@@ -138,7 +138,7 @@ public:
bool removeBounded(const SkTSpan<OppCurve, TCurve>* opp);
void reset() {
- fBounded = NULL;
+ fBounded = nullptr;
}
void resetBounds(const TCurve& curve) {
@@ -207,7 +207,7 @@ public:
bool debugHasBounded(const SkTSpan<OppCurve, TCurve>* ) const;
const SkTSect<OppCurve, TCurve>* debugOpp() const {
- return SkDEBUGRELEASE(fOppSect, NULL);
+ return SkDEBUGRELEASE(fOppSect, nullptr);
}
const SkTSpan<TCurve, OppCurve>* debugSpan(int id) const;
@@ -452,7 +452,7 @@ bool SkTSpan<TCurve, OppCurve>::contains(double t) const {
template<typename TCurve, typename OppCurve>
const SkTSect<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::debugOpp() const {
- return SkDEBUGRELEASE(fDebugSect->debugOpp(), NULL);
+ return SkDEBUGRELEASE(fDebugSect->debugOpp(), nullptr);
}
template<typename TCurve, typename OppCurve>
@@ -466,7 +466,7 @@ SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::findOppSpan(
}
bounded = bounded->fNext;
}
- return NULL;
+ return nullptr;
}
// returns 0 if no hull intersection
@@ -520,10 +520,10 @@ int SkTSpan<TCurve, OppCurve>::hullsIntersect(SkTSpan<OppCurve, TCurve>* opp,
template<typename TCurve, typename OppCurve>
void SkTSpan<TCurve, OppCurve>::init(const TCurve& c) {
- fPrev = fNext = NULL;
+ fPrev = fNext = nullptr;
fStartT = 0;
fEndT = 1;
- fBounded = NULL;
+ fBounded = nullptr;
resetBounds(c);
}
@@ -656,7 +656,7 @@ SkTSpan<OppCurve, TCurve>* SkTSpan<TCurve, OppCurve>::oppT(double t) const {
}
bounded = bounded->fNext;
}
- return NULL;
+ return nullptr;
}
template<typename TCurve, typename OppCurve>
@@ -692,7 +692,7 @@ bool SkTSpan<TCurve, OppCurve>::removeBounded(const SkTSpan<OppCurve, TCurve>* o
}
}
SkTSpanBounded<OppCurve, TCurve>* bounded = fBounded;
- SkTSpanBounded<OppCurve, TCurve>* prev = NULL;
+ SkTSpanBounded<OppCurve, TCurve>* prev = nullptr;
while (bounded) {
SkTSpanBounded<OppCurve, TCurve>* boundedNext = bounded->fNext;
if (opp == bounded->fBounded) {
@@ -701,7 +701,7 @@ bool SkTSpan<TCurve, OppCurve>::removeBounded(const SkTSpan<OppCurve, TCurve>* o
return false;
} else {
fBounded = boundedNext;
- return fBounded == NULL;
+ return fBounded == nullptr;
}
}
prev = bounded;
@@ -734,7 +734,7 @@ bool SkTSpan<TCurve, OppCurve>::splitAt(SkTSpan* work, double t, SkChunkAlloc* h
fNext->fPrev = this;
}
SkTSpanBounded<OppCurve, TCurve>* bounded = work->fBounded;
- fBounded = NULL;
+ fBounded = nullptr;
while (bounded) {
this->addBounded(bounded->fBounded, heap);
bounded = bounded->fNext;
@@ -750,9 +750,9 @@ bool SkTSpan<TCurve, OppCurve>::splitAt(SkTSpan* work, double t, SkChunkAlloc* h
template<typename TCurve, typename OppCurve>
void SkTSpan<TCurve, OppCurve>::validate() const {
#if DEBUG_T_SECT
- SkASSERT(fNext == NULL || fNext != fPrev);
- SkASSERT(fNext == NULL || this == fNext->fPrev);
- SkASSERT(fPrev == NULL || this == fPrev->fNext);
+ SkASSERT(fNext == nullptr || fNext != fPrev);
+ SkASSERT(fNext == nullptr || this == fNext->fPrev);
+ SkASSERT(fPrev == nullptr || this == fPrev->fNext);
SkASSERT(fBounds.width() || fBounds.height() || fCollapsed);
SkASSERT(fBoundsMax == SkTMax(fBounds.width(), fBounds.height()));
SkASSERT(0 <= fStartT);
@@ -810,8 +810,8 @@ template<typename TCurve, typename OppCurve>
SkTSect<TCurve, OppCurve>::SkTSect(const TCurve& c PATH_OPS_DEBUG_T_SECT_PARAMS(int id))
: fCurve(c)
, fHeap(sizeof(SkTSpan<TCurve, OppCurve>) * 4)
- , fCoincident(NULL)
- , fDeleted(NULL)
+ , fCoincident(nullptr)
+ , fDeleted(nullptr)
, fActiveCount(0)
PATH_OPS_DEBUG_T_SECT_PARAMS(fID(id))
PATH_OPS_DEBUG_T_SECT_PARAMS(fDebugCount(0))
@@ -831,7 +831,7 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::addOne() {
} else {
result = new (fHeap.allocThrow(sizeof(SkTSpan<TCurve, OppCurve>)))(
SkTSpan<TCurve, OppCurve>);
- result->fBounded = NULL;
+ result->fBounded = nullptr;
#if DEBUG_T_SECT
++fDebugAllocatedCount;
#endif
@@ -973,7 +973,7 @@ void SkTSect<TCurve, OppCurve>::computePerpendiculars(SkTSect<OppCurve, TCurve>*
SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) {
const OppCurve& opp = sect2->fCurve;
SkTSpan<TCurve, OppCurve>* work = first;
- SkTSpan<TCurve, OppCurve>* prior = NULL;
+ SkTSpan<TCurve, OppCurve>* prior = nullptr;
do {
if (!work->fHasPerp && !work->fCollapsed) {
if (prior) {
@@ -1061,7 +1061,7 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::extractCoincident(
SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) {
first = findCoincidentRun(first, &last);
if (!first) {
- return NULL;
+ return nullptr;
}
// march outwards to find limit of coincidence from here to previous and next spans
double startT = first->fStartT;
@@ -1146,15 +1146,15 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::extractCoincident(
}
this->validate();
sect2->validate();
- return last && !last->fDeleted ? last : NULL;
+ return last && !last->fDeleted ? last : nullptr;
}
template<typename TCurve, typename OppCurve>
SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::findCoincidentRun(
SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>** lastPtr) {
SkTSpan<TCurve, OppCurve>* work = first;
- SkTSpan<TCurve, OppCurve>* lastCandidate = NULL;
- first = NULL;
+ SkTSpan<TCurve, OppCurve>* lastCandidate = nullptr;
+ first = nullptr;
// find the first fully coincident span
do {
if (work->fCoinStart.isCoincident()) {
@@ -1174,7 +1174,7 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::findCoincidentRun(
*lastPtr = lastCandidate;
return first;
} else {
- lastCandidate = NULL;
+ lastCandidate = nullptr;
SkASSERT(!first);
}
if (work == *lastPtr) {
@@ -1404,7 +1404,7 @@ void SkTSect<TCurve, OppCurve>::mergeCoincidence(SkTSect<OppCurve, TCurve>* sect
double smallLimit = 0;
do {
// find the smallest unprocessed span
- SkTSpan<TCurve, OppCurve>* smaller = NULL;
+ SkTSpan<TCurve, OppCurve>* smaller = nullptr;
SkTSpan<TCurve, OppCurve>* test = fCoincident;
do {
if (test->fStartT < smallLimit) {
@@ -1420,9 +1420,9 @@ void SkTSect<TCurve, OppCurve>::mergeCoincidence(SkTSect<OppCurve, TCurve>* sect
}
smallLimit = smaller->fEndT;
// find next larger span
- SkTSpan<TCurve, OppCurve>* prior = NULL;
- SkTSpan<TCurve, OppCurve>* larger = NULL;
- SkTSpan<TCurve, OppCurve>* largerPrior = NULL;
+ SkTSpan<TCurve, OppCurve>* prior = nullptr;
+ SkTSpan<TCurve, OppCurve>* larger = nullptr;
+ SkTSpan<TCurve, OppCurve>* largerPrior = nullptr;
test = fCoincident;
do {
if (test->fStartT < smaller->fEndT) {
@@ -1458,7 +1458,7 @@ void SkTSect<TCurve, OppCurve>::mergeCoincidence(SkTSect<OppCurve, TCurve>* sect
template<typename TCurve, typename OppCurve>
SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::prev(
SkTSpan<TCurve, OppCurve>* span) const {
- SkTSpan<TCurve, OppCurve>* result = NULL;
+ SkTSpan<TCurve, OppCurve>* result = nullptr;
SkTSpan<TCurve, OppCurve>* test = fHead;
while (span != test) {
result = test;
@@ -1588,13 +1588,13 @@ template<typename TCurve, typename OppCurve>
SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::spanAtT(double t,
SkTSpan<TCurve, OppCurve>** priorSpan) {
SkTSpan<TCurve, OppCurve>* test = fHead;
- SkTSpan<TCurve, OppCurve>* prev = NULL;
+ SkTSpan<TCurve, OppCurve>* prev = nullptr;
while (test && test->fEndT < t) {
prev = test;
test = test->fNext;
}
*priorSpan = prev;
- return test && test->fStartT <= t ? test : NULL;
+ return test && test->fStartT <= t ? test : nullptr;
}
template<typename TCurve, typename OppCurve>
@@ -1654,7 +1654,7 @@ void SkTSect<TCurve, OppCurve>::unlinkSpan(SkTSpan<TCurve, OppCurve>* span) {
} else {
fHead = next;
if (next) {
- next->fPrev = NULL;
+ next->fPrev = nullptr;
}
}
}
@@ -1668,7 +1668,7 @@ bool SkTSect<TCurve, OppCurve>::updateBounded(SkTSpan<TCurve, OppCurve>* first,
do {
deleteSpan |= test->removeAllBounded();
} while ((test = test->fNext) != final);
- first->fBounded = NULL;
+ first->fBounded = nullptr;
first->addBounded(oppFirst, &fHeap);
// cannot call validate until remove span range is called
return deleteSpan;
@@ -1688,7 +1688,7 @@ void SkTSect<TCurve, OppCurve>::validate() const {
SkASSERT(span->fStartT >= last);
SkDEBUGCODE(last = span->fEndT);
++count;
- } while ((span = span->fNext) != NULL);
+ } while ((span = span->fNext) != nullptr);
}
SkASSERT(count == fActiveCount);
SkASSERT(fActiveCount <= fDebugAllocatedCount);
@@ -1716,7 +1716,7 @@ void SkTSect<TCurve, OppCurve>::validateBounded() const {
const SkTSpan<TCurve, OppCurve>* span = fHead;
do {
span->validateBounded();
- } while ((span = span->fNext) != NULL);
+ } while ((span = span->fNext) != nullptr);
#endif
}
@@ -1823,8 +1823,8 @@ struct SkClosestRecord {
void reset() {
fClosest = FLT_MAX;
- SkDEBUGCODE(fC1Span = NULL);
- SkDEBUGCODE(fC2Span = NULL);
+ SkDEBUGCODE(fC1Span = nullptr);
+ SkDEBUGCODE(fC2Span = nullptr);
SkDEBUGCODE(fC1Index = fC2Index = -1);
}
diff --git a/src/pathops/SkPathOpsTightBounds.cpp b/src/pathops/SkPathOpsTightBounds.cpp
index 7eb72a9037..ac5d6aae0b 100644
--- a/src/pathops/SkPathOpsTightBounds.cpp
+++ b/src/pathops/SkPathOpsTightBounds.cpp
@@ -11,7 +11,7 @@ bool TightBounds(const SkPath& path, SkRect* result) {
SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune
SkOpContour contour;
SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour);
- SkOpGlobalState globalState(NULL, contourList SkDEBUGPARAMS(NULL));
+ SkOpGlobalState globalState(nullptr, contourList SkDEBUGPARAMS(nullptr));
// turn path into list of segments
SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState);
if (!builder.finish(&allocator)) {
diff --git a/src/pathops/SkPathOpsWinding.cpp b/src/pathops/SkPathOpsWinding.cpp
index 03efdacd29..3061ea365a 100644
--- a/src/pathops/SkPathOpsWinding.cpp
+++ b/src/pathops/SkPathOpsWinding.cpp
@@ -82,7 +82,7 @@ static bool ccw_dxdy(const SkDVector& v, SkOpRayDir dir) {
struct SkOpRayHit {
SkOpRayDir makeTestBase(SkOpSpan* span, double t) {
- fNext = NULL;
+ fNext = nullptr;
fSpan = span;
fT = span->t() * (1 - t) + span->next()->t() * t;
SkOpSegment* segment = span->segment();
@@ -191,13 +191,13 @@ SkOpSpan* SkOpSegment::windingSpanAtT(double tHit) {
do {
next = span->next();
if (approximately_equal(tHit, next->t())) {
- return NULL;
+ return nullptr;
}
if (tHit < next->t()) {
return span;
}
} while (!next->final() && (span = next->upCast()));
- return NULL;
+ return nullptr;
}
static bool hit_compare_x(const SkOpRayHit* a, const SkOpRayHit* b) {
@@ -266,7 +266,7 @@ bool SkOpSpan::sortableTop(SkOpContour* contourHead) {
for (int index = 0; index < count; ++index) {
hit = sorted[index];
SkOpSpan* span = hit->fSpan;
- SkOpSegment* hitSegment = span ? span->segment() : NULL;
+ SkOpSegment* hitSegment = span ? span->segment() : nullptr;
bool operand = span ? hitSegment->operand() : false;
bool ccw = ccw_dxdy(hit->fSlope, dir);
SkDebugf("%s [%d] valid=%d operand=%d span=%d ccw=%d ", __FUNCTION__, index,
@@ -278,7 +278,7 @@ bool SkOpSpan::sortableTop(SkOpContour* contourHead) {
hit->fPt.fX, hit->fPt.fY, hit->fSlope.fX, hit->fSlope.fY);
}
#endif
- const SkPoint* last = NULL;
+ const SkPoint* last = nullptr;
int wind = 0;
int oppWind = 0;
for (int index = 0; index < count; ++index) {
@@ -345,8 +345,8 @@ bool SkOpSpan::sortableTop(SkOpContour* contourHead) {
if (this->globalState()->phase() == SkOpGlobalState::kFixWinding) {
hitSegment->contour()->setCcw(ccw);
} else {
- (void) hitSegment->markAndChaseWinding(span, span->next(), windSum, oppSum, NULL);
- (void) hitSegment->markAndChaseWinding(span->next(), span, windSum, oppSum, NULL);
+ (void) hitSegment->markAndChaseWinding(span, span->next(), windSum, oppSum, nullptr);
+ (void) hitSegment->markAndChaseWinding(span->next(), span, windSum, oppSum, nullptr);
}
}
if (operand) {
@@ -373,7 +373,7 @@ SkOpSpan* SkOpSegment::findSortableTop(SkOpContour* contourHead) {
return span;
}
} while (!next->final() && (span = next->upCast()));
- return NULL;
+ return nullptr;
}
SkOpSpan* SkOpContour::findSortableTop(SkOpContour* contourHead) {
@@ -387,7 +387,7 @@ SkOpSpan* SkOpContour::findSortableTop(SkOpContour* contourHead) {
return result;
}
} while ((testSegment = testSegment->next()));
- return NULL;
+ return nullptr;
}
SkOpSpan* FindSortableTop(SkOpContourHead* contourHead) {
@@ -403,5 +403,5 @@ SkOpSpan* FindSortableTop(SkOpContourHead* contourHead) {
}
} while ((contour = contour->next()));
}
- return NULL;
+ return nullptr;
}
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index bef8d9757e..c52a4600c4 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -73,7 +73,7 @@ SkDeflateWStream::SkDeflateWStream(SkWStream* out) : fImpl(new SkDeflateWStream:
}
fImpl->fZStream.zalloc = &skia_alloc_func;
fImpl->fZStream.zfree = &skia_free_func;
- fImpl->fZStream.opaque = NULL;
+ fImpl->fZStream.opaque = nullptr;
SkDEBUGCODE(int r =) deflateInit(&fImpl->fZStream, Z_DEFAULT_COMPRESSION);
SkASSERT(Z_OK == r);
}
@@ -87,7 +87,7 @@ void SkDeflateWStream::finalize() {
do_deflate(Z_FINISH, &fImpl->fZStream, fImpl->fOut, fImpl->fInBuffer,
fImpl->fInBufferIndex);
(void)deflateEnd(&fImpl->fZStream);
- fImpl->fOut = NULL;
+ fImpl->fOut = nullptr;
}
bool SkDeflateWStream::write(const void* void_buffer, size_t len) {
diff --git a/src/pdf/SkJpegInfo.cpp b/src/pdf/SkJpegInfo.cpp
index 85cd3251cd..455b4aa2c0 100644
--- a/src/pdf/SkJpegInfo.cpp
+++ b/src/pdf/SkJpegInfo.cpp
@@ -22,7 +22,7 @@ public:
}
if (JpegSegment::StandAloneMarker(fMarker)) {
fLength = 0;
- fBuffer = NULL;
+ fBuffer = nullptr;
return true;
}
if (!this->readBigendianUint16(&fLength) || fLength < 2) {
diff --git a/src/pdf/SkJpegInfo.h b/src/pdf/SkJpegInfo.h
index 1be4c0fa66..178d648a1a 100644
--- a/src/pdf/SkJpegInfo.h
+++ b/src/pdf/SkJpegInfo.h
@@ -19,7 +19,7 @@ struct SkJFIFInfo {
};
/** Returns true iff the data seems to be a valid JFIF JPEG image.
- If so and if info is not NULL, populate info.
+ If so and if info is not nullptr, populate info.
JPEG/JFIF References:
http://www.w3.org/Graphics/JPEG/itu-t81.pdf
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index 35052334db..de43221630 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -439,12 +439,12 @@ SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) {
SkASSERT(canon);
if (!SkColorTypeIsValid(bitmap.colorType()) ||
kUnknown_SkColorType == bitmap.colorType()) {
- return NULL;
+ return nullptr;
}
SkBitmap copy;
const SkBitmap& bm = immutable_bitmap(bitmap, &copy);
if (bm.drawsNothing()) {
- return NULL;
+ return nullptr;
}
if (SkPDFBitmap* canonBitmap = canon->findBitmap(bm)) {
return SkRef(canonBitmap);
@@ -463,7 +463,7 @@ SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) {
}
}
- SkPDFObject* smask = NULL;
+ SkPDFObject* smask = nullptr;
if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) {
smask = new PDFAlphaBitmap(bm);
}
diff --git a/src/pdf/SkPDFBitmap.h b/src/pdf/SkPDFBitmap.h
index 2c8653f315..58d91bec88 100644
--- a/src/pdf/SkPDFBitmap.h
+++ b/src/pdf/SkPDFBitmap.h
@@ -24,7 +24,7 @@ class SkPDFCanon;
*/
class SkPDFBitmap : public SkPDFObject {
public:
- // Returns NULL on unsupported bitmap;
+ // Returns nullptr on unsupported bitmap;
static SkPDFBitmap* Create(SkPDFCanon*, const SkBitmap&);
bool equals(const SkBitmap& other) const {
return fBitmap.getGenerationID() == other.getGenerationID() &&
diff --git a/src/pdf/SkPDFCanon.cpp b/src/pdf/SkPDFCanon.cpp
index b6187cbb33..6cc3995412 100644
--- a/src/pdf/SkPDFCanon.cpp
+++ b/src/pdf/SkPDFCanon.cpp
@@ -41,7 +41,7 @@ T* find_item(const SkTDArray<T*>& ptrArray, const U& object) {
return ptrArray[i];
}
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -51,7 +51,7 @@ SkPDFFont* SkPDFCanon::findFont(uint32_t fontID,
SkPDFFont** relatedFontPtr) const {
SkASSERT(relatedFontPtr);
- SkPDFFont* relatedFont = NULL;
+ SkPDFFont* relatedFont = nullptr;
for (int i = 0; i < fFontRecords.count(); ++i) {
SkPDFFont::Match match = SkPDFFont::IsMatch(
fFontRecords[i].fFont, fFontRecords[i].fFontID,
@@ -62,8 +62,8 @@ SkPDFFont* SkPDFCanon::findFont(uint32_t fontID,
relatedFont = fFontRecords[i].fFont;
}
}
- *relatedFontPtr = relatedFont; // May still be NULL.
- return NULL;
+ *relatedFontPtr = relatedFont; // May still be nullptr.
+ return nullptr;
}
void SkPDFCanon::addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID) {
@@ -109,7 +109,7 @@ void SkPDFCanon::addImageShader(SkPDFImageShader* pdfShader) {
const SkPDFGraphicState* SkPDFCanon::findGraphicState(
const SkPDFGraphicState& key) const {
const WrapGS* ptr = fGraphicStateRecords.find(WrapGS(&key));
- return ptr ? ptr->fPtr : NULL;
+ return ptr ? ptr->fPtr : nullptr;
}
void SkPDFCanon::addGraphicState(const SkPDFGraphicState* state) {
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 5198e7b0ac..2ad5a229aa 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -40,9 +40,9 @@ public:
// reset to original setting, unrefs all objects.
void reset();
- // Returns exact match if there is one. If not, it returns NULL.
+ // Returns exact match if there is one. If not, it returns nullptr.
// If there is no exact match, but there is a related font, we
- // still return NULL, but also set *relatedFont.
+ // still return nullptr, but also set *relatedFont.
SkPDFFont* findFont(uint32_t fontID,
uint16_t glyphID,
SkPDFFont** relatedFont) const;
@@ -78,7 +78,7 @@ private:
SkTDArray<SkPDFImageShader*> fImageShaderRecords;
struct WrapGS {
- explicit WrapGS(const SkPDFGraphicState* ptr = NULL) : fPtr(ptr) {}
+ explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {}
const SkPDFGraphicState* fPtr;
bool operator==(const WrapGS& rhs) const {
SkASSERT(fPtr);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 678e6c058f..a5c9557412 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -43,7 +43,7 @@
static void replace_srcmode_on_opaque_paint(SkPaint* paint) {
if (kSrcOver_SkXfermodeInterpretation
== SkInterpretXfermode(*paint, false)) {
- paint->setXfermode(NULL);
+ paint->setXfermode(nullptr);
}
}
@@ -86,7 +86,7 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
SkMatrix ident;
ident.reset();
- SkAutoGlyphCache autoCache(paint, NULL, &ident);
+ SkAutoGlyphCache autoCache(paint, nullptr, &ident);
SkGlyphCache* cache = autoCache.getCache();
const char* start = reinterpret_cast<const char*>(glyphs);
@@ -126,7 +126,7 @@ static int force_glyph_encoding(const SkPaint& paint, const void* text,
const uint16_t** glyphIDs) {
// Make sure we have a glyph id encoding.
if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) {
- int numGlyphs = paint.textToGlyphs(text, len, NULL);
+ int numGlyphs = paint.textToGlyphs(text, len, nullptr);
storage->reset(numGlyphs);
paint.textToGlyphs(text, len, storage->get());
*glyphIDs = storage->get();
@@ -204,10 +204,10 @@ struct GraphicStateEntry {
int fGraphicStateIndex;
// We may change the font (i.e. for Type1 support) within a
- // ContentEntry. This is the one currently in effect, or NULL if none.
+ // ContentEntry. This is the one currently in effect, or nullptr if none.
SkPDFFont* fFont;
// In PDF, text size has no default value. It is only valid if fFont is
- // not NULL.
+ // not nullptr.
SkScalar fTextSize;
};
@@ -216,7 +216,7 @@ GraphicStateEntry::GraphicStateEntry() : fColor(SK_ColorBLACK),
fTextFill(SkPaint::kFill_Style),
fShaderIndex(-1),
fGraphicStateIndex(-1),
- fFont(NULL),
+ fFont(nullptr),
fTextSize(SK_ScalarNaN) {
fMatrix.reset();
}
@@ -309,7 +309,7 @@ static void skip_clip_stack_prefix(const SkClipStack& prefix,
}
}
- SkASSERT(prefixEntry == NULL);
+ SkASSERT(prefixEntry == nullptr);
}
static void emit_clip(SkPath* clipPath, SkRect* clipRect,
@@ -444,7 +444,7 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
#ifdef SK_PDF_USE_PATHOPS_CLIPPING
SkPath clipPath;
if (get_clip_stack_path(transform, clipStack, clipRegion, &clipPath)) {
- emit_clip(&clipPath, NULL, fContentStream);
+ emit_clip(&clipPath, nullptr, fContentStream);
return;
}
#endif
@@ -474,7 +474,7 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
if (needRegion) {
SkPath clipPath;
SkAssertResult(clipRegion.getBoundaryPath(&clipPath));
- emit_clip(&clipPath, NULL, fContentStream);
+ emit_clip(&clipPath, nullptr, fContentStream);
} else {
skip_clip_stack_prefix(fEntries[0].fClipStack, clipStack, &iter);
const SkClipStack::Element* clipEntry;
@@ -484,14 +484,14 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
case SkClipStack::Element::kRect_Type: {
SkRect translatedClip;
transform.mapRect(&translatedClip, clipEntry->getRect());
- emit_clip(NULL, &translatedClip, fContentStream);
+ emit_clip(nullptr, &translatedClip, fContentStream);
break;
}
default: {
SkPath translatedPath;
clipEntry->asPath(&translatedPath);
translatedPath.transform(transform, &translatedPath);
- emit_clip(&translatedPath, NULL, fContentStream);
+ emit_clip(&translatedPath, nullptr, fContentStream);
break;
}
}
@@ -572,13 +572,13 @@ static bool not_supported_for_layers(const SkPaint& layerPaint) {
// to improve quality and file size (http://skbug.com/3043)
// TODO: should we return true if there is a colorfilter?
- return layerPaint.getImageFilter() != NULL;
+ return layerPaint.getImageFilter() != nullptr;
}
SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint* layerPaint) {
if (cinfo.fForImageFilter ||
(layerPaint && not_supported_for_layers(*layerPaint))) {
- return NULL;
+ return nullptr;
}
SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
return SkPDFDevice::Create(size, fRasterDpi, fCanon);
@@ -594,9 +594,9 @@ struct ContentEntry {
// So we manually destruct the object.
~ContentEntry() {
ContentEntry* val = fNext.detach();
- while (val != NULL) {
+ while (val != nullptr) {
ContentEntry* valNext = val->fNext.detach();
- // When the destructor is called, fNext is NULL and exits.
+ // When the destructor is called, fNext is nullptr and exits.
delete val;
val = valNext;
}
@@ -610,18 +610,18 @@ public:
ScopedContentEntry(SkPDFDevice* device, const SkDraw& draw,
const SkPaint& paint, bool hasText = false)
: fDevice(device),
- fContentEntry(NULL),
+ fContentEntry(nullptr),
fXfermode(SkXfermode::kSrcOver_Mode),
- fDstFormXObject(NULL) {
+ fDstFormXObject(nullptr) {
init(draw.fClipStack, *draw.fClip, *draw.fMatrix, paint, hasText);
}
ScopedContentEntry(SkPDFDevice* device, const SkClipStack* clipStack,
const SkRegion& clipRegion, const SkMatrix& matrix,
const SkPaint& paint, bool hasText = false)
: fDevice(device),
- fContentEntry(NULL),
+ fContentEntry(nullptr),
fXfermode(SkXfermode::kSrcOver_Mode),
- fDstFormXObject(NULL) {
+ fDstFormXObject(nullptr) {
init(clipStack, clipRegion, matrix, paint, hasText);
}
@@ -629,7 +629,7 @@ public:
if (fContentEntry) {
SkPath* shape = &fShape;
if (shape->isEmpty()) {
- shape = NULL;
+ shape = nullptr;
}
fDevice->finishContentEntry(fXfermode, fDstFormXObject, shape);
}
@@ -702,11 +702,11 @@ SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFCanon* canon
, fPageSize(pageSize)
, fContentSize(pageSize)
, fExistingClipRegion(SkIRect::MakeSize(pageSize))
- , fAnnotations(NULL)
- , fLastContentEntry(NULL)
- , fLastMarginContentEntry(NULL)
+ , fAnnotations(nullptr)
+ , fLastContentEntry(nullptr)
+ , fLastMarginContentEntry(nullptr)
, fDrawingArea(kContent_DrawingArea)
- , fClipStack(NULL)
+ , fClipStack(nullptr)
, fFontGlyphUsage(new SkPDFGlyphSetMap)
, fRasterDpi(rasterDpi)
, fCanon(canon) {
@@ -731,13 +731,13 @@ SkPDFDevice::~SkPDFDevice() {
}
void SkPDFDevice::init() {
- fAnnotations = NULL;
+ fAnnotations = nullptr;
fContentEntries.free();
- fLastContentEntry = NULL;
+ fLastContentEntry = nullptr;
fMarginContentEntries.free();
- fLastMarginContentEntry = NULL;
+ fLastMarginContentEntry = nullptr;
fDrawingArea = kContent_DrawingArea;
- if (fFontGlyphUsage.get() == NULL) {
+ if (fFontGlyphUsage.get() == nullptr) {
fFontGlyphUsage.reset(new SkPDFGlyphSetMap);
}
}
@@ -946,7 +946,7 @@ static SkPDFDict* create_rect_annotation(const SkRect& r,
if (linkToName) {
return create_link_named_dest(linkToName, r);
}
- return NULL;
+ return nullptr;
}
void SkPDFDevice::drawRect(const SkDraw& d,
@@ -963,7 +963,7 @@ void SkPDFDevice::drawRect(const SkDraw& d,
}
SkPath path;
path.addRect(r);
- drawPath(d, path, paint, NULL, true);
+ drawPath(d, path, paint, nullptr, true);
return;
}
@@ -996,7 +996,7 @@ void SkPDFDevice::drawRRect(const SkDraw& draw,
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addRRect(rrect);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkPDFDevice::drawOval(const SkDraw& draw,
@@ -1006,7 +1006,7 @@ void SkPDFDevice::drawOval(const SkDraw& draw,
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addOval(oval);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkPDFDevice::drawPath(const SkDraw& d,
@@ -1043,14 +1043,14 @@ void SkPDFDevice::drawPath(const SkDraw& d,
bool fill = paint.getFillPath(origPath, pathPtr);
SkPaint noEffectPaint(paint);
- noEffectPaint.setPathEffect(NULL);
+ noEffectPaint.setPathEffect(nullptr);
if (fill) {
noEffectPaint.setStyle(SkPaint::kFill_Style);
} else {
noEffectPaint.setStyle(SkPaint::kStroke_Style);
noEffectPaint.setStrokeWidth(0);
}
- drawPath(d, *pathPtr, noEffectPaint, NULL, true);
+ drawPath(d, *pathPtr, noEffectPaint, nullptr, true);
return;
}
@@ -1154,7 +1154,7 @@ void SkPDFDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap,
SkMatrix transform = matrix;
transform.postConcat(*d.fMatrix);
- this->internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, NULL,
+ this->internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, nullptr,
paint);
}
@@ -1171,7 +1171,7 @@ void SkPDFDevice::drawSprite(const SkDraw& d, const SkBitmap& bitmap,
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y));
- this->internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL,
+ this->internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, nullptr,
paint);
}
@@ -1215,8 +1215,8 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
SkPaint paint = srcPaint;
replace_srcmode_on_opaque_paint(&paint);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- if (paint.getMaskFilter() != NULL) {
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ if (paint.getMaskFilter() != nullptr) {
// Don't pretend we support drawing MaskFilters, it makes for artifacts
// making text unreadable (e.g. same text twice when using CSS shadows).
return;
@@ -1228,7 +1228,7 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
}
SkGlyphStorage storage(0);
- const uint16_t* glyphIDs = NULL;
+ const uint16_t* glyphIDs = nullptr;
int numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -1267,8 +1267,8 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
SkPaint paint = srcPaint;
replace_srcmode_on_opaque_paint(&paint);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- if (paint.getMaskFilter() != NULL) {
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ if (paint.getMaskFilter() != nullptr) {
// Don't pretend we support drawing MaskFilters, it makes for artifacts
// making text unreadable (e.g. same text twice when using CSS shadows).
return;
@@ -1281,7 +1281,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
}
SkGlyphStorage storage(0);
- const uint16_t* glyphIDs = NULL;
+ const uint16_t* glyphIDs = nullptr;
size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -1374,7 +1374,7 @@ void SkPDFDevice::onAttachToCanvas(SkCanvas* canvas) {
void SkPDFDevice::onDetachFromCanvas() {
INHERITED::onDetachFromCanvas();
- fClipStack = NULL;
+ fClipStack = nullptr;
}
SkSurface* SkPDFDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
@@ -1451,7 +1451,7 @@ void SkPDFDevice::copyContentEntriesToData(ContentEntry* entry,
// TODO(ctguil): For margins, I'm not sure fExistingClipStack/Region is the
// right thing to pass here.
GraphicStackState gsState(fExistingClipStack, fExistingClipRegion, data);
- while (entry != NULL) {
+ while (entry != nullptr) {
SkPoint translation;
translation.iset(this->getOrigin());
translation.negate();
@@ -1485,7 +1485,7 @@ void SkPDFDevice::writeContent(SkWStream* out) const {
if (fPageSize != fContentSize) {
SkRect r = SkRect::MakeWH(SkIntToScalar(this->width()),
SkIntToScalar(this->height()));
- emit_clip(NULL, &r, out);
+ emit_clip(nullptr, &r, out);
}
SkPDFDevice::copyContentEntriesToData(fContentEntries.get(), out);
@@ -1525,7 +1525,7 @@ bool SkPDFDevice::handleInversePath(const SkDraw& d, const SkPath& origPath,
// To be consistent with the raster output, hairline strokes
// are rendered as non-inverted.
modifiedPath.toggleInverseFillType();
- drawPath(d, modifiedPath, paint, NULL, true);
+ drawPath(d, modifiedPath, paint, nullptr, true);
return true;
}
}
@@ -1584,7 +1584,7 @@ bool SkPDFDevice::handlePointAnnotation(const SkPoint* points, size_t count,
}
void SkPDFDevice::addAnnotation(SkPDFDict* annotation) {
- if (NULL == fAnnotations) {
+ if (nullptr == fAnnotations) {
fAnnotations = new SkPDFArray;
}
fAnnotations->appendObject(annotation);
@@ -1653,14 +1653,14 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
const SkPaint& paint,
bool hasText,
SkPDFFormXObject** dst) {
- *dst = NULL;
+ *dst = nullptr;
if (clipRegion.isEmpty()) {
- return NULL;
+ return nullptr;
}
// The clip stack can come from an SkDraw where it is technically optional.
SkClipStack synthesizedClipStack;
- if (clipStack == NULL) {
+ if (clipStack == nullptr) {
if (clipRegion == fExistingClipRegion) {
clipStack = &fExistingClipStack;
} else {
@@ -1699,7 +1699,7 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
xfermode != SkXfermode::kSrcOut_Mode) {
// Except for Src and SrcOut, if there isn't anything already there,
// then we're done.
- return NULL;
+ return nullptr;
}
}
// TODO(vandebo): Figure out how/if we can handle the following modes:
@@ -1707,7 +1707,7 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
// Dst xfer mode doesn't draw source at all.
if (xfermode == SkXfermode::kDst_Mode) {
- return NULL;
+ return nullptr;
}
ContentEntry* entry;
@@ -1798,7 +1798,7 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
// If there is shape, then an empty source with Src, SrcIn, SrcOut,
// DstIn, DstAtop or Modulate reduces to Clear and DstOut or SrcAtop
// reduces to Dst.
- if (shape == NULL || xfermode == SkXfermode::kDstOut_Mode ||
+ if (shape == nullptr || xfermode == SkXfermode::kDstOut_Mode ||
xfermode == SkXfermode::kSrcATop_Mode) {
ScopedContentEntry content(this, &fExistingClipStack,
fExistingClipRegion, identity,
@@ -1827,7 +1827,7 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
} else {
SkAutoTUnref<SkPDFFormXObject> dstMaskStorage;
SkPDFFormXObject* dstMask = srcFormXObject.get();
- if (shape != NULL) {
+ if (shape != nullptr) {
// Draw shape into a form-xobject.
SkDraw d;
d.fMatrix = &identity;
@@ -1836,7 +1836,7 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
SkPaint filledPaint;
filledPaint.setColor(SK_ColorBLACK);
filledPaint.setStyle(SkPaint::kFill_Style);
- this->drawPath(d, *shape, filledPaint, NULL, true);
+ this->drawPath(d, *shape, filledPaint, nullptr, true);
dstMaskStorage.reset(createFormXObjectFromDevice());
dstMask = dstMaskStorage.get();
@@ -1915,9 +1915,9 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
const SkPaint& paint,
bool hasText,
GraphicStateEntry* entry) {
- NOT_IMPLEMENTED(paint.getPathEffect() != NULL, false);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- NOT_IMPLEMENTED(paint.getColorFilter() != NULL, false);
+ NOT_IMPLEMENTED(paint.getPathEffect() != nullptr, false);
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ NOT_IMPLEMENTED(paint.getColorFilter() != nullptr, false);
entry->fMatrix = matrix;
entry->fClipStack = clipStack;
@@ -1967,7 +1967,7 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
SkShader::GradientInfo gradientInfo;
SkColor gradientColor;
gradientInfo.fColors = &gradientColor;
- gradientInfo.fColorOffsets = NULL;
+ gradientInfo.fColorOffsets = nullptr;
gradientInfo.fColorCount = 1;
if (shader->asAGradient(&gradientInfo) ==
SkShader::kColor_GradientType) {
@@ -2025,7 +2025,7 @@ int SkPDFDevice::addXObjectResource(SkPDFObject* xObject) {
void SkPDFDevice::updateFont(const SkPaint& paint, uint16_t glyphID,
ContentEntry* contentEntry) {
SkTypeface* typeface = paint.getTypeface();
- if (contentEntry->fState.fFont == NULL ||
+ if (contentEntry->fState.fFont == nullptr ||
contentEntry->fState.fTextSize != paint.getTextSize() ||
!contentEntry->fState.fFont->hasGlyph(glyphID)) {
int fontIndex = getFontResourceIndex(typeface, glyphID);
@@ -2080,7 +2080,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
subsetBitmap = &tmpSubsetBitmap;
*subsetBitmap = origBitmap;
}
- srcRect = NULL;
+ srcRect = nullptr;
// Transform the bitmap in the new space, without taking into
// account the initial transform.
@@ -2156,7 +2156,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
SkScalarCeilToInt(bounds.width()),
SkScalarCeilToInt(bounds.height())));
clipRegion = &perspectiveBounds;
- srcRect = NULL;
+ srcRect = nullptr;
bitmap = &perspectiveBitmap;
}
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 06d3e108ee..fbd5fb3c9c 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -152,7 +152,7 @@ public:
*/
SkPDFArray* copyMediaBox() const;
- /** Get the annotations from this page, or NULL if there are none.
+ /** Get the annotations from this page, or nullptr if there are none.
*/
SkPDFArray* getAnnotations() const { return fAnnotations; }
@@ -247,7 +247,7 @@ private:
bool invertClip);
// If the paint or clip is such that we shouldn't draw anything, this
- // returns NULL and does not create a content entry.
+ // returns nullptr and does not create a content entry.
// setUpContentEntry and finishContentEntry can be used directly, but
// the preferred method is to use the ScopedContentEntry helper class.
ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
@@ -288,7 +288,7 @@ private:
bool handleInversePath(const SkDraw& d, const SkPath& origPath,
const SkPaint& paint, bool pathIsMutable,
- const SkMatrix* prePathMatrix = NULL);
+ const SkMatrix* prePathMatrix = nullptr);
bool handlePointAnnotation(const SkPoint* points, size_t count,
const SkMatrix& matrix, SkAnnotation* annot);
void addAnnotation(SkPDFDict*);
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 25ffc0b851..8df59b77f1 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -77,7 +77,7 @@ bool parsePFB(const uint8_t* src, size_t size, size_t* headerLen,
return parsePFBSection(&srcPtr, &remaining, 1, headerLen) &&
parsePFBSection(&srcPtr, &remaining, 2, dataLen) &&
parsePFBSection(&srcPtr, &remaining, 1, trailerLen) &&
- parsePFBSection(&srcPtr, &remaining, 3, NULL);
+ parsePFBSection(&srcPtr, &remaining, 3, nullptr);
}
/* The sections of a PFA file are implicitly defined. The body starts
@@ -162,13 +162,13 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
// Make as few copies as possible given these constraints.
SkDynamicMemoryWStream dynamicStream;
SkAutoTDelete<SkMemoryStream> staticStream;
- SkData* data = NULL;
+ SkData* data = nullptr;
const uint8_t* src;
size_t srcLen;
if ((srcLen = srcStream->getLength()) > 0) {
staticStream.reset(new SkMemoryStream(srcLen + 1));
src = (const uint8_t*)staticStream->getMemoryBase();
- if (srcStream->getMemoryBase() != NULL) {
+ if (srcStream->getMemoryBase() != nullptr) {
memcpy((void *)src, srcStream->getMemoryBase(), srcLen);
} else {
size_t read = 0;
@@ -176,7 +176,7 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
size_t got = srcStream->read((void *)staticStream->getAtPos(),
srcLen - read);
if (got == 0) {
- return NULL;
+ return nullptr;
}
read += got;
staticStream->seek(read);
@@ -191,7 +191,7 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
dynamicStream.write(buf, amount);
}
amount = 0;
- dynamicStream.write(&amount, 1); // NULL terminator.
+ dynamicStream.write(&amount, 1); // nullptr terminator.
data = dynamicStream.copyToData();
src = data->bytes();
srcLen = data->size() - 1;
@@ -268,7 +268,7 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
return SkData::NewFromMalloc(buffer.detach(), length);
}
- return NULL;
+ return nullptr;
}
// scale from em-units to base-1000, returning as a SkScalar
@@ -329,7 +329,7 @@ SkPDFArray* composeAdvanceData(
SkPDFArray* array),
Data* defaultAdvance) {
SkPDFArray* result = new SkPDFArray();
- for (; advanceInfo != NULL; advanceInfo = advanceInfo->fNext.get()) {
+ for (; advanceInfo != nullptr; advanceInfo = advanceInfo->fNext.get()) {
switch (advanceInfo->fType) {
case SkAdvancedTypefaceMetrics::WidthRange::kDefault: {
SkASSERT(advanceInfo->fAdvance.count() == 1);
@@ -520,7 +520,7 @@ void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
for (int i = firstGlyphID - glyphOffset; i < limit + 1; ++i) {
bool inSubset = i < limit &&
- (subset == NULL || subset->has(i + glyphOffset));
+ (subset == nullptr || subset->has(i + glyphOffset));
if (!rangeEmpty) {
// PDF spec requires bfrange not changing the higher byte,
// e.g. <1035> <10FF> <2222> is ok, but
@@ -596,11 +596,11 @@ static size_t get_subset_font_stream(const char* fontName,
size_t fontSize = fontData->getLength();
// Read font into buffer.
- SkPDFStream* subsetFontStream = NULL;
+ SkPDFStream* subsetFontStream = nullptr;
SkTDArray<unsigned char> originalFont;
originalFont.setCount(SkToInt(fontSize));
if (fontData->read(originalFont.begin(), fontSize) == fontSize) {
- unsigned char* subsetFont = NULL;
+ unsigned char* subsetFont = nullptr;
// sfntly requires unsigned int* to be passed in, as far as we know,
// unsigned int is equivalent to uint32_t on all platforms.
static_assert(sizeof(unsigned int) == sizeof(uint32_t), "unsigned_int_not_32_bits");
@@ -610,11 +610,11 @@ static size_t get_subset_font_stream(const char* fontName,
subset.begin(),
subset.count(),
&subsetFont);
- if (subsetFontSize > 0 && subsetFont != NULL) {
+ if (subsetFontSize > 0 && subsetFont != nullptr) {
SkAutoDataUnref data(SkData::NewWithProc(subsetFont,
subsetFontSize,
sk_delete_array,
- NULL));
+ nullptr));
subsetFontStream = new SkPDFStream(data.get());
fontSize = subsetFontSize;
}
@@ -671,7 +671,7 @@ SkPDFGlyphSetMap::F2BIter::F2BIter(const SkPDFGlyphSetMap& map) {
const SkPDFGlyphSetMap::FontGlyphSetPair* SkPDFGlyphSetMap::F2BIter::next() const {
if (fIndex >= fMap->count()) {
- return NULL;
+ return nullptr;
}
return &((*fMap)[fIndex++]);
}
@@ -697,7 +697,7 @@ void SkPDFGlyphSetMap::merge(const SkPDFGlyphSetMap& usage) {
void SkPDFGlyphSetMap::reset() {
for (int i = 0; i < fMap.count(); ++i) {
- delete fMap[i].fGlyphSet; // Should not be NULL.
+ delete fMap[i].fGlyphSet; // Should not be nullptr.
}
fMap.reset();
}
@@ -806,7 +806,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
}
SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics;
- SkPDFDict* relatedFontDescriptor = NULL;
+ SkPDFDict* relatedFontDescriptor = nullptr;
if (relatedFont) {
fontMetrics.reset(SkSafeRef(relatedFont->fontInfo()));
relatedFontDescriptor = relatedFont->getFontDescriptor();
@@ -832,7 +832,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
info, SkTypeface::kHAdvance_PerGlyphInfo);
#endif
fontMetrics.reset(
- typeface->getAdvancedTypefaceMetrics(info, NULL, 0));
+ typeface->getAdvancedTypefaceMetrics(info, nullptr, 0));
#if defined (SK_SFNTLY_SUBSETTER)
if (fontMetrics.get() &&
fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) {
@@ -840,7 +840,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
info = SkTBitOr<SkTypeface::PerGlyphInfo>(
info, SkTypeface::kHAdvance_PerGlyphInfo);
fontMetrics.reset(
- typeface->getAdvancedTypefaceMetrics(info, NULL, 0));
+ typeface->getAdvancedTypefaceMetrics(info, nullptr, 0));
}
#endif
}
@@ -852,7 +852,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
}
SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
- return NULL; // Default: no support.
+ return nullptr; // Default: no support.
}
SkPDFFont::SkPDFFont(const SkAdvancedTypefaceMetrics* info,
@@ -864,7 +864,7 @@ SkPDFFont::SkPDFFont(const SkAdvancedTypefaceMetrics* info,
, fLastGlyphID(info ? info->fLastGlyphID : 0)
, fFontInfo(SkSafeRef(info))
, fDescriptor(SkSafeRef(relatedFontDescriptor)) {
- if (info == NULL ||
+ if (info == nullptr ||
info->fFlags & SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag) {
fFontType = SkAdvancedTypefaceMetrics::kOther_Font;
} else {
@@ -886,7 +886,7 @@ SkPDFFont* SkPDFFont::Create(SkPDFCanon* canon,
}
if (type == SkAdvancedTypefaceMetrics::kType1CID_Font ||
type == SkAdvancedTypefaceMetrics::kTrueType_Font) {
- SkASSERT(relatedFontDescriptor == NULL);
+ SkASSERT(relatedFontDescriptor == nullptr);
return new SkPDFType0Font(info, typeface);
}
if (type == SkAdvancedTypefaceMetrics::kType1_Font) {
@@ -904,7 +904,7 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::fontInfo() {
}
void SkPDFFont::setFontInfo(const SkAdvancedTypefaceMetrics* info) {
- if (info == NULL || info == fFontInfo.get()) {
+ if (info == nullptr || info == fFontInfo.get()) {
return;
}
fFontInfo.reset(info);
@@ -933,7 +933,7 @@ void SkPDFFont::setFontDescriptor(SkPDFDict* descriptor) {
}
bool SkPDFFont::addCommonFontDescriptorEntries(int16_t defaultWidth) {
- if (fDescriptor.get() == NULL) {
+ if (fDescriptor.get() == nullptr) {
return false;
}
@@ -970,7 +970,7 @@ void SkPDFFont::adjustGlyphRangeForSingleByteEncoding(uint16_t glyphID) {
}
void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
- if (fFontInfo == NULL || fFontInfo->fGlyphToUnicode.begin() == NULL) {
+ if (fFontInfo == nullptr || fFontInfo->fGlyphToUnicode.begin() == nullptr) {
return;
}
this->insertObjRef("ToUnicode",
@@ -986,10 +986,10 @@ void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
///////////////////////////////////////////////////////////////////////////////
SkPDFType0Font::SkPDFType0Font(const SkAdvancedTypefaceMetrics* info, SkTypeface* typeface)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
SkDEBUGCODE(fPopulated = false);
if (!canSubset()) {
- this->populate(NULL);
+ this->populate(nullptr);
}
}
@@ -997,7 +997,7 @@ SkPDFType0Font::~SkPDFType0Font() {}
SkPDFFont* SkPDFType0Font::getFontSubset(const SkPDFGlyphSet* subset) {
if (!canSubset()) {
- return NULL;
+ return nullptr;
}
SkPDFType0Font* newSubset = new SkPDFType0Font(fontInfo(), typeface());
newSubset->populate(subset);
@@ -1037,7 +1037,7 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
SkPDFCIDFont::SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
const SkPDFGlyphSet* subset)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
this->populate(subset);
}
@@ -1062,7 +1062,7 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
#if defined(SK_SFNTLY_SUBSETTER)
if (this->canSubset()) {
SkAutoTUnref<SkPDFStream> fontStream;
- SkPDFStream* rawStream = NULL;
+ SkPDFStream* rawStream = nullptr;
fontSize = get_subset_font_stream(fontInfo()->fFontName.c_str(),
typeface(),
*subset,
@@ -1077,7 +1077,7 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
#endif
SkAutoTUnref<SkPDFSharedStream> fontStream;
SkAutoTDelete<SkStreamAsset> fontData(
- this->typeface()->openStream(NULL));
+ this->typeface()->openStream(nullptr));
SkASSERT(fontData);
fontSize = fontData->getLength();
SkASSERT(fontSize > 0);
@@ -1089,7 +1089,7 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
case SkAdvancedTypefaceMetrics::kCFF_Font:
case SkAdvancedTypefaceMetrics::kType1CID_Font: {
SkAutoTUnref<SkPDFSharedStream> fontStream(
- new SkPDFSharedStream(this->typeface()->openStream(NULL)));
+ new SkPDFSharedStream(this->typeface()->openStream(nullptr)));
if (getType() == SkAdvancedTypefaceMetrics::kCFF_Font) {
fontStream->dict()->insertName("Subtype", "Type1C");
@@ -1123,7 +1123,7 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
info = SkTypeface::kGlyphNames_PerGlyphInfo;
info = SkTBitOr<SkTypeface::PerGlyphInfo>(
info, SkTypeface::kHAdvance_PerGlyphInfo);
- uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin();
+ uint32_t* glyphs = (glyphIDs.count() == 0) ? nullptr : glyphIDs.begin();
uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0;
SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics(
typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount));
@@ -1131,7 +1131,7 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
addFontDescriptor(0, &glyphIDs);
} else {
// Other CID fonts
- addFontDescriptor(0, NULL);
+ addFontDescriptor(0, nullptr);
}
insertName("BaseFont", fontInfo()->fFontName);
@@ -1219,7 +1219,7 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
SkAutoTDelete<SkStream> rawFontData(typeface()->openStream(&ttcIndex));
SkAutoTUnref<SkData> fontData(handle_type1_stream(rawFontData.get(), &header,
&data, &trailer));
- if (fontData.get() == NULL) {
+ if (fontData.get() == nullptr) {
return false;
}
if (canEmbed()) {
@@ -1242,10 +1242,10 @@ bool SkPDFType1Font::populate(int16_t glyphID) {
adjustGlyphRangeForSingleByteEncoding(glyphID);
int16_t defaultWidth = 0;
- const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry = NULL;
+ const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry = nullptr;
const SkAdvancedTypefaceMetrics::WidthRange* widthEntry;
for (widthEntry = fontInfo()->fGlyphWidths.get();
- widthEntry != NULL;
+ widthEntry != nullptr;
widthEntry = widthEntry->fNext.get()) {
switch (widthEntry->fType) {
case SkAdvancedTypefaceMetrics::WidthRange::kDefault:
@@ -1255,7 +1255,7 @@ bool SkPDFType1Font::populate(int16_t glyphID) {
SkASSERT(false);
break;
case SkAdvancedTypefaceMetrics::WidthRange::kRange:
- SkASSERT(widthRangeEntry == NULL);
+ SkASSERT(widthRangeEntry == nullptr);
widthRangeEntry = widthEntry;
break;
}
@@ -1320,7 +1320,7 @@ void SkPDFType1Font::addWidthInfoFromRange(
SkPDFType3Font::SkPDFType3Font(const SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
uint16_t glyphID)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
this->populate(glyphID);
}
@@ -1331,7 +1331,7 @@ bool SkPDFType3Font::populate(uint16_t glyphID) {
paint.setTypeface(typeface());
paint.setTextSize(1000);
const SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- SkAutoGlyphCache autoCache(paint, &props, NULL);
+ SkAutoGlyphCache autoCache(paint, &props, nullptr);
SkGlyphCache* cache = autoCache.getCache();
// If fLastGlyphID isn't set (because there is not fFontInfo), look it up.
if (lastGlyphID() == 0) {
@@ -1394,7 +1394,7 @@ bool SkPDFType3Font::populate(uint16_t glyphID) {
this->insertObject("Widths", widthArray.detach());
this->insertName("CIDToGIDMap", "Identity");
- this->populateToUnicodeTable(NULL);
+ this->populateToUnicodeTable(nullptr);
return true;
}
@@ -1409,7 +1409,7 @@ SkPDFFont::Match SkPDFFont::IsMatch(SkPDFFont* existingFont,
if (existingGlyphID == 0 || searchGlyphID == 0) {
return SkPDFFont::kExact_Match;
}
- if (existingFont != NULL) {
+ if (existingFont != nullptr) {
return (existingFont->fFirstGlyphID <= searchGlyphID &&
searchGlyphID <= existingFont->fLastGlyphID)
? SkPDFFont::kExact_Match
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index d85c5826d3..404e8b7621 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -82,7 +82,7 @@ class SkPDFFont : public SkPDFDict {
public:
virtual ~SkPDFFont();
- /** Returns the typeface represented by this class. Returns NULL for the
+ /** Returns the typeface represented by this class. Returns nullptr for the
* default typeface.
*/
SkTypeface* typeface();
@@ -133,7 +133,7 @@ public:
/** Subset the font based on usage set. Returns a SkPDFFont instance with
* subset.
* @param usage Glyph subset requested.
- * @return NULL if font does not support subsetting, a new instance
+ * @return nullptr if font does not support subsetting, a new instance
* of SkPDFFont otherwise.
*/
virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
@@ -175,7 +175,7 @@ protected:
void adjustGlyphRangeForSingleByteEncoding(uint16_t glyphID);
// Generate ToUnicode table according to glyph usage subset.
- // If subset is NULL, all available glyph ids will be used.
+ // If subset is nullptr, all available glyph ids will be used.
void populateToUnicodeTable(const SkPDFGlyphSet* subset);
// Create instances of derived types based on fontInfo.
diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp
index 07f42facb3..09db1404c9 100644
--- a/src/pdf/SkPDFFormXObject.cpp
+++ b/src/pdf/SkPDFFormXObject.cpp
@@ -25,7 +25,7 @@ SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) {
this->setData(content.get());
SkAutoTUnref<SkPDFArray> bboxArray(device->copyMediaBox());
- this->init(NULL, resourceDict.get(), bboxArray);
+ this->init(nullptr, resourceDict.get(), bboxArray);
// We invert the initial transform and apply that to the xobject so that
// it doesn't get applied twice. We can't just undo it because it's
@@ -68,7 +68,7 @@ void SkPDFFormXObject::init(const char* colorSpace,
SkAutoTUnref<SkPDFDict> group(new SkPDFDict("Group"));
group->insertName("S", "Transparency");
- if (colorSpace != NULL) {
+ if (colorSpace != nullptr) {
group->insertName("CS", colorSpace);
}
group->insertBool("I", true); // Isolated.
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index bff32aec36..162ddc8447 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -65,9 +65,9 @@ static const char* as_blend_mode(SkXfermode::Mode mode) {
// TODO(vandebo): Figure out if we can support more of these modes.
case SkXfermode::kXor_Mode:
case SkXfermode::kPlus_Mode:
- return NULL;
+ return nullptr;
}
- return NULL;
+ return nullptr;
}
// If a SkXfermode is unsupported in PDF, this function returns
diff --git a/src/pdf/SkPDFResourceDict.h b/src/pdf/SkPDFResourceDict.h
index 291377903f..698823b36c 100644
--- a/src/pdf/SkPDFResourceDict.h
+++ b/src/pdf/SkPDFResourceDict.h
@@ -34,7 +34,7 @@ public:
* The full set of ProcSet entries is automatically created for backwards
* compatibility, as recommended by the PDF spec.
*
- * Any arguments can be NULL.
+ * Any arguments can be nullptr.
*/
static SkPDFDict* Create(
const SkTDArray<SkPDFObject*>* gStateResources,
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 6b4e758950..645091dad2 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -495,7 +495,7 @@ static SkPDFObject* get_pdf_shader_by_state(
// handle compose shader by pulling things up to a layer, drawing with
// the first shader, applying the xfer mode and drawing again with the
// second shader, then applying the layer to the original drawing.
- return NULL;
+ return nullptr;
} else if (state.fType == SkShader::kNone_GradientType) {
SkPDFObject* shader = canon->findImageShader(state);
return shader ? SkRef(shader)
@@ -533,7 +533,7 @@ static SkPDFDict* get_gradient_resource_dict(
if (gState) {
graphicStates.push(gState);
}
- return SkPDFResourceDict::Create(&graphicStates, &patterns, NULL, NULL);
+ return SkPDFResourceDict::Create(&graphicStates, &patterns, nullptr, nullptr);
}
static void populate_tiling_pattern_dict(SkPDFDict* pattern,
@@ -592,7 +592,7 @@ static SkPDFObject* create_smask_graphic_state(
SkAutoTDelete<SkStream> alphaStream(create_pattern_fill_content(-1, bbox));
SkAutoTUnref<SkPDFDict>
- resources(get_gradient_resource_dict(luminosityShader, NULL));
+ resources(get_gradient_resource_dict(luminosityShader, nullptr));
SkAutoTUnref<SkPDFFormXObject> alphaMask(
new SkPDFFormXObject(alphaStream.get(), bbox, resources.get()));
@@ -615,7 +615,7 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
SkAutoTUnref<SkPDFObject> colorShader(
get_pdf_shader_by_state(canon, dpi, &opaqueState));
if (!colorShader) {
- return NULL;
+ return nullptr;
}
// Create resource dict with alpha graphics state as G0 and
@@ -712,7 +712,7 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
const SkPDFShader::State& state = **autoState;
SkString (*codeFunction)(const SkShader::GradientInfo& info,
- const SkMatrix& perspectiveRemover) = NULL;
+ const SkMatrix& perspectiveRemover) = nullptr;
SkPoint transformPoints[2];
// Depending on the type of the gradient, we want to transform the
@@ -743,7 +743,7 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
case SkShader::kColor_GradientType:
case SkShader::kNone_GradientType:
default:
- return NULL;
+ return nullptr;
}
// Move any scaling (assuming a unit gradient) or translation
@@ -766,14 +766,14 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
if (finalMatrix.hasPerspective()) {
if (!split_perspective(finalMatrix,
&finalMatrix, &perspectiveInverseOnly)) {
- return NULL;
+ return nullptr;
}
}
SkRect bbox;
bbox.set(state.fBBox);
if (!inverse_transform_bbox(finalMatrix, &bbox)) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkPDFArray> domain(new SkPDFArray);
@@ -792,7 +792,7 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
SkShader::GradientInfo twoPointRadialInfo = *info;
SkMatrix inverseMapperMatrix;
if (!mapperMatrix.invert(&inverseMapperMatrix)) {
- return NULL;
+ return nullptr;
}
inverseMapperMatrix.mapPoints(twoPointRadialInfo.fPoint, 2);
twoPointRadialInfo.fRadius[0] =
@@ -843,7 +843,7 @@ SkPDFImageShader* SkPDFImageShader::Create(
SkRect deviceBounds;
deviceBounds.set(state.fBBox);
if (!inverse_transform_bbox(finalMatrix, &deviceBounds)) {
- return NULL;
+ return nullptr;
}
const SkBitmap* image = &state.fImage;
@@ -1099,8 +1099,8 @@ SkPDFShader::State::State(const SkShader& shader, const SkMatrix& canvasTransfor
fBBox(bbox),
fPixelGeneration(0) {
fInfo.fColorCount = 0;
- fInfo.fColors = NULL;
- fInfo.fColorOffsets = NULL;
+ fInfo.fColors = nullptr;
+ fInfo.fColorOffsets = nullptr;
fShaderTransform = shader.getLocalMatrix();
fImageTileModes[0] = fImageTileModes[1] = SkShader::kClamp_TileMode;
diff --git a/src/pdf/SkPDFShader.h b/src/pdf/SkPDFShader.h
index 1cc36cee19..9380b57a72 100644
--- a/src/pdf/SkPDFShader.h
+++ b/src/pdf/SkPDFShader.h
@@ -29,7 +29,7 @@ public:
class State;
/** Get the PDF shader for the passed SkShader. If the SkShader is
- * invalid in some way, returns NULL. The reference count of
+ * invalid in some way, returns nullptr. The reference count of
* the object is incremented and it is the caller's responsibility to
* unreference it when done. This is needed to accommodate the weak
* reference pattern used when the returned object is new and has no
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h
index 07c62f525a..c4217f3bf9 100644
--- a/src/pipe/SkGPipePriv.h
+++ b/src/pipe/SkGPipePriv.h
@@ -172,8 +172,8 @@ public:
: fBitmap(bitmap)
, fGenID(genID)
, fBytesAllocated(0)
- , fMoreRecentlyUsed(NULL)
- , fLessRecentlyUsed(NULL)
+ , fMoreRecentlyUsed(nullptr)
+ , fLessRecentlyUsed(nullptr)
, fToBeDrawnCount(toBeDrawnCount)
{}
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 97cae90034..4d57a6cca9 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -118,7 +118,7 @@ public:
SkFlattenable* getFlat(unsigned index) const {
if (0 == index) {
- return NULL;
+ return nullptr;
}
return fFlatArray[index - 1];
}
@@ -174,7 +174,7 @@ public:
void releaseRef(int32_t) override {}
void setSharedHeap(SkBitmapHeap* heap) {
- SkASSERT(!shouldFlattenBitmaps(fFlags) || NULL == heap);
+ SkASSERT(!shouldFlattenBitmaps(fFlags) || nullptr == heap);
SkRefCnt_SafeAssign(fSharedHeap, heap);
this->updateReader();
}
@@ -200,7 +200,7 @@ public:
}
SkTypeface* getTypeface(unsigned id) const {
- return id ? fTypefaces[id - 1] : NULL;
+ return id ? fTypefaces[id - 1] : nullptr;
}
const SkImage* getImage(int32_t slot) const {
@@ -209,7 +209,7 @@ public:
private:
void updateReader() {
- if (NULL == fReader) {
+ if (nullptr == fReader) {
return;
}
bool crossProcess = SkToBool(fFlags & SkGPipeWriter::kCrossProcess_Flag);
@@ -218,7 +218,7 @@ private:
if (crossProcess) {
fReader->setFactoryArray(&fFactoryArray);
} else {
- fReader->setFactoryArray(NULL);
+ fReader->setFactoryArray(nullptr);
}
if (shouldFlattenBitmaps(fFlags)) {
@@ -337,11 +337,11 @@ static void saveLayer_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
unsigned flags = DrawOp_unpackFlags(op32);
SkCanvas::SaveFlags saveFlags = (SkCanvas::SaveFlags)DrawOp_unpackData(op32);
- const SkRect* bounds = NULL;
+ const SkRect* bounds = nullptr;
if (flags & kSaveLayer_HasBounds_DrawOpFlag) {
bounds = skip<SkRect>(reader);
}
- const SkPaint* paint = NULL;
+ const SkPaint* paint = nullptr;
if (flags & kSaveLayer_HasPaint_DrawOpFlag) {
paint = &state->paint();
}
@@ -414,11 +414,11 @@ static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
const SkPoint* cubics = skip<SkPoint>(reader, SkPatchUtils::kNumCtrlPts);
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
if (flags & kDrawVertices_HasColors_DrawOpFlag) {
colors = skip<SkColor>(reader, SkPatchUtils::kNumCorners);
}
- const SkPoint* texCoords = NULL;
+ const SkPoint* texCoords = nullptr;
if (flags & kDrawVertices_HasTexs_DrawOpFlag) {
texCoords = skip<SkPoint>(reader, SkPatchUtils::kNumCorners);
}
@@ -452,12 +452,12 @@ static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
int vertexCount = reader->readU32();
const SkPoint* verts = skip<SkPoint>(reader, vertexCount);
- const SkPoint* texs = NULL;
+ const SkPoint* texs = nullptr;
if (flags & kDrawVertices_HasTexs_DrawOpFlag) {
texs = skip<SkPoint>(reader, vertexCount);
}
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
if (flags & kDrawVertices_HasColors_DrawOpFlag) {
colors = skip<SkColor>(reader, vertexCount);
}
@@ -469,7 +469,7 @@ static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
}
int indexCount = 0;
- const uint16_t* indices = NULL;
+ const uint16_t* indices = nullptr;
if (flags & kDrawVertices_HasIndices_DrawOpFlag) {
indexCount = reader->readU32();
indices = skipAlign<uint16_t>(reader, indexCount);
@@ -483,7 +483,7 @@ static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
static void drawAtlas_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, SkGPipeState* state) {
unsigned flags = DrawOp_unpackFlags(op32);
- const SkPaint* paint = NULL;
+ const SkPaint* paint = nullptr;
if (flags & kDrawAtlas_HasPaint_DrawOpFlag) {
paint = &state->paint();
}
@@ -493,11 +493,11 @@ static void drawAtlas_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, Sk
SkXfermode::Mode mode = (SkXfermode::Mode)reader->readU32();
const SkRSXform* xform = skip<SkRSXform>(reader, count);
const SkRect* tex = skip<SkRect>(reader, count);
- const SkColor* colors = NULL;
+ const SkColor* colors = nullptr;
if (flags & kDrawAtlas_HasColors_DrawOpFlag) {
colors = skip<SkColor>(reader, count);
}
- const SkRect* cull = NULL;
+ const SkRect* cull = nullptr;
if (flags & kDrawAtlas_HasCull_DrawOpFlag) {
cull = skip<SkRect>(reader, 1);
}
@@ -551,7 +551,7 @@ static void drawTextOnPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op3
reader->readPath(&path);
SkMatrix matrixStorage;
- const SkMatrix* matrix = NULL;
+ const SkMatrix* matrix = nullptr;
if (DrawOp_unpackFlags(op32) & kDrawTextOnPath_HasMatrix_DrawOpFlag) {
reader->readMatrix(&matrixStorage);
matrix = &matrixStorage;
@@ -567,7 +567,7 @@ class BitmapHolder : SkNoncopyable {
public:
BitmapHolder(SkReader32* reader, uint32_t op32, SkGPipeState* state);
~BitmapHolder() {
- if (fHeapEntry != NULL) {
+ if (fHeapEntry != nullptr) {
fHeapEntry->releaseRef();
}
}
@@ -585,7 +585,7 @@ BitmapHolder::BitmapHolder(SkReader32* reader, uint32_t op32,
const unsigned flags = state->getFlags();
const unsigned index = DrawOp_unpackData(op32);
if (shouldFlattenBitmaps(flags)) {
- fHeapEntry = NULL;
+ fHeapEntry = nullptr;
fBitmap = state->getBitmap(index);
} else {
SkBitmapHeapEntry* entry = state->getSharedHeap()->getEntry(index);
@@ -596,7 +596,7 @@ BitmapHolder::BitmapHolder(SkReader32* reader, uint32_t op32,
fBitmap = &fBitmapStorage;
// Release the ref on the bitmap now, since we made our own copy.
entry->releaseRef();
- fHeapEntry = NULL;
+ fHeapEntry = nullptr;
} else {
SkASSERT(!shouldFlattenBitmaps(flags));
SkASSERT(!SkToBool(flags & SkGPipeWriter::kSimultaneousReaders_Flag));
@@ -614,7 +614,7 @@ static void drawBitmap_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkScalar top = reader->readScalar();
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
- canvas->drawBitmap(*bitmap, left, top, hasPaint ? &state->paint() : NULL);
+ canvas->drawBitmap(*bitmap, left, top, hasPaint ? &state->paint() : nullptr);
}
}
@@ -627,7 +627,7 @@ static void drawBitmapNine_rp(SkCanvas* canvas, SkReader32* reader,
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawBitmapNine(*bitmap, *center, *dst,
- hasPaint ? &state->paint() : NULL);
+ hasPaint ? &state->paint() : nullptr);
}
}
@@ -641,7 +641,7 @@ static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader,
if (hasSrc) {
src = skip<SkRect>(reader);
} else {
- src = NULL;
+ src = nullptr;
}
SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectConstraint;
if (flags & kDrawBitmap_Bleed_DrawOpFlag) {
@@ -650,7 +650,7 @@ static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader,
const SkRect* dst = skip<SkRect>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
- canvas->legacy_drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->paint() : NULL, constraint);
+ canvas->legacy_drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->paint() : nullptr, constraint);
}
}
@@ -661,7 +661,7 @@ static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
const SkIPoint* point = skip<SkIPoint>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
- canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->paint() : NULL);
+ canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->paint() : nullptr);
}
}
@@ -673,7 +673,7 @@ static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, Sk
SkScalar y = reader->readScalar();
const SkImage* image = state->getImage(slot);
if (state->shouldDraw()) {
- canvas->drawImage(image, x, y, hasPaint ? &state->paint() : NULL);
+ canvas->drawImage(image, x, y, hasPaint ? &state->paint() : nullptr);
}
}
@@ -683,7 +683,7 @@ static void drawImageRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32
unsigned flags = DrawOp_unpackFlags(op32);
bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag);
bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag);
- const SkRect* src = NULL;
+ const SkRect* src = nullptr;
if (hasSrc) {
src = skip<SkRect>(reader);
}
@@ -692,7 +692,7 @@ static void drawImageRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32
const SkImage* image = state->getImage(slot);
if (state->shouldDraw()) {
- canvas->legacy_drawImageRect(image, src, *dst, hasPaint ? &state->paint() : NULL, constraint);
+ canvas->legacy_drawImageRect(image, src, *dst, hasPaint ? &state->paint() : nullptr, constraint);
}
}
@@ -705,7 +705,7 @@ static void drawImageNine_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32
const SkRect* dst = skip<SkRect>(reader);
const SkImage* image = state->getImage(slot);
if (state->shouldDraw()) {
- canvas->drawImageNine(image, *center, *dst, hasPaint ? &state->paint() : NULL);
+ canvas->drawImageNine(image, *center, *dst, hasPaint ? &state->paint() : nullptr);
}
}
@@ -812,7 +812,7 @@ static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32,
p->setAnnotation(SkAnnotation::Create(buffer))->unref();
SkASSERT(buffer.offset() == size);
} else {
- p->setAnnotation(NULL);
+ p->setAnnotation(nullptr);
}
}
@@ -925,7 +925,7 @@ static const ReadProc gReadTable[] = {
SkGPipeState::SkGPipeState()
: fReader(0)
, fSilent(false)
- , fSharedHeap(NULL)
+ , fSharedHeap(nullptr)
, fFlags(0) {
}
@@ -942,16 +942,16 @@ SkGPipeState::~SkGPipeState() {
#include "SkGPipe.h"
SkGPipeReader::SkGPipeReader() {
- fCanvas = NULL;
- fState = NULL;
- fProc = NULL;
+ fCanvas = nullptr;
+ fState = nullptr;
+ fProc = nullptr;
}
SkGPipeReader::SkGPipeReader(SkCanvas* target) {
- fCanvas = NULL;
+ fCanvas = nullptr;
this->setCanvas(target);
- fState = NULL;
- fProc = NULL;
+ fState = nullptr;
+ fProc = nullptr;
}
void SkGPipeReader::setCanvas(SkCanvas *target) {
@@ -965,11 +965,11 @@ SkGPipeReader::~SkGPipeReader() {
SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
uint32_t playbackFlags, size_t* bytesRead) {
- if (NULL == fCanvas) {
+ if (nullptr == fCanvas) {
return kError_Status;
}
- if (NULL == fState) {
+ if (nullptr == fState) {
fState = new SkGPipeState;
}
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index b74b36d0cc..0fccb80d0a 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -53,7 +53,7 @@ static SkFlattenable* get_paintflat(const SkPaint& paint, unsigned paintFlat) {
case kXfermode_PaintFlat: return paint.getXfermode();
}
SkDEBUGFAIL("never gets here");
- return NULL;
+ return nullptr;
}
static size_t writeTypeface(SkWriter32* writer, SkTypeface* typeface) {
@@ -76,7 +76,7 @@ public:
FlattenableHeap(int numFlatsToKeep, SkNamedFactorySet* fset, bool isCrossProcess)
: INHERITED(isCrossProcess ? SkWriteBuffer::kCrossProcess_Flag : 0)
, fNumFlatsToKeep(numFlatsToKeep) {
- SkASSERT((isCrossProcess && fset != NULL) || (!isCrossProcess && NULL == fset));
+ SkASSERT((isCrossProcess && fset != nullptr) || (!isCrossProcess && nullptr == fset));
if (isCrossProcess) {
this->setNamedFactorySet(fset);
}
@@ -150,7 +150,7 @@ const SkFlatData* FlattenableHeap::flatToReplace() const {
}
}
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -229,10 +229,10 @@ public:
size_t storageAllocatedForRecording() {
size_t bytesAllocated = 0;
- if (NULL != fBitmapHeap) {
+ if (nullptr != fBitmapHeap) {
bytesAllocated += fBitmapHeap->bytesAllocated();
}
- if (NULL != fImageHeap) {
+ if (nullptr != fImageHeap) {
bytesAllocated += fImageHeap->bytesInCache();
}
return bytesAllocated;
@@ -375,7 +375,7 @@ private:
void SkGPipeCanvas::flattenFactoryNames() {
const char* name;
- while ((name = fFactorySet->getNextAddedFactoryName()) != NULL) {
+ while ((name = fFactorySet->getNextAddedFactoryName()) != nullptr) {
size_t len = strlen(name);
if (this->needOpBytes(SkWriter32::WriteStringSize(name, len))) {
this->writeOp(kDef_Factory_DrawOp);
@@ -400,11 +400,11 @@ bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) {
return false;
}
-// return 0 for NULL (or unflattenable obj), or index-base-1
+// return 0 for nullptr (or unflattenable obj), or index-base-1
// return ~(index-base-1) if an old flattenable was replaced
int SkGPipeCanvas::flattenToIndex(SkFlattenable* obj, PaintFlats paintflat) {
- SkASSERT(!fDone && fBitmapHeap != NULL);
- if (NULL == obj) {
+ SkASSERT(!fDone && fBitmapHeap != nullptr);
+ if (nullptr == obj) {
return 0;
}
@@ -442,7 +442,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
uint32_t width,
uint32_t height)
: SkCanvas(width, height)
- , fFactorySet(is_cross_process(flags) ? new SkNamedFactorySet : NULL)
+ , fFactorySet(is_cross_process(flags) ? new SkNamedFactorySet : nullptr)
, fWriter(*writer)
, fFlags(flags)
, fFlattenableHeap(FLATTENABLES_TO_KEEP, fFactorySet, is_cross_process(flags))
@@ -501,7 +501,7 @@ bool SkGPipeCanvas::needOpBytes(size_t needed) {
needed = SkTMax<size_t>(MIN_BLOCK_SIZE, needed);
void* block = fController->requestBlock(needed, &fBlockSize);
- if (NULL == block) {
+ if (nullptr == block) {
// Do not notify the readers, which would call this function again.
this->finish(false);
return false;
@@ -519,7 +519,7 @@ uint32_t SkGPipeCanvas::getTypefaceID(SkTypeface* face) {
id = fTypefaceSet.find(face);
if (0 == id) {
id = fTypefaceSet.add(face);
- size_t size = writeTypeface(NULL, face);
+ size_t size = writeTypeface(nullptr, face);
if (this->needOpBytes(size)) {
this->writeOp(kDef_Typeface_DrawOp);
writeTypeface(&fWriter, face);
@@ -596,7 +596,7 @@ void SkGPipeCanvas::recordScale(const SkMatrix& m) {
}
void SkGPipeCanvas::recordConcat(const SkMatrix& m) {
- if (this->needOpBytes(m.writeToMemory(NULL))) {
+ if (this->needOpBytes(m.writeToMemory(nullptr))) {
this->writeOp(kConcat_DrawOp);
fWriter.writeMatrix(m);
}
@@ -623,7 +623,7 @@ void SkGPipeCanvas::didConcat(const SkMatrix& matrix) {
void SkGPipeCanvas::didSetMatrix(const SkMatrix& matrix) {
NOTIFY_SETUP(this);
- if (this->needOpBytes(matrix.writeToMemory(NULL))) {
+ if (this->needOpBytes(matrix.writeToMemory(nullptr))) {
this->writeOp(kSetMatrix_DrawOp);
fWriter.writeMatrix(matrix);
}
@@ -661,7 +661,7 @@ void SkGPipeCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op rgnOp,
void SkGPipeCanvas::onClipPath(const SkPath& path, SkRegion::Op rgnOp,
ClipEdgeStyle edgeStyle) {
NOTIFY_SETUP(this);
- if (this->needOpBytes(path.writeToMemory(NULL))) {
+ if (this->needOpBytes(path.writeToMemory(nullptr))) {
unsigned flags = 0;
if (kSoft_ClipEdgeStyle == edgeStyle) {
flags = kClip_HasAntiAlias_DrawOpFlag;
@@ -675,7 +675,7 @@ void SkGPipeCanvas::onClipPath(const SkPath& path, SkRegion::Op rgnOp,
void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) {
NOTIFY_SETUP(this);
- if (this->needOpBytes(region.writeToMemory(NULL))) {
+ if (this->needOpBytes(region.writeToMemory(nullptr))) {
this->writeOp(kClipRegion_DrawOp, 0, rgnOp);
fWriter.writeRegion(region);
}
@@ -746,7 +746,7 @@ void SkGPipeCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
void SkGPipeCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
- if (this->needOpBytes(path.writeToMemory(NULL))) {
+ if (this->needOpBytes(path.writeToMemory(nullptr))) {
this->writeOp(kDrawPath_DrawOp);
fWriter.writePath(path);
}
@@ -760,13 +760,13 @@ bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op,
return false;
}
- if (paint != NULL) {
+ if (paint != nullptr) {
flags |= kDrawBitmap_HasPaint_DrawOpFlag;
this->writePaint(*paint);
}
// This needs to run first so its calls to needOpBytes() and its writes
// don't interlace with the needOpBytes() and write below.
- SkASSERT(fBitmapHeap != NULL);
+ SkASSERT(fBitmapHeap != nullptr);
int32_t bitmapIndex = fBitmapHeap->insert(bm);
if (SkBitmapHeap::INVALID_SLOT == bitmapIndex) {
return false;
@@ -794,7 +794,7 @@ void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, cons
const SkPaint* paint, SrcRectConstraint constraint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(SkRect);
- bool hasSrc = src != NULL;
+ bool hasSrc = src != nullptr;
unsigned flags;
if (hasSrc) {
flags = kDrawBitmap_HasSrcRect_DrawOpFlag;
@@ -844,7 +844,7 @@ bool SkGPipeCanvas::commonDrawImage(const SkImage* image, DrawOps op, unsigned f
return false;
}
- if (paint != NULL) {
+ if (paint != nullptr) {
flags |= kDrawBitmap_HasPaint_DrawOpFlag;
this->writePaint(*paint);
}
@@ -916,7 +916,7 @@ void SkGPipeCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP
if (byteLength) {
NOTIFY_SETUP(this);
this->writePaint(paint);
- int count = paint.textToGlyphs(text, byteLength, NULL);
+ int count = paint.textToGlyphs(text, byteLength, nullptr);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkPoint))) {
this->writeOp(kDrawPosText_DrawOp);
fWriter.write32(SkToU32(byteLength));
@@ -932,7 +932,7 @@ void SkGPipeCanvas::onDrawPosTextH(const void* text, size_t byteLength, const Sk
if (byteLength) {
NOTIFY_SETUP(this);
this->writePaint(paint);
- int count = paint.textToGlyphs(text, byteLength, NULL);
+ int count = paint.textToGlyphs(text, byteLength, nullptr);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkScalar) + 4)) {
this->writeOp(kDrawPosTextH_DrawOp);
fWriter.write32(SkToU32(byteLength));
@@ -949,10 +949,10 @@ void SkGPipeCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const
if (byteLength) {
NOTIFY_SETUP(this);
unsigned flags = 0;
- size_t size = 4 + SkAlign4(byteLength) + path.writeToMemory(NULL);
+ size_t size = 4 + SkAlign4(byteLength) + path.writeToMemory(nullptr);
if (matrix) {
flags |= kDrawTextOnPath_HasMatrix_DrawOpFlag;
- size += matrix->writeToMemory(NULL);
+ size += matrix->writeToMemory(nullptr);
}
this->writePaint(paint);
if (this->needOpBytes(size)) {
@@ -1214,7 +1214,7 @@ void SkGPipeCanvas::resetImageHeap() {
}
size_t SkGPipeCanvas::freeMemoryIfPossible(size_t bytesToFree) {
- return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->freeMemoryIfPossible(bytesToFree);
+ return (nullptr == fBitmapHeap) ? 0 : fBitmapHeap->freeMemoryIfPossible(bytesToFree);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1347,7 +1347,7 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) {
// Do these after we've written kPaintOp_DrawOp
if (base.getAnnotation() != paint.getAnnotation()) {
- if (NULL == paint.getAnnotation()) {
+ if (nullptr == paint.getAnnotation()) {
if (this->needOpBytes()) {
this->writeOp(kSetAnnotation_DrawOp, 0, 0);
}
@@ -1388,7 +1388,7 @@ void SkGPipeController::purgeCaches()
SkGPipeWriter::SkGPipeWriter()
: fWriter(0) {
- fCanvas = NULL;
+ fCanvas = nullptr;
}
SkGPipeWriter::~SkGPipeWriter() {
@@ -1397,8 +1397,8 @@ SkGPipeWriter::~SkGPipeWriter() {
SkCanvas* SkGPipeWriter::startRecording(SkGPipeController* controller, uint32_t flags,
uint32_t width, uint32_t height) {
- if (NULL == fCanvas) {
- fWriter.reset(NULL, 0);
+ if (nullptr == fCanvas) {
+ fWriter.reset(nullptr, 0);
fCanvas = new SkGPipeCanvas(controller, &fWriter, flags, width, height);
}
controller->setCanvas(fCanvas);
@@ -1409,7 +1409,7 @@ void SkGPipeWriter::endRecording() {
if (fCanvas) {
fCanvas->finish(true);
fCanvas->unref();
- fCanvas = NULL;
+ fCanvas = nullptr;
}
}
@@ -1427,13 +1427,13 @@ size_t SkGPipeWriter::freeMemoryIfPossible(size_t bytesToFree) {
}
size_t SkGPipeWriter::storageAllocatedForRecording() const {
- return NULL == fCanvas ? 0 : fCanvas->storageAllocatedForRecording();
+ return nullptr == fCanvas ? 0 : fCanvas->storageAllocatedForRecording();
}
///////////////////////////////////////////////////////////////////////////////
BitmapShuttle::BitmapShuttle(SkGPipeCanvas* canvas) {
- SkASSERT(canvas != NULL);
+ SkASSERT(canvas != nullptr);
fCanvas = canvas;
fCanvas->ref();
}
@@ -1443,16 +1443,16 @@ BitmapShuttle::~BitmapShuttle() {
}
bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) {
- SkASSERT(fCanvas != NULL);
+ SkASSERT(fCanvas != nullptr);
return fCanvas->shuttleBitmap(bitmap, slot);
}
void BitmapShuttle::removeCanvas() {
- if (NULL == fCanvas) {
+ if (nullptr == fCanvas) {
return;
}
fCanvas->unref();
- fCanvas = NULL;
+ fCanvas = nullptr;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index b85ceb6790..fea9d6842b 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -13,7 +13,7 @@
PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc)
:fReader(target) {
- fBlock = NULL;
+ fBlock = nullptr;
fBlockSize = fBytesWritten = 0;
fReader.setBitmapDecoder(proc);
}
@@ -42,7 +42,7 @@ void PipeController::notifyWritten(size_t bytes) {
TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
SkPicture::InstallPixelRefProc proc,
const SkMatrix* initial)
-: INHERITED(NULL, proc) {
+: INHERITED(nullptr, proc) {
int32_t top = 0;
int32_t bottom;
int32_t height = bitmap.height() / NumberOfTiles;
@@ -55,7 +55,7 @@ TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
SkASSERT(extracted);
SkCanvas* canvas = new SkCanvas(fBitmaps[i]);
- if (initial != NULL) {
+ if (initial != nullptr) {
canvas->setMatrix(*initial);
}
canvas->translate(SkIntToScalar(-rect.left()),
@@ -82,7 +82,7 @@ void TiledPipeController::notifyWritten(size_t bytes) {
ThreadSafePipeController::ThreadSafePipeController(int numberOfReaders)
: fAllocator(kMinBlockSize)
, fNumberOfReaders(numberOfReaders) {
- fBlock = NULL;
+ fBlock = nullptr;
fBytesWritten = 0;
}
diff --git a/src/pipe/utils/SamplePipeControllers.h b/src/pipe/utils/SamplePipeControllers.h
index 5e074c565c..b3f057fa8c 100644
--- a/src/pipe/utils/SamplePipeControllers.h
+++ b/src/pipe/utils/SamplePipeControllers.h
@@ -16,7 +16,7 @@ class SkMatrix;
class PipeController : public SkGPipeController {
public:
- PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc = NULL);
+ PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc = nullptr);
virtual ~PipeController();
void* requestBlock(size_t minRequest, size_t* actual) override;
void notifyWritten(size_t bytes) override;
@@ -34,8 +34,8 @@ private:
class TiledPipeController : public PipeController {
public:
- TiledPipeController(const SkBitmap&, SkPicture::InstallPixelRefProc proc = NULL,
- const SkMatrix* initialMatrix = NULL);
+ TiledPipeController(const SkBitmap&, SkPicture::InstallPixelRefProc proc = nullptr,
+ const SkMatrix* initialMatrix = nullptr);
virtual ~TiledPipeController() {};
void notifyWritten(size_t bytes) override;
int numberOfReaders() const override { return NumberOfTiles; }
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index 3400aa99a8..8a8e4a1b53 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -77,7 +77,7 @@ static void test_writeToMemory(const SkFontConfigInterface::FontIdentity& iden0,
int initValue) {
SkFontConfigInterface::FontIdentity iden1;
- size_t size0 = iden0.writeToMemory(NULL);
+ size_t size0 = iden0.writeToMemory(nullptr);
SkAutoMalloc storage(size0);
memset(storage.get(), initValue, size0);
@@ -131,8 +131,8 @@ private:
SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) {
SkAutoMutexAcquire ac(mutex);
- static SkFontConfigInterfaceDirect* singleton = NULL;
- if (singleton == NULL) {
+ static SkFontConfigInterfaceDirect* singleton = nullptr;
+ if (singleton == nullptr) {
singleton = new SkFontConfigInterfaceDirect;
}
return singleton;
@@ -140,13 +140,13 @@ SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBase
///////////////////////////////////////////////////////////////////////////////
-// Returns the string from the pattern, or NULL
+// Returns the string from the pattern, or nullptr
static const char* get_name(FcPattern* pattern, const char field[],
int index = 0) {
const char* name;
if (FcPatternGetString(pattern, field, index,
(FcChar8**)&name) != FcResultMatch) {
- name = NULL;
+ name = nullptr;
}
return name;
}
@@ -360,7 +360,7 @@ FcPattern* MatchFont(FcFontSet* font_set,
const SkString& family) {
// Older versions of fontconfig have a bug where they cannot select
// only scalable fonts so we have to manually filter the results.
- FcPattern* match = NULL;
+ FcPattern* match = nullptr;
for (int i = 0; i < font_set->nfont; ++i) {
FcPattern* current = font_set->fonts[i];
if (valid_pattern(current)) {
@@ -388,7 +388,7 @@ FcPattern* MatchFont(FcFontSet* font_set,
break;
}
if (!acceptable_substitute)
- return NULL;
+ return nullptr;
}
return match;
@@ -469,7 +469,7 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
: FC_SLANT_ROMAN);
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
- FcConfigSubstitute(NULL, pattern, FcMatchPattern);
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
// Font matching:
@@ -477,7 +477,7 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
// font-family: a, b, c, serif;
// However, fontconfig will always do its best to find *a* font when asked
// for something so we need a way to tell if the match which it has found is
- // "good enough" for us. Otherwise, we can return NULL which gets piped up
+ // "good enough" for us. Otherwise, we can return nullptr which gets piped up
// and lets WebKit know to try the next CSS family name. However, fontconfig
// configs allow substitutions (mapping "Arial -> Helvetica" etc) and we
// wish to support that.
@@ -579,20 +579,20 @@ SkDataTable* SkFontConfigInterfaceDirect::getFamilyNames() {
FcPattern* pat = FcPatternCreate();
SkAutoTCallVProc<FcPattern, FcPatternDestroy> autoDestroyPat(pat);
- if (NULL == pat) {
- return NULL;
+ if (nullptr == pat) {
+ return nullptr;
}
FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, (char *)0);
SkAutoTCallVProc<FcObjectSet, FcObjectSetDestroy> autoDestroyOs(os);
- if (NULL == os) {
- return NULL;
+ if (nullptr == os) {
+ return nullptr;
}
- FcFontSet* fs = FcFontList(NULL, pat, os);
+ FcFontSet* fs = FcFontList(nullptr, pat, os);
SkAutoTCallVProc<FcFontSet, FcFontSetDestroy> autoDestroyFs(fs);
- if (NULL == fs) {
- return NULL;
+ if (nullptr == fs) {
+ return nullptr;
}
SkTDArray<const char*> names;
@@ -630,7 +630,7 @@ bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[],
}
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
- FcConfigSubstitute(NULL, pattern, FcMatchPattern);
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
// Font matching:
@@ -638,7 +638,7 @@ bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[],
// font-family: a, b, c, serif;
// However, fontconfig will always do its best to find *a* font when asked
// for something so we need a way to tell if the match which it has found is
- // "good enough" for us. Otherwise, we can return NULL which gets piped up
+ // "good enough" for us. Otherwise, we can return nullptr which gets piped up
// and lets WebKit know to try the next CSS family name. However, fontconfig
// configs allow substitutions (mapping "Arial -> Helvetica" etc) and we
// wish to support that.
@@ -720,7 +720,7 @@ bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[],
if (!match) {
FcPatternDestroy(pattern);
FcFontSetDestroy(font_set);
- return NULL;
+ return nullptr;
}
FcPatternDestroy(pattern);
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index d207f088ae..a6dc6cae79 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -48,7 +48,7 @@ protected:
: INHERITED(style, SkTypefaceCache::NewFontID(), false)
, fIdentity(fi)
, fFamilyName(familyName)
- , fLocalStream(NULL) {}
+ , fLocalStream(nullptr) {}
FontConfigTypeface(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream)
: INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth)
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 860f32002c..32eafad87c 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -76,11 +76,11 @@ extern "C" {
return sk_realloc_throw(block, new_size);
}
};
-FT_MemoryRec_ gFTMemory = { NULL, sk_ft_alloc, sk_ft_free, sk_ft_realloc };
+FT_MemoryRec_ gFTMemory = { nullptr, sk_ft_alloc, sk_ft_free, sk_ft_realloc };
class FreeTypeLibrary : SkNoncopyable {
public:
- FreeTypeLibrary() : fLibrary(NULL), fIsLCDSupported(false), fLCDExtra(0) {
+ FreeTypeLibrary() : fLibrary(nullptr), fIsLCDSupported(false), fLCDExtra(0) {
if (FT_New_Library(&gFTMemory, &fLibrary)) {
return;
}
@@ -101,7 +101,7 @@ public:
FT_Library_SetLcdFilterWeights(fLibrary, gGaussianLikeHeavyWeights);
# elif SK_CAN_USE_DLOPEN == 1
//The FreeType library is already loaded, so symbols are available in process.
- void* self = dlopen(NULL, RTLD_LAZY);
+ void* self = dlopen(nullptr, RTLD_LAZY);
if (self) {
FT_Library_SetLcdFilterWeightsProc setLcdFilterWeights;
//The following cast is non-standard, but safe for POSIX.
@@ -157,7 +157,7 @@ static bool ref_ft_library() {
SkASSERT(gFTCount >= 0);
if (0 == gFTCount) {
- SkASSERT(NULL == gFTLibrary);
+ SkASSERT(nullptr == gFTLibrary);
gFTLibrary = new FreeTypeLibrary;
}
++gFTCount;
@@ -171,9 +171,9 @@ static void unref_ft_library() {
--gFTCount;
if (0 == gFTCount) {
- SkASSERT(NULL != gFTLibrary);
+ SkASSERT(nullptr != gFTLibrary);
delete gFTLibrary;
- SkDEBUGCODE(gFTLibrary = NULL;)
+ SkDEBUGCODE(gFTLibrary = nullptr;)
}
}
@@ -183,7 +183,7 @@ public:
virtual ~SkScalerContext_FreeType();
bool success() const {
- return fFTSize != NULL && fFace != NULL;
+ return fFTSize != nullptr && fFace != nullptr;
}
protected:
@@ -257,7 +257,7 @@ extern "C" {
}
SkFaceRec::SkFaceRec(SkStreamAsset* stream, uint32_t fontID)
- : fNext(NULL), fSkStream(stream), fRefCnt(1), fFontID(fontID)
+ : fNext(nullptr), fSkStream(stream), fRefCnt(1), fFontID(fontID)
{
sk_bzero(&fFTStream, sizeof(fFTStream));
fFTStream.size = fSkStream->getLength();
@@ -272,7 +272,7 @@ static void ft_face_setup_axes(FT_Face face, const SkFontData& data) {
}
SkDEBUGCODE(
- FT_MM_Var* variations = NULL;
+ FT_MM_Var* variations = nullptr;
if (FT_Get_MM_Var(face, &variations)) {
SkDEBUGF(("INFO: font %s claims variations, but none found.\n", face->family_name));
return;
@@ -314,8 +314,8 @@ static FT_Face ref_ft_face(const SkTypeface* typeface) {
}
SkAutoTDelete<SkFontData> data(typeface->createFontData());
- if (NULL == data || !data->hasStream()) {
- return NULL;
+ if (nullptr == data || !data->hasStream()) {
+ return nullptr;
}
// this passes ownership of stream to the rec
@@ -337,14 +337,14 @@ static FT_Face ref_ft_face(const SkTypeface* typeface) {
if (err) {
SkDEBUGF(("ERROR: unable to open font '%x'\n", fontID));
delete rec;
- return NULL;
+ return nullptr;
}
SkASSERT(rec->fFace);
ft_face_setup_axes(rec->fFace, *data);
// FreeType will set the charmap to the "most unicode" cmap if it exists.
- // If there are no unicode cmaps, the charmap is set to NULL.
+ // If there are no unicode cmaps, the charmap is set to nullptr.
// However, "symbol" cmaps should also be considered "fallback unicode" cmaps
// because they are effectively private use area only (even if they aren't).
// This is the last on the fallback list at
@@ -363,7 +363,7 @@ static void unref_ft_face(FT_Face face) {
gFTMutex.assertHeld();
SkFaceRec* rec = gFaceRecHead;
- SkFaceRec* prev = NULL;
+ SkFaceRec* prev = nullptr;
while (rec) {
SkFaceRec* next = rec->fNext;
if (rec->fFace == face) {
@@ -386,7 +386,7 @@ static void unref_ft_face(FT_Face face) {
class AutoFTAccess {
public:
- AutoFTAccess(const SkTypeface* tf) : fFace(NULL) {
+ AutoFTAccess(const SkTypeface* tf) : fFace(nullptr) {
gFTMutex.acquire();
if (!ref_ft_library()) {
sk_throw();
@@ -458,12 +458,12 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
const uint32_t* glyphIDs,
uint32_t glyphIDsCount) const {
#if defined(SK_BUILD_FOR_MAC)
- return NULL;
+ return nullptr;
#else
AutoFTAccess fta(this);
FT_Face face = fta.face();
if (!face) {
- return NULL;
+ return nullptr;
}
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
@@ -500,7 +500,7 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
cid = true;
TT_Header* ttHeader;
if ((ttHeader = (TT_Header*)FT_Get_Sfnt_Table(face,
- ft_sfnt_head)) != NULL) {
+ ft_sfnt_head)) != nullptr) {
info->fEmSize = ttHeader->Units_Per_EM;
}
} else {
@@ -519,7 +519,7 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
info->fItalicAngle = ps_info.italic_angle;
} else if ((tt_info =
(TT_Postscript*)FT_Get_Sfnt_Table(face,
- ft_sfnt_post)) != NULL) {
+ ft_sfnt_post)) != nullptr) {
info->fItalicAngle = SkFixedToScalar(tt_info->italicAngle);
} else {
info->fItalicAngle = 0;
@@ -546,14 +546,14 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
TT_PCLT* pclt_info;
TT_OS2* os2_table;
- if ((pclt_info = (TT_PCLT*)FT_Get_Sfnt_Table(face, ft_sfnt_pclt)) != NULL) {
+ if ((pclt_info = (TT_PCLT*)FT_Get_Sfnt_Table(face, ft_sfnt_pclt)) != nullptr) {
info->fCapHeight = pclt_info->CapHeight;
uint8_t serif_style = pclt_info->SerifStyle & 0x3F;
if (serif_style >= 2 && serif_style <= 6)
info->fStyle |= SkAdvancedTypefaceMetrics::kSerif_Style;
else if (serif_style >= 9 && serif_style <= 12)
info->fStyle |= SkAdvancedTypefaceMetrics::kScript_Style;
- } else if (((os2_table = (TT_OS2*)FT_Get_Sfnt_Table(face, ft_sfnt_os2)) != NULL) &&
+ } else if (((os2_table = (TT_OS2*)FT_Get_Sfnt_Table(face, ft_sfnt_os2)) != nullptr) &&
// sCapHeight is available only when version 2 or later.
os2_table->version != 0xFFFF &&
os2_table->version >= 2) {
@@ -666,7 +666,7 @@ SkScalerContext* SkTypeface_FreeType::onCreateScalerContext(
new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), desc);
if (!c->success()) {
delete c;
- c = NULL;
+ c = nullptr;
}
return c;
}
@@ -742,8 +742,8 @@ bool SkTypeface_FreeType::onGetKerningPairAdjustments(const uint16_t glyphs[],
static FT_Int chooseBitmapStrike(FT_Face face, SkFixed scaleY) {
// early out if face is bad
- if (face == NULL) {
- SkDEBUGF(("chooseBitmapStrike aborted due to NULL face\n"));
+ if (face == nullptr) {
+ SkDEBUGF(("chooseBitmapStrike aborted due to nullptr face\n"));
return -1;
}
// determine target ppem
@@ -795,9 +795,9 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
// load the font file
fStrikeIndex = -1;
- fFTSize = NULL;
+ fFTSize = nullptr;
fFace = ref_ft_face(typeface);
- if (NULL == fFace) {
+ if (nullptr == fFace) {
return;
}
@@ -886,14 +886,14 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
FT_Error err = FT_New_Size(fFace, &fFTSize);
if (err != 0) {
SkDEBUGF(("FT_New_Size returned %x for face %s\n", err, fFace->family_name));
- fFace = NULL;
+ fFace = nullptr;
return;
}
err = FT_Activate_Size(fFTSize);
if (err != 0) {
SkDEBUGF(("FT_Activate_Size(%08x, 0x%x, 0x%x) returned 0x%x\n", fFace, fScaleX, fScaleY,
err));
- fFTSize = NULL;
+ fFTSize = nullptr;
return;
}
@@ -902,10 +902,10 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
if (err != 0) {
SkDEBUGF(("FT_Set_CharSize(%08x, 0x%x, 0x%x) returned 0x%x\n",
fFace, fScaleX, fScaleY, err));
- fFace = NULL;
+ fFace = nullptr;
return;
}
- FT_Set_Transform(fFace, &fMatrix22, NULL);
+ FT_Set_Transform(fFace, &fMatrix22, nullptr);
} else if (FT_HAS_FIXED_SIZES(fFace)) {
fStrikeIndex = chooseBitmapStrike(fFace, fScaleY);
if (fStrikeIndex == -1) {
@@ -934,11 +934,11 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
SkScalerContext_FreeType::~SkScalerContext_FreeType() {
SkAutoMutexAcquire ac(gFTMutex);
- if (fFTSize != NULL) {
+ if (fFTSize != nullptr) {
FT_Done_Size(fFTSize);
}
- if (fFace != NULL) {
+ if (fFace != nullptr) {
unref_ft_face(fFace);
}
@@ -953,13 +953,13 @@ FT_Error SkScalerContext_FreeType::setupSize() {
if (err != 0) {
SkDEBUGF(("SkScalerContext_FreeType::FT_Activate_Size(%s %s, 0x%x, 0x%x) returned 0x%x\n",
fFace->family_name, fFace->style_name, fScaleX, fScaleY, err));
- fFTSize = NULL;
+ fFTSize = nullptr;
return err;
}
// seems we need to reset this every time (not sure why, but without it
// I get random italics from some other fFTSize)
- FT_Set_Transform(fFace, &fMatrix22, NULL);
+ FT_Set_Transform(fFace, &fMatrix22, nullptr);
return 0;
}
@@ -1258,7 +1258,7 @@ void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph, SkPath* path)
}
void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics) {
- if (NULL == metrics) {
+ if (nullptr == metrics) {
return;
}
@@ -1473,7 +1473,7 @@ int SkTypeface_FreeType::onCharsToGlyphs(const void* chars, Encoding encoding,
EncodingProc next_uni_proc = find_encoding_proc(encoding);
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
for (int i = 0; i < glyphCount; ++i) {
if (0 == FT_Get_Char_Index(face, next_uni_proc(&chars))) {
return i;
@@ -1507,7 +1507,7 @@ int SkTypeface_FreeType::onCountGlyphs() const {
SkTypeface::LocalizedStrings* SkTypeface_FreeType::onCreateFamilyNameIterator() const {
SkTypeface::LocalizedStrings* nameIter =
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this);
- if (NULL == nameIter) {
+ if (nullptr == nameIter) {
SkString familyName;
this->getFamilyName(&familyName);
SkString language("und"); //undetermined
@@ -1523,8 +1523,8 @@ int SkTypeface_FreeType::onGetTableTags(SkFontTableTag tags[]) const {
FT_ULong tableCount = 0;
FT_Error error;
- // When 'tag' is NULL, returns number of tables in 'length'.
- error = FT_Sfnt_Table_Info(face, 0, NULL, &tableCount);
+ // When 'tag' is nullptr, returns number of tables in 'length'.
+ error = FT_Sfnt_Table_Info(face, 0, nullptr, &tableCount);
if (error) {
return 0;
}
@@ -1553,7 +1553,7 @@ size_t SkTypeface_FreeType::onGetTableData(SkFontTableTag tag, size_t offset,
FT_Error error;
// When 'length' is 0 it is overwritten with the full table length; 'offset' is ignored.
- error = FT_Load_Sfnt_Table(face, tag, 0, NULL, &tableLength);
+ error = FT_Load_Sfnt_Table(face, tag, 0, nullptr, &tableLength);
if (error) {
return 0;
}
@@ -1575,7 +1575,7 @@ size_t SkTypeface_FreeType::onGetTableData(SkFontTableTag tag, size_t offset,
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-SkTypeface_FreeType::Scanner::Scanner() : fLibrary(NULL) {
+SkTypeface_FreeType::Scanner::Scanner() : fLibrary(nullptr) {
if (FT_New_Library(&gFTMemory, &fLibrary)) {
return;
}
@@ -1590,8 +1590,8 @@ SkTypeface_FreeType::Scanner::~Scanner() {
FT_Face SkTypeface_FreeType::Scanner::openFace(SkStream* stream, int ttcIndex,
FT_Stream ftStream) const
{
- if (fLibrary == NULL) {
- return NULL;
+ if (fLibrary == nullptr) {
+ return nullptr;
}
FT_Open_Args args;
@@ -1616,7 +1616,7 @@ FT_Face SkTypeface_FreeType::Scanner::openFace(SkStream* stream, int ttcIndex,
FT_Face face;
if (FT_Open_Face(fLibrary, &args, ttcIndex, &face)) {
- return NULL;
+ return nullptr;
}
return face;
}
@@ -1626,7 +1626,7 @@ bool SkTypeface_FreeType::Scanner::recognizedFont(SkStream* stream, int* numFace
FT_StreamRec streamRec;
FT_Face face = this->openFace(stream, -1, &streamRec);
- if (NULL == face) {
+ if (nullptr == face) {
return false;
}
@@ -1645,7 +1645,7 @@ bool SkTypeface_FreeType::Scanner::scanFont(
FT_StreamRec streamRec;
FT_Face face = this->openFace(stream, ttcIndex, &streamRec);
- if (NULL == face) {
+ if (nullptr == face) {
return false;
}
@@ -1716,7 +1716,7 @@ bool SkTypeface_FreeType::Scanner::scanFont(
}
if (axes && face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) {
- FT_MM_Var* variations = NULL;
+ FT_MM_Var* variations = nullptr;
FT_Error err = FT_Get_MM_Var(face, &variations);
if (err) {
SkDEBUGF(("INFO: font %s claims to have variations, but none found.\n",
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 5afe70a668..245ded1283 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -194,7 +194,7 @@ static void copyFTBitmap(const FT_Bitmap& srcFTBitmap, SkMask& dstMask) {
const size_t height = srcFTBitmap.rows;
if (SkMask::kLCD16_Format == dstFormat) {
- copyFT2LCD16<false>(srcFTBitmap, dstMask, false, NULL, NULL, NULL);
+ copyFT2LCD16<false>(srcFTBitmap, dstMask, false, nullptr, nullptr, nullptr);
return;
}
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index 540d805c38..5c9e896617 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -88,8 +88,8 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[],
SkTypeface::Style style)
{
SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
- if (NULL == fci.get()) {
- return NULL;
+ if (nullptr == fci.get()) {
+ return nullptr;
}
// Check if requested NameStyle is in the NameStyle cache.
@@ -107,7 +107,7 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[],
SkString outFamilyName;
SkTypeface::Style outStyle;
if (!fci->matchFamilyName(familyName, style, &indentity, &outFamilyName, &outStyle)) {
- return NULL;
+ return nullptr;
}
// Check if a typeface with this FontIdentity is already in the FontIdentity cache.
@@ -136,8 +136,8 @@ SkStreamAsset* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
}
SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
- if (NULL == fci.get()) {
- return NULL;
+ if (nullptr == fci.get()) {
+ return nullptr;
}
*ttcIndex = this->getIdentity().fTTCIndex;
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index b144aee12e..343936c673 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -68,7 +68,7 @@ class SkScalerContext_Mac;
// provide a wrapper here that will return an empty array if need be.
static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() {
#ifdef SK_BUILD_FOR_IOS
- return CFArrayCreate(NULL, NULL, 0, NULL);
+ return CFArrayCreate(nullptr, nullptr, 0, nullptr);
#else
return CTFontManagerCopyAvailableFontFamilyNames();
#endif
@@ -94,10 +94,10 @@ template <typename T> static void CFSafeRetain(/*CFTypeRef*/const T* cfTypeRef)
/** Acts like a CFRef, but calls CFSafeRelease when it goes out of scope. */
template<typename CFRef> class AutoCFRelease : private SkNoncopyable {
public:
- explicit AutoCFRelease(CFRef cfRef = NULL) : fCFRef(cfRef) { }
+ explicit AutoCFRelease(CFRef cfRef = nullptr) : fCFRef(cfRef) { }
~AutoCFRelease() { CFSafeRelease(fCFRef); }
- void reset(CFRef that = NULL) {
+ void reset(CFRef that = nullptr) {
if (that != fCFRef) {
CFSafeRelease(fCFRef);
fCFRef = that;
@@ -106,20 +106,20 @@ public:
CFRef detach() {
CFRef self = fCFRef;
- fCFRef = NULL;
+ fCFRef = nullptr;
return self;
}
operator CFRef() const { return fCFRef; }
CFRef get() const { return fCFRef; }
- CFRef* operator&() { SkASSERT(fCFRef == NULL); return &fCFRef; }
+ CFRef* operator&() { SkASSERT(fCFRef == nullptr); return &fCFRef; }
private:
CFRef fCFRef;
};
static CFStringRef make_CFString(const char str[]) {
- return CFStringCreateWithCString(NULL, str, kCFStringEncodingUTF8);
+ return CFStringCreateWithCString(nullptr, str, kCFStringEncodingUTF8);
}
template<typename T> class AutoCGTable : SkNoncopyable {
@@ -127,7 +127,7 @@ public:
AutoCGTable(CGFontRef font)
//Undocumented: the tag parameter in this call is expected in machine order and not BE order.
: fCFData(CGFontCopyTableForTag(font, SkSetFourByteTag(T::TAG0, T::TAG1, T::TAG2, T::TAG3)))
- , fData(fCFData ? reinterpret_cast<const T*>(CFDataGetBytePtr(fCFData)) : NULL)
+ , fData(fCFData ? reinterpret_cast<const T*>(CFDataGetBytePtr(fCFData)) : nullptr)
{ }
const T* operator->() const { return fData; }
@@ -327,8 +327,8 @@ static bool supports_LCD() {
class Offscreen {
public:
Offscreen()
- : fRGBSpace(NULL)
- , fCG(NULL)
+ : fRGBSpace(nullptr)
+ , fCG(nullptr)
, fDoAA(false)
, fDoLCD(false)
{
@@ -389,7 +389,7 @@ static int unit_width_to_fontstyle(float unit) {
static SkFontStyle fontstyle_from_descriptor(CTFontDescriptorRef desc) {
AutoCFRelease<CFDictionaryRef> dict(
(CFDictionaryRef)CTFontDescriptorCopyAttribute(desc, kCTFontTraitsAttribute));
- if (NULL == dict.get()) {
+ if (nullptr == dict.get()) {
return SkFontStyle();
}
@@ -528,7 +528,7 @@ static SkTypeface* NewFromName(const char familyName[], const SkFontStyle& theSt
&kCFTypeDictionaryValueCallBacks));
if (!cfFontName || !cfFontTraits || !cfAttributes || !cfTraits) {
- return NULL;
+ return nullptr;
}
CFDictionaryAddValue(cfTraits, kCTFontSymbolicTrait, cfFontTraits);
@@ -539,17 +539,17 @@ static SkTypeface* NewFromName(const char familyName[], const SkFontStyle& theSt
AutoCFRelease<CTFontDescriptorRef> ctFontDesc(
CTFontDescriptorCreateWithAttributes(cfAttributes));
if (!ctFontDesc) {
- return NULL;
+ return nullptr;
}
- AutoCFRelease<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(ctFontDesc, 0, NULL));
+ AutoCFRelease<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(ctFontDesc, 0, nullptr));
if (!ctFont) {
- return NULL;
+ return nullptr;
}
SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_CTFontRef, (void*)ctFont.get());
if (!face) {
- face = NewFromFontRef(ctFont.detach(), NULL, NULL, false);
+ face = NewFromFontRef(ctFont.detach(), nullptr, nullptr, false);
SkTypefaceCache::Add(face, face->fontStyle());
}
return face;
@@ -561,7 +561,7 @@ static SkTypeface* GetDefaultFace() {
static SkTypeface* gDefaultFace;
- if (NULL == gDefaultFace) {
+ if (nullptr == gDefaultFace) {
gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkFontStyle());
SkTypefaceCache::Add(gDefaultFace, SkFontStyle());
}
@@ -573,7 +573,7 @@ static SkTypeface* GetDefaultFace() {
extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);
CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) {
const SkTypeface_Mac* macface = (const SkTypeface_Mac*)face;
- return macface ? macface->fFontRef.get() : NULL;
+ return macface ? macface->fFontRef.get() : nullptr;
}
/* This function is visible on the outside. It first searches the cache, and if
@@ -586,7 +586,7 @@ SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef fontRef, CFTypeRef resourceRef)
if (resourceRef) {
CFRetain(resourceRef);
}
- face = NewFromFontRef(fontRef, resourceRef, NULL, false);
+ face = NewFromFontRef(fontRef, resourceRef, nullptr, false);
SkTypefaceCache::Add(face, face->fontStyle());
}
return face;
@@ -736,7 +736,7 @@ SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface,
SkVector scale;
SkMatrix skTransform;
fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, &skTransform,
- NULL, NULL, &fFUnitMatrix);
+ nullptr, nullptr, &fFUnitMatrix);
fTransform = MatrixToCGAffineTransform(skTransform);
fInvTransform = CGAffineTransformInvert(fTransform);
@@ -761,9 +761,9 @@ SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface,
CGFloat textSize = ScalarToCG(scale.y());
fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &fTransform, ctFontDesc));
- fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, NULL));
+ fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, nullptr));
fCTUnrotatedFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize,
- &CGAffineTransformIdentity, NULL));
+ &CGAffineTransformIdentity, nullptr));
// The fUnitMatrix includes the text size (and em) as it is used to scale the raw font data.
SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFont)));
@@ -1088,8 +1088,8 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
// empty path or not, and if so, we jam the bounds to 0. Hopefully a zero-advance
// is rare, so we won't incur a big performance cost for this extra check.
if (0 == cgAdvance.width && 0 == cgAdvance.height) {
- AutoCFRelease<CGPathRef> path(CTFontCreatePathForGlyph(fCTFont, cgGlyph, NULL));
- if (NULL == path || CGPathIsEmpty(path)) {
+ AutoCFRelease<CGPathRef> path(CTFontCreatePathForGlyph(fCTFont, cgGlyph, nullptr));
+ if (nullptr == path || CGPathIsEmpty(path)) {
return;
}
}
@@ -1253,7 +1253,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
// Draw the glyph
size_t cgRowBytes;
CGRGBPixel* cgPixels = fOffscreen.getCG(*this, glyph, cgGlyph, &cgRowBytes, generateA8FromLCD);
- if (cgPixels == NULL) {
+ if (cgPixels == nullptr) {
return;
}
@@ -1372,14 +1372,14 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
CGAffineTransform xform = MatrixToCGAffineTransform(m, scaleX, scaleY);
// need to release font when we're done
- font = CTFontCreateCopyWithAttributes(fCTFont, 1, &xform, NULL);
+ font = CTFontCreateCopyWithAttributes(fCTFont, 1, &xform, nullptr);
}
CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID();
- AutoCFRelease<CGPathRef> cgPath(CTFontCreatePathForGlyph(font, cgGlyph, NULL));
+ AutoCFRelease<CGPathRef> cgPath(CTFontCreatePathForGlyph(font, cgGlyph, nullptr));
path->reset();
- if (cgPath != NULL) {
+ if (cgPath != nullptr) {
CGPathApply(cgPath, path, SkScalerContext_Mac::CTPathElement);
}
@@ -1398,7 +1398,7 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
}
void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* metrics) {
- if (NULL == metrics) {
+ if (nullptr == metrics) {
return;
}
@@ -1461,15 +1461,15 @@ void SkScalerContext_Mac::CTPathElement(void *info, const CGPathElement *element
///////////////////////////////////////////////////////////////////////////////
-// Returns NULL on failure
+// Returns nullptr on failure
// Call must still manage its ownership of provider
static SkTypeface* create_from_dataProvider(CGDataProviderRef provider) {
AutoCFRelease<CGFontRef> cg(CGFontCreateWithDataProvider(provider));
- if (NULL == cg) {
- return NULL;
+ if (nullptr == cg) {
+ return nullptr;
}
- CTFontRef ct = CTFontCreateWithGraphicsFont(cg, 0, NULL, NULL);
- return ct ? NewFromFontRef(ct, NULL, NULL, true) : NULL;
+ CTFontRef ct = CTFontCreateWithGraphicsFont(cg, 0, nullptr, nullptr);
+ return ct ? NewFromFontRef(ct, nullptr, nullptr, true) : nullptr;
}
// Web fonts added to the the CTFont registry do not return their character set.
@@ -1548,7 +1548,7 @@ static bool getWidthAdvance(CTFontRef ctFont, int gId, int16_t* data) {
return true;
}
-/** Assumes src and dst are not NULL. */
+/** Assumes src and dst are not nullptr. */
static void CFStringToSkString(CFStringRef src, SkString* dst) {
// Reserve enough room for the worst-case string,
// plus 1 byte for the trailing null.
@@ -1569,7 +1569,7 @@ SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
CTFontRef originalCTFont = fFontRef.get();
AutoCFRelease<CTFontRef> ctFont(CTFontCreateCopyWithAttributes(
- originalCTFont, CTFontGetUnitsPerEm(originalCTFont), NULL, NULL));
+ originalCTFont, CTFontGetUnitsPerEm(originalCTFont), nullptr, nullptr));
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
{
@@ -1699,7 +1699,7 @@ static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) {
SkStreamAsset* SkTypeface_Mac::onOpenStream(int* ttcIndex) const {
SK_SFNT_ULONG fontType = get_font_type_tag(this);
if (0 == fontType) {
- return NULL;
+ return nullptr;
}
// get table tags
@@ -1811,12 +1811,12 @@ static bool get_variations(CTFontRef fFontRef, CFIndex* cgAxisCount,
SkAutoSTMalloc<4, SkFixed>* axisValues)
{
// CTFontCopyVariationAxes and CTFontCopyVariation do not work when applied to fonts which
- // started life with CGFontCreateWithDataProvider (they simply always return NULL).
+ // started life with CGFontCreateWithDataProvider (they simply always return nullptr).
// As a result, we are limited to CGFontCopyVariationAxes and CGFontCopyVariations.
- AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(fFontRef, NULL));
+ AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(fFontRef, nullptr));
AutoCFRelease<CFDictionaryRef> cgVariations(CGFontCopyVariations(cgFont));
- // If a font has no variations CGFontCopyVariations returns NULL (instead of an empty dict).
+ // If a font has no variations CGFontCopyVariations returns nullptr (instead of an empty dict).
if (!cgVariations.get()) {
return false;
}
@@ -1868,21 +1868,21 @@ SkFontData* SkTypeface_Mac::onCreateFontData() const {
if (get_variations(fFontRef, &cgAxisCount, &axisValues)) {
return new SkFontData(stream.detach(), index, axisValues.get(), cgAxisCount);
}
- return new SkFontData(stream.detach(), index, NULL, 0);
+ return new SkFontData(stream.detach(), index, nullptr, 0);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SkTypeface_Mac::onGetUPEM() const {
- AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(fFontRef, NULL));
+ AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(fFontRef, nullptr));
return CGFontGetUnitsPerEm(cgFont);
}
SkTypeface::LocalizedStrings* SkTypeface_Mac::onCreateFamilyNameIterator() const {
SkTypeface::LocalizedStrings* nameIter =
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this);
- if (NULL == nameIter) {
+ if (nullptr == nameIter) {
AutoCFRelease<CFStringRef> cfLanguage;
AutoCFRelease<CFStringRef> cfFamilyName(
CTFontCopyLocalizedName(fFontRef, kCTFontFamilyNameKey, &cfLanguage));
@@ -1909,8 +1909,8 @@ SkTypeface::LocalizedStrings* SkTypeface_Mac::onCreateFamilyNameIterator() const
static CFDataRef copyTableFromFont(CTFontRef ctFont, SkFontTableTag tag) {
CFDataRef data = CTFontCopyTable(ctFont, (CTFontTableTag) tag,
kCTFontTableOptionNoOptions);
- if (NULL == data) {
- AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(ctFont, NULL));
+ if (nullptr == data) {
+ AutoCFRelease<CGFontRef> cgFont(CTFontCopyGraphicsFont(ctFont, nullptr));
data = CGFontCopyTableForTag(cgFont, tag);
}
return data;
@@ -1919,7 +1919,7 @@ static CFDataRef copyTableFromFont(CTFontRef ctFont, SkFontTableTag tag) {
int SkTypeface_Mac::onGetTableTags(SkFontTableTag tags[]) const {
AutoCFRelease<CFArrayRef> cfArray(CTFontCopyAvailableTables(fFontRef,
kCTFontTableOptionNoOptions));
- if (NULL == cfArray) {
+ if (nullptr == cfArray) {
return 0;
}
int count = SkToInt(CFArrayGetCount(cfArray));
@@ -1935,7 +1935,7 @@ int SkTypeface_Mac::onGetTableTags(SkFontTableTag tags[]) const {
size_t SkTypeface_Mac::onGetTableData(SkFontTableTag tag, size_t offset,
size_t length, void* dstData) const {
AutoCFRelease<CFDataRef> srcData(copyTableFromFont(fFontRef, tag));
- if (NULL == srcData) {
+ if (nullptr == srcData) {
return 0;
}
@@ -2039,8 +2039,8 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
// we take ownership of the ref
static const char* get_str(CFStringRef ref, SkString* str) {
- if (NULL == ref) {
- return NULL;
+ if (nullptr == ref) {
+ return nullptr;
}
CFStringToSkString(ref, str);
CFSafeRelease(ref);
@@ -2106,22 +2106,22 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding,
}
}
- // If glyphs is NULL, CT still needs glyph storage for finding the first failure.
+ // If glyphs is nullptr, CT still needs glyph storage for finding the first failure.
// Also, if there are any non-bmp code points, the provided 'glyphs' storage will be inadequate.
SkAutoSTMalloc<1024, uint16_t> glyphStorage;
uint16_t* macGlyphs = glyphs;
- if (NULL == macGlyphs || srcCount > glyphCount) {
+ if (nullptr == macGlyphs || srcCount > glyphCount) {
macGlyphs = glyphStorage.reset(srcCount);
}
bool allEncoded = CTFontGetGlyphsForCharacters(fFontRef, src, macGlyphs, srcCount);
// If there were any non-bmp, then copy and compact.
- // If 'glyphs' is NULL, then compact glyphStorage in-place.
- // If all are bmp and 'glyphs' is non-NULL, 'glyphs' already contains the compact glyphs.
- // If some are non-bmp and 'glyphs' is non-NULL, copy and compact into 'glyphs'.
+ // If 'glyphs' is nullptr, then compact glyphStorage in-place.
+ // If all are bmp and 'glyphs' is non-nullptr, 'glyphs' already contains the compact glyphs.
+ // If some are non-bmp and 'glyphs' is non-nullptr, copy and compact into 'glyphs'.
uint16_t* compactedGlyphs = glyphs;
- if (NULL == compactedGlyphs) {
+ if (nullptr == compactedGlyphs) {
compactedGlyphs = macGlyphs;
}
if (srcCount > glyphCount) {
@@ -2157,7 +2157,7 @@ int SkTypeface_Mac::onCountGlyphs() const {
static bool find_desc_str(CTFontDescriptorRef desc, CFStringRef name, SkString* value) {
AutoCFRelease<CFStringRef> ref((CFStringRef)CTFontDescriptorCopyAttribute(desc, name));
- if (NULL == ref.get()) {
+ if (nullptr == ref.get()) {
return false;
}
CFStringToSkString(ref, value);
@@ -2190,15 +2190,15 @@ static SkTypeface* createFromDesc(CFStringRef cfFamilyName, CTFontDescriptorRef
return face;
}
- AutoCFRelease<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(desc, 0, NULL));
+ AutoCFRelease<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(desc, 0, nullptr));
if (!ctFont) {
- return NULL;
+ return nullptr;
}
bool isFixedPitch;
(void)computeStyleBits(ctFont, &isFixedPitch);
- face = new SkTypeface_Mac(ctFont.detach(), NULL, cacheRequest.fStyle, isFixedPitch,
+ face = new SkTypeface_Mac(ctFont.detach(), nullptr, cacheRequest.fStyle, isFixedPitch,
skFamilyName.c_str(), false);
SkTypefaceCache::Add(face, face->fontStyle());
return face;
@@ -2207,12 +2207,12 @@ static SkTypeface* createFromDesc(CFStringRef cfFamilyName, CTFontDescriptorRef
class SkFontStyleSet_Mac : public SkFontStyleSet {
public:
SkFontStyleSet_Mac(CFStringRef familyName, CTFontDescriptorRef desc)
- : fArray(CTFontDescriptorCreateMatchingFontDescriptors(desc, NULL))
+ : fArray(CTFontDescriptorCreateMatchingFontDescriptors(desc, nullptr))
, fFamilyName(familyName)
, fCount(0) {
CFRetain(familyName);
- if (NULL == fArray) {
- fArray = CFArrayCreate(NULL, NULL, 0, NULL);
+ if (nullptr == fArray) {
+ fArray = CFArrayCreate(nullptr, nullptr, 0, nullptr);
}
fCount = SkToInt(CFArrayGetCount(fArray));
}
@@ -2248,7 +2248,7 @@ public:
SkTypeface* matchStyle(const SkFontStyle& pattern) override {
if (0 == fCount) {
- return NULL;
+ return nullptr;
}
return createFromDesc(fFamilyName, findMatchingDesc(pattern));
}
@@ -2260,7 +2260,7 @@ private:
CTFontDescriptorRef findMatchingDesc(const SkFontStyle& pattern) const {
int bestMetric = SK_MaxS32;
- CTFontDescriptorRef bestDesc = NULL;
+ CTFontDescriptorRef bestDesc = nullptr;
for (int i = 0; i < fCount; ++i) {
CTFontDescriptorRef desc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fArray, i);
@@ -2324,7 +2324,7 @@ protected:
SkFontStyleSet* onCreateStyleSet(int index) const override {
if ((unsigned)index >= (unsigned)fCount) {
- return NULL;
+ return nullptr;
}
return CreateSet(this->stringAt(index));
}
@@ -2336,32 +2336,32 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
const char* bcp47[], int bcp47Count,
SkUnichar character) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
const SkFontStyle&) const override {
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
AutoCFRelease<CGDataProviderRef> pr(SkCreateDataProviderFromData(data));
- if (NULL == pr) {
- return NULL;
+ if (nullptr == pr) {
+ return nullptr;
}
return create_from_dataProvider(pr);
}
SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const override {
AutoCFRelease<CGDataProviderRef> pr(SkCreateDataProviderFromStream(stream));
- if (NULL == pr) {
- return NULL;
+ if (nullptr == pr) {
+ return nullptr;
}
return create_from_dataProvider(pr);
}
@@ -2369,12 +2369,12 @@ protected:
static CFDictionaryRef get_axes(CGFontRef cg, SkFontData* fontData) {
AutoCFRelease<CFArrayRef> cgAxes(CGFontCopyVariationAxes(cg));
if (!cgAxes) {
- return NULL;
+ return nullptr;
}
CFIndex axisCount = CFArrayGetCount(cgAxes);
if (0 == axisCount || axisCount != fontData->getAxisCount()) {
- return NULL;
+ return nullptr;
}
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, axisCount,
@@ -2383,13 +2383,13 @@ protected:
for (int i = 0; i < fontData->getAxisCount(); ++i) {
CFTypeRef axisInfo = CFArrayGetValueAtIndex(cgAxes, i);
if (CFDictionaryGetTypeID() != CFGetTypeID(axisInfo)) {
- return NULL;
+ return nullptr;
}
CFDictionaryRef axisInfoDict = static_cast<CFDictionaryRef>(axisInfo);
CFTypeRef axisName = CFDictionaryGetValue(axisInfoDict, kCGFontVariationAxisName);
if (!axisName || CFGetTypeID(axisName) != CFStringGetTypeID()) {
- return NULL;
+ return nullptr;
}
// The variation axes can be set to any value, but cg will effectively pin them.
@@ -2399,7 +2399,7 @@ protected:
if (!min || CFGetTypeID(min) != CFNumberGetTypeID() ||
!max || CFGetTypeID(max) != CFNumberGetTypeID())
{
- return NULL;
+ return nullptr;
}
CFNumberRef minNumber = static_cast<CFNumberRef>(min);
CFNumberRef maxNumber = static_cast<CFNumberRef>(max);
@@ -2408,7 +2408,7 @@ protected:
if (!CFNumberGetValue(minNumber, kCFNumberDoubleType, &minDouble) ||
!CFNumberGetValue(maxNumber, kCFNumberDoubleType, &maxDouble))
{
- return NULL;
+ return nullptr;
}
double value = SkTPin(SkFixedToDouble(fontData->getAxis()[i]), minDouble, maxDouble);
CFNumberRef valueNumber = CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType,
@@ -2423,12 +2423,12 @@ protected:
SkAutoTDelete<SkFontData> fontData(data);
SkStreamAsset* stream = fontData->detachStream();
AutoCFRelease<CGDataProviderRef> provider(SkCreateDataProviderFromStream(stream));
- if (NULL == provider) {
- return NULL;
+ if (nullptr == provider) {
+ return nullptr;
}
AutoCFRelease<CGFontRef> cg(CGFontCreateWithDataProvider(provider));
- if (NULL == cg) {
- return NULL;
+ if (nullptr == cg) {
+ return nullptr;
}
AutoCFRelease<CFDictionaryRef> cgVariations(get_axes(cg, fontData));
@@ -2442,17 +2442,17 @@ protected:
cgVariant.reset(cg.detach());
}
- CTFontRef ct = CTFontCreateWithGraphicsFont(cgVariant, 0, NULL, NULL);
+ CTFontRef ct = CTFontCreateWithGraphicsFont(cgVariant, 0, nullptr, nullptr);
if (!ct) {
- return NULL;
+ return nullptr;
}
- return NewFromFontRef(ct, cg.detach(), NULL, true);
+ return NewFromFontRef(ct, cg.detach(), nullptr, true);
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(path));
- if (NULL == pr) {
- return NULL;
+ if (nullptr == pr) {
+ return nullptr;
}
return create_from_dataProvider(pr);
}
@@ -2472,7 +2472,7 @@ protected:
NameStyle cacheRequest = { familyName, style };
SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_NameStyle, &cacheRequest);
- if (NULL == face) {
+ if (nullptr == face) {
face = NewFromName(familyName, style);
if (face) {
SkTypefaceCache::Add(face, style);
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 97e659ef6f..e263cc28e7 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -87,9 +87,9 @@ using namespace skia_advanced_typeface_metrics_utils;
static void tchar_to_skstring(const TCHAR t[], SkString* s) {
#ifdef UNICODE
- size_t sSize = WideCharToMultiByte(CP_UTF8, 0, t, -1, NULL, 0, NULL, NULL);
+ size_t sSize = WideCharToMultiByte(CP_UTF8, 0, t, -1, nullptr, 0, nullptr, nullptr);
s->resize(sSize);
- WideCharToMultiByte(CP_UTF8, 0, t, -1, s->writable_str(), sSize, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, t, -1, s->writable_str(), sSize, nullptr, nullptr);
#else
s->set(t);
#endif
@@ -97,9 +97,9 @@ static void tchar_to_skstring(const TCHAR t[], SkString* s) {
static void dcfontname_to_skstring(HDC deviceContext, const LOGFONT& lf, SkString* familyName) {
int fontNameLen; //length of fontName in TCHARS.
- if (0 == (fontNameLen = GetTextFace(deviceContext, 0, NULL))) {
+ if (0 == (fontNameLen = GetTextFace(deviceContext, 0, nullptr))) {
call_ensure_accessible(lf);
- if (0 == (fontNameLen = GetTextFace(deviceContext, 0, NULL))) {
+ if (0 == (fontNameLen = GetTextFace(deviceContext, 0, nullptr))) {
fontNameLen = 0;
}
}
@@ -169,7 +169,7 @@ static unsigned calculateGlyphCount(HDC hdc, const LOGFONT& lf) {
while (min < max) {
int32_t mid = min + ((max - min) / 2);
if (GetGlyphOutlineW(hdc, mid, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0,
- NULL, &mat2) == GDI_ERROR) {
+ nullptr, &mat2) == GDI_ERROR) {
max = mid;
} else {
min = mid + 1;
@@ -212,7 +212,7 @@ public:
// If the font has cubic outlines, it will not be rendered with ClearType.
HFONT font = CreateFontIndirect(&lf);
- HDC deviceContext = ::CreateCompatibleDC(NULL);
+ HDC deviceContext = ::CreateCompatibleDC(nullptr);
HFONT savefont = (HFONT)SelectObject(deviceContext, font);
TEXTMETRIC textMetric;
@@ -320,7 +320,7 @@ SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT& origLF) {
LOGFONT lf = origLF;
make_canonical(&lf);
SkTypeface* face = SkTypefaceCache::FindByProcAndRef(FindByLogFont, &lf);
- if (NULL == face) {
+ if (nullptr == face) {
face = LogFontTypeface::Create(lf);
SkTypefaceCache::Add(face, get_style(lf));
}
@@ -341,7 +341,7 @@ SkTypeface* SkCreateFontMemResourceTypefaceFromLOGFONT(const LOGFONT& origLF, HA
* This guy is public
*/
void SkLOGFONTFromTypeface(const SkTypeface* face, LOGFONT* lf) {
- if (NULL == face) {
+ if (nullptr == face) {
*lf = get_default_font();
} else {
*lf = static_cast<const LogFontTypeface*>(face)->fLogFont;
@@ -356,7 +356,7 @@ void SkLOGFONTFromTypeface(const SkTypeface* face, LOGFONT* lf) {
// of calling GetFontUnicodeRange().
static void populate_glyph_to_unicode(HDC fontHdc, const unsigned glyphCount,
SkTDArray<SkUnichar>* glyphToUnicode) {
- DWORD glyphSetBufferSize = GetFontUnicodeRanges(fontHdc, NULL);
+ DWORD glyphSetBufferSize = GetFontUnicodeRanges(fontHdc, nullptr);
if (!glyphSetBufferSize) {
return;
}
@@ -416,7 +416,7 @@ public:
fFont = 0;
fDC = 0;
fBM = 0;
- fBits = NULL;
+ fBits = nullptr;
fWidth = fHeight = 0;
fIsBW = false;
}
@@ -455,7 +455,7 @@ const void* HDCOffscreen::draw(const SkGlyph& glyph, bool isBW,
if (0 == fDC) {
fDC = CreateCompatibleDC(0);
if (0 == fDC) {
- return NULL;
+ return nullptr;
}
SetGraphicsMode(fDC, GM_ADVANCED);
SetBkMode(fDC, TRANSPARENT);
@@ -498,7 +498,7 @@ const void* HDCOffscreen::draw(const SkGlyph& glyph, bool isBW,
}
fBM = CreateDIBSection(fDC, &info, DIB_RGB_COLORS, &fBits, 0, 0);
if (0 == fBM) {
- return NULL;
+ return nullptr;
}
SelectObject(fDC, fBM);
}
@@ -514,10 +514,10 @@ const void* HDCOffscreen::draw(const SkGlyph& glyph, bool isBW,
SetWorldTransform(fDC, &xform);
uint16_t glyphID = glyph.getGlyphID();
- BOOL ret = ExtTextOutW(fDC, 0, 0, ETO_GLYPH_INDEX, NULL, reinterpret_cast<LPCWSTR>(&glyphID), 1, NULL);
+ BOOL ret = ExtTextOutW(fDC, 0, 0, ETO_GLYPH_INDEX, nullptr, reinterpret_cast<LPCWSTR>(&glyphID), 1, nullptr);
GdiFlush();
if (0 == ret) {
- return NULL;
+ return nullptr;
}
*srcRBPtr = srcRB;
// offset to the start of the image
@@ -606,7 +606,7 @@ SkScalerContext_GDI::SkScalerContext_GDI(SkTypeface* rawTypeface,
{
LogFontTypeface* typeface = reinterpret_cast<LogFontTypeface*>(rawTypeface);
- fDDC = ::CreateCompatibleDC(NULL);
+ fDDC = ::CreateCompatibleDC(nullptr);
if (!fDDC) {
return;
}
@@ -806,13 +806,13 @@ uint16_t SkScalerContext_GDI::generateCharToGlyph(SkUnichar utf32) {
// Use uniscribe to detemine glyph index for non-BMP characters.
static const int numWCHAR = 2;
static const int maxItems = 2;
- // MSDN states that this can be NULL, but some things don't work then.
+ // MSDN states that this can be nullptr, but some things don't work then.
SCRIPT_CONTROL sc = { 0 };
// Add extra item to SCRIPT_ITEM to work around a bug (now documented).
// https://bugzilla.mozilla.org/show_bug.cgi?id=366643
SCRIPT_ITEM si[maxItems + 1];
int numItems;
- HRZM(ScriptItemize(utf16, numWCHAR, maxItems, &sc, NULL, si, &numItems),
+ HRZM(ScriptItemize(utf16, numWCHAR, maxItems, &sc, nullptr, si, &numItems),
"Could not itemize character.");
// Sometimes ScriptShape cannot find a glyph for a non-BMP and returns 2 space glyphs.
@@ -883,10 +883,10 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
GLYPHMETRICS gm;
sk_bzero(&gm, sizeof(gm));
- DWORD status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &fMat22);
+ DWORD status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fMat22);
if (GDI_ERROR == status) {
LogFontTypeface::EnsureAccessible(this->getTypeface());
- status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &fMat22);
+ status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fMat22);
if (GDI_ERROR == status) {
glyph->zeroMetrics();
return;
@@ -899,7 +899,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
// is to be drawn, like a '.'. We need to outset '.' but do not wish to outset ' '.
if (1 == gm.gmBlackBoxX && 1 == gm.gmBlackBoxY) {
// If GetGlyphOutline with GGO_NATIVE returns 0, we know there was no outline.
- DWORD bufferSize = GetGlyphOutlineW(fDDC, glyphId, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, 0, NULL, &fMat22);
+ DWORD bufferSize = GetGlyphOutlineW(fDDC, glyphId, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fMat22);
empty = (0 == bufferSize);
}
@@ -925,7 +925,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
if (this->isSubpixel()) {
sk_bzero(&gm, sizeof(gm));
- status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &fHighResMat22);
+ status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fHighResMat22);
if (GDI_ERROR != status) {
SkPoint advance;
fHiResMatrix.mapXY(SkIntToScalar(gm.gmCellIncX), SkIntToScalar(gm.gmCellIncY), &advance);
@@ -933,7 +933,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
glyph->fAdvanceY = SkScalarToFixed(advance.fY);
}
} else if (!isAxisAligned(this->fRec)) {
- status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &fGsA);
+ status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, nullptr, &fGsA);
if (GDI_ERROR != status) {
SkPoint advance;
fG_inv.mapXY(SkIntToScalar(gm.gmCellIncX), SkIntToScalar(gm.gmCellIncY), &advance);
@@ -945,7 +945,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
static const MAT2 gMat2Identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
void SkScalerContext_GDI::generateFontMetrics(SkPaint::FontMetrics* metrics) {
- if (NULL == metrics) {
+ if (nullptr == metrics) {
return;
}
sk_bzero(metrics, sizeof(*metrics));
@@ -1231,10 +1231,10 @@ void SkScalerContext_GDI::generateImage(const SkGlyph& glyph) {
size_t srcRB;
const void* bits = fOffscreen.draw(glyph, isBW, &srcRB);
- if (NULL == bits) {
+ if (nullptr == bits) {
LogFontTypeface::EnsureAccessible(this->getTypeface());
bits = fOffscreen.draw(glyph, isBW, &srcRB);
- if (NULL == bits) {
+ if (nullptr == bits) {
sk_bzero(glyph.fImage, glyph.computeImageSize());
return;
}
@@ -1322,22 +1322,22 @@ public:
nextHeader:
if (!fCurveIter.isSet()) {
const TTPOLYGONHEADER* header = fHeaderIter.next();
- if (NULL == header) {
- return NULL;
+ if (nullptr == header) {
+ return nullptr;
}
fCurveIter.set(header);
const TTPOLYCURVE* curve = fCurveIter.next();
- if (NULL == curve) {
- return NULL;
+ if (nullptr == curve) {
+ return nullptr;
}
fPointIter.set(curve);
return &header->pfxStart;
}
const POINTFX* nextPoint = fPointIter.next();
- if (NULL == nextPoint) {
+ if (nullptr == nextPoint) {
const TTPOLYCURVE* curve = fCurveIter.next();
- if (NULL == curve) {
+ if (nullptr == curve) {
fCurveIter.set();
goto nextHeader;
} else {
@@ -1363,7 +1363,7 @@ private:
const TTPOLYGONHEADER* next() {
if (fCurPolygon >= fEndPolygon) {
- return NULL;
+ return nullptr;
}
const TTPOLYGONHEADER* thisPolygon = fCurPolygon;
fCurPolygon = SkTAddOffset<const TTPOLYGONHEADER>(fCurPolygon, fCurPolygon->cb);
@@ -1377,27 +1377,27 @@ private:
/** Iterates over all of the polygon curves in a polygon header. */
class GDIPolygonCurveIter {
public:
- GDIPolygonCurveIter() : fCurCurve(NULL), fEndCurve(NULL) { }
+ GDIPolygonCurveIter() : fCurCurve(nullptr), fEndCurve(nullptr) { }
GDIPolygonCurveIter(const TTPOLYGONHEADER* curPolygon)
: fCurCurve(SkTAddOffset<const TTPOLYCURVE>(curPolygon, sizeof(TTPOLYGONHEADER)))
, fEndCurve(SkTAddOffset<const TTPOLYCURVE>(curPolygon, curPolygon->cb))
{ }
- bool isSet() { return fCurCurve != NULL; }
+ bool isSet() { return fCurCurve != nullptr; }
void set(const TTPOLYGONHEADER* curPolygon) {
fCurCurve = SkTAddOffset<const TTPOLYCURVE>(curPolygon, sizeof(TTPOLYGONHEADER));
fEndCurve = SkTAddOffset<const TTPOLYCURVE>(curPolygon, curPolygon->cb);
}
void set() {
- fCurCurve = NULL;
- fEndCurve = NULL;
+ fCurCurve = nullptr;
+ fEndCurve = nullptr;
}
const TTPOLYCURVE* next() {
if (fCurCurve >= fEndCurve) {
- return NULL;
+ return nullptr;
}
const TTPOLYCURVE* thisCurve = fCurCurve;
fCurCurve = SkTAddOffset<const TTPOLYCURVE>(fCurCurve, size_of_TTPOLYCURVE(*fCurCurve));
@@ -1414,7 +1414,7 @@ private:
/** Iterates over all of the polygon points in a polygon curve. */
class GDIPolygonCurvePointIter {
public:
- GDIPolygonCurvePointIter() : fCurveType(0), fCurPoint(NULL), fEndPoint(NULL) { }
+ GDIPolygonCurvePointIter() : fCurveType(0), fCurPoint(nullptr), fEndPoint(nullptr) { }
GDIPolygonCurvePointIter(const TTPOLYCURVE* curPolygon)
: fCurveType(curPolygon->wType)
@@ -1422,7 +1422,7 @@ private:
, fEndPoint(&curPolygon->apfx[curPolygon->cpfx])
{ }
- bool isSet() { return fCurPoint != NULL; }
+ bool isSet() { return fCurPoint != nullptr; }
void set(const TTPOLYCURVE* curPolygon) {
fCurveType = curPolygon->wType;
@@ -1430,13 +1430,13 @@ private:
fEndPoint = &curPolygon->apfx[curPolygon->cpfx];
}
void set() {
- fCurPoint = NULL;
- fEndPoint = NULL;
+ fCurPoint = nullptr;
+ fEndPoint = nullptr;
}
const POINTFX* next() {
if (fCurPoint >= fEndPoint) {
- return NULL;
+ return nullptr;
}
const POINTFX* thisPoint = fCurPoint;
++fCurPoint;
@@ -1505,7 +1505,7 @@ static void sk_path_from_gdi_path(SkPath* path, const uint8_t* glyphbuf, DWORD t
#define move_next_expected_hinted_point(iter, pElem) do {\
pElem = iter.next(); \
- if (NULL == pElem) return false; \
+ if (nullptr == pElem) return false; \
} while(0)
// It is possible for the hinted and unhinted versions of the same path to have
@@ -1591,10 +1591,10 @@ DWORD SkScalerContext_GDI::getGDIGlyphPath(const SkGlyph& glyph, UINT flags,
// GDI_ERROR because the BUFFERSIZE was too small, or because the data was not accessible.
// When the data is not accessable GetGlyphOutlineW fails rather quickly,
// so just try to get the size. If that fails then ensure the data is accessible.
- total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, NULL, &fMat22);
+ total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, nullptr, &fMat22);
if (GDI_ERROR == total_size) {
LogFontTypeface::EnsureAccessible(this->getTypeface());
- total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, NULL, &fMat22);
+ total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, nullptr, &fMat22);
if (GDI_ERROR == total_size) {
// GetGlyphOutlineW is known to fail for some characters, such as spaces.
// In these cases, just return that the glyph does not have a shape.
@@ -1668,7 +1668,7 @@ static void logfont_for_name(const char* familyName, LOGFONT* lf) {
#ifdef UNICODE
// Get the buffer size needed first.
size_t str_len = ::MultiByteToWideChar(CP_UTF8, 0, familyName,
- -1, NULL, 0);
+ -1, nullptr, 0);
// Allocate a buffer (str_len already has terminating null
// accounted for).
wchar_t *wideFamilyName = new wchar_t[str_len];
@@ -1688,7 +1688,7 @@ void LogFontTypeface::onGetFamilyName(SkString* familyName) const {
// Get the actual name of the typeface. The logfont may not know this.
HFONT font = CreateFontIndirect(&fLogFont);
- HDC deviceContext = ::CreateCompatibleDC(NULL);
+ HDC deviceContext = ::CreateCompatibleDC(nullptr);
HFONT savefont = (HFONT)SelectObject(deviceContext, font);
dcfontname_to_skstring(deviceContext, fLogFont, familyName);
@@ -1716,7 +1716,7 @@ static bool getWidthAdvance(HDC hdc, int gId, int16_t* advance) {
SkScalarToFIXED(0), SkScalarToFIXED(1)};
int flags = GGO_METRICS | GGO_GLYPH_INDEX;
GLYPHMETRICS gm;
- if (GDI_ERROR == GetGlyphOutline(hdc, gId, flags, &gm, 0, NULL, &mat2)) {
+ if (GDI_ERROR == GetGlyphOutline(hdc, gId, flags, &gm, 0, nullptr, &mat2)) {
return false;
}
SkASSERT(advance);
@@ -1729,12 +1729,12 @@ SkAdvancedTypefaceMetrics* LogFontTypeface::onGetAdvancedTypefaceMetrics(
const uint32_t* glyphIDs,
uint32_t glyphIDsCount) const {
LOGFONT lf = fLogFont;
- SkAdvancedTypefaceMetrics* info = NULL;
+ SkAdvancedTypefaceMetrics* info = nullptr;
- HDC hdc = CreateCompatibleDC(NULL);
+ HDC hdc = CreateCompatibleDC(nullptr);
HFONT font = CreateFontIndirect(&lf);
HFONT savefont = (HFONT)SelectObject(hdc, font);
- HFONT designFont = NULL;
+ HFONT designFont = nullptr;
const char stem_chars[] = {'i', 'I', '!', '1'};
int16_t min_width;
@@ -1852,7 +1852,7 @@ ReturnInfo:
//Dummy representation of a Base64 encoded GUID from create_unique_font_name.
#define BASE64_GUID_ID "XXXXXXXXXXXXXXXXXXXXXXXX"
-//Length of GUID representation from create_id, including NULL terminator.
+//Length of GUID representation from create_id, including nullptr terminator.
#define BASE64_GUID_ID_LEN SK_ARRAY_COUNT(BASE64_GUID_ID)
static_assert(BASE64_GUID_ID_LEN < LF_FACESIZE, "GUID_longer_than_facesize");
@@ -1899,7 +1899,7 @@ static HRESULT create_unique_font_name(char* buffer, size_t bufferSize) {
}
/**
- Introduces a font to GDI. On failure will return NULL. The returned handle
+ Introduces a font to GDI. On failure will return nullptr. The returned handle
should eventually be passed to RemoveFontMemResourceEx.
*/
static HANDLE activate_font(SkData* fontData) {
@@ -1910,9 +1910,9 @@ static HANDLE activate_font(SkData* fontData) {
0,
&numFonts);
- if (fontHandle != NULL && numFonts < 1) {
+ if (fontHandle != nullptr && numFonts < 1) {
RemoveFontMemResourceEx(fontHandle);
- return NULL;
+ return nullptr;
}
return fontHandle;
@@ -1925,19 +1925,19 @@ static SkTypeface* create_from_stream(SkStreamAsset* stream) {
char familyName[BASE64_GUID_ID_LEN];
const int familyNameSize = SK_ARRAY_COUNT(familyName);
if (FAILED(create_unique_font_name(familyName, familyNameSize))) {
- return NULL;
+ return nullptr;
}
// Change the name of the font.
SkAutoTUnref<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyName, familyNameSize-1));
- if (NULL == rewrittenFontData.get()) {
- return NULL;
+ if (nullptr == rewrittenFontData.get()) {
+ return nullptr;
}
// Register the font with GDI.
HANDLE fontReference = activate_font(rewrittenFontData.get());
- if (NULL == fontReference) {
- return NULL;
+ if (nullptr == fontReference) {
+ return nullptr;
}
// Create the typeface.
@@ -1954,17 +1954,17 @@ SkStreamAsset* LogFontTypeface::onOpenStream(int* ttcIndex) const {
SkEndian_SwapBE32(SkSetFourByteTag('t', 't', 'c', 'f'));
LOGFONT lf = fLogFont;
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
HFONT font = CreateFontIndirect(&lf);
HFONT savefont = (HFONT)SelectObject(hdc, font);
- SkMemoryStream* stream = NULL;
+ SkMemoryStream* stream = nullptr;
DWORD tables[2] = {kTTCTag, 0};
for (int i = 0; i < SK_ARRAY_COUNT(tables); i++) {
- DWORD bufferSize = GetFontData(hdc, tables[i], 0, NULL, 0);
+ DWORD bufferSize = GetFontData(hdc, tables[i], 0, nullptr, 0);
if (bufferSize == GDI_ERROR) {
call_ensure_accessible(lf);
- bufferSize = GetFontData(hdc, tables[i], 0, NULL, 0);
+ bufferSize = GetFontData(hdc, tables[i], 0, nullptr, 0);
}
if (bufferSize != GDI_ERROR) {
stream = new SkMemoryStream(bufferSize);
@@ -1972,7 +1972,7 @@ SkStreamAsset* LogFontTypeface::onOpenStream(int* ttcIndex) const {
break;
} else {
delete stream;
- stream = NULL;
+ stream = nullptr;
}
}
}
@@ -2015,13 +2015,13 @@ static uint16_t nonBmpCharToGlyph(HDC hdc, SCRIPT_CACHE* scriptCache, const WCHA
// Use uniscribe to detemine glyph index for non-BMP characters.
static const int numWCHAR = 2;
static const int maxItems = 2;
- // MSDN states that this can be NULL, but some things don't work then.
+ // MSDN states that this can be nullptr, but some things don't work then.
SCRIPT_CONTROL scriptControl = { 0 };
// Add extra item to SCRIPT_ITEM to work around a bug (now documented).
// https://bugzilla.mozilla.org/show_bug.cgi?id=366643
SCRIPT_ITEM si[maxItems + 1];
int numItems;
- HRZM(ScriptItemize(utf16, numWCHAR, maxItems, &scriptControl, NULL, si, &numItems),
+ HRZM(ScriptItemize(utf16, numWCHAR, maxItems, &scriptControl, nullptr, si, &numItems),
"Could not itemize character.");
// Sometimes ScriptShape cannot find a glyph for a non-BMP and returns 2 space glyphs.
@@ -2042,7 +2042,7 @@ static uint16_t nonBmpCharToGlyph(HDC hdc, SCRIPT_CACHE* scriptCache, const WCHA
class SkAutoHDC {
public:
SkAutoHDC(const LOGFONT& lf)
- : fHdc(::CreateCompatibleDC(NULL))
+ : fHdc(::CreateCompatibleDC(nullptr))
, fFont(::CreateFontIndirect(&lf))
, fSavefont((HFONT)SelectObject(fHdc, fFont))
{ }
@@ -2075,7 +2075,7 @@ int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
SkAutoSTMalloc<256, uint16_t> scratchGlyphs;
uint16_t* glyphs;
- if (userGlyphs != NULL) {
+ if (userGlyphs != nullptr) {
glyphs = userGlyphs;
} else {
glyphs = scratchGlyphs.reset(glyphCount);
@@ -2189,7 +2189,7 @@ int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
}
int LogFontTypeface::onCountGlyphs() const {
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
HFONT font = CreateFontIndirect(&fLogFont);
HFONT savefont = (HFONT)SelectObject(hdc, font);
@@ -2203,7 +2203,7 @@ int LogFontTypeface::onCountGlyphs() const {
}
int LogFontTypeface::onGetUPEM() const {
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
HFONT font = CreateFontIndirect(&fLogFont);
HFONT savefont = (HFONT)SelectObject(hdc, font);
@@ -2219,7 +2219,7 @@ int LogFontTypeface::onGetUPEM() const {
SkTypeface::LocalizedStrings* LogFontTypeface::onCreateFamilyNameIterator() const {
SkTypeface::LocalizedStrings* nameIter =
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this);
- if (NULL == nameIter) {
+ if (nullptr == nameIter) {
SkString familyName;
this->getFamilyName(&familyName);
SkString language("und"); //undetermined
@@ -2255,12 +2255,12 @@ size_t LogFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
{
LOGFONT lf = fLogFont;
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
HFONT font = CreateFontIndirect(&lf);
HFONT savefont = (HFONT)SelectObject(hdc, font);
tag = SkEndian_SwapBE32(tag);
- if (NULL == data) {
+ if (nullptr == data) {
length = 0;
}
DWORD bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length);
@@ -2280,7 +2280,7 @@ SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc
SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), desc);
if (!ctx->isValid()) {
delete ctx;
- ctx = NULL;
+ ctx = nullptr;
}
return ctx;
}
@@ -2378,7 +2378,7 @@ public:
lf.lfCharSet = DEFAULT_CHARSET;
_tcscpy_s(lf.lfFaceName, familyName);
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
::EnumFontFamiliesEx(hdc, &lf, enum_family_proc, (LPARAM)&fArray, 0);
::DeleteDC(hdc);
}
@@ -2424,7 +2424,7 @@ public:
sk_bzero(&lf, sizeof(lf));
lf.lfCharSet = DEFAULT_CHARSET;
- HDC hdc = ::CreateCompatibleDC(NULL);
+ HDC hdc = ::CreateCompatibleDC(nullptr);
::EnumFontFamiliesEx(hdc, &lf, enum_family_proc, (LPARAM)&fLogFontArray, 0);
::DeleteDC(hdc);
}
@@ -2445,7 +2445,7 @@ protected:
}
SkFontStyleSet* onMatchFamily(const char familyName[]) const override {
- if (NULL == familyName) {
+ if (nullptr == familyName) {
familyName = ""; // do we need this check???
}
LOGFONT lf;
@@ -2463,7 +2463,7 @@ protected:
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
const char* bcp47[], int bcp47Count,
SkUnichar character) const override {
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
@@ -2492,7 +2492,7 @@ protected:
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
unsigned styleBits) const override {
LOGFONT lf;
- if (NULL == familyName) {
+ if (nullptr == familyName) {
lf = get_default_font();
} else {
logfont_for_name(familyName, &lf);
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index dc89d91931..0fd121e5ca 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -124,7 +124,7 @@ class SkFontStyleSet_Android : public SkFontStyleSet {
public:
explicit SkFontStyleSet_Android(const FontFamily& family, const Scanner& scanner) {
- const SkString* cannonicalFamilyName = NULL;
+ const SkString* cannonicalFamilyName = nullptr;
if (family.fNames.count() > 0) {
cannonicalFamilyName = &family.fNames[0];
}
@@ -174,7 +174,7 @@ public:
// The first specified family name overrides the family name found in the font.
// TODO: SkTypeface_AndroidSystem::onCreateFamilyNameIterator should return
// all of the specified family names in addition to the names found in the font.
- if (cannonicalFamilyName != NULL) {
+ if (cannonicalFamilyName != nullptr) {
familyName = *cannonicalFamilyName;
}
@@ -244,7 +244,7 @@ public:
}
SkTypeface_AndroidSystem* createTypeface(int index) override {
if (index < 0 || fStyles.count() <= index) {
- return NULL;
+ return nullptr;
}
return SkRef(fStyles[index].get());
}
@@ -255,7 +255,7 @@ public:
*/
SkTypeface_AndroidSystem* matchStyle(const SkFontStyle& pattern) override {
if (0 == fStyles.count()) {
- return NULL;
+ return nullptr;
}
SkTypeface_AndroidSystem* closest = fStyles[0];
int minScore = std::numeric_limits<int>::max();
@@ -342,14 +342,14 @@ protected:
SkFontStyleSet* onCreateStyleSet(int index) const override {
if (index < 0 || fNameToFamilyMap.count() <= index) {
- return NULL;
+ return nullptr;
}
return SkRef(fNameToFamilyMap[index].styleSet);
}
SkFontStyleSet* onMatchFamily(const char familyName[]) const override {
if (!familyName) {
- return NULL;
+ return nullptr;
}
SkAutoAsciiToLC tolc(familyName);
for (int i = 0; i < fNameToFamilyMap.count(); ++i) {
@@ -363,7 +363,7 @@ protected:
return SkRef(fFallbackNameToFamilyMap[i].styleSet);
}
}
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
@@ -381,7 +381,7 @@ protected:
}
}
}
- return NULL;
+ return nullptr;
}
static SkTypeface_AndroidSystem* find_family_style_character(
@@ -411,7 +411,7 @@ protected:
return face.detach();
}
}
- return NULL;
+ return nullptr;
}
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
@@ -449,7 +449,7 @@ protected:
return matchingTypeface;
}
}
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
@@ -458,7 +458,7 @@ protected:
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : NULL;
+ return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
}
SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
@@ -466,10 +466,10 @@ protected:
bool isFixedPitch;
SkFontStyle style;
SkString name;
- if (!fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, NULL)) {
- return NULL;
+ if (!fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, nullptr)) {
+ return nullptr;
}
- SkFontData* data(new SkFontData(stream.detach(), ttcIndex, NULL, 0));
+ SkFontData* data(new SkFontData(stream.detach(), ttcIndex, nullptr, 0));
return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
}
@@ -478,8 +478,8 @@ protected:
bool isFixedPitch;
SkFontStyle style;
SkString name;
- if (!fScanner.scanFont(stream, data->getIndex(), &name, &style, &isFixedPitch, NULL)) {
- return NULL;
+ if (!fScanner.scanFont(stream, data->getIndex(), &name, &style, &isFixedPitch, nullptr)) {
+ return nullptr;
}
return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
}
@@ -490,7 +490,7 @@ protected:
SkFontStyle style = SkFontStyle(styleBits);
if (familyName) {
- // On Android, we must return NULL when we can't find the requested
+ // On Android, we must return nullptr 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
// default family instead.
@@ -546,18 +546,18 @@ private:
static const char* gDefaultNames[] = { "sans-serif" };
for (size_t i = 0; i < SK_ARRAY_COUNT(gDefaultNames); ++i) {
SkFontStyleSet* set = this->onMatchFamily(gDefaultNames[i]);
- if (NULL == set) {
+ if (nullptr == set) {
continue;
}
SkTypeface* tf = set->matchStyle(SkFontStyle());
- if (NULL == tf) {
+ if (nullptr == tf) {
continue;
}
fDefaultFamily = set;
fDefaultTypeface = tf;
break;
}
- if (NULL == fDefaultTypeface) {
+ if (nullptr == fDefaultTypeface) {
fDefaultFamily = fFontStyleSets[0];
fDefaultTypeface = fDefaultFamily->createTypeface(0);
}
diff --git a/src/ports/SkFontMgr_android_factory.cpp b/src/ports/SkFontMgr_android_factory.cpp
index 7f48561479..96d89314d0 100644
--- a/src/ports/SkFontMgr_android_factory.cpp
+++ b/src/ports/SkFontMgr_android_factory.cpp
@@ -9,9 +9,9 @@
#include "SkFontMgr_android.h"
// For test only.
-static const char* gTestFontsXml = NULL;
-static const char* gTestFallbackFontsXml = NULL;
-static const char* gTestBasePath = NULL;
+static const char* gTestFontsXml = nullptr;
+static const char* gTestFallbackFontsXml = nullptr;
+static const char* gTestBasePath = nullptr;
void SkUseTestFontConfigFile(const char* fontsXml, const char* fallbackFontsXml,
const char* basePath)
@@ -39,5 +39,5 @@ SkFontMgr* SkFontMgr::Factory() {
return SkFontMgr_New_Android(&custom);
}
- return SkFontMgr_New_Android(NULL);
+ return SkFontMgr_New_Android(nullptr);
}
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 53decf36cf..83b1c4aa3b 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -51,28 +51,28 @@ struct TagHandler {
/** Called at the start tag.
* Called immediately after the parent tag retuns this handler from a call to 'tag'.
* Allows setting up for handling the tag content and processing attributes.
- * If NULL, will not be called.
+ * If nullptr, will not be called.
*/
void (*start)(FamilyData* data, const char* tag, const char** attributes);
/** Called at the end tag.
* Allows post-processing of any accumulated information.
* This will be the last call made in relation to the current tag.
- * If NULL, will not be called.
+ * If nullptr, will not be called.
*/
void (*end)(FamilyData* data, const char* tag);
/** Called when a nested tag is encountered.
* This is responsible for determining how to handle the tag.
- * If the tag is not recognized, return NULL to skip the tag.
- * If NULL, all nested tags will be skipped.
+ * If the tag is not recognized, return nullptr to skip the tag.
+ * If nullptr, all nested tags will be skipped.
*/
const TagHandler* (*tag)(FamilyData* data, const char* tag, const char** attributes);
/** The character handler for this tag.
* This is only active for character data contained directly in this tag (not sub-tags).
* The first parameter will be castable to a FamilyData*.
- * If NULL, any character data in this tag will be ignored.
+ * If nullptr, any character data in this tag will be ignored.
*/
XML_CharacterDataHandler chars;
};
@@ -84,8 +84,8 @@ struct FamilyData {
const TagHandler* topLevelHandler)
: fParser(parser)
, fFamilies(families)
- , fCurrentFamily(NULL)
- , fCurrentFontInfo(NULL)
+ , fCurrentFamily(nullptr)
+ , fCurrentFontInfo(nullptr)
, fVersion(0)
, fBasePath(basePath)
, fIsFallback(isFallback)
@@ -114,7 +114,7 @@ static bool memeq(const char* s1, const char* s2, size_t n1, size_t n2) {
}
#define MEMEQ(c, s, n) memeq(c, s, sizeof(c) - 1, n)
-#define ATTS_NON_NULL(a, i) (a[i] != NULL && a[i+1] != NULL)
+#define ATTS_NON_NULL(a, i) (a[i] != nullptr && a[i+1] != nullptr)
#define SK_FONTMGR_ANDROID_PARSER_PREFIX "[SkFontMgr Android Parser] "
@@ -178,9 +178,9 @@ static const TagHandler axisHandler = {
}
}
},
- /*end*/NULL,
- /*tag*/NULL,
- /*chars*/NULL,
+ /*end*/nullptr,
+ /*tag*/nullptr,
+ /*chars*/nullptr,
};
static const TagHandler fontHandler = {
@@ -221,7 +221,7 @@ static const TagHandler fontHandler = {
if (MEMEQ("axis", tag, len)) {
return &axisHandler;
}
- return NULL;
+ return nullptr;
},
/*chars*/[](void* data, const char* s, int len) {
FamilyData* self = static_cast<FamilyData*>(data);
@@ -265,9 +265,9 @@ static const TagHandler familyHandler = {
if (MEMEQ("font", tag, len)) {
return &fontHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
static FontFamily* find_family(FamilyData* self, const SkString& familyName) {
@@ -279,7 +279,7 @@ static FontFamily* find_family(FamilyData* self, const SkString& familyName) {
}
}
}
- return NULL;
+ return nullptr;
}
static const TagHandler aliasHandler = {
@@ -331,14 +331,14 @@ static const TagHandler aliasHandler = {
targetFamily->fNames.push_back().set(aliasName);
}
},
- /*end*/NULL,
- /*tag*/NULL,
- /*chars*/NULL,
+ /*end*/nullptr,
+ /*tag*/nullptr,
+ /*chars*/nullptr,
};
static const TagHandler familySetHandler = {
/*start*/[](FamilyData* self, const char* tag, const char** attributes) { },
- /*end*/NULL,
+ /*end*/nullptr,
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
if (MEMEQ("family", tag, len)) {
@@ -346,9 +346,9 @@ static const TagHandler familySetHandler = {
} else if (MEMEQ("alias", tag, len)) {
return &aliasHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
} // lmpParser
@@ -400,8 +400,8 @@ static const TagHandler fileHandler = {
}
self->fCurrentFontInfo = &newFileInfo;
},
- /*end*/NULL,
- /*tag*/NULL,
+ /*end*/nullptr,
+ /*tag*/nullptr,
/*chars*/[](void* data, const char* s, int len) {
FamilyData* self = static_cast<FamilyData*>(data);
self->fCurrentFontInfo->fFileName.append(s, len);
@@ -409,16 +409,16 @@ static const TagHandler fileHandler = {
};
static const TagHandler fileSetHandler = {
- /*start*/NULL,
- /*end*/NULL,
+ /*start*/nullptr,
+ /*end*/nullptr,
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
if (MEMEQ("file", tag, len)) {
return &fileHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
static const TagHandler nameHandler = {
@@ -426,8 +426,8 @@ static const TagHandler nameHandler = {
// The character data should be a name for the font.
self->fCurrentFamily->fNames.push_back();
},
- /*end*/NULL,
- /*tag*/NULL,
+ /*end*/nullptr,
+ /*tag*/nullptr,
/*chars*/[](void* data, const char* s, int len) {
FamilyData* self = static_cast<FamilyData*>(data);
SkAutoAsciiToLC tolc(s, len);
@@ -436,16 +436,16 @@ static const TagHandler nameHandler = {
};
static const TagHandler nameSetHandler = {
- /*start*/NULL,
- /*end*/NULL,
+ /*start*/nullptr,
+ /*end*/nullptr,
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
if (MEMEQ("name", tag, len)) {
return &nameHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
static const TagHandler familyHandler = {
@@ -467,29 +467,29 @@ static const TagHandler familyHandler = {
} else if (MEMEQ("fileset", tag, len)) {
return &fileSetHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
static const TagHandler familySetHandler = {
- /*start*/NULL,
- /*end*/NULL,
+ /*start*/nullptr,
+ /*end*/nullptr,
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
if (MEMEQ("family", tag, len)) {
return &familyHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
} // namespace jbParser
static const TagHandler topLevelHandler = {
- /*start*/NULL,
- /*end*/NULL,
+ /*start*/nullptr,
+ /*end*/nullptr,
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
if (MEMEQ("familyset", tag, len)) {
@@ -508,9 +508,9 @@ static const TagHandler topLevelHandler = {
}
return &jbParser::familySetHandler;
}
- return NULL;
+ return nullptr;
},
- /*chars*/NULL,
+ /*chars*/nullptr,
};
static void XMLCALL start_element_handler(void *data, const char *tag, const char **attributes) {
@@ -518,7 +518,7 @@ static void XMLCALL start_element_handler(void *data, const char *tag, const cha
if (!self->fSkip) {
const TagHandler* parent = self->fHandler.top();
- const TagHandler* child = parent->tag ? parent->tag(self, tag, attributes) : NULL;
+ const TagHandler* child = parent->tag ? parent->tag(self, tag, attributes) : nullptr;
if (child) {
if (child->start) {
child->start(self, tag, attributes);
@@ -527,7 +527,7 @@ static void XMLCALL start_element_handler(void *data, const char *tag, const cha
XML_SetCharacterDataHandler(self->fParser, child->chars);
} else {
SK_FONTCONFIGPARSER_WARNING("'%s' tag not recognized, skipping", tag);
- XML_SetCharacterDataHandler(self->fParser, NULL);
+ XML_SetCharacterDataHandler(self->fParser, nullptr);
self->fSkip = self->fDepth;
}
}
@@ -597,7 +597,7 @@ static int parse_config_file(const char* filename, SkTDArray<FontFamily*>& famil
}
SkAutoTCallVProc<remove_ptr<XML_Parser>::type, XML_ParserFree> parser(
- XML_ParserCreate_MM(NULL, &sk_XML_alloc, NULL));
+ XML_ParserCreate_MM(nullptr, &sk_XML_alloc, nullptr));
if (!parser) {
SkDebugf(SK_FONTMGR_ANDROID_PARSER_PREFIX "could not create XML parser\n");
return -1;
@@ -669,7 +669,7 @@ static void append_fallback_font_families_for_locale(SkTDArray<FontFamily*>& fal
#endif
SkAutoTCallIProc<DIR, closedir> fontDirectory(opendir(dir));
- if (NULL == fontDirectory) {
+ if (nullptr == fontDirectory) {
return;
}
@@ -789,7 +789,7 @@ SkLanguage SkLanguage::getParent() const {
// strip off the rightmost "-.*"
const char* parentTagEnd = strrchr(tag, '-');
- if (parentTagEnd == NULL) {
+ if (parentTagEnd == nullptr) {
return SkLanguage();
}
size_t parentTagLen = parentTagEnd - tag;
diff --git a/src/ports/SkFontMgr_android_parser.h b/src/ports/SkFontMgr_android_parser.h
index ca66c43410..aca1573952 100644
--- a/src/ports/SkFontMgr_android_parser.h
+++ b/src/ports/SkFontMgr_android_parser.h
@@ -115,7 +115,7 @@ void GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies,
const SkString& basePath,
const char* fontsXml,
const char* fallbackFontsXml,
- const char* langFallbackFontsDir = NULL);
+ const char* langFallbackFontsDir = nullptr);
} // SkFontMgr_Android_Parser namespace
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 496a54cd38..7f3ce6b032 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -63,7 +63,7 @@ public:
SkTypeface_Empty() : INHERITED(SkFontStyle(), false, true, SkString(), 0) {}
protected:
- SkStreamAsset* onOpenStream(int*) const override { return NULL; }
+ SkStreamAsset* onOpenStream(int*) const override { return nullptr; }
private:
typedef SkTypeface_Custom INHERITED;
@@ -156,7 +156,7 @@ public:
SkTypeface* matchStyle(const SkFontStyle& pattern) override {
if (0 == fStyles.count()) {
- return NULL;
+ return nullptr;
}
SkTypeface_Custom* closest = fStyles[0];
@@ -203,30 +203,30 @@ public:
virtual ~SystemFontLoader() { }
virtual void loadSystemFonts(const SkTypeface_FreeType::Scanner&, Families*) const = 0;
};
- explicit SkFontMgr_Custom(const SystemFontLoader& loader) : fDefaultFamily(NULL) {
+ explicit SkFontMgr_Custom(const SystemFontLoader& loader) : fDefaultFamily(nullptr) {
loader.loadSystemFonts(fScanner, &fFamilies);
// Try to pick a default font.
static const char* defaultNames[] = {
- "Arial", "Verdana", "Times New Roman", "Droid Sans", NULL
+ "Arial", "Verdana", "Times New Roman", "Droid Sans", nullptr
};
for (size_t i = 0; i < SK_ARRAY_COUNT(defaultNames); ++i) {
SkFontStyleSet_Custom* set = this->onMatchFamily(defaultNames[i]);
- if (NULL == set) {
+ if (nullptr == set) {
continue;
}
SkTypeface* tf = set->matchStyle(SkFontStyle(SkFontStyle::kNormal_Weight,
SkFontStyle::kNormal_Width,
SkFontStyle::kUpright_Slant));
- if (NULL == tf) {
+ if (nullptr == tf) {
continue;
}
fDefaultFamily = set;
break;
}
- if (NULL == fDefaultFamily) {
+ if (nullptr == fDefaultFamily) {
fDefaultFamily = fFamilies[0];
}
}
@@ -252,7 +252,7 @@ protected:
return SkRef(fFamilies[i].get());
}
}
- return NULL;
+ return nullptr;
}
SkTypeface* onMatchFamilyStyle(const char familyName[],
@@ -266,7 +266,7 @@ protected:
const char* bcp47[], int bcp47Count,
SkUnichar character) const override
{
- return NULL;
+ return nullptr;
}
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
@@ -279,7 +279,7 @@ protected:
}
}
}
- return NULL;
+ return nullptr;
}
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
@@ -288,24 +288,24 @@ protected:
SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(bareStream);
- if (NULL == stream || stream->getLength() <= 0) {
- return NULL;
+ if (nullptr == stream || stream->getLength() <= 0) {
+ return nullptr;
}
bool isFixedPitch;
SkFontStyle style;
SkString name;
- if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, NULL)) {
+ if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, nullptr)) {
return new SkTypeface_Stream(style, isFixedPitch, false, name, stream.detach(),
ttcIndex);
} else {
- return NULL;
+ return nullptr;
}
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : NULL;
+ return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
@@ -317,13 +317,13 @@ protected:
oldStyle & SkTypeface::kItalic
? SkFontStyle::kItalic_Slant
: SkFontStyle::kUpright_Slant);
- SkTypeface* tf = NULL;
+ SkTypeface* tf = nullptr;
if (familyName) {
tf = this->onMatchFamilyStyle(familyName, style);
}
- if (NULL == tf) {
+ if (nullptr == tf) {
tf = fDefaultFamily->matchStyle(style);
}
@@ -366,7 +366,7 @@ private:
return families[i].get();
}
}
- return NULL;
+ return nullptr;
}
static void load_directory_fonts(const SkTypeface_FreeType::Scanner& scanner,
@@ -394,7 +394,7 @@ private:
bool isFixedPitch;
SkString realname;
SkFontStyle style = SkFontStyle(); // avoid uninitialized warning
- if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, NULL)) {
+ if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, nullptr)) {
SkDebugf("---- failed to open <%s> <%d> as a font\n",
filename.c_str(), faceIndex);
continue;
@@ -405,7 +405,7 @@ private:
realname, filename.c_str(), faceIndex);
SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str());
- if (NULL == addTo) {
+ if (nullptr == addTo) {
addTo = new SkFontStyleSet_Custom(realname);
families->push_back().reset(addTo);
}
@@ -463,7 +463,7 @@ private:
return families[i].get();
}
}
- return NULL;
+ return nullptr;
}
static void load_embedded_font(const SkTypeface_FreeType::Scanner& scanner,
@@ -482,7 +482,7 @@ private:
bool isFixedPitch;
SkString realname;
SkFontStyle style = SkFontStyle(); // avoid uninitialized warning
- if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, NULL)) {
+ if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, nullptr)) {
SkDebugf("---- failed to open <%d> <%d> as a font\n", index, faceIndex);
return;
}
@@ -492,7 +492,7 @@ private:
realname, stream.detach(), faceIndex);
SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str());
- if (NULL == addTo) {
+ if (nullptr == addTo) {
addTo = new SkFontStyleSet_Custom(realname);
families->push_back().reset(addTo);
}
diff --git a/src/ports/SkFontMgr_empty_factory.cpp b/src/ports/SkFontMgr_empty_factory.cpp
index ceed8f3320..b4232cde12 100644
--- a/src/ports/SkFontMgr_empty_factory.cpp
+++ b/src/ports/SkFontMgr_empty_factory.cpp
@@ -8,6 +8,6 @@
#include "SkFontMgr.h"
SkFontMgr* SkFontMgr::Factory() {
- // Always return NULL, an empty SkFontMgr will be used.
- return NULL;
+ // Always return nullptr, an empty SkFontMgr will be used.
+ return nullptr;
}
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index 3dc1ea03da..76825233bf 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -113,7 +113,7 @@ template <typename T, T* (*C)(), void (*D)(T*)> class SkAutoFc
public:
SkAutoFc() : SkAutoTCallVProc<T, FcTDestroy<T, D> >(C()) {
T* obj = this->operator T*();
- SK_ALWAYSBREAK(NULL != obj);
+ SK_ALWAYSBREAK(nullptr != obj);
}
explicit SkAutoFc(T* obj) : SkAutoTCallVProc<T, FcTDestroy<T, D> >(obj) {}
};
@@ -162,7 +162,7 @@ static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) {
// Create a copy of the pattern with only the value 'pattern'['object'['id']] in it.
// Internally, FontConfig pattern objects are linked lists, so faster to remove from head.
- SkAutoFcObjectSet requestedObjectOnly(FcObjectSetBuild(object, NULL));
+ SkAutoFcObjectSet requestedObjectOnly(FcObjectSetBuild(object, nullptr));
SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
FcBool hasId = true;
for (int i = 0; hasId && i < id; ++i) {
@@ -226,7 +226,7 @@ static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) {
static void remove_weak(FcPattern* pattern, const char object[]) {
FCLocker::AssertHeld();
- SkAutoFcObjectSet requestedObjectOnly(FcObjectSetBuild(object, NULL));
+ SkAutoFcObjectSet requestedObjectOnly(FcObjectSetBuild(object, nullptr));
SkAutoFcPattern minimal(FcPatternFilter(pattern, requestedObjectOnly));
int lastStrongId = -1;
@@ -512,8 +512,8 @@ class SkFontMgr_fontconfig : public SkFontMgr {
SkAutoFcPattern match(FcFontSetMatch(fFontMgr->fFC,
fontSets, SK_ARRAY_COUNT(fontSets),
pattern, &result));
- if (NULL == match) {
- return NULL;
+ if (nullptr == match) {
+ return nullptr;
}
return fFontMgr->createTypefaceFromFcPattern(match);
@@ -544,7 +544,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
for (int setIndex = 0; setIndex < (int)SK_ARRAY_COUNT(fcNameSet); ++setIndex) {
// Return value of FcConfigGetFonts must not be destroyed.
FcFontSet* allFonts(FcConfigGetFonts(fcconfig, fcNameSet[setIndex]));
- if (NULL == allFonts) {
+ if (nullptr == allFonts) {
continue;
}
@@ -587,7 +587,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
FCLocker::AssertHeld();
SkAutoMutexAcquire ama(fTFCacheMutex);
SkTypeface* face = fTFCache.findByProcAndRef(FindByFcPattern, pattern);
- if (NULL == face) {
+ if (nullptr == face) {
FcPatternReference(pattern);
face = SkTypeface_fontconfig::Create(pattern);
if (face) {
@@ -658,8 +658,8 @@ protected:
static bool FontAccessible(FcPattern* font) {
// FontConfig can return fonts which are unreadable.
- const char* filename = get_string(font, FC_FILE, NULL);
- if (NULL == filename) {
+ const char* filename = get_string(font, FC_FILE, nullptr);
+ if (nullptr == filename) {
return false;
}
return sk_exists(filename, kRead_SkFILE_Flag);
@@ -696,7 +696,7 @@ protected:
FcDefaultSubstitute(pattern);
FcPattern* matchPattern;
- SkAutoFcPattern strongPattern(NULL);
+ SkAutoFcPattern strongPattern(nullptr);
if (familyName) {
strongPattern.reset(FcPatternDuplicate(pattern));
remove_weak(strongPattern, FC_FAMILY);
@@ -713,7 +713,7 @@ protected:
for (int setIndex = 0; setIndex < (int)SK_ARRAY_COUNT(fcNameSet); ++setIndex) {
// Return value of FcConfigGetFonts must not be destroyed.
FcFontSet* allFonts(FcConfigGetFonts(fFC, fcNameSet[setIndex]));
- if (NULL == allFonts) {
+ if (nullptr == allFonts) {
continue;
}
@@ -748,7 +748,7 @@ protected:
// In aliases, bindings are weak by default, so this is easy and common.
// If no family name was specified, we'll probably only get weak matches, but that's ok.
FcPattern* matchPattern;
- SkAutoFcPattern strongPattern(NULL);
+ SkAutoFcPattern strongPattern(nullptr);
if (familyName) {
strongPattern.reset(FcPatternDuplicate(pattern));
remove_weak(strongPattern, FC_FAMILY);
@@ -759,8 +759,8 @@ protected:
FcResult result;
SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));
- if (NULL == font || !FontAccessible(font) || !FontFamilyNameMatches(font, matchPattern)) {
- return NULL;
+ if (nullptr == font || !FontAccessible(font) || !FontFamilyNameMatches(font, matchPattern)) {
+ return nullptr;
}
return createTypefaceFromFcPattern(font);
@@ -801,8 +801,8 @@ protected:
FcResult result;
SkAutoFcPattern font(FcFontMatch(fFC, pattern, &result));
- if (NULL == font || !FontAccessible(font) || !FontContainsCharacter(font, character)) {
- return NULL;
+ if (nullptr == font || !FontAccessible(font) || !FontContainsCharacter(font, character)) {
+ return nullptr;
}
return createTypefaceFromFcPattern(font);
@@ -821,16 +821,16 @@ protected:
SkAutoTDelete<SkStreamAsset> stream(bareStream);
const size_t length = stream->getLength();
if (length <= 0 || (1u << 30) < length) {
- return NULL;
+ return nullptr;
}
SkFontStyle style;
bool isFixedWidth = false;
- if (!fScanner.scanFont(stream, ttcIndex, NULL, &style, &isFixedWidth, NULL)) {
- return NULL;
+ if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth, nullptr)) {
+ return nullptr;
}
- return new SkTypeface_stream(new SkFontData(stream.detach(), ttcIndex, NULL, 0), style,
+ return new SkTypeface_stream(new SkFontData(stream.detach(), ttcIndex, nullptr, 0), style,
isFixedWidth);
}
@@ -846,14 +846,14 @@ protected:
SkStreamAsset* stream(fontData->getStream());
const size_t length = stream->getLength();
if (length <= 0 || (1u << 30) < length) {
- return NULL;
+ return nullptr;
}
const int ttcIndex = fontData->getIndex();
SkFontStyle style;
bool isFixedWidth = false;
- if (!fScanner.scanFont(stream, ttcIndex, NULL, &style, &isFixedWidth, NULL)) {
- return NULL;
+ if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth, nullptr)) {
+ return nullptr;
}
return new SkTypeface_stream(fontData, style, isFixedWidth);
@@ -873,7 +873,7 @@ protected:
return typeface.detach();
}
- return this->matchFamilyStyle(NULL, style);
+ return this->matchFamilyStyle(nullptr, style);
}
};
diff --git a/src/ports/SkFontMgr_fontconfig_factory.cpp b/src/ports/SkFontMgr_fontconfig_factory.cpp
index 78792fa989..cdf055608d 100644
--- a/src/ports/SkFontMgr_fontconfig_factory.cpp
+++ b/src/ports/SkFontMgr_fontconfig_factory.cpp
@@ -10,5 +10,5 @@
#include "SkTypes.h"
SkFontMgr* SkFontMgr::Factory() {
- return SkFontMgr_New_FontConfig(NULL);
+ return SkFontMgr_New_FontConfig(nullptr);
}
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index df51764ab8..e40c5e4faa 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -42,7 +42,7 @@ public:
// Takes ownership of stream.
static HRESULT Create(SkStreamAsset* stream, StreamFontFileLoader** streamFontFileLoader) {
*streamFontFileLoader = new StreamFontFileLoader(stream);
- if (NULL == streamFontFileLoader) {
+ if (nullptr == streamFontFileLoader) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -63,7 +63,7 @@ HRESULT StreamFontFileLoader::QueryInterface(REFIID iid, void** ppvObject) {
AddRef();
return S_OK;
} else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -107,7 +107,7 @@ public:
static HRESULT Create(IDWriteFactory* factory, IDWriteFontFileLoader* fontFileLoader,
StreamFontFileEnumerator** streamFontFileEnumerator) {
*streamFontFileEnumerator = new StreamFontFileEnumerator(factory, fontFileLoader);
- if (NULL == streamFontFileEnumerator) {
+ if (nullptr == streamFontFileEnumerator) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -139,7 +139,7 @@ HRESULT StreamFontFileEnumerator::QueryInterface(REFIID iid, void** ppvObject) {
AddRef();
return S_OK;
} else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -166,7 +166,7 @@ HRESULT StreamFontFileEnumerator::MoveNext(BOOL* hasCurrentFile) {
UINT32 dummy = 0;
HR(fFactory->CreateCustomFontFileReference(
- &dummy, //cannot be NULL
+ &dummy, //cannot be nullptr
sizeof(dummy), //even if this is 0
fFontFileLoader.get(),
&fCurrentFile));
@@ -176,8 +176,8 @@ HRESULT StreamFontFileEnumerator::MoveNext(BOOL* hasCurrentFile) {
}
HRESULT StreamFontFileEnumerator::GetCurrentFontFile(IDWriteFontFile** fontFile) {
- if (fCurrentFile.get() == NULL) {
- *fontFile = NULL;
+ if (fCurrentFile.get() == nullptr) {
+ *fontFile = nullptr;
return E_FAIL;
}
@@ -204,7 +204,7 @@ public:
static HRESULT Create(IDWriteFontFileLoader* fontFileLoader,
StreamFontCollectionLoader** streamFontCollectionLoader) {
*streamFontCollectionLoader = new StreamFontCollectionLoader(fontFileLoader);
- if (NULL == streamFontCollectionLoader) {
+ if (nullptr == streamFontCollectionLoader) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -226,7 +226,7 @@ HRESULT StreamFontCollectionLoader::QueryInterface(REFIID iid, void** ppvObject)
AddRef();
return S_OK;
} else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -268,9 +268,9 @@ public:
{
#if SK_HAS_DWRITE_2_H
if (!SUCCEEDED(fFactory->QueryInterface(&fFactory2))) {
- // IUnknown::QueryInterface states that if it fails, punk will be set to NULL.
+ // IUnknown::QueryInterface states that if it fails, punk will be set to nullptr.
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
- SK_ALWAYSBREAK(NULL == fFactory2.get());
+ SK_ALWAYSBREAK(nullptr == fFactory2.get());
}
#endif
memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR));
@@ -370,8 +370,8 @@ static bool FindByDWriteFont(SkTypeface* cached, const SkFontStyle&, void* ctx)
//Check if the two fonts share the same loader and have the same key.
UINT32 cshNumFiles;
UINT32 ctxNumFiles;
- HRB(cshFace->fDWriteFontFace->GetFiles(&cshNumFiles, NULL));
- HRB(ctxFace->fDWriteFontFace->GetFiles(&ctxNumFiles, NULL));
+ HRB(cshFace->fDWriteFontFace->GetFiles(&cshNumFiles, nullptr));
+ HRB(ctxFace->fDWriteFontFace->GetFiles(&ctxNumFiles, nullptr));
if (cshNumFiles != ctxNumFiles) {
return false;
}
@@ -452,7 +452,7 @@ SkTypeface* SkFontMgr_DirectWrite::createTypefaceFromDWriteFont(
SkAutoMutexAcquire ama(fTFCacheMutex);
ProtoDWriteTypeface spec = { fontFace, font, fontFamily };
SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, &spec);
- if (NULL == face) {
+ if (nullptr == face) {
face = DWriteFontTypeface::Create(fFactory.get(), fontFace, font, fontFamily);
if (face) {
fTFCache.add(face, get_style(font));
@@ -491,7 +491,7 @@ SkFontStyleSet* SkFontMgr_DirectWrite::onMatchFamily(const char familyName[]) co
HRNM(fFontCollection->FindFamilyName(dwFamilyName.get(), &index, &exists),
"Failed while finding family by name.");
if (!exists) {
- return NULL;
+ return nullptr;
}
return this->onCreateStyleSet(index);
@@ -506,7 +506,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyle(const char familyName[],
class FontFallbackRenderer : public IDWriteTextRenderer {
public:
FontFallbackRenderer(const SkFontMgr_DirectWrite* outer, UINT32 character)
- : fRefCount(1), fOuter(SkSafeRef(outer)), fCharacter(character), fResolvedTypeface(NULL) {
+ : fRefCount(1), fOuter(SkSafeRef(outer)), fCharacter(character), fResolvedTypeface(nullptr) {
}
virtual ~FontFallbackRenderer() { }
@@ -616,7 +616,7 @@ public:
this->AddRef();
return S_OK;
}
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_FAIL;
}
@@ -648,7 +648,7 @@ public:
UINT32* textLength) override
{
if (fLength <= textPosition) {
- *textString = NULL;
+ *textString = nullptr;
*textLength = 0;
return S_OK;
}
@@ -663,7 +663,7 @@ public:
UINT32* textLength) override
{
if (textPosition < 1 || fLength <= textPosition) {
- *textString = NULL;
+ *textString = nullptr;
*textLength = 0;
return S_OK;
}
@@ -716,7 +716,7 @@ public:
this->AddRef();
return S_OK;
}
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_FAIL;
}
@@ -735,7 +735,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
{
const DWriteStyle dwStyle(style);
- const WCHAR* dwFamilyName = NULL;
+ const WCHAR* dwFamilyName = nullptr;
SkSMallocWCHAR dwFamilyNameLocal;
if (familyName) {
HRN(sk_cstring_to_wchar(familyName, &dwFamilyNameLocal));
@@ -764,7 +764,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
HRNM(fFactory2->GetSystemFontFallback(&fontFallback), "Could not get system fallback.");
SkTScopedComPtr<IDWriteNumberSubstitution> numberSubstitution;
- HRNM(fFactory2->CreateNumberSubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, NULL, TRUE,
+ HRNM(fFactory2->CreateNumberSubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, nullptr, TRUE,
&numberSubstitution),
"Could not create number substitution.");
SkTScopedComPtr<FontFallbackSource> fontFallbackSource(
@@ -786,7 +786,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
&scale),
"Could not map characters");
if (!font.get()) {
- return NULL;
+ return nullptr;
}
SkTScopedComPtr<IDWriteFontFace> fontFace;
@@ -820,7 +820,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
SkTScopedComPtr<FontFallbackRenderer> fontFallbackRenderer(
new FontFallbackRenderer(this, character));
- HRNM(fallbackLayout->Draw(NULL, fontFallbackRenderer.get(), 50.0f, 50.0f),
+ HRNM(fallbackLayout->Draw(nullptr, fontFallbackRenderer.get(), 50.0f, 50.0f),
"Could not draw layout with renderer.");
return fontFallbackRenderer->FallbackTypeface();
@@ -849,7 +849,7 @@ public:
T* detatch() {
T* old = fUnregister;
- fUnregister = NULL;
+ fUnregister = nullptr;
return old;
}
@@ -881,7 +881,7 @@ SkTypeface* SkFontMgr_DirectWrite::onCreateFromStream(SkStreamAsset* stream, int
fFactory.get(), fontCollectionLoader.get());
SkTScopedComPtr<IDWriteFontCollection> fontCollection;
- HRN(fFactory->CreateCustomFontCollection(fontCollectionLoader.get(), NULL, 0, &fontCollection));
+ HRN(fFactory->CreateCustomFontCollection(fontCollectionLoader.get(), nullptr, 0, &fontCollection));
// Find the first non-simulated font which has the given ttc index.
UINT32 familyCount = fontCollection->GetFontFamilyCount();
@@ -910,7 +910,7 @@ SkTypeface* SkFontMgr_DirectWrite::onCreateFromStream(SkStreamAsset* stream, int
}
}
- return NULL;
+ return nullptr;
}
SkTypeface* SkFontMgr_DirectWrite::onCreateFromData(SkData* data, int ttcIndex) const {
@@ -957,12 +957,12 @@ SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[
}
}
- if (NULL == fontFamily.get()) {
+ if (nullptr == fontFamily.get()) {
// No family with given name, try default.
HRNM(this->getDefaultFontFamily(&fontFamily), "Could not get default font family.");
}
- if (NULL == fontFamily.get()) {
+ if (nullptr == fontFamily.get()) {
// Could not obtain the default font.
HRNM(fFontCollection->GetFontFamily(0, &fontFamily),
"Could not get default-default font family.");
@@ -1065,10 +1065,10 @@ SkTypeface* SkFontStyleSet_DirectWrite::matchStyle(const SkFontStyle& pattern) {
#include "SkTypeface_win.h"
SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
- if (NULL == factory) {
+ if (nullptr == factory) {
factory = sk_get_dwrite_factory();
- if (NULL == factory) {
- return NULL;
+ if (nullptr == factory) {
+ return nullptr;
}
}
@@ -1077,13 +1077,13 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
"Could not get system font collection.");
WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
- WCHAR* localeName = NULL;
+ WCHAR* localeName = nullptr;
int localeNameLen = 0;
// Dynamically load GetUserDefaultLocaleName function, as it is not available on XP.
- SkGetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = NULL;
+ SkGetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = nullptr;
HRESULT hr = SkGetGetUserDefaultLocaleNameProc(&getUserDefaultLocaleNameProc);
- if (NULL == getUserDefaultLocaleNameProc) {
+ if (nullptr == getUserDefaultLocaleNameProc) {
SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName.");
} else {
localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_NAME_MAX_LENGTH);
@@ -1098,8 +1098,8 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
#include "SkFontMgr_indirect.h"
SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) {
SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
- if (impl.get() == NULL) {
- return NULL;
+ if (impl.get() == nullptr) {
+ return nullptr;
}
return new SkFontMgr_Indirect(impl.get(), proxy);
}
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index e1e6dc17e7..bd94764c3a 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -41,7 +41,7 @@ static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) {
static CGImageSourceRef SkStreamToCGImageSource(SkStream* stream) {
CGDataProviderRef data = SkStreamToDataProvider(stream);
if (!data) {
- return NULL;
+ return nullptr;
}
CGImageSourceRef imageSrc = CGImageSourceCreateWithDataProvider(data, 0);
CGDataProviderRelease(data);
@@ -134,13 +134,13 @@ static bool colorspace_is_sRGB(CGColorSpaceRef cs) {
SkImageDecoder::Result SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
CGImageSourceRef imageSrc = SkStreamToCGImageSource(stream);
- if (NULL == imageSrc) {
+ if (nullptr == imageSrc) {
return kFailure;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
- CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL);
- if (NULL == image) {
+ CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, nullptr);
+ if (nullptr == image) {
return kFailure;
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
@@ -173,7 +173,7 @@ SkImageDecoder::Result SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* b
return kSuccess;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return kFailure;
}
@@ -219,7 +219,7 @@ extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
SkImageDecoder* decoder = image_decoder_from_stream(stream);
- if (NULL == decoder) {
+ if (nullptr == decoder) {
// If no image decoder specific to the stream exists, use SkImageDecoder_CG.
return new SkImageDecoder_CG;
} else {
@@ -230,7 +230,7 @@ SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
/////////////////////////////////////////////////////////////////////////
SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////
@@ -256,12 +256,12 @@ static CGDataConsumerRef SkStreamToCGDataConsumer(SkWStream* stream) {
static CGImageDestinationRef SkStreamToImageDestination(SkWStream* stream,
CFStringRef type) {
CGDataConsumerRef consumer = SkStreamToCGDataConsumer(stream);
- if (NULL == consumer) {
- return NULL;
+ if (nullptr == consumer) {
+ return nullptr;
}
SkAutoTCallVProc<const void, CFRelease> arconsumer(consumer);
- return CGImageDestinationCreateWithDataConsumer(consumer, type, 1, NULL);
+ return CGImageDestinationCreateWithDataConsumer(consumer, type, 1, nullptr);
}
class SkImageEncoder_CG : public SkImageEncoder {
@@ -316,18 +316,18 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm,
}
CGImageDestinationRef dst = SkStreamToImageDestination(stream, type);
- if (NULL == dst) {
+ if (nullptr == dst) {
return false;
}
SkAutoTCallVProc<const void, CFRelease> ardst(dst);
CGImageRef image = SkCreateCGImageRef(*bmPtr);
- if (NULL == image) {
+ if (nullptr == image) {
return false;
}
SkAutoTCallVProc<CGImage, CGImageRelease> agimage(image);
- CGImageDestinationAddImage(dst, image, NULL);
+ CGImageDestinationAddImage(dst, image, nullptr);
return CGImageDestinationFinalize(dst);
}
@@ -342,7 +342,7 @@ static SkImageEncoder* sk_imageencoder_cg_factory(SkImageEncoder::Type t) {
case SkImageEncoder::kPNG_Type:
break;
default:
- return NULL;
+ return nullptr;
}
return new SkImageEncoder_CG(t);
}
@@ -388,13 +388,13 @@ static SkImageDecoder::Format UTType_to_Format(const CFStringRef uttype) {
static SkImageDecoder::Format get_format_cg(SkStreamRewindable* stream) {
CGImageSourceRef imageSrc = SkStreamToCGImageSource(stream);
- if (NULL == imageSrc) {
+ if (nullptr == imageSrc) {
return SkImageDecoder::kUnknown_Format;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
const CFStringRef name = CGImageSourceGetType(imageSrc);
- if (NULL == name) {
+ if (nullptr == name) {
return SkImageDecoder::kUnknown_Format;
}
return UTType_to_Format(name);
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 919483135c..3cc9a32b68 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -60,7 +60,7 @@ public:
* Helper function to decode an SkStream.
* @param stream SkStream to decode. Must be at the beginning.
* @param bm SkBitmap to decode into. Only used if wicMode is kDecodeBounds_WICMode or
- * kDecodePixels_WICMode, in which case it must not be NULL.
+ * kDecodePixels_WICMode, in which case it must not be nullptr.
* @param format Out parameter for the SkImageDecoder::Format of the SkStream. Only used if
* wicMode is kDecodeFormat_WICMode.
*/
@@ -102,7 +102,7 @@ SkImageDecoder::Result SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap*
wicMode = kDecodePixels_WICMode;
break;
}
- return this->decodeStream(stream, bm, wicMode, NULL) ? kSuccess : kFailure;
+ return this->decodeStream(stream, bm, wicMode, nullptr) ? kSuccess : kFailure;
}
bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes wicMode,
@@ -120,7 +120,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
if (SUCCEEDED(hr)) {
hr = CoCreateInstance(
CLSID_WICImagingFactory
- , NULL
+ , nullptr
, CLSCTX_INPROC_SERVER
, IID_PPV_ARGS(&piImagingFactory)
);
@@ -135,7 +135,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
//Make sure we're at the beginning of the stream.
if (SUCCEEDED(hr)) {
LARGE_INTEGER liBeginning = { 0 };
- hr = piStream->Seek(liBeginning, STREAM_SEEK_SET, NULL);
+ hr = piStream->Seek(liBeginning, STREAM_SEEK_SET, nullptr);
}
//Create the decoder from the stream content.
@@ -143,14 +143,14 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateDecoderFromStream(
piStream.get() //Image to be decoded
- , NULL //No particular vendor
+ , nullptr //No particular vendor
, WICDecodeMetadataCacheOnDemand //Cache metadata when needed
, &piBitmapDecoder //Pointer to the decoder
);
}
if (kDecodeFormat_WICMode == wicMode) {
- SkASSERT(format != NULL);
+ SkASSERT(format != nullptr);
//Get the format
if (SUCCEEDED(hr)) {
GUID guidFormat;
@@ -190,7 +190,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
if (kDecodeBounds_WICMode == wicMode) {
return true;
}
- if (!this->allocPixelRef(bm, NULL)) {
+ if (!this->allocPixelRef(bm, nullptr)) {
return false;
}
}
@@ -213,7 +213,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
piBitmapSourceOriginal.get() //Input bitmap to convert
, destinationPixelFormat //Destination pixel format
, WICBitmapDitherTypeNone //Specified dither patterm
- , NULL //Specify a particular palette
+ , nullptr //Specify a particular palette
, 0.f //Alpha threshold
, WICBitmapPaletteTypeCustom //Palette translation type
);
@@ -233,7 +233,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
bm->eraseColor(SK_ColorTRANSPARENT);
const UINT stride = (UINT) bm->rowBytes();
hr = piBitmapSourceConverted->CopyPixels(
- NULL, //Get all the pixels
+ nullptr, //Get all the pixels
stride,
stride * height,
reinterpret_cast<BYTE *>(bm->getPixels())
@@ -254,7 +254,7 @@ extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
SkImageDecoder* decoder = image_decoder_from_stream(stream);
- if (NULL == decoder) {
+ if (nullptr == decoder) {
// If no image decoder specific to the stream exists, use SkImageDecoder_WIC.
return new SkImageDecoder_WIC;
} else {
@@ -265,7 +265,7 @@ SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
/////////////////////////////////////////////////////////////////////////
SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////
@@ -345,7 +345,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
if (SUCCEEDED(hr)) {
hr = CoCreateInstance(
CLSID_WICImagingFactory
- , NULL
+ , nullptr
, CLSCTX_INPROC_SERVER
, IID_PPV_ARGS(&piImagingFactory)
);
@@ -360,7 +360,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
//Create an encode of the appropriate type.
SkTScopedComPtr<IWICBitmapEncoder> piEncoder;
if (SUCCEEDED(hr)) {
- hr = piImagingFactory->CreateEncoder(type, NULL, &piEncoder);
+ hr = piImagingFactory->CreateEncoder(type, nullptr, &piEncoder);
}
if (SUCCEEDED(hr)) {
@@ -445,7 +445,7 @@ static SkImageEncoder* sk_imageencoder_wic_factory(SkImageEncoder::Type t) {
case SkImageEncoder::kPNG_Type:
break;
default:
- return NULL;
+ return nullptr;
}
return new SkImageEncoder_WIC(t);
}
@@ -455,7 +455,7 @@ static SkImageEncoder_EncodeReg gEReg(sk_imageencoder_wic_factory);
static SkImageDecoder::Format get_format_wic(SkStreamRewindable* stream) {
SkImageDecoder::Format format;
SkImageDecoder_WIC codec;
- if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICMode, &format)) {
+ if (!codec.decodeStream(stream, nullptr, SkImageDecoder_WIC::kDecodeFormat_WICMode, &format)) {
format = SkImageDecoder::kUnknown_Format;
}
return format;
diff --git a/src/ports/SkImageDecoder_empty.cpp b/src/ports/SkImageDecoder_empty.cpp
index e6cca089bc..d248f14c4d 100644
--- a/src/ports/SkImageDecoder_empty.cpp
+++ b/src/ports/SkImageDecoder_empty.cpp
@@ -22,7 +22,7 @@ SkImageDecoder::SkImageDecoder() {}
SkImageDecoder::~SkImageDecoder() {}
SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable*) {
- return NULL;
+ return nullptr;
}
void SkImageDecoder::copyFieldsToOther(SkImageDecoder* ) {}
@@ -67,15 +67,15 @@ SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable*) {
}
const char* SkImageDecoder::GetFormatName(Format) {
- return NULL;
+ return nullptr;
}
SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker*) {
- return NULL;
+ return nullptr;
}
SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator*) {
- return NULL;
+ return nullptr;
}
void SkImageDecoder::setSampleSize(int) {}
@@ -94,7 +94,7 @@ bool SkImageDecoder::allocPixelRef(SkBitmap*, SkColorTable*) const {
// Empty implementation for SkMovie.
SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
// Empty implementations for SkImageEncoder.
SkImageEncoder* SkImageEncoder::Create(Type t) {
- return NULL;
+ return nullptr;
}
bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap&, Type, int quality) {
@@ -114,7 +114,7 @@ bool SkImageEncoder::EncodeStream(SkWStream*, const SkBitmap&, SkImageEncoder::T
}
SkData* SkImageEncoder::EncodeData(const SkBitmap&, Type, int quality) {
- return NULL;
+ return nullptr;
}
bool SkImageEncoder::encodeStream(SkWStream*, const SkBitmap&, int) {
@@ -122,7 +122,7 @@ bool SkImageEncoder::encodeStream(SkWStream*, const SkBitmap&, int) {
}
SkData* SkImageEncoder::encodeData(const SkBitmap&, int) {
- return NULL;
+ return nullptr;
}
bool SkImageEncoder::encodeFile(const char file[], const SkBitmap& bm, int quality) {
diff --git a/src/ports/SkImageGenerator_none.cpp b/src/ports/SkImageGenerator_none.cpp
index c0126cae79..2dce1c2dc4 100644
--- a/src/ports/SkImageGenerator_none.cpp
+++ b/src/ports/SkImageGenerator_none.cpp
@@ -8,5 +8,5 @@
#include "SkImageGenerator.h"
SkImageGenerator* SkImageGenerator::NewFromEncodedImpl(SkData*) {
- return NULL;
+ return nullptr;
}
diff --git a/src/ports/SkImageGenerator_skia.cpp b/src/ports/SkImageGenerator_skia.cpp
index 2b11651e0b..afcd4b4a92 100644
--- a/src/ports/SkImageGenerator_skia.cpp
+++ b/src/ports/SkImageGenerator_skia.cpp
@@ -28,7 +28,7 @@ protected:
{
return false;
}
- return bm->installPixels(bmi, fMemory, fRowBytes, ctable, NULL, NULL);
+ return bm->installPixels(bmi, fMemory, fRowBytes, ctable, nullptr, nullptr);
}
};
@@ -67,7 +67,7 @@ protected:
SkASSERT(ctableEntries);
SkColorTable* ctable = bm.getColorTable();
- if (NULL == ctable) {
+ if (nullptr == ctable) {
return false;
}
const int count = ctable->count();
@@ -90,15 +90,15 @@ private:
SkImageGenerator* SkImageGenerator::NewFromEncodedImpl(SkData* data) {
SkMemoryStream stream(data->data(), data->size(), false);
SkImageDecoder* decoder = SkImageDecoder::Factory(&stream);
- if (NULL == decoder) {
- return NULL;
+ if (nullptr == decoder) {
+ return nullptr;
}
SkBitmap bm;
stream.rewind();
if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDecodeBounds_Mode)) {
delete decoder;
- return NULL;
+ return nullptr;
}
return new SkImageDecoderGenerator(bm.info(), decoder, data);
diff --git a/src/ports/SkMemory_malloc.cpp b/src/ports/SkMemory_malloc.cpp
index f9836c0e0e..6ad01daca0 100644
--- a/src/ports/SkMemory_malloc.cpp
+++ b/src/ports/SkMemory_malloc.cpp
@@ -19,8 +19,8 @@ static inline void sk_out_of_memory(size_t size) {
}
static inline void* throw_on_failure(size_t size, void* p) {
- if (size > 0 && p == NULL) {
- // If we've got a NULL here, the only reason we should have failed is running out of RAM.
+ if (size > 0 && p == nullptr) {
+ // If we've got a nullptr here, the only reason we should have failed is running out of RAM.
sk_out_of_memory(size);
}
return p;
diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp
index b604c2190c..58662f382f 100644
--- a/src/ports/SkOSFile_posix.cpp
+++ b/src/ports/SkOSFile_posix.cpp
@@ -63,19 +63,19 @@ void sk_fmunmap(const void* addr, size_t length) {
void* sk_fdmmap(int fd, size_t* size) {
struct stat status;
if (0 != fstat(fd, &status)) {
- return NULL;
+ return nullptr;
}
if (!S_ISREG(status.st_mode)) {
- return NULL;
+ return nullptr;
}
if (!SkTFitsIn<size_t>(status.st_size)) {
- return NULL;
+ return nullptr;
}
size_t fileSize = static_cast<size_t>(status.st_size);
- void* addr = mmap(NULL, fileSize, PROT_READ, MAP_PRIVATE, fd, 0);
+ void* addr = mmap(nullptr, fileSize, PROT_READ, MAP_PRIVATE, fd, 0);
if (MAP_FAILED == addr) {
- return NULL;
+ return nullptr;
}
*size = fileSize;
@@ -89,7 +89,7 @@ int sk_fileno(SkFILE* f) {
void* sk_fmmap(SkFILE* f, size_t* size) {
int fd = sk_fileno(f);
if (fd < 0) {
- return NULL;
+ return nullptr;
}
return sk_fdmmap(fd, size);
@@ -149,7 +149,7 @@ bool SkOSFile::Iter::next(SkString* name, bool getDir) {
if (self.fDIR) {
dirent* entry;
- while ((entry = ::readdir(self.fDIR)) != NULL) {
+ while ((entry = ::readdir(self.fDIR)) != nullptr) {
struct stat s;
SkString str(self.fPath);
diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp
index a7d776afb1..5b497d417a 100644
--- a/src/ports/SkOSFile_stdio.cpp
+++ b/src/ports/SkOSFile_stdio.cpp
@@ -70,7 +70,7 @@ bool sk_frewind(SkFILE* f) {
size_t sk_fread(void* buffer, size_t byteCount, SkFILE* f) {
SkASSERT(f);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
size_t curr = ::ftell((FILE*)f);
if ((long)curr == -1) {
SkDEBUGF(("sk_fread: ftell(%p) returned -1 feof:%d ferror:%d\n", f, feof((FILE*)f), ferror((FILE*)f)));
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp
index 64bd516305..14af458a44 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -79,29 +79,29 @@ void sk_fmunmap(const void* addr, size_t) {
void* sk_fdmmap(int fileno, size_t* length) {
HANDLE file = (HANDLE)_get_osfhandle(fileno);
if (INVALID_HANDLE_VALUE == file) {
- return NULL;
+ return nullptr;
}
LARGE_INTEGER fileSize;
if (0 == GetFileSizeEx(file, &fileSize)) {
//TODO: use SK_TRACEHR(GetLastError(), "Could not get file size.") to report.
- return NULL;
+ return nullptr;
}
if (!SkTFitsIn<size_t>(fileSize.QuadPart)) {
- return NULL;
+ return nullptr;
}
- SkAutoWinMMap mmap(CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL));
+ SkAutoWinMMap mmap(CreateFileMapping(file, nullptr, PAGE_READONLY, 0, 0, nullptr));
if (!mmap.isValid()) {
//TODO: use SK_TRACEHR(GetLastError(), "Could not create file mapping.") to report.
- return NULL;
+ return nullptr;
}
// Eventually call UnmapViewOfFile
void* addr = MapViewOfFile(mmap, FILE_MAP_READ, 0, 0, 0);
- if (NULL == addr) {
+ if (nullptr == addr) {
//TODO: use SK_TRACEHR(GetLastError(), "Could not map view of file.") to report.
- return NULL;
+ return nullptr;
}
*length = static_cast<size_t>(fileSize.QuadPart);
@@ -115,7 +115,7 @@ int sk_fileno(SkFILE* f) {
void* sk_fmmap(SkFILE* f, size_t* length) {
int fileno = sk_fileno(f);
if (fileno < 0) {
- return NULL;
+ return nullptr;
}
return sk_fdmmap(fileno, length);
@@ -124,7 +124,7 @@ void* sk_fmmap(SkFILE* f, size_t* length) {
////////////////////////////////////////////////////////////////////////////
struct SkOSFileIterData {
- SkOSFileIterData() : fHandle(0), fPath16(NULL) { }
+ SkOSFileIterData() : fHandle(0), fPath16(nullptr) { }
HANDLE fHandle;
uint16_t* fPath16;
};
@@ -177,7 +177,7 @@ void SkOSFile::Iter::reset(const char path[], const char suffix[]) {
::FindClose(self.fHandle);
self.fHandle = 0;
}
- if (NULL == path) {
+ if (nullptr == path) {
path = "";
}
@@ -193,7 +193,7 @@ static bool is_magic_dir(const uint16_t dir[]) {
static bool get_the_file(HANDLE handle, SkString* name, WIN32_FIND_DATAW* dataPtr, bool getDir) {
WIN32_FIND_DATAW data;
- if (NULL == dataPtr) {
+ if (nullptr == dataPtr) {
if (::FindNextFileW(handle, &data))
dataPtr = &data;
else
@@ -226,10 +226,10 @@ static bool get_the_file(HANDLE handle, SkString* name, WIN32_FIND_DATAW* dataPt
bool SkOSFile::Iter::next(SkString* name, bool getDir) {
SkOSFileIterData& self = *static_cast<SkOSFileIterData*>(fSelf.get());
WIN32_FIND_DATAW data;
- WIN32_FIND_DATAW* dataPtr = NULL;
+ WIN32_FIND_DATAW* dataPtr = nullptr;
if (self.fHandle == 0) { // our first time
- if (self.fPath16 == NULL || *self.fPath16 == 0) { // check for no path
+ if (self.fPath16 == nullptr || *self.fPath16 == 0) { // check for no path
return false;
}
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp
index 2d06255a24..aaef3a40a9 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -34,8 +34,8 @@ private:
explicit DataId(DataId& that)
: fLoader(that.fLoader), fKey(that.fKey), fKeySize(that.fKeySize)
{
- that.fLoader = NULL;
- that.fKey = NULL;
+ that.fLoader = nullptr;
+ that.fKey = nullptr;
SkDEBUGCODE(that.fKeySize = 0xFFFFFFFF;)
}
@@ -116,7 +116,7 @@ public:
HRM(font->CreateFontFace(&fontFace), "Could not create font face.");
UINT32 numFiles;
- HR(fontFace->GetFiles(&numFiles, NULL));
+ HR(fontFace->GetFiles(&numFiles, nullptr));
if (numFiles > 1) {
return E_FAIL;
}
@@ -193,7 +193,7 @@ public:
"Could not match font in family.",
identity);
- HR_GENERAL(FontToIdentity(font.get(), &identity), NULL, identity);
+ HR_GENERAL(FontToIdentity(font.get(), &identity), nullptr, identity);
return identity;
}
@@ -218,12 +218,12 @@ public:
SkRemotableFontIdentitySet* matchName(const char familyName[]) const override {
SkSMallocWCHAR dwFamilyName;
- if (NULL == familyName) {
+ if (nullptr == familyName) {
HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName),
- NULL, SkRemotableFontIdentitySet::NewEmpty());
+ nullptr, SkRemotableFontIdentitySet::NewEmpty());
} else {
HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName),
- NULL, SkRemotableFontIdentitySet::NewEmpty());
+ nullptr, SkRemotableFontIdentitySet::NewEmpty());
}
UINT32 index;
@@ -244,10 +244,10 @@ public:
SkFontIdentity identity = { SkFontIdentity::kInvalidDataId };
SkSMallocWCHAR dwFamilyName;
- if (NULL == familyName) {
- HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName), NULL, identity);
+ if (nullptr == familyName) {
+ HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName), nullptr, identity);
} else {
- HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), NULL, identity);
+ HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), nullptr, identity);
}
UINT32 index;
@@ -374,7 +374,7 @@ public:
this->AddRef();
return S_OK;
}
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_FAIL;
}
@@ -395,7 +395,7 @@ public:
SkFontIdentity identity = { SkFontIdentity::kInvalidDataId };
IDWriteFactory* dwFactory = sk_get_dwrite_factory();
- if (NULL == dwFactory) {
+ if (nullptr == dwFactory) {
return identity;
}
@@ -404,10 +404,10 @@ public:
const DWriteStyle dwStyle(pattern);
SkSMallocWCHAR dwFamilyName;
- if (NULL == familyName) {
- HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName), NULL, identity);
+ if (nullptr == familyName) {
+ HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName), nullptr, identity);
} else {
- HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), NULL, identity);
+ HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), nullptr, identity);
}
const SkSMallocWCHAR* dwBcp47;
@@ -416,7 +416,7 @@ public:
dwBcp47 = &fLocaleName;
} else {
//TODO: support fallback stack.
- HR_GENERAL(sk_cstring_to_wchar(bcp47[bcp47Count-1], &dwBcp47Local), NULL, identity);
+ HR_GENERAL(sk_cstring_to_wchar(bcp47[bcp47Count-1], &dwBcp47Local), nullptr, identity);
dwBcp47 = &dwBcp47Local;
}
@@ -445,7 +445,7 @@ public:
SkTScopedComPtr<FontFallbackRenderer> fontFallbackRenderer(
new FontFallbackRenderer(this, character));
- HR_GENERAL(fallbackLayout->Draw(NULL, fontFallbackRenderer.get(), 50.0f, 50.0f),
+ HR_GENERAL(fallbackLayout->Draw(nullptr, fontFallbackRenderer.get(), 50.0f, 50.0f),
"Could not draw layout with renderer.",
identity);
@@ -455,7 +455,7 @@ public:
SkStreamAsset* getData(int dataId) const override {
SkAutoMutexAcquire ama(fDataIdCacheMutex);
if (dataId >= fDataIdCache.count()) {
- return NULL;
+ return nullptr;
}
const DataId& id = fDataIdCache[dataId];
@@ -478,8 +478,8 @@ private:
SkRemotableFontMgr* SkRemotableFontMgr_New_DirectWrite() {
IDWriteFactory* factory = sk_get_dwrite_factory();
- if (NULL == factory) {
- return NULL;
+ if (nullptr == factory) {
+ return nullptr;
}
SkTScopedComPtr<IDWriteFontCollection> sysFontCollection;
@@ -487,13 +487,13 @@ SkRemotableFontMgr* SkRemotableFontMgr_New_DirectWrite() {
"Could not get system font collection.");
WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
- WCHAR* localeName = NULL;
+ WCHAR* localeName = nullptr;
int localeNameLen = 0;
// Dynamically load GetUserDefaultLocaleName function, as it is not available on XP.
- SkGetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = NULL;
+ SkGetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = nullptr;
HRESULT hr = SkGetGetUserDefaultLocaleNameProc(&getUserDefaultLocaleNameProc);
- if (NULL == getUserDefaultLocaleNameProc) {
+ if (nullptr == getUserDefaultLocaleNameProc) {
SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName.");
} else {
localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_NAME_MAX_LENGTH);
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 7bfa1d420d..e259479fcb 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -467,7 +467,7 @@ void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) {
}
void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
- if (NULL == metrics) {
+ if (nullptr == metrics) {
return;
}
@@ -734,8 +734,8 @@ void SkScalerContext_DW::generatePath(const SkGlyph& glyph, SkPath* path) {
//It may not be needed, it appears that DirectWrite only hints at em size.
HRVM(fTypeface->fDWriteFontFace->GetGlyphRunOutline(SkScalarToFloat(fTextSizeRender),
&glyphId,
- NULL, //advances
- NULL, //offsets
+ nullptr, //advances
+ nullptr, //offsets
1, //num glyphs
FALSE, //sideways
FALSE, //rtl
diff --git a/src/ports/SkTLS_none.cpp b/src/ports/SkTLS_none.cpp
index 95f6e37037..d655560c22 100644
--- a/src/ports/SkTLS_none.cpp
+++ b/src/ports/SkTLS_none.cpp
@@ -7,7 +7,7 @@
#include "SkTLS.h"
-static void* gSpecific = NULL;
+static void* gSpecific = nullptr;
void* SkTLS::PlatformGetSpecific(bool) {
return gSpecific;
diff --git a/src/ports/SkTLS_pthread.cpp b/src/ports/SkTLS_pthread.cpp
index 4264890217..ac558a8196 100644
--- a/src/ports/SkTLS_pthread.cpp
+++ b/src/ports/SkTLS_pthread.cpp
@@ -18,7 +18,7 @@ static void sk_tls_make_key() {
void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) {
// should we use forceCreateTheSlot to potentially skip calling pthread_once
- // and just return NULL if we've never been called with
+ // and just return nullptr if we've never been called with
// forceCreateTheSlot==true ?
(void)pthread_once(&gSkTLSKey_Once, sk_tls_make_key);
diff --git a/src/ports/SkTLS_win.cpp b/src/ports/SkTLS_win.cpp
index c6f3dfc638..cdfb465a7e 100644
--- a/src/ports/SkTLS_win.cpp
+++ b/src/ports/SkTLS_win.cpp
@@ -14,7 +14,7 @@ SK_DECLARE_STATIC_MUTEX(gMutex);
void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) {
if (!forceCreateTheSlot && !gOnce) {
- return NULL;
+ return nullptr;
}
if (!gOnce) {
@@ -49,9 +49,9 @@ void SkTLS::PlatformSetSpecific(void* ptr) {
void NTAPI onTLSCallback(PVOID unused, DWORD reason, PVOID unused2) {
if ((DLL_THREAD_DETACH == reason || DLL_PROCESS_DETACH == reason) && gOnce) {
void* ptr = TlsGetValue(gTlsIndex);
- if (ptr != NULL) {
+ if (ptr != nullptr) {
SkTLS::Destructor(ptr);
- TlsSetValue(gTlsIndex, NULL);
+ TlsSetValue(gTlsIndex, nullptr);
}
}
}
diff --git a/src/ports/SkTime_Unix.cpp b/src/ports/SkTime_Unix.cpp
index 84f1a4e374..ec96bb8a90 100644
--- a/src/ports/SkTime_Unix.cpp
+++ b/src/ports/SkTime_Unix.cpp
@@ -38,6 +38,6 @@ void SkTime::GetDateTime(DateTime* dt)
SkMSec SkTime::GetMSecs()
{
struct timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
return (SkMSec) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds
}
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 3af4cca4b2..144d4c7367 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -30,7 +30,7 @@ void DWriteFontTypeface::onGetFamilyName(SkString* familyName) const {
SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
HRV(fDWriteFontFamily->GetFamilyNames(&familyNames));
- sk_get_locale_string(familyNames.get(), NULL/*fMgr->fLocaleName.get()*/, familyName);
+ sk_get_locale_string(familyNames.get(), nullptr/*fMgr->fLocaleName.get()*/, familyName);
}
void DWriteFontTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
@@ -40,7 +40,7 @@ void DWriteFontTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
HRV(fDWriteFontFamily->GetFamilyNames(&familyNames));
SkString utf8FamilyName;
- sk_get_locale_string(familyNames.get(), NULL/*fMgr->fLocaleName.get()*/, &utf8FamilyName);
+ sk_get_locale_string(familyNames.get(), nullptr/*fMgr->fLocaleName.get()*/, &utf8FamilyName);
desc->setFamilyName(utf8FamilyName.c_str());
*isLocalStream = SkToBool(fDWriteFontFileLoader.get());
@@ -74,7 +74,7 @@ static EncodingProc find_encoding_proc(SkTypeface::Encoding enc) {
int DWriteFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
uint16_t glyphs[], int glyphCount) const
{
- if (NULL == glyphs) {
+ if (nullptr == glyphs) {
EncodingProc next_ucs4_proc = find_encoding_proc(encoding);
for (int i = 0; i < glyphCount; ++i) {
const SkUnichar c = next_ucs4_proc(&chars);
@@ -172,7 +172,7 @@ private:
SkTypeface::LocalizedStrings* DWriteFontTypeface::onCreateFamilyNameIterator() const {
SkTypeface::LocalizedStrings* nameIter =
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this);
- if (NULL == nameIter) {
+ if (nullptr == nameIter) {
SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
HRNM(fDWriteFontFamily->GetFamilyNames(&familyNames), "Could not obtain family names.");
nameIter = new LocalizedStrings_IDWriteLocalizedStrings(familyNames.release());
@@ -217,10 +217,10 @@ SkStreamAsset* DWriteFontTypeface::onOpenStream(int* ttcIndex) const {
*ttcIndex = fDWriteFontFace->GetIndex();
UINT32 numFiles;
- HRNM(fDWriteFontFace->GetFiles(&numFiles, NULL),
+ HRNM(fDWriteFontFace->GetFiles(&numFiles, nullptr),
"Could not get number of font files.");
if (numFiles != 1) {
- return NULL;
+ return nullptr;
}
SkTScopedComPtr<IDWriteFontFile> fontFile;
@@ -265,7 +265,7 @@ void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const {
#if SK_FONT_HOST_USE_SYSTEM_SETTINGS
IDWriteFactory* factory = get_dwrite_factory();
- if (factory != NULL) {
+ if (factory != nullptr) {
SkTScopedComPtr<IDWriteRenderingParams> defaultRenderingParams;
if (SUCCEEDED(factory->CreateRenderingParams(&defaultRenderingParams))) {
float gamma = defaultRenderingParams->GetGamma();
@@ -332,7 +332,7 @@ SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
const uint32_t* glyphIDs,
uint32_t glyphIDsCount) const {
- SkAdvancedTypefaceMetrics* info = NULL;
+ SkAdvancedTypefaceMetrics* info = nullptr;
HRESULT hr = S_OK;
diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h
index 866e634d78..3d6fce0a32 100644
--- a/src/ports/SkTypeface_win_dw.h
+++ b/src/ports/SkTypeface_win_dw.h
@@ -41,8 +41,8 @@ private:
IDWriteFontFace* fontFace,
IDWriteFont* font,
IDWriteFontFamily* fontFamily,
- IDWriteFontFileLoader* fontFileLoader = NULL,
- IDWriteFontCollectionLoader* fontCollectionLoader = NULL)
+ IDWriteFontFileLoader* fontFileLoader = nullptr,
+ IDWriteFontCollectionLoader* fontCollectionLoader = nullptr)
: SkTypeface(style, fontID, false)
, fFactory(SkRefComPtr(factory))
, fDWriteFontCollectionLoader(SkSafeRefComPtr(fontCollectionLoader))
@@ -53,9 +53,9 @@ private:
{
#if SK_HAS_DWRITE_1_H
if (!SUCCEEDED(fDWriteFontFace->QueryInterface(&fDWriteFontFace1))) {
- // IUnknown::QueryInterface states that if it fails, punk will be set to NULL.
+ // IUnknown::QueryInterface states that if it fails, punk will be set to nullptr.
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
- SK_ALWAYSBREAK(NULL == fDWriteFontFace1.get());
+ SK_ALWAYSBREAK(nullptr == fDWriteFontFace1.get());
}
#endif
}
@@ -75,8 +75,8 @@ public:
IDWriteFontFace* fontFace,
IDWriteFont* font,
IDWriteFontFamily* fontFamily,
- IDWriteFontFileLoader* fontFileLoader = NULL,
- IDWriteFontCollectionLoader* fontCollectionLoader = NULL) {
+ IDWriteFontFileLoader* fontFileLoader = nullptr,
+ IDWriteFontCollectionLoader* fontCollectionLoader = nullptr) {
SkFontID fontID = SkTypefaceCache::NewFontID();
return new DWriteFontTypeface(get_style(font), fontID, factory, fontFace, font, fontFamily,
fontFileLoader, fontCollectionLoader);
diff --git a/src/sfnt/SkOTTable_name.cpp b/src/sfnt/SkOTTable_name.cpp
index 897b2358f2..4e26759cdc 100644
--- a/src/sfnt/SkOTTable_name.cpp
+++ b/src/sfnt/SkOTTable_name.cpp
@@ -31,7 +31,7 @@ static SkUnichar SkUTF16BE_NextUnichar(const uint16_t** srcPtr) {
}
static void SkStringFromUTF16BE(const uint16_t* utf16be, size_t length, SkString& utf8) {
- SkASSERT(utf16be != NULL);
+ SkASSERT(utf16be != nullptr);
utf8.reset();
size_t numberOf16BitValues = length / 2;
diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp
index fb82182130..52d996fbc5 100644
--- a/src/sfnt/SkOTUtils.cpp
+++ b/src/sfnt/SkOTUtils.cpp
@@ -38,7 +38,7 @@ SkData* SkOTUtils::RenameFont(SkStreamAsset* fontData, const char* fontName, int
// Get the sfnt header.
SkSFNTHeader sfntHeader;
if (fontData->read(&sfntHeader, sizeof(sfntHeader)) < sizeof(sfntHeader)) {
- return NULL;
+ return nullptr;
}
// Find the existing 'name' table.
@@ -47,18 +47,18 @@ SkData* SkOTUtils::RenameFont(SkStreamAsset* fontData, const char* fontName, int
int numTables = SkEndian_SwapBE16(sfntHeader.numTables);
for (tableIndex = 0; tableIndex < numTables; ++tableIndex) {
if (fontData->read(&tableEntry, sizeof(tableEntry)) < sizeof(tableEntry)) {
- return NULL;
+ return nullptr;
}
if (SkOTTableName::TAG == tableEntry.tag) {
break;
}
}
if (tableIndex == numTables) {
- return NULL;
+ return nullptr;
}
if (!fontData->rewind()) {
- return NULL;
+ return nullptr;
}
// The required 'name' record types: Family, Style, Unique, Full and PostScript.
@@ -87,19 +87,19 @@ SkData* SkOTUtils::RenameFont(SkStreamAsset* fontData, const char* fontName, int
SK_OT_BYTE* data = static_cast<SK_OT_BYTE*>(rewrittenFontData->writable_data());
if (fontData->read(data, oldNameTableOffset) < oldNameTableOffset) {
- return NULL;
+ return nullptr;
}
if (fontData->skip(oldNameTablePhysicalSize) < oldNameTablePhysicalSize) {
- return NULL;
+ return nullptr;
}
if (fontData->read(data + oldNameTableOffset, originalDataSize - oldNameTableOffset) < originalDataSize - oldNameTableOffset) {
- return NULL;
+ return nullptr;
}
//Fix up the offsets of the directory entries after the old 'name' table entry.
SkSFNTHeader::TableDirectoryEntry* currentEntry = reinterpret_cast<SkSFNTHeader::TableDirectoryEntry*>(data + sizeof(SkSFNTHeader));
SkSFNTHeader::TableDirectoryEntry* endEntry = currentEntry + numTables;
- SkSFNTHeader::TableDirectoryEntry* headTableEntry = NULL;
+ SkSFNTHeader::TableDirectoryEntry* headTableEntry = nullptr;
for (; currentEntry < endEntry; ++currentEntry) {
uint32_t oldOffset = SkEndian_SwapBE32(currentEntry->offset);
if (oldOffset > oldNameTableOffset) {
@@ -166,12 +166,12 @@ SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(const SkTypeface& ty
static const SkFontTableTag nameTag = SkSetFourByteTag('n','a','m','e');
size_t nameTableSize = typeface.getTableSize(nameTag);
if (0 == nameTableSize) {
- return NULL;
+ return nullptr;
}
SkAutoTDeleteArray<uint8_t> nameTableData(new uint8_t[nameTableSize]);
size_t copied = typeface.getTableData(nameTag, 0, nameTableSize, nameTableData.get());
if (copied != nameTableSize) {
- return NULL;
+ return nullptr;
}
return new SkOTUtils::LocalizedStrings_NameTable((SkOTTableName*)nameTableData.detach(),
diff --git a/src/sfnt/SkOTUtils.h b/src/sfnt/SkOTUtils.h
index e1db048b18..1773e69ab6 100644
--- a/src/sfnt/SkOTUtils.h
+++ b/src/sfnt/SkOTUtils.h
@@ -23,7 +23,7 @@ struct SkOTUtils {
/**
* Renames an sfnt font. On failure (invalid data or not an sfnt font)
- * returns NULL.
+ * returns nullptr.
*
* Essentially, this removes any existing 'name' table and replaces it
* with a new one in which FontFamilyName, FontSubfamilyName,
@@ -50,7 +50,7 @@ struct SkOTUtils {
{ }
/** Creates an iterator over all the family names in the 'name' table of a typeface.
- * If no valid 'name' table can be found, returns NULL.
+ * If no valid 'name' table can be found, returns nullptr.
*/
static LocalizedStrings_NameTable* CreateForFamilyNames(const SkTypeface& typeface);
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index a3f8af747e..4c679dfee7 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -38,7 +38,7 @@ static SkScalar svg_opacity(SkColor color) {
// Keep in sync with SkPaint::Cap
static const char* cap_map[] = {
- NULL, // kButt_Cap (default)
+ nullptr, // kButt_Cap (default)
"round", // kRound_Cap
"square" // kSquare_Cap
};
@@ -51,7 +51,7 @@ static const char* svg_cap(SkPaint::Cap cap) {
// Keep in sync with SkPaint::Join
static const char* join_map[] = {
- NULL, // kMiter_Join (default)
+ nullptr, // kMiter_Join (default)
"round", // kRound_Join
"bevel" // kBevel_Join
};
@@ -64,7 +64,7 @@ static const char* svg_join(SkPaint::Join join) {
// Keep in sync with SkPaint::Align
static const char* text_align_map[] = {
- NULL, // kLeft_Align (default)
+ nullptr, // kLeft_Align (default)
"middle", // kCenter_Align
"end" // kRight_Align
};
@@ -115,7 +115,7 @@ struct Resources {
class SVGTextBuilder : SkNoncopyable {
public:
SVGTextBuilder(const void* text, size_t byteLen, const SkPaint& paint, const SkPoint& offset,
- unsigned scalarsPerPos, const SkScalar pos[] = NULL)
+ unsigned scalarsPerPos, const SkScalar pos[] = nullptr)
: fOffset(offset)
, fScalarsPerPos(scalarsPerPos)
, fPos(pos)
@@ -277,7 +277,7 @@ class SkSVGDevice::AutoElement : ::SkNoncopyable {
public:
AutoElement(const char name[], SkXMLWriter* writer)
: fWriter(writer)
- , fResourceBucket(NULL) {
+ , fResourceBucket(nullptr) {
fWriter->startElement(name);
}
@@ -563,7 +563,7 @@ void SkSVGDevice::AutoElement::addTextAttributes(const SkPaint& paint) {
SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkXMLWriter* writer) {
if (!writer) {
- return NULL;
+ return nullptr;
}
return new SkSVGDevice(size, writer);
@@ -670,7 +670,7 @@ void SkSVGDevice::drawBitmapCommon(const SkDraw& draw, const SkBitmap& bm,
return;
}
- size_t b64Size = SkBase64::Encode(pngData->data(), pngData->size(), NULL);
+ size_t b64Size = SkBase64::Encode(pngData->data(), pngData->size(), nullptr);
SkAutoTMalloc<char> b64Data(b64Size);
SkBase64::Encode(pngData->data(), pngData->size(), b64Data.get());
diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h
index 31e231d926..8426ad5e10 100644
--- a/src/svg/SkSVGDevice.h
+++ b/src/svg/SkSVGDevice.h
@@ -27,7 +27,7 @@ protected:
void drawRRect(const SkDraw&, const SkRRect& rr, const SkPaint& paint) override;
void drawPath(const SkDraw&, const SkPath& path,
const SkPaint& paint,
- const SkMatrix* prePathMatrix = NULL,
+ const SkMatrix* prePathMatrix = nullptr,
bool pathIsMutable = false) override;
void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
diff --git a/src/svg/parser/SkSVGClipPath.cpp b/src/svg/parser/SkSVGClipPath.cpp
index fa3a79918d..86dc2df7f1 100644
--- a/src/svg/parser/SkSVGClipPath.cpp
+++ b/src/svg/parser/SkSVGClipPath.cpp
@@ -28,7 +28,7 @@ void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) {
SkSVGElement* child = *fChildren.begin();
SkASSERT(child->getType() == SkSVGType_Use);
SkSVGUse* use = (SkSVGUse*) child;
- SkSVGElement* ref = NULL;
+ SkSVGElement* ref = nullptr;
const char* refStr = &use->f_xlink_href.c_str()[1];
SkASSERT(parser.getIDs().find(refStr, &ref));
SkASSERT(ref);
diff --git a/src/svg/parser/SkSVGElements.cpp b/src/svg/parser/SkSVGElements.cpp
index a1bd100571..dc8ec940c5 100644
--- a/src/svg/parser/SkSVGElements.cpp
+++ b/src/svg/parser/SkSVGElements.cpp
@@ -21,14 +21,14 @@ void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
}
-SkSVGElement::SkSVGElement() : fParent(NULL), fIsDef(false), fIsNotDef(true) {
+SkSVGElement::SkSVGElement() : fParent(nullptr), fIsDef(false), fIsNotDef(true) {
}
SkSVGElement::~SkSVGElement() {
}
SkSVGElement* SkSVGElement::getGradient() {
- return NULL;
+ return nullptr;
}
bool SkSVGElement::isGroupParent() {
diff --git a/src/svg/parser/SkSVGGradient.cpp b/src/svg/parser/SkSVGGradient.cpp
index bbcca18f39..0f7c6bab7e 100644
--- a/src/svg/parser/SkSVGGradient.cpp
+++ b/src/svg/parser/SkSVGGradient.cpp
@@ -33,7 +33,7 @@ void SkSVGGradient::translate(SkSVGParser& parser, bool defState) {
bool addedFirst = false;
bool addedLast = false;
SkString offsets("[");
- SkString* lastOffset = NULL;
+ SkString* lastOffset = nullptr;
for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkASSERT((*ptr)->getType() == SkSVGType_Stop);
SkSVGStop* stop = (SkSVGStop*) *ptr;
diff --git a/src/svg/parser/SkSVGGroup.cpp b/src/svg/parser/SkSVGGroup.cpp
index 420179d871..cbd8c4ea71 100644
--- a/src/svg/parser/SkSVGGroup.cpp
+++ b/src/svg/parser/SkSVGGroup.cpp
@@ -17,10 +17,10 @@ SkSVGGroup::SkSVGGroup() {
SkSVGElement* SkSVGGroup::getGradient() {
for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkSVGElement* result = (*ptr)->getGradient();
- if (result != NULL)
+ if (result != nullptr)
return result;
}
- return NULL;
+ return nullptr;
}
bool SkSVGGroup::isDef() {
diff --git a/src/svg/parser/SkSVGPaintState.cpp b/src/svg/parser/SkSVGPaintState.cpp
index 5db624d02e..df8ba2823f 100644
--- a/src/svg/parser/SkSVGPaintState.cpp
+++ b/src/svg/parser/SkSVGPaintState.cpp
@@ -38,7 +38,7 @@ SkSVGAttribute SkSVGPaint::gAttributes[] = {
const int SkSVGPaint::kAttributesSize = SK_ARRAY_COUNT(SkSVGPaint::gAttributes);
-SkSVGPaint::SkSVGPaint() : fNext(NULL) {
+SkSVGPaint::SkSVGPaint() : fNext(nullptr) {
}
SkString* SkSVGPaint::operator[](int index) {
@@ -81,7 +81,7 @@ void SkSVGPaint::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrEnd = attrValue + attrLength;
do {
const char* end = strchr(attrValue, ';');
- if (end == NULL)
+ if (end == nullptr)
end = attrEnd;
const char* delimiter = strchr(attrValue, ':');
SkASSERT(delimiter != 0 && delimiter < end);
@@ -102,7 +102,7 @@ bool SkSVGPaint::flush(SkSVGParser& parser, bool isFlushable, bool isDef) {
SkSVGPaint current;
SkSVGPaint* walking = parser.fHead;
int index;
- while (walking != NULL) {
+ while (walking != nullptr) {
for (index = kInitial + 1; index < kTerminal; index++) {
SkString* lastAttr = (*walking)[index];
if (lastAttr->size() == 0)
@@ -195,7 +195,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
int index;
SkMatrix sum;
sum.reset();
- while (walking != NULL) {
+ while (walking != nullptr) {
for (index = kInitial + 1; index < kTerminal; index++) {
SkString* lastAttr = (*walking)[index];
if (lastAttr->size() == 0)
@@ -205,7 +205,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
SkASSERT(strncmp(str, "matrix(", 7) == 0);
str += 6;
const char* strEnd = strrchr(str, ')');
- SkASSERT(strEnd != NULL);
+ SkASSERT(strEnd != nullptr);
SkString mat(str, strEnd - str);
SkSVGParser::ConvertToArray(mat);
SkScalar values[6];
diff --git a/src/svg/parser/SkSVGParser.cpp b/src/svg/parser/SkSVGParser.cpp
index 74ea0236e0..854716b6c5 100644
--- a/src/svg/parser/SkSVGParser.cpp
+++ b/src/svg/parser/SkSVGParser.cpp
@@ -38,14 +38,14 @@ static int gGeneratedMatrixID = 0;
SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
SkXMLParser(errHandler),
fHead(&fEmptyPaint), fIDs(256),
- fXMLWriter(&fStream), fCurrElement(NULL), fInSVG(false), fSuppressPaint(false) {
+ fXMLWriter(&fStream), fCurrElement(nullptr), fInSVG(false), fSuppressPaint(false) {
fLastTransform.reset();
fEmptyPaint.f_fill.set("black");
fEmptyPaint.f_stroke.set("none");
fEmptyPaint.f_strokeMiterlimit.set("4");
fEmptyPaint.f_fillRule.set("winding");
fEmptyPaint.f_opacity.set("1");
- fEmptyPaint.fNext = NULL;
+ fEmptyPaint.fNext = nullptr;
for (int index = SkSVGPaint::kInitial + 1; index < SkSVGPaint::kTerminal; index++) {
SkString* initial = fEmptyPaint[index];
if (initial->size() == 0)
@@ -129,7 +129,7 @@ bool SkSVGParser::isStrokeAndFill( SkSVGPaint** strokeState, SkSVGPaint** fillS
bool fill = false;
bool strokeSet = false;
bool fillSet = false;
- while (walking != NULL) {
+ while (walking != nullptr) {
if (strokeSet == false && walking->f_stroke.size() > 0) {
stroke = walking->f_stroke.equals("none") == false;
*strokeState = walking;
@@ -150,7 +150,7 @@ bool SkSVGParser::onAddAttribute(const char name[], const char value[]) {
}
bool SkSVGParser::onAddAttributeLen(const char name[], const char value[], size_t len) {
- if (fCurrElement == NULL) // this signals we should ignore attributes for this element
+ if (fCurrElement == nullptr) // this signals we should ignore attributes for this element
return true;
if (fCurrElement->fIsDef == false && fCurrElement->fIsNotDef == false)
return false; // also an ignored element
@@ -202,7 +202,7 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
type = SkSVGType_G;
// return true;
}
- SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
+ SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : nullptr;
SkSVGElement* element = CreateElement(type, parent);
bool result = false;
if (parent) {
@@ -237,7 +237,7 @@ void SkSVGParser::translate(SkSVGElement* element, bool isDef) {
(element->fIsDef == false && isDef && element->fIsNotDef)) {
isFlushable = false;
}
- SkSVGPaint* strokeState = NULL, * fillState = NULL;
+ SkSVGPaint* strokeState = nullptr, * fillState = nullptr;
if (isFlushable)
element->fPaintState.setSave(*this);
if (isFlushable && isStrokeAndFill(&strokeState, &fillState)) {
@@ -288,7 +288,7 @@ void SkSVGParser::translateMatrix(SkString& string, SkString* stringID) {
SkASSERT(strncmp(str, "matrix(", 7) == 0);
str += 6;
const char* strEnd = strrchr(str, ')');
- SkASSERT(strEnd != NULL);
+ SkASSERT(strEnd != nullptr);
SkString mat(str, strEnd - str);
ConvertToArray(mat);
const char* elems[6];
@@ -305,7 +305,7 @@ void SkSVGParser::translateMatrix(SkString& string, SkString* stringID) {
string.reset();
for (int index = 0; index < 6; index++) {
const char* end = strchr(elems[index], ',');
- if (end == NULL)
+ if (end == nullptr)
end= strchr(elems[index], ']');
string.append(elems[index], end - elems[index] + 1);
}
@@ -356,7 +356,7 @@ undoLastComma:
#define CASE_NEW(type) case SkSVGType_##type : created = new SkSVG##type(); break
SkSVGElement* SkSVGParser::CreateElement(SkSVGTypes type, SkSVGElement* parent) {
- SkSVGElement* created = NULL;
+ SkSVGElement* created = nullptr;
switch (type) {
CASE_NEW(Circle);
CASE_NEW(ClipPath);
@@ -383,7 +383,7 @@ SkSVGElement* SkSVGParser::CreateElement(SkSVGTypes type, SkSVGElement* parent)
CASE_NEW(Use);
default:
SkASSERT(0);
- return NULL;
+ return nullptr;
}
created->fParent = parent;
bool isDef = created->fIsDef = created->isDef();
diff --git a/src/svg/parser/SkSVGPath.cpp b/src/svg/parser/SkSVGPath.cpp
index ab18a65a7b..c9917c7b52 100644
--- a/src/svg/parser/SkSVGPath.cpp
+++ b/src/svg/parser/SkSVGPath.cpp
@@ -21,7 +21,7 @@ void SkSVGPath::translate(SkSVGParser& parser, bool defState) {
INHERITED::translate(parser, defState);
bool hasMultiplePaths = false;
const char* firstZ = strchr(f_d.c_str(), 'z');
- if (firstZ != NULL) {
+ if (firstZ != nullptr) {
firstZ++; // skip over 'z'
while (*firstZ == ' ')
firstZ++;
diff --git a/src/utils/SkBase64.cpp b/src/utils/SkBase64.cpp
index 545a8ebb21..4c3078f255 100644
--- a/src/utils/SkBase64.cpp
+++ b/src/utils/SkBase64.cpp
@@ -26,7 +26,7 @@ static const signed char decodeData[] = {
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
};
-SkBase64::SkBase64() : fLength((size_t) -1), fData(NULL) {
+SkBase64::SkBase64() : fLength((size_t) -1), fData(nullptr) {
}
#if defined _WIN32 && _MSC_VER >= 1300 // disable 'two', etc. may be used without having been initialized
@@ -111,7 +111,7 @@ goHome:
size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr, const char* encodeMap) {
const char* encode;
- if (NULL == encodeMap) {
+ if (nullptr == encodeMap) {
encode = default_encode;
} else {
encode = encodeMap;
diff --git a/src/utils/SkBase64.h b/src/utils/SkBase64.h
index ba66dd2f47..13350b7b68 100644
--- a/src/utils/SkBase64.h
+++ b/src/utils/SkBase64.h
@@ -26,7 +26,7 @@ public:
encode[64] will be used as the pad character. Encodings other than the
default encoding cannot be decoded.
*/
- static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL);
+ static size_t Encode(const void* src, size_t length, void* dest, const char* encode = nullptr);
private:
Error decode(const void* srcPtr, size_t length, bool writeDestination);
diff --git a/src/utils/SkBitSet.cpp b/src/utils/SkBitSet.cpp
index 63d18ff2f3..3ace15de80 100755
--- a/src/utils/SkBitSet.cpp
+++ b/src/utils/SkBitSet.cpp
@@ -10,7 +10,7 @@
#include "SkBitSet.h"
SkBitSet::SkBitSet(int numberOfBits)
- : fBitData(NULL), fDwordCount(0), fBitCount(numberOfBits) {
+ : fBitData(nullptr), fDwordCount(0), fBitCount(numberOfBits) {
SkASSERT(numberOfBits > 0);
// Round up size to 32-bit boundary.
fDwordCount = (numberOfBits + 31) / 32;
@@ -18,7 +18,7 @@ SkBitSet::SkBitSet(int numberOfBits)
}
SkBitSet::SkBitSet(const SkBitSet& source)
- : fBitData(NULL), fDwordCount(0), fBitCount(0) {
+ : fBitData(nullptr), fDwordCount(0), fBitCount(0) {
*this = source;
}
@@ -36,7 +36,7 @@ SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) {
bool SkBitSet::operator==(const SkBitSet& rhs) {
if (fBitCount == rhs.fBitCount) {
- if (fBitData.get() != NULL) {
+ if (fBitData.get() != nullptr) {
return (memcmp(fBitData.get(), rhs.fBitData.get(),
fDwordCount * sizeof(uint32_t)) == 0);
}
@@ -50,7 +50,7 @@ bool SkBitSet::operator!=(const SkBitSet& rhs) {
}
void SkBitSet::clearAll() {
- if (fBitData.get() != NULL) {
+ if (fBitData.get() != nullptr) {
sk_bzero(fBitData.get(), fDwordCount * sizeof(uint32_t));
}
}
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
index e5fcc4051b..7ef11ee245 100644
--- a/src/utils/SkBoundaryPatch.cpp
+++ b/src/utils/SkBoundaryPatch.cpp
@@ -7,7 +7,7 @@
*/
#include "SkBoundaryPatch.h"
-SkBoundaryPatch::SkBoundaryPatch() : fBoundary(NULL) {}
+SkBoundaryPatch::SkBoundaryPatch() : fBoundary(nullptr) {}
SkBoundaryPatch::~SkBoundaryPatch() {
SkSafeUnref(fBoundary);
@@ -74,6 +74,6 @@ SkPoint SkCubicBoundary::eval(Edge e, SkScalar t) {
fPts[12] = fPts[0];
SkPoint loc;
- SkEvalCubicAt(&fPts[e * 3], t, &loc, NULL, NULL);
+ SkEvalCubicAt(&fPts[e * 3], t, &loc, nullptr, nullptr);
return loc;
}
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index c7389cefeb..c8c462a5f7 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -74,7 +74,7 @@ void SkPatch3D::reset() {
}
void SkPatch3D::transform(const SkMatrix3D& m, SkPatch3D* dst) const {
- if (dst == NULL) {
+ if (dst == nullptr) {
dst = (SkPatch3D*)this;
}
m.mapVector(fU, &dst->fU);
@@ -356,7 +356,7 @@ SkScalar Sk3DView::dotWithNormal(SkScalar x, SkScalar y, SkScalar z) const {
}
void Sk3DView::getMatrix(SkMatrix* matrix) const {
- if (matrix != NULL) {
+ if (matrix != nullptr) {
SkPatch3D patch;
patch.transform(fRec->fMatrix);
fCamera.patchToMatrix(patch, matrix);
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 8ab853dbf3..8b7a10a124 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -104,9 +104,9 @@ public:
: INHERITED(kVersion, canvas)
{
layerCount = 0;
- layers = NULL;
+ layers = nullptr;
mcState.clipRectCount = 0;
- mcState.clipRects = NULL;
+ mcState.clipRects = nullptr;
originalCanvas = SkRef(canvas);
}
@@ -203,7 +203,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
if (validator.failed()) {
SkErrorInternals::SetError(kInvalidOperation_SkError,
"CaptureCanvasState does not support canvases with antialiased clips.\n");
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkCanvasState_v1> canvasState(new SkCanvasState_v1(canvas));
@@ -226,7 +226,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
// we currently only work for bitmap backed devices
SkPixmap pmap;
if (!layer.device()->accessPixels(&pmap) || 0 == pmap.width() || 0 == pmap.height()) {
- return NULL;
+ return nullptr;
}
SkCanvasLayerState* layerState =
@@ -245,7 +245,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
layerState->raster.config = kRGB_565_RasterConfig;
break;
default:
- return NULL;
+ return nullptr;
}
layerState->raster.rowBytes = pmap.rowBytes();
layerState->raster.pixels = pmap.writable_addr();
@@ -301,7 +301,7 @@ static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layer
kUnknown_SkColorType;
if (colorType == kUnknown_SkColorType) {
- return NULL;
+ return nullptr;
}
bitmap.installPixels(SkImageInfo::Make(layerState.width, layerState.height,
@@ -327,7 +327,7 @@ SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state)
const SkCanvasState_v1* state_v1 = static_cast<const SkCanvasState_v1*>(state);
if (state_v1->layerCount < 1) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkCanvasStack> canvas(new SkCanvasStack(state->width, state->height));
@@ -339,7 +339,7 @@ SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state)
for (int i = state_v1->layerCount - 1; i >= 0; --i) {
SkAutoTUnref<SkCanvas> canvasLayer(create_canvas_from_canvas_layer(state_v1->layers[i]));
if (!canvasLayer.get()) {
- return NULL;
+ return nullptr;
}
canvas->pushCanvas(canvasLayer.get(), SkIPoint::Make(state_v1->layers[i].x,
state_v1->layers[i].y));
diff --git a/src/utils/SkCullPoints.cpp b/src/utils/SkCullPoints.cpp
index 76e63c71a9..f77acf1023 100644
--- a/src/utils/SkCullPoints.cpp
+++ b/src/utils/SkCullPoints.cpp
@@ -76,7 +76,7 @@ void SkCullPoints::moveTo(int x, int y) {
}
SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) {
- SkASSERT(line != NULL);
+ SkASSERT(line != nullptr);
LineToResult result = kNo_Result;
int x0 = fPrevPt.fX;
@@ -107,7 +107,7 @@ SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) {
#include "SkPath.h"
SkCullPointsPath::SkCullPointsPath()
- : fCP(), fPath(NULL) {
+ : fCP(), fPath(nullptr) {
}
SkCullPointsPath::SkCullPointsPath(const SkIRect& r, SkPath* dst)
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index de249f6fff..c177295941 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -92,7 +92,7 @@ static void outset_for_stroke(SkRect* rect, const SkStrokeRec& rec) {
static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec,
const SkRect* cullRect, SkScalar intervalLength,
SkPath* dstPath) {
- if (NULL == cullRect) {
+ if (nullptr == cullRect) {
return false;
}
diff --git a/src/utils/SkDashPathPriv.h b/src/utils/SkDashPathPriv.h
index 94222a271a..7453dcec82 100644
--- a/src/utils/SkDashPathPriv.h
+++ b/src/utils/SkDashPathPriv.h
@@ -15,11 +15,11 @@ namespace SkDashPath {
* Calculates the initialDashLength, initialDashIndex, and intervalLength based on the
* inputed phase and intervals. If adjustedPhase is passed in, then the phase will be
* adjusted to be between 0 and intervalLength. The result will be stored in adjustedPhase.
- * If adjustedPhase is NULL then it is assumed phase is already between 0 and intervalLength
+ * If adjustedPhase is nullptr then it is assumed phase is already between 0 and intervalLength
*/
void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count,
SkScalar* initialDashLength, int32_t* initialDashIndex,
- SkScalar* intervalLength, SkScalar* adjustedPhase = NULL);
+ SkScalar* intervalLength, SkScalar* adjustedPhase = nullptr);
bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
const SkScalar aIntervals[], int32_t count, SkScalar initialDashLength,
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index e8997ab573..8d0209d964 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -195,7 +195,7 @@ void SkDumpCanvas::dump(Verb verb, const SkPaint* paint,
///////////////////////////////////////////////////////////////////////////////
void SkDumpCanvas::willSave() {
- this->dump(kSave_Verb, NULL, "save()");
+ this->dump(kSave_Verb, nullptr, "save()");
this->INHERITED::willSave();
}
@@ -220,7 +220,7 @@ SkCanvas::SaveLayerStrategy SkDumpCanvas::willSaveLayer(const SkRect* bounds, co
}
void SkDumpCanvas::willRestore() {
- this->dump(kRestore_Verb, NULL, "restore");
+ this->dump(kRestore_Verb, nullptr, "restore");
this->INHERITED::willRestore();
}
@@ -229,18 +229,18 @@ void SkDumpCanvas::didConcat(const SkMatrix& matrix) {
switch (matrix.getType()) {
case SkMatrix::kTranslate_Mask:
- this->dump(kMatrix_Verb, NULL, "translate(%g %g)",
+ this->dump(kMatrix_Verb, nullptr, "translate(%g %g)",
SkScalarToFloat(matrix.getTranslateX()),
SkScalarToFloat(matrix.getTranslateY()));
break;
case SkMatrix::kScale_Mask:
- this->dump(kMatrix_Verb, NULL, "scale(%g %g)",
+ this->dump(kMatrix_Verb, nullptr, "scale(%g %g)",
SkScalarToFloat(matrix.getScaleX()),
SkScalarToFloat(matrix.getScaleY()));
break;
default:
matrix.toString(&str);
- this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str());
+ this->dump(kMatrix_Verb, nullptr, "concat(%s)", str.c_str());
break;
}
@@ -250,7 +250,7 @@ void SkDumpCanvas::didConcat(const SkMatrix& matrix) {
void SkDumpCanvas::didSetMatrix(const SkMatrix& matrix) {
SkString str;
matrix.toString(&str);
- this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str());
+ this->dump(kMatrix_Verb, nullptr, "setMatrix(%s)", str.c_str());
this->INHERITED::didSetMatrix(matrix);
}
@@ -263,7 +263,7 @@ const char* SkDumpCanvas::EdgeStyleToAAString(ClipEdgeStyle edgeStyle) {
void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(rect, &str);
- this->dump(kClip_Verb, NULL, "clipRect(%s %s %s)", str.c_str(), toString(op),
+ this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString(op),
EdgeStyleToAAString(edgeStyle));
this->INHERITED::onClipRect(rect, op, edgeStyle);
}
@@ -271,7 +271,7 @@ void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle
void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(rrect, &str);
- this->dump(kClip_Verb, NULL, "clipRRect(%s %s %s)", str.c_str(), toString(op),
+ this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString(op),
EdgeStyleToAAString(edgeStyle));
this->INHERITED::onClipRRect(rrect, op, edgeStyle);
}
@@ -279,7 +279,7 @@ void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeSt
void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(path, &str);
- this->dump(kClip_Verb, NULL, "clipPath(%s %s %s)", str.c_str(), toString(op),
+ this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString(op),
EdgeStyleToAAString(edgeStyle));
this->INHERITED::onClipPath(path, op, edgeStyle);
}
@@ -287,7 +287,7 @@ void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle
void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
SkString str;
toString(deviceRgn, &str);
- this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(),
+ this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(),
toString(op));
this->INHERITED::onClipRegion(deviceRgn, op);
}
@@ -448,13 +448,13 @@ void SkDumpCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y
void SkDumpCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
const SkPaint* paint) {
- this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %f:%f:%f:%f", picture,
+ this->dump(kDrawPicture_Verb, nullptr, "drawPicture(%p) %f:%f:%f:%f", picture,
picture->cullRect().fLeft, picture->cullRect().fTop,
picture->cullRect().fRight, picture->cullRect().fBottom);
fNestLevel += 1;
this->INHERITED::onDrawPicture(picture, matrix, paint);
fNestLevel -= 1;
- this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %f:%f:%f:%f", &picture,
+ this->dump(kDrawPicture_Verb, nullptr, "endPicture(%p) %f:%f:%f:%f", &picture,
picture->cullRect().fLeft, picture->cullRect().fTop,
picture->cullRect().fRight, picture->cullRect().fBottom);
}
@@ -552,6 +552,6 @@ static void dumpToDebugf(const char text[], void*) {
SkDebugf("%s\n", text);
}
-SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {}
+SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, nullptr) {}
#endif
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 08364d15eb..0955cfaf71 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -30,7 +30,7 @@ public:
size_t getLength() const override { return fLength; }
- SkStreamRewindable* duplicate() const override { return NULL; }
+ SkStreamRewindable* duplicate() const override { return nullptr; }
private:
SkAutoTDelete<SkStream> fStream;
@@ -44,21 +44,21 @@ private:
// Total size of the buffer.
const size_t fBufferSize;
// FIXME: SkAutoTMalloc throws on failure. Instead, Create should return a
- // NULL stream.
+ // nullptr stream.
SkAutoTMalloc<char> fBuffer;
// Read up to size bytes from already buffered data, and copy to
- // dst, if non-NULL. Updates fOffset. Assumes that fOffset is less
+ // dst, if non-nullptr. Updates fOffset. Assumes that fOffset is less
// than fBufferedSoFar.
size_t readFromBuffer(char* dst, size_t size);
// Buffer up to size bytes from the stream, and copy to dst if non-
- // NULL. Updates fOffset and fBufferedSoFar. Assumes that fOffset is
+ // nullptr. Updates fOffset and fBufferedSoFar. Assumes that fOffset is
// less than fBufferedSoFar, and size is greater than 0.
size_t bufferAndWriteTo(char* dst, size_t size);
// Read up to size bytes directly from the stream and into dst if non-
- // NULL. Updates fOffset. Assumes fOffset is at or beyond the buffered
+ // nullptr. Updates fOffset. Assumes fOffset is at or beyond the buffered
// data, and size is greater than 0.
size_t readDirectlyFromStream(char* dst, size_t size);
@@ -66,8 +66,8 @@ private:
};
SkStreamRewindable* SkFrontBufferedStream::Create(SkStream* stream, size_t bufferSize) {
- if (NULL == stream) {
- return NULL;
+ if (nullptr == stream) {
+ return nullptr;
}
return new FrontBufferedStream(stream, bufferSize);
}
@@ -106,7 +106,7 @@ size_t FrontBufferedStream::readFromBuffer(char* dst, size_t size) {
// lesser of the size requested and the remainder of the buffered
// data.
const size_t bytesToCopy = SkTMin(size, fBufferedSoFar - fOffset);
- if (dst != NULL) {
+ if (dst != nullptr) {
memcpy(dst, fBuffer + fOffset, bytesToCopy);
}
@@ -133,7 +133,7 @@ size_t FrontBufferedStream::bufferAndWriteTo(char* dst, size_t size) {
SkASSERT(fBufferedSoFar <= fBufferSize);
// Copy the buffer to the destination buffer and update the amount read.
- if (dst != NULL) {
+ if (dst != nullptr) {
memcpy(dst, buffer, buffered);
}
@@ -185,7 +185,7 @@ size_t FrontBufferedStream::read(void* voidDst, size_t size) {
// and the destination buffer.
size -= bytesCopied;
SkASSERT(size + (fOffset - start) == totalSize);
- if (dst != NULL) {
+ if (dst != nullptr) {
dst += bytesCopied;
}
}
@@ -199,7 +199,7 @@ size_t FrontBufferedStream::read(void* voidDst, size_t size) {
// and the destination buffer.
size -= buffered;
SkASSERT(size + (fOffset - start) == totalSize);
- if (dst != NULL) {
+ if (dst != nullptr) {
dst += buffered;
}
}
diff --git a/src/utils/SkInterpolator.cpp b/src/utils/SkInterpolator.cpp
index 03e7e4a83f..cd9ad3a2db 100644
--- a/src/utils/SkInterpolator.cpp
+++ b/src/utils/SkInterpolator.cpp
@@ -12,9 +12,9 @@
#include "SkTSearch.h"
SkInterpolatorBase::SkInterpolatorBase() {
- fStorage = NULL;
- fTimes = NULL;
- SkDEBUGCODE(fTimesArray = NULL;)
+ fStorage = nullptr;
+ fTimes = nullptr;
+ SkDEBUGCODE(fTimesArray = nullptr;)
}
SkInterpolatorBase::~SkInterpolatorBase() {
@@ -30,9 +30,9 @@ void SkInterpolatorBase::reset(int elemCount, int frameCount) {
fRepeat = SK_Scalar1;
if (fStorage) {
sk_free(fStorage);
- fStorage = NULL;
- fTimes = NULL;
- SkDEBUGCODE(fTimesArray = NULL);
+ fStorage = nullptr;
+ fTimes = nullptr;
+ SkDEBUGCODE(fTimesArray = nullptr);
}
}
@@ -129,8 +129,8 @@ SkInterpolatorBase::Result SkInterpolatorBase::timeToT(SkMSec time, SkScalar* T,
SkInterpolator::SkInterpolator() {
INHERITED::reset(0, 0);
- fValues = NULL;
- SkDEBUGCODE(fScalarsArray = NULL;)
+ fValues = nullptr;
+ SkDEBUGCODE(fScalarsArray = nullptr;)
}
SkInterpolator::SkInterpolator(int elemCount, int frameCount) {
@@ -159,9 +159,9 @@ static const SkScalar gIdentityBlend[4] = {
bool SkInterpolator::setKeyFrame(int index, SkMSec time,
const SkScalar values[], const SkScalar blend[4]) {
- SkASSERT(values != NULL);
+ SkASSERT(values != nullptr);
- if (blend == NULL) {
+ if (blend == nullptr) {
blend = gIdentityBlend;
}
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp
index 525917ff66..39032b616e 100644
--- a/src/utils/SkLayer.cpp
+++ b/src/utils/SkLayer.cpp
@@ -18,7 +18,7 @@
///////////////////////////////////////////////////////////////////////////////
SkLayer::SkLayer() {
- fParent = NULL;
+ fParent = nullptr;
m_opacity = SK_Scalar1;
m_size.set(0, 0);
m_position.set(0, 0);
@@ -35,7 +35,7 @@ SkLayer::SkLayer() {
}
SkLayer::SkLayer(const SkLayer& src) : INHERITED() {
- fParent = NULL;
+ fParent = nullptr;
m_opacity = src.m_opacity;
m_size = src.m_size;
m_position = src.m_position;
@@ -93,14 +93,14 @@ SkLayer* SkLayer::getChild(int index) const {
SkASSERT(m_children[index]->fParent == this);
return m_children[index];
}
- return NULL;
+ return nullptr;
}
SkLayer* SkLayer::addChild(SkLayer* child) {
SkASSERT(this != child);
child->ref();
child->detachFromParent();
- SkASSERT(child->fParent == NULL);
+ SkASSERT(child->fParent == nullptr);
child->fParent = this;
*m_children.append() = child;
@@ -112,7 +112,7 @@ void SkLayer::detachFromParent() {
int index = fParent->m_children.find(this);
SkASSERT(index >= 0);
fParent->m_children.remove(index);
- fParent = NULL;
+ fParent = nullptr;
this->unref(); // this call might delete us
}
}
@@ -122,7 +122,7 @@ void SkLayer::removeChildren() {
for (int i = 0; i < count; i++) {
SkLayer* child = m_children[i];
SkASSERT(child->fParent == this);
- child->fParent = NULL; // in case it has more than one owner
+ child->fParent = nullptr; // in case it has more than one owner
child->unref();
}
m_children.reset();
@@ -130,7 +130,7 @@ void SkLayer::removeChildren() {
SkLayer* SkLayer::getRootLayer() const {
const SkLayer* root = this;
- while (root->fParent != NULL) {
+ while (root->fParent != nullptr) {
root = root->fParent;
}
return const_cast<SkLayer*>(root);
@@ -157,7 +157,7 @@ void SkLayer::localToGlobal(SkMatrix* matrix) const {
}
const SkLayer* layer = this;
- while (layer->fParent != NULL) {
+ while (layer->fParent != nullptr) {
layer = layer->fParent;
SkMatrix tmp;
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index e5d4c2b3a4..307e5f6152 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -502,13 +502,13 @@ static SkPaint* lua2OptionalPaint(lua_State* L, int index, SkPaint* paint) {
return paint;
}
}
- return NULL;
+ return nullptr;
}
static int lcanvas_drawImage(lua_State* L) {
SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
SkImage* image = get_ref<SkImage>(L, 2);
- if (NULL == image) {
+ if (nullptr == image) {
return 0;
}
SkScalar x = lua2scalar(L, 3);
@@ -522,12 +522,12 @@ static int lcanvas_drawImage(lua_State* L) {
static int lcanvas_drawImageRect(lua_State* L) {
SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
SkImage* image = get_ref<SkImage>(L, 2);
- if (NULL == image) {
+ if (nullptr == image) {
return 0;
}
SkRect srcR, dstR;
- SkRect* srcRPtr = NULL;
+ SkRect* srcRPtr = nullptr;
if (!lua_isnil(L, 3)) {
srcRPtr = lua2rect(L, 3, &srcR);
}
@@ -543,8 +543,8 @@ static int lcanvas_drawPatch(lua_State* L) {
SkColor colorStorage[4];
SkPoint texStorage[4];
- const SkColor* colors = NULL;
- const SkPoint* texs = NULL;
+ const SkColor* colors = nullptr;
+ const SkPoint* texs = nullptr;
getarray_points(L, 2, cubics, 12);
@@ -560,7 +560,7 @@ static int lcanvas_drawPatch(lua_State* L) {
texs = texStorage;
}
- get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, NULL, *get_obj<SkPaint>(L, 5));
+ get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, nullptr, *get_obj<SkPaint>(L, 5));
return 0;
}
@@ -576,7 +576,7 @@ static int lcanvas_drawPicture(lua_State* L) {
SkPicture* picture = get_ref<SkPicture>(L, 2);
SkScalar x = lua2scalar_def(L, 3, 0);
SkScalar y = lua2scalar_def(L, 4, 0);
- SkMatrix matrix, *matrixPtr = NULL;
+ SkMatrix matrix, *matrixPtr = nullptr;
if (x || y) {
matrix.setTranslate(x, y);
matrixPtr = &matrix;
@@ -646,7 +646,7 @@ int SkLua::lcanvas_getReducedClipStack(lua_State* L) {
&genID,
&initialState,
&resultBounds,
- NULL);
+ nullptr);
GrReducedClip::ElementList::Iter iter(elements);
int i = 0;
@@ -671,7 +671,7 @@ static int lcanvas_save(lua_State* L) {
static int lcanvas_saveLayer(lua_State* L) {
SkPaint paint;
- lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(NULL, lua2OptionalPaint(L, 2, &paint)));
+ lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(nullptr, lua2OptionalPaint(L, 2, &paint)));
return 1;
}
@@ -710,7 +710,7 @@ static int lcanvas_newSurface(lua_State* L) {
int height = lua2int_def(L, 3, 0);
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
SkSurface* surface = get_ref<SkCanvas>(L, 1)->newSurface(info);
- if (NULL == surface) {
+ if (nullptr == surface) {
lua_pushnil(L);
} else {
push_ref(L, surface)->unref();
@@ -754,13 +754,13 @@ const struct luaL_Reg gSkCanvas_Methods[] = {
{ "newSurface", lcanvas_newSurface },
{ "__gc", lcanvas_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
static int ldocument_beginPage(lua_State* L) {
- const SkRect* contentPtr = NULL;
+ const SkRect* contentPtr = nullptr;
push_ref(L, get_ref<SkDocument>(L, 1)->beginPage(lua2scalar(L, 2),
lua2scalar(L, 3),
contentPtr));
@@ -787,7 +787,7 @@ static const struct luaL_Reg gSkDocument_Methods[] = {
{ "endPage", ldocument_endPage },
{ "close", ldocument_close },
{ "__gc", ldocument_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1176,7 +1176,7 @@ static const struct luaL_Reg gSkPaint_Methods[] = {
{ "setShader", lpaint_setShader },
{ "getPathEffect", lpaint_getPathEffect },
{ "__gc", lpaint_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1260,7 +1260,7 @@ static const struct luaL_Reg gSkShader_Methods[] = {
{ "isABitmap", lshader_isABitmap },
{ "asAGradient", lshader_asAGradient },
{ "__gc", lshader_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1289,7 +1289,7 @@ static int lpatheffect_gc(lua_State* L) {
static const struct luaL_Reg gSkPathEffect_Methods[] = {
{ "asADash", lpatheffect_asADash },
{ "__gc", lpatheffect_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1301,7 +1301,7 @@ static int lpimagefilter_gc(lua_State* L) {
static const struct luaL_Reg gSkImageFilter_Methods[] = {
{ "__gc", lpimagefilter_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1390,7 +1390,7 @@ static const struct luaL_Reg gSkMatrix_Methods[] = {
{ "setRectToRect", lmatrix_setRectToRect },
{ "invert", lmatrix_invert },
{ "mapXY", lmatrix_mapXY },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1568,7 +1568,7 @@ static const struct luaL_Reg gSkPath_Methods[] = {
{ "cubicTo", lpath_cubicTo },
{ "close", lpath_close },
{ "__gc", lpath_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1620,7 +1620,7 @@ static const struct luaL_Reg gSkRRect_Methods[] = {
{ "type", lrrect_type },
{ "radii", lrrect_radii },
{ "__gc", lrrect_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1637,7 +1637,7 @@ static int limage_height(lua_State* L) {
static int limage_newShader(lua_State* L) {
SkShader::TileMode tmode = SkShader::kClamp_TileMode;
- const SkMatrix* localM = NULL;
+ const SkMatrix* localM = nullptr;
SkAutoTUnref<SkShader> shader(get_ref<SkImage>(L, 1)->newShader(tmode, tmode, localM));
push_ref(L, shader.get());
return 1;
@@ -1653,7 +1653,7 @@ static const struct luaL_Reg gSkImage_Methods[] = {
{ "height", limage_height },
{ "newShader", limage_newShader },
{ "__gc", limage_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1670,7 +1670,7 @@ static int lsurface_height(lua_State* L) {
static int lsurface_getCanvas(lua_State* L) {
SkCanvas* canvas = get_ref<SkSurface>(L, 1)->getCanvas();
- if (NULL == canvas) {
+ if (nullptr == canvas) {
lua_pushnil(L);
} else {
push_ref(L, canvas);
@@ -1685,7 +1685,7 @@ static int lsurface_getCanvas(lua_State* L) {
static int lsurface_newImageSnapshot(lua_State* L) {
SkImage* image = get_ref<SkSurface>(L, 1)->newImageSnapshot();
- if (NULL == image) {
+ if (nullptr == image) {
lua_pushnil(L);
} else {
push_ref(L, image)->unref();
@@ -1698,7 +1698,7 @@ static int lsurface_newSurface(lua_State* L) {
int height = lua2int_def(L, 3, 0);
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
SkSurface* surface = get_ref<SkSurface>(L, 1)->newSurface(info);
- if (NULL == surface) {
+ if (nullptr == surface) {
lua_pushnil(L);
} else {
push_ref(L, surface)->unref();
@@ -1718,7 +1718,7 @@ static const struct luaL_Reg gSkSurface_Methods[] = {
{ "newImageSnapshot", lsurface_newImageSnapshot },
{ "newSurface", lsurface_newSurface },
{ "__gc", lsurface_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1732,7 +1732,7 @@ static int lpicturerecorder_beginRecording(lua_State* L) {
}
SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->beginRecording(w, h);
- if (NULL == canvas) {
+ if (nullptr == canvas) {
lua_pushnil(L);
return 1;
}
@@ -1743,7 +1743,7 @@ static int lpicturerecorder_beginRecording(lua_State* L) {
static int lpicturerecorder_getCanvas(lua_State* L) {
SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->getRecordingCanvas();
- if (NULL == canvas) {
+ if (nullptr == canvas) {
lua_pushnil(L);
return 1;
}
@@ -1753,7 +1753,7 @@ static int lpicturerecorder_getCanvas(lua_State* L) {
static int lpicturerecorder_endRecording(lua_State* L) {
SkPicture* pic = get_obj<SkPictureRecorder>(L, 1)->endRecording();
- if (NULL == pic) {
+ if (nullptr == pic) {
lua_pushnil(L);
return 1;
}
@@ -1771,7 +1771,7 @@ static const struct luaL_Reg gSkPictureRecorder_Methods[] = {
{ "getCanvas", lpicturerecorder_getCanvas },
{ "endRecording", lpicturerecorder_endRecording },
{ "__gc", lpicturerecorder_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1795,7 +1795,7 @@ static const struct luaL_Reg gSkPicture_Methods[] = {
{ "width", lpicture_width },
{ "height", lpicture_height },
{ "__gc", lpicture_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1813,7 +1813,7 @@ static int ltextblob_gc(lua_State* L) {
static const struct luaL_Reg gSkTextBlob_Methods[] = {
{ "bounds", ltextblob_bounds },
{ "__gc", ltextblob_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1839,7 +1839,7 @@ static const struct luaL_Reg gSkTypeface_Methods[] = {
{ "getFamilyName", ltypeface_getFamilyName },
{ "getStyle", ltypeface_getStyle },
{ "__gc", ltypeface_gc },
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////////////////////////////////////
@@ -1873,13 +1873,13 @@ private:
///////////////////////////////////////////////////////////////////////////////
static int lsk_newDocumentPDF(lua_State* L) {
- const char* file = NULL;
+ const char* file = nullptr;
if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
- file = lua_tolstring(L, 1, NULL);
+ file = lua_tolstring(L, 1, nullptr);
}
SkDocument* doc = SkDocument::CreatePDF(file);
- if (NULL == doc) {
+ if (nullptr == doc) {
// do I need to push a nil on the stack and return 1?
return 0;
} else {
@@ -1892,7 +1892,7 @@ static int lsk_newBlurImageFilter(lua_State* L) {
SkScalar sigmaX = lua2scalar_def(L, 1, 0);
SkScalar sigmaY = lua2scalar_def(L, 2, 0);
SkImageFilter* imf = SkBlurImageFilter::Create(sigmaX, sigmaY);
- if (NULL == imf) {
+ if (nullptr == imf) {
lua_pushnil(L);
} else {
push_ref(L, imf)->unref();
@@ -1910,8 +1910,8 @@ static int lsk_newLinearGradient(lua_State* L) {
SkPoint pts[] = { { x0, y0 }, { x1, y1 } };
SkColor colors[] = { c0, c1 };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
- if (NULL == s) {
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
+ if (nullptr == s) {
lua_pushnil(L);
} else {
push_ref(L, s)->unref();
@@ -1947,7 +1947,7 @@ static int lsk_newRRect(lua_State* L) {
#include "SkTextBox.h"
// Sk.newTextBlob(text, rect, paint)
static int lsk_newTextBlob(lua_State* L) {
- const char* text = lua_tolstring(L, 1, NULL);
+ const char* text = lua_tolstring(L, 1, nullptr);
SkRect bounds;
lua2rect(L, 2, &bounds);
const SkPaint& paint = *get_obj<SkPaint>(L, 3);
@@ -1965,21 +1965,21 @@ static int lsk_newTextBlob(lua_State* L) {
}
static int lsk_newTypeface(lua_State* L) {
- const char* name = NULL;
+ const char* name = nullptr;
int style = SkTypeface::kNormal;
int count = lua_gettop(L);
if (count > 0 && lua_isstring(L, 1)) {
- name = lua_tolstring(L, 1, NULL);
+ name = lua_tolstring(L, 1, nullptr);
if (count > 1 && lua_isnumber(L, 2)) {
- style = lua_tointegerx(L, 2, NULL) & SkTypeface::kBoldItalic;
+ style = lua_tointegerx(L, 2, nullptr) & SkTypeface::kBoldItalic;
}
}
SkTypeface* face = SkTypeface::CreateFromName(name,
(SkTypeface::Style)style);
// SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, face->getRefCnt());
- if (NULL == face) {
+ if (nullptr == face) {
face = SkTypeface::RefDefault();
}
push_ref(L, face)->unref();
@@ -1992,7 +1992,7 @@ static int lsk_newRasterSurface(lua_State* L) {
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
SkSurface* surface = SkSurface::NewRaster(info, &props);
- if (NULL == surface) {
+ if (nullptr == surface) {
lua_pushnil(L);
} else {
push_ref(L, surface)->unref();
@@ -2002,7 +2002,7 @@ static int lsk_newRasterSurface(lua_State* L) {
static int lsk_loadImage(lua_State* L) {
if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
- const char* name = lua_tolstring(L, 1, NULL);
+ const char* name = lua_tolstring(L, 1, nullptr);
SkAutoDataUnref data(SkData::NewFromFileName(name));
if (data.get()) {
SkImage* image = SkImage::NewFromEncoded(data);
diff --git a/src/utils/SkMeshUtils.cpp b/src/utils/SkMeshUtils.cpp
index 3857dc954f..cf4e5099b3 100644
--- a/src/utils/SkMeshUtils.cpp
+++ b/src/utils/SkMeshUtils.cpp
@@ -21,15 +21,15 @@ bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[],
int texW, int texH, int rows, int cols) {
if (rows < 2 || cols < 2) {
sk_free(fStorage);
- fStorage = NULL;
- fTex = NULL;
- fIndices = NULL;
+ fStorage = nullptr;
+ fTex = nullptr;
+ fIndices = nullptr;
fTexCount = fIndexCount = 0;
return false;
}
sk_free(fStorage);
- fStorage = NULL;
+ fStorage = nullptr;
fTexCount = rows * cols;
rows -= 1;
@@ -96,7 +96,7 @@ void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode))->unref();
canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
- rows * cols, verts, idx.tex(), colors, NULL,
+ rows * cols, verts, idx.tex(), colors, nullptr,
idx.indices(), idx.indexCount(), p);
}
}
diff --git a/src/utils/SkNinePatch.cpp b/src/utils/SkNinePatch.cpp
index 4a5308bb07..5ee488e44b 100644
--- a/src/utils/SkNinePatch.cpp
+++ b/src/utils/SkNinePatch.cpp
@@ -196,8 +196,8 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
mesh.fVerts = verts;
mesh.fTexs = texs;
- mesh.fColors = NULL;
- mesh.fIndices = NULL;
+ mesh.fColors = nullptr;
+ mesh.fIndices = nullptr;
// we use <= for YDivs, since the prebuild indices work for 3x2 and 3x1 too
if (numXDivs == 2 && numYDivs <= 2) {
@@ -245,7 +245,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
}
p.setShader(shader)->unref();
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, vCount,
- mesh.fVerts, mesh.fTexs, mesh.fColors, NULL,
+ mesh.fVerts, mesh.fTexs, mesh.fColors, nullptr,
mesh.fIndices, indexCount, p);
}
diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp
index cb12c2b6ae..a0c003ba8d 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -20,7 +20,7 @@ SkString SkOSPath::Basename(const char* fullPath) {
return SkString();
}
const char* filename = strrchr(fullPath, SkPATH_SEPARATOR);
- if (NULL == filename) {
+ if (nullptr == filename) {
filename = fullPath;
} else {
++filename;
@@ -33,7 +33,7 @@ SkString SkOSPath::Dirname(const char* fullPath) {
return SkString();
}
const char* end = strrchr(fullPath, SkPATH_SEPARATOR);
- if (NULL == end) {
+ if (nullptr == end) {
return SkString();
}
if (end == fullPath) {
diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp
index 446f9d444a..b5a108e2cb 100644
--- a/src/utils/SkParse.cpp
+++ b/src/utils/SkParse.cpp
@@ -112,7 +112,7 @@ const char* SkParse::FindHex(const char str[], uint32_t* value)
str = skip_ws(str);
if (!is_hex(*str))
- return NULL;
+ return nullptr;
uint32_t n = 0;
int max_digits = 8;
@@ -121,7 +121,7 @@ const char* SkParse::FindHex(const char str[], uint32_t* value)
while ((digit = to_hex(*str)) >= 0)
{
if (--max_digits < 0)
- return NULL;
+ return nullptr;
n = (n << 4) | digit;
str += 1;
}
@@ -132,7 +132,7 @@ const char* SkParse::FindHex(const char str[], uint32_t* value)
*value = n;
return str;
}
- return NULL;
+ return nullptr;
}
const char* SkParse::FindS32(const char str[], int32_t* value)
@@ -148,7 +148,7 @@ const char* SkParse::FindS32(const char str[], int32_t* value)
}
if (!is_digit(*str))
- return NULL;
+ return nullptr;
int n = 0;
while (is_digit(*str))
@@ -174,7 +174,7 @@ const char* SkParse::FindMSec(const char str[], SkMSec* value)
}
if (!is_digit(*str))
- return NULL;
+ return nullptr;
int n = 0;
while (is_digit(*str))
@@ -207,7 +207,7 @@ const char* SkParse::FindScalar(const char str[], SkScalar* value) {
char* stop;
float v = (float)strtod(str, &stop);
if (str == stop) {
- return NULL;
+ return nullptr;
}
if (value) {
*value = v;
@@ -224,7 +224,7 @@ const char* SkParse::FindScalars(const char str[], SkScalar value[], int count)
for (;;)
{
str = SkParse::FindScalar(str, value);
- if (--count == 0 || str == NULL)
+ if (--count == 0 || str == nullptr)
break;
// keep going
@@ -272,14 +272,14 @@ int SkParse::FindList(const char target[], const char list[])
const char* end = strchr(list, ',');
size_t entryLen;
- if (end == NULL) // last entry
+ if (end == nullptr) // last entry
entryLen = strlen(list);
else
entryLen = end - list;
if (entryLen == len && memcmp(target, list, len) == 0)
return index;
- if (end == NULL)
+ if (end == nullptr)
break;
list = end + 1; // skip the ','
diff --git a/src/utils/SkParseColor.cpp b/src/utils/SkParseColor.cpp
index 989a6091ef..329b304ac4 100644
--- a/src/utils/SkParseColor.cpp
+++ b/src/utils/SkParseColor.cpp
@@ -423,11 +423,11 @@ const char* SkParse::FindNamedColor(const char* name, size_t len, SkColor* color
while ((int) gColorNames[lo] >= 0)
++lo;
} else if (hi == mid)
- return NULL;
+ return nullptr;
else
hi = mid;
}
- return NULL;
+ return nullptr;
}
// !!! move to char utilities
@@ -435,12 +435,12 @@ const char* SkParse::FindNamedColor(const char* name, size_t len, SkColor* color
// char c;
// int separators = 0;
// while ((c = *str++) != '\0') {
-// if (strchr(sep, c) == NULL)
+// if (strchr(sep, c) == nullptr)
// continue;
// do {
// if ((c = *str++) == '\0')
// goto goHome;
-// } while (strchr(sep, c) != NULL);
+// } while (strchr(sep, c) != nullptr);
// separators++;
// }
//goHome:
@@ -459,7 +459,7 @@ const char* SkParse::FindColor(const char* value, SkColor* colorPtr) {
uint32_t hex;
const char* end = SkParse::FindHex(value + 1, &hex);
// SkASSERT(end);
- if (end == NULL)
+ if (end == nullptr)
return end;
size_t len = end - value - 1;
if (len == 3 || len == 4) {
@@ -476,7 +476,7 @@ const char* SkParse::FindColor(const char* value, SkColor* colorPtr) {
return end;
} else {
// SkASSERT(0);
- return NULL;
+ return nullptr;
}
// } else if (strchr(value, ',')) {
// SkScalar array[4];
@@ -484,8 +484,8 @@ const char* SkParse::FindColor(const char* value, SkColor* colorPtr) {
// SkASSERT(count == 3 || count == 4);
// array[0] = SK_Scalar1 * 255;
// const char* end = SkParse::FindScalars(value, &array[4 - count], count);
-// if (end == NULL)
-// return NULL;
+// if (end == nullptr)
+// return nullptr;
// !!! range check for errors?
// *colorPtr = SkColorSetARGB(SkScalarRoundToInt(array[0]), SkScalarRoundToInt(array[1]),
// SkScalarRoundToInt(array[2]), SkScalarRoundToInt(array[3]));
@@ -503,7 +503,7 @@ void SkParse::TestColor() {
for (index = 0; index < colorNamesSize; index++) {
result = SK_ColorBLACK;
SkNameRGB nameRGB = colorNames[index];
- SkASSERT(FindColor(nameRGB.name, &result) != NULL);
+ SkASSERT(FindColor(nameRGB.name, &result) != nullptr);
SkASSERT(result == (SkColor) (nameRGB.rgb | 0xFF000000));
}
for (index = 0; index < colorNamesSize; index++) {
@@ -513,9 +513,9 @@ void SkParse::TestColor() {
size_t len = strlen(nameRGB.name);
memcpy(bad, nameRGB.name, len);
bad[len - 1] -= 1;
- SkASSERT(FindColor(bad, &result) == NULL);
+ SkASSERT(FindColor(bad, &result) == nullptr);
bad[len - 1] += 2;
- SkASSERT(FindColor(bad, &result) == NULL);
+ SkASSERT(FindColor(bad, &result) == nullptr);
}
result = SK_ColorBLACK;
SkASSERT(FindColor("lightGrey", &result));
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 94c3112120..3fecb46fe6 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -167,7 +167,7 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
break;
case '~': {
SkPoint args[2];
- data = find_points(data, args, 2, false, NULL);
+ data = find_points(data, args, 2, false, nullptr);
path.moveTo(args[0].fX, args[0].fY);
path.lineTo(args[1].fX, args[1].fY);
} break;
diff --git a/src/utils/SkPatchGrid.cpp b/src/utils/SkPatchGrid.cpp
index 386e3a633d..b7aaa82b9b 100644
--- a/src/utils/SkPatchGrid.cpp
+++ b/src/utils/SkPatchGrid.cpp
@@ -12,12 +12,12 @@ SkPatchGrid::SkPatchGrid(int rows, int cols, VertexType flags, SkXfermode* xfer)
: fRows(0)
, fCols(0)
, fModeFlags(kNone_VertexType)
- , fCornerPts(NULL)
- , fCornerColors(NULL)
- , fTexCoords(NULL)
- , fHrzCtrlPts(NULL)
- , fVrtCtrlPts(NULL)
- , fXferMode(NULL) {
+ , fCornerPts(nullptr)
+ , fCornerColors(nullptr)
+ , fTexCoords(nullptr)
+ , fHrzCtrlPts(nullptr)
+ , fVrtCtrlPts(nullptr)
+ , fXferMode(nullptr) {
this->reset(rows, cols, flags, xfer);
}
@@ -33,7 +33,7 @@ bool SkPatchGrid::setPatch(int x, int y, const SkPoint cubics[12], const SkColor
const SkPoint texCoords[4]) {
// Check for the passed paramaters to be within the range of the grid dimensions and a valid
// pointer for the cubics' control points.
- if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || NULL == cubics) {
+ if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || nullptr == cubics) {
return false;
}
@@ -79,7 +79,7 @@ bool SkPatchGrid::setPatch(int x, int y, const SkPoint cubics[12], const SkColor
bool SkPatchGrid::getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4],
SkPoint texCoords[4]) const {
- if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || NULL == cubics) {
+ if (x < 0 || y < 0 || x > fCols - 1 || y > fRows - 1 || nullptr == cubics) {
return false;
}
@@ -159,7 +159,7 @@ void SkPatchGrid::draw(SkCanvas* canvas, SkPaint& paint) {
for (int y = 0; y < fRows; y++) {
for (int x = 0; x < fCols; x++) {
SkPoint cubics[12];
- this->getPatch(x, y, cubics, NULL, NULL);
+ this->getPatch(x, y, cubics, nullptr, nullptr);
SkMatrix matrix = canvas->getTotalMatrix();
SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &matrix);
maxCols[x] = SkMax32(maxCols[x], lod.width());
@@ -175,8 +175,8 @@ void SkPatchGrid::draw(SkCanvas* canvas, SkPaint& paint) {
this->getPatch(x, y, cubics, colors, texCoords);
SkPatchUtils::VertexData data;
if (SkPatchUtils::getVertexData(&data, cubics,
- fModeFlags & kColors_VertexType ? colors : NULL,
- fModeFlags & kTexs_VertexType ? texCoords : NULL,
+ fModeFlags & kColors_VertexType ? colors : nullptr,
+ fModeFlags & kTexs_VertexType ? texCoords : nullptr,
maxCols[x], maxRows[y])) {
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCount,
data.fPoints, data.fTexCoords, data.fColors, fXferMode,
diff --git a/src/utils/SkPatchGrid.h b/src/utils/SkPatchGrid.h
index cf90098c68..5bc2e65df0 100644
--- a/src/utils/SkPatchGrid.h
+++ b/src/utils/SkPatchGrid.h
@@ -88,7 +88,7 @@ public:
};
SkPatchGrid(int rows = 0, int cols = 0, VertexType flags = kNone_VertexType,
- SkXfermode* xfer = NULL);
+ SkXfermode* xfer = nullptr);
~SkPatchGrid();
@@ -103,9 +103,9 @@ public:
const SkPoint texCoords[4]);
/**
- * Get patch at location (x,y). If cubics, colors or texCoords is not NULL it sets patch's
+ * Get patch at location (x,y). If cubics, colors or texCoords is not nullptr it sets patch's
* array with its corresponding values.
- * The function returns false if the cubics parameter is NULL or if the (x,y) coordinates are
+ * The function returns false if the cubics parameter is nullptr or if the (x,y) coordinates are
* not within the range of the grid.
*/
bool getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4], SkPoint texCoords[4]) const;
diff --git a/src/utils/SkPatchUtils.cpp b/src/utils/SkPatchUtils.cpp
index e9ff906dd2..ad846f7ba2 100644
--- a/src/utils/SkPatchUtils.cpp
+++ b/src/utils/SkPatchUtils.cpp
@@ -191,7 +191,7 @@ void SkPatchUtils::getRightCubic(const SkPoint cubics[12], SkPoint points[4]) {
bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint cubics[12],
const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY) {
- if (lodX < 1 || lodY < 1 || NULL == cubics || NULL == data) {
+ if (lodX < 1 || lodY < 1 || nullptr == cubics || nullptr == data) {
return false;
}
diff --git a/src/utils/SkPatchUtils.h b/src/utils/SkPatchUtils.h
index 3560421f4a..7c231f1a3b 100644
--- a/src/utils/SkPatchUtils.h
+++ b/src/utils/SkPatchUtils.h
@@ -29,10 +29,10 @@ public:
VertexData()
: fVertexCount(0)
, fIndexCount(0)
- , fPoints(NULL)
- , fTexCoords(NULL)
- , fColors(NULL)
- , fIndices(NULL) { }
+ , fPoints(nullptr)
+ , fTexCoords(nullptr)
+ , fColors(nullptr)
+ , fIndices(nullptr) { }
~VertexData() {
delete[] fPoints;
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index f441bf143b..9c076cbb16 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -41,7 +41,7 @@ SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) {
continue;
}
- char *valptr = strtok(NULL, sep);
+ char *valptr = strtok(nullptr, sep);
if (!valptr) {
continue;
}
@@ -240,7 +240,7 @@ static inline void str_replace(char *s, char search, char replace) {
}
template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
- const char *str = NULL;
+ const char *str = nullptr;
for (int i = fConfigFileKeys.count() - 1 ; i >= 0; i--) {
if (fConfigFileKeys[i]->equals(name)) {
@@ -301,7 +301,7 @@ template <typename T> void SkRTConfRegistry::set(const char *name,
}
return;
}
- SkASSERT(confArray != NULL);
+ SkASSERT(confArray != nullptr);
for (SkRTConfBase **confBase = confArray->begin(); confBase != confArray->end(); confBase++) {
// static_cast here is okay because there's only one kind of child class.
SkRTConf<T> *concrete = static_cast<SkRTConf<T> *>(*confBase);
diff --git a/src/utils/SkTextBox.cpp b/src/utils/SkTextBox.cpp
index af05cadfc6..ba6ef53deb 100644
--- a/src/utils/SkTextBox.cpp
+++ b/src/utils/SkTextBox.cpp
@@ -15,7 +15,7 @@ static inline int is_ws(int c)
static size_t linebreak(const char text[], const char stop[],
const SkPaint& paint, SkScalar margin,
- size_t* trailing = NULL)
+ size_t* trailing = nullptr)
{
size_t lengthBreak = paint.breakText(text, stop - text, margin);
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index c256a61a97..e308f6e480 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -35,7 +35,7 @@ static bool compress_etc1_565(uint8_t* dst, const uint8_t* src,
namespace SkTextureCompressor {
void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec) {
- if (NULL == dimX || NULL == dimY) {
+ if (nullptr == dimX || nullptr == dimY) {
return;
}
@@ -147,7 +147,7 @@ bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcCol
SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixmap.height());
if (compressedDataSize < 0) {
- return NULL;
+ return nullptr;
}
const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr());
@@ -156,7 +156,7 @@ SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colorType(),
pixmap.width(), pixmap.height(), pixmap.rowBytes(), format)) {
dst->unref();
- dst = NULL;
+ dst = nullptr;
}
return dst;
}
@@ -174,10 +174,10 @@ SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer,
return CreateASTCBlitter(width, height, compressedBuffer, allocator);
default:
- return NULL;
+ return nullptr;
}
- return NULL;
+ return nullptr;
}
bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* src,
diff --git a/src/utils/SkTextureCompressor.h b/src/utils/SkTextureCompressor.h
index f002cde301..d4d48967a3 100644
--- a/src/utils/SkTextureCompressor.h
+++ b/src/utils/SkTextureCompressor.h
@@ -56,7 +56,7 @@ namespace SkTextureCompressor {
// Returns an SkData holding a blob of compressed data that corresponds
// to the pixmap. If the pixmap colorType cannot be compressed using the
- // associated format, then we return NULL. The caller is responsible for
+ // associated format, then we return nullptr. The caller is responsible for
// calling unref() on the returned data.
SkData* CompressBitmapToFormat(const SkPixmap&, Format format);
diff --git a/src/utils/SkTextureCompressor_ASTC.cpp b/src/utils/SkTextureCompressor_ASTC.cpp
index 7969359e98..a6e91d66b8 100644
--- a/src/utils/SkTextureCompressor_ASTC.cpp
+++ b/src/utils/SkTextureCompressor_ASTC.cpp
@@ -1175,7 +1175,7 @@ struct ASTCDecompressionData {
// in the maximum encoding that will fit the number of color values that
// we need. Returns false on error. (See section C.2.22 of the spec)
bool getColorValueEncoding(int *nBits, int *nTrits, int *nQuints) const {
- if (NULL == nBits || NULL == nTrits || NULL == nQuints) {
+ if (nullptr == nBits || nullptr == nTrits || nullptr == nQuints) {
return false;
}
@@ -2057,7 +2057,7 @@ bool CompressA8To12x12ASTC(uint8_t* dst, const uint8_t* src,
SkBlitter* CreateASTCBlitter(int width, int height, void* outputBuffer,
SkTBlitterAllocator* allocator) {
if ((width % 12) != 0 || (height % 12) != 0) {
- return NULL;
+ return nullptr;
}
// Memset the output buffer to an encoding that decodes to zero. We must do this
diff --git a/src/utils/SkTextureCompressor_Blitter.h b/src/utils/SkTextureCompressor_Blitter.h
index e52237518f..0c259d692a 100644
--- a/src/utils/SkTextureCompressor_Blitter.h
+++ b/src/utils/SkTextureCompressor_Blitter.h
@@ -366,10 +366,10 @@ public:
}
// If the blitter just sets a single value for each pixel, return the
- // bitmap it draws into, and assign value. If not, return NULL and ignore
+ // bitmap it draws into, and assign value. If not, return nullptr and ignore
// the value parameter.
const SkPixmap* justAnOpaqueColor(uint32_t* value) override {
- return NULL;
+ return nullptr;
}
/**
diff --git a/src/utils/SkTextureCompressor_LATC.cpp b/src/utils/SkTextureCompressor_LATC.cpp
index f0cf4a90ac..3ee6b2787b 100644
--- a/src/utils/SkTextureCompressor_LATC.cpp
+++ b/src/utils/SkTextureCompressor_LATC.cpp
@@ -485,7 +485,7 @@ bool CompressA8ToLATC(uint8_t* dst, const uint8_t* src, int width, int height, s
SkBlitter* CreateLATCBlitter(int width, int height, void* outputBuffer,
SkTBlitterAllocator* allocator) {
if ((width % 4) != 0 || (height % 4) != 0) {
- return NULL;
+ return nullptr;
}
#if COMPRESS_LATC_FAST
@@ -502,7 +502,7 @@ SkBlitter* CreateLATCBlitter(int width, int height, void* outputBuffer,
(width, height, outputBuffer);
#elif COMPRESS_LATC_SLOW
// TODO (krajcevski)
- return NULL;
+ return nullptr;
#endif
}
diff --git a/src/utils/SkTextureCompressor_R11EAC.cpp b/src/utils/SkTextureCompressor_R11EAC.cpp
index c7edf37183..291820b4d7 100644
--- a/src/utils/SkTextureCompressor_R11EAC.cpp
+++ b/src/utils/SkTextureCompressor_R11EAC.cpp
@@ -638,7 +638,7 @@ SkBlitter* CreateR11EACBlitter(int width, int height, void* outputBuffer,
SkTBlitterAllocator* allocator) {
if ((width % 4) != 0 || (height % 4) != 0) {
- return NULL;
+ return nullptr;
}
// Memset the output buffer to an encoding that decodes to zero. We must do this
diff --git a/src/utils/SkThreadUtils.h b/src/utils/SkThreadUtils.h
index 8963981596..e89bc6d09b 100644
--- a/src/utils/SkThreadUtils.h
+++ b/src/utils/SkThreadUtils.h
@@ -14,7 +14,7 @@ class SkThread : SkNoncopyable {
public:
typedef void (*entryPointProc)(void*);
- SkThread(entryPointProc entryPoint, void* data = NULL);
+ SkThread(entryPointProc entryPoint, void* data = nullptr);
/**
* Non-virtual, do not subclass.
diff --git a/src/utils/SkThreadUtils_pthread.cpp b/src/utils/SkThreadUtils_pthread.cpp
index 7dec907df1..0bd804d43a 100644
--- a/src/utils/SkThreadUtils_pthread.cpp
+++ b/src/utils/SkThreadUtils_pthread.cpp
@@ -14,8 +14,8 @@
#include <signal.h>
PThreadEvent::PThreadEvent() : fConditionFlag(false) {
- pthread_cond_init(&fCondition, NULL);
- pthread_mutex_init(&fConditionMutex, NULL);
+ pthread_cond_init(&fCondition, nullptr);
+ pthread_mutex_init(&fConditionMutex, nullptr);
}
PThreadEvent::~PThreadEvent() {
pthread_mutex_destroy(&fConditionMutex);
@@ -65,7 +65,7 @@ static void* thread_start(void* arg) {
if (!pthreadData->fCanceled.isTriggered()) {
pthreadData->fEntryPoint(pthreadData->fParam);
}
- return NULL;
+ return nullptr;
}
SkThread::SkThread(entryPointProc entryPoint, void* data) {
@@ -81,7 +81,7 @@ SkThread::SkThread(entryPointProc entryPoint, void* data) {
}
SkThread::~SkThread() {
- if (fData != NULL) {
+ if (fData != nullptr) {
SkThread_PThreadData* pthreadData = static_cast<SkThread_PThreadData*>(fData);
// If created thread but start was never called, kill the thread.
if (pthreadData->fValidPThread && !pthreadData->fStarted.isTriggered()) {
@@ -113,5 +113,5 @@ void SkThread::join() {
return;
}
- pthread_join(pthreadData->fPThread, NULL);
+ pthread_join(pthreadData->fPThread, nullptr);
}
diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp
index a064d3b6b3..a5efb939f3 100644
--- a/src/utils/SkThreadUtils_win.cpp
+++ b/src/utils/SkThreadUtils_win.cpp
@@ -11,17 +11,17 @@
#include "SkThreadUtils_win.h"
SkThread_WinData::SkThread_WinData(SkThread::entryPointProc entryPoint, void* data)
- : fHandle(NULL)
+ : fHandle(nullptr)
, fParam(data)
, fThreadId(0)
, fEntryPoint(entryPoint)
, fStarted(false)
{
fCancelEvent = CreateEvent(
- NULL, // default security attributes
+ nullptr, // default security attributes
false, //auto reset
false, //not signaled
- NULL); //no name
+ nullptr); //no name
}
SkThread_WinData::~SkThread_WinData() {
@@ -44,12 +44,12 @@ SkThread::SkThread(entryPointProc entryPoint, void* data) {
SkThread_WinData* winData = new SkThread_WinData(entryPoint, data);
fData = winData;
- if (NULL == winData->fCancelEvent) {
+ if (nullptr == winData->fCancelEvent) {
return;
}
winData->fHandle = CreateThread(
- NULL, // default security attributes
+ nullptr, // default security attributes
0, // use default stack size
thread_start, // thread function name (proxy)
winData, // argument to thread function (proxy args)
@@ -58,10 +58,10 @@ SkThread::SkThread(entryPointProc entryPoint, void* data) {
}
SkThread::~SkThread() {
- if (fData != NULL) {
+ if (fData != nullptr) {
SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
// If created thread but start was never called, kill the thread.
- if (winData->fHandle != NULL && !winData->fStarted) {
+ if (winData->fHandle != nullptr && !winData->fStarted) {
if (SetEvent(winData->fCancelEvent) != 0) {
if (this->start()) {
this->join();
@@ -77,7 +77,7 @@ SkThread::~SkThread() {
bool SkThread::start() {
SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
- if (NULL == winData->fHandle) {
+ if (nullptr == winData->fHandle) {
return false;
}
@@ -90,7 +90,7 @@ bool SkThread::start() {
void SkThread::join() {
SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
- if (NULL == winData->fHandle || !winData->fStarted) {
+ if (nullptr == winData->fHandle || !winData->fStarted) {
return;
}
@@ -119,7 +119,7 @@ static unsigned int nth_set_bit(unsigned int n, DWORD_PTR mask) {
bool SkThread::setProcessorAffinity(unsigned int processor) {
SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
- if (NULL == winData->fHandle) {
+ if (nullptr == winData->fHandle) {
return false;
}
diff --git a/src/utils/android/SkAndroidSDKCanvas.cpp b/src/utils/android/SkAndroidSDKCanvas.cpp
index 2eec95f66c..51064736a1 100644
--- a/src/utils/android/SkAndroidSDKCanvas.cpp
+++ b/src/utils/android/SkAndroidSDKCanvas.cpp
@@ -26,16 +26,16 @@ void CheckShader(SkPaint* paint) {
if (shader->isABitmap()) {
return;
}
- if (shader->asACompose(NULL)) {
+ if (shader->asACompose(nullptr)) {
return;
}
- SkShader::GradientType gtype = shader->asAGradient(NULL);
+ SkShader::GradientType gtype = shader->asAGradient(nullptr);
if (gtype == SkShader::kLinear_GradientType ||
gtype == SkShader::kRadial_GradientType ||
gtype == SkShader::kSweep_GradientType) {
return;
}
- paint->setShader(NULL);
+ paint->setShader(nullptr);
}
void Filter(SkPaint* paint) {
@@ -48,7 +48,7 @@ void Filter(SkPaint* paint) {
SkXfermode::Mode mode;
SkXfermode::AsMode(paint->getXfermode(), &mode);
if (mode > SkXfermode::kLighten_Mode) {
- paint->setXfermode(NULL);
+ paint->setXfermode(nullptr);
}
// Force bilinear scaling or none
@@ -70,22 +70,22 @@ void Filter(SkPaint* paint) {
paint->setColorFilter(
SkColorFilter::CreateModeFilter(color, SkXfermode::kSrcOver_Mode));
} else if (!isMode && !cf->asColorMatrix(srcColorMatrix)) {
- paint->setColorFilter(NULL);
+ paint->setColorFilter(nullptr);
}
}
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
SkPathEffect* pe = paint->getPathEffect();
if (pe && !pe->exposedInAndroidJavaAPI()) {
- paint->setPathEffect(NULL);
+ paint->setPathEffect(nullptr);
}
#endif
// TODO: Android doesn't support all the flags that can be passed to
// blur filters; we need plumbing to get them out.
- paint->setImageFilter(NULL);
- paint->setLooper(NULL);
+ paint->setImageFilter(nullptr);
+ paint->setLooper(nullptr);
};
} // namespace
@@ -103,7 +103,7 @@ void Filter(SkPaint* paint) {
}
-SkAndroidSDKCanvas::SkAndroidSDKCanvas() : fProxyTarget(NULL) { }
+SkAndroidSDKCanvas::SkAndroidSDKCanvas() : fProxyTarget(nullptr) { }
void SkAndroidSDKCanvas::reset(SkCanvas* newTarget) { fProxyTarget = newTarget; }
@@ -292,7 +292,7 @@ bool SkAndroidSDKCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
SkASSERT(pmap);
SkImageInfo info;
size_t rowBytes;
- const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, NULL);
+ const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, nullptr);
if (addr) {
pmap->reset(info, addr, rowBytes);
return true;
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 5ce9067546..f163cc5470 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -50,7 +50,7 @@ public:
return gTable[idx];
}
- Factory getFactory() const override { return NULL; }
+ Factory getFactory() const override { return nullptr; }
#ifndef SK_IGNORE_TO_STRING
void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
#endif
@@ -64,13 +64,13 @@ public:
bool overrideFilterQuality,
SkFilterQuality quality)
: INHERITED(width, height)
- , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : NULL)
+ , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr)
, fOverrideFilterQuality(overrideFilterQuality)
, fFilterQuality(quality) {}
protected:
void onFilterPaint(SkPaint* paint, Type) const override {
- if (NULL != fOverdrawXfermode.get()) {
+ if (nullptr != fOverdrawXfermode.get()) {
paint->setAntiAlias(false);
paint->setXfermode(fOverdrawXfermode.get());
}
@@ -100,7 +100,7 @@ private:
SkDebugCanvas::SkDebugCanvas(int width, int height)
: INHERITED(width, height)
- , fPicture(NULL)
+ , fPicture(nullptr)
, fFilter(false)
, fMegaVizMode(false)
, fOverdrawViz(false)
@@ -359,7 +359,7 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
void SkDebugCanvas::updatePaintFilterCanvas() {
if (!fOverdrawViz && !fOverrideFilterQuality) {
- fPaintFilterCanvas.reset(NULL);
+ fPaintFilterCanvas.reset(nullptr);
return;
}
@@ -515,7 +515,7 @@ void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPo
SkXfermode*, const uint16_t indices[], int indexCount,
const SkPaint& paint) {
this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
- texs, colors, NULL, indices, indexCount, paint));
+ texs, colors, nullptr, indices, indexCount, paint));
}
void SkDebugCanvas::willRestore() {
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 75d847493b..a9415dd924 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -63,7 +63,7 @@ const char* SkDrawCommand::GetCommandString(OpType type) {
break;
}
SkDEBUGFAIL("DrawType UNUSED\n");
- return NULL;
+ return nullptr;
}
SkString SkDrawCommand::toString() const {
@@ -114,7 +114,7 @@ void render_path(SkCanvas* canvas, const SkPath& path) {
canvas->restore();
}
-void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRect = NULL) {
+void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRect = nullptr) {
const SkISize& size = canvas->getDeviceSize();
SkScalar xScale = SkIntToScalar(size.fWidth-2) / input.width();
@@ -270,7 +270,7 @@ SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left,
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
- fPaintPtr = NULL;
+ fPaintPtr = nullptr;
}
fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -300,7 +300,7 @@ SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
- fPaintPtr = NULL;
+ fPaintPtr = nullptr;
}
fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -336,7 +336,7 @@ SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
- fPaintPtr = NULL;
+ fPaintPtr = nullptr;
}
fConstraint = constraint;
@@ -764,7 +764,7 @@ SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
- fPaintPtr = NULL;
+ fPaintPtr = nullptr;
}
fInfo.push(SkObjectParser::BitmapToString(bitmap));
@@ -829,7 +829,7 @@ SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe
void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) const {
canvas->drawTextOnPath(fText, fByteLength, fPath,
- fMatrix.isIdentity() ? NULL : &fMatrix,
+ fMatrix.isIdentity() ? nullptr : &fMatrix,
fPaint);
}
@@ -850,14 +850,14 @@ SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver
fTexs = new SkPoint[vertexCount];
memcpy(fTexs, texs, vertexCount * sizeof(SkPoint));
} else {
- fTexs = NULL;
+ fTexs = nullptr;
}
if (colors) {
fColors = new SkColor[vertexCount];
memcpy(fColors, colors, vertexCount * sizeof(SkColor));
} else {
- fColors = NULL;
+ fColors = nullptr;
}
fXfermode = xfermode;
@@ -869,7 +869,7 @@ SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver
fIndices = new uint16_t[indexCount];
memcpy(fIndices, indices, indexCount * sizeof(uint16_t));
} else {
- fIndices = NULL;
+ fIndices = nullptr;
}
fIndexCount = indexCount;
@@ -924,7 +924,7 @@ SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain
fPaint = *paint;
fPaintPtr = &fPaint;
} else {
- fPaintPtr = NULL;
+ fPaintPtr = nullptr;
}
fFlags = flags;
@@ -938,7 +938,7 @@ SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain
}
void SkSaveLayerCommand::execute(SkCanvas* canvas) const {
- canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds,
+ canvas->saveLayer(fBounds.isEmpty() ? nullptr : &fBounds,
fPaintPtr,
fFlags);
}
diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h
index b8eca799e7..c7e5f008a4 100644
--- a/src/utils/debugger/SkDrawCommand.h
+++ b/src/utils/debugger/SkDrawCommand.h
@@ -250,7 +250,7 @@ public:
void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; }
- const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; }
+ const SkRect* srcRect() const { return fSrc.isEmpty() ? nullptr : &fSrc; }
void setSrcRect(const SkRect& src) { fSrc = src; }
const SkRect& dstRect() const { return fDst; }
diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp
index cba8d067e1..03820e11f4 100644
--- a/src/utils/debugger/SkObjectParser.cpp
+++ b/src/utils/debugger/SkObjectParser.cpp
@@ -151,7 +151,7 @@ SkString* SkObjectParser::PathToString(const SkPath& path) {
mPath->append(gConvexityStrings[path.getConvexity()]);
mPath->append(", ");
- if (path.isRect(NULL)) {
+ if (path.isRect(nullptr)) {
mPath->append("isRect, ");
} else {
mPath->append("isNotRect, ");
@@ -235,7 +235,7 @@ SkString* SkObjectParser::RectToString(const SkRect& rect, const char* title) {
SkString* mRect = new SkString;
- if (NULL == title) {
+ if (nullptr == title) {
mRect->append("SkRect: ");
} else {
mRect->append(title);
@@ -256,7 +256,7 @@ SkString* SkObjectParser::RRectToString(const SkRRect& rrect, const char* title)
SkString* mRRect = new SkString;
- if (NULL == title) {
+ if (nullptr == title) {
mRRect->append("SkRRect (");
if (rrect.isEmpty()) {
mRRect->append("empty");
@@ -358,7 +358,7 @@ SkString* SkObjectParser::TextToString(const void* text, size_t byteLength,
decodedText->append("UTF-16: ");
size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text,
SkToS32(byteLength / 2),
- NULL);
+ nullptr);
SkAutoSTMalloc<0x100, char> utf8(sizeNeeded);
SkUTF16_ToUTF8((uint16_t*)text, SkToS32(byteLength / 2), utf8);
decodedText->append(utf8, sizeNeeded);
diff --git a/src/utils/debugger/SkObjectParser.h b/src/utils/debugger/SkObjectParser.h
index c4d0da0bf8..4c04935257 100644
--- a/src/utils/debugger/SkObjectParser.h
+++ b/src/utils/debugger/SkObjectParser.h
@@ -89,13 +89,13 @@ public:
Returns a string representation of the SkRects coordinates.
@param rect SkRect
*/
- static SkString* RectToString(const SkRect& rect, const char* title = NULL);
+ static SkString* RectToString(const SkRect& rect, const char* title = nullptr);
/**
Returns a string representation of an SkRRect.
@param rrect SkRRect
*/
- static SkString* RRectToString(const SkRRect& rrect, const char* title = NULL);
+ static SkString* RRectToString(const SkRRect& rrect, const char* title = nullptr);
/**
Returns a string representation of the SkRegion enum.
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index 4675d7185e..0cbf704a41 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -101,7 +101,7 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
CGBitmapInfo* info) {
bool upscaleTo32;
if (!getBitmapInfo(bm, bitsPerComponent, info, &upscaleTo32)) {
- return NULL;
+ return nullptr;
}
SkBitmap* copy;
@@ -122,8 +122,8 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
CGBitmapInfo info SK_INIT_TO_AVOID_WARNING;
SkBitmap* bitmap = prepareForImageRef(bm, &bitsPerComponent, &info);
- if (NULL == bitmap) {
- return NULL;
+ if (nullptr == bitmap) {
+ return nullptr;
}
const int w = bitmap->width();
@@ -138,7 +138,7 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
SkBitmap_ReleaseInfo);
bool releaseColorSpace = false;
- if (NULL == colorSpace) {
+ if (nullptr == colorSpace) {
colorSpace = CGColorSpaceCreateDeviceRGB();
releaseColorSpace = true;
}
@@ -146,7 +146,7 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
CGImageRef ref = CGImageCreate(w, h, bitsPerComponent,
bitmap->bytesPerPixel() * 8,
bitmap->rowBytes(), colorSpace, info, dataRef,
- NULL, false, kCGRenderingIntentDefault);
+ nullptr, false, kCGRenderingIntentDefault);
if (releaseColorSpace) {
CGColorSpaceRelease(colorSpace);
@@ -192,19 +192,19 @@ private:
bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
CGDataProviderRef data = SkCreateDataProviderFromStream(stream);
- if (NULL == data) {
+ if (nullptr == data) {
return false;
}
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
CGDataProviderRelease(data);
- if (NULL == pdf) {
+ if (nullptr == pdf) {
return false;
}
SkAutoPDFRelease releaseMe(pdf);
CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
- if (NULL == page) {
+ if (nullptr == page) {
return false;
}
@@ -221,7 +221,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
size_t bitsPerComponent;
CGBitmapInfo info;
- getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
+ getBitmapInfo(bitmap, &bitsPerComponent, &info, nullptr);
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
@@ -261,7 +261,7 @@ SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, vo
CGContextRef cg = CGBitmapContextCreate(pixels, info.width(), info.height(), bitsPerComponent,
rowBytes, cs, cg_bitmap_info);
CFRelease(cs);
- if (NULL == cg) {
+ if (nullptr == cg) {
return false;
}
diff --git a/src/utils/win/SkAutoCoInitialize.cpp b/src/utils/win/SkAutoCoInitialize.cpp
index 89115bfe41..78326a5608 100644
--- a/src/utils/win/SkAutoCoInitialize.cpp
+++ b/src/utils/win/SkAutoCoInitialize.cpp
@@ -14,7 +14,7 @@
SkAutoCoInitialize::SkAutoCoInitialize() :
fHR(
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
+ CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
)
{ }
diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp
index 363ac438d9..2254961d14 100644
--- a/src/utils/win/SkDWrite.cpp
+++ b/src/utils/win/SkDWrite.cpp
@@ -12,7 +12,7 @@
#include <dwrite.h>
-static IDWriteFactory* gDWriteFactory = NULL;
+static IDWriteFactory* gDWriteFactory = nullptr;
static void release_dwrite_factory() {
if (gDWriteFactory) {
@@ -52,7 +52,7 @@ IDWriteFactory* sk_get_dwrite_factory() {
/** Converts a utf8 string to a WCHAR string. */
HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name) {
- int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, NULL, 0);
+ int wlen = MultiByteToWideChar(CP_UTF8, 0, skname, -1, nullptr, 0);
if (0 == wlen) {
HRM(HRESULT_FROM_WIN32(GetLastError()),
"Could not get length for wchar to utf-8 conversion.");
@@ -67,7 +67,7 @@ HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name) {
/** Converts a WCHAR string to a utf8 string. */
HRESULT sk_wchar_to_skstring(WCHAR* name, int nameLen, SkString* skname) {
- int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, NULL, 0, NULL, NULL);
+ int len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, nullptr, 0, nullptr, nullptr);
if (0 == len) {
if (nameLen <= 0) {
skname->reset();
@@ -78,7 +78,7 @@ HRESULT sk_wchar_to_skstring(WCHAR* name, int nameLen, SkString* skname) {
}
skname->resize(len);
- len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, NULL, NULL);
+ len = WideCharToMultiByte(CP_UTF8, 0, name, nameLen, skname->writable_str(), len, nullptr, nullptr);
if (0 == len) {
HRM(HRESULT_FROM_WIN32(GetLastError()), "Could not convert utf-8 to wchar.");
}
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index eb7e5dccaf..0e3d4fc202 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -20,8 +20,8 @@
SkDWriteFontFileStream::SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream)
: fFontFileStream(SkRefComPtr(fontFileStream))
, fPos(0)
- , fLockedMemory(NULL)
- , fFragmentLock(NULL) {
+ , fLockedMemory(nullptr)
+ , fFragmentLock(nullptr) {
}
SkDWriteFontFileStream::~SkDWriteFontFileStream() {
@@ -33,7 +33,7 @@ SkDWriteFontFileStream::~SkDWriteFontFileStream() {
size_t SkDWriteFontFileStream::read(void* buffer, size_t size) {
HRESULT hr = S_OK;
- if (NULL == buffer) {
+ if (nullptr == buffer) {
size_t fileSize = this->getLength();
if (fPos + size > fileSize) {
@@ -137,7 +137,7 @@ HRESULT SkDWriteFontFileStreamWrapper::Create(SkStreamAsset* stream,
SkDWriteFontFileStreamWrapper** streamFontFileStream)
{
*streamFontFileStream = new SkDWriteFontFileStreamWrapper(stream);
- if (NULL == streamFontFileStream) {
+ if (nullptr == streamFontFileStream) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -153,7 +153,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::QueryInterface(REFIID i
AddRef();
return S_OK;
} else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -180,8 +180,8 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment(
UINT64 fileSize;
this->GetFileSize(&fileSize);
if (fileOffset > fileSize || fragmentSize > fileSize - fileOffset) {
- *fragmentStart = NULL;
- *fragmentContext = NULL;
+ *fragmentStart = nullptr;
+ *fragmentContext = nullptr;
return E_FAIL;
}
@@ -192,14 +192,14 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment(
const void* data = fStream->getMemoryBase();
if (data) {
*fragmentStart = static_cast<BYTE const*>(data) + static_cast<size_t>(fileOffset);
- *fragmentContext = NULL;
+ *fragmentContext = nullptr;
} else {
// May be called from multiple threads.
SkAutoMutexAcquire ama(fStreamMutex);
- *fragmentStart = NULL;
- *fragmentContext = NULL;
+ *fragmentStart = nullptr;
+ *fragmentContext = nullptr;
if (!fStream->seek(static_cast<size_t>(fileOffset))) {
return E_FAIL;
diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp
index b7ef88ba3b..066d4a4674 100644
--- a/src/utils/win/SkDWriteGeometrySink.cpp
+++ b/src/utils/win/SkDWriteGeometrySink.cpp
@@ -19,7 +19,7 @@ SkDWriteGeometrySink::SkDWriteGeometrySink(SkPath* path) : fRefCount(1), fPath(p
SkDWriteGeometrySink::~SkDWriteGeometrySink() { }
HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void **object) {
- if (NULL == object) {
+ if (nullptr == object) {
return E_INVALIDARG;
}
if (iid == __uuidof(IUnknown) || iid == __uuidof(IDWriteGeometrySink)) {
@@ -27,7 +27,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void
this->AddRef();
return S_OK;
} else {
- *object = NULL;
+ *object = nullptr;
return E_NOINTERFACE;
}
}
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 0aea4a622e..d565986d10 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -15,23 +15,23 @@ void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg
}
SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr);
- LPSTR errorText = NULL;
+ LPSTR errorText = nullptr;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
hr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) &errorText,
0,
- NULL
+ nullptr
);
- if (NULL == errorText) {
+ if (nullptr == errorText) {
SkDebugf("<unknown>\n");
} else {
SkDebugf("%s", errorText);
LocalFree(errorText);
- errorText = NULL;
+ errorText = nullptr;
}
}
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index dc9d1636d7..f1dbcb274c 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -22,7 +22,7 @@ SkBaseIStream::~SkBaseIStream() { }
HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid
, void ** ppvObject)
{
- if (NULL == ppvObject) {
+ if (nullptr == ppvObject) {
return E_INVALIDARG;
}
if (iid == __uuidof(IUnknown)
@@ -33,7 +33,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid
AddRef();
return S_OK;
} else {
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
@@ -122,7 +122,7 @@ HRESULT SkIStream::CreateFromSkStream(SkStream* stream
, bool deleteOnRelease
, IStream ** ppStream)
{
- if (NULL == stream) {
+ if (nullptr == stream) {
return E_INVALIDARG;
}
*ppStream = new SkIStream(stream, deleteOnRelease);
@@ -208,7 +208,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg
if (0 == (grfStatFlag & STATFLAG_NONAME)) {
return STG_E_INVALIDFLAG;
}
- pStatstg->pwcsName = NULL;
+ pStatstg->pwcsName = nullptr;
// FIXME: Should not depend on getLength
// See https://code.google.com/p/skia/issues/detail?id=1570
pStatstg->cbSize.QuadPart = this->fSkStream->getLength();
@@ -268,7 +268,7 @@ HRESULT STDMETHODCALLTYPE SkWIStream::Stat(STATSTG* pStatstg
if (0 == (grfStatFlag & STATFLAG_NONAME)) {
return STG_E_INVALIDFLAG;
}
- pStatstg->pwcsName = NULL;
+ pStatstg->pwcsName = nullptr;
pStatstg->cbSize.QuadPart = 0;
pStatstg->clsid = CLSID_NULL;
pStatstg->type = STGTY_STREAM;
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 60f3cb34a4..ef07bea61e 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -13,7 +13,7 @@
#include "SkTSort.h"
bool SkWGLExtensions::hasExtension(HDC dc, const char* ext) const {
- if (NULL == this->fGetExtensionsString) {
+ if (nullptr == this->fGetExtensionsString) {
return false;
}
if (!strcmp("WGL_ARB_extensions_string", ext)) {
@@ -168,7 +168,7 @@ namespace {
#define DUMMY_CLASS STR_LIT("DummyClass")
HWND create_dummy_window() {
- HMODULE module = GetModuleHandle(NULL);
+ HMODULE module = GetModuleHandle(nullptr);
HWND dummy;
RECT windowRect;
windowRect.left = 0;
@@ -183,10 +183,10 @@ HWND create_dummy_window() {
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
- wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
+ wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wc.hbrBackground = nullptr;
+ wc.lpszMenuName = nullptr;
wc.lpszClassName = DUMMY_CLASS;
if(!RegisterClass(&wc)) {
@@ -205,11 +205,11 @@ HWND create_dummy_window() {
0, 0,
windowRect.right-windowRect.left,
windowRect.bottom-windowRect.top,
- NULL, NULL,
+ nullptr, nullptr,
module,
- NULL))) {
+ nullptr))) {
UnregisterClass(DUMMY_CLASS, module);
- return NULL;
+ return nullptr;
}
ShowWindow(dummy, SW_HIDE);
@@ -218,7 +218,7 @@ HWND create_dummy_window() {
void destroy_dummy_window(HWND dummy) {
DestroyWindow(dummy);
- HMODULE module = GetModuleHandle(NULL);
+ HMODULE module = GetModuleHandle(nullptr);
UnregisterClass(DUMMY_CLASS, module);
}
}
@@ -227,16 +227,16 @@ void destroy_dummy_window(HWND dummy) {
(##NAME##Proc) wglGetProcAddress("wgl" #NAME #SUFFIX)
SkWGLExtensions::SkWGLExtensions()
- : fGetExtensionsString(NULL)
- , fChoosePixelFormat(NULL)
- , fGetPixelFormatAttribfv(NULL)
- , fGetPixelFormatAttribiv(NULL)
- , fCreateContextAttribs(NULL)
- , fSwapInterval(NULL)
- , fCreatePbuffer(NULL)
- , fGetPbufferDC(NULL)
- , fReleasePbufferDC(NULL)
- , fDestroyPbuffer(NULL)
+ : fGetExtensionsString(nullptr)
+ , fChoosePixelFormat(nullptr)
+ , fGetPixelFormatAttribfv(nullptr)
+ , fGetPixelFormatAttribiv(nullptr)
+ , fCreateContextAttribs(nullptr)
+ , fSwapInterval(nullptr)
+ , fCreatePbuffer(nullptr)
+ , fGetPbufferDC(nullptr)
+ , fReleasePbufferDC(nullptr)
+ , fDestroyPbuffer(nullptr)
{
HDC prevDC = wglGetCurrentDC();
HGLRC prevGLRC = wglGetCurrentContext();
@@ -272,7 +272,7 @@ SkWGLExtensions::SkWGLExtensions()
GET_PROC(ReleasePbufferDC, ARB);
GET_PROC(DestroyPbuffer, ARB);
- wglMakeCurrent(dummyDC, NULL);
+ wglMakeCurrent(dummyDC, nullptr);
wglDeleteContext(dummyGLRC);
destroy_dummy_window(dummyWND);
}
@@ -329,11 +329,11 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
HDC prevDC = wglGetCurrentDC();
HGLRC prevGLRC = wglGetCurrentContext();
- HGLRC glrc = NULL;
+ HGLRC glrc = nullptr;
if (kGLES_SkWGLContextRequest == contextType) {
if (!extensions.hasExtension(dc, "WGL_EXT_create_context_es2_profile")) {
wglMakeCurrent(prevDC, prevGLRC);
- return NULL;
+ return nullptr;
}
static const int glesAttribs[] = {
SK_WGL_CONTEXT_MAJOR_VERSION, 3,
@@ -341,10 +341,10 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_ES2_PROFILE_BIT,
0,
};
- glrc = extensions.createContextAttribs(dc, NULL, glesAttribs);
- if (NULL == glrc) {
+ glrc = extensions.createContextAttribs(dc, nullptr, glesAttribs);
+ if (nullptr == glrc) {
wglMakeCurrent(prevDC, prevGLRC);
- return NULL;
+ return nullptr;
}
} else {
if (kGLPreferCoreProfile_SkWGLContextRequest == contextType &&
@@ -366,7 +366,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
coreProfileAttribs[1] = kCoreGLVersions[2 * v];
coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
- glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs);
+ glrc = extensions.createContextAttribs(dc, nullptr, coreProfileAttribs);
if (glrc) {
break;
}
@@ -374,7 +374,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
}
}
- if (NULL == glrc) {
+ if (nullptr == glrc) {
glrc = wglCreateContext(dc);
}
SkASSERT(glrc);
@@ -391,7 +391,7 @@ static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR
HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contextType) {
SkWGLExtensions extensions;
if (!extensions.hasExtension(dc, "WGL_ARB_pixel_format")) {
- return NULL;
+ return nullptr;
}
BOOL set = FALSE;
@@ -407,7 +407,7 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contex
}
if (!set) {
- return NULL;
+ return nullptr;
}
return create_gl_context(dc, extensions, contextType);}
@@ -417,7 +417,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou
SkWGLExtensions extensions;
if (!extensions.hasExtension(parentDC, "WGL_ARB_pixel_format") ||
!extensions.hasExtension(parentDC, "WGL_ARB_pbuffer")) {
- return NULL;
+ return nullptr;
}
// try for single buffer first
@@ -426,7 +426,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou
get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSampleCount,
pixelFormatsToTry);
for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry); ++f) {
- HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, NULL);
+ HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, nullptr);
if (0 != pbuf) {
HDC dc = extensions.getPbufferDC(pbuf);
if (dc) {
@@ -440,7 +440,7 @@ SkWGLPbufferContext* SkWGLPbufferContext::Create(HDC parentDC, int msaaSampleCou
}
}
}
- return NULL;
+ return nullptr;
}
SkWGLPbufferContext::~SkWGLPbufferContext() {
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 5f204c0f0f..5316b49a1d 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -11,14 +11,14 @@
void SkEvent::initialize(const char* type, size_t typeLen,
SkEventSinkID targetID) {
- fType = NULL;
+ fType = nullptr;
setType(type, typeLen);
f32 = 0;
fTargetID = targetID;
- fTargetProc = NULL;
+ fTargetProc = nullptr;
#ifdef SK_DEBUG
fTime = 0;
- fNextEvent = NULL;
+ fNextEvent = nullptr;
#endif
}
@@ -128,7 +128,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
this->setType(name);
const char* value;
- if ((value = dom.findAttr(node, "fast32")) != NULL)
+ if ((value = dom.findAttr(node, "fast32")) != nullptr)
{
int32_t n;
if (SkParse::FindS32(value, &n))
@@ -144,25 +144,25 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
}
name = dom.findAttr(node, "name");
- if (name == NULL)
+ if (name == nullptr)
{
SkDEBUGCODE(SkDebugf("SkEvent::inflate missing required \"name\" attribute in <data> subelement\n");)
continue;
}
- if ((value = dom.findAttr(node, "s32")) != NULL)
+ if ((value = dom.findAttr(node, "s32")) != nullptr)
{
int32_t n;
if (SkParse::FindS32(value, &n))
this->setS32(name, n);
}
- else if ((value = dom.findAttr(node, "scalar")) != NULL)
+ else if ((value = dom.findAttr(node, "scalar")) != nullptr)
{
SkScalar x;
if (SkParse::FindScalar(value, &x))
this->setScalar(name, x);
}
- else if ((value = dom.findAttr(node, "string")) != NULL)
+ else if ((value = dom.findAttr(node, "string")) != nullptr)
this->setString(name, value);
#ifdef SK_DEBUG
else
@@ -194,7 +194,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
int count;
const char* name;
- while ((name = iter.next(&mtype, &count)) != NULL)
+ while ((name = iter.next(&mtype, &count)) != nullptr)
{
SkASSERT(count > 0);
@@ -209,7 +209,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
break;
case SkMetaData::kScalar_Type:
{
- const SkScalar* values = md.findScalars(name, &count, NULL);
+ const SkScalar* values = md.findScalars(name, &count, nullptr);
SkDebugf("%f", SkScalarToFloat(values[0]));
for (int i = 1; i < count; i++)
SkDebugf(", %f", SkScalarToFloat(values[i]));
@@ -271,9 +271,9 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
class SkEvent_Globals {
public:
SkEvent_Globals() {
- fEventQHead = NULL;
- fEventQTail = NULL;
- fDelayQHead = NULL;
+ fEventQHead = nullptr;
+ fEventQTail = nullptr;
+ fDelayQHead = nullptr;
SkDEBUGCODE(fEventCounter = 0;)
}
@@ -338,14 +338,14 @@ bool SkEvent::Enqueue(SkEvent* evt) {
SkASSERT(evt);
- bool wasEmpty = globals.fEventQHead == NULL;
+ bool wasEmpty = globals.fEventQHead == nullptr;
if (globals.fEventQTail)
globals.fEventQTail->fNextEvent = evt;
globals.fEventQTail = evt;
- if (globals.fEventQHead == NULL)
+ if (globals.fEventQHead == nullptr)
globals.fEventQHead = evt;
- evt->fNextEvent = NULL;
+ evt->fNextEvent = nullptr;
SkDEBUGCODE(++globals.fEventCounter);
@@ -361,8 +361,8 @@ SkEvent* SkEvent::Dequeue() {
SkDEBUGCODE(--globals.fEventCounter);
globals.fEventQHead = evt->fNextEvent;
- if (globals.fEventQHead == NULL) {
- globals.fEventQTail = NULL;
+ if (globals.fEventQHead == nullptr) {
+ globals.fEventQTail = nullptr;
}
}
globals.fEventMutex.release();
@@ -374,7 +374,7 @@ bool SkEvent::QHasEvents() {
SkEvent_Globals& globals = getGlobals();
// this is not thread accurate, need a semaphore for that
- return globals.fEventQHead != NULL;
+ return globals.fEventQHead != nullptr;
}
#ifdef SK_TRACE_EVENTS
@@ -386,7 +386,7 @@ SkMSec SkEvent::EnqueueTime(SkEvent* evt, SkMSec time) {
// gEventMutex acquired by caller
SkEvent* curr = globals.fDelayQHead;
- SkEvent* prev = NULL;
+ SkEvent* prev = nullptr;
while (curr) {
if (SkMSec_LT(time, curr->fTime)) {
@@ -398,7 +398,7 @@ SkMSec SkEvent::EnqueueTime(SkEvent* evt, SkMSec time) {
evt->fTime = time;
evt->fNextEvent = curr;
- if (prev == NULL) {
+ if (prev == nullptr) {
globals.fDelayQHead = evt;
} else {
prev->fNextEvent = evt;
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 282f2b8ad6..003bf8c4fe 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -16,7 +16,7 @@ class SkEventSink_Globals {
public:
SkEventSink_Globals() {
fNextSinkID = 0;
- fSinkHead = NULL;
+ fSinkHead = nullptr;
}
SkMutex fSinkMutex;
@@ -30,7 +30,7 @@ static SkEventSink_Globals& getGlobals() {
return *gGlobals;
}
-SkEventSink::SkEventSink() : fTagHead(NULL) {
+SkEventSink::SkEventSink() : fTagHead(nullptr) {
SkEventSink_Globals& globals = getGlobals();
globals.fSinkMutex.acquire();
@@ -51,7 +51,7 @@ SkEventSink::~SkEventSink() {
globals.fSinkMutex.acquire();
SkEventSink* sink = globals.fSinkHead;
- SkEventSink* prev = NULL;
+ SkEventSink* prev = nullptr;
for (;;) {
SkEventSink* next = sink->fNextSink;
@@ -89,12 +89,12 @@ bool SkEventSink::onQuery(SkEvent*) {
///////////////////////////////////////////////////////////////////////////////
SkTagList* SkEventSink::findTagList(U8CPU tag) const {
- return fTagHead ? SkTagList::Find(fTagHead, tag) : NULL;
+ return fTagHead ? SkTagList::Find(fTagHead, tag) : nullptr;
}
void SkEventSink::addTagList(SkTagList* rec) {
SkASSERT(rec);
- SkASSERT(fTagHead == NULL || SkTagList::Find(fTagHead, rec->fTag) == NULL);
+ SkASSERT(fTagHead == nullptr || SkTagList::Find(fTagHead, rec->fTag) == nullptr);
rec->fNext = fTagHead;
fTagHead = rec;
@@ -162,7 +162,7 @@ void SkEventSink::addListenerID(SkEventSinkID id)
void SkEventSink::copyListeners(const SkEventSink& sink)
{
SkListenersTagList* sinkList = (SkListenersTagList*)sink.findTagList(kListeners_SkTagList);
- if (sinkList == NULL)
+ if (sinkList == nullptr)
return;
SkASSERT(sinkList->countListners() > 0);
const SkEventSinkID* iter = sinkList->fIDs;
@@ -178,7 +178,7 @@ void SkEventSink::removeListenerID(SkEventSinkID id)
SkListenersTagList* list = (SkListenersTagList*)this->findTagList(kListeners_SkTagList);
- if (list == NULL)
+ if (list == nullptr)
return;
int index = list->find(id);
@@ -199,7 +199,7 @@ void SkEventSink::removeListenerID(SkEventSinkID id)
bool SkEventSink::hasListeners() const
{
- return this->findTagList(kListeners_SkTagList) != NULL;
+ return this->findTagList(kListeners_SkTagList) != nullptr;
}
void SkEventSink::postToListeners(const SkEvent& evt, SkMSec delay) {
@@ -246,7 +246,7 @@ SkEventSink* SkEventSink::FindSink(SkEventSinkID sinkID)
return sink;
sink = sink->fNextSink;
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index 8c2e47602f..ec92a7b4a5 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -28,7 +28,7 @@ const SkOSMenu::Item* SkOSMenu::getItemByID(int itemID) const {
if (itemID == fItems[i]->getID())
return fItems[i];
}
- return NULL;
+ return nullptr;
}
void SkOSMenu::getItems(const SkOSMenu::Item* items[]) const {
@@ -155,7 +155,7 @@ int SkOSMenu::appendList(const char label[], const char slotName[],
SkString str(option);
va_start(args, option);
int count = 1;
- for (const char* arg = va_arg(args, const char*); arg != NULL; arg = va_arg(args, const char*)) {
+ for (const char* arg = va_arg(args, const char*); arg != nullptr; arg = va_arg(args, const char*)) {
str += gDelimiter;
str += arg;
++count;
@@ -206,13 +206,13 @@ bool SkOSMenu::FindListItemCount(const SkEvent& evt, int* count) {
bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) {
if (evt.isType(gMenuEventType) && items) {
const char* text = evt.findString(gList_Items_Str);
- if (text != NULL) {
+ if (text != nullptr) {
SkString temp(text);
char* token = strtok((char*)temp.c_str(), gDelimiter);
int index = 0;
- while (token != NULL) {
+ while (token != nullptr) {
items[index].set(token, strlen(token));
- token = strtok (NULL, gDelimiter);
+ token = strtok (nullptr, gDelimiter);
++index;
}
}
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
index 5b4476423e..1a1b7067ba 100644
--- a/src/views/SkParsePaint.cpp
+++ b/src/views/SkParsePaint.cpp
@@ -13,8 +13,8 @@
static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
{
- if ((node = dom.getFirstChild(node, "shader")) == NULL)
- return NULL;
+ if ((node = dom.getFirstChild(node, "shader")) == nullptr)
+ return nullptr;
const char* str;
@@ -24,9 +24,9 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
SkPoint pts[2];
colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
- if ((str = dom.findAttr(node, "c0")) != NULL &&
+ if ((str = dom.findAttr(node, "c0")) != nullptr &&
SkParse::FindColor(str, &colors[0]) &&
- (str = dom.findAttr(node, "c1")) != NULL &&
+ (str = dom.findAttr(node, "c1")) != nullptr &&
SkParse::FindColor(str, &colors[1]) &&
dom.findScalars(node, "p0", &pts[0].fX, 2) &&
dom.findScalars(node, "p1", &pts[1].fX, 2))
@@ -36,13 +36,13 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
mode = (SkShader::TileMode)index;
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, mode);
}
}
else if (dom.hasAttr(node, "type", "bitmap"))
{
- if ((str = dom.findAttr(node, "src")) == NULL)
- return NULL;
+ if ((str = dom.findAttr(node, "src")) == nullptr)
+ return nullptr;
SkBitmap bm;
@@ -57,7 +57,7 @@ static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
return SkShader::CreateBitmapShader(bm, mode, mode);
}
}
- return NULL;
+ return nullptr;
}
void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
diff --git a/src/views/SkProgressView.cpp b/src/views/SkProgressView.cpp
index 03e28eb208..7ce022dd73 100644
--- a/src/views/SkProgressView.cpp
+++ b/src/views/SkProgressView.cpp
@@ -12,11 +12,11 @@
#include "SkInterpolator.h"
#include "SkTime.h"
-SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(NULL), fOffShader(NULL)
+SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(nullptr), fOffShader(nullptr)
{
fValue = 0;
fMax = 0;
- fInterp = NULL;
+ fInterp = nullptr;
fDoInterp = false;
}
@@ -33,7 +33,7 @@ void SkProgressView::setMax(U16CPU max)
{
fMax = SkToU16(max);
if (fValue > 0)
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -52,7 +52,7 @@ void SkProgressView::setValue(U16CPU value)
fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
}
fValue = SkToU16(value);
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -69,12 +69,12 @@ void SkProgressView::onDraw(SkCanvas* canvas)
if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
{
delete fInterp;
- fInterp = NULL;
+ fInterp = nullptr;
}
percent = (SkFixed)x; // now its 16.8
percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
- this->inval(NULL);
+ this->inval(nullptr);
}
else
{
@@ -112,7 +112,7 @@ static SkShader* inflate_shader(const char file[])
return SkImageDecoder::DecodeFile(file, &bm) ?
SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
- NULL;
+ nullptr;
}
void SkProgressView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -121,12 +121,12 @@ void SkProgressView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
const char* s;
- SkASSERT(fOnShader == NULL);
- SkASSERT(fOffShader == NULL);
+ SkASSERT(fOnShader == nullptr);
+ SkASSERT(fOffShader == nullptr);
- if ((s = dom.findAttr(node, "src-on")) != NULL)
+ if ((s = dom.findAttr(node, "src-on")) != nullptr)
fOnShader = inflate_shader(s);
- if ((s = dom.findAttr(node, "src-off")) != NULL)
+ if ((s = dom.findAttr(node, "src-off")) != nullptr)
fOffShader = inflate_shader(s);
(void)dom.findBool(node, "do-interp", &fDoInterp);
}
diff --git a/src/views/SkStackViewLayout.cpp b/src/views/SkStackViewLayout.cpp
index aba6f2e93a..b0c8c8ce02 100644
--- a/src/views/SkStackViewLayout.cpp
+++ b/src/views/SkStackViewLayout.cpp
@@ -79,7 +79,7 @@ static SkScalar compute_children_limit(SkView* parent, GetSizeProc sizeProc, int
SkScalar limit = 0;
int n = 0, flex = 0;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
n += 1;
if (child->getFlags() & flexMask)
@@ -145,7 +145,7 @@ void SkStackViewLayout::onLayoutChildren(SkView* parent)
}
crossLimit += (parent->*crossGetSizeP)();
if (fAlign != kStretch_Align)
- crossSetSizeP = NULL;
+ crossSetSizeP = nullptr;
int childCount, flexCount;
SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
@@ -164,7 +164,7 @@ void SkStackViewLayout::onLayoutChildren(SkView* parent)
if (flexCount > 0 && parentLimit > childLimit)
flexAmount = (parentLimit - childLimit) / flexCount;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
if (fRound)
pos = SkScalarRoundToScalar(pos);
@@ -258,7 +258,7 @@ void SkFillViewLayout::onLayoutChildren(SkView* parent)
SkView::B2FIter iter(parent);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
child->setLoc(fMargin.fLeft, fMargin.fTop);
child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
diff --git a/src/views/SkTagList.cpp b/src/views/SkTagList.cpp
index 8ede870feb..b1d6ff64d3 100644
--- a/src/views/SkTagList.cpp
+++ b/src/views/SkTagList.cpp
@@ -17,7 +17,7 @@ SkTagList* SkTagList::Find(SkTagList* rec, U8CPU tag)
{
SkASSERT(tag < kSkTagListCount);
- while (rec != NULL)
+ while (rec != nullptr)
{
if (rec->fTag == tag)
break;
@@ -31,9 +31,9 @@ void SkTagList::DeleteTag(SkTagList** head, U8CPU tag)
SkASSERT(tag < kSkTagListCount);
SkTagList* rec = *head;
- SkTagList* prev = NULL;
+ SkTagList* prev = nullptr;
- while (rec != NULL)
+ while (rec != nullptr)
{
SkTagList* next = rec->fNext;
diff --git a/src/views/SkTagList.h b/src/views/SkTagList.h
index 47294e3242..1cff9cabe2 100644
--- a/src/views/SkTagList.h
+++ b/src/views/SkTagList.h
@@ -29,7 +29,7 @@ struct SkTagList {
SkTagList(U8CPU tag) : fTag(SkToU8(tag))
{
SkASSERT(tag < kSkTagListCount);
- fNext = NULL;
+ fNext = nullptr;
fExtra16 = 0;
fExtra8 = 0;
}
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index 00702012d9..249737a64b 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -14,7 +14,7 @@ SkView::SkView(uint32_t flags) : fFlags(SkToU8(flags))
{
fWidth = fHeight = 0;
fLoc.set(0, 0);
- fParent = fFirstChild = fNextSibling = fPrevSibling = NULL;
+ fParent = fFirstChild = fNextSibling = fPrevSibling = nullptr;
fMatrix.setIdentity();
fContainsFocus = 0;
}
@@ -31,13 +31,13 @@ void SkView::setFlags(uint32_t flags)
uint32_t diff = fFlags ^ flags;
if (diff & kVisible_Mask)
- this->inval(NULL);
+ this->inval(nullptr);
fFlags = SkToU8(flags);
if (diff & kVisible_Mask)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -67,10 +67,10 @@ void SkView::setSize(SkScalar width, SkScalar height)
if (fWidth != width || fHeight != height)
{
- this->inval(NULL);
+ this->inval(nullptr);
fWidth = width;
fHeight = height;
- this->inval(NULL);
+ this->inval(nullptr);
this->onSizeChange();
this->invokeLayout();
}
@@ -80,9 +80,9 @@ void SkView::setLoc(SkScalar x, SkScalar y)
{
if (fLoc.fX != x || fLoc.fY != y)
{
- this->inval(NULL);
+ this->inval(nullptr);
fLoc.set(x, y);
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -94,9 +94,9 @@ void SkView::offset(SkScalar dx, SkScalar dy)
void SkView::setLocalMatrix(const SkMatrix& matrix)
{
- this->inval(NULL);
+ this->inval(nullptr);
fMatrix = matrix;
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkView::draw(SkCanvas* canvas)
@@ -136,7 +136,7 @@ void SkView::draw(SkCanvas* canvas)
SkCanvas* childCanvas = this->beforeChildren(canvas);
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
child->draw(childCanvas);
this->afterChildren(canvas);
@@ -165,7 +165,7 @@ void SkView::inval(SkRect* rect) {
}
SkView* parent = view->fParent;
- if (parent == NULL) {
+ if (parent == nullptr) {
return;
}
@@ -185,18 +185,18 @@ bool SkView::setFocusView(SkView* fv)
do {
if (view->onSetFocusView(fv))
return true;
- } while ((view = view->fParent) != NULL);
+ } while ((view = view->fParent) != nullptr);
return false;
}
SkView* SkView::getFocusView() const
{
- SkView* focus = NULL;
+ SkView* focus = nullptr;
const SkView* view = this;
do {
if (view->onGetFocusView(&focus))
break;
- } while ((view = view->fParent) != NULL);
+ } while ((view = view->fParent) != nullptr);
return focus;
}
@@ -222,30 +222,30 @@ SkView* SkView::acceptFocus(FocusDirection dir)
B2FIter iter(this);
SkView* child, *focus;
- while ((child = iter.next()) != NULL)
- if ((focus = child->acceptFocus(dir)) != NULL)
+ while ((child = iter.next()) != nullptr)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
}
else // prev
{
F2BIter iter(this);
SkView* child, *focus;
- while ((child = iter.next()) != NULL)
- if ((focus = child->acceptFocus(dir)) != NULL)
+ while ((child = iter.next()) != nullptr)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
if (this->acceptFocus())
return this;
}
- return NULL;
+ return nullptr;
}
SkView* SkView::moveFocus(FocusDirection dir)
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
{ // start with the root
focus = this;
while (focus->fParent)
@@ -267,19 +267,19 @@ SkView* SkView::moveFocus(FocusDirection dir)
while (child != parent->fFirstChild)
{
FIRST_CHILD:
- if ((focus = child->acceptFocus(dir)) != NULL)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
child = child->fNextSibling;
}
NEXT_SIB:
child = parent->fNextSibling;
parent = parent->fParent;
- } while (parent != NULL);
+ } while (parent != nullptr);
}
else // prevfocus
{
parent = focus->fParent;
- if (parent == NULL) // we're the root
+ if (parent == nullptr) // we're the root
return focus->acceptFocus(dir);
else
{
@@ -289,7 +289,7 @@ SkView* SkView::moveFocus(FocusDirection dir)
while (child != parent->fFirstChild)
{
child = child->fPrevSibling;
- if ((focus = child->acceptFocus(dir)) != NULL)
+ if ((focus = child->acceptFocus(dir)) != nullptr)
return focus;
}
if (parent->acceptFocus())
@@ -300,12 +300,12 @@ SkView* SkView::moveFocus(FocusDirection dir)
}
}
}
- return NULL;
+ return nullptr;
}
void SkView::onFocusChange(bool gainFocusP)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
////////////////////////////////////////////////////////////////////////////
@@ -314,9 +314,9 @@ SkView::Click::Click(SkView* target)
{
SkASSERT(target);
fTargetID = target->getSinkID();
- fType = NULL;
+ fType = nullptr;
fWeOwnTheType = false;
- fOwner = NULL;
+ fOwner = nullptr;
}
SkView::Click::~Click()
@@ -331,7 +331,7 @@ void SkView::Click::resetType()
sk_free(fType);
fWeOwnTheType = false;
}
- fType = NULL;
+ fType = nullptr;
}
bool SkView::Click::isType(const char type[]) const
@@ -341,9 +341,9 @@ bool SkView::Click::isType(const char type[]) const
if (type == t)
return true;
- if (type == NULL)
+ if (type == nullptr)
type = "";
- if (t == NULL)
+ if (t == nullptr)
t = "";
return !strcmp(t, type);
}
@@ -371,14 +371,14 @@ void SkView::Click::copyType(const char type[])
SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y, unsigned modi) {
if (x < 0 || y < 0 || x >= fWidth || y >= fHeight) {
- return NULL;
+ return nullptr;
}
if (this->onSendClickToChildren(x, y, modi)) {
F2BIter iter(this);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
SkPoint p;
if (!child->globalToLocal(x, y, &p)) {
@@ -401,7 +401,7 @@ void SkView::DoClickDown(Click* click, int x, int y, unsigned modi)
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -425,7 +425,7 @@ void SkView::DoClickMoved(Click* click, int x, int y, unsigned modi)
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -449,7 +449,7 @@ void SkView::DoClickUp(Click* click, int x, int y, unsigned modi)
SkASSERT(click);
SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID);
- if (NULL == target) {
+ if (nullptr == target) {
return;
}
@@ -493,7 +493,7 @@ bool SkView::onSendClickToChildren(SkScalar x, SkScalar y, unsigned modi) {
}
SkView::Click* SkView::onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) {
- return NULL;
+ return nullptr;
}
bool SkView::onClick(Click*) {
@@ -517,17 +517,17 @@ void SkView::getLocalBounds(SkRect* bounds) const {
void SkView::detachFromParent_NoLayout() {
this->validate();
- if (fParent == NULL) {
+ if (fParent == nullptr) {
return;
}
if (fContainsFocus) {
- (void)this->setFocusView(NULL);
+ (void)this->setFocusView(nullptr);
}
- this->inval(NULL);
+ this->inval(nullptr);
- SkView* next = NULL;
+ SkView* next = nullptr;
if (fNextSibling != this) { // do we have any siblings
fNextSibling->fPrevSibling = fPrevSibling;
@@ -539,7 +539,7 @@ void SkView::detachFromParent_NoLayout() {
fParent->fFirstChild = next;
}
- fParent = fNextSibling = fPrevSibling = NULL;
+ fParent = fNextSibling = fPrevSibling = nullptr;
this->validate();
this->unref();
@@ -559,13 +559,13 @@ SkView* SkView::attachChildToBack(SkView* child) {
this->validate();
SkASSERT(child != this);
- if (child == NULL || fFirstChild == child)
+ if (child == nullptr || fFirstChild == child)
goto DONE;
child->ref();
child->detachFromParent_NoLayout();
- if (fFirstChild == NULL) {
+ if (fFirstChild == nullptr) {
child->fNextSibling = child;
child->fPrevSibling = child;
} else {
@@ -577,7 +577,7 @@ SkView* SkView::attachChildToBack(SkView* child) {
fFirstChild = child;
child->fParent = this;
- child->inval(NULL);
+ child->inval(nullptr);
this->validate();
this->invokeLayout();
@@ -589,13 +589,13 @@ SkView* SkView::attachChildToFront(SkView* child) {
this->validate();
SkASSERT(child != this);
- if (child == NULL || (fFirstChild && fFirstChild->fPrevSibling == child))
+ if (child == nullptr || (fFirstChild && fFirstChild->fPrevSibling == child))
goto DONE;
child->ref();
child->detachFromParent_NoLayout();
- if (fFirstChild == NULL) {
+ if (fFirstChild == nullptr) {
fFirstChild = child;
child->fNextSibling = child;
child->fPrevSibling = child;
@@ -607,7 +607,7 @@ SkView* SkView::attachChildToFront(SkView* child) {
}
child->fParent = this;
- child->inval(NULL);
+ child->inval(nullptr);
this->validate();
this->invokeLayout();
@@ -699,7 +699,7 @@ void SkView::postInflate(const SkTDict<SkView*>& dict) {
B2FIter iter(this);
SkView* child;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
child->postInflate(dict);
}
@@ -714,7 +714,7 @@ SkView* SkView::sendEventToParents(const SkEvent& evt) {
}
parent = parent->fParent;
}
- return NULL;
+ return nullptr;
}
SkView* SkView::sendQueryToParents(SkEvent* evt) {
@@ -726,15 +726,15 @@ SkView* SkView::sendQueryToParents(SkEvent* evt) {
}
parent = parent->fParent;
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
SkView::F2BIter::F2BIter(const SkView* parent) {
- fFirstChild = parent ? parent->fFirstChild : NULL;
- fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
+ fFirstChild = parent ? parent->fFirstChild : nullptr;
+ fChild = fFirstChild ? fFirstChild->fPrevSibling : nullptr;
}
SkView* SkView::F2BIter::next() {
@@ -742,7 +742,7 @@ SkView* SkView::F2BIter::next() {
if (fChild) {
if (fChild == fFirstChild) {
- fChild = NULL;
+ fChild = nullptr;
} else {
fChild = fChild->fPrevSibling;
}
@@ -751,7 +751,7 @@ SkView* SkView::F2BIter::next() {
}
SkView::B2FIter::B2FIter(const SkView* parent) {
- fFirstChild = parent ? parent->fFirstChild : NULL;
+ fFirstChild = parent ? parent->fFirstChild : nullptr;
fChild = fFirstChild;
}
@@ -761,7 +761,7 @@ SkView* SkView::B2FIter::next() {
if (fChild) {
SkView* next = fChild->fNextSibling;
if (next == fFirstChild)
- next = NULL;
+ next = nullptr;
fChild = next;
}
return curr;
@@ -778,8 +778,8 @@ void SkView::validate() const {
SkASSERT(fNextSibling);
SkASSERT(fPrevSibling);
} else {
- bool nextNull = NULL == fNextSibling;
- bool prevNull = NULL == fNextSibling;
+ bool nextNull = nullptr == fNextSibling;
+ bool prevNull = nullptr == fNextSibling;
SkASSERT(nextNull == prevNull);
}
}
@@ -812,7 +812,7 @@ static void dumpview(const SkView* view, int level, bool recurse)
SkView* child;
bool noChildren = true;
- while ((child = iter.next()) != NULL)
+ while ((child = iter.next()) != nullptr)
{
if (noChildren)
SkDebugf(">\n");
diff --git a/src/views/SkViewInflate.cpp b/src/views/SkViewInflate.cpp
index 59cc4813fa..8418fb0e72 100644
--- a/src/views/SkViewInflate.cpp
+++ b/src/views/SkViewInflate.cpp
@@ -37,10 +37,10 @@ void SkViewInflate::rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView*
const char* name = dom.getName(child);
const char* target;
- if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
+ if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != nullptr)
this->addIDStr(&fListenTo, parent, target);
- if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
+ if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != nullptr)
this->addIDStr(&fBroadcastTo, parent, target);
}
child = dom.getNextSibling(child);
@@ -62,13 +62,13 @@ SkView* SkViewInflate::inflate(const SkDOM& dom, const SkDOM::Node* node, SkView
{
fIDs.reset();
- if (root == NULL)
+ if (root == nullptr)
{
root = this->createView(dom, node);
- if (root == NULL)
+ if (root == nullptr)
{
- printf("createView returned NULL on <%s>\n", dom.getName(node));
- return NULL;
+ printf("createView returned nullptr on <%s>\n", dom.getName(node));
+ return nullptr;
}
}
this->rInflate(dom, node, root);
@@ -103,21 +103,21 @@ SkView* SkViewInflate::inflate(const char xml[], size_t len, SkView* root)
SkDOM dom;
const SkDOM::Node* node = dom.build(xml, len);
- return node ? this->inflate(dom, node, root) : NULL;
+ return node ? this->inflate(dom, node, root) : nullptr;
}
SkView* SkViewInflate::findViewByID(const char id[]) const
{
SkASSERT(id);
SkView* view;
- return fIDs.find(id, &view) ? view : NULL;
+ return fIDs.find(id, &view) ? view : nullptr;
}
SkView* SkViewInflate::createView(const SkDOM& dom, const SkDOM::Node* node)
{
if (!strcmp(dom.getName(node), "view"))
return new SkView;
- return NULL;
+ return nullptr;
}
void SkViewInflate::addIDStr(SkTDArray<IDStr>* list, SkView* view, const char* str)
diff --git a/src/views/SkViewPriv.cpp b/src/views/SkViewPriv.cpp
index 6d90814574..03541fd7ad 100644
--- a/src/views/SkViewPriv.cpp
+++ b/src/views/SkViewPriv.cpp
@@ -29,14 +29,14 @@ void SkView::Artist::onInflate(const SkDOM&, const SkDOM::Node*)
SkView::Artist* SkView::getArtist() const
{
Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
- SkASSERT(rec == NULL || rec->fArtist != NULL);
+ SkASSERT(rec == nullptr || rec->fArtist != nullptr);
- return rec ? rec->fArtist : NULL;
+ return rec ? rec->fArtist : nullptr;
}
SkView::Artist* SkView::setArtist(Artist* obj)
{
- if (obj == NULL)
+ if (obj == nullptr)
{
this->removeTagList(kViewArtist_SkTagList);
}
@@ -75,14 +75,14 @@ void SkView::Layout::onInflate(const SkDOM&, const SkDOM::Node*)
SkView::Layout* SkView::getLayout() const
{
Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
- SkASSERT(rec == NULL || rec->fLayout != NULL);
+ SkASSERT(rec == nullptr || rec->fLayout != nullptr);
- return rec ? rec->fLayout : NULL;
+ return rec ? rec->fLayout : nullptr;
}
SkView::Layout* SkView::setLayout(Layout* obj, bool invokeLayoutNow)
{
- if (obj == NULL)
+ if (obj == nullptr)
{
this->removeTagList(kViewLayout_SkTagList);
}
diff --git a/src/views/SkWidgets.cpp b/src/views/SkWidgets.cpp
index cde2b42738..fc0ffb82b6 100644
--- a/src/views/SkWidgets.cpp
+++ b/src/views/SkWidgets.cpp
@@ -72,7 +72,7 @@ SkinSuite::SkinSuite()
if (!fAnimators[i]->decodeURI(path.c_str()))
{
delete fAnimators[i];
- fAnimators[i] = NULL;
+ fAnimators[i] = nullptr;
}
}
}
@@ -88,11 +88,11 @@ static SkinSuite* gSkinSuite;
static SkAnimator* get_skin_animator(SkinType st)
{
#if 0
- if (gSkinSuite == NULL)
+ if (gSkinSuite == nullptr)
gSkinSuite = new SkinSuite;
return gSkinSuite->get(st);
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -109,7 +109,7 @@ void SkWidget::Term()
void SkWidget::onEnabledChange()
{
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkWidget::postWidgetEvent()
@@ -130,7 +130,7 @@ void SkWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
this->INHERITED::onInflate(dom, node);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
+ if ((node = dom.getFirstChild(node, "event")) != nullptr)
fEvent.inflate(dom, node);
}
@@ -196,7 +196,7 @@ void SkButtonWidget::setButtonState(State state)
void SkButtonWidget::onButtonStateChange()
{
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkButtonWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -293,7 +293,7 @@ void SkPushButtonWidget::onDraw(SkCanvas* canvas)
p.setColor(SK_ColorBLUE);
create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
- p.setMaskFilter(NULL);
+ p.setMaskFilter(nullptr);
p.setTextAlign(SkPaint::kCenter_Align);
@@ -351,7 +351,7 @@ void SkStaticTextView::computeSize()
{
if (fMode == kAutoWidth_Mode)
{
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), nullptr, nullptr);
this->setWidth(width + fMargin.fX * 2);
}
else if (fMode == kAutoHeight_Mode)
@@ -360,7 +360,7 @@ void SkStaticTextView::computeSize()
int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
SkScalar before, after;
- (void)fPaint.measureText(0, NULL, &before, &after);
+ (void)fPaint.measureText(0, nullptr, &before, &after);
this->setHeight(lines * (after - before) + fMargin.fY * 2);
}
@@ -380,7 +380,7 @@ void SkStaticTextView::setMode(Mode mode)
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
@@ -395,7 +395,7 @@ void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
fMargin.set(dx, dy);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -429,7 +429,7 @@ void SkStaticTextView::setText(const char text[], size_t len)
{
fText.set(text, len);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -445,7 +445,7 @@ void SkStaticTextView::setPaint(const SkPaint& paint)
{
fPaint = paint;
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -489,7 +489,7 @@ void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
if (text)
this->setText(text);
- if ((node = dom.getFirstChild(node, "paint")) != NULL)
+ if ((node = dom.getFirstChild(node, "paint")) != nullptr)
SkPaint_Inflate(&fPaint, dom, node);
}
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 9eef0230eb..9234ac1395 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -16,7 +16,7 @@
SkWindow::SkWindow()
: fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
- , fFocusView(NULL)
+ , fFocusView(nullptr)
{
fClicks.reset();
fWaitingOnInval = false;
@@ -37,7 +37,7 @@ SkSurface* SkWindow::createSurface() {
void SkWindow::setMatrix(const SkMatrix& matrix) {
if (fMatrix != matrix) {
fMatrix = matrix;
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -67,7 +67,7 @@ void SkWindow::resize(int width, int height, SkColorType ct) {
ct, kPremul_SkAlphaType));
this->setSize(SkIntToScalar(width), SkIntToScalar(height));
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -146,7 +146,7 @@ bool SkWindow::handleChar(SkUnichar uni) {
return true;
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
SkEvent evt(SK_EventType_Unichar);
@@ -164,7 +164,7 @@ bool SkWindow::handleKey(SkKey key) {
// send an event to the focus-view
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
SkEvent evt(SK_EventType_Key);
@@ -174,8 +174,8 @@ bool SkWindow::handleKey(SkKey key) {
}
if (key == kUp_SkKey || key == kDown_SkKey) {
- if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
- this->onSetFocusView(NULL);
+ if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == nullptr)
+ this->onSetFocusView(nullptr);
return true;
}
return false;
@@ -191,7 +191,7 @@ bool SkWindow::handleKeyUp(SkKey key) {
//send an event to the focus-view
{
SkView* focus = this->getFocusView();
- if (focus == NULL)
+ if (focus == nullptr)
focus = this;
//should this one be the same?
@@ -209,7 +209,7 @@ void SkWindow::addMenu(SkOSMenu* menu) {
}
void SkWindow::setTitle(const char title[]) {
- if (NULL == title) {
+ if (nullptr == title) {
title = "";
}
fTitle.set(title);
diff --git a/src/views/animated/SkBorderView.cpp b/src/views/animated/SkBorderView.cpp
index 3eff6056f9..88bff696c9 100644
--- a/src/views/animated/SkBorderView.cpp
+++ b/src/views/animated/SkBorderView.cpp
@@ -52,7 +52,7 @@ void SkBorderView::setSkin(const char skin[])
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -65,7 +65,7 @@ void SkBorderView::setSkin(const char skin[])
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkImageView.cpp b/src/views/animated/SkImageView.cpp
index 2956729fef..04b8258651 100644
--- a/src/views/animated/SkImageView.cpp
+++ b/src/views/animated/SkImageView.cpp
@@ -16,10 +16,10 @@
SkImageView::SkImageView()
{
- fMatrix = NULL;
+ fMatrix = nullptr;
fScaleType = kMatrix_ScaleType;
- fData.fAnim = NULL; // handles initializing the other union values
+ fData.fAnim = nullptr; // handles initializing the other union values
fDataIsAnim = true;
fUriIsValid = false; // an empty string is not valid
@@ -65,7 +65,7 @@ void SkImageView::setScaleType(ScaleType st)
{
fScaleType = SkToU8(st);
if (fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -92,7 +92,7 @@ void SkImageView::setImageMatrix(const SkMatrix* matrix)
if (matrix && !matrix->isIdentity())
{
- if (fMatrix == NULL)
+ if (fMatrix == nullptr)
fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
*fMatrix = *matrix;
changed = true;
@@ -103,14 +103,14 @@ void SkImageView::setImageMatrix(const SkMatrix* matrix)
{
SkASSERT(!fMatrix->isIdentity());
sk_free(fMatrix);
- fMatrix = NULL;
+ fMatrix = nullptr;
changed = true;
}
}
// only redraw if we changed our matrix and we're not in scaleToFit mode
if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -120,7 +120,7 @@ bool SkImageView::onEvent(const SkEvent& evt)
if (evt.isType(SK_EventType_Inval))
{
if (fUriIsValid)
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
return this->INHERITED::onEvent(evt);
@@ -174,7 +174,7 @@ void SkImageView::onDraw(SkCanvas* canvas)
SkDEBUGF(("SkImageView : now = %X[%12.3f], diff = %d\n", now, now/1000., diff));
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -207,7 +207,7 @@ void SkImageView::onInflate(const SkDOM& dom, const SkDOMNode* node)
void SkImageView::onUriChange()
{
if (this->freeData())
- this->inval(NULL);
+ this->inval(nullptr);
fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
}
@@ -220,7 +220,7 @@ bool SkImageView::freeData()
else
delete fData.fBitmap;
- fData.fAnim = NULL; // valid for all union values
+ fData.fAnim = nullptr; // valid for all union values
return true;
}
return false;
diff --git a/src/views/animated/SkProgressBarView.cpp b/src/views/animated/SkProgressBarView.cpp
index e7754eb612..5ce944fb07 100644
--- a/src/views/animated/SkProgressBarView.cpp
+++ b/src/views/animated/SkProgressBarView.cpp
@@ -35,7 +35,7 @@ void SkProgressBarView::changeProgress(int diff)
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -48,7 +48,7 @@ void SkProgressBarView::changeProgress(int diff)
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkScrollBarView.cpp b/src/views/animated/SkScrollBarView.cpp
index d78cafafd7..9ba523e658 100644
--- a/src/views/animated/SkScrollBarView.cpp
+++ b/src/views/animated/SkScrollBarView.cpp
@@ -89,7 +89,7 @@ void SkScrollBarView::setTotal(unsigned total)
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -102,7 +102,7 @@ void SkScrollBarView::setTotal(unsigned total)
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp
index 0e4cad63e5..4bec5106a4 100644
--- a/src/views/animated/SkStaticTextView.cpp
+++ b/src/views/animated/SkStaticTextView.cpp
@@ -62,7 +62,7 @@ void SkStaticTextView::setMode(Mode mode)
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ this->inval(nullptr);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
@@ -77,7 +77,7 @@ void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
fMargin.set(dx, dy);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -102,7 +102,7 @@ void SkStaticTextView::setText(const SkString& text)
void SkStaticTextView::setText(const char text[])
{
- if (text == NULL)
+ if (text == nullptr)
text = "";
this->setText(text, strlen(text));
}
@@ -113,7 +113,7 @@ void SkStaticTextView::setText(const char text[], size_t len)
{
fText.set(text, len);
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -129,7 +129,7 @@ void SkStaticTextView::setPaint(const SkPaint& paint)
{
fPaint = paint;
this->computeSize();
- this->inval(NULL);
+ this->inval(nullptr);
}
}
@@ -178,8 +178,8 @@ if (false) { // avoid bit rot, suppress warning
this->setText(text);
}
- if ((node = dom.getFirstChild(node, "paint")) != NULL &&
- (node = dom.getFirstChild(node, "screenplay")) != NULL)
+ if ((node = dom.getFirstChild(node, "paint")) != nullptr &&
+ (node = dom.getFirstChild(node, "screenplay")) != nullptr)
{
// FIXME: Including inflate_paint causes Windows build to fail -- it complains
// that SKListView::SkListView is undefined.
diff --git a/src/views/animated/SkWidgetViews.cpp b/src/views/animated/SkWidgetViews.cpp
index cd22678d92..9d3c936523 100644
--- a/src/views/animated/SkWidgetViews.cpp
+++ b/src/views/animated/SkWidgetViews.cpp
@@ -110,7 +110,7 @@ void SkWidgetView::setLabel(const char label[])
void SkWidgetView::setLabel(const char label[], size_t len)
{
- if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
+ if ((label == nullptr && fLabel.size() != 0) || !fLabel.equals(label, len))
{
SkString tmp(label, len);
@@ -153,13 +153,13 @@ bool SkWidgetView::postWidgetEvent()
if (label)
this->setLabel(label);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
+ if ((node = dom.getFirstChild(node, "event")) != nullptr)
fEvent.inflate(dom, node);
}
/*virtual*/ void SkWidgetView::onLabelChange(const char oldLabel[], const char newLabel[])
{
- this->inval(NULL);
+ this->inval(nullptr);
}
static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot";
@@ -208,7 +208,7 @@ void SkCheckButtonView::setCheckState(CheckState state)
/*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState)
{
- this->inval(NULL);
+ this->inval(nullptr);
}
/*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -296,7 +296,7 @@ protected:
SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
+ this->inval(nullptr);
else if (diff == SkAnimator::kPartiallyDifferent)
{
SkRect bounds;
@@ -309,7 +309,7 @@ protected:
{
if (evt.isType(SK_EventType_Inval))
{
- this->inval(NULL);
+ this->inval(nullptr);
return true;
}
if (evt.isType("recommendDim"))
@@ -346,8 +346,8 @@ private:
SkView* SkWidgetFactory(const char name[])
{
- if (name == NULL)
- return NULL;
+ if (name == nullptr)
+ return nullptr;
// must be in the same order as the SkSkinWidgetEnum is declared
static const char* gNames[] = {
@@ -365,7 +365,7 @@ SkView* SkWidgetFactory(const char name[])
if (!strcmp(gNames[i], name))
return SkWidgetFactory((SkWidgetEnum)i);
- return NULL;
+ return nullptr;
}
#include "SkImageView.h"
@@ -394,5 +394,5 @@ SkView* SkWidgetFactory(SkWidgetEnum sw)
SkDEBUGFAIL("unknown enum passed to SkWidgetFactory");
break;
}
- return NULL;
+ return nullptr;
}
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index 27783d41fc..1954015674 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -17,8 +17,8 @@ static void post_SkEvent_event() {
evt.type = SDL_USEREVENT;
evt.user.type = SDL_USEREVENT;
evt.user.code = 0;
- evt.user.data1 = NULL;
- evt.user.data2 = NULL;
+ evt.user.data1 = nullptr;
+ evt.user.data2 = nullptr;
SDL_PushEvent(&evt);
}
@@ -52,11 +52,11 @@ SkOSWindow::SkOSWindow(void* screen) {
uint32_t amask = SK_A32_MASK << SK_A32_SHIFT;
if (fScreen->flags & SDL_OPENGL) {
- fSurface = NULL;
+ fSurface = nullptr;
fGLCanvas = new SkGLCanvas;
fGLCanvas->setViewport(fScreen->w, fScreen->h);
} else {
- fGLCanvas = NULL;
+ fGLCanvas = nullptr;
fSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, fScreen->w, fScreen->h,
32, rmask, gmask, bmask, amask);
}
@@ -102,7 +102,7 @@ void SkOSWindow::doDraw() {
SDL_UnlockSurface(fSurface);
}
- int result = SDL_BlitSurface(fSurface, NULL, fScreen, NULL);
+ int result = SDL_BlitSurface(fSurface, nullptr, fScreen, nullptr);
if (result) {
SkDebugf("------- SDL_BlitSurface returned %d\n", result);
}
@@ -200,7 +200,7 @@ void SkOSWindow::onHandleInval(const SkIRect& r) {
}
void SkOSWindow::onSetTitle(const char title[]) {
- SDL_WM_SetCaption(title, NULL);
+ SDL_WM_SetCaption(title, nullptr);
}
void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) {}
@@ -220,7 +220,7 @@ static Uint32 timer_callback(Uint32 interval) {
void SkEvent::SignalQueueTimer(SkMSec delay)
{
- SDL_SetTimer(0, NULL);
+ SDL_SetTimer(0, nullptr);
if (delay) {
SDL_SetTimer(delay, timer_callback);
}
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 79fd011fb2..4d4b628bfb 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -33,11 +33,11 @@ const long EVENT_MASK = StructureNotifyMask|ButtonPressMask|ButtonReleaseMask
|ExposureMask|PointerMotionMask|KeyPressMask|KeyReleaseMask;
SkOSWindow::SkOSWindow(void*)
- : fVi(NULL)
+ : fVi(nullptr)
, fMSAASampleCount(0) {
- fUnixWindow.fDisplay = NULL;
- fUnixWindow.fGLContext = NULL;
- this->initWindow(0, NULL);
+ fUnixWindow.fDisplay = nullptr;
+ fUnixWindow.fGLContext = nullptr;
+ this->initWindow(0, nullptr);
this->resize(WIDTH, HEIGHT);
}
@@ -50,11 +50,11 @@ void SkOSWindow::internalCloseWindow() {
this->detach();
SkASSERT(fUnixWindow.fGc);
XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc);
- fUnixWindow.fGc = NULL;
+ fUnixWindow.fGc = nullptr;
XDestroyWindow(fUnixWindow.fDisplay, fUnixWindow.fWin);
- fVi = NULL;
+ fVi = nullptr;
XCloseDisplay(fUnixWindow.fDisplay);
- fUnixWindow.fDisplay = NULL;
+ fUnixWindow.fDisplay = nullptr;
fMSAASampleCount = 0;
}
}
@@ -76,9 +76,9 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
}
return;
}
- fUnixWindow.fDisplay = XOpenDisplay(NULL);
+ fUnixWindow.fDisplay = XOpenDisplay(nullptr);
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
SkDebugf("Could not open an X Display");
return;
}
@@ -90,7 +90,7 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
GLX_STENCIL_SIZE, 8,
None
};
- SkASSERT(NULL == fVi);
+ SkASSERT(nullptr == fVi);
if (requestedMSAASampleCount > 0) {
static const GLint kAttCount = SK_ARRAY_COUNT(att);
GLint msaaAtt[kAttCount + 4];
@@ -104,7 +104,7 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
fVi = glXChooseVisual(dsp, DefaultScreen(dsp), msaaAtt);
fMSAASampleCount = requestedMSAASampleCount;
}
- if (NULL == fVi) {
+ if (nullptr == fVi) {
fVi = glXChooseVisual(dsp, DefaultScreen(dsp), att);
fMSAASampleCount = 0;
}
@@ -146,7 +146,7 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info)
0); // background value
}
this->mapWindowAndWait();
- fUnixWindow.fGc = XCreateGC(dsp, fUnixWindow.fWin, 0, NULL);
+ fUnixWindow.fGc = XCreateGC(dsp, fUnixWindow.fWin, 0, nullptr);
}
static unsigned getModi(const XEvent& evt) {
@@ -190,7 +190,7 @@ static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) {
tv.tv_sec = ms / 1000; // seconds
tv.tv_usec = (ms % 1000) * 1000; // microseconds
- if (!select(x11_fd + 1, &input_fds, NULL, NULL, &tv)) {
+ if (!select(x11_fd + 1, &input_fds, nullptr, nullptr, &tv)) {
if (!XPending(dsp)) {
return false;
}
@@ -222,16 +222,16 @@ SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() {
case ButtonPress:
if (evt.xbutton.button == Button1)
this->handleClick(evt.xbutton.x, evt.xbutton.y,
- SkView::Click::kDown_State, NULL, getModi(evt));
+ SkView::Click::kDown_State, nullptr, getModi(evt));
break;
case ButtonRelease:
if (evt.xbutton.button == Button1)
this->handleClick(evt.xbutton.x, evt.xbutton.y,
- SkView::Click::kUp_State, NULL, getModi(evt));
+ SkView::Click::kUp_State, nullptr, getModi(evt));
break;
case MotionNotify:
this->handleClick(evt.xmotion.x, evt.xmotion.y,
- SkView::Click::kMoved_State, NULL, getModi(evt));
+ SkView::Click::kMoved_State, nullptr, getModi(evt));
break;
case KeyPress: {
int shiftLevel = (evt.xkey.state & ShiftMask) ? 1 : 0;
@@ -264,7 +264,7 @@ SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() {
void SkOSWindow::loop() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return;
}
Window win = fUnixWindow.fWin;
@@ -298,7 +298,7 @@ void SkOSWindow::loop() {
case kPaintRequest_NextXEventResult:
sentExposeEvent = false;
if (this->isDirty()) {
- this->update(NULL);
+ this->update(nullptr);
}
this->doPaint();
break;
@@ -352,17 +352,17 @@ static void glXSwapInterval(Display* dsp, GLXDrawable drawable, int interval) {
bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* info) {
this->initWindow(msaaSampleCount, info);
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return false;
}
- if (NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fGLContext) {
SkASSERT(fVi);
fUnixWindow.fGLContext = glXCreateContext(fUnixWindow.fDisplay,
fVi,
- NULL,
+ nullptr,
GL_TRUE);
- if (NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fGLContext) {
return false;
}
}
@@ -379,12 +379,12 @@ bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* inf
}
void SkOSWindow::detach() {
- if (NULL == fUnixWindow.fDisplay || NULL == fUnixWindow.fGLContext) {
+ if (nullptr == fUnixWindow.fDisplay || nullptr == fUnixWindow.fGLContext) {
return;
}
- glXMakeCurrent(fUnixWindow.fDisplay, None, NULL);
+ glXMakeCurrent(fUnixWindow.fDisplay, None, nullptr);
glXDestroyContext(fUnixWindow.fDisplay, fUnixWindow.fGLContext);
- fUnixWindow.fGLContext = NULL;
+ fUnixWindow.fGLContext = nullptr;
}
void SkOSWindow::present() {
@@ -394,7 +394,7 @@ void SkOSWindow::present() {
}
void SkOSWindow::onSetTitle(const char title[]) {
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return;
}
XTextProperty textProp;
@@ -424,7 +424,7 @@ static bool convertBitmapToXImage(XImage& image, const SkBitmap& bitmap) {
}
void SkOSWindow::doPaint() {
- if (NULL == fUnixWindow.fDisplay) {
+ if (nullptr == fUnixWindow.fDisplay) {
return;
}
// If we are drawing with GL, we don't need XPutImage.
@@ -458,7 +458,7 @@ enum {
bool SkOSWindow::makeFullscreen() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return false;
}
@@ -490,7 +490,7 @@ void SkOSWindow::setVsync(bool vsync) {
void SkOSWindow::closeWindow() {
Display* dsp = fUnixWindow.fDisplay;
- if (NULL == dsp) {
+ if (nullptr == dsp) {
return;
}
diff --git a/src/views/unix/skia_unix.cpp b/src/views/unix/skia_unix.cpp
index 03a2915adb..58cc040c1e 100644
--- a/src/views/unix/skia_unix.cpp
+++ b/src/views/unix/skia_unix.cpp
@@ -10,7 +10,7 @@
#include "SkWindow.h"
int main(int argc, char** argv){
- SkOSWindow* window = create_sk_window(NULL, argc, argv);
+ SkOSWindow* window = create_sk_window(nullptr, argc, argv);
// drain any events that occurred before |window| was assigned.
while (SkEvent::ProcessEvent());
diff --git a/src/xml/SkBML_XMLParser.cpp b/src/xml/SkBML_XMLParser.cpp
index c0a5af55e5..1314608137 100644
--- a/src/xml/SkBML_XMLParser.cpp
+++ b/src/xml/SkBML_XMLParser.cpp
@@ -41,7 +41,7 @@ static void set(char* array[256], int index, SkStream& s, int data)
size_t size = rdata(s, data);
- if (array[index] == NULL)
+ if (array[index] == nullptr)
array[index] = (char*)sk_malloc_throw(size + 1);
else
{
diff --git a/src/xml/SkDOM.cpp b/src/xml/SkDOM.cpp
index 3bb0835bbc..68e2938d9a 100644
--- a/src/xml/SkDOM.cpp
+++ b/src/xml/SkDOM.cpp
@@ -24,15 +24,15 @@ bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
SkDOM::AttrIter iter(dom, node);
const char* name, *value;
- while ((name = iter.next(&value)) != NULL)
+ while ((name = iter.next(&value)) != nullptr)
if (this->addAttribute(name, value))
return false;
- if ((node = dom.getFirstChild(node)) != NULL)
+ if ((node = dom.getFirstChild(node)) != nullptr)
do {
if (!this->parse(dom, node))
return false;
- } while ((node = dom.getNextSibling(node)) != NULL);
+ } while ((node = dom.getNextSibling(node)) != nullptr);
return !this->endElement(elemName);
}
@@ -66,7 +66,7 @@ struct SkDOMNode {
#define kMinChunkSize 512
-SkDOM::SkDOM() : fAlloc(kMinChunkSize), fRoot(NULL)
+SkDOM::SkDOM() : fAlloc(kMinChunkSize), fRoot(nullptr)
{
}
@@ -86,7 +86,7 @@ const SkDOM::Node* SkDOM::getFirstChild(const Node* node, const char name[]) con
if (name)
{
- for (; child != NULL; child = child->fNextSibling)
+ for (; child != nullptr; child = child->fNextSibling)
if (!strcmp(name, child->fName))
break;
}
@@ -99,7 +99,7 @@ const SkDOM::Node* SkDOM::getNextSibling(const Node* node, const char name[]) co
const Node* sibling = node->fNextSibling;
if (name)
{
- for (; sibling != NULL; sibling = sibling->fNextSibling)
+ for (; sibling != nullptr; sibling = sibling->fNextSibling)
if (!strcmp(name, sibling->fName))
break;
}
@@ -130,22 +130,22 @@ const char* SkDOM::findAttr(const Node* node, const char name[]) const
return attr->fValue;
attr += 1;
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////
const SkDOM::Attr* SkDOM::getFirstAttr(const Node* node) const
{
- return node->fAttrCount ? node->attrs() : NULL;
+ return node->fAttrCount ? node->attrs() : nullptr;
}
const SkDOM::Attr* SkDOM::getNextAttr(const Node* node, const Attr* attr) const
{
SkASSERT(node);
- if (attr == NULL)
- return NULL;
- return (attr - node->attrs() + 1) < node->fAttrCount ? attr + 1 : NULL;
+ if (attr == nullptr)
+ return nullptr;
+ return (attr - node->attrs() + 1) < node->fAttrCount ? attr + 1 : nullptr;
}
const char* SkDOM::getAttrName(const Node* node, const Attr* attr) const
@@ -173,7 +173,7 @@ SkDOM::AttrIter::AttrIter(const SkDOM&, const SkDOM::Node* node)
const char* SkDOM::AttrIter::next(const char** value)
{
- const char* name = NULL;
+ const char* name = nullptr;
if (fAttr < fStop)
{
@@ -204,7 +204,7 @@ public:
SkDOMParser(SkChunkAlloc* chunk) : SkXMLParser(&fParserError), fAlloc(chunk)
{
fAlloc->reset();
- fRoot = NULL;
+ fRoot = nullptr;
fLevel = 0;
fNeedToFlush = true;
}
@@ -222,13 +222,13 @@ protected:
SkChunkAlloc::kThrow_AllocFailType);
node->fName = fElemName;
- node->fFirstChild = NULL;
+ node->fFirstChild = nullptr;
node->fAttrCount = SkToU16(attrCount);
node->fType = fElemType;
- if (fRoot == NULL)
+ if (fRoot == nullptr)
{
- node->fNextSibling = NULL;
+ node->fNextSibling = nullptr;
fRoot = node;
}
else // this adds siblings in reverse order. gets corrected in onEndElement()
@@ -268,7 +268,7 @@ protected:
fParentStack.pop(&parent);
SkDOM::Node* child = parent->fFirstChild;
- SkDOM::Node* prev = NULL;
+ SkDOM::Node* prev = nullptr;
while (child)
{
SkDOM::Node* next = child->fNextSibling;
@@ -317,9 +317,9 @@ const SkDOM::Node* SkDOM::build(const char doc[], size_t len)
if (!parser.parse(doc, len))
{
SkDEBUGCODE(SkDebugf("xml parse error, line %d\n", parser.fParserError.getLineNumber());)
- fRoot = NULL;
+ fRoot = nullptr;
fAlloc.reset();
- return NULL;
+ return nullptr;
}
fRoot = parser.getRoot();
return fRoot;
@@ -341,14 +341,14 @@ static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par
SkDOM::AttrIter iter(dom, node);
const char* name;
const char* value;
- while ((name = iter.next(&value)) != NULL)
+ while ((name = iter.next(&value)) != nullptr)
parser->addAttribute(name, value);
- node = dom.getFirstChild(node, NULL);
+ node = dom.getFirstChild(node, nullptr);
while (node)
{
walk_dom(dom, node, parser);
- node = dom.getNextSibling(node, NULL);
+ node = dom.getNextSibling(node, nullptr);
}
parser->endElement(elem);
@@ -468,7 +468,7 @@ bool SkDOM::hasBool(const Node* node, const char name[], bool target) const
void SkDOM::dump(const Node* node, int level) const
{
- if (node == NULL)
+ if (node == nullptr)
node = this->getRootNode();
SkDebugWStream debugStream;
@@ -493,7 +493,7 @@ void SkDOM::UnitTest()
SkDOM dom;
- SkASSERT(dom.getRootNode() == NULL);
+ SkASSERT(dom.getRootNode() == nullptr);
const Node* root = dom.build(gDoc, sizeof(gDoc) - 1);
SkASSERT(root && dom.getRootNode() == root);
@@ -503,7 +503,7 @@ void SkDOM::UnitTest()
v = dom.findAttr(root, "b");
SkASSERT(v && !strcmp(v, "2"));
v = dom.findAttr(root, "c");
- SkASSERT(v == NULL);
+ SkASSERT(v == nullptr);
SkASSERT(dom.getFirstChild(root, "elem1"));
SkASSERT(!dom.getFirstChild(root, "subelem1"));
diff --git a/src/xml/SkXMLParser.cpp b/src/xml/SkXMLParser.cpp
index ccc7aa4b02..e28365634e 100644
--- a/src/xml/SkXMLParser.cpp
+++ b/src/xml/SkXMLParser.cpp
@@ -51,7 +51,7 @@ void SkXMLParserError::reset() {
////////////////
-SkXMLParser::SkXMLParser(SkXMLParserError* parserError) : fParser(NULL), fError(parserError)
+SkXMLParser::SkXMLParser(SkXMLParserError* parserError) : fParser(nullptr), fError(parserError)
{
}
diff --git a/src/xml/SkXMLPullParser.cpp b/src/xml/SkXMLPullParser.cpp
index ed042281a7..34ad282cc7 100644
--- a/src/xml/SkXMLPullParser.cpp
+++ b/src/xml/SkXMLPullParser.cpp
@@ -16,13 +16,13 @@ static void reset(SkXMLPullParser::Curr* curr)
curr->fIsWhitespace = false;
}
-SkXMLPullParser::SkXMLPullParser() : fStream(NULL)
+SkXMLPullParser::SkXMLPullParser() : fStream(nullptr)
{
fCurr.fEventType = ERROR;
fDepth = -1;
}
-SkXMLPullParser::SkXMLPullParser(SkStream* stream) : fStream(NULL)
+SkXMLPullParser::SkXMLPullParser(SkStream* stream) : fStream(nullptr)
{
fCurr.fEventType = ERROR;
fDepth = 0;
@@ -32,7 +32,7 @@ SkXMLPullParser::SkXMLPullParser(SkStream* stream) : fStream(NULL)
SkXMLPullParser::~SkXMLPullParser()
{
- this->setStream(NULL);
+ this->setStream(nullptr);
}
SkStream* SkXMLPullParser::setStream(SkStream* stream)
@@ -89,7 +89,7 @@ const char* SkXMLPullParser::getName()
case END_TAG:
return fCurr.fName;
default:
- return NULL;
+ return nullptr;
}
}
@@ -100,7 +100,7 @@ const char* SkXMLPullParser::getText()
case IGNORABLE_WHITESPACE:
return fCurr.fName;
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/xml/SkXMLWriter.cpp b/src/xml/SkXMLWriter.cpp
index 7a1b04277e..5ee237ff68 100644
--- a/src/xml/SkXMLWriter.cpp
+++ b/src/xml/SkXMLWriter.cpp
@@ -146,7 +146,7 @@ void SkXMLWriter::addAttributeLen(const char name[], const char value[], size_t
if (fDoEscapeMarkup)
{
- size_t extra = escape_markup(NULL, value, length);
+ size_t extra = escape_markup(nullptr, value, length);
if (extra)
{
valueStr.resize(length + extra);
@@ -181,15 +181,15 @@ static void write_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLWriter* w,
SkDOM::AttrIter iter(dom, node);
const char* name;
const char* value;
- while ((name = iter.next(&value)) != NULL)
+ while ((name = iter.next(&value)) != nullptr)
w->addAttribute(name, value);
}
- node = dom.getFirstChild(node, NULL);
+ node = dom.getFirstChild(node, nullptr);
while (node)
{
write_dom(dom, node, w, false);
- node = dom.getNextSibling(node, NULL);
+ node = dom.getNextSibling(node, nullptr);
}
if (!skipRoot)
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 1c4f391293..42fc7e7f96 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -62,7 +62,7 @@ static void copyToMask(const SkRegion& rgn, SkMask* mask) {
if (rgn.isEmpty()) {
mask->fBounds.setEmpty();
mask->fRowBytes = 0;
- mask->fImage = NULL;
+ mask->fImage = nullptr;
return;
}
@@ -185,7 +185,7 @@ static void test_path_bounds(skiatest::Reporter* reporter) {
path.addOval(SkRect::MakeWH(sheight, sheight));
REPORTER_ASSERT(reporter, sheight == path.getBounds().height());
- clip.setPath(path, NULL, true);
+ clip.setPath(path, nullptr, true);
REPORTER_ASSERT(reporter, height == clip.getBounds().height());
// this is the trimmed height of this cubic (with aa). The critical thing
@@ -199,7 +199,7 @@ static void test_path_bounds(skiatest::Reporter* reporter) {
imoveTo(path, 0, 20);
icubicTo(path, 40, 40, 40, 0, 0, 20);
REPORTER_ASSERT(reporter, sheight == path.getBounds().height());
- clip.setPath(path, NULL, true);
+ clip.setPath(path, nullptr, true);
REPORTER_ASSERT(reporter, teardrop_height == clip.getBounds().height());
}
@@ -228,9 +228,9 @@ static void test_empty(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, clip1 == clip0);
SkMask mask;
- mask.fImage = NULL;
+ mask.fImage = nullptr;
clip0.copyToMask(&mask);
- REPORTER_ASSERT(reporter, NULL == mask.fImage);
+ REPORTER_ASSERT(reporter, nullptr == mask.fImage);
REPORTER_ASSERT(reporter, mask.fBounds.isEmpty());
}
@@ -308,7 +308,7 @@ static void test_path_with_hole(skiatest::Reporter* reporter) {
for (int i = 0; i < 2; ++i) {
SkAAClip clip;
- clip.setPath(path, NULL, 1 == i);
+ clip.setPath(path, nullptr, 1 == i);
SkMask mask;
clip.copyToMask(&mask);
diff --git a/tests/AsADashTest.cpp b/tests/AsADashTest.cpp
index 47f19717a4..c59dc8344f 100644
--- a/tests/AsADashTest.cpp
+++ b/tests/AsADashTest.cpp
@@ -24,7 +24,7 @@ DEF_TEST(AsADashTest_nullInfo, reporter) {
const SkScalar phase = 2.0;
SkAutoTUnref<SkDashPathEffect> pe(SkDashPathEffect::Create(inIntervals, 4, phase));
- SkPathEffect::DashType dashType = pe->asADash(NULL);
+ SkPathEffect::DashType dashType = pe->asADash(nullptr);
REPORTER_ASSERT(reporter, SkPathEffect::kDash_DashType == dashType);
}
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 1cb2944e99..65427ffd7b 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -193,15 +193,15 @@ static const int H = 33;
static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul,
SkColorType ct) {
- SkColorTable* ctable = NULL;
+ SkColorTable* ctable = nullptr;
if (kIndex_8_SkColorType == ct) {
ctable = init_ctable();
}
srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType),
- NULL, ctable);
+ nullptr, ctable);
SkSafeUnref(ctable);
init_src(*srcOpaque);
init_src(*srcPremul);
@@ -248,8 +248,8 @@ DEF_TEST(BitmapCopy_extractSubset, reporter) {
SkAutoLockPixels alp0(subset);
SkAutoLockPixels alp1(copy);
// they should both have, or both not-have, a colortable
- bool hasCT = subset.getColorTable() != NULL;
- REPORTER_ASSERT(reporter, (copy.getColorTable() != NULL) == hasCT);
+ bool hasCT = subset.getColorTable() != nullptr;
+ REPORTER_ASSERT(reporter, (copy.getColorTable() != nullptr) == hasCT);
}
}
}
@@ -376,7 +376,7 @@ DEF_TEST(BitmapCopy, reporter) {
// Create bitmap to act as source for copies and subsets.
SkBitmap src, subset;
- SkColorTable* ct = NULL;
+ SkColorTable* ct = nullptr;
if (kIndex_8_SkColorType == src.colorType()) {
ct = init_ctable();
}
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index 2567256667..4d68e73dbe 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -16,17 +16,17 @@ static void test_peekpixels(skiatest::Reporter* reporter) {
SkBitmap bm;
// empty should return false
- REPORTER_ASSERT(reporter, !bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, !bm.peekPixels(nullptr));
REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap));
// no pixels should return false
bm.setInfo(SkImageInfo::MakeN32Premul(10, 10));
- REPORTER_ASSERT(reporter, !bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, !bm.peekPixels(nullptr));
REPORTER_ASSERT(reporter, !bm.peekPixels(&pmap));
// real pixels should return true
bm.allocPixels(info);
- REPORTER_ASSERT(reporter, bm.peekPixels(NULL));
+ REPORTER_ASSERT(reporter, bm.peekPixels(nullptr));
REPORTER_ASSERT(reporter, bm.peekPixels(&pmap));
REPORTER_ASSERT(reporter, pmap.info() == bm.info());
REPORTER_ASSERT(reporter, pmap.addr() == bm.getPixels());
@@ -43,7 +43,7 @@ static void test_bigalloc(skiatest::Reporter* reporter) {
SkBitmap bm;
REPORTER_ASSERT(reporter, !bm.tryAllocPixels(info));
- SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), NULL);
+ SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), nullptr);
REPORTER_ASSERT(reporter, !pr);
}
diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp
index 4689a305ac..b6a24eb98d 100644
--- a/tests/BlitRowTest.cpp
+++ b/tests/BlitRowTest.cpp
@@ -174,7 +174,7 @@ struct Mesh {
void draw(SkCanvas* canvas, SkPaint* paint) {
canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts,
- NULL, NULL, NULL, 0, *paint);
+ nullptr, nullptr, nullptr, 0, *paint);
}
};
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index cde700ef7f..89f3a0a5cf 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -171,7 +171,7 @@ static void ground_truth_2d(int width, int height,
memset(src.fImage, 0xff, src.computeTotalImageSize());
- dst.fImage = NULL;
+ dst.fImage = nullptr;
SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle);
int midX = dst.fBounds.centerX();
@@ -281,7 +281,7 @@ static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path,
int* result, int resultCount) {
GrContext* grContext = factory->get(GrContextFactory::kNative_GLContextType);
- if (NULL == grContext) {
+ if (nullptr == grContext) {
return false;
}
@@ -292,7 +292,7 @@ static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path,
desc.fHeight = 30;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, NULL, 0));
+ SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0));
SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice (grContext, texture.get()));
SkCanvas canvas(device.get());
@@ -430,7 +430,7 @@ static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma,
const bool expectSuccess = sigma > 0 &&
0 == (flags & SkBlurDrawLooper::kIgnoreTransform_BlurFlag);
- if (NULL == lp.get()) {
+ if (nullptr == lp.get()) {
REPORTER_ASSERT(reporter, sigma <= 0);
} else {
SkDrawLooper::BlurShadowRec rec;
@@ -526,7 +526,7 @@ static void test_asABlur(skiatest::Reporter* reporter) {
const SkBlurQuality quality = blurMaskFilterFlags_as_quality(flags);
SkAutoTUnref<SkMaskFilter> mf(SkBlurMaskFilter::Create(style, sigma, flags));
- if (NULL == mf.get()) {
+ if (nullptr == mf.get()) {
REPORTER_ASSERT(reporter, sigma <= 0);
} else {
REPORTER_ASSERT(reporter, sigma > 0);
diff --git a/tests/CTest.cpp b/tests/CTest.cpp
index 4cc8cd6666..f6ff4f0551 100644
--- a/tests/CTest.cpp
+++ b/tests/CTest.cpp
@@ -16,7 +16,7 @@
static void shader_test(skiatest::Reporter* reporter) {
sk_imageinfo_t info =
{64, 64, sk_colortype_get_default_8888(), PREMUL_SK_ALPHATYPE};
- sk_surface_t* surface = sk_surface_new_raster(&info, NULL);
+ sk_surface_t* surface = sk_surface_new_raster(&info, nullptr);
sk_canvas_t* canvas = sk_surface_get_canvas(surface);
sk_paint_t* paint = sk_paint_new();
@@ -30,21 +30,21 @@ static void shader_test(skiatest::Reporter* reporter) {
sk_shader_t* shader;
shader = sk_shader_new_radial_gradient(
- &point, 1.0f, colors, NULL, 2, tilemode, NULL);
- REPORTER_ASSERT(reporter, shader != NULL);
+ &point, 1.0f, colors, nullptr, 2, tilemode, nullptr);
+ REPORTER_ASSERT(reporter, shader != nullptr);
sk_paint_set_shader(paint, shader);
sk_shader_unref(shader);
sk_canvas_draw_paint(canvas, paint);
- shader = sk_shader_new_sweep_gradient(&point, colors, NULL, 2, NULL);
- REPORTER_ASSERT(reporter, shader != NULL);
+ shader = sk_shader_new_sweep_gradient(&point, colors, nullptr, 2, nullptr);
+ REPORTER_ASSERT(reporter, shader != nullptr);
sk_paint_set_shader(paint, shader);
sk_shader_unref(shader);
sk_canvas_draw_paint(canvas, paint);
shader = sk_shader_new_two_point_conical_gradient(
- &point, 10.0f, &point2, 50.0f, colors, NULL, 2, tilemode, NULL);
- REPORTER_ASSERT(reporter, shader != NULL);
+ &point, 10.0f, &point2, 50.0f, colors, nullptr, 2, tilemode, nullptr);
+ REPORTER_ASSERT(reporter, shader != nullptr);
sk_paint_set_shader(paint, shader);
sk_shader_unref(shader);
sk_canvas_draw_paint(canvas, paint);
diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp
index e3ceeaf152..c3fc9a47bf 100644
--- a/tests/CachedDataTest.cpp
+++ b/tests/CachedDataTest.cpp
@@ -78,14 +78,14 @@ DEF_TEST(CachedData, reporter) {
const size_t size = 100;
// test with client as last owner
- SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.get() : NULL);
+ SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.get() : nullptr);
check_data(reporter, data, 2, kInCache, kLocked);
data->detachFromCacheAndUnref();
check_data(reporter, data, 1, kNotInCache, kLocked);
data->unref();
// test with cache as last owner
- data = test_locking(reporter, size, useDiscardable ? pool.get() : NULL);
+ data = test_locking(reporter, size, useDiscardable ? pool.get() : nullptr);
check_data(reporter, data, 2, kInCache, kLocked);
data->unref();
check_data(reporter, data, 1, kInCache, kUnlocked);
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 721c0908f8..b58880b10d 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -44,7 +44,7 @@ static SkData* create_data_from_bitmap(const SkBitmap& bm,
if (SkImageEncoder::EncodeStream(&stream, bm, type, 100)) {
return stream.copyToData();
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -108,8 +108,8 @@ static void test_three_encodings(skiatest::Reporter* reporter,
for (size_t i = 0; i < SK_ARRAY_COUNT(types); i++) {
SkImageEncoder::Type type = types[i];
SkAutoDataUnref encoded(create_data_from_bitmap(original, type));
- REPORTER_ASSERT(reporter, encoded.get() != NULL);
- if (NULL == encoded.get()) {
+ REPORTER_ASSERT(reporter, encoded.get() != nullptr);
+ if (nullptr == encoded.get()) {
continue;
}
SkBitmap lazy;
@@ -118,20 +118,20 @@ static void test_three_encodings(skiatest::Reporter* reporter,
if (!installSuccess) {
continue;
}
- REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
+ REPORTER_ASSERT(reporter, nullptr == lazy.getPixels());
{
SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
REPORTER_ASSERT(reporter, lazy.getPixels());
- if (NULL == lazy.getPixels()) {
+ if (nullptr == lazy.getPixels()) {
continue;
}
}
// pixels should be gone!
- REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
+ REPORTER_ASSERT(reporter, nullptr == lazy.getPixels());
{
SkAutoLockPixels autoLockPixels(lazy); // now pixels are good.
REPORTER_ASSERT(reporter, lazy.getPixels());
- if (NULL == lazy.getPixels()) {
+ if (nullptr == lazy.getPixels()) {
continue;
}
}
@@ -184,7 +184,7 @@ protected:
bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) override {
- REPORTER_ASSERT(fReporter, pixels != NULL);
+ REPORTER_ASSERT(fReporter, pixels != nullptr);
REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes());
if (fType != kSucceedGetPixels_TestType) {
return false;
@@ -214,7 +214,7 @@ static void check_test_image_generator_bitmap(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, TestImageGenerator::Height() == bm.height());
SkAutoLockPixels autoLockPixels(bm);
REPORTER_ASSERT(reporter, bm.getPixels());
- if (NULL == bm.getPixels()) {
+ if (nullptr == bm.getPixels()) {
return;
}
int errors = 0;
@@ -240,21 +240,21 @@ static void check_pixelref(TestImageGenerator::TestType type,
SkDiscardableMemory::Factory* factory) {
SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter));
- REPORTER_ASSERT(reporter, gen.get() != NULL);
+ REPORTER_ASSERT(reporter, gen.get() != nullptr);
SkBitmap lazy;
bool success;
if (kSkCaching_PixelRefType == pixelRefType) {
// Ignore factory; use global cache.
success = SkCachingPixelRef::Install(gen.detach(), &lazy);
} else {
- success = SkInstallDiscardablePixelRef(gen.detach(), NULL, &lazy, factory);
+ success = SkInstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory);
}
REPORTER_ASSERT(reporter, success);
if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
check_test_image_generator_bitmap(reporter, lazy);
} else if (TestImageGenerator::kFailGetPixels_TestType == type) {
SkAutoLockPixels autoLockPixels(lazy);
- REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
+ REPORTER_ASSERT(reporter, nullptr == lazy.getPixels());
}
}
@@ -278,17 +278,17 @@ DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
test_newlockdelete(reporter);
check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkCaching_PixelRefType, NULL);
+ reporter, kSkCaching_PixelRefType, nullptr);
check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkCaching_PixelRefType, NULL);
+ reporter, kSkCaching_PixelRefType, nullptr);
check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, NULL);
+ reporter, kSkDiscardable_PixelRefType, nullptr);
check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, NULL);
+ reporter, kSkDiscardable_PixelRefType, nullptr);
SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(1, NULL));
+ SkDiscardableMemoryPool::Create(1, nullptr));
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
reporter, kSkDiscardable_PixelRefType, pool);
@@ -298,7 +298,7 @@ DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool();
- // Only acts differently from NULL on a platform that has a
+ // Only acts differently from nullptr on a platform that has a
// default discardable memory implementation that differs from the
// global DM pool.
check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
@@ -318,7 +318,7 @@ DEF_TEST(Image_NewFromGenerator, r) {
TestImageGenerator::TestType test = testTypes[i];
SkImageGenerator* gen = new TestImageGenerator(test, r);
SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen));
- if (NULL == image.get()) {
+ if (nullptr == image.get()) {
ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
SK_SIZE_T_SPECIFIER "]", i);
continue;
@@ -332,7 +332,7 @@ DEF_TEST(Image_NewFromGenerator, r) {
SkCanvas canvas(bitmap);
const SkColor kDefaultColor = 0xffabcdef;
canvas.clear(kDefaultColor);
- canvas.drawImage(image, 0, 0, NULL);
+ canvas.drawImage(image, 0, 0, nullptr);
if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
REPORTER_ASSERT(
r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0));
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index 8b6aa258c2..b5543a1523 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -37,9 +37,9 @@ public:
OpenLibResult(skiatest::Reporter* reporter) {
if (FLAGS_library.count() == 1) {
fHandle = dlopen(FLAGS_library[0], RTLD_LAZY | RTLD_LOCAL);
- REPORTER_ASSERT_MESSAGE(reporter, fHandle != NULL, "Failed to open library!");
+ REPORTER_ASSERT_MESSAGE(reporter, fHandle != nullptr, "Failed to open library!");
} else {
- fHandle = NULL;
+ fHandle = nullptr;
}
}
@@ -81,7 +81,7 @@ DEF_TEST(CanvasState_test_complex_layers, reporter) {
float r, float b, int32_t s);
OpenLibResult openLibResult(reporter);
- if (openLibResult.handle() != NULL) {
+ if (openLibResult.handle() != nullptr) {
*(void**) (&drawFn) = dlsym(openLibResult.handle(),
"complex_layers_draw_from_canvas_state");
} else {
@@ -183,7 +183,7 @@ DEF_TEST(CanvasState_test_complex_clips, reporter) {
int32_t regionRects, int32_t* rectCoords);
OpenLibResult openLibResult(reporter);
- if (openLibResult.handle() != NULL) {
+ if (openLibResult.handle() != nullptr) {
*(void**) (&drawFn) = dlsym(openLibResult.handle(),
"complex_clips_draw_from_canvas_state");
} else {
@@ -271,7 +271,7 @@ DEF_TEST(CanvasState_test_draw_filters, reporter) {
REPORTER_ASSERT(reporter, tmpCanvas);
REPORTER_ASSERT(reporter, canvas.getDrawFilter());
- REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter());
+ REPORTER_ASSERT(reporter, nullptr == tmpCanvas->getDrawFilter());
tmpCanvas->unref();
SkCanvasStateUtils::ReleaseCanvasState(state);
@@ -292,7 +292,7 @@ DEF_TEST(CanvasState_test_soft_clips, reporter) {
canvas.clipRRect(roundRect, SkRegion::kIntersect_Op, true);
- SkSetErrorCallback(error_callback, NULL);
+ SkSetErrorCallback(error_callback, nullptr);
SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
REPORTER_ASSERT(reporter, !state);
@@ -318,7 +318,7 @@ DEF_TEST(CanvasState_test_saveLayer_clip, reporter) {
// Check that saveLayer without the kClipToLayer_SaveFlag leaves the
// clip stack unchanged.
- canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_NoClipLayer_SaveFlag);
+ canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_NoClipLayer_SaveFlag);
SkRect clipStackBounds;
SkClipStack::BoundsType boundsType;
canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
@@ -328,7 +328,7 @@ DEF_TEST(CanvasState_test_saveLayer_clip, reporter) {
// Check that saveLayer with the kClipToLayer_SaveFlag sets the clip
// stack to the layer bounds.
- canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_ClipLayer_SaveFlag);
canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH);
REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT);
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index f7976356e0..2ec25e4bab 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -215,7 +215,7 @@ static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
static void test_clipstack(skiatest::Reporter* reporter) {
// The clipstack is refcounted, and needs to be able to out-live the canvas if a client has
// ref'd it.
- const SkClipStack* cs = NULL;
+ const SkClipStack* cs = nullptr;
{
SkCanvas canvas(10, 10);
cs = SkRef(canvas.getClipStack());
@@ -356,7 +356,7 @@ TEST_STEP(SaveMatrixClip, SaveMatrixClipStep);
static void SaveLayerStep(SkCanvas* canvas, const TestData& d,
skiatest::Reporter* reporter, CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
canvas->restore();
REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
@@ -366,7 +366,7 @@ TEST_STEP(SaveLayer, SaveLayerStep);
static void BoundedSaveLayerStep(SkCanvas* canvas, const TestData& d,
skiatest::Reporter* reporter, CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
- canvas->saveLayer(&d.fRect, NULL);
+ canvas->saveLayer(&d.fRect, nullptr);
canvas->restore();
REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
@@ -376,7 +376,7 @@ TEST_STEP(BoundedSaveLayer, BoundedSaveLayerStep);
static void PaintSaveLayerStep(SkCanvas* canvas, const TestData& d,
skiatest::Reporter* reporter, CanvasTestStep* testStep) {
int saveCount = canvas->getSaveCount();
- canvas->saveLayer(NULL, &d.fPaint);
+ canvas->saveLayer(nullptr, &d.fPaint);
canvas->restore();
REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
testStep->assertMessage());
@@ -418,7 +418,7 @@ static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
paint.setShader(shader)->unref();
canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts,
- NULL, NULL, NULL, 0, paint);
+ nullptr, nullptr, nullptr, 0, paint);
}
// NYI: issue 240.
TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep);
@@ -427,7 +427,7 @@ static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d,
skiatest::Reporter*, CanvasTestStep*) {
SkPictureRecorder recorder;
SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIntToScalar(d.fHeight),
- NULL, 0);
+ nullptr, 0);
testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1));
testCanvas->clipRect(d.fRect);
testCanvas->drawRect(d.fRect, d.fPaint);
@@ -658,15 +658,15 @@ static void test_newraster(skiatest::Reporter* reporter) {
// now try a deliberately bad info
info = info.makeWH(-1, info.height());
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
// too big
info = info.makeWH(1 << 30, 1 << 30);
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
// not a valid pixel type
info = SkImageInfo::Make(10, 10, kUnknown_SkColorType, info.alphaType());
- REPORTER_ASSERT(reporter, NULL == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
+ REPORTER_ASSERT(reporter, nullptr == SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes));
// We should succeed with a zero-sized valid info
info = SkImageInfo::MakeN32Premul(0, 0);
@@ -696,7 +696,7 @@ DEF_TEST(Canvas_SaveState, reporter) {
REPORTER_ASSERT(reporter, 1 == n);
REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount());
- n = canvas.saveLayer(NULL, NULL);
+ n = canvas.saveLayer(nullptr, nullptr);
REPORTER_ASSERT(reporter, 2 == n);
REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount());
diff --git a/tests/ChecksumTest.cpp b/tests/ChecksumTest.cpp
index 3658bd771e..0302ea9886 100644
--- a/tests/ChecksumTest.cpp
+++ b/tests/ChecksumTest.cpp
@@ -32,8 +32,8 @@ DEF_TEST(Checksum, r) {
for (size_t i = 0; i < SK_ARRAY_COUNT(kAlgorithms); ++i) {
const algorithmProc algorithm = kAlgorithms[i];
- // Hash of NULL is always 0.
- ASSERT(algorithm(NULL, 0) == 0);
+ // Hash of nullptr is always 0.
+ ASSERT(algorithm(nullptr, 0) == 0);
const uint32_t hash = algorithm(data, kBytes);
// Should be deterministic.
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index c0ff7632c7..c57fb37850 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -33,7 +33,7 @@ static GrTexture* create_texture(GrContext* context) {
// We are initializing the texture with zeros here
GrTexture* texture = context->textureProvider()->createTexture(desc, false, textureData, 0);
if (!texture) {
- return NULL;
+ return nullptr;
}
return texture;
@@ -52,7 +52,7 @@ static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) {
desc.fWidth = kXSize;
desc.fHeight = kYSize;
- GrTexture* texture = context->textureProvider()->createTexture(desc, false, NULL, 0);
+ GrTexture* texture = context->textureProvider()->createTexture(desc, false, nullptr, 0);
if (!texture) {
return;
}
@@ -117,7 +117,7 @@ static void check_state(skiatest::Reporter* reporter,
static void check_empty_state(skiatest::Reporter* reporter,
const GrClipMaskCache& cache) {
REPORTER_ASSERT(reporter, SkClipStack::kInvalidGenID == cache.getLastClipGenID());
- REPORTER_ASSERT(reporter, NULL == cache.getLastMask());
+ REPORTER_ASSERT(reporter, nullptr == cache.getLastMask());
SkIRect emptyBound;
emptyBound.setEmpty();
@@ -156,7 +156,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
GrTexture* texture1 = cache.getLastMask();
REPORTER_ASSERT(reporter, texture1);
- if (NULL == texture1) {
+ if (nullptr == texture1) {
return;
}
@@ -179,7 +179,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
GrTexture* texture2 = cache.getLastMask();
REPORTER_ASSERT(reporter, texture2);
- if (NULL == texture2) {
+ if (nullptr == texture2) {
return;
}
@@ -219,7 +219,7 @@ DEF_GPUTEST(ClipCache, reporter, factory) {
continue;
}
GrContext* context = factory->get(glType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 662e68040e..a18d1efe06 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -144,7 +144,7 @@ static void test_iterators(skiatest::Reporter* reporter) {
// bottom to top iteration
{
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
SkClipStack::B2TIter iter(stack);
int i;
@@ -159,7 +159,7 @@ static void test_iterators(skiatest::Reporter* reporter) {
// top to bottom iteration
{
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
int i;
@@ -174,7 +174,7 @@ static void test_iterators(skiatest::Reporter* reporter) {
// skipToTopmost
{
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart);
@@ -383,7 +383,7 @@ static int count(const SkClipStack& stack) {
SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
- const SkClipStack::Element* element = NULL;
+ const SkClipStack::Element* element = nullptr;
int count = 0;
for (element = iter.prev(); element; element = iter.prev(), ++count) {
@@ -964,7 +964,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) {
int32_t reducedGenID;
GrReducedClip::InitialState initial;
SkIRect tBounds(inflatedIBounds);
- SkIRect* tightBounds = r.nextBool() ? &tBounds : NULL;
+ SkIRect* tightBounds = r.nextBool() ? &tBounds : nullptr;
GrReducedClip::ReduceClipStack(stack,
inflatedIBounds,
&reducedClips,
@@ -1129,7 +1129,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
&reducedClips,
&reducedGenID,
&initial,
- testCases[i].tighterBounds.isEmpty() ? NULL : &tightBounds);
+ testCases[i].tighterBounds.isEmpty() ? nullptr : &tightBounds);
REPORTER_ASSERT(reporter, reducedClips.count() == testCases[i].reducedClipCount);
SkASSERT(reducedClips.count() == testCases[i].reducedClipCount);
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index ec6d645196..81d8eb42b5 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -46,7 +46,7 @@ static void compare_to_good_digest(skiatest::Reporter* r, const SkMD5::Digest& g
/**
* Test decoding an SkCodec to a particular SkImageInfo.
*
- * Calling getPixels(info) should return expectedResult, and if goodDigest is non NULL,
+ * Calling getPixels(info) should return expectedResult, and if goodDigest is non nullptr,
* the resulting decode should match.
*/
static void test_info(skiatest::Reporter* r, SkCodec* codec, const SkImageInfo& info,
@@ -104,14 +104,14 @@ static void check(skiatest::Reporter* r,
SkImageInfo info565 = info.makeColorType(kRGB_565_SkColorType);
SkCodec::Result expected = (supports565 && info.alphaType() == kOpaque_SkAlphaType) ?
SkCodec::kSuccess : SkCodec::kInvalidConversion;
- test_info(r, codec, info565, expected, NULL);
+ test_info(r, codec, info565, expected, nullptr);
}
SkBitmap bm;
bm.allocPixels(info);
SkAutoLockPixels autoLockPixels(bm);
SkCodec::Result result =
- codec->getPixels(info, bm.getPixels(), bm.rowBytes(), NULL, NULL, NULL);
+ codec->getPixels(info, bm.getPixels(), bm.rowBytes(), nullptr, nullptr, nullptr);
REPORTER_ASSERT(r, result == SkCodec::kSuccess);
SkMD5::Digest digest;
@@ -124,13 +124,13 @@ static void check(skiatest::Reporter* r,
// Check alpha type conversions
if (info.alphaType() == kOpaque_SkAlphaType) {
test_info(r, codec, info.makeAlphaType(kUnpremul_SkAlphaType),
- SkCodec::kInvalidConversion, NULL);
+ SkCodec::kInvalidConversion, nullptr);
test_info(r, codec, info.makeAlphaType(kPremul_SkAlphaType),
- SkCodec::kInvalidConversion, NULL);
+ SkCodec::kInvalidConversion, nullptr);
} else {
// Decoding to opaque should fail
test_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType),
- SkCodec::kInvalidConversion, NULL);
+ SkCodec::kInvalidConversion, nullptr);
SkAlphaType otherAt = info.alphaType();
if (kPremul_SkAlphaType == otherAt) {
otherAt = kUnpremul_SkAlphaType;
@@ -138,7 +138,7 @@ static void check(skiatest::Reporter* r,
otherAt = kPremul_SkAlphaType;
}
// The other non-opaque alpha type should always succeed, but not match.
- test_info(r, codec, info.makeAlphaType(otherAt), SkCodec::kSuccess, NULL);
+ test_info(r, codec, info.makeAlphaType(otherAt), SkCodec::kSuccess, nullptr);
}
}
@@ -185,7 +185,7 @@ static void check(skiatest::Reporter* r,
SkBitmap bm;
bm.allocPixels(subsetInfo);
const SkCodec::Result result = codec->getPixels(bm.info(), bm.getPixels(), bm.rowBytes(),
- &opts, NULL, NULL);
+ &opts, nullptr, nullptr);
if (supportsSubsetDecoding) {
REPORTER_ASSERT(r, result == SkCodec::kSuccess);
@@ -302,7 +302,7 @@ static void test_dimensions(skiatest::Reporter* r, const char path[]) {
SkAutoTMalloc<SkPMColor> pixels(totalBytes);
SkCodec::Result result =
- codec->getPixels(scaledInfo, pixels.get(), rowBytes, NULL, NULL, NULL);
+ codec->getPixels(scaledInfo, pixels.get(), rowBytes, nullptr, nullptr, nullptr);
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
}
}
@@ -339,7 +339,7 @@ static void test_invalid(skiatest::Reporter* r, const char path[]) {
return;
}
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
- REPORTER_ASSERT(r, NULL == codec);
+ REPORTER_ASSERT(r, nullptr == codec);
}
DEF_TEST(Codec_Empty, r) {
@@ -371,7 +371,7 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) {
SkPMColor colorStorage[256];
int colorCount;
SkCodec::Result result = decoder->start(
- decoder->getInfo().makeColorType(kIndex_8_SkColorType), NULL, colorStorage, &colorCount);
+ decoder->getInfo().makeColorType(kIndex_8_SkColorType), nullptr, colorStorage, &colorCount);
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
// The rest of the test is uninteresting if kIndex8 is not supported
if (SkCodec::kSuccess != result) {
@@ -381,7 +381,7 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) {
// This should return kInvalidParameters because, in kIndex_8 mode, we must pass in a valid
// colorPtr and a valid colorCountPtr.
result = decoder->start(
- decoder->getInfo().makeColorType(kIndex_8_SkColorType), NULL, NULL, NULL);
+ decoder->getInfo().makeColorType(kIndex_8_SkColorType), nullptr, nullptr, nullptr);
REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
result = decoder->start(
decoder->getInfo().makeColorType(kIndex_8_SkColorType));
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp
index d0b0d77ed4..ee8f12b2fb 100644
--- a/tests/ColorFilterTest.cpp
+++ b/tests/ColorFilterTest.cpp
@@ -42,12 +42,12 @@ static void test_composecolorfilter_limit(skiatest::Reporter* reporter) {
for (int i = 2; i < way_too_many; ++i) {
SkAutoTUnref<SkColorFilter> filter(make_filter());
parent.reset(SkColorFilter::CreateComposeFilter(parent, filter));
- if (NULL == parent) {
+ if (nullptr == parent) {
REPORTER_ASSERT(reporter, i > 2); // we need to have succeeded at least once!
return;
}
}
- REPORTER_ASSERT(reporter, false); // we never saw a NULL :(
+ REPORTER_ASSERT(reporter, false); // we never saw a nullptr :(
}
#define ILLEGAL_MODE ((SkXfermode::Mode)-1)
@@ -59,14 +59,14 @@ DEF_TEST(ColorFilter, reporter) {
SkColor color = rand.nextU();
// ensure we always get a filter, by avoiding the possibility of a
- // special case that would return NULL (if color's alpha is 0 or 0xFF)
+ // special case that would return nullptr (if color's alpha is 0 or 0xFF)
color = SkColorSetA(color, 0x7F);
SkColorFilter* cf = SkColorFilter::CreateModeFilter(color,
(SkXfermode::Mode)mode);
// allow for no filter if we're in Dst mode (its a no op)
- if (SkXfermode::kDst_Mode == mode && NULL == cf) {
+ if (SkXfermode::kDst_Mode == mode && nullptr == cf) {
continue;
}
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp
index 228aee9031..d7c3d1d8d4 100644
--- a/tests/DashPathEffectTest.cpp
+++ b/tests/DashPathEffectTest.cpp
@@ -19,8 +19,8 @@ DEF_TEST(DashPathEffectTest_crbug_348821, r) {
SkScalar phase = SK_ScalarInfinity; // Used to force the bad fInitialDashLength = -1 path.
SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, count, phase));
- // NULL -> refuses to work with flattening framework.
- REPORTER_ASSERT(r, dash->getFactory() != NULL);
+ // nullptr -> refuses to work with flattening framework.
+ REPORTER_ASSERT(r, dash->getFactory() != nullptr);
SkWriteBuffer buffer;
buffer.writeFlattenable(dash);
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 58600ef3ee..177c9d37d5 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -33,10 +33,10 @@ static void test_datatable_is_empty(skiatest::Reporter* reporter,
static void test_emptytable(skiatest::Reporter* reporter) {
SkAutoTUnref<SkDataTable> table0(SkDataTable::NewEmpty());
- SkAutoTUnref<SkDataTable> table1(SkDataTable::NewCopyArrays(NULL, NULL, 0));
- SkAutoTUnref<SkDataTable> table2(SkDataTable::NewCopyArray(NULL, 0, 0));
- SkAutoTUnref<SkDataTable> table3(SkDataTable::NewArrayProc(NULL, 0, 0,
- NULL, NULL));
+ SkAutoTUnref<SkDataTable> table1(SkDataTable::NewCopyArrays(nullptr, nullptr, 0));
+ SkAutoTUnref<SkDataTable> table2(SkDataTable::NewCopyArray(nullptr, 0, 0));
+ SkAutoTUnref<SkDataTable> table3(SkDataTable::NewArrayProc(nullptr, 0, 0,
+ nullptr, nullptr));
test_datatable_is_empty(reporter, table0);
test_datatable_is_empty(reporter, table1);
@@ -122,7 +122,7 @@ static void test_globaltable(skiatest::Reporter* reporter) {
int count = SK_ARRAY_COUNT(gData);
SkAutoTUnref<SkDataTable> table(SkDataTable::NewArrayProc(gData,
- sizeof(gData[0]), count, NULL, NULL));
+ sizeof(gData[0]), count, nullptr, nullptr));
REPORTER_ASSERT(reporter, table->count() == count);
for (int i = 0; i < count; ++i) {
@@ -168,7 +168,7 @@ static void test_cstring(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, r0->equals(r1));
- SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL));
+ SkAutoTUnref<SkData> r2(SkData::NewWithCString(nullptr));
REPORTER_ASSERT(reporter, 1 == r2->size());
REPORTER_ASSERT(reporter, 0 == *r2->bytes());
}
@@ -193,13 +193,13 @@ static void test_files(skiatest::Reporter* reporter) {
SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag);
SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file));
- REPORTER_ASSERT(reporter, r1.get() != NULL);
+ REPORTER_ASSERT(reporter, r1.get() != nullptr);
REPORTER_ASSERT(reporter, r1->size() == 26);
REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0);
int fd = sk_fileno(file);
SkAutoTUnref<SkData> r2(SkData::NewFromFD(fd));
- REPORTER_ASSERT(reporter, r2.get() != NULL);
+ REPORTER_ASSERT(reporter, r2.get() != nullptr);
REPORTER_ASSERT(reporter, r2->size() == 26);
REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0);
}
diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp
index 04b1f4010e..b41262f738 100644
--- a/tests/DequeTest.cpp
+++ b/tests/DequeTest.cpp
@@ -13,8 +13,8 @@ static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int c
REPORTER_ASSERT(reporter, deq.empty());
REPORTER_ASSERT(reporter, 0 == deq.count());
REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
- REPORTER_ASSERT(reporter, NULL == deq.front());
- REPORTER_ASSERT(reporter, NULL == deq.back());
+ REPORTER_ASSERT(reporter, nullptr == deq.front());
+ REPORTER_ASSERT(reporter, nullptr == deq.back());
} else {
REPORTER_ASSERT(reporter, !deq.empty());
REPORTER_ASSERT(reporter, count == deq.count());
diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp
index e0145bc5ab..cabd14b6ea 100644
--- a/tests/DiscardableMemoryPoolTest.cpp
+++ b/tests/DiscardableMemoryPoolTest.cpp
@@ -10,12 +10,12 @@
DEF_TEST(DiscardableMemoryPool, reporter) {
SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(1, NULL));
+ SkDiscardableMemoryPool::Create(1, nullptr));
pool->setRAMBudget(3);
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
SkAutoTDelete<SkDiscardableMemory> dm1(pool->create(100));
- REPORTER_ASSERT(reporter, dm1->data() != NULL);
+ REPORTER_ASSERT(reporter, dm1->data() != nullptr);
REPORTER_ASSERT(reporter, 100 == pool->getRAMUsed());
dm1->unlock();
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
diff --git a/tests/DiscardableMemoryTest.cpp b/tests/DiscardableMemoryTest.cpp
index da36ffd8b0..28dd6e98a5 100644
--- a/tests/DiscardableMemoryTest.cpp
+++ b/tests/DiscardableMemoryTest.cpp
@@ -13,12 +13,12 @@ DEF_TEST(DiscardableMemory, reporter) {
const char testString[] = "HELLO, WORLD!";
const size_t len = sizeof(testString);
SkAutoTDelete<SkDiscardableMemory> dm(SkDiscardableMemory::Create(len));
- REPORTER_ASSERT(reporter, dm.get() != NULL);
- if (NULL == dm.get()) {
+ REPORTER_ASSERT(reporter, dm.get() != nullptr);
+ if (nullptr == dm.get()) {
return;
}
void* ptr = dm->data();
- REPORTER_ASSERT(reporter, ptr != NULL);
+ REPORTER_ASSERT(reporter, ptr != nullptr);
memcpy(ptr, testString, sizeof(testString));
dm->unlock();
bool success = dm->lock();
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 0b0c87c88e..8836a7bd5c 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -32,9 +32,9 @@ protected:
static void test_faulty_pixelref(skiatest::Reporter* reporter) {
// need a cache, but don't expect to use it, so the budget is not critical
SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(10 * 1000, NULL));
+ SkDiscardableMemoryPool::Create(10 * 1000, nullptr));
SkBitmap bm;
- bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, NULL, &bm, pool);
+ bool success = SkInstallDiscardablePixelRef(new FailureImageGenerator, nullptr, &bm, pool);
REPORTER_ASSERT(reporter, success);
// now our bitmap has a pixelref, but we know it will fail to lock
@@ -300,7 +300,7 @@ DEF_TEST(DrawBitmapRect, reporter) {
SkIRect srcR = { gWidth, 0, gWidth + 16, 16 };
SkRect dstR = { 0, 0, SkIntToScalar(16), SkIntToScalar(16) };
- canvas.drawBitmapRect(src, srcR, dstR, NULL);
+ canvas.drawBitmapRect(src, srcR, dstR, nullptr);
// ensure that we draw nothing if srcR does not intersect the bitmap
REPORTER_ASSERT(reporter, check_for_all_zeros(dst));
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index de4672dd67..6381a3c8fa 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -30,14 +30,14 @@ static void test_saverestore(skiatest::Reporter* reporter) {
SkAutoTUnref<TestFilter> df(new TestFilter);
- REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter());
+ REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
canvas->save();
canvas->setDrawFilter(df);
- REPORTER_ASSERT(reporter, NULL != canvas->getDrawFilter());
+ REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter());
canvas->restore();
- REPORTER_ASSERT(reporter, NULL == canvas->getDrawFilter());
+ REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
}
DEF_TEST(DrawFilter, reporter) {
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 67af75568a..4351faf70e 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -269,7 +269,7 @@ static void test_crbug_165432(skiatest::Reporter* reporter) {
SkPath filteredPath;
SkStrokeRec rec(paint);
- REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, NULL));
+ REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullptr));
REPORTER_ASSERT(reporter, filteredPath.isEmpty());
}
diff --git a/tests/DynamicHashTest.cpp b/tests/DynamicHashTest.cpp
index 4a5bb850f8..289b332c02 100644
--- a/tests/DynamicHashTest.cpp
+++ b/tests/DynamicHashTest.cpp
@@ -100,14 +100,14 @@ DEF_TEST(DynamicHash_lookup, reporter) {
ASSERT(hash.countCollisions(9) == 2);
// We can find our data right?
- ASSERT(hash.find(1) != NULL);
+ ASSERT(hash.find(1) != nullptr);
ASSERT(hash.find(1)->value == 2.0);
- ASSERT(hash.find(5) != NULL);
+ ASSERT(hash.find(5) != nullptr);
ASSERT(hash.find(5)->value == 3.0);
// These aren't in the hash.
- ASSERT(hash.find(2) == NULL);
- ASSERT(hash.find(9) == NULL);
+ ASSERT(hash.find(2) == nullptr);
+ ASSERT(hash.find(9) == nullptr);
}
DEF_TEST(DynamicHash_remove, reporter) {
@@ -123,16 +123,16 @@ DEF_TEST(DynamicHash_remove, reporter) {
hash.remove(1);
// a should be marked deleted, and b should still be findable.
- ASSERT(hash.find(1) == NULL);
- ASSERT(hash.find(5) != NULL);
+ ASSERT(hash.find(1) == nullptr);
+ ASSERT(hash.find(5) != nullptr);
ASSERT(hash.find(5)->value == 3.0);
// This will go in the same slot as 'a' did before.
ASSERT(hash.countCollisions(9) == 0);
hash.add(&c);
- ASSERT(hash.find(9) != NULL);
+ ASSERT(hash.find(9) != nullptr);
ASSERT(hash.find(9)->value == 4.0);
- ASSERT(hash.find(5) != NULL);
+ ASSERT(hash.find(5) != nullptr);
ASSERT(hash.find(5)->value == 3.0);
}
@@ -161,7 +161,7 @@ template<typename T> static void TestIter(skiatest::Reporter* reporter) {
for (T iter(&hash); !iter.done(); ++iter) {
int key = (*iter).key;
keys[count] = key;
- ASSERT(hash.find(key) != NULL);
+ ASSERT(hash.find(key) != nullptr);
++count;
}
ASSERT(3 == count);
@@ -177,7 +177,7 @@ template<typename T> static void TestIter(skiatest::Reporter* reporter) {
int key = (*iter).key;
keys[count] = key;
ASSERT(key != 1);
- ASSERT(hash.find(key) != NULL);
+ ASSERT(hash.find(key) != nullptr);
++count;
}
ASSERT(2 == count);
@@ -215,8 +215,8 @@ static void TestResetOrRewind(skiatest::Reporter* reporter, bool testReset) {
ASSERT(hash.count() == 2);
ASSERT(hash.capacity() == 4);
- ASSERT(hash.find(1) != NULL);
- ASSERT(hash.find(2) != NULL);
+ ASSERT(hash.find(1) != nullptr);
+ ASSERT(hash.find(2) != nullptr);
}
DEF_TEST(DynamicHash_reset, reporter) {
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 1adc7442af..c5103c813f 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -55,14 +55,14 @@ void runFPTest(skiatest::Reporter* reporter, GrContextFactory* factory,
continue;
}
GrContext* context = factory->get(type);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
desc, false, controlPixelData.begin(), 0));
// Floating point textures are NOT supported everywhere
- if (NULL == fpTexture) {
+ if (nullptr == fpTexture) {
continue;
}
fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index 7ac3da363a..7843a412a1 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -91,7 +91,7 @@ DEF_TEST(FontHostStream, reporter) {
SkTypeface* origTypeface = paint.getTypeface();
SkAutoTUnref<SkTypeface> aur;
- if (NULL == origTypeface) {
+ if (nullptr == origTypeface) {
origTypeface = aur.reset(SkTypeface::RefDefault());
}
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index db83e06b62..d9a3df414a 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -112,7 +112,7 @@ static void test_charsToGlyphs(skiatest::Reporter* reporter, SkTypeface* face) {
}
static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream, int ttcIndex) {
- int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL);
+ int n = SkFontStream::GetTableTags(stream, ttcIndex, nullptr);
SkAutoTArray<SkFontTableTag> array(n);
int n2 = SkFontStream::GetTableTags(stream, ttcIndex, array.get());
@@ -214,7 +214,7 @@ static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
static void test_tables(skiatest::Reporter* reporter) {
static const char* const gNames[] = {
- NULL, // default font
+ nullptr, // default font
"Helvetica", "Arial",
"Times", "Times New Roman",
"Courier", "Courier New",
@@ -242,7 +242,7 @@ static void test_tables(skiatest::Reporter* reporter) {
*/
static void test_advances(skiatest::Reporter* reporter) {
static const char* const faces[] = {
- NULL, // default font
+ nullptr, // default font
"Arial", "Times", "Times New Roman", "Helvetica", "Courier",
"Courier New", "Verdana", "monospace",
};
diff --git a/tests/FontMgrAndroidParserTest.cpp b/tests/FontMgrAndroidParserTest.cpp
index 5c282ed2a7..a45bc259f4 100644
--- a/tests/FontMgrAndroidParserTest.cpp
+++ b/tests/FontMgrAndroidParserTest.cpp
@@ -187,7 +187,7 @@ DEF_TEST(FontMgrAndroidParser, reporter) {
SkFontMgr_Android_Parser::GetCustomFontFamilies(v22FontFamilies,
SkString("/custom/font/path/"),
GetResourcePath("android_fonts/v22/fonts.xml").c_str(),
- NULL);
+ nullptr);
if (v22FontFamilies.count() > 0) {
REPORTER_ASSERT(reporter, v22FontFamilies.count() == 54);
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index a1dc9dc0b3..56a791a98b 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -14,7 +14,7 @@
#include "SkPaint.h"
static void test_font(skiatest::Reporter* reporter) {
uint32_t flags = 0;
- SkAutoTUnref<SkFont> font(SkFont::Create(NULL, 24, SkFont::kA8_MaskType, flags));
+ SkAutoTUnref<SkFont> font(SkFont::Create(nullptr, 24, SkFont::kA8_MaskType, flags));
REPORTER_ASSERT(reporter, font->getTypeface());
REPORTER_ASSERT(reporter, 24 == font->getSize());
@@ -61,7 +61,7 @@ static void test_alias_names(skiatest::Reporter* reporter) {
for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) {
SkAutoTUnref<SkTypeface> first(SkTypeface::CreateFromName(inNames[i],
SkTypeface::kNormal));
- if (NULL == first.get()) {
+ if (nullptr == first.get()) {
continue;
}
for (int j = 0; j < 10; ++j) {
diff --git a/tests/FontObjTest.cpp b/tests/FontObjTest.cpp
index c2d8f5d328..9d18ce6b2e 100644
--- a/tests/FontObjTest.cpp
+++ b/tests/FontObjTest.cpp
@@ -43,7 +43,7 @@ static void test_cachedfont(skiatest::Reporter* reporter, const SkPaint& paint)
static void test_cachedfont(skiatest::Reporter* reporter) {
static const char* const faces[] = {
- NULL, // default font
+ nullptr, // default font
"Arial", "Times", "Times New Roman", "Helvetica", "Courier",
"Courier New", "Verdana", "monospace",
};
diff --git a/tests/GLInterfaceValidationTest.cpp b/tests/GLInterfaceValidationTest.cpp
index 1448f28fb0..7af34a7fe0 100755
--- a/tests/GLInterfaceValidationTest.cpp
+++ b/tests/GLInterfaceValidationTest.cpp
@@ -24,7 +24,7 @@ DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
if (GrContextFactory::kNVPR_GLContextType == glCtxType &&
factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
!factory->getGLContext(GrContextFactory::kNative_GLContextType)->gl()->hasExtension("GL_NV_path_rendering")) {
- REPORTER_ASSERT(reporter, NULL == glCtx);
+ REPORTER_ASSERT(reporter, nullptr == glCtx);
continue;
}
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index d5251baf75..7f23f93d34 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -127,7 +127,7 @@ static GrRenderTarget* random_render_target(GrTextureProvider* textureProvider,
textureProvider->assignUniqueKeyToTexture(key, texture);
}
}
- return texture ? texture->asRenderTarget() : NULL;
+ return texture ? texture->asRenderTarget() : nullptr;
}
static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestData* d) {
@@ -202,13 +202,13 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
SkAutoTUnref<GrTexture> dummyTexture1(
- context->textureProvider()->createTexture(dummyDesc, false, NULL, 0));
+ context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0));
dummyDesc.fFlags = kNone_GrSurfaceFlags;
dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
SkAutoTUnref<GrTexture> dummyTexture2(
- context->textureProvider()->createTexture(dummyDesc, false, NULL, 0));
+ context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0));
if (!dummyTexture1 || ! dummyTexture2) {
SkDebugf("Could not allocate dummy textures");
diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp
index 5aa80d0b1f..f89914fa74 100644
--- a/tests/GeometryTest.cpp
+++ b/tests/GeometryTest.cpp
@@ -60,7 +60,7 @@ static void test_evalquadat(skiatest::Reporter* reporter) {
check_pairs(reporter, i, t, "quad-pos", r0.fX, r0.fY, r1.fX, r1.fY);
SkVector v0;
- SkEvalQuadAt(pts, t, NULL, &v0);
+ SkEvalQuadAt(pts, t, nullptr, &v0);
SkVector v1 = SkEvalQuadTangentAt(pts, t);
check_pairs(reporter, i, t, "quad-tan", v0.fX, v0.fY, v1.fX, v1.fY);
@@ -71,14 +71,14 @@ static void test_evalquadat(skiatest::Reporter* reporter) {
static void test_conic_eval_pos(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) {
SkPoint p0, p1;
- conic.evalAt(t, &p0, NULL);
+ conic.evalAt(t, &p0, nullptr);
p1 = conic.evalAt(t);
check_pairs(reporter, 0, t, "conic-pos", p0.fX, p0.fY, p1.fX, p1.fY);
}
static void test_conic_eval_tan(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) {
SkVector v0, v1;
- conic.evalAt(t, NULL, &v0);
+ conic.evalAt(t, nullptr, &v0);
v1 = conic.evalTangentAt(t);
check_pairs(reporter, 0, t, "conic-tan", v0.fX, v0.fY, v1.fX, v1.fY);
}
@@ -155,9 +155,9 @@ static void test_cubic_tangents(skiatest::Reporter* reporter) {
for (int index = 0; index < count; ++index) {
SkConic conic(&pts[index * 3], 0.707f);
SkVector start, mid, end;
- SkEvalCubicAt(&pts[index * 4], 0, NULL, &start, NULL);
- SkEvalCubicAt(&pts[index * 4], .5f, NULL, &mid, NULL);
- SkEvalCubicAt(&pts[index * 4], 1, NULL, &end, NULL);
+ SkEvalCubicAt(&pts[index * 4], 0, nullptr, &start, nullptr);
+ SkEvalCubicAt(&pts[index * 4], .5f, nullptr, &mid, nullptr);
+ SkEvalCubicAt(&pts[index * 4], 1, nullptr, &end, nullptr);
REPORTER_ASSERT(reporter, start.fX && start.fY);
REPORTER_ASSERT(reporter, mid.fX && mid.fY);
REPORTER_ASSERT(reporter, end.fX && end.fY);
diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp
index 0c4cf234bf..5ecc623756 100644
--- a/tests/GpuColorFilterTest.cpp
+++ b/tests/GpuColorFilterTest.cpp
@@ -121,7 +121,7 @@ DEF_GPUTEST(GpuColorFilter, reporter, factory) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
GrContext* grContext = factory->get(glType);
- if (NULL == grContext) {
+ if (nullptr == grContext) {
continue;
}
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index b86689fd4e..f23f5ef8dc 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -48,7 +50,7 @@ DEF_GPUTEST(GpuDrawPath, reporter, factory) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
GrContext* grContext = factory->get(glType);
- if (NULL == grContext) {
+ if (nullptr == grContext) {
continue;
}
static const int sampleCounts[] = { 0, 4, 16 };
@@ -58,7 +60,7 @@ DEF_GPUTEST(GpuDrawPath, reporter, factory) {
SkAutoTUnref<SkSurface> surface(
SkSurface::NewRenderTarget(grContext, SkSurface::kNo_Budgeted, info,
- sampleCounts[i], NULL));
+ sampleCounts[i], nullptr));
test_drawPathEmpty(reporter, surface->getCanvas());
}
}
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index 411a10ba3b..95ac7b641d 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -46,7 +46,7 @@ static void create_layers(skiatest::Reporter* reporter,
SkIRect::MakeEmpty(),
SkMatrix::I(),
indices, 1,
- NULL);
+ nullptr);
REPORTER_ASSERT(reporter, layer);
GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(),
indices, 1);
@@ -57,8 +57,8 @@ static void create_layers(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID());
REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1);
REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2);
- REPORTER_ASSERT(reporter, NULL == layer->texture());
- REPORTER_ASSERT(reporter, NULL == layer->paint());
+ REPORTER_ASSERT(reporter, nullptr == layer->texture());
+ REPORTER_ASSERT(reporter, nullptr == layer->paint());
REPORTER_ASSERT(reporter, !layer->isAtlased());
}
}
@@ -106,7 +106,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
GrContext* context = factory->get(glCtxType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
@@ -169,7 +169,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
} else {
#endif
// The final layer should not be atlased.
- REPORTER_ASSERT(reporter, NULL == layer->texture());
+ REPORTER_ASSERT(reporter, nullptr == layer->texture());
REPORTER_ASSERT(reporter, !layer->isAtlased());
#if GR_CACHE_HOISTED_LAYERS
}
@@ -207,12 +207,12 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// The one that was never atlased should still be around
REPORTER_ASSERT(reporter, layer);
- REPORTER_ASSERT(reporter, NULL == layer->texture());
+ REPORTER_ASSERT(reporter, nullptr == layer->texture());
REPORTER_ASSERT(reporter, !layer->isAtlased());
#if GR_CACHE_HOISTED_LAYERS
} else {
// The one bumped out of the atlas (i.e., 0) should be gone
- REPORTER_ASSERT(reporter, NULL == layer);
+ REPORTER_ASSERT(reporter, nullptr == layer);
}
#endif
}
@@ -242,7 +242,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// but should eliminate the free-floating layers.
create_layers(reporter, &cache, *picture, kInitialNumLayers, 0);
- picture.reset(NULL);
+ picture.reset(nullptr);
cache.processDeletedPictures();
REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0);
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index 1d884acd9c..787f16c983 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
@@ -16,17 +18,17 @@ DEF_GPUTEST(GrContextFactory, reporter, factory) {
// Before we ask for a context, we expect the GL context to not be there.
REPORTER_ASSERT(reporter,
- NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
+ nullptr == factory->getGLContext(GrContextFactory::kNull_GLContextType));
// After we ask for a context, we expect that the GL context to be there.
factory->get(GrContextFactory::kNull_GLContextType);
REPORTER_ASSERT(reporter,
- factory->getGLContext(GrContextFactory::kNull_GLContextType) != NULL);
+ factory->getGLContext(GrContextFactory::kNull_GLContextType) != nullptr);
// If we did not ask for a context with the particular GL context, we would
// expect the particular GL context to not be there.
REPORTER_ASSERT(reporter,
- NULL == factory->getGLContext(GrContextFactory::kDebug_GLContextType));
+ nullptr == factory->getGLContext(GrContextFactory::kDebug_GLContextType));
}
#endif
diff --git a/tests/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp
index 6f3f31f17b..ce3da8098e 100644
--- a/tests/GrDrawTargetTest.cpp
+++ b/tests/GrDrawTargetTest.cpp
@@ -27,7 +27,7 @@ DEF_GPUTEST(GrDrawTarget, reporter, factory) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
GrContext* grContext = factory->get(glType);
- if (NULL == grContext) {
+ if (nullptr == grContext) {
continue;
}
diff --git a/tests/GrGLSLPrettyPrintTest.cpp b/tests/GrGLSLPrettyPrintTest.cpp
index 827a27b4c5..1a5152fa75 100644
--- a/tests/GrGLSLPrettyPrintTest.cpp
+++ b/tests/GrGLSLPrettyPrintTest.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
#if SK_SUPPORT_GPU
#include "Test.h"
#include "gl/GrGLSLPrettyPrint.h"
@@ -117,7 +119,7 @@ DEF_TEST(GrGLSLPrettyPrint, r) {
// Just test we don't crash with garbage input
ASSERT(GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(), 1,
- true).c_str() != NULL);
+ true).c_str() != nullptr);
}
#endif
diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp
index 4f53c1deda..1aecce328c 100644
--- a/tests/GrMemoryPoolTest.cpp
+++ b/tests/GrMemoryPoolTest.cpp
@@ -51,7 +51,7 @@ public:
}
static void ResetAllocator() {
- gPool.reset(NULL);
+ gPool.reset(nullptr);
}
private:
@@ -164,7 +164,7 @@ A* A::Create(SkRandom* r) {
return new E;
default:
// suppress warning
- return NULL;
+ return nullptr;
}
}
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index b40ae7cc94..87b7a2edfa 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -76,10 +76,10 @@ public:
const GrProcOptInfo& colorPOI, const GrProcOptInfo& covPOI) {
SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode));
SkAutoTUnref<GrXferProcessor> xp(
- xpf->createXferProcessor(colorPOI, covPOI, false, NULL, caps));
+ xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps));
TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false));
xpf->getInvariantBlendedColor(colorPOI, &fBlendedColor);
- fOptFlags = xp->getOptimizations(colorPOI, covPOI, false, NULL, caps);
+ fOptFlags = xp->getOptimizations(colorPOI, covPOI, false, nullptr, caps);
GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType);
xp->getBlendInfo(&fBlendInfo);
TEST_ASSERT(!xp->willReadDstColor());
@@ -100,8 +100,8 @@ public:
static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcOptInfo colorPOI, covPOI;
- colorPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, false);
- covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true);
+ colorPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, false);
+ covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true);
SkASSERT(!colorPOI.isOpaque());
SkASSERT(!colorPOI.isSolidWhite());
@@ -291,9 +291,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcOptInfo colorPOI, covPOI;
- colorPOI.calcWithInitialValues(NULL, 0, GrColorPackRGBA(229, 0, 154, 0),
+ colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(229, 0, 154, 0),
kR_GrColorComponentFlag | kB_GrColorComponentFlag, false);
- covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true);
+ covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true);
SkASSERT(!colorPOI.isOpaque());
SkASSERT(!colorPOI.isSolidWhite());
@@ -494,8 +494,8 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcOptInfo colorPOI, covPOI;
- colorPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kA_GrColorComponentFlag, false);
- covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true);
+ colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kA_GrColorComponentFlag, false);
+ covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true);
SkASSERT(colorPOI.isOpaque());
SkASSERT(!colorPOI.isSolidWhite());
@@ -691,9 +691,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcOptInfo colorPOI, covPOI;
- colorPOI.calcWithInitialValues(NULL, 0, GrColorPackRGBA(0, 82, 0, 255),
+ colorPOI.calcWithInitialValues(nullptr, 0, GrColorPackRGBA(0, 82, 0, 255),
kG_GrColorComponentFlag | kA_GrColorComponentFlag, false);
- covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true);
+ covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255), kRGBA_GrColorComponentFlags, true);
SkASSERT(colorPOI.isOpaque());
SkASSERT(!colorPOI.isSolidWhite());
@@ -916,8 +916,8 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
} testLCDCoverageBatch;
GrProcOptInfo colorPOI, covPOI;
- colorPOI.calcColorWithBatch(&testLCDCoverageBatch, NULL, 0);
- covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, NULL, 0);
+ colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0);
+ covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0);
SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
SkASSERT(covPOI.isFourChannelOutput());
@@ -926,7 +926,7 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false));
SkAutoTUnref<GrXferProcessor> xp(
- xpf->createXferProcessor(colorPOI, covPOI, false, NULL, caps));
+ xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
return;
@@ -985,13 +985,13 @@ static void test_no_dual_source_blending(skiatest::Reporter* reporter) {
for (size_t c = 0; c < SK_ARRAY_COUNT(testColors); c++) {
GrProcOptInfo colorPOI;
- colorPOI.calcWithInitialValues(NULL, 0, testColors[c], testColorFlags[c], false);
+ colorPOI.calcWithInitialValues(nullptr, 0, testColors[c], testColorFlags[c], false);
for (int f = 0; f <= 1; f++) {
GrProcOptInfo covPOI;
if (!f) {
- covPOI.calcWithInitialValues(NULL, 0, 0, kNone_GrColorComponentFlags, true);
+ covPOI.calcWithInitialValues(nullptr, 0, 0, kNone_GrColorComponentFlags, true);
} else {
- covPOI.calcWithInitialValues(NULL, 0, GrColorPackA4(255),
+ covPOI.calcWithInitialValues(nullptr, 0, GrColorPackA4(255),
kRGBA_GrColorComponentFlags, true);
}
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index b9bb319210..24ffc7c5d3 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -27,7 +27,7 @@ DEF_GPUTEST(GrSurface, reporter, factory) {
desc.fWidth = 256;
desc.fHeight = 256;
desc.fSampleCnt = 0;
- GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, NULL, 0);
+ GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
REPORTER_ASSERT(reporter, texRT1 == texRT1->asRenderTarget());
REPORTER_ASSERT(reporter, texRT1 == texRT1->asTexture());
@@ -39,8 +39,8 @@ DEF_GPUTEST(GrSurface, reporter, factory) {
static_cast<GrSurface*>(texRT1->asTexture()));
desc.fFlags = kNone_GrSurfaceFlags;
- GrSurface* tex1 = context->textureProvider()->createTexture(desc, false, NULL, 0);
- REPORTER_ASSERT(reporter, NULL == tex1->asRenderTarget());
+ GrSurface* tex1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
+ REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1 == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1) == tex1->asTexture());
diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp
index ab5c02ac94..f046f8ff6b 100644
--- a/tests/GrTextureMipMapInvalidationTest.cpp
+++ b/tests/GrTextureMipMapInvalidationTest.cpp
@@ -29,12 +29,12 @@ DEF_GPUTEST(GrTextureMipMapInvalidationTest, reporter, factory) {
desc.fWidth = 256;
desc.fHeight = 256;
desc.fSampleCnt = 0;
- GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, NULL, 0);
- GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, NULL, 0);
- REPORTER_ASSERT(reporter, NULL != texRT1);
- REPORTER_ASSERT(reporter, NULL != texRT2);
+ GrSurface* texRT1 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
+ GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, nullptr, 0);
+ REPORTER_ASSERT(reporter, nullptr != texRT1);
+ REPORTER_ASSERT(reporter, nullptr != texRT2);
GrTexture* tex = texRT1->asTexture();
- REPORTER_ASSERT(reporter, NULL != tex);
+ REPORTER_ASSERT(reporter, nullptr != tex);
SkBitmap bitmap;
GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap);
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index a2814a3961..d0ea1f2b4d 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -18,7 +18,7 @@
static void test_big_grad(skiatest::Reporter* reporter) {
const SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
const SkPoint pts[] = {{ 15, 14.7112684f }, { 0.709064007f, 12.6108112f }};
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
SkPaint paint;
paint.setShader(s)->unref();
@@ -67,15 +67,15 @@ struct GradRec {
static void none_gradproc(skiatest::Reporter* reporter, const GradRec&) {
SkAutoTUnref<SkShader> s(SkShader::CreateEmptyShader());
- REPORTER_ASSERT(reporter, SkShader::kNone_GradientType == s->asAGradient(NULL));
+ REPORTER_ASSERT(reporter, SkShader::kNone_GradientType == s->asAGradient(nullptr));
}
static void color_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
SkAutoTUnref<SkShader> s(new SkColorShader(rec.fColors[0]));
- REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(NULL));
+ REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(nullptr));
SkShader::GradientInfo info;
- info.fColors = NULL;
+ info.fColors = nullptr;
info.fColorCount = 0;
s->asAGradient(&info);
REPORTER_ASSERT(reporter, 1 == info.fColorCount);
diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp
index f53faaf864..c90c377cc2 100644
--- a/tests/HashTest.cpp
+++ b/tests/HashTest.cpp
@@ -94,7 +94,7 @@ namespace {
class CopyCounter {
public:
- CopyCounter() : fID(0), fCounter(NULL) {}
+ CopyCounter() : fID(0), fCounter(nullptr) {}
CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {}
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index 98fb4efb7d..89d2f8d5dd 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -27,7 +27,7 @@ struct TestingRec : public SkResourceCache::Rec {
const Key& getKey() const override { return fKey; }
size_t bytesUsed() const override { return sizeof(fKey) + sizeof(fValue); }
const char* getCategory() const override { return "test_cache"; }
- SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return NULL; }
+ SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return nullptr; }
static bool Visitor(const SkResourceCache::Rec& baseRec, void* context) {
const TestingRec& rec = static_cast<const TestingRec&>(baseRec);
@@ -122,7 +122,7 @@ DEF_TEST(ImageCache, reporter) {
}
{
SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(defLimit, NULL));
+ SkDiscardableMemoryPool::Create(defLimit, nullptr));
gPool = pool.get();
SkResourceCache cache(pool_factory);
test_cache(reporter, cache, true);
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 971c3e791f..69ed7dedad 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -87,7 +87,7 @@ static void compare_unpremul(skiatest::Reporter* reporter, const SkString& filen
}
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
SkDebugf("couldn't decode %s\n", filename.c_str());
return;
}
@@ -176,7 +176,7 @@ static void test_alphaType(skiatest::Reporter* reporter, const SkString& filenam
SkFILEStream stream(filename.c_str());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
return;
}
@@ -281,7 +281,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, decoder.get());
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
continue;
}
@@ -424,8 +424,8 @@ DEF_TEST(WebP, reporter) {
static SkPixelRef* install_pixel_ref(SkBitmap* bitmap,
SkStreamRewindable* stream,
int sampleSize, bool ditherImage) {
- SkASSERT(bitmap != NULL);
- SkASSERT(stream != NULL);
+ SkASSERT(bitmap != nullptr);
+ SkASSERT(stream != nullptr);
SkASSERT(stream->rewind());
SkColorType colorType = bitmap->colorType();
SkDecodingImageGenerator::Options opts(sampleSize, ditherImage, colorType);
@@ -433,7 +433,7 @@ static SkPixelRef* install_pixel_ref(SkBitmap* bitmap,
SkDecodingImageGenerator::Create(stream, opts), bitmap)) {
return bitmap->pixelRef();
}
- return NULL;
+ return nullptr;
}
/**
* A test for the SkDecodingImageGenerator::Create and
@@ -515,13 +515,13 @@ static void test_options(skiatest::Reporter* reporter,
SkBitmap bm;
bool success = false;
if (useData) {
- if (NULL == encodedData) {
+ if (nullptr == encodedData) {
return;
}
success = SkInstallDiscardablePixelRef(
SkDecodingImageGenerator::Create(encodedData, opts), &bm);
} else {
- if (NULL == encodedStream) {
+ if (nullptr == encodedStream) {
return;
}
success = SkInstallDiscardablePixelRef(
@@ -554,7 +554,7 @@ static void test_options(skiatest::Reporter* reporter,
// && out_size <= SkNextPow2(((in_size - 1) / sample_size) + 1));
#endif // SK_BUILD_FOR_ANDROID || SK_BUILD_FOR_UNIX
SkAutoLockPixels alp(bm);
- if (bm.getPixels() == NULL) {
+ if (bm.getPixels() == nullptr) {
ERRORF(reporter, "Pixel decode failed [sampleSize=%d dither=%s "
"colorType=%s %s]", opts.fSampleSize, yn(opts.fDitherImage),
options_colorType(opts), path.c_str());
@@ -635,10 +635,10 @@ DEF_TEST(ImageDecoderOptions, reporter) {
}
SkAutoDataUnref encodedData(SkData::NewFromFileName(path.c_str()));
- REPORTER_ASSERT(reporter, encodedData.get() != NULL);
+ REPORTER_ASSERT(reporter, encodedData.get() != nullptr);
SkAutoTDelete<SkStreamRewindable> encodedStream(
SkStream::NewFromFile(path.c_str()));
- REPORTER_ASSERT(reporter, encodedStream.get() != NULL);
+ REPORTER_ASSERT(reporter, encodedStream.get() != nullptr);
for (size_t i = 0; i < SK_ARRAY_COUNT(scaleList); ++i) {
for (size_t j = 0; j < SK_ARRAY_COUNT(ditherList); ++j) {
@@ -702,13 +702,13 @@ public:
SkASSERT(bm);
if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) {
bm->setPixels(fPixels, ct);
- fPixels = NULL;
+ fPixels = nullptr;
fSize = 0;
return true;
}
- return bm->tryAllocPixels(NULL, ct);
+ return bm->tryAllocPixels(nullptr, ct);
}
- bool ready() { return fPixels != NULL; }
+ bool ready() { return fPixels != nullptr; }
private:
void* fPixels;
size_t fSize;
@@ -727,7 +727,7 @@ DEF_TEST(ImageDecoding_JpegOverwrite, r) {
return;
}
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
- if (NULL == decoder.get()) {
+ if (nullptr == decoder.get()) {
ERRORF(r, "\nSkImageDecoder::Factory failed.\n");
return;
}
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index f2aa0e94e9..8c3206680a 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -47,7 +47,7 @@ namespace {
class MatrixTestImageFilter : public SkImageFilter {
public:
MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix)
- : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMatrix) {
+ : SkImageFilter(0, nullptr), fReporter(reporter), fExpectedMatrix(expectedMatrix) {
}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx,
@@ -123,7 +123,7 @@ static void make_small_bitmap(SkBitmap& bitmap) {
}
}
-static SkImageFilter* make_scale(float amount, SkImageFilter* input = NULL) {
+static SkImageFilter* make_scale(float amount, SkImageFilter* input = nullptr) {
SkScalar s = amount;
SkScalar matrix[20] = { s, 0, 0, 0, 0,
0, s, 0, 0, 0,
@@ -155,10 +155,10 @@ DEF_TEST(ImageFilter, reporter) {
// Check that two non-clipping color-matrice-filters concatenate into a single filter.
SkAutoTUnref<SkImageFilter> halfBrightness(make_scale(0.5f));
SkAutoTUnref<SkImageFilter> quarterBrightness(make_scale(0.5f, halfBrightness));
- REPORTER_ASSERT(reporter, NULL == quarterBrightness->getInput(0));
+ REPORTER_ASSERT(reporter, nullptr == quarterBrightness->getInput(0));
SkColorFilter* cf;
REPORTER_ASSERT(reporter, quarterBrightness->asColorFilter(&cf));
- REPORTER_ASSERT(reporter, cf->asColorMatrix(NULL));
+ REPORTER_ASSERT(reporter, cf->asColorMatrix(nullptr));
cf->unref();
}
@@ -167,38 +167,38 @@ DEF_TEST(ImageFilter, reporter) {
// concatenates into a single filter, but not a matrixfilter (due to clamping).
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, nullptr == halfBrightness->getInput(0));
SkColorFilter* cf;
REPORTER_ASSERT(reporter, halfBrightness->asColorFilter(&cf));
- REPORTER_ASSERT(reporter, !cf->asColorMatrix(NULL));
+ REPORTER_ASSERT(reporter, !cf->asColorMatrix(nullptr));
cf->unref();
}
{
// Check that a color filter image filter without a crop rect can be
// expressed as a color filter.
- SkAutoTUnref<SkImageFilter> gray(make_grayscale(NULL, NULL));
- REPORTER_ASSERT(reporter, true == gray->asColorFilter(NULL));
+ SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr));
+ REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr));
}
{
// Check that a colorfilterimage filter without a crop rect but with an input
// that is another colorfilterimage can be expressed as a colorfilter (composed).
- SkAutoTUnref<SkImageFilter> mode(make_blue(NULL, NULL));
- SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, NULL));
- REPORTER_ASSERT(reporter, true == gray->asColorFilter(NULL));
+ SkAutoTUnref<SkImageFilter> mode(make_blue(nullptr, nullptr));
+ SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, nullptr));
+ REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr));
}
{
// Test that if we exceed the limit of what ComposeColorFilter can combine, we still
// can build the DAG and won't assert if we call asColorFilter.
- SkAutoTUnref<SkImageFilter> filter(make_blue(NULL, NULL));
+ SkAutoTUnref<SkImageFilter> filter(make_blue(nullptr, nullptr));
const int kWayTooManyForComposeColorFilter = 100;
for (int i = 0; i < kWayTooManyForComposeColorFilter; ++i) {
- filter.reset(make_blue(filter, NULL));
+ filter.reset(make_blue(filter, nullptr));
// the first few of these will succeed, but after we hit the internal limit,
// it will then return false.
- (void)filter->asColorFilter(NULL);
+ (void)filter->asColorFilter(nullptr);
}
}
@@ -206,8 +206,8 @@ DEF_TEST(ImageFilter, reporter) {
// Check that a color filter image filter with a crop rect cannot
// be expressed as a color filter.
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(0, 0, 100, 100));
- SkAutoTUnref<SkImageFilter> grayWithCrop(make_grayscale(NULL, &cropRect));
- REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(NULL));
+ SkAutoTUnref<SkImageFilter> grayWithCrop(make_grayscale(nullptr, &cropRect));
+ REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(nullptr));
}
{
@@ -276,7 +276,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep
SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80));
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60));
- SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect));
+ SkAutoTUnref<SkImageFilter> input(make_grayscale(nullptr, &inputCropRect));
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
@@ -315,7 +315,7 @@ static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep
SkIPoint offset;
SkString str;
str.printf("filter %d", static_cast<int>(i));
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr);
REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(proxy, bitmap, ctx,
&result, &offset), str.c_str());
REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, str.c_str());
@@ -338,7 +338,7 @@ static SkBitmap make_gradient_circle(int width, int height) {
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkAutoTUnref<SkShader> shader(
- SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2,
+ SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode)
);
SkPaint paint;
@@ -365,12 +365,12 @@ static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy, skiatest::Repo
SkBitmap positiveResult1, negativeResult1;
SkBitmap positiveResult2, negativeResult2;
SkIPoint offset;
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr);
positiveFilter->filterImage(proxy, gradient, ctx, &positiveResult1, &offset);
negativeFilter->filterImage(proxy, gradient, ctx, &negativeResult1, &offset);
SkMatrix negativeScale;
negativeScale.setScale(-SK_Scalar1, SK_Scalar1);
- SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest(), NULL);
+ SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest(), nullptr);
positiveFilter->filterImage(proxy, gradient, negativeCTX, &negativeResult2, &offset);
negativeFilter->filterImage(proxy, gradient, negativeCTX, &positiveResult2, &offset);
SkAutoLockPixels lockP1(positiveResult1);
@@ -469,14 +469,14 @@ DEF_TEST(ImageFilterDrawTiled, reporter) {
SkMatrixConvolutionImageFilter::Create(
kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1),
SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) },
- { "merge", SkMergeImageFilter::Create(NULL, NULL, SkXfermode::kSrcOver_Mode) },
+ { "merge", SkMergeImageFilter::Create(nullptr, nullptr, SkXfermode::kSrcOver_Mode) },
{ "merge with disjoint inputs", SkMergeImageFilter::Create(
rectShaderFilterLeft, rectShaderFilterRight, SkXfermode::kSrcOver_Mode) },
{ "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) },
{ "dilate", SkDilateImageFilter::Create(3, 2) },
{ "erode", SkErodeImageFilter::Create(2, 3) },
{ "tile", SkTileImageFilter::Create(SkRect::MakeXYWH(0, 0, 50, 50),
- SkRect::MakeXYWH(0, 0, 100, 100), NULL) },
+ SkRect::MakeXYWH(0, 0, 100, 100), nullptr) },
{ "matrix", SkImageFilter::CreateMatrixFilter(matrix, kLow_SkFilterQuality) },
{ "blur and offset", SkOffsetImageFilter::Create(five, five, blur.get()) },
{ "picture and blur", SkBlurImageFilter::Create(five, five, pictureFilter.get()) },
@@ -572,7 +572,7 @@ DEF_TEST(ImageFilterDrawMatrixBBH, reporter) {
SkRTreeFactory factory;
draw_saveLayer_picture(width, height, tileSize, &factory, &result1);
- draw_saveLayer_picture(width, height, tileSize, NULL, &result2);
+ draw_saveLayer_picture(width, height, tileSize, nullptr, &result2);
for (int y = 0; y < height; y++) {
int diffs = memcmp(result1.getAddr32(0, y), result2.getAddr32(0, y), result1.rowBytes());
@@ -583,16 +583,16 @@ DEF_TEST(ImageFilterDrawMatrixBBH, reporter) {
}
}
-static SkImageFilter* makeBlur(SkImageFilter* input = NULL) {
+static SkImageFilter* makeBlur(SkImageFilter* input = nullptr) {
return SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, input);
}
-static SkImageFilter* makeDropShadow(SkImageFilter* input = NULL) {
+static SkImageFilter* makeDropShadow(SkImageFilter* input = nullptr) {
return SkDropShadowImageFilter::Create(
SkIntToScalar(100), SkIntToScalar(100),
SkIntToScalar(10), SkIntToScalar(10),
SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,
- input, NULL);
+ input, nullptr);
}
DEF_TEST(ImageFilterBlurThenShadowBounds, reporter) {
@@ -647,7 +647,7 @@ static void draw_blurred_rect(SkCanvas* canvas) {
SkPaint filterPaint;
filterPaint.setColor(SK_ColorWHITE);
filterPaint.setImageFilter(filter);
- canvas->saveLayer(NULL, &filterPaint);
+ canvas->saveLayer(nullptr, &filterPaint);
SkPaint whitePaint;
whitePaint.setColor(SK_ColorWHITE);
canvas->drawRect(SkRect::Make(SkIRect::MakeWH(4, 4)), whitePaint);
@@ -686,7 +686,7 @@ DEF_TEST(ImageFilterDrawTiledBlurRTree, reporter) {
// The only difference between these two pictures is that one has RTree aceleration.
SkCanvas* recordingCanvas1 = recorder1.beginRecording(SkIntToScalar(width),
SkIntToScalar(height),
- NULL, 0);
+ nullptr, 0);
SkCanvas* recordingCanvas2 = recorder2.beginRecording(SkIntToScalar(width),
SkIntToScalar(height),
&factory, 0);
@@ -794,7 +794,7 @@ DEF_TEST(ImageFilterMatrix, reporter) {
SkAutoTUnref<MatrixTestImageFilter> imageFilter(
new MatrixTestImageFilter(reporter, expectedMatrix));
paint.setImageFilter(imageFilter.get());
- recordingCanvas->saveLayer(NULL, &paint);
+ recordingCanvas->saveLayer(nullptr, &paint);
SkPaint solidPaint;
solidPaint.setColor(0xFFFFFFFF);
recordingCanvas->save();
@@ -882,7 +882,7 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
SkBitmap result;
SkIPoint offset;
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NULL);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), nullptr);
SkBitmap bitmap;
bitmap.allocN32Pixels(2, 2);
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -924,7 +924,7 @@ DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
recordingCanvas = recorder.beginRecording(10, 10, &factory, 0);
- recordingCanvas->saveLayer(NULL, &imageFilterPaint);
+ recordingCanvas->saveLayer(nullptr, &imageFilterPaint);
recordingCanvas->restore();
SkAutoTUnref<SkPicture> picture2(recorder.endRecording());
@@ -969,7 +969,7 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) {
SkScalar gain = SK_Scalar1, bias = 0;
SkIPoint kernelOffset = SkIPoint::Make(1, 1);
- // Check that an enormous (non-allocatable) kernel gives a NULL filter.
+ // Check that an enormous (non-allocatable) kernel gives a nullptr filter.
SkAutoTUnref<SkImageFilter> conv(SkMatrixConvolutionImageFilter::Create(
SkISize::Make(1<<30, 1<<30),
kernel,
@@ -979,21 +979,21 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) {
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
false));
- REPORTER_ASSERT(reporter, NULL == conv.get());
+ REPORTER_ASSERT(reporter, nullptr == conv.get());
- // Check that a NULL kernel gives a NULL filter.
+ // Check that a nullptr kernel gives a nullptr filter.
conv.reset(SkMatrixConvolutionImageFilter::Create(
SkISize::Make(1, 1),
- NULL,
+ nullptr,
gain,
bias,
kernelOffset,
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
false));
- REPORTER_ASSERT(reporter, NULL == conv.get());
+ REPORTER_ASSERT(reporter, nullptr == conv.get());
- // Check that a kernel width < 1 gives a NULL filter.
+ // Check that a kernel width < 1 gives a nullptr filter.
conv.reset(SkMatrixConvolutionImageFilter::Create(
SkISize::Make(0, 1),
kernel,
@@ -1003,9 +1003,9 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) {
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
false));
- REPORTER_ASSERT(reporter, NULL == conv.get());
+ REPORTER_ASSERT(reporter, nullptr == conv.get());
- // Check that kernel height < 1 gives a NULL filter.
+ // Check that kernel height < 1 gives a nullptr filter.
conv.reset(SkMatrixConvolutionImageFilter::Create(
SkISize::Make(1, -1),
kernel,
@@ -1015,7 +1015,7 @@ DEF_TEST(MatrixConvolutionSanityTest, reporter) {
SkMatrixConvolutionImageFilter::kRepeat_TileMode,
false));
- REPORTER_ASSERT(reporter, NULL == conv.get());
+ REPORTER_ASSERT(reporter, nullptr == conv.get());
}
static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* reporter) {
@@ -1031,7 +1031,7 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re
SkColorFilterImageFilter::Create(green.get()));
SkImageFilter::CropRect cropRect(SkRect::MakeEmpty());
SkAutoTUnref<SkColorFilterImageFilter> croppedOut(
- SkColorFilterImageFilter::Create(green.get(), NULL, &cropRect));
+ SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect));
// Check that an xfermode image filter whose input has been cropped out still draws the other
// input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning.
@@ -1082,7 +1082,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) {
// Test that saveLayer() with a filter nested inside another saveLayer() applies the
// correct offset to the filter matrix.
SkRect bounds1 = SkRect::MakeXYWH(10, 10, 30, 30);
- canvas.saveLayer(&bounds1, NULL);
+ canvas.saveLayer(&bounds1, nullptr);
SkPaint filterPaint;
filterPaint.setImageFilter(matrixFilter);
SkRect bounds2 = SkRect::MakeXYWH(20, 20, 10, 10);
@@ -1105,7 +1105,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) {
// correct offset to the filter matrix.
canvas.clear(0x0);
canvas.readPixels(info, &pixel, 4, 25, 25);
- canvas.saveLayer(&bounds1, NULL);
+ canvas.saveLayer(&bounds1, nullptr);
canvas.drawSprite(bitmap, 20, 20, &filterPaint);
canvas.restore();
@@ -1129,12 +1129,12 @@ DEF_TEST(ComposedImageFilterOffset, reporter) {
SkImageFilter::Proxy proxy(&device);
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20));
- SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, NULL, &cropRect));
+ SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, nullptr, &cropRect));
SkAutoTUnref<SkImageFilter> blurFilter(makeBlur());
SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blurFilter, offsetFilter.get()));
SkBitmap result;
SkIPoint offset;
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr);
REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &result, &offset));
REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0);
}
@@ -1149,10 +1149,10 @@ DEF_TEST(PartialCropRect, reporter) {
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge);
- SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect));
+ SkAutoTUnref<SkImageFilter> filter(make_grayscale(nullptr, &cropRect));
SkBitmap result;
SkIPoint offset;
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), nullptr);
REPORTER_ASSERT(reporter, filter->filterImage(&proxy, bitmap, ctx, &result, &offset));
REPORTER_ASSERT(reporter, offset.fX == 0);
REPORTER_ASSERT(reporter, offset.fY == 0);
@@ -1216,7 +1216,7 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -1234,7 +1234,7 @@ DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) {
DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -1252,7 +1252,7 @@ DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) {
DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -1270,7 +1270,7 @@ DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) {
DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
diff --git a/tests/ImageGeneratorTest.cpp b/tests/ImageGeneratorTest.cpp
index 1846f5762e..d6f546acb1 100644
--- a/tests/ImageGeneratorTest.cpp
+++ b/tests/ImageGeneratorTest.cpp
@@ -14,7 +14,7 @@ static bool gMyFactoryWasCalled;
static SkImageGenerator* my_factory(SkData*) {
gMyFactoryWasCalled = true;
- return NULL;
+ return nullptr;
}
static void test_imagegenerator_factory(skiatest::Reporter* reporter) {
@@ -27,14 +27,14 @@ static void test_imagegenerator_factory(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !gMyFactoryWasCalled);
gen = SkImageGenerator::NewFromEncoded(data);
- REPORTER_ASSERT(reporter, NULL == gen);
+ REPORTER_ASSERT(reporter, nullptr == gen);
REPORTER_ASSERT(reporter, !gMyFactoryWasCalled);
// Test is racy, in that it hopes no other thread is changing this global...
SkGraphics::ImageGeneratorFromEncodedFactory prev =
SkGraphics::SetImageGeneratorFromEncodedFactory(my_factory);
gen = SkImageGenerator::NewFromEncoded(data);
- REPORTER_ASSERT(reporter, NULL == gen);
+ REPORTER_ASSERT(reporter, nullptr == gen);
REPORTER_ASSERT(reporter, gMyFactoryWasCalled);
SkGraphics::SetImageGeneratorFromEncodedFactory(prev);
}
@@ -50,16 +50,16 @@ DEF_TEST(ImageGenerator, reporter) {
sizes[0] = SkISize::Make(200, 200);
sizes[1] = SkISize::Make(100, 100);
sizes[2] = SkISize::Make( 50, 50);
- void* planes[3] = { NULL };
+ void* planes[3] = { nullptr };
size_t rowBytes[3] = { 0 };
SkYUVColorSpace colorSpace;
// Check that the YUV decoding API does not cause any crashes
- ig.getYUV8Planes(sizes, NULL, NULL, &colorSpace);
- ig.getYUV8Planes(sizes, NULL, NULL, NULL);
- ig.getYUV8Planes(sizes, planes, NULL, NULL);
- ig.getYUV8Planes(sizes, NULL, rowBytes, NULL);
- ig.getYUV8Planes(sizes, planes, rowBytes, NULL);
+ ig.getYUV8Planes(sizes, nullptr, nullptr, &colorSpace);
+ ig.getYUV8Planes(sizes, nullptr, nullptr, nullptr);
+ ig.getYUV8Planes(sizes, planes, nullptr, nullptr);
+ ig.getYUV8Planes(sizes, nullptr, rowBytes, nullptr);
+ ig.getYUV8Planes(sizes, planes, rowBytes, nullptr);
ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace);
int dummy;
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index 522bd9447f..3718cf16cc 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -75,7 +75,7 @@ DEF_GPUTEST(ImageIsOpaqueTest_GPU, reporter, factory) {
GrContext* context = factory->get(glCtxType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index c78b7157a2..c01fbe7ee8 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -153,7 +153,7 @@ DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) {
GrContext* context = factory->get(glCtxType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index de945f978b..bbf6682084 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -80,7 +80,7 @@ static void test_encode(skiatest::Reporter* reporter, GrContext* ctx) {
SkAutoTUnref<SkImage> decoded(SkImage::NewFromEncoded(origEncoded));
REPORTER_ASSERT(reporter, decoded);
- assert_equal(reporter, orig, NULL, decoded);
+ assert_equal(reporter, orig, nullptr, decoded);
// Now see if we can instantiate an image from a subset of the surface/origEncoded
@@ -90,7 +90,7 @@ static void test_encode(skiatest::Reporter* reporter, GrContext* ctx) {
}
DEF_TEST(Image_Encode_Cpu, reporter) {
- test_encode(reporter, NULL);
+ test_encode(reporter, nullptr);
}
#if SK_SUPPORT_GPU
diff --git a/tests/IndexedPngOverflowTest.cpp b/tests/IndexedPngOverflowTest.cpp
index 914053a3ac..78f8d94b1a 100644
--- a/tests/IndexedPngOverflowTest.cpp
+++ b/tests/IndexedPngOverflowTest.cpp
@@ -40,5 +40,5 @@ DEF_TEST(IndexedPngOverflow, reporter) {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(SkImageInfo::MakeN32Premul(20, 1)));
SkCanvas* canvas = surface->getCanvas();
SkRect destRect = SkRect::MakeXYWH(0, 0, 20, 1);
- canvas->drawBitmapRect(image, destRect, NULL);
+ canvas->drawBitmapRect(image, destRect, nullptr);
}
diff --git a/tests/JpegTest.cpp b/tests/JpegTest.cpp
index 1153a3682b..daa932c4c9 100644
--- a/tests/JpegTest.cpp
+++ b/tests/JpegTest.cpp
@@ -470,7 +470,7 @@ DEF_TEST(Jpeg_YUV, reporter) {
SkPixelRef* pixelRef = bitmap.pixelRef();
SkISize yuvSizes[3];
- bool sizesComputed = (NULL != pixelRef) && pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NULL);
+ bool sizesComputed = (nullptr != pixelRef) && pixelRef->getYUV8Planes(yuvSizes, nullptr, nullptr, nullptr);
REPORTER_ASSERT(reporter, sizesComputed);
if (!sizesComputed) {
@@ -495,5 +495,5 @@ DEF_TEST(Jpeg_YUV, reporter) {
planes[2] = (uint8_t*)planes[1] + sizes[1];
// Get the YUV planes
- REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes, NULL));
+ REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes, nullptr));
}
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index eb36d643a8..4315e6dbd6 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -33,7 +33,7 @@ DEF_TEST(KtxReadWrite, reporter) {
uint8_t *pixels = reinterpret_cast<uint8_t*>(bm8888.getPixels());
REPORTER_ASSERT(reporter, pixels);
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return;
}
@@ -72,7 +72,7 @@ DEF_TEST(KtxReadWrite, reporter) {
REPORTER_ASSERT(reporter, decodedPixels);
REPORTER_ASSERT(reporter, decodedBitmap.getSize() == bm8888.getSize());
- if (NULL == decodedPixels) {
+ if (nullptr == decodedPixels) {
return;
}
@@ -144,7 +144,7 @@ DEF_TEST(KtxReexportPKM, reporter) {
// Load PKM file into a bitmap
SkBitmap etcBitmap;
SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str()));
- if (NULL == fileData) {
+ if (nullptr == fileData) {
SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str());
return;
}
diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp
index 3d1921514c..5a0e1d89ba 100644
--- a/tests/LListTest.cpp
+++ b/tests/LListTest.cpp
@@ -91,12 +91,12 @@ static void TestTInternalLList(skiatest::Reporter* reporter) {
check_list(list, reporter, true, 0, false, false, false, false, elements);
// test out methods that add to the middle of the list.
- list.addAfter(&elements[1], NULL);
+ list.addAfter(&elements[1], nullptr);
check_list(list, reporter, false, 1, false, true, false, false, elements);
list.remove(&elements[1]);
- list.addBefore(&elements[1], NULL);
+ list.addBefore(&elements[1], nullptr);
check_list(list, reporter, false, 1, false, true, false, false, elements);
list.addBefore(&elements[0], &elements[1]);
@@ -129,8 +129,8 @@ static void TestTLList(skiatest::Reporter* reporter) {
Iter iter4;
REPORTER_ASSERT(reporter, list1.isEmpty());
- REPORTER_ASSERT(reporter, NULL == iter1.init(list1, Iter::kHead_IterStart));
- REPORTER_ASSERT(reporter, NULL == iter1.init(list1, Iter::kTail_IterStart));
+ REPORTER_ASSERT(reporter, nullptr == iter1.init(list1, Iter::kHead_IterStart));
+ REPORTER_ASSERT(reporter, nullptr == iter1.init(list1, Iter::kTail_IterStart));
// Try popping an empty list
list1.popHead();
list1.popTail();
@@ -271,9 +271,9 @@ static void TestTLList(skiatest::Reporter* reporter) {
Iter np = next; np.prev();
// pn should match next unless the target node was the head, in which case prev
// walked off the list.
- REPORTER_ASSERT(reporter, pn.get() == next.get() || NULL == prev.get());
+ REPORTER_ASSERT(reporter, pn.get() == next.get() || nullptr == prev.get());
// Similarly, np should match prev unless next originally walked off the tail.
- REPORTER_ASSERT(reporter, np.get() == prev.get() || NULL == next.get());
+ REPORTER_ASSERT(reporter, np.get() == prev.get() || nullptr == next.get());
--count;
}
REPORTER_ASSERT(reporter, count == list1.count());
diff --git a/tests/LayerRasterizerTest.cpp b/tests/LayerRasterizerTest.cpp
index 82060b01b0..a81cca4037 100644
--- a/tests/LayerRasterizerTest.cpp
+++ b/tests/LayerRasterizerTest.cpp
@@ -81,7 +81,7 @@ static bool equals(const SkLayerRasterizer_Rec& rec1, const SkLayerRasterizer_Re
DEF_TEST(LayerRasterizer_copy, reporter) {
SkLayerRasterizer::Builder builder;
- REPORTER_ASSERT(reporter, NULL == builder.snapshotRasterizer());
+ REPORTER_ASSERT(reporter, nullptr == builder.snapshotRasterizer());
SkPaint paint;
// Create a bunch of paints with different flags.
for (uint32_t flags = 0x01; flags < SkPaint::kAllFlags; flags <<= 1) {
@@ -105,9 +105,9 @@ DEF_TEST(LayerRasterizer_copy, reporter) {
REPORTER_ASSERT(reporter, largerCount == LayerRasterizerTester::CountLayers(*detached.get()));
REPORTER_ASSERT(reporter, smallerCount == largerCount - 1);
- const SkLayerRasterizer_Rec* recFirstCopy = NULL;
- const SkLayerRasterizer_Rec* recOneLarger = NULL;
- const SkLayerRasterizer_Rec* recDetached = NULL;
+ const SkLayerRasterizer_Rec* recFirstCopy = nullptr;
+ const SkLayerRasterizer_Rec* recOneLarger = nullptr;
+ const SkLayerRasterizer_Rec* recDetached = nullptr;
const SkDeque& layersFirstCopy = LayerRasterizerTester::GetLayers(*firstCopy.get());
const SkDeque& layersOneLarger = LayerRasterizerTester::GetLayers(*oneLarger.get());
@@ -131,7 +131,7 @@ DEF_TEST(LayerRasterizer_copy, reporter) {
REPORTER_ASSERT(reporter, equals(*recOneLarger, *recDetached));
if (smallerCount == i) {
- REPORTER_ASSERT(reporter, recFirstCopy == NULL);
+ REPORTER_ASSERT(reporter, recFirstCopy == nullptr);
} else {
REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger));
}
@@ -140,5 +140,5 @@ DEF_TEST(LayerRasterizer_copy, reporter) {
DEF_TEST(LayerRasterizer_detachEmpty, reporter) {
SkLayerRasterizer::Builder builder;
- REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer());
+ REPORTER_ASSERT(reporter, nullptr == builder.detachRasterizer());
}
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index e267d6f72c..2e6c07d103 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -25,71 +25,71 @@ DEF_TEST(MallocPixelRef, reporter) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
{
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, NULL));
+ SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, nullptr));
// rowbytes too small.
- REPORTER_ASSERT(reporter, NULL == pr.get());
+ REPORTER_ASSERT(reporter, nullptr == pr.get());
}
{
size_t rowBytes = info.minRowBytes() - 1;
size_t size = info.getSafeSize(rowBytes);
SkAutoDataUnref data(SkData::NewUninitialized(size));
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data));
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data));
// rowbytes too small.
- REPORTER_ASSERT(reporter, NULL == pr.get());
+ REPORTER_ASSERT(reporter, nullptr == pr.get());
}
{
size_t rowBytes = info.minRowBytes() + 2;
size_t size = info.getSafeSize(rowBytes) - 1;
SkAutoDataUnref data(SkData::NewUninitialized(size));
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data));
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data));
// data too small.
- REPORTER_ASSERT(reporter, NULL == pr.get());
+ REPORTER_ASSERT(reporter, nullptr == pr.get());
}
size_t rowBytes = info.minRowBytes() + 7;
size_t size = info.getSafeSize(rowBytes) + 9;
{
SkAutoMalloc memory(size);
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, NULL));
- REPORTER_ASSERT(reporter, pr.get() != NULL);
+ SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, nullptr));
+ REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
}
{
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewAllocate(info, rowBytes, NULL));
- REPORTER_ASSERT(reporter, pr.get() != NULL);
+ SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr));
+ REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, pr->pixels());
}
{
void* addr = static_cast<void*>(new uint8_t[size]);
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr,
- delete_uint8_proc, NULL));
- REPORTER_ASSERT(reporter, pr.get() != NULL);
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
+ delete_uint8_proc, nullptr));
+ REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
{
int x = 0;
SkAutoMalloc memory(size);
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithProc(info, rowBytes, NULL,
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr,
memory.get(), set_to_one_proc,
static_cast<void*>(&x)));
- REPORTER_ASSERT(reporter, pr.get() != NULL);
+ REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
REPORTER_ASSERT(reporter, 0 == x);
- pr.reset(NULL);
+ pr.reset(nullptr);
// make sure that set_to_one_proc was called.
REPORTER_ASSERT(reporter, 1 == x);
}
{
void* addr = static_cast<void*>(new uint8_t[size]);
- REPORTER_ASSERT(reporter, addr != NULL);
+ REPORTER_ASSERT(reporter, addr != nullptr);
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr,
- delete_uint8_proc, NULL));
+ SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
+ delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, addr == pr->pixels());
}
{
@@ -97,9 +97,9 @@ DEF_TEST(MallocPixelRef, reporter) {
SkData* dataPtr = data.get();
REPORTER_ASSERT(reporter, dataPtr->unique());
SkAutoTUnref<SkMallocPixelRef> pr(
- SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data.get()));
+ SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
REPORTER_ASSERT(reporter, !(dataPtr->unique()));
- data.reset(NULL);
+ data.reset(nullptr);
REPORTER_ASSERT(reporter, dataPtr->unique());
REPORTER_ASSERT(reporter, dataPtr->data() == pr->pixels());
}
diff --git a/tests/MaskCacheTest.cpp b/tests/MaskCacheTest.cpp
index f4e316c6c9..13cd354c91 100644
--- a/tests/MaskCacheTest.cpp
+++ b/tests/MaskCacheTest.cpp
@@ -24,7 +24,7 @@ static void check_data(skiatest::Reporter* reporter, SkCachedData* data,
int refcnt, CachedState cacheState, LockedState lockedState) {
REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt);
REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState));
- bool isLocked = (data->data() != NULL);
+ bool isLocked = (data->data() != nullptr);
REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked));
}
@@ -40,7 +40,7 @@ DEF_TEST(RRectMaskCache, reporter) {
SkMask mask;
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rrect, &mask, &cache);
- REPORTER_ASSERT(reporter, NULL == data);
+ REPORTER_ASSERT(reporter, nullptr == data);
size_t size = 256;
data = cache.newCachedData(size);
@@ -78,7 +78,7 @@ DEF_TEST(RectsMaskCache, reporter) {
SkMask mask;
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rects, 1, &mask, &cache);
- REPORTER_ASSERT(reporter, NULL == data);
+ REPORTER_ASSERT(reporter, nullptr == data);
size_t size = 256;
data = cache.newCachedData(size);
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 9208ed13ad..f4b6783c36 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -430,17 +430,17 @@ static void test_invert(skiatest::Reporter* reporter) {
SkMatrix44 tinyScale(SkMatrix44::kIdentity_Constructor);
tinyScale.setDouble(0, 0, 1e-39);
REPORTER_ASSERT(reporter, tinyScale.getType() == SkMatrix44::kScale_Mask);
- REPORTER_ASSERT(reporter, !tinyScale.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScale.invert(nullptr));
REPORTER_ASSERT(reporter, !tinyScale.invert(&inverse));
SkMatrix44 tinyScaleTranslate(SkMatrix44::kIdentity_Constructor);
tinyScaleTranslate.setDouble(0, 0, 1e-38);
- REPORTER_ASSERT(reporter, tinyScaleTranslate.invert(NULL));
+ REPORTER_ASSERT(reporter, tinyScaleTranslate.invert(nullptr));
tinyScaleTranslate.setDouble(0, 3, 10);
REPORTER_ASSERT(
reporter, tinyScaleTranslate.getType() ==
(SkMatrix44::kScale_Mask | SkMatrix44::kTranslate_Mask));
- REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(nullptr));
REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(&inverse));
SkMatrix44 tinyScalePerspective(SkMatrix44::kIdentity_Constructor);
@@ -449,7 +449,7 @@ static void test_invert(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, (tinyScalePerspective.getType() &
SkMatrix44::kPerspective_Mask) ==
SkMatrix44::kPerspective_Mask);
- REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(nullptr));
REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(&inverse));
}
@@ -835,7 +835,7 @@ DEF_TEST(Matrix44, reporter) {
mat.setScale(3, 3, 3);
rot.setRotateDegreesAbout(0, 0, -1, 90);
mat.postConcat(rot);
- REPORTER_ASSERT(reporter, mat.invert(NULL));
+ REPORTER_ASSERT(reporter, mat.invert(nullptr));
mat.invert(&inverse);
iden1.setConcat(mat, inverse);
REPORTER_ASSERT(reporter, is_identity(iden1));
@@ -849,7 +849,7 @@ DEF_TEST(Matrix44, reporter) {
rot.setRotateDegreesAbout(0, 0, -1, 90);
mat.postConcat(rot);
mat.postTranslate(v,v,v);
- REPORTER_ASSERT(reporter, mat.invert(NULL));
+ REPORTER_ASSERT(reporter, mat.invert(nullptr));
mat.invert(&inverse);
iden1.setConcat(mat, inverse);
REPORTER_ASSERT(reporter, is_identity(iden1));
@@ -864,7 +864,7 @@ DEF_TEST(Matrix44, reporter) {
mat.postTranslate(SkDoubleToMScalar(1.0e+2),
SkDoubleToMScalar(3.0),
SkDoubleToMScalar(1.0e-2));
- REPORTER_ASSERT(reporter, mat.invert(NULL));
+ REPORTER_ASSERT(reporter, mat.invert(nullptr));
mat.invert(&inverse);
iden1.setConcat(mat, inverse);
REPORTER_ASSERT(reporter, is_identity(iden1));
@@ -872,7 +872,7 @@ DEF_TEST(Matrix44, reporter) {
// test degenerate matrix
mat.reset();
mat.set3x3(1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0);
- REPORTER_ASSERT(reporter, !mat.invert(NULL));
+ REPORTER_ASSERT(reporter, !mat.invert(nullptr));
// test rol/col Major getters
{
diff --git a/tests/MatrixClipCollapseTest.cpp b/tests/MatrixClipCollapseTest.cpp
index c9940272c0..de6af362eb 100644
--- a/tests/MatrixClipCollapseTest.cpp
+++ b/tests/MatrixClipCollapseTest.cpp
@@ -192,8 +192,8 @@ static void emit_clip(SkCanvas* canvas, ClipType clip) {
}
static void add_clip(ClipType clip, MatType mat, SkTDArray<DrawType>* expected) {
- if (NULL == expected) {
- // expected is NULL if this clip will be fused into later clips
+ if (nullptr == expected) {
+ // expected is nullptr if this clip will be fused into later clips
return;
}
@@ -255,8 +255,8 @@ static void emit_mat(SkCanvas* canvas, MatType mat) {
}
static void add_mat(MatType mat, SkTDArray<DrawType>* expected) {
- if (NULL == expected) {
- // expected is NULL if this matrix call will be fused into later ones
+ if (nullptr == expected) {
+ // expected is nullptr if this matrix call will be fused into later ones
return;
}
@@ -475,7 +475,7 @@ static void emit_body2(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
(*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, accumulatedClips+1);
*expected->append() = SAVE_LAYER;
// TODO: widen testing to exercise saveLayer's parameters
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
if (needsSaveRestore) {
*expected->append() = SAVE;
}
@@ -513,14 +513,14 @@ static void emit_body3(SkCanvas* canvas, PFEmitMC emitMC, MatType mat,
(*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, accumulatedClips+1);
*expected->append() = SAVE_LAYER;
// TODO: widen testing to exercise saveLayer's parameters
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
(*emitMC)(canvas, mat, clip, kSaveLayer_DrawOpType, expected, 1);
if (kNone_MatType != mat || kNone_ClipType != clip) {
*expected->append() = SAVE;
}
*expected->append() = SAVE_LAYER;
// TODO: widen testing to exercise saveLayer's parameters
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
if (needsSaveRestore) {
*expected->append() = SAVE;
}
@@ -569,11 +569,11 @@ static void emit_struct1(SkCanvas* canvas,
PFEmitMC emitMC, MatType mat, ClipType clip,
PFEmitBody emitBody, DrawOpType draw,
SkTDArray<DrawType>* expected) {
- (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these get fused into later ops
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these get fused into later ops
canvas->save();
(*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1);
canvas->restore();
- (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get removed
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get removed
}
// Emit:
@@ -592,14 +592,14 @@ static void emit_struct2(SkCanvas* canvas,
PFEmitMC emitMC, MatType mat, ClipType clip,
PFEmitBody emitBody, DrawOpType draw,
SkTDArray<DrawType>* expected) {
- (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get fused into later ops
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get fused into later ops
canvas->save();
(*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1);
canvas->restore();
canvas->save();
(*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1);
canvas->restore();
- (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get removed
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get removed
}
// Emit:
@@ -621,17 +621,17 @@ static void emit_struct3(SkCanvas* canvas,
PFEmitMC emitMC, MatType mat, ClipType clip,
PFEmitBody emitBody, DrawOpType draw,
SkTDArray<DrawType>* expected) {
- (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get fused into later ops
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get fused into later ops
canvas->save();
(*emitBody)(canvas, emitMC, mat, clip, draw, expected, 1);
canvas->restore();
canvas->save();
- (*emitMC)(canvas, mat, clip, draw, NULL, 1); // these will get fused into later ops
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 1); // these will get fused into later ops
canvas->save();
(*emitBody)(canvas, emitMC, mat, clip, draw, expected, 2);
canvas->restore();
canvas->restore();
- (*emitMC)(canvas, mat, clip, draw, NULL, 0); // these will get removed
+ (*emitMC)(canvas, mat, clip, draw, nullptr, 0); // these will get removed
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 2296b8f2b5..57e79576b0 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -142,7 +142,7 @@ static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) {
// add 100 in case we have a bug, I don't want to kill my stack in the test
static const size_t kBufferSize = SkMatrix::kMaxFlattenSize + 100;
char buffer[kBufferSize];
- size_t size1 = m.writeToMemory(NULL);
+ size_t size1 = m.writeToMemory(nullptr);
size_t size2 = m.writeToMemory(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize);
@@ -497,7 +497,7 @@ static void test_matrix_decomposition(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
// make sure it doesn't crash if we pass in NULLs
- REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, NULL, NULL, NULL));
+ REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, nullptr, nullptr, nullptr));
// rotation only
mat.setRotate(kRotation0);
@@ -711,7 +711,7 @@ static void test_matrix_homogeneous(skiatest::Reporter* reporter) {
// doesn't crash with null dst, src, count == 0
{
- mats[0].mapHomogeneousPoints(NULL, NULL, 0);
+ mats[0].mapHomogeneousPoints(nullptr, nullptr, 0);
}
// uniform scale of point
@@ -822,7 +822,7 @@ DEF_TEST(Matrix, reporter) {
mat.setScale(SkIntToScalar(3), SkIntToScalar(5), SkIntToScalar(20), 0);
mat.postRotate(SkIntToScalar(25));
- REPORTER_ASSERT(reporter, mat.invert(NULL));
+ REPORTER_ASSERT(reporter, mat.invert(nullptr));
REPORTER_ASSERT(reporter, mat.invert(&inverse));
iden1.setConcat(mat, inverse);
REPORTER_ASSERT(reporter, is_identity(iden1));
@@ -832,17 +832,17 @@ DEF_TEST(Matrix, reporter) {
test_flatten(reporter, iden2);
mat.setScale(0, SK_Scalar1);
- REPORTER_ASSERT(reporter, !mat.invert(NULL));
+ REPORTER_ASSERT(reporter, !mat.invert(nullptr));
REPORTER_ASSERT(reporter, !mat.invert(&inverse));
mat.setScale(SK_Scalar1, 0);
- REPORTER_ASSERT(reporter, !mat.invert(NULL));
+ REPORTER_ASSERT(reporter, !mat.invert(nullptr));
REPORTER_ASSERT(reporter, !mat.invert(&inverse));
// Inverting this matrix results in a non-finite matrix
mat.setAll(0.0f, 1.0f, 2.0f,
0.0f, 1.0f, -3.40277175e+38f,
1.00003040f, 1.0f, 0.0f);
- REPORTER_ASSERT(reporter, !mat.invert(NULL));
+ REPORTER_ASSERT(reporter, !mat.invert(nullptr));
REPORTER_ASSERT(reporter, !mat.invert(&inverse));
// rectStaysRect test
diff --git a/tests/MemsetTest.cpp b/tests/MemsetTest.cpp
index 1e1378b4ad..76412eec77 100644
--- a/tests/MemsetTest.cpp
+++ b/tests/MemsetTest.cpp
@@ -30,7 +30,7 @@ static void test_chunkalloc(skiatest::Reporter* reporter) {
//------------------------------------------------------------------------
// check empty
check_alloc(reporter, alloc, 0, 0, 0);
- REPORTER_ASSERT(reporter, !alloc.contains(NULL));
+ REPORTER_ASSERT(reporter, !alloc.contains(nullptr));
REPORTER_ASSERT(reporter, !alloc.contains(reporter));
// reset on empty allocator
diff --git a/tests/MetaDataTest.cpp b/tests/MetaDataTest.cpp
index 9d8d5dd5a9..25673981c8 100644
--- a/tests/MetaDataTest.cpp
+++ b/tests/MetaDataTest.cpp
@@ -84,7 +84,7 @@ DEF_TEST(MetaData, reporter) {
int loop = 0;
int count;
SkMetaData::Type t;
- while ((name = iter.next(&t, &count)) != NULL)
+ while ((name = iter.next(&t, &count)) != nullptr)
{
int match = 0;
for (unsigned i = 0; i < SK_ARRAY_COUNT(gElems); i++)
diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp
index c8396effa6..5e5e894870 100644
--- a/tests/MipMapTest.cpp
+++ b/tests/MipMapTest.cpp
@@ -11,7 +11,7 @@
#include "Test.h"
static void make_bitmap(SkBitmap* bm, SkRandom& rand) {
- // for now, Build needs a min size of 2, otherwise it will return NULL.
+ // for now, Build needs a min size of 2, otherwise it will return nullptr.
// should fix that to support 1 X N, where N > 1 to return non-null.
int w = 2 + rand.nextU() % 1000;
int h = 2 + rand.nextU() % 1000;
@@ -25,10 +25,10 @@ DEF_TEST(MipMap, reporter) {
for (int i = 0; i < 500; ++i) {
make_bitmap(&bm, rand);
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, NULL));
+ SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, nullptr));
- REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, NULL));
- REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, NULL));
+ REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, nullptr));
+ REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, nullptr));
SkMipMap::Level prevLevel;
sk_bzero(&prevLevel, sizeof(prevLevel));
diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp
index facc6ad3f7..3276145fa4 100644
--- a/tests/OSPathTest.cpp
+++ b/tests/OSPathTest.cpp
@@ -86,8 +86,8 @@ DEF_TEST(OSPath, reporter) {
SkString baseOfDir = SkOSPath::Basename(dir.c_str());
REPORTER_ASSERT(reporter, baseOfDir.size() == 0);
- // Basename of NULL is an empty string.
- SkString empty = SkOSPath::Basename(NULL);
+ // Basename of nullptr is an empty string.
+ SkString empty = SkOSPath::Basename(nullptr);
REPORTER_ASSERT(reporter, empty.size() == 0);
// File in root dir
@@ -99,7 +99,7 @@ DEF_TEST(OSPath, reporter) {
filename.reset();
test_dir_with_file(reporter, dir, filename);
- // Test that NULL can be used for the directory and filename.
- SkString emptyPath = SkOSPath::Join(NULL, NULL);
+ // Test that nullptr can be used for the directory and filename.
+ SkString emptyPath = SkOSPath::Join(nullptr, nullptr);
REPORTER_ASSERT(reporter, emptyPath.isEmpty());
}
diff --git a/tests/PDFDeflateWStreamTest.cpp b/tests/PDFDeflateWStreamTest.cpp
index a85212c2c3..f4d8dd3730 100644
--- a/tests/PDFDeflateWStreamTest.cpp
+++ b/tests/PDFDeflateWStreamTest.cpp
@@ -27,7 +27,7 @@ void skia_free_func(void*, void* address) { sk_free(address); }
/**
* Use the un-deflate compression algorithm to decompress the data in src,
- * returning the result. Returns NULL if an error occurs.
+ * returning the result. Returns nullptr if an error occurs.
*/
SkStreamAsset* stream_inflate(SkStream* src) {
SkDynamicMemoryWStream decompressedDynamicMemoryWStream;
@@ -39,8 +39,8 @@ SkStreamAsset* stream_inflate(SkStream* src) {
z_stream flateData;
flateData.zalloc = &skia_alloc_func;
flateData.zfree = &skia_free_func;
- flateData.opaque = NULL;
- flateData.next_in = NULL;
+ flateData.opaque = nullptr;
+ flateData.next_in = nullptr;
flateData.avail_in = 0;
flateData.next_out = outputBuffer;
flateData.avail_out = kBufferSize;
@@ -51,8 +51,8 @@ SkStreamAsset* stream_inflate(SkStream* src) {
uint8_t* input = (uint8_t*)src->getMemoryBase();
size_t inputLength = src->getLength();
- if (input == NULL || inputLength == 0) {
- input = NULL;
+ if (input == nullptr || inputLength == 0) {
+ input = nullptr;
flateData.next_in = inputBuffer;
flateData.avail_in = 0;
} else {
@@ -73,7 +73,7 @@ SkStreamAsset* stream_inflate(SkStream* src) {
if (rc != Z_OK)
break;
if (flateData.avail_in == 0) {
- if (input != NULL)
+ if (input != nullptr)
break;
size_t read = src->read(&inputBuffer, kBufferSize);
if (read == 0)
diff --git a/tests/PDFDocumentTest.cpp b/tests/PDFDocumentTest.cpp
index f9fcdff6a2..04c3ede6aa 100644
--- a/tests/PDFDocumentTest.cpp
+++ b/tests/PDFDocumentTest.cpp
@@ -82,7 +82,7 @@ static void test_file(skiatest::Reporter* reporter) {
doc->close();
FILE* file = fopen(path.c_str(), "r");
- REPORTER_ASSERT(reporter, file != NULL);
+ REPORTER_ASSERT(reporter, file != nullptr);
char header[100];
REPORTER_ASSERT(reporter, fread(header, 4, 1, file) != 0);
REPORTER_ASSERT(reporter, strncmp(header, "%PDF", 4) == 0);
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index 33fcc80ef7..529c97233c 100644
--- a/tests/PDFGlyphsToUnicodeTest.cpp
+++ b/tests/PDFGlyphsToUnicodeTest.cpp
@@ -126,7 +126,7 @@ endbfchar\n";
buffer.reset();
- append_cmap_sections(glyphToUnicode, NULL, &buffer, false, 0xFC, 0x110);
+ append_cmap_sections(glyphToUnicode, nullptr, &buffer, false, 0xFC, 0x110);
char expectedResultSingleBytes[] =
"2 beginbfchar\n\
diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp
index cfe6776bf5..530ed2a1d0 100644
--- a/tests/PDFJpegEmbedTest.cpp
+++ b/tests/PDFJpegEmbedTest.cpp
@@ -46,7 +46,7 @@ static SkData* load_resource(
SkDebugf("\n%s: Resource '%s' can not be found.\n",
test, filename);
}
- return data; // May return NULL.
+ return data; // May return nullptr.
}
/**
@@ -70,9 +70,9 @@ DEF_TEST(PDFJpegEmbedTest, r) {
canvas->clear(SK_ColorLTGRAY);
SkBitmap bm1(bitmap_from_data(mandrillData));
- canvas->drawBitmap(bm1, 65.0, 0.0, NULL);
+ canvas->drawBitmap(bm1, 65.0, 0.0, nullptr);
SkBitmap bm2(bitmap_from_data(cmykData));
- canvas->drawBitmap(bm2, 0.0, 512.0, NULL);
+ canvas->drawBitmap(bm2, 0.0, 512.0, nullptr);
canvas->flush();
document->endPage();
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 8af806cbe7..3253fcaf71 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -32,7 +32,7 @@ struct Catalog {
} // namespace
template <typename T>
-static SkString emit_to_string(T& obj, Catalog* catPtr = NULL) {
+static SkString emit_to_string(T& obj, Catalog* catPtr = nullptr) {
Catalog catalog;
SkDynamicMemoryWStream buffer;
if (!catPtr) {
@@ -364,7 +364,7 @@ namespace {
class DummyImageFilter : public SkImageFilter {
public:
- DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(visited) {}
+ DummyImageFilter(bool visited = false) : SkImageFilter(0, nullptr), fVisited(visited) {}
~DummyImageFilter() override {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const override {
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 1fca8dc656..7affa9ee94 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -294,7 +294,7 @@ DEF_TEST(Paint_MoreFlattening, r) {
paint.setTextScaleX(1.0f); // Default value, ignored.
paint.setTextSize(19);
paint.setXfermode(SkXfermode::Create(SkXfermode::kModulate_Mode))->unref();
- paint.setLooper(NULL); // Default value, ignored.
+ paint.setLooper(nullptr); // Default value, ignored.
SkWriteBuffer writer;
paint.flatten(writer);
@@ -333,7 +333,7 @@ DEF_TEST(Paint_getHash, r) {
// SkTypeface is the first field we hash, so test it specially.
paint.setTypeface(SkTypeface::RefDefault())->unref();
REPORTER_ASSERT(r, paint.getHash() != defaultHash);
- paint.setTypeface(NULL);
+ paint.setTypeface(nullptr);
REPORTER_ASSERT(r, paint.getHash() == defaultHash);
// This is part of fBitfields, the last field we hash.
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index 88b469e21a..8fc100ee02 100755
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -419,7 +419,7 @@ static void testQuadAngles(skiatest::Reporter* reporter, const SkDQuad& quad1, c
SkPoint shortQuads[2][3];
SkOpContourHead contour;
- SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL));
+ SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr));
contour.init(&state, false, false);
makeSegment(&contour, quad1, shortQuads[0], allocator);
makeSegment(&contour, quad1, shortQuads[1], allocator);
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index cec8dde68a..faf5da50f2 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -235,7 +235,7 @@ static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet);
DEF_TEST(PathOpsAngleCircle, reporter) {
SkChunkAlloc allocator(4096);
SkOpContourHead contour;
- SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL));
+ SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr));
contour.init(&state, false, false);
for (int index = 0; index < circleDataSetSize; ++index) {
CircleData& data = circleDataSet[index];
@@ -427,7 +427,7 @@ struct FourPoints {
DEF_TEST(PathOpsAngleAfter, reporter) {
SkChunkAlloc allocator(4096);
SkOpContourHead contour;
- SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL));
+ SkOpGlobalState state(nullptr, &contour SkDEBUGPARAMS(nullptr));
contour.init(&state, false, false);
for (int index = intersectDataSetsSize - 1; index >= 0; --index) {
IntersectData* dataArray = intersectDataSets[index];
diff --git a/tests/PathOpsBattles.cpp b/tests/PathOpsBattles.cpp
index 2920a01557..6e0d3a4177 100644
--- a/tests/PathOpsBattles.cpp
+++ b/tests/PathOpsBattles.cpp
@@ -11123,5 +11123,5 @@ DEF_TEST(PathOpsBattle, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
- RunTestSet(reporter, tests, testCount, firstTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse);
}
diff --git a/tests/PathOpsBuildUseTest.cpp b/tests/PathOpsBuildUseTest.cpp
index 76a54f6fbe..67e42520aa 100644
--- a/tests/PathOpsBuildUseTest.cpp
+++ b/tests/PathOpsBuildUseTest.cpp
@@ -2431,5 +2431,5 @@ DEF_TEST(PathOpsBuildUse, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
- RunTestSet(reporter, tests, testCount, firstTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse);
}
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index 08fc632732..88684fe18d 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -31,7 +31,7 @@ DEF_TEST(PathOpsBuilder, reporter) {
REPORTER_ASSERT(reporter, builder.resolve(&result));
bool closed;
SkPath::Direction dir;
- REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir));
+ REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result);
@@ -42,7 +42,7 @@ DEF_TEST(PathOpsBuilder, reporter) {
rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction);
builder.add(rectPath, kUnion_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
- REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir));
+ REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
REPORTER_ASSERT(reporter, rectPath == result);
@@ -58,7 +58,7 @@ DEF_TEST(PathOpsBuilder, reporter) {
builder.add(rect2, kUnion_SkPathOp);
builder.add(rect3, kUnion_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
- REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir));
+ REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
SkRect expected;
expected.set(0, 1, 5, 3);
diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp
index 507d865926..263c37b120 100755
--- a/tests/PathOpsDebug.cpp
+++ b/tests/PathOpsDebug.cpp
@@ -1066,7 +1066,7 @@ void SkOpSegment::dumpAngles() const {
const SkOpSpanBase* span = &fHead;
do {
const SkOpAngle* fAngle = span->fromAngle();
- const SkOpAngle* tAngle = span->final() ? NULL : span->upCast()->toAngle();
+ const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle();
if (fAngle) {
SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID());
fAngle->dumpTo(this, tAngle);
@@ -1285,7 +1285,7 @@ const SkOpAngle* SkOpGlobalState::debugAngle(int id) const {
segment = segment->next();
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
SkOpContour* SkOpGlobalState::debugContour(int id) {
@@ -1295,7 +1295,7 @@ SkOpContour* SkOpGlobalState::debugContour(int id) {
return contour;
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
const SkOpPtT* SkOpGlobalState::debugPtT(int id) const {
@@ -1318,7 +1318,7 @@ const SkOpPtT* SkOpGlobalState::debugPtT(int id) const {
segment = segment->next();
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
const SkOpSegment* SkOpGlobalState::debugSegment(int id) const {
@@ -1332,7 +1332,7 @@ const SkOpSegment* SkOpGlobalState::debugSegment(int id) const {
segment = segment->next();
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const {
@@ -1353,7 +1353,7 @@ const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const {
segment = segment->next();
}
} while ((contour = contour->next()));
- return NULL;
+ return nullptr;
}
#endif
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 1401290f83..7209617985 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -425,14 +425,14 @@ bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& st
if (!state.fReporter->verbose()) {
return true;
}
- int result = comparePaths(state.fReporter, NULL, path, out, *state.fBitmap);
+ int result = comparePaths(state.fReporter, nullptr, path, out, *state.fBitmap);
if (result) {
SkAutoMutexAcquire autoM(simplifyDebugOut);
char temp[8192];
sk_bzero(temp, sizeof(temp));
SkMemoryWStream stream(temp, sizeof(temp));
- const char* pathPrefix = NULL;
- const char* nameSuffix = NULL;
+ const char* pathPrefix = nullptr;
+ const char* nameSuffix = nullptr;
if (fillType == SkPath::kEvenOdd_FillType) {
pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n";
nameSuffix = "x";
@@ -586,7 +586,7 @@ void initializeTests(skiatest::Reporter* reporter, const char* test) {
inData.setCount((int) inFile.getLength());
size_t inLen = inData.count();
inFile.read(inData.begin(), inLen);
- inFile.setPath(NULL);
+ inFile.setPath(nullptr);
char* insert = strstr(inData.begin(), marker);
if (insert) {
insert += sizeof(marker) - 1;
@@ -599,8 +599,8 @@ void initializeTests(skiatest::Reporter* reporter, const char* test) {
void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFillType) {
const char testFunction[] = "testSimplify(path);";
- const char* pathPrefix = NULL;
- const char* nameSuffix = NULL;
+ const char* pathPrefix = nullptr;
+ const char* nameSuffix = nullptr;
if (pathFillType == SkPath::kEvenOdd_FillType) {
pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n";
nameSuffix = "x";
@@ -614,7 +614,7 @@ void outputProgress(char* ramStr, const char* pathStr, SkPathOp op) {
SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes));
const char* nameSuffix = opSuffixes[op];
SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE);
- outputToStream(pathStr, NULL, nameSuffix, testFunction, true, rRamStream);
+ outputToStream(pathStr, nullptr, nameSuffix, testFunction, true, rRamStream);
}
void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index fbe0116eb5..98189ef2d1 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -5528,11 +5528,11 @@ DEF_TEST(PathOpsOp, reporter) {
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
if (runSubTests && runSubTestsFirst) {
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
}
RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
if (runSubTests && !runSubTestsFirst) {
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
}
}
@@ -5743,5 +5743,5 @@ DEF_TEST(PathOpsFailOp, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
- RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false);
+ RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, false);
}
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 8f03ba0051..bd82311c38 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -5340,10 +5340,10 @@ static bool runReverse = false;
DEF_TEST(PathOpsSimplify, reporter) {
if (runSubTests && runSubTestsFirst) {
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
}
RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
if (runSubTests && !runSubTestsFirst) {
- RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTest, runReverse);
+ RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
}
}
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index de4f48c586..edc79d18e6 100644
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -443,7 +443,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
}
void TestResult::testOne() {
- SkPicture* pic = NULL;
+ SkPicture* pic = nullptr;
{
#if DEBUG_SHOW_TEST_NAME
if (fTestStep == kCompareBits) {
@@ -533,8 +533,8 @@ DEFINE_string2(match, m, "PathOpsSkpClipThreaded",
"^ and $ requires an exact match\n"
"If a test does not match any list entry,\n"
"it is skipped unless some list entry starts with ~");
-DEFINE_string2(dir, d, NULL, "range of directories (e.g., 1-100)");
-DEFINE_string2(skp, s, NULL, "skp to test");
+DEFINE_string2(dir, d, nullptr, "range of directories (e.g., 1-100)");
+DEFINE_string2(skp, s, nullptr, "skp to test");
DEFINE_bool2(single, z, false, "run tests on a single thread internally.");
DEFINE_int32(testIndex, 0, "override local test index (PathOpsSkpClipOneOff only).");
DEFINE_bool2(verbose, v, false, "enable verbose output.");
@@ -614,7 +614,7 @@ public:
while (fNames && ++fIndex < fNames->count()) {
return (*fNames)[fIndex];
}
- return NULL;
+ return nullptr;
}
void set(const SkCommandLineFlags::StringArray& names) {
@@ -705,7 +705,7 @@ bool Less(const SortByName& a, const SortByName& b) {
static bool doOneDir(TestState* state, bool threaded) {
int dirNo = state->fResult.fDirNo;
- SkString dirName = get_in_path(dirNo, NULL);
+ SkString dirName = get_in_path(dirNo, nullptr);
if (!dirName.size()) {
return false;
}
@@ -912,7 +912,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) {
int dirNo;
gDirs.reset();
while ((dirNo = gDirs.next()) > 0) {
- SkString dirName = get_in_path(dirNo, NULL);
+ SkString dirName = get_in_path(dirNo, nullptr);
if (!dirName.size()) {
continue;
}
@@ -943,7 +943,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) {
}
testRunner.render();
SkAutoTDeleteArray<SkTDArray<TestResult> > results(new SkTDArray<TestResult>[dirCount]);
- if (!buildTests(results.get(), NULL)) {
+ if (!buildTests(results.get(), nullptr)) {
return;
}
SkTDArray<TestResult> allResults;
@@ -1042,10 +1042,10 @@ public:
if (fReg) {
TestRegistry::Factory fact = fReg->factory();
fReg = fReg->next();
- Test* test = fact(NULL);
+ Test* test = fact(nullptr);
return test;
}
- return NULL;
+ return nullptr;
}
private:
@@ -1096,7 +1096,7 @@ int tool_main(int argc, char** argv) {
SkDebugf("%s", header.c_str());
Iter iter;
Test* test;
- while ((test = iter.next()) != NULL) {
+ while ((test = iter.next()) != nullptr) {
SkAutoTDelete<Test> owned(test);
if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
test->run();
diff --git a/tests/PathOpsTSectDebug.h b/tests/PathOpsTSectDebug.h
index 5780610c9b..51532f8476 100644
--- a/tests/PathOpsTSectDebug.h
+++ b/tests/PathOpsTSectDebug.h
@@ -21,13 +21,13 @@ const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugSpan(int id) co
return test;
}
} while ((test = test->next()));
- return NULL;
+ return nullptr;
}
template<typename TCurve, typename OppCurve>
const SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::debugT(double t) const {
const SkTSpan<TCurve, OppCurve>* test = fHead;
- const SkTSpan<TCurve, OppCurve>* closest = NULL;
+ const SkTSpan<TCurve, OppCurve>* closest = nullptr;
double bestDist = DBL_MAX;
do {
if (between(test->fStartT, t, test->fEndT)) {
@@ -132,12 +132,12 @@ void SkTSect<TCurve, OppCurve>::dumpCurves() const {
template<typename TCurve, typename OppCurve>
const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugSpan(int id) const {
- return SkDEBUGRELEASE(fDebugSect->debugSpan(id), NULL);
+ return SkDEBUGRELEASE(fDebugSect->debugSpan(id), nullptr);
}
template<typename TCurve, typename OppCurve>
const SkTSpan<TCurve, OppCurve>* SkTSpan<TCurve, OppCurve>::debugT(double t) const {
- return SkDEBUGRELEASE(fDebugSect->debugT(t), NULL);
+ return SkDEBUGRELEASE(fDebugSect->debugT(t), nullptr);
}
template<typename TCurve, typename OppCurve>
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 68eb67722f..cd9e8847a1 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -314,7 +314,7 @@ static void test_bad_cubic_crbug229478() {
SkPath dst;
// Before the fix, this would infinite-recurse, and run out of stack
// because we would keep trying to subdivide a degenerate cubic segment.
- paint.getFillPath(path, &dst, NULL);
+ paint.getFillPath(path, &dst, nullptr);
}
static void build_path_170666(SkPath& path) {
@@ -485,27 +485,27 @@ static void test_addrect(skiatest::Reporter* reporter) {
SkPath path;
path.lineTo(0, 0);
path.addRect(SkRect::MakeWH(50, 100));
- REPORTER_ASSERT(reporter, path.isRect(NULL));
+ REPORTER_ASSERT(reporter, path.isRect(nullptr));
path.reset();
path.lineTo(FLT_EPSILON, FLT_EPSILON);
path.addRect(SkRect::MakeWH(50, 100));
- REPORTER_ASSERT(reporter, !path.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr));
path.reset();
path.quadTo(0, 0, 0, 0);
path.addRect(SkRect::MakeWH(50, 100));
- REPORTER_ASSERT(reporter, !path.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr));
path.reset();
path.conicTo(0, 0, 0, 0, 0.5f);
path.addRect(SkRect::MakeWH(50, 100));
- REPORTER_ASSERT(reporter, !path.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr));
path.reset();
path.cubicTo(0, 0, 0, 0, 0, 0);
path.addRect(SkRect::MakeWH(50, 100));
- REPORTER_ASSERT(reporter, !path.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr));
}
// Make sure we stay non-finite once we get there (unless we reset or rewind).
@@ -926,7 +926,7 @@ static void check_direction(skiatest::Reporter* reporter, const SkPath& path,
static void test_direction(skiatest::Reporter* reporter) {
size_t i;
SkPath path;
- REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL));
+ REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr));
REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection));
REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection));
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kUnknown_FirstDirection));
@@ -943,7 +943,7 @@ static void test_direction(skiatest::Reporter* reporter) {
path.reset();
bool valid = SkParsePath::FromSVGString(gDegen[i], &path);
REPORTER_ASSERT(reporter, valid);
- REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL));
+ REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr));
}
static const char* gCW[] = {
@@ -1361,7 +1361,7 @@ static void setFromString(SkPath* path, const char str[]) {
while (str) {
SkScalar x, y;
str = SkParse::FindScalar(str, &x);
- if (NULL == str) {
+ if (nullptr == str) {
break;
}
str = SkParse::FindScalar(str, &y);
@@ -1507,7 +1507,7 @@ static void test_isLine(skiatest::Reporter* reporter) {
SkPoint pts[2];
const SkScalar value = SkIntToScalar(5);
- REPORTER_ASSERT(reporter, !path.isLine(NULL));
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr));
// set some non-zero values
pts[0].set(value, value);
@@ -1522,7 +1522,7 @@ static void test_isLine(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, value != moveX && value != moveY);
path.moveTo(moveX, moveY);
- REPORTER_ASSERT(reporter, !path.isLine(NULL));
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr));
REPORTER_ASSERT(reporter, !path.isLine(pts));
// check that pts was untouched
REPORTER_ASSERT(reporter, pts[0].equals(value, value));
@@ -1533,7 +1533,7 @@ static void test_isLine(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, value != lineX && value != lineY);
path.lineTo(lineX, lineY);
- REPORTER_ASSERT(reporter, path.isLine(NULL));
+ REPORTER_ASSERT(reporter, path.isLine(nullptr));
REPORTER_ASSERT(reporter, !pts[0].equals(moveX, moveY));
REPORTER_ASSERT(reporter, !pts[1].equals(lineX, lineY));
@@ -1542,14 +1542,14 @@ static void test_isLine(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY));
path.lineTo(0, 0); // too many points/verbs
- REPORTER_ASSERT(reporter, !path.isLine(NULL));
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr));
REPORTER_ASSERT(reporter, !path.isLine(pts));
REPORTER_ASSERT(reporter, pts[0].equals(moveX, moveY));
REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY));
path.reset();
path.quadTo(1, 1, 2, 2);
- REPORTER_ASSERT(reporter, !path.isLine(NULL));
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr));
}
static void test_conservativelyContains(skiatest::Reporter* reporter) {
@@ -1771,7 +1771,7 @@ static void test_isRect_open_close(skiatest::Reporter* reporter) {
path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1);
path.close();
- REPORTER_ASSERT(reporter, path.isRect(NULL, &isClosed, NULL));
+ REPORTER_ASSERT(reporter, path.isRect(nullptr, &isClosed, nullptr));
REPORTER_ASSERT(reporter, isClosed);
}
@@ -1875,7 +1875,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
if (tests[testIndex].fClose) {
path.close();
}
- REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(NULL));
+ REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(nullptr));
if (tests[testIndex].fIsRect) {
SkRect computed, expected;
@@ -1909,7 +1909,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
}
path1.close();
path1.lineTo(1, 0);
- REPORTER_ASSERT(reporter, !path1.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
// fail, move in the middle
path1.reset();
@@ -1921,7 +1921,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
- REPORTER_ASSERT(reporter, !path1.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
// fail, move on the edge
path1.reset();
@@ -1930,7 +1930,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
- REPORTER_ASSERT(reporter, !path1.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
// fail, quad
path1.reset();
@@ -1942,7 +1942,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
- REPORTER_ASSERT(reporter, !path1.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
// fail, cubic
path1.reset();
@@ -1954,7 +1954,7 @@ static void test_isRect(skiatest::Reporter* reporter) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
- REPORTER_ASSERT(reporter, !path1.isRect(NULL));
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
}
static void test_isNestedFillRects(skiatest::Reporter* reporter) {
@@ -2042,7 +2042,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
path.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
REPORTER_ASSERT(reporter,
- tests[testIndex].fIsNestedRect == path.isNestedFillRects(NULL));
+ tests[testIndex].fIsNestedRect == path.isNestedFillRects(nullptr));
if (tests[testIndex].fIsNestedRect) {
SkRect expected[2], computed[2];
SkPathPriv::FirstDirection expectedDirs[2];
@@ -2079,7 +2079,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
if (!rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
// fail, move in the middle
path1.reset();
@@ -2097,7 +2097,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
if (!rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
// fail, move on the edge
path1.reset();
@@ -2112,7 +2112,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
if (!rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
// fail, quad
path1.reset();
@@ -2130,7 +2130,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
if (!rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
// fail, cubic
path1.reset();
@@ -2148,13 +2148,13 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
if (!rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
}
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
// fail, not nested
path1.reset();
path1.addRect(1, 1, 3, 3, SkPath::kCW_Direction);
path1.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr));
}
// pass, constructed explicitly from manually closed rects specified as moves/lines.
@@ -2169,7 +2169,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
path.lineTo(9, 9);
path.lineTo(1, 9);
path.lineTo(1, 1);
- REPORTER_ASSERT(reporter, path.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, path.isNestedFillRects(nullptr));
// pass, stroke rect
SkPath src, dst;
@@ -2178,7 +2178,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) {
strokePaint.setStyle(SkPaint::kStroke_Style);
strokePaint.setStrokeWidth(2);
strokePaint.getFillPath(src, &dst);
- REPORTER_ASSERT(reporter, dst.isNestedFillRects(NULL));
+ REPORTER_ASSERT(reporter, dst.isNestedFillRects(nullptr));
}
static void write_and_read_back(skiatest::Reporter* reporter,
@@ -2198,7 +2198,7 @@ static void write_and_read_back(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() ==
p.getConvexityOrUnknown());
- REPORTER_ASSERT(reporter, readBack.isOval(NULL) == p.isOval(NULL));
+ REPORTER_ASSERT(reporter, readBack.isOval(nullptr) == p.isOval(nullptr));
const SkRect& origBounds = p.getBounds();
const SkRect& readBackBounds = readBack.getBounds();
@@ -2225,7 +2225,7 @@ static void test_flattening(skiatest::Reporter* reporter) {
// create a buffer that should be much larger than the path so we don't
// kill our stack if writer goes too far.
char buffer[1024];
- size_t size1 = p.writeToMemory(NULL);
+ size_t size1 = p.writeToMemory(nullptr);
size_t size2 = p.writeToMemory(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
@@ -2315,7 +2315,7 @@ static void test_transform(skiatest::Reporter* reporter) {
p.transform(matrix, &p1);
REPORTER_ASSERT(reporter, matrix.invert(&matrix));
- p1.transform(matrix, NULL);
+ p1.transform(matrix, nullptr);
SkRect pBounds = p.getBounds();
SkRect p1Bounds = p1.getBounds();
REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fLeft, p1Bounds.fLeft));
@@ -3089,51 +3089,51 @@ static void test_oval(skiatest::Reporter* reporter) {
rect = SkRect::MakeWH(SkIntToScalar(30), SkIntToScalar(50));
path.addOval(rect);
- REPORTER_ASSERT(reporter, path.isOval(NULL));
+ REPORTER_ASSERT(reporter, path.isOval(nullptr));
m.setRotate(SkIntToScalar(90));
SkPath tmp;
path.transform(m, &tmp);
// an oval rotated 90 degrees is still an oval.
- REPORTER_ASSERT(reporter, tmp.isOval(NULL));
+ REPORTER_ASSERT(reporter, tmp.isOval(nullptr));
m.reset();
m.setRotate(SkIntToScalar(30));
tmp.reset();
path.transform(m, &tmp);
// an oval rotated 30 degrees is not an oval anymore.
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL));
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
// since empty path being transformed.
path.reset();
tmp.reset();
m.reset();
path.transform(m, &tmp);
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL));
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
// empty path is not an oval
tmp.reset();
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL));
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
// only has moveTo()s
tmp.reset();
tmp.moveTo(0, 0);
tmp.moveTo(SkIntToScalar(10), SkIntToScalar(10));
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL));
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
// mimic WebKit's calling convention,
// call moveTo() first and then call addOval()
path.reset();
path.moveTo(0, 0);
path.addOval(rect);
- REPORTER_ASSERT(reporter, path.isOval(NULL));
+ REPORTER_ASSERT(reporter, path.isOval(nullptr));
// copy path
path.reset();
tmp.reset();
tmp.addOval(rect);
path = tmp;
- REPORTER_ASSERT(reporter, path.isOval(NULL));
+ REPORTER_ASSERT(reporter, path.isOval(nullptr));
}
static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
@@ -3204,7 +3204,7 @@ static void test_rrect(skiatest::Reporter* reporter) {
p.addRRect(rr);
bool closed;
SkPath::Direction dir;
- REPORTER_ASSERT(reporter, p.isRect(NULL, &closed, &dir));
+ REPORTER_ASSERT(reporter, p.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
REPORTER_ASSERT(reporter, SkPath::kCW_Direction == dir);
test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
@@ -3494,12 +3494,12 @@ static void test_get_point(skiatest::Reporter* reporter) {
SkPath p;
SkPoint pt = p.getPoint(0);
REPORTER_ASSERT(reporter, pt == SkPoint::Make(0, 0));
- REPORTER_ASSERT(reporter, !p.getLastPt(NULL));
+ REPORTER_ASSERT(reporter, !p.getLastPt(nullptr));
REPORTER_ASSERT(reporter, !p.getLastPt(&pt) && pt == SkPoint::Make(0, 0));
p.setLastPt(10, 10);
pt = p.getPoint(0);
REPORTER_ASSERT(reporter, pt == SkPoint::Make(10, 10));
- REPORTER_ASSERT(reporter, p.getLastPt(NULL));
+ REPORTER_ASSERT(reporter, p.getLastPt(nullptr));
p.rMoveTo(10, 10);
REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt == SkPoint::Make(20, 20));
}
@@ -3615,7 +3615,7 @@ public:
}
{
- SkScalar* weights = NULL;
+ SkScalar* weights = nullptr;
ed.growForRepeatedVerb(SkPath::kConic_Verb, kRepeatCnt, &weights);
REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
@@ -3671,7 +3671,7 @@ static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool
if (strlen(str) > 0) {
REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str)));
} else {
- REPORTER_ASSERT(reporter, data->data() == NULL || !memcmp(data->data(), str, strlen(str)));
+ REPORTER_ASSERT(reporter, data->data() == nullptr || !memcmp(data->data(), str, strlen(str)));
}
}
@@ -3842,8 +3842,8 @@ DEF_TEST(Paths, reporter) {
REPORTER_ASSERT(reporter, !(p == empty));
// do getPoints and getVerbs return the right result
- REPORTER_ASSERT(reporter, p.getPoints(NULL, 0) == 4);
- REPORTER_ASSERT(reporter, p.getVerbs(NULL, 0) == 5);
+ REPORTER_ASSERT(reporter, p.getPoints(nullptr, 0) == 4);
+ REPORTER_ASSERT(reporter, p.getVerbs(nullptr, 0) == 5);
SkPoint pts[4];
int count = p.getPoints(pts, 4);
REPORTER_ASSERT(reporter, count == 4);
@@ -3863,7 +3863,7 @@ DEF_TEST(Paths, reporter) {
p.offset(SK_Scalar1*3, SK_Scalar1*4);
REPORTER_ASSERT(reporter, bounds == p.getBounds());
- REPORTER_ASSERT(reporter, p.isRect(NULL));
+ REPORTER_ASSERT(reporter, p.isRect(nullptr));
bounds2.setEmpty();
REPORTER_ASSERT(reporter, p.isRect(&bounds2));
REPORTER_ASSERT(reporter, bounds == bounds2);
@@ -3871,7 +3871,7 @@ DEF_TEST(Paths, reporter) {
// now force p to not be a rect
bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2);
p.addRect(bounds);
- REPORTER_ASSERT(reporter, !p.isRect(NULL));
+ REPORTER_ASSERT(reporter, !p.isRect(nullptr));
// Test an edge case w.r.t. the bound returned by isRect (i.e., the
// path has a trailing moveTo. Please see crbug.com\445368)
diff --git a/tests/PictureBBHTest.cpp b/tests/PictureBBHTest.cpp
index d09403ff14..0a0d3da914 100644
--- a/tests/PictureBBHTest.cpp
+++ b/tests/PictureBBHTest.cpp
@@ -29,7 +29,7 @@ public:
void run(skiatest::Reporter* reporter) {
// No BBH
- this->run(NULL, reporter);
+ this->run(nullptr, reporter);
// With an R-Tree
SkRTreeFactory RTreeFactory;
diff --git a/tests/PictureShaderTest.cpp b/tests/PictureShaderTest.cpp
index 113f4f86ee..14bdcf2d81 100644
--- a/tests/PictureShaderTest.cpp
+++ b/tests/PictureShaderTest.cpp
@@ -11,7 +11,7 @@
#include "SkShader.h"
#include "Test.h"
-// Test that attempting to create a picture shader with a NULL picture or
+// Test that attempting to create a picture shader with a nullptr picture or
// empty picture returns a shader that draws nothing.
DEF_TEST(PictureShader_empty, reporter) {
SkPaint paint;
@@ -23,7 +23,7 @@ DEF_TEST(PictureShader_empty, reporter) {
canvas.clear(SK_ColorGREEN);
SkShader* shader = SkShader::CreatePictureShader(
- NULL, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
+ nullptr, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr);
paint.setShader(shader)->unref();
canvas.drawRect(SkRect::MakeWH(1,1), paint);
@@ -31,10 +31,10 @@ DEF_TEST(PictureShader_empty, reporter) {
SkPictureRecorder factory;
- factory.beginRecording(0, 0, NULL, 0);
+ factory.beginRecording(0, 0, nullptr, 0);
SkAutoTUnref<SkPicture> picture(factory.endRecording());
shader = SkShader::CreatePictureShader(
- picture.get(), SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
+ picture.get(), SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr);
paint.setShader(shader)->unref();
canvas.drawRect(SkRect::MakeWH(1,1), paint);
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index ce14213e82..de4d1e3e00 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -163,8 +163,8 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
// path effects currently render an SkPicture undesireable for GPU rendering
- const char *reason = NULL;
- REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason));
+ const char *reason = nullptr;
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr, &reason));
REPORTER_ASSERT(reporter, reason);
canvas = recorder.beginRecording(100, 100);
@@ -187,7 +187,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
}
picture.reset(recorder.endRecording());
// A lot of small AA concave paths should be fine for GPU rendering
- REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr));
canvas = recorder.beginRecording(100, 100);
{
@@ -209,7 +209,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
}
picture.reset(recorder.endRecording());
// A lot of large AA concave paths currently render an SkPicture undesireable for GPU rendering
- REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr));
canvas = recorder.beginRecording(100, 100);
{
@@ -233,7 +233,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
}
picture.reset(recorder.endRecording());
// hairline stroked AA concave paths are fine for GPU rendering
- REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr));
canvas = recorder.beginRecording(100, 100);
{
@@ -250,7 +250,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
}
picture.reset(recorder.endRecording());
// fast-path dashed effects are fine for GPU rendering ...
- REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(nullptr));
canvas = recorder.beginRecording(100, 100);
{
@@ -265,7 +265,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
}
picture.reset(recorder.endRecording());
// ... but only when applied to drawPoint() calls
- REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr));
// Nest the previous picture inside a new one.
canvas = recorder.beginRecording(100, 100);
@@ -273,7 +273,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
canvas->drawPicture(picture.get());
}
picture.reset(recorder.endRecording());
- REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(nullptr));
}
#endif
@@ -302,7 +302,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
&bbhFactory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
- c->saveLayer(NULL, &complexPaint);
+ c->saveLayer(nullptr, &complexPaint);
c->restore();
child.reset(recorder.endRecording());
@@ -337,11 +337,11 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
&bbhFactory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
// 1)
- c->saveLayer(NULL, &complexPaint); // layer #0
+ c->saveLayer(nullptr, &complexPaint); // layer #0
c->restore();
// 2)
- c->saveLayer(NULL, NULL); // layer #1
+ c->saveLayer(nullptr, nullptr); // layer #1
c->translate(kWidth / 2.0f, kHeight / 2.0f);
SkRect r = SkRect::MakeXYWH(0, 0, kWidth/2, kHeight/2);
c->saveLayer(&r, &complexPaint); // layer #2
@@ -350,7 +350,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
// 3)
{
- c->saveLayer(NULL, &complexPaint); // layer #3
+ c->saveLayer(nullptr, &complexPaint); // layer #3
c->restore();
}
@@ -358,7 +358,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
layerPaint.setColor(SK_ColorRED); // Non-alpha only to avoid SaveLayerDrawRestoreNooper
// 4)
{
- c->saveLayer(NULL, &layerPaint); // layer #4
+ c->saveLayer(nullptr, &layerPaint); // layer #4
c->drawPicture(child); // layer #5 inside picture
c->restore();
}
@@ -368,7 +368,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
SkMatrix trans;
trans.setTranslate(10, 10);
- c->saveLayer(NULL, &layerPaint); // layer #6
+ c->saveLayer(nullptr, &layerPaint); // layer #6
c->drawPicture(child, &trans, &picturePaint); // layer #7 inside picture
c->restore();
}
@@ -402,37 +402,37 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
const SkLayerInfo::BlockInfo& info6 = gpuData->block(7);
const SkLayerInfo::BlockInfo& info7 = gpuData->block(6);
- REPORTER_ASSERT(reporter, NULL == info0.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info0.fPicture);
REPORTER_ASSERT(reporter, kWidth == info0.fBounds.width() &&
kHeight == info0.fBounds.height());
REPORTER_ASSERT(reporter, info0.fLocalMat.isIdentity());
REPORTER_ASSERT(reporter, info0.fPreMat.isIdentity());
REPORTER_ASSERT(reporter, 0 == info0.fBounds.fLeft && 0 == info0.fBounds.fTop);
- REPORTER_ASSERT(reporter, NULL != info0.fPaint);
+ REPORTER_ASSERT(reporter, nullptr != info0.fPaint);
REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayers);
- REPORTER_ASSERT(reporter, NULL == info1.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info1.fPicture);
REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.width() &&
kHeight/2.0 == info1.fBounds.height());
REPORTER_ASSERT(reporter, info1.fLocalMat.isIdentity());
REPORTER_ASSERT(reporter, info1.fPreMat.isIdentity());
REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.fLeft &&
kHeight/2.0 == info1.fBounds.fTop);
- REPORTER_ASSERT(reporter, NULL == info1.fPaint);
+ REPORTER_ASSERT(reporter, nullptr == info1.fPaint);
REPORTER_ASSERT(reporter, !info1.fIsNested &&
info1.fHasNestedLayers); // has a nested SL
- REPORTER_ASSERT(reporter, NULL == info2.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info2.fPicture);
REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.width() &&
kHeight / 2 == info2.fBounds.height()); // bound reduces size
REPORTER_ASSERT(reporter, !info2.fLocalMat.isIdentity());
REPORTER_ASSERT(reporter, info2.fPreMat.isIdentity());
REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.fLeft && // translated
kHeight / 2 == info2.fBounds.fTop);
- REPORTER_ASSERT(reporter, NULL != info2.fPaint);
+ REPORTER_ASSERT(reporter, nullptr != info2.fPaint);
REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers); // is nested
- REPORTER_ASSERT(reporter, NULL == info3.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info3.fPicture);
REPORTER_ASSERT(reporter, kWidth == info3.fBounds.width() &&
kHeight == info3.fBounds.height());
REPORTER_ASSERT(reporter, info3.fLocalMat.isIdentity());
@@ -441,7 +441,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, info3.fPaint);
REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayers);
- REPORTER_ASSERT(reporter, NULL == info4.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info4.fPicture);
REPORTER_ASSERT(reporter, kWidth == info4.fBounds.width() &&
kHeight == info4.fBounds.height());
REPORTER_ASSERT(reporter, 0 == info4.fBounds.fLeft && 0 == info4.fBounds.fTop);
@@ -457,10 +457,10 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 0 == info5.fBounds.fLeft && 0 == info5.fBounds.fTop);
REPORTER_ASSERT(reporter, info5.fLocalMat.isIdentity());
REPORTER_ASSERT(reporter, info5.fPreMat.isIdentity());
- REPORTER_ASSERT(reporter, NULL != info5.fPaint);
+ REPORTER_ASSERT(reporter, nullptr != info5.fPaint);
REPORTER_ASSERT(reporter, info5.fIsNested && !info5.fHasNestedLayers); // is nested
- REPORTER_ASSERT(reporter, NULL == info6.fPicture);
+ REPORTER_ASSERT(reporter, nullptr == info6.fPicture);
REPORTER_ASSERT(reporter, kWidth-10 == info6.fBounds.width() &&
kHeight-10 == info6.fBounds.height());
REPORTER_ASSERT(reporter, 10 == info6.fBounds.fLeft && 10 == info6.fBounds.fTop);
@@ -476,7 +476,7 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 0 == info7.fBounds.fLeft && 0 == info7.fBounds.fTop);
REPORTER_ASSERT(reporter, info7.fLocalMat.isIdentity());
REPORTER_ASSERT(reporter, info7.fPreMat.isIdentity());
- REPORTER_ASSERT(reporter, NULL != info7.fPaint);
+ REPORTER_ASSERT(reporter, nullptr != info7.fPaint);
REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers); // is nested
}
}
@@ -530,7 +530,7 @@ static void test_has_text(skiatest::Reporter* reporter) {
path.moveTo(0, 0);
path.lineTo(50, 50);
- canvas->drawTextOnPath("Q", 1, path, NULL, SkPaint());
+ canvas->drawTextOnPath("Q", 1, path, nullptr, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
@@ -668,14 +668,14 @@ DEF_TEST(PictureRecorder_replay, reporter) {
SkCanvas* canvas = recorder.beginRecording(10, 10);
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
SkAutoTUnref<SkPicture> copy(SkPictureRecorderReplayTester::Copy(&recorder));
// The extra save and restore comes from the Copy process.
check_save_state(reporter, copy, 2, 1, 3);
- canvas->saveLayer(NULL, NULL);
+ canvas->saveLayer(nullptr, nullptr);
SkAutoTUnref<SkPicture> final(recorder.endRecording());
@@ -719,7 +719,7 @@ DEF_TEST(PictureRecorder_replay, reporter) {
{
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(4, 3, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(4, 3, nullptr, 0);
create_imbalance(canvas);
int expectedSaveCount = canvas->getSaveCount();
@@ -904,10 +904,10 @@ static void test_bitmap_with_encoded_data(skiatest::Reporter* reporter) {
SkSetErrorCallback(assert_one_parse_error_cb, &context);
SkMemoryStream pictureStream(picture1);
SkClearLastError();
- SkAutoTUnref<SkPicture> pictureFromStream(SkPicture::CreateFromStream(&pictureStream, NULL));
- REPORTER_ASSERT(reporter, pictureFromStream.get() != NULL);
+ SkAutoTUnref<SkPicture> pictureFromStream(SkPicture::CreateFromStream(&pictureStream, nullptr));
+ REPORTER_ASSERT(reporter, pictureFromStream.get() != nullptr);
SkClearLastError();
- SkSetErrorCallback(NULL, NULL);
+ SkSetErrorCallback(nullptr, nullptr);
}
static void test_clip_bound_opt(skiatest::Reporter* reporter) {
@@ -1331,7 +1331,7 @@ DEF_TEST(Picture_BitmapLeak, r) {
REPORTER_ASSERT(r, !immut.pixelRef()->unique());
// When the picture goes away, it's just our bitmaps holding the refs.
- pic.reset(NULL);
+ pic.reset(nullptr);
REPORTER_ASSERT(r, mut.pixelRef()->unique());
REPORTER_ASSERT(r, immut.pixelRef()->unique());
}
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 775354c83d..01e2ce5c0b 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -23,21 +23,21 @@ static void test_dont_leak_install(skiatest::Reporter* reporter) {
info = SkImageInfo::MakeN32Premul(0, 0);
release_counter = 1;
- success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, true == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
info = SkImageInfo::MakeN32Premul(10, 10);
release_counter = 1;
- success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, true == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
info = SkImageInfo::MakeN32Premul(-10, -10);
release_counter = 1;
- success = bm.installPixels(info, NULL, 0, NULL, decrement_counter_proc, &release_counter);
+ success = bm.installPixels(info, nullptr, 0, nullptr, decrement_counter_proc, &release_counter);
REPORTER_ASSERT(reporter, false == success);
bm.reset();
REPORTER_ASSERT(reporter, 0 == release_counter);
@@ -48,12 +48,12 @@ static void test_install(skiatest::Reporter* reporter) {
SkImageInfo info = SkImageInfo::MakeN32Premul(0, 0);
SkBitmap bm;
// make sure we don't assert on an empty install
- success = bm.installPixels(info, NULL, 0);
+ success = bm.installPixels(info, nullptr, 0);
REPORTER_ASSERT(reporter, success);
// no pixels should be the same as setInfo()
info = SkImageInfo::MakeN32Premul(10, 10);
- success = bm.installPixels(info, NULL, 0);
+ success = bm.installPixels(info, nullptr, 0);
REPORTER_ASSERT(reporter, success);
}
@@ -69,7 +69,7 @@ private:
DEF_TEST(PixelRef_GenIDChange, r) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
- SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, NULL));
+ SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
// Register a listener.
int count = 0;
@@ -94,9 +94,9 @@ DEF_TEST(PixelRef_GenIDChange, r) {
pixelRef->notifyPixelsChanged();
REPORTER_ASSERT(r, 1 == count);
- // Quick check that NULL is safe.
+ // Quick check that nullptr is safe.
REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
- pixelRef->addGenIDChangeListener(NULL);
+ pixelRef->addGenIDChangeListener(nullptr);
pixelRef->notifyPixelsChanged();
test_install(r);
diff --git a/tests/PointTest.cpp b/tests/PointTest.cpp
index 08ce7208eb..84ea865827 100644
--- a/tests/PointTest.cpp
+++ b/tests/PointTest.cpp
@@ -74,7 +74,7 @@ static float force_as_float(skiatest::Reporter* reporter, float value) {
// even the pair of memcpy calls are not sufficient, since those seem to
// be no-op'd, so we add a runtime tests (just like get_value) to force
// the compiler to give us an actual float.
- if (NULL == reporter) {
+ if (nullptr == reporter) {
storage = ~storage;
}
memcpy(&value, &storage, 4);
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index e230f11025..211006ad21 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -87,7 +87,7 @@ DEF_GPUTEST(PremulAlphaRoundTrip, reporter, factory) {
continue;
}
GrContext* ctx = factory->get(type);
- if (NULL == ctx) {
+ if (nullptr == ctx) {
continue;
}
device.reset(SkGpuDevice::Create(ctx, SkSurface::kNo_Budgeted, info, 0, &props,
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index c17aae9e6e..7eb80f1712 100644
--- a/tests/QuickRejectTest.cpp
+++ b/tests/QuickRejectTest.cpp
@@ -98,7 +98,7 @@ static void test_layers(skiatest::Reporter* reporter) {
// Test that saveLayer updates quickReject
SkRect bounds = SkRect::MakeLTRB(50, 50, 70, 70);
- canvas.saveLayer(&bounds, NULL);
+ canvas.saveLayer(&bounds, nullptr);
REPORTER_ASSERT(reporter, true == canvas.quickReject(SkRect::MakeWH(10, 10)));
REPORTER_ASSERT(reporter, false == canvas.quickReject(SkRect::MakeWH(60, 60)));
}
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index b94be0eba8..09d6211024 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -328,7 +328,7 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
continue;
}
GrContext* context = factory->get(type);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
GrSurfaceDesc desc;
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index a767068622..301bf6b78e 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -23,7 +23,7 @@ DEF_GPUTEST(ReadWriteAlpha, reporter, factory) {
continue;
}
GrContext* context = factory->get(glType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
diff --git a/tests/Reader32Test.cpp b/tests/Reader32Test.cpp
index cfa08b3c1f..c49e57c330 100644
--- a/tests/Reader32Test.cpp
+++ b/tests/Reader32Test.cpp
@@ -35,8 +35,8 @@ static void assert_empty(skiatest::Reporter* reporter, const SkReader32& reader)
DEF_TEST(Reader32, reporter) {
SkReader32 reader;
assert_empty(reporter, reader);
- REPORTER_ASSERT(reporter, NULL == reader.base());
- REPORTER_ASSERT(reporter, NULL == reader.peek());
+ REPORTER_ASSERT(reporter, nullptr == reader.base());
+ REPORTER_ASSERT(reporter, nullptr == reader.peek());
size_t i;
@@ -74,8 +74,8 @@ DEF_TEST(Reader32, reporter) {
reader.read(buffer, sizeof(data2));
REPORTER_ASSERT(reporter, !memcmp(data2, buffer, sizeof(data2)));
- reader.setMemory(NULL, 0);
+ reader.setMemory(nullptr, 0);
assert_empty(reporter, reader);
- REPORTER_ASSERT(reporter, NULL == reader.base());
- REPORTER_ASSERT(reporter, NULL == reader.peek());
+ REPORTER_ASSERT(reporter, nullptr == reader.base());
+ REPORTER_ASSERT(reporter, nullptr == reader.peek());
}
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index 84ceb20f54..d8ca48d796 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -67,7 +67,7 @@ DEF_TEST(RecordDraw_Abort, r) {
SkRecorder canvas(&rerecord, W, H);
JustOneDraw callback;
- SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, &callback);
+ SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr/*bbh*/, &callback);
REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord));
REPORTER_ASSERT(r, 0 == count_instances_of_type<SkRecords::ClipRect>(rerecord));
@@ -81,7 +81,7 @@ DEF_TEST(RecordDraw_Unbalanced, r) {
SkRecord rerecord;
SkRecorder canvas(&rerecord, W, H);
- SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, NULL/*callback*/);
+ SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr/*bbh*/, nullptr/*callback*/);
int save_count = count_instances_of_type<SkRecords::Save>(rerecord);
int restore_count = count_instances_of_type<SkRecords::Save>(rerecord);
@@ -103,7 +103,7 @@ DEF_TEST(RecordDraw_SetMatrixClobber, r) {
translate.setTranslate(20, 20);
translateCanvas.setMatrix(translate);
- SkRecordDraw(scaleRecord, &translateCanvas, NULL, NULL, 0, NULL/*bbh*/, NULL/*callback*/);
+ SkRecordDraw(scaleRecord, &translateCanvas, nullptr, nullptr, 0, nullptr/*bbh*/, nullptr/*callback*/);
REPORTER_ASSERT(r, 4 == translateRecord.count());
assert_type<SkRecords::SetMatrix>(r, translateRecord, 0);
assert_type<SkRecords::Save> (r, translateRecord, 1);
@@ -215,7 +215,7 @@ DEF_TEST(RecordDraw_PartialStartStop, r) {
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- SkRecordPartialDraw(record, &canvas, NULL, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2
+ SkRecordPartialDraw(record, &canvas, nullptr, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2
REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord));
int index = find_first_instances_of_type<SkRecords::DrawRect>(rerecord);
@@ -238,7 +238,7 @@ DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) {
paint.setImageFilter(SkDropShadowImageFilter::Create(20, 0, 0, 0, SK_ColorBLACK,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode))->unref();
- recorder.saveLayer(NULL, &paint);
+ recorder.saveLayer(nullptr, &paint);
recorder.clipRect(SkRect::MakeWH(20, 40));
recorder.drawRect(SkRect::MakeWH(20, 40), SkPaint());
recorder.restore();
@@ -317,7 +317,7 @@ DEF_TEST(RecordDraw_drawImage, r){
SkRecord record;
SkRecorder recorder(&record, 10, 10);
recorder.drawImage(image, 0, 0);
- SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0);
+ SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0);
}
REPORTER_ASSERT(r, canvas.fDrawImageCalled);
canvas.resetTestValues();
@@ -326,7 +326,7 @@ DEF_TEST(RecordDraw_drawImage, r){
SkRecord record;
SkRecorder recorder(&record, 10, 10);
recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr);
- SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0);
+ SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0);
}
REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index 25102c4fc8..dd6c410ed4 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -77,7 +77,7 @@ DEF_TEST(RecordOpts_SaveSaveLayerRestoreRestore, r) {
// A previous bug NoOp'd away the first 3 commands.
recorder.save();
- recorder.saveLayer(NULL, NULL);
+ recorder.saveLayer(nullptr, nullptr);
recorder.restore();
recorder.restore();
@@ -131,13 +131,13 @@ DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) {
translucentDrawPaint.setColor(0x0F020202); // Not opaque.
// SaveLayer/Restore removed: No paint = no point.
- recorder.saveLayer(NULL, NULL);
+ recorder.saveLayer(nullptr, nullptr);
recorder.drawRect(draw, opaqueDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 0, true);
// Bounds don't matter.
- recorder.saveLayer(&bounds, NULL);
+ recorder.saveLayer(&bounds, nullptr);
recorder.drawRect(draw, opaqueDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 3, true);
@@ -145,31 +145,31 @@ DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) {
// TODO(mtklein): test case with null draw paint
// No change: layer paint isn't alpha-only.
- recorder.saveLayer(NULL, &translucentLayerPaint);
+ recorder.saveLayer(nullptr, &translucentLayerPaint);
recorder.drawRect(draw, opaqueDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 6, false);
// No change: layer paint has an effect.
- recorder.saveLayer(NULL, &xfermodeLayerPaint);
+ recorder.saveLayer(nullptr, &xfermodeLayerPaint);
recorder.drawRect(draw, opaqueDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 9, false);
// SaveLayer/Restore removed: we can fold in the alpha!
- recorder.saveLayer(NULL, &alphaOnlyLayerPaint);
+ recorder.saveLayer(nullptr, &alphaOnlyLayerPaint);
recorder.drawRect(draw, translucentDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 12, true);
// SaveLayer/Restore removed: we can fold in the alpha!
- recorder.saveLayer(NULL, &alphaOnlyLayerPaint);
+ recorder.saveLayer(nullptr, &alphaOnlyLayerPaint);
recorder.drawRect(draw, opaqueDrawPaint);
recorder.restore();
assert_savelayer_restore(r, &record, 15, true);
const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, record, 16);
- REPORTER_ASSERT(r, drawRect != NULL);
+ REPORTER_ASSERT(r, drawRect != nullptr);
REPORTER_ASSERT(r, drawRect->paint.getColor() == 0x03020202);
}
@@ -223,9 +223,9 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
{
// Any combination of these should cause the pattern to be optimized.
- SkRect* firstBounds[] = { NULL, &bounds };
- SkPaint* firstPaints[] = { NULL, &alphaOnlyLayerPaint };
- SkRect* secondBounds[] = { NULL, &bounds };
+ SkRect* firstBounds[] = { nullptr, &bounds };
+ SkPaint* firstPaints[] = { nullptr, &alphaOnlyLayerPaint };
+ SkRect* secondBounds[] = { nullptr, &bounds };
SkPaint* secondPaints[] = { &opaqueFilterLayerPaint, &translucentFilterLayerPaint };
for (size_t i = 0; i < SK_ARRAY_COUNT(firstBounds); ++ i) {
@@ -252,8 +252,8 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
SkPaint* firstPaint;
SkPaint* secondPaint;
} noChangeTests[] = {
- // No change: NULL filter layer paint not implemented.
- { &alphaOnlyLayerPaint, NULL },
+ // No change: nullptr filter layer paint not implemented.
+ { &alphaOnlyLayerPaint, nullptr },
// No change: layer paint is not alpha-only.
{ &translucentLayerPaint, &opaqueFilterLayerPaint },
// No change: layer paint has an xfereffect.
@@ -268,10 +268,10 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
};
for (size_t i = 0; i < SK_ARRAY_COUNT(noChangeTests); ++i) {
- recorder.saveLayer(NULL, noChangeTests[i].firstPaint);
+ recorder.saveLayer(nullptr, noChangeTests[i].firstPaint);
recorder.save();
recorder.clipRect(clip);
- recorder.saveLayer(NULL, noChangeTests[i].secondPaint);
+ recorder.saveLayer(nullptr, noChangeTests[i].secondPaint);
recorder.restore();
recorder.restore();
recorder.restore();
@@ -280,25 +280,25 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
}
// Test the folded alpha value.
- recorder.saveLayer(NULL, &alphaOnlyLayerPaint);
+ recorder.saveLayer(nullptr, &alphaOnlyLayerPaint);
recorder.save();
recorder.clipRect(clip);
- recorder.saveLayer(NULL, &opaqueFilterLayerPaint);
+ recorder.saveLayer(nullptr, &opaqueFilterLayerPaint);
recorder.restore();
recorder.restore();
recorder.restore();
assert_merge_svg_opacity_and_filter_layers(r, &record, index, true);
const SkRecords::SaveLayer* saveLayer = assert_type<SkRecords::SaveLayer>(r, record, index + 3);
- REPORTER_ASSERT(r, saveLayer != NULL);
+ REPORTER_ASSERT(r, saveLayer != nullptr);
REPORTER_ASSERT(r, saveLayer->paint->getColor() == 0x03020202);
index += 7;
// Test that currently we do not fold alphas for patterns without the clip. This is just not
// implemented.
- recorder.saveLayer(NULL, &alphaOnlyLayerPaint);
- recorder.saveLayer(NULL, &opaqueFilterLayerPaint);
+ recorder.saveLayer(nullptr, &alphaOnlyLayerPaint);
+ recorder.saveLayer(nullptr, &opaqueFilterLayerPaint);
recorder.restore();
recorder.restore();
SkRecordMergeSvgOpacityAndFilterLayers(&record);
diff --git a/tests/RecordPatternTest.cpp b/tests/RecordPatternTest.cpp
index b88165d6f3..d1e48bb838 100644
--- a/tests/RecordPatternTest.cpp
+++ b/tests/RecordPatternTest.cpp
@@ -35,9 +35,9 @@ DEF_TEST(RecordPattern_Simple, r) {
recorder.restore();
REPORTER_ASSERT(r, pattern.match(&record, 0));
- REPORTER_ASSERT(r, pattern.first<Save>() != NULL);
- REPORTER_ASSERT(r, pattern.second<ClipRect>() != NULL);
- REPORTER_ASSERT(r, pattern.third<Restore>() != NULL);
+ REPORTER_ASSERT(r, pattern.first<Save>() != nullptr);
+ REPORTER_ASSERT(r, pattern.second<ClipRect>() != nullptr);
+ REPORTER_ASSERT(r, pattern.third<Restore>() != nullptr);
}
DEF_TEST(RecordPattern_StartingIndex, r) {
@@ -146,7 +146,7 @@ DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) {
SkRecord record;
SkRecorder recorder(&record, 1920, 1200);
- recorder.saveLayer(NULL, NULL);
+ recorder.saveLayer(nullptr, nullptr);
REPORTER_ASSERT(r, !pattern.match(&record, 0));
}
diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp
index 8c45ee14dd..3074cfdc13 100644
--- a/tests/RecordReplaceDrawTest.cpp
+++ b/tests/RecordReplaceDrawTest.cpp
@@ -50,7 +50,7 @@ DEF_TEST(RecordReplaceDraw_Abort, r) {
SkRecorder canvas(&rerecord, kWidth, kHeight);
JustOneDraw callback;
- GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), &callback);
+ GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), &callback);
switch (rerecord.count()) {
case 3:
@@ -83,7 +83,7 @@ DEF_TEST(RecordReplaceDraw_Unbalanced, r) {
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), NULL/*callback*/);
+ GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), nullptr/*callback*/);
// ensure rerecord is balanced (in this case by checking that the count is odd)
REPORTER_ASSERT(r, (rerecord.count() & 1) == 1);
@@ -97,10 +97,10 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) {
SkRTreeFactory bbhFactory;
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntToScalar(kHeight),
- useBBH ? &bbhFactory : NULL);
+ useBBH ? &bbhFactory : nullptr);
SkPaint paint;
- canvas->saveLayer(NULL, &paint);
+ canvas->saveLayer(nullptr, &paint);
canvas->clear(SK_ColorRED);
canvas->restore();
canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth / 2), SkIntToScalar(kHeight / 2)),
@@ -125,14 +125,14 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) {
desc.fSampleCnt = 0;
SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc,
- false, NULL, 0));
+ false, nullptr, 0));
layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight));
SkAutoTUnref<SkBBoxHierarchy> bbh;
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), NULL/*callback*/);
+ GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callback*/);
int recount = rerecord.count();
REPORTER_ASSERT(r, 2 == recount || 4 == recount);
@@ -156,7 +156,7 @@ DEF_GPUTEST(RecordReplaceDraw, r, factory) {
continue;
}
GrContext* context = factory->get(glType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
diff --git a/tests/RecordTestUtils.h b/tests/RecordTestUtils.h
index 8243089e5d..e4421fab52 100644
--- a/tests/RecordTestUtils.h
+++ b/tests/RecordTestUtils.h
@@ -11,10 +11,10 @@
#include "SkRecord.h"
#include "SkRecords.h"
-// If the command we're reading is a U, set ptr to it, otherwise set it to NULL.
+// If the command we're reading is a U, set ptr to it, otherwise set it to nullptr.
template <typename U>
struct ReadAs {
- ReadAs() : ptr(NULL), type(SkRecords::Type(~0)) {}
+ ReadAs() : ptr(nullptr), type(SkRecords::Type(~0)) {}
const U* ptr;
SkRecords::Type type;
diff --git a/tests/RecordingXfermodeTest.cpp b/tests/RecordingXfermodeTest.cpp
index 7c234ada4c..05af84c377 100644
--- a/tests/RecordingXfermodeTest.cpp
+++ b/tests/RecordingXfermodeTest.cpp
@@ -50,9 +50,9 @@ class Drawer {
canvas->clipRect(clipRect);
canvas->clear(0xff000000);
- canvas->saveLayer(NULL, &blackPaint);
+ canvas->saveLayer(nullptr, &blackPaint);
canvas->drawRect(canvasRect, greenPaint);
- canvas->saveLayer(NULL, &layerPaint);
+ canvas->saveLayer(nullptr, &layerPaint);
canvas->drawBitmapRect(fCircleBM, SkRect::MakeXYWH(20,20,60,60), &blackPaint);
canvas->restore();
canvas->restore();
diff --git a/tests/RefDictTest.cpp b/tests/RefDictTest.cpp
index 469026ebc9..af30f86148 100644
--- a/tests/RefDictTest.cpp
+++ b/tests/RefDictTest.cpp
@@ -19,9 +19,9 @@ DEF_TEST(RefDict, reporter) {
TestRC data0, data1;
SkRefDict dict;
- REPORTER_ASSERT(reporter, NULL == dict.find(NULL));
- REPORTER_ASSERT(reporter, NULL == dict.find("foo"));
- REPORTER_ASSERT(reporter, NULL == dict.find("bar"));
+ REPORTER_ASSERT(reporter, nullptr == dict.find(nullptr));
+ REPORTER_ASSERT(reporter, nullptr == dict.find("foo"));
+ REPORTER_ASSERT(reporter, nullptr == dict.find("bar"));
dict.set("foo", &data0);
REPORTER_ASSERT(reporter, &data0 == dict.find("foo"));
@@ -36,8 +36,8 @@ DEF_TEST(RefDict, reporter) {
REPORTER_ASSERT(reporter, data0.unique());
REPORTER_ASSERT(reporter, !data1.unique());
- dict.set("foo", NULL);
- REPORTER_ASSERT(reporter, NULL == dict.find("foo"));
+ dict.set("foo", nullptr);
+ REPORTER_ASSERT(reporter, nullptr == dict.find("foo"));
REPORTER_ASSERT(reporter, data0.unique());
REPORTER_ASSERT(reporter, data1.unique());
@@ -55,14 +55,14 @@ DEF_TEST(RefDict, reporter) {
REPORTER_ASSERT(reporter, !data1.unique());
dict.removeAll();
- REPORTER_ASSERT(reporter, NULL == dict.find("foo"));
- REPORTER_ASSERT(reporter, NULL == dict.find("bar"));
+ REPORTER_ASSERT(reporter, nullptr == dict.find("foo"));
+ REPORTER_ASSERT(reporter, nullptr == dict.find("bar"));
REPORTER_ASSERT(reporter, data0.unique());
REPORTER_ASSERT(reporter, data1.unique());
{
SkRefDict d;
- REPORTER_ASSERT(reporter, NULL == d.find("foo"));
+ REPORTER_ASSERT(reporter, nullptr == d.find("foo"));
REPORTER_ASSERT(reporter, data0.unique());
d.set("foo", &data0);
REPORTER_ASSERT(reporter, &data0 == d.find("foo"));
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index 121f16d6ec..4a96056419 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -266,7 +266,7 @@ DEF_TEST(Region, reporter) {
// Test that writeToMemory reports the same number of bytes whether there was a
// buffer to write to or not.
static void test_write(const SkRegion& region, skiatest::Reporter* r) {
- const size_t bytesNeeded = region.writeToMemory(NULL);
+ const size_t bytesNeeded = region.writeToMemory(nullptr);
SkAutoMalloc storage(bytesNeeded);
const size_t bytesWritten = region.writeToMemory(storage.get());
REPORTER_ASSERT(r, bytesWritten == bytesNeeded);
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index dff96f9213..d76da31920 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -38,7 +38,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanva
size_t srcSize = src.getSize();
size_t initialCacheSize;
- context->getResourceCacheUsage(NULL, &initialCacheSize);
+ context->getResourceCacheUsage(nullptr, &initialCacheSize);
int oldMaxNum;
size_t oldMaxBytes;
@@ -60,7 +60,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context, SkCanva
src.notifyPixelsChanged();
size_t curCacheSize;
- context->getResourceCacheUsage(NULL, &curCacheSize);
+ context->getResourceCacheUsage(nullptr, &curCacheSize);
// we should never go over the size limit
REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize);
@@ -185,8 +185,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
static const int kW = 100;
static const int kH = 100;
- texIDs[0] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
- texIDs[1] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
+ texIDs[0] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
+ texIDs[1] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
context->resetContext();
@@ -208,8 +208,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
return;
}
- borrowed.reset(NULL);
- adopted.reset(NULL);
+ borrowed.reset(nullptr);
+ adopted.reset(nullptr);
context->flush();
@@ -235,7 +235,7 @@ public:
TestResource(GrGpu* gpu, size_t size, GrGpuResource::LifeCycle lifeCycle)
: INHERITED(gpu, lifeCycle)
- , fToDelete(NULL)
+ , fToDelete(nullptr)
, fSize(size)
, fProperty(kA_SimulatedProperty) {
++fNumAlive;
@@ -244,7 +244,7 @@ public:
TestResource(GrGpu* gpu, GrGpuResource::LifeCycle lifeCycle)
: INHERITED(gpu, lifeCycle)
- , fToDelete(NULL)
+ , fToDelete(nullptr)
, fSize(kDefaultSize)
, fProperty(kA_SimulatedProperty) {
++fNumAlive;
@@ -253,7 +253,7 @@ public:
TestResource(GrGpu* gpu)
: INHERITED(gpu, kCached_LifeCycle)
- , fToDelete(NULL)
+ , fToDelete(nullptr)
, fSize(kDefaultSize)
, fProperty(kA_SimulatedProperty) {
++fNumAlive;
@@ -297,7 +297,7 @@ private:
TestResource(GrGpu* gpu, SimulatedProperty property, bool cached, ScratchConstructor)
: INHERITED(gpu, cached ? kCached_LifeCycle : kUncached_LifeCycle)
- , fToDelete(NULL)
+ , fToDelete(nullptr)
, fSize(kDefaultSize)
, fProperty(property) {
GrScratchKey scratchKey;
@@ -417,7 +417,7 @@ static void test_budgeting(skiatest::Reporter* reporter) {
GrUniqueKey uniqueKey2;
make_unique_key<0>(&uniqueKey2, 1);
wrapped->resourcePriv().setUniqueKey(uniqueKey2);
- REPORTER_ASSERT(reporter, NULL == cache->findAndRefUniqueResource(uniqueKey2));
+ REPORTER_ASSERT(reporter, nullptr == cache->findAndRefUniqueResource(uniqueKey2));
// Make sure sizes are as we expect
REPORTER_ASSERT(reporter, 4 == cache->getResourceCount());
@@ -557,7 +557,7 @@ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
REPORTER_ASSERT(reporter, !resource->resourcePriv().isBudgeted());
- REPORTER_ASSERT(reporter, NULL == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
+ REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());
REPORTER_ASSERT(reporter, size == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount());
@@ -615,7 +615,7 @@ static void test_duplicate_scratch_key(skiatest::Reporter* reporter) {
GrScratchKey scratchKey1;
TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey1);
// Check for negative case consistency. (leaks upon test failure.)
- REPORTER_ASSERT(reporter, NULL == cache->findAndRefScratchResource(scratchKey1, TestResource::kDefaultSize, 0));
+ REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(scratchKey1, TestResource::kDefaultSize, 0));
GrScratchKey scratchKey;
TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
@@ -662,7 +662,7 @@ static void test_remove_scratch_key(skiatest::Reporter* reporter) {
// Ensure that scratch key lookup is correct for negative case.
TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey);
// (following leaks upon test failure).
- REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == NULL);
+ REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr);
// Scratch resources are registered with GrResourceCache just by existing. There are 2.
TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
@@ -742,21 +742,21 @@ static void test_scratch_key_consistency(skiatest::Reporter* reporter) {
// Ensure that scratch key lookup is correct for negative case.
TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey);
// (following leaks upon test failure).
- REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == NULL);
+ REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr);
// Find the first resource with a scratch key and a copy of a scratch key.
TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
GrGpuResource* find = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
- REPORTER_ASSERT(reporter, find != NULL);
+ REPORTER_ASSERT(reporter, find != nullptr);
find->unref();
scratchKey2 = scratchKey;
find = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0);
- REPORTER_ASSERT(reporter, find != NULL);
+ REPORTER_ASSERT(reporter, find != nullptr);
REPORTER_ASSERT(reporter, find == a || find == b);
GrGpuResource* find2 = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0);
- REPORTER_ASSERT(reporter, find2 != NULL);
+ REPORTER_ASSERT(reporter, find2 != nullptr);
REPORTER_ASSERT(reporter, find2 == a || find2 == b);
REPORTER_ASSERT(reporter, find2 != find);
find2->unref();
@@ -956,7 +956,7 @@ static void test_cache_chained_purge(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
// Break the cycle
- a->setUnrefWhenDestroyed(NULL);
+ a->setUnrefWhenDestroyed(nullptr);
REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
cache->purgeAllUnlocked();
@@ -1080,9 +1080,9 @@ static void test_timestamp_wrap(skiatest::Reporter* reporter) {
if (currShouldPurgeIdx < shouldPurgeIdxs.count() &&
shouldPurgeIdxs[currShouldPurgeIdx] == j) {
++currShouldPurgeIdx;
- REPORTER_ASSERT(reporter, NULL == res);
+ REPORTER_ASSERT(reporter, nullptr == res);
} else {
- REPORTER_ASSERT(reporter, NULL != res);
+ REPORTER_ASSERT(reporter, nullptr != res);
}
SkSafeUnref(res);
}
@@ -1257,7 +1257,7 @@ DEF_GPUTEST(ResourceCache, reporter, factory) {
continue;
}
GrContext* context = factory->get(glType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
GrSurfaceDesc desc;
diff --git a/tests/SVGDeviceTest.cpp b/tests/SVGDeviceTest.cpp
index c973f8b15f..494efbb3e7 100644
--- a/tests/SVGDeviceTest.cpp
+++ b/tests/SVGDeviceTest.cpp
@@ -24,21 +24,21 @@ void check_text_node(skiatest::Reporter* reporter,
const SkPoint& offset,
unsigned scalarsPerPos,
const char* expected) {
- if (root == NULL) {
+ if (root == nullptr) {
ERRORF(reporter, "root element not found.");
return;
}
const SkDOM::Node* textElem = dom.getFirstChild(root, "text");
- if (textElem == NULL) {
+ if (textElem == nullptr) {
ERRORF(reporter, "<text> element not found.");
return;
}
REPORTER_ASSERT(reporter, dom.getType(textElem) == SkDOM::kElement_Type);
const SkDOM::Node* textNode= dom.getFirstChild(textElem);
- REPORTER_ASSERT(reporter, textNode != NULL);
- if (textNode != NULL) {
+ REPORTER_ASSERT(reporter, textNode != nullptr);
+ if (textNode != nullptr) {
REPORTER_ASSERT(reporter, dom.getType(textNode) == SkDOM::kText_Type);
REPORTER_ASSERT(reporter, strcmp(expected, dom.getName(textNode)) == 0);
}
@@ -46,8 +46,8 @@ void check_text_node(skiatest::Reporter* reporter,
int textLen = SkToInt(strlen(expected));
const char* x = dom.findAttr(textElem, "x");
- REPORTER_ASSERT(reporter, x != NULL);
- if (x != NULL) {
+ REPORTER_ASSERT(reporter, x != nullptr);
+ if (x != nullptr) {
int xposCount = (scalarsPerPos < 1) ? 1 : textLen;
REPORTER_ASSERT(reporter, SkParse::Count(x) == xposCount);
@@ -63,8 +63,8 @@ void check_text_node(skiatest::Reporter* reporter,
}
const char* y = dom.findAttr(textElem, "y");
- REPORTER_ASSERT(reporter, y != NULL);
- if (y != NULL) {
+ REPORTER_ASSERT(reporter, y != nullptr);
+ if (y != nullptr) {
int yposCount = (scalarsPerPos < 2) ? 1 : textLen;
REPORTER_ASSERT(reporter, SkParse::Count(y) == yposCount);
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 31dbbe8ad9..01e90d898b 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -186,15 +186,15 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed,
// Make sure this fails when it should (test with smaller size, but still multiple of 4)
SkValidatingReadBuffer buffer(dataWritten, bytesWritten - 4);
- T* obj = NULL;
+ T* obj = nullptr;
SerializationUtils<T>::Read(buffer, &obj);
REPORTER_ASSERT(reporter, !buffer.isValid());
- REPORTER_ASSERT(reporter, NULL == obj);
+ REPORTER_ASSERT(reporter, nullptr == obj);
// Make sure this succeeds when it should
SkValidatingReadBuffer buffer2(dataWritten, bytesWritten);
const unsigned char* peekBefore = static_cast<const unsigned char*>(buffer2.skip(0));
- T* obj2 = NULL;
+ T* obj2 = nullptr;
SerializationUtils<T>::Read(buffer2, &obj2);
const unsigned char* peekAfter = static_cast<const unsigned char*>(buffer2.skip(0));
if (shouldSucceed) {
@@ -205,7 +205,7 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed,
} else {
// If the deserialization was supposed to fail, make sure it did
REPORTER_ASSERT(reporter, !buffer.isValid());
- REPORTER_ASSERT(reporter, NULL == obj2);
+ REPORTER_ASSERT(reporter, nullptr == obj2);
}
return obj2; // Return object to perform further validity tests on it
@@ -267,7 +267,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
static void TestXfermodeSerialization(skiatest::Reporter* reporter) {
for (size_t i = 0; i <= SkXfermode::kLastMode; ++i) {
if (i == SkXfermode::kSrcOver_Mode) {
- // skip SrcOver, as it is allowed to return NULL from Create()
+ // skip SrcOver, as it is allowed to return nullptr from Create()
continue;
}
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(static_cast<SkXfermode::Mode>(i)));
@@ -331,7 +331,7 @@ static void serialize_and_compare_typeface(SkTypeface* typeface, const char* tex
SkIRect canvasRect = SkIRect::MakeWH(kBitmapSize, kBitmapSize);
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(canvasRect.width()),
SkIntToScalar(canvasRect.height()),
- NULL, 0);
+ nullptr, 0);
canvas->drawColor(SK_ColorWHITE);
canvas->drawText(text, 2, 24, 32, paint);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
@@ -413,7 +413,7 @@ static void draw_something(SkCanvas* canvas) {
canvas->save();
canvas->scale(0.5f, 0.5f);
- canvas->drawBitmap(bitmap, 0, 0, NULL);
+ canvas->drawBitmap(bitmap, 0, 0, nullptr);
canvas->restore();
paint.setAntiAlias(true);
@@ -524,7 +524,7 @@ DEF_TEST(Serialization, reporter) {
SkPictureRecorder recorder;
draw_something(recorder.beginRecording(SkIntToScalar(kBitmapSize),
SkIntToScalar(kBitmapSize),
- NULL, 0));
+ nullptr, 0));
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
// Serialize picture
diff --git a/tests/SkBase64Test.cpp b/tests/SkBase64Test.cpp
index a534768793..d855ef57ad 100644
--- a/tests/SkBase64Test.cpp
+++ b/tests/SkBase64Test.cpp
@@ -17,7 +17,7 @@ DEF_TEST(SkBase64, reporter) {
for (int offset = 0; offset < 6; ++offset) {
size_t length = 256 - offset;
- size_t encodeLength = SkBase64::Encode(all + offset, length, NULL);
+ size_t encodeLength = SkBase64::Encode(all + offset, length, nullptr);
SkAutoTMalloc<char> src(encodeLength + 1);
SkBase64::Encode(all + offset, length, src.get());
src[SkToInt(encodeLength)] = '\0';
diff --git a/tests/SkImageTest.cpp b/tests/SkImageTest.cpp
index fabc1fd146..8817f0b597 100644
--- a/tests/SkImageTest.cpp
+++ b/tests/SkImageTest.cpp
@@ -33,7 +33,7 @@ DEF_TEST(SkImageFromBitmap_extractSubset, reporter) {
tgt.allocN32Pixels(gWidth, gHeight);
SkCanvas canvas(tgt);
canvas.clear(SK_ColorTRANSPARENT);
- canvas.drawImage(image, 0, 0, NULL);
+ canvas.drawImage(image, 0, 0, nullptr);
uint32_t pixel = 0;
SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType);
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 58ab781725..6314863e50 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -142,7 +142,7 @@ static void check_data(skiatest::Reporter* reporter, const SkCachedData* data,
int refcnt, CachedState cacheState, LockedState lockedState) {
REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt);
REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState));
- bool isLocked = (data->data() != NULL);
+ bool isLocked = (data->data() != nullptr);
REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked));
}
@@ -154,7 +154,7 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach
src.setImmutable();
const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src, cache);
- REPORTER_ASSERT(reporter, NULL == mipmap);
+ REPORTER_ASSERT(reporter, nullptr == mipmap);
mipmap = SkMipMapCache::AddAndRef(src, cache);
REPORTER_ASSERT(reporter, mipmap);
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 23cd30c0c1..98c54e032c 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -382,7 +382,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
}
void TestResult::testOne() {
- SkPicture* pic = NULL;
+ SkPicture* pic = nullptr;
{
SkString d;
d.printf(" {%d, \"%s\"},", fDirNo, fFilename);
@@ -417,7 +417,7 @@ void TestResult::testOne() {
#else
GrContext* context = contextFactory.get(kNative);
#endif
- if (NULL == context) {
+ if (nullptr == context) {
SkDebugf("unable to allocate context for %s\n", fFilename);
goto finish;
}
@@ -450,7 +450,7 @@ void TestResult::testOne() {
desc.fWidth = dim.fX;
desc.fHeight = dim.fY;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0));
+ SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0));
if (!texture) {
SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename,
dim.fX, dim.fY);
diff --git a/tests/SmallAllocatorTest.cpp b/tests/SmallAllocatorTest.cpp
index 30c8ffa94a..774e0c9e89 100644
--- a/tests/SmallAllocatorTest.cpp
+++ b/tests/SmallAllocatorTest.cpp
@@ -32,7 +32,7 @@ template<uint32_t kMaxObjects, size_t kBytes> void test_allocator(skiatest::Repo
SkSmallAllocator<kMaxObjects, kBytes> alloc;
for (uint32_t i = 0; i < kMaxObjects; ++i) {
CountingClass* c = alloc.template createT<CountingClass>();
- REPORTER_ASSERT(reporter, c != NULL);
+ REPORTER_ASSERT(reporter, c != nullptr);
REPORTER_ASSERT(reporter, CountingClass::GetCount() == static_cast<int>(i+1));
}
}
@@ -78,6 +78,6 @@ DEF_TEST(SmallAllocator_pointer, reporter) {
SkSmallAllocator<1, 8> alloc;
Dummy d;
DummyContainer* container = alloc.createT<DummyContainer>(&d);
- REPORTER_ASSERT(reporter, container != NULL);
+ REPORTER_ASSERT(reporter, container != nullptr);
REPORTER_ASSERT(reporter, container->getDummy() == &d);
}
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index 6f78eca5f0..d307f51318 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -170,16 +170,16 @@ static void TestPackedUInt(skiatest::Reporter* reporter) {
}
}
-// Test that setting an SkMemoryStream to a NULL data does not result in a crash when calling
+// Test that setting an SkMemoryStream to a nullptr data does not result in a crash when calling
// methods that access fData.
static void TestDereferencingData(SkMemoryStream* memStream) {
- memStream->read(NULL, 0);
+ memStream->read(nullptr, 0);
memStream->getMemoryBase();
SkAutoDataUnref data(memStream->copyToData());
}
static void TestNullData() {
- SkData* nullData = NULL;
+ SkData* nullData = nullptr;
SkMemoryStream memStream(nullData);
TestDereferencingData(&memStream);
@@ -241,9 +241,9 @@ static void test_peeking_front_buffered_stream(skiatest::Reporter* r,
const SkStream& original,
size_t bufferSize) {
SkStream* dupe = original.duplicate();
- REPORTER_ASSERT(r, dupe != NULL);
+ REPORTER_ASSERT(r, dupe != nullptr);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(dupe, bufferSize));
- REPORTER_ASSERT(r, bufferedStream != NULL);
+ REPORTER_ASSERT(r, bufferedStream != nullptr);
test_peeking_stream(r, bufferedStream, bufferSize);
}
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index af21d861fe..595a0b194a 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -36,7 +36,7 @@ DEF_TEST(String, reporter) {
SkString a;
SkString b((size_t)0);
SkString c("");
- SkString d(NULL, 0);
+ SkString d(nullptr, 0);
REPORTER_ASSERT(reporter, a.isEmpty());
REPORTER_ASSERT(reporter, a == b && a == c && a == d);
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 771fc9ea72..4efe985926 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -41,7 +41,7 @@ static void release_storage(void* pixels, void* context) {
static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context,
SkAlphaType at = kPremul_SkAlphaType,
- SkImageInfo* requestedInfo = NULL) {
+ SkImageInfo* requestedInfo = nullptr) {
const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
if (requestedInfo) {
@@ -58,11 +58,11 @@ static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context,
release_storage, storage);
}
case kGpu_SurfaceType:
- return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, NULL);
+ return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, nullptr);
case kGpuScratch_SurfaceType:
- return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, NULL);
+ return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, nullptr);
}
- return NULL;
+ return nullptr;
}
enum ImageType {
@@ -83,26 +83,26 @@ public:
static void test_empty_image(skiatest::Reporter* reporter) {
const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
- REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0));
- REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0));
- REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL, NULL));
- REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerator));
+ REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterCopy(info, nullptr, 0));
+ REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterData(info, nullptr, 0));
+ REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromRaster(info, nullptr, 0, nullptr, nullptr));
+ REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromGenerator(new EmptyGenerator));
}
static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) {
const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
- REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info));
- REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0));
+ REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRaster(info));
+ REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRasterDirect(info, nullptr, 0));
if (ctx) {
- REPORTER_ASSERT(reporter, NULL ==
- SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, NULL));
+ REPORTER_ASSERT(reporter, nullptr ==
+ SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, nullptr));
}
}
#if SK_SUPPORT_GPU
static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext* ctx) {
- if (NULL == ctx) {
+ if (nullptr == ctx) {
return;
}
@@ -130,7 +130,7 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
wrappedDesc.fTextureHandle = texID;
- SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, NULL));
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, nullptr));
REPORTER_ASSERT(reporter, surface);
if (surface) {
// Validate that we can draw to the canvas and that the original texture color is preserved
@@ -196,7 +196,7 @@ struct ReleaseDataContext {
ReleaseDataContext* state = (ReleaseDataContext*)context;
REPORTER_ASSERT(state->fReporter, state->fData);
state->fData->unref();
- state->fData = NULL;
+ state->fData = nullptr;
}
};
@@ -307,7 +307,7 @@ static SkImage* create_image(skiatest::Reporter* reporter,
}
}
SkASSERT(false);
- return NULL;
+ return nullptr;
}
static void set_pixels(SkPMColor pixels[], int count, SkPMColor color) {
@@ -425,10 +425,10 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
const SkColor color = SK_ColorRED;
const SkPMColor pmcolor = SkPreMultiplyColor(color);
- GrContext* ctx = NULL;
+ GrContext* ctx = nullptr;
#if SK_SUPPORT_GPU
ctx = factory->get(GrContextFactory::kNative_GLContextType);
- if (NULL == ctx) {
+ if (nullptr == ctx) {
return;
}
#endif
@@ -440,16 +440,16 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
SkImageInfo info;
size_t rowBytes;
- releaseCtx.fData = NULL;
+ releaseCtx.fData = nullptr;
SkAutoTUnref<SkImage> image(create_image(reporter, gRec[i].fType, ctx, color, &releaseCtx));
if (!image.get()) {
SkDebugf("failed to createImage[%d] %s\n", i, gRec[i].fName);
continue; // gpu may not be enabled
}
if (kRasterProc_ImageType == gRec[i].fType) {
- REPORTER_ASSERT(reporter, NULL != releaseCtx.fData); // we are tracking the data
+ REPORTER_ASSERT(reporter, nullptr != releaseCtx.fData); // we are tracking the data
} else {
- REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we ignored the context
+ REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we ignored the context
}
test_legacy_bitmap(reporter, image);
@@ -469,7 +469,7 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
test_image_readpixels(reporter, image, pmcolor);
}
- REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we released the data
+ REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we released the data
}
static void test_canvaspeek(skiatest::Reporter* reporter,
@@ -497,7 +497,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
#endif
for (int i= 0; i < cnt; ++i) {
- GrContext* context = NULL;
+ GrContext* context = nullptr;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
@@ -505,7 +505,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
}
context = factory->get(glCtxType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
#endif
@@ -534,7 +534,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, info2 == info);
REPORTER_ASSERT(reporter, rb2 == rowBytes);
} else {
- REPORTER_ASSERT(reporter, NULL == addr2);
+ REPORTER_ASSERT(reporter, nullptr == addr2);
}
}
}
@@ -565,7 +565,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
#endif
for (int i= 0; i < cnt; ++i) {
- GrContext* context = NULL;
+ GrContext* context = nullptr;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
@@ -573,7 +573,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
}
context = factory->get(glCtxType);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
#endif
@@ -598,10 +598,10 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
}
static void test_snap_alphatype(skiatest::Reporter* reporter, GrContextFactory* factory) {
- GrContext* context = NULL;
+ GrContext* context = nullptr;
#if SK_SUPPORT_GPU
context = factory->get(GrContextFactory::kNative_GLContextType);
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
#endif
@@ -706,12 +706,12 @@ static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType sur
EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint))
EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0))
EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr))
- EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, NULL))
- EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, NULL))
+ EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr))
+ EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, nullptr))
EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testPaint))
EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoints2, \
testPaint))
- EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, NULL, \
+ EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, nullptr, \
testPaint))
const SkSurface::BackendHandleAccess accessModes[] = {
@@ -796,7 +796,7 @@ static void TestGetTexture(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, texture);
REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle());
} else {
- REPORTER_ASSERT(reporter, NULL == texture);
+ REPORTER_ASSERT(reporter, nullptr == texture);
}
surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
REPORTER_ASSERT(reporter, as_IB(image)->getTexture() == texture);
@@ -883,13 +883,13 @@ static void TestSurfaceNoCanvas(skiatest::Reporter* reporter,
DEF_GPUTEST(Surface, reporter, factory) {
test_image(reporter);
- TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
- TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL);
- TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard_ContentChangeMode);
- TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ContentChangeMode);
+ TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, nullptr);
+ TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, nullptr);
+ TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kDiscard_ContentChangeMode);
+ TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kRetain_ContentChangeMode);
test_empty_image(reporter);
- test_empty_surface(reporter, NULL);
+ test_empty_surface(reporter, nullptr);
test_imagepeek(reporter, factory);
test_canvaspeek(reporter, factory);
@@ -899,7 +899,7 @@ DEF_GPUTEST(Surface, reporter, factory) {
test_snap_alphatype(reporter, factory);
#if SK_SUPPORT_GPU
- TestGetTexture(reporter, kRaster_SurfaceType, NULL);
+ TestGetTexture(reporter, kRaster_SurfaceType, nullptr);
if (factory) {
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
@@ -1005,7 +1005,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) {
ReleaseTextureContext releaseCtx(reporter);
SkAutoTUnref<SkImage> refImg(make_desc_image(ctx, w, h, srcTex, &releaseCtx));
- SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, NULL));
+ SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, nullptr));
test_image_color(reporter, refImg, expected0);
test_image_color(reporter, cpyImg, expected0);
@@ -1025,7 +1025,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) {
// Now exercise the release proc
REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased);
- refImg.reset(NULL); // force a release of the image
+ refImg.reset(nullptr); // force a release of the image
REPORTER_ASSERT(reporter, releaseCtx.fIsReleased);
}
#endif
diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp
index c2ae07c4c8..6f0dabeb11 100644
--- a/tests/SwizzlerTest.cpp
+++ b/tests/SwizzlerTest.cpp
@@ -116,15 +116,15 @@ DEF_TEST(SwizzlerFill, r) {
// Fill with a color
check_fill(r, colorInfo, startRow, endRow, colorRowBytes, offset,
- kFillColor, NULL);
+ kFillColor, nullptr);
// Fill with an index
check_fill(r, indexInfo, startRow, endRow, indexRowBytes, offset,
- kFillIndex, NULL);
+ kFillIndex, nullptr);
// Fill a grayscale image
check_fill(r, grayInfo, startRow, endRow, grayRowBytes, offset,
- kFillColor, NULL);
+ kFillColor, nullptr);
}
}
}
diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp
index 53bb5fe842..c398c6c019 100644
--- a/tests/TLSTest.cpp
+++ b/tests/TLSTest.cpp
@@ -56,7 +56,7 @@ static int32_t gCounter;
static void* FakeCreateTLS() {
sk_atomic_inc(&gCounter);
- return NULL;
+ return nullptr;
}
static void FakeDeleteTLS(void*) {
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index dbfd825038..c2bbf889bc 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -252,7 +252,7 @@ static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, GrResourceProvider*
DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
- if (NULL == context) {
+ if (nullptr == context) {
return;
}
GrSurfaceDesc desc;
diff --git a/tests/Test.cpp b/tests/Test.cpp
index c8c40cdfa4..f6f2bdab3d 100644
--- a/tests/Test.cpp
+++ b/tests/Test.cpp
@@ -12,7 +12,7 @@
#include "SkString.h"
#include "SkTime.h"
-DEFINE_string2(tmpDir, t, NULL, "Temp directory to use.");
+DEFINE_string2(tmpDir, t, nullptr, "Temp directory to use.");
void skiatest::Reporter::bumpTestCount() {}
@@ -33,6 +33,6 @@ SkString skiatest::Failure::toString() const {
}
SkString skiatest::GetTmpDir() {
- const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0];
+ const char* tmpDir = FLAGS_tmpDir.isEmpty() ? nullptr : FLAGS_tmpDir[0];
return SkString(tmpDir);
}
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index cf2a2390b9..3a548c7835 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -100,7 +100,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContextFactory
SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
for (int j = 0; j < set->count(); ++j) {
SkFontStyle fs;
- set->getStyle(j, &fs, NULL);
+ set->getStyle(j, &fs, nullptr);
// We use a typeface which randomy returns unexpected mask formats to fuzz
SkAutoTUnref<SkTypeface> orig(set->createTypeface(j));
@@ -124,7 +124,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContextFactory
const SkTextBlobBuilder::RunBuffer& run = builder.allocRun(paint,
maxTotalText,
0, 0,
- NULL);
+ nullptr);
memcpy(run.glyphs, text.get(), maxTotalText * sizeof(uint16_t));
}
}
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index 5d08b0147d..ec748e7744 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -20,7 +20,7 @@ public:
SkTextBlobBuilder builder;
// empty run set
- RunBuilderTest(reporter, builder, NULL, 0, NULL, 0);
+ RunBuilderTest(reporter, builder, nullptr, 0, nullptr, 0);
RunDef set1[] = {
{ 128, SkTextBlob::kDefault_Positioning, 100, 100 },
@@ -206,7 +206,7 @@ private:
static void AddRun(const SkPaint& font, int count, SkTextBlob::GlyphPositioning pos,
const SkPoint& offset, SkTextBlobBuilder& builder,
- const SkRect* bounds = NULL) {
+ const SkRect* bounds = nullptr) {
switch (pos) {
case SkTextBlob::kDefault_Positioning: {
const SkTextBlobBuilder::RunBuffer& rb = builder.allocRun(font, count, offset.x(),
diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp
index ca8da28858..d2e6db209b 100644
--- a/tests/TextureCompressionTest.cpp
+++ b/tests/TextureCompressionTest.cpp
@@ -63,7 +63,7 @@ DEF_TEST(CompressAlphaFailDimensions, reporter) {
continue;
}
SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt));
- REPORTER_ASSERT(reporter, NULL == data);
+ REPORTER_ASSERT(reporter, nullptr == data);
}
}
@@ -92,7 +92,7 @@ DEF_TEST(CompressAlphaFailColorType, reporter) {
continue;
}
SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt));
- REPORTER_ASSERT(reporter, NULL == data);
+ REPORTER_ASSERT(reporter, nullptr == data);
}
}
@@ -120,7 +120,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
{
uint8_t* pixels = reinterpret_cast<uint8_t*>(pixmap.writable_addr());
REPORTER_ASSERT(reporter, pixels);
- if (NULL == pixels) {
+ if (nullptr == pixels) {
return;
}
@@ -139,7 +139,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
SkAutoMalloc decompMemory(kWidth*kHeight);
uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get());
REPORTER_ASSERT(reporter, decompBuffer);
- if (NULL == decompBuffer) {
+ if (nullptr == decompBuffer) {
return;
}
@@ -154,7 +154,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
SkAutoDataUnref data(SkTextureCompressor::CompressBitmapToFormat(pixmap, fmt));
REPORTER_ASSERT(reporter, data);
- if (NULL == data) {
+ if (nullptr == data) {
continue;
}
@@ -167,7 +167,7 @@ DEF_TEST(CompressCheckerboard, reporter) {
const uint8_t* pixels = reinterpret_cast<const uint8_t*>(pixmap.addr());
REPORTER_ASSERT(reporter, pixels);
- if (NULL == pixels) {
+ if (nullptr == pixels) {
continue;
}
@@ -213,7 +213,7 @@ DEF_TEST(CompressLATC, reporter) {
SkAutoDataUnref latcData(
SkTextureCompressor::CompressBitmapToFormat(pixmap, kLATCFormat));
REPORTER_ASSERT(reporter, latcData);
- if (NULL == latcData) {
+ if (nullptr == latcData) {
continue;
}
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index bb5d361bee..b3bc157eba 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -10,7 +10,7 @@
DEF_TEST(Typeface, reporter) {
- SkAutoTUnref<SkTypeface> t1(SkTypeface::CreateFromName(NULL, SkTypeface::kNormal));
+ SkAutoTUnref<SkTypeface> t1(SkTypeface::CreateFromName(nullptr, SkTypeface::kNormal));
SkAutoTUnref<SkTypeface> t2(SkTypeface::RefDefault(SkTypeface::kNormal));
REPORTER_ASSERT(reporter, SkTypeface::Equal(t1.get(), t2.get()));
@@ -21,6 +21,6 @@ DEF_TEST(Typeface, reporter) {
#ifdef SK_BUILD_FOR_ANDROID
SkAutoTUnref<SkTypeface> t3(SkTypeface::CreateFromName("non-existent-font", SkTypeface::kNormal));
- REPORTER_ASSERT(reporter, NULL == t3.get());
+ REPORTER_ASSERT(reporter, nullptr == t3.get());
#endif
}
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index 6db8104acc..4dad52b50c 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -35,8 +35,8 @@ static void test_autounref(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, &obj == tmp.detach());
REPORTER_ASSERT(reporter, obj.unique());
- REPORTER_ASSERT(reporter, NULL == tmp.detach());
- REPORTER_ASSERT(reporter, NULL == tmp.get());
+ REPORTER_ASSERT(reporter, nullptr == tmp.detach());
+ REPORTER_ASSERT(reporter, nullptr == tmp.get());
obj.ref();
REPORTER_ASSERT(reporter, !obj.unique());
diff --git a/tests/WArrayTest.cpp b/tests/WArrayTest.cpp
index 7f03e5bacd..48be952637 100644
--- a/tests/WArrayTest.cpp
+++ b/tests/WArrayTest.cpp
@@ -101,7 +101,7 @@ static const char* expectedSubset14 = "0[1] 5[2]";
static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>* data) {
SkString result;
bool leadingSpace = false;
- while (data != NULL) {
+ while (data != nullptr) {
if (leadingSpace) {
result.append(" ");
} else {
@@ -174,34 +174,34 @@ class TestWData {
};
DEF_TEST(WArray, reporter) {
- TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1);
- TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2);
- TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3);
- TestWData(reporter, data4, SK_ARRAY_COUNT(data4), NULL, 0, expected4);
- TestWData(reporter, data5, SK_ARRAY_COUNT(data5), NULL, 0, expected5);
- TestWData(reporter, data6, SK_ARRAY_COUNT(data6), NULL, 0, expected6);
- TestWData(reporter, data7, SK_ARRAY_COUNT(data7), NULL, 0, expected7);
+ TestWData(reporter, data1, SK_ARRAY_COUNT(data1), nullptr, 0, expected1);
+ TestWData(reporter, data2, SK_ARRAY_COUNT(data2), nullptr, 0, expected2);
+ TestWData(reporter, data3, SK_ARRAY_COUNT(data3), nullptr, 0, expected3);
+ TestWData(reporter, data4, SK_ARRAY_COUNT(data4), nullptr, 0, expected4);
+ TestWData(reporter, data5, SK_ARRAY_COUNT(data5), nullptr, 0, expected5);
+ TestWData(reporter, data6, SK_ARRAY_COUNT(data6), nullptr, 0, expected6);
+ TestWData(reporter, data7, SK_ARRAY_COUNT(data7), nullptr, 0, expected7);
TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7,
SK_ARRAY_COUNT(subset7), expectedSubset7);
- TestWData(reporter, data8, SK_ARRAY_COUNT(data8), NULL, 0, expected8);
+ TestWData(reporter, data8, SK_ARRAY_COUNT(data8), nullptr, 0, expected8);
TestWData(reporter, data8, SK_ARRAY_COUNT(data8), subset8,
SK_ARRAY_COUNT(subset8), expectedSubset8);
- TestWData(reporter, data9, SK_ARRAY_COUNT(data9), NULL, 0, expected9);
+ TestWData(reporter, data9, SK_ARRAY_COUNT(data9), nullptr, 0, expected9);
TestWData(reporter, data9, SK_ARRAY_COUNT(data9), subset9,
SK_ARRAY_COUNT(subset9), expectedSubset9);
- TestWData(reporter, data10, SK_ARRAY_COUNT(data10), NULL, 0, expected10);
+ TestWData(reporter, data10, SK_ARRAY_COUNT(data10), nullptr, 0, expected10);
TestWData(reporter, data10, SK_ARRAY_COUNT(data10), subset10,
SK_ARRAY_COUNT(subset10), expectedSubset10);
- TestWData(reporter, data11, SK_ARRAY_COUNT(data11), NULL, 0, expected11);
+ TestWData(reporter, data11, SK_ARRAY_COUNT(data11), nullptr, 0, expected11);
TestWData(reporter, data11, SK_ARRAY_COUNT(data11), subset11,
SK_ARRAY_COUNT(subset11), expectedSubset11);
- TestWData(reporter, data12, SK_ARRAY_COUNT(data12), NULL, 0, expected12);
+ TestWData(reporter, data12, SK_ARRAY_COUNT(data12), nullptr, 0, expected12);
TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12,
SK_ARRAY_COUNT(subset12), expectedSubset12);
- TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13);
+ TestWData(reporter, data13, SK_ARRAY_COUNT(data13), nullptr, 0, expected13);
TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13,
SK_ARRAY_COUNT(subset13), expectedSubset13);
- TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14);
+ TestWData(reporter, data14, SK_ARRAY_COUNT(data14), nullptr, 0, expected14);
TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14,
SK_ARRAY_COUNT(subset14), expectedSubset14);
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index a06130e36b..c4010b7119 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -200,7 +200,7 @@ static bool check_write(skiatest::Reporter* reporter, SkCanvas* canvas, const Sk
canvasRowBytes = secretDevBitmap.rowBytes();
canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels());
- if (NULL == canvasPixels) {
+ if (nullptr == canvasPixels) {
return false;
}
@@ -286,7 +286,7 @@ static bool alloc_row_bytes(SkBitmap* bm, const SkImageInfo& info, size_t rowByt
if (!bm->setInfo(info, rowBytes)) {
return false;
}
- SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, NULL);
+ SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr);
bm->setPixelRef(pr)->unref();
return true;
}
@@ -306,7 +306,7 @@ static SkSurface* create_surface(const CanvasConfig& c, GrContext* grCtx) {
if (!c.fTightRowBytes) {
memset(pixels, DEV_PAD, size);
}
- return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes, free_pixels, NULL);
+ return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes, free_pixels, nullptr);
}
#if SK_SUPPORT_GPU
case kGpu_BottomLeft_DevType:
@@ -322,7 +322,7 @@ static SkSurface* create_surface(const CanvasConfig& c, GrContext* grCtx) {
return SkSurface::NewRenderTargetDirect(texture->asRenderTarget());
#endif
}
- return NULL;
+ return nullptr;
}
static bool setup_bitmap(SkBitmap* bm, SkColorType ct, SkAlphaType at, int w, int h, int tightRB) {
@@ -417,7 +417,7 @@ DEF_GPUTEST(WritePixels, reporter, factory) {
}
#endif
for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) {
- GrContext* context = NULL;
+ GrContext* context = nullptr;
#if SK_SUPPORT_GPU
if (isGPUDevice) {
GrContextFactory::GLContextType type =
@@ -426,7 +426,7 @@ DEF_GPUTEST(WritePixels, reporter, factory) {
continue;
}
context = factory->get(type);
- if (NULL == context) {
+ if (nullptr == context) {
continue;
}
}
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index d1366082ae..5849d731ef 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -31,8 +31,8 @@ static void test_string_null(skiatest::Reporter* reporter) {
uint8_t storage[8];
SkWriter32 writer(storage, sizeof(storage));
- // Can we write NULL?
- writer.writeString(NULL);
+ // Can we write nullptr?
+ writer.writeString(nullptr);
const int32_t expected[] = { 0x0, 0x0 };
check_contents(reporter, writer, expected, sizeof(expected));
}
@@ -241,7 +241,7 @@ DEF_TEST(Writer32_contiguous, reporter) {
writer.reset(storage, sizeof(storage));
// This write is small enough to fit in storage, so it's contiguous.
test1(reporter, &writer);
- REPORTER_ASSERT(reporter, writer.contiguousArray() != NULL);
+ REPORTER_ASSERT(reporter, writer.contiguousArray() != nullptr);
// Everything other aspect of contiguous/non-contiguous is an
// implementation detail, not part of the public contract for
diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp
index 34f5233fcf..294d63db59 100644
--- a/tests/XfermodeTest.cpp
+++ b/tests/XfermodeTest.cpp
@@ -35,7 +35,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
}
static void test_IsMode(skiatest::Reporter* reporter) {
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(NULL,
+ REPORTER_ASSERT(reporter, SkXfermode::IsMode(nullptr,
SkXfermode::kSrcOver_Mode));
for (int i = 0; i <= SkXfermode::kLastMode; ++i) {
@@ -46,7 +46,7 @@ static void test_IsMode(skiatest::Reporter* reporter) {
SkSafeUnref(xfer);
if (SkXfermode::kSrcOver_Mode != mode) {
- REPORTER_ASSERT(reporter, !SkXfermode::IsMode(NULL, mode));
+ REPORTER_ASSERT(reporter, !SkXfermode::IsMode(nullptr, mode));
}
}
}
diff --git a/tests/YUVCacheTest.cpp b/tests/YUVCacheTest.cpp
index f5b5897334..f3a09f116b 100644
--- a/tests/YUVCacheTest.cpp
+++ b/tests/YUVCacheTest.cpp
@@ -24,7 +24,7 @@ static void check_data(skiatest::Reporter* reporter, SkCachedData* data,
int refcnt, CachedState cacheState, LockedState lockedState) {
REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt);
REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cacheState));
- bool isLocked = (data->data() != NULL);
+ bool isLocked = (data->data() != nullptr);
REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked));
}
@@ -43,7 +43,7 @@ DEF_TEST(YUVPlanesCache, reporter) {
const uint32_t genID = 12345678;
SkCachedData* data = SkYUVPlanesCache::FindAndRef(genID, &yuvInfo, &cache);
- REPORTER_ASSERT(reporter, NULL == data);
+ REPORTER_ASSERT(reporter, nullptr == data);
size_t size = 256;
data = cache.newCachedData(size);
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index fbd35d081b..dc5ae97c3f 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -76,7 +76,7 @@ class SkTestRunnable : public SkRunnable {
public:
SkTestRunnable(const Test& test,
Status* status,
- GrContextFactory* grContextFactory = NULL)
+ GrContextFactory* grContextFactory = nullptr)
: fTest(test), fStatus(status), fGrContextFactory(grContextFactory) {}
virtual void run() {
@@ -193,7 +193,7 @@ int test_main() {
}
}
- GrContextFactory* grContextFactoryPtr = NULL;
+ GrContextFactory* grContextFactoryPtr = nullptr;
#if SK_SUPPORT_GPU
// Give GPU tests a context factory if that makes sense on this machine.
GrContextFactory grContextFactory;
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp
index bc1e32ec11..f5ffb25d03 100644
--- a/tools/CopyTilesRenderer.cpp
+++ b/tools/CopyTilesRenderer.cpp
@@ -32,7 +32,7 @@ namespace sk_tools {
bool useChecksumBasedFilenames, bool useMultiPictureDraw) {
// Do not call INHERITED::init(), which would create a (potentially large) canvas which is
// not used by bench_pictures.
- SkASSERT(pict != NULL);
+ SkASSERT(pict != nullptr);
// Only work with absolute widths (as opposed to percentages).
SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0);
fPicture.reset(pict)->ref();
diff --git a/tools/CrashHandler.cpp b/tools/CrashHandler.cpp
index e26772b4ba..6707b65de4 100644
--- a/tools/CrashHandler.cpp
+++ b/tools/CrashHandler.cpp
@@ -150,10 +150,10 @@
GetCurrentThread(),
&frame,
c,
- NULL,
+ nullptr,
SymFunctionTableAccess64,
SymGetModuleBase64,
- NULL)) {
+ nullptr)) {
// Buffer to store symbol name in.
static const int kMaxNameLength = 1024;
uint8_t buffer[sizeof(IMAGEHLP_SYMBOL64) + kMaxNameLength];
diff --git a/tools/DumpRecord.cpp b/tools/DumpRecord.cpp
index 3c34231e18..667c9ef506 100644
--- a/tools/DumpRecord.cpp
+++ b/tools/DumpRecord.cpp
@@ -21,7 +21,7 @@ public:
: fDigits(0)
, fIndent(0)
, fIndex(0)
- , fDraw(canvas, NULL, NULL, 0, NULL)
+ , fDraw(canvas, nullptr, nullptr, 0, nullptr)
, fTimeWithCommand(timeWithCommand) {
while (count > 0) {
count /= 10;
diff --git a/tools/LazyDecodeBitmap.cpp b/tools/LazyDecodeBitmap.cpp
index bcd8cad44d..b6ac2d5566 100644
--- a/tools/LazyDecodeBitmap.cpp
+++ b/tools/LazyDecodeBitmap.cpp
@@ -24,21 +24,21 @@ DEFINE_bool(useVolatileCache, false, "Use a volatile cache for deferred image de
// Used in SkPictureData::CreateFromStream
bool sk_tools::LazyDecodeBitmap(const void* src, size_t length, SkBitmap* dst) {
SkAutoDataUnref data(SkData::NewWithCopy(src, length));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
return false;
}
SkAutoTDelete<SkImageGenerator> gen(SkImageGenerator::NewFromEncoded(data));
- if (NULL == gen.get()) {
+ if (nullptr == gen.get()) {
return false;
}
const SkImageInfo info = gen->getInfo();
- SkDiscardableMemory::Factory* pool = NULL;
+ SkDiscardableMemory::Factory* pool = nullptr;
if ((!FLAGS_useVolatileCache) || (info.width() * info.height() < 32 * 1024)) {
// how to do switching with SkDiscardableMemory.
pool = SkGetGlobalDiscardableMemoryPool();
// Only meaningful if platform has a default discardable
// memory implementation that differs from the global DM pool.
}
- return SkInstallDiscardablePixelRef(gen.detach(), NULL, dst, pool);
+ return SkInstallDiscardablePixelRef(gen.detach(), nullptr, dst, pool);
}
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index 9a86d85f9b..84528e5744 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -16,12 +16,12 @@ namespace sk_tools {
PictureBenchmark::PictureBenchmark()
: fRepeats(1)
- , fRenderer(NULL)
+ , fRenderer(nullptr)
, fTimerResult(TimerData::kAvg_Result)
, fTimerTypes(0)
, fTimeIndividualTiles(false)
, fPurgeDecodedTex(false)
- , fWriter(NULL) {
+ , fWriter(nullptr) {
}
PictureBenchmark::~PictureBenchmark() {
@@ -43,11 +43,11 @@ void PictureBenchmark::setTimersToShow(bool wall,
Timer* PictureBenchmark::setupTimer(bool useGLTimer) {
#if SK_SUPPORT_GPU
- if (useGLTimer && fRenderer != NULL && fRenderer->isUsingGpuDevice()) {
+ if (useGLTimer && fRenderer != nullptr && fRenderer->isUsingGpuDevice()) {
return new Timer(fRenderer->getGLContext());
}
#endif
- return new Timer(NULL);
+ return new Timer(nullptr);
}
PictureRenderer* PictureBenchmark::setRenderer(sk_tools::PictureRenderer* renderer) {
@@ -57,21 +57,21 @@ PictureRenderer* PictureBenchmark::setRenderer(sk_tools::PictureRenderer* render
void PictureBenchmark::run(SkPicture* pict, bool useMultiPictureDraw) {
SkASSERT(pict);
- if (NULL == pict) {
+ if (nullptr == pict) {
return;
}
- SkASSERT(fRenderer != NULL);
- if (NULL == fRenderer) {
+ SkASSERT(fRenderer != nullptr);
+ if (nullptr == fRenderer) {
return;
}
- fRenderer->init(pict, NULL, NULL, NULL, false, useMultiPictureDraw);
+ fRenderer->init(pict, nullptr, nullptr, nullptr, false, useMultiPictureDraw);
// We throw this away to remove first time effects (such as paging in this program)
fRenderer->setup();
- fRenderer->render(NULL);
+ fRenderer->render(nullptr);
fRenderer->resetState(true); // flush, swapBuffers and Finish
if (fPurgeDecodedTex) {
@@ -109,7 +109,7 @@ void PictureBenchmark::run(SkPicture* pict, bool useMultiPictureDraw) {
if (fTimeIndividualTiles) {
TiledPictureRenderer* tiledRenderer = fRenderer->getTiledRenderer();
SkASSERT(tiledRenderer && tiledRenderer->supportsTimingIndividualTiles());
- if (NULL == tiledRenderer || !tiledRenderer->supportsTimingIndividualTiles()) {
+ if (nullptr == tiledRenderer || !tiledRenderer->supportsTimingIndividualTiles()) {
return;
}
int xTiles, yTiles;
@@ -200,7 +200,7 @@ void PictureBenchmark::run(SkPicture* pict, bool useMultiPictureDraw) {
fRenderer->setup();
perRunTimer->start();
- fRenderer->render(NULL);
+ fRenderer->render(nullptr);
perRunTimer->truncatedEnd();
fRenderer->resetState(false); // flush & swapBuffers, but don't Finish
perRunTimer->end();
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index ee8e981a39..700d3d3982 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -65,14 +65,14 @@ void PictureRenderer::init(const SkPicture* pict,
fUseChecksumBasedFilenames = useChecksumBasedFilenames;
fUseMultiPictureDraw = useMultiPictureDraw;
- SkASSERT(NULL == fPicture);
- SkASSERT(NULL == fCanvas.get());
+ SkASSERT(nullptr == fPicture);
+ SkASSERT(nullptr == fCanvas.get());
if (fPicture || fCanvas.get()) {
return;
}
- SkASSERT(pict != NULL);
- if (NULL == pict) {
+ SkASSERT(pict != nullptr);
+ if (nullptr == pict) {
return;
}
@@ -102,7 +102,7 @@ protected:
if (PictureRenderer::kMaskFilter_DrawFilterFlag & fFlags[t]) {
SkMaskFilter* maskFilter = paint->getMaskFilter();
if (maskFilter) {
- paint->setMaskFilter(NULL);
+ paint->setMaskFilter(nullptr);
}
}
if (PictureRenderer::kHinting_DrawFilterFlag & fFlags[t]) {
@@ -154,7 +154,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
desc.fWidth = width;
desc.fHeight = height;
desc.fSampleCnt = fSampleCount;
- target.reset(fGrContext->textureProvider()->createTexture(desc, false, NULL, 0));
+ target.reset(fGrContext->textureProvider()->createTexture(desc, false, nullptr, 0));
}
uint32_t flags = fUseDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
@@ -163,7 +163,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
SkGpuDevice::Create(target->asRenderTarget(), &props,
SkGpuDevice::kUninit_InitContents));
if (!device) {
- return NULL;
+ return nullptr;
}
canvas.reset(new SkCanvas(device));
break;
@@ -171,7 +171,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
#endif
default:
SkASSERT(0);
- return NULL;
+ return nullptr;
}
if (fHasDrawFilters) {
@@ -192,7 +192,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
}
void PictureRenderer::scaleToScaleFactor(SkCanvas* canvas) {
- SkASSERT(canvas != NULL);
+ SkASSERT(canvas != nullptr);
if (fScaleFactor != SK_Scalar1) {
canvas->scale(fScaleFactor, fScaleFactor);
}
@@ -200,12 +200,12 @@ void PictureRenderer::scaleToScaleFactor(SkCanvas* canvas) {
void PictureRenderer::end() {
this->resetState(true);
- fPicture.reset(NULL);
- fCanvas.reset(NULL);
+ fPicture.reset(nullptr);
+ fCanvas.reset(nullptr);
}
int PictureRenderer::getViewWidth() {
- SkASSERT(fPicture != NULL);
+ SkASSERT(fPicture != nullptr);
int width = SkScalarCeilToInt(fPicture->cullRect().width() * fScaleFactor);
if (fViewport.width() > 0) {
width = SkMin32(width, fViewport.width());
@@ -214,7 +214,7 @@ int PictureRenderer::getViewWidth() {
}
int PictureRenderer::getViewHeight() {
- SkASSERT(fPicture != NULL);
+ SkASSERT(fPicture != nullptr);
int height = SkScalarCeilToInt(fPicture->cullRect().height() * fScaleFactor);
if (fViewport.height() > 0) {
height = SkMin32(height, fViewport.height());
@@ -247,7 +247,7 @@ void PictureRenderer::buildBBoxHierarchy() {
void PictureRenderer::resetState(bool callFinish) {
#if SK_SUPPORT_GPU
SkGLContext* glContext = this->getGLContext();
- if (NULL == glContext) {
+ if (nullptr == glContext) {
SkASSERT(kBitmap_DeviceType == fDeviceType);
return;
}
@@ -267,7 +267,7 @@ void PictureRenderer::purgeTextures() {
#if SK_SUPPORT_GPU
SkGLContext* glContext = this->getGLContext();
- if (NULL == glContext) {
+ if (nullptr == glContext) {
SkASSERT(kBitmap_DeviceType == fDeviceType);
return;
}
@@ -295,9 +295,9 @@ void PictureRenderer::purgeTextures() {
*/
static bool write(SkCanvas* canvas, const SkString& writePath, const SkString& mismatchPath,
const SkString& inputFilename, ImageResultsAndExpectations *jsonSummaryPtr,
- bool useChecksumBasedFilenames, const int* tileNumberPtr=NULL) {
- SkASSERT(canvas != NULL);
- if (NULL == canvas) {
+ bool useChecksumBasedFilenames, const int* tileNumberPtr=nullptr) {
+ SkASSERT(canvas != nullptr);
+ if (nullptr == canvas) {
return false;
}
@@ -315,7 +315,7 @@ static bool write(SkCanvas* canvas, const SkString& writePath, const SkString& m
// TODO(epoger): what about including the config type within outputFilename? That way,
// we could combine results of different config types without conflicting filenames.
SkString outputFilename;
- const char *outputSubdirPtr = NULL;
+ const char *outputSubdirPtr = nullptr;
if (useChecksumBasedFilenames) {
ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
outputSubdirPtr = escapedInputFilename.c_str();
@@ -364,7 +364,7 @@ static bool write(SkCanvas* canvas, const SkString& writePath, const SkString& m
SkCanvas* RecordPictureRenderer::setupCanvas(int width, int height) {
// defer the canvas setup until the render step
- return NULL;
+ return nullptr;
}
bool RecordPictureRenderer::render(SkBitmap** out) {
@@ -395,9 +395,9 @@ SkString RecordPictureRenderer::getConfigNameInternal() {
///////////////////////////////////////////////////////////////////////////////////////////////
bool PipePictureRenderer::render(SkBitmap** out) {
- SkASSERT(fCanvas.get() != NULL);
- SkASSERT(fPicture != NULL);
- if (NULL == fCanvas.get() || NULL == fPicture) {
+ SkASSERT(fCanvas.get() != nullptr);
+ SkASSERT(fPicture != nullptr);
+ if (nullptr == fCanvas.get() || nullptr == fPicture) {
return false;
}
@@ -436,9 +436,9 @@ void SimplePictureRenderer::init(const SkPicture* picture, const SkString* write
}
bool SimplePictureRenderer::render(SkBitmap** out) {
- SkASSERT(fCanvas.get() != NULL);
+ SkASSERT(fCanvas.get() != nullptr);
SkASSERT(fPicture);
- if (NULL == fCanvas.get() || NULL == fPicture) {
+ if (nullptr == fCanvas.get() || nullptr == fPicture) {
return false;
}
@@ -493,7 +493,7 @@ void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath
bool useChecksumBasedFilenames, bool useMultiPictureDraw) {
SkASSERT(pict);
SkASSERT(0 == fTileRects.count());
- if (NULL == pict || fTileRects.count() != 0) {
+ if (nullptr == pict || fTileRects.count() != 0) {
return;
}
@@ -550,7 +550,7 @@ void TiledPictureRenderer::setupTiles() {
}
bool TiledPictureRenderer::tileDimensions(int &x, int &y) {
- if (fTileRects.count() == 0 || NULL == fPicture) {
+ if (fTileRects.count() == 0 || nullptr == fPicture) {
return false;
}
x = fTilesX;
@@ -687,8 +687,8 @@ bool TiledPictureRenderer::postRender(SkCanvas* canvas, const SkIRect& tileRect,
}
bool TiledPictureRenderer::render(SkBitmap** out) {
- SkASSERT(fPicture != NULL);
- if (NULL == fPicture) {
+ SkASSERT(fPicture != nullptr);
+ if (nullptr == fPicture) {
return false;
}
@@ -819,12 +819,12 @@ SkString PlaybackCreationRenderer::getConfigNameInternal() {
SkBBHFactory* PictureRenderer::getFactory() {
switch (fBBoxHierarchyType) {
case kNone_BBoxHierarchyType:
- return NULL;
+ return nullptr;
case kRTree_BBoxHierarchyType:
return new SkRTreeFactory;
}
SkASSERT(0); // invalid bbhType
- return NULL;
+ return nullptr;
}
} // namespace sk_tools
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index a06604bc87..3139801910 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -83,9 +83,9 @@ public:
*
* @param pict The SkPicture to render.
* @param writePath The output directory within which this renderer should write all images,
- * or NULL if this renderer should not write all images.
+ * or nullptr if this renderer should not write all images.
* @param mismatchPath The output directory within which this renderer should write any images
- * which do not match expectations, or NULL if this renderer should not write mismatches.
+ * which do not match expectations, or nullptr if this renderer should not write mismatches.
* @param inputFilename The name of the input file we are rendering.
* @param useChecksumBasedFilenames Whether to use checksum-based filenames when writing
* bitmap images to disk.
@@ -138,7 +138,7 @@ public:
* @return bool True if rendering succeeded and, if fWritePath had been specified, the output
* was successfully written to a file.
*/
- virtual bool render(SkBitmap** out = NULL) = 0;
+ virtual bool render(SkBitmap** out = nullptr) = 0;
/**
* Called once finished with a particular SkPicture, before calling init again, and before
@@ -150,7 +150,7 @@ public:
* If this PictureRenderer is actually a TiledPictureRender, return a pointer to this as a
* TiledPictureRender so its methods can be called.
*/
- virtual TiledPictureRenderer* getTiledRenderer() { return NULL; }
+ virtual TiledPictureRenderer* getTiledRenderer() { return nullptr; }
/**
* Resets the GPU's state. Does nothing if the backing is raster. For a GPU renderer, calls
@@ -177,7 +177,7 @@ public:
#if SK_SUPPORT_GPU
// In case this function is called more than once
SkSafeUnref(fGrContext);
- fGrContext = NULL;
+ fGrContext = nullptr;
// Set to Native so it will have an initial value.
GrContextFactory::GLContextType glContextType = GrContextFactory::kNative_GLContextType;
#endif
@@ -208,7 +208,7 @@ public:
}
#if SK_SUPPORT_GPU
fGrContext = fGrContextFactory.get(glContextType, gpuAPI);
- if (NULL == fGrContext) {
+ if (nullptr == fGrContext) {
return false;
} else {
fGrContext->ref();
@@ -390,7 +390,7 @@ public:
break;
#endif
default:
- return NULL;
+ return nullptr;
}
return fGrContextFactory.getGLContext(glContextType);
}
@@ -417,7 +417,7 @@ public:
#else
PictureRenderer()
#endif
- : fJsonSummaryPtr(NULL)
+ : fJsonSummaryPtr(nullptr)
, fDeviceType(kBitmap_DeviceType)
, fEnableWrites(false)
, fBBoxHierarchyType(kNone_BBoxHierarchyType)
@@ -425,7 +425,7 @@ public:
, fScaleFactor(SK_Scalar1)
#if SK_SUPPORT_GPU
, fGrContextFactory(opts)
- , fGrContext(NULL)
+ , fGrContext(nullptr)
, fSampleCount(0)
, fUseDFText(false)
#endif
@@ -481,7 +481,7 @@ protected:
virtual SkCanvas* setupCanvas(int width, int height);
/**
- * Copy src to dest; if src==NULL, set dest to empty string.
+ * Copy src to dest; if src==nullptr, set dest to empty string.
*/
static void CopyString(SkString* dest, const SkString* src);
@@ -510,7 +510,7 @@ public:
RecordPictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
#endif
- bool render(SkBitmap** out = NULL) override;
+ bool render(SkBitmap** out = nullptr) override;
SkString getPerIterTimeFormat() override { return SkString("%.4f"); }
@@ -531,7 +531,7 @@ public:
PipePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
#endif
- bool render(SkBitmap** out = NULL) override;
+ bool render(SkBitmap** out = nullptr) override;
private:
SkString getConfigNameInternal() override;
@@ -552,7 +552,7 @@ public:
bool useChecksumBasedFilenames,
bool useMultiPictureDraw) override;
- bool render(SkBitmap** out = NULL) override;
+ bool render(SkBitmap** out = nullptr) override;
private:
SkString getConfigNameInternal() override;
@@ -580,7 +580,7 @@ public:
* If fWritePath was provided, a separate file is
* created for each tile, named "path0.png", "path1.png", etc.
*/
- bool render(SkBitmap** out = NULL) override;
+ bool render(SkBitmap** out = nullptr) override;
void end() override;
@@ -703,7 +703,7 @@ public:
void setup() override;
- bool render(SkBitmap** out = NULL) override;
+ bool render(SkBitmap** out = nullptr) override;
SkString getPerIterTimeFormat() override { return SkString("%.4f"); }
diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp
index 7a2fc259d7..b0456baa82 100644
--- a/tools/PictureRenderingFlags.cpp
+++ b/tools/PictureRenderingFlags.cpp
@@ -92,11 +92,11 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
error.reset();
bool useTiles = false;
- const char* widthString = NULL;
- const char* heightString = NULL;
+ const char* widthString = nullptr;
+ const char* heightString = nullptr;
bool isPowerOf2Mode = false;
bool isCopyMode = false;
- const char* mode = NULL;
+ const char* mode = nullptr;
#if SK_SUPPORT_GPU
GrContextOptions grContextOpts;
@@ -123,13 +123,13 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
if (FLAGS_mode.count() < 2) {
error.printf("Missing width for --mode %s\n", mode);
- return NULL;
+ return nullptr;
}
widthString = FLAGS_mode[1];
if (FLAGS_mode.count() < 3) {
error.printf("Missing height for --mode %s\n", mode);
- return NULL;
+ return nullptr;
}
heightString = FLAGS_mode[2];
@@ -144,12 +144,12 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
// be created below.
} else {
error.printf("%s is not a valid mode for --mode\n", mode);
- return NULL;
+ return nullptr;
}
}
if (useTiles) {
- SkASSERT(NULL == renderer);
+ SkASSERT(nullptr == renderer);
SkAutoTUnref<sk_tools::TiledPictureRenderer> tiledRenderer;
if (isCopyMode) {
int xTiles = -1;
@@ -157,7 +157,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
if (FLAGS_tiles.count() > 0) {
if (FLAGS_tiles.count() != 2) {
error.printf("--tiles requires an x value and a y value.\n");
- return NULL;
+ return nullptr;
}
xTiles = atoi(FLAGS_tiles[0]);
yTiles = atoi(FLAGS_tiles[1]);
@@ -169,7 +169,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
y = yTiles;
if (x <= 0 || y <= 0) {
error.printf("--tiles must be given values > 0\n");
- return NULL;
+ return nullptr;
}
} else {
x = y = 4;
@@ -189,43 +189,43 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
SkString err;
error.printf("-mode %s must be given a width"
" value that is a power of two\n", mode);
- return NULL;
+ return nullptr;
}
tiledRenderer->setTileMinPowerOf2Width(minWidth);
} else if (sk_tools::is_percentage(widthString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
- return NULL;
+ return nullptr;
}
tiledRenderer->setTileWidthPercentage(atof(widthString));
if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
error.printf("--mode %s must be given a width percentage > 0\n", mode);
- return NULL;
+ return nullptr;
}
} else {
tiledRenderer->setTileWidth(atoi(widthString));
if (!(tiledRenderer->getTileWidth() > 0)) {
error.printf("--mode %s must be given a width > 0\n", mode);
- return NULL;
+ return nullptr;
}
}
if (sk_tools::is_percentage(heightString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
- return NULL;
+ return nullptr;
}
tiledRenderer->setTileHeightPercentage(atof(heightString));
if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
error.printf("--mode %s must be given a height percentage > 0\n", mode);
- return NULL;
+ return nullptr;
}
} else {
tiledRenderer->setTileHeight(atoi(heightString));
if (!(tiledRenderer->getTileHeight() > 0)) {
SkString err;
error.printf("--mode %s must be given a height > 0\n", mode);
- return NULL;
+ return nullptr;
}
}
@@ -237,22 +237,22 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
} else { // useTiles
if (FLAGS_pipe) {
- if (renderer != NULL) {
+ if (renderer != nullptr) {
error.printf("Pipe is incompatible with other modes.\n");
- return NULL;
+ return nullptr;
}
renderer.reset(new sk_tools::PipePictureRenderer RENDERER_ARGS);
}
}
- if (NULL == renderer) {
+ if (nullptr == renderer) {
renderer.reset(new sk_tools::SimplePictureRenderer RENDERER_ARGS);
}
if (FLAGS_viewport.count() > 0) {
if (FLAGS_viewport.count() != 2) {
error.printf("--viewport requires a width and a height.\n");
- return NULL;
+ return nullptr;
}
SkISize viewport;
viewport.fWidth = atoi(FLAGS_viewport[0]);
@@ -271,11 +271,11 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
gpuAPI = kGLES_GrGLStandard;
} else {
error.printf("--gpuAPI invalid api value.\n");
- return NULL;
+ return nullptr;
}
} else if (FLAGS_gpuAPI.count() > 1) {
error.printf("--gpuAPI invalid api value.\n");
- return NULL;
+ return nullptr;
}
int sampleCount = 0;
@@ -322,7 +322,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
#endif
else {
error.printf("%s is not a valid mode for --config\n", FLAGS_config[0]);
- return NULL;
+ return nullptr;
}
#if SK_SUPPORT_GPU
if (!renderer->setDeviceType(deviceType, gpuAPI)) {
@@ -330,7 +330,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
if (!renderer->setDeviceType(deviceType)) {
#endif
error.printf("Could not create backend for --config %s\n", FLAGS_config[0]);
- return NULL;
+ return nullptr;
}
#if SK_SUPPORT_GPU
renderer->setSampleCount(sampleCount);
@@ -349,11 +349,11 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType;
} else {
error.printf("%s is not a valid value for --bbhType\n", type);
- return NULL;
+ return nullptr;
}
if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) {
error.printf("--pipe and --bbh cannot be used together\n");
- return NULL;
+ return nullptr;
}
}
renderer->setBBoxHierarchyType(bbhType);
diff --git a/tools/PictureRenderingFlags.h b/tools/PictureRenderingFlags.h
index 29215ac7e1..9f0ee79432 100644
--- a/tools/PictureRenderingFlags.h
+++ b/tools/PictureRenderingFlags.h
@@ -26,7 +26,7 @@ enum PictureTool {
* @param error If there is an error or warning, it will be stored in error.
* @param tool Which tool is being used.
* @return PictureRenderer A PictureRenderer with the settings specified
- * on the command line, or NULL if the command line is invalid.
+ * on the command line, or nullptr if the command line is invalid.
*/
sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool);
diff --git a/tools/PictureResultsWriter.h b/tools/PictureResultsWriter.h
index c9aaed0b35..8e606dceeb 100644
--- a/tools/PictureResultsWriter.h
+++ b/tools/PictureResultsWriter.h
@@ -104,7 +104,7 @@ private:
class PictureResultsLoggerWriter : public PictureResultsWriter {
private:
void logProgress(const char str[]) {
- if(fLogger != NULL) {
+ if(fLogger != nullptr) {
fLogger->logProgress(str);
}
}
diff --git a/tools/Resources.cpp b/tools/Resources.cpp
index 75625b40a6..a2a59029bc 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -44,14 +44,14 @@ SkStreamAsset* GetResourceAsStream(const char* resource) {
return stream.detach();
} else {
SkDebugf("Resource %s not found.\n", resource);
- return NULL;
+ return nullptr;
}
}
SkTypeface* GetResourceAsTypeface(const char* resource) {
SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource));
if (!stream) {
- return NULL;
+ return nullptr;
}
return SkTypeface::CreateFromStream(stream.detach());
}
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 0763d5cacc..ae3526bfea 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -56,7 +56,7 @@ VisualBench::VisualBench(void* hwnd, int argc, char** argv)
, fFlushes(1)
, fLoops(1)
, fState(kPreWarmLoops_State)
- , fBenchmark(NULL)
+ , fBenchmark(nullptr)
, fResults(new ResultsWriter) {
SkCommandLineFlags::Parse(argc, argv);
@@ -123,7 +123,7 @@ bool VisualBench::setupBackend() {
}
void VisualBench::resetContext() {
- fSurface.reset(NULL);
+ fSurface.reset(nullptr);
fInterface.reset(GrGLCreateNativeInterface());
SkASSERT(fInterface);
@@ -266,7 +266,7 @@ void VisualBench::draw(SkCanvas* canvas) {
}
// Invalidate the window to force a redraw. Poor man's animation mechanism.
- this->inval(NULL);
+ this->inval(nullptr);
}
inline double VisualBench::elapsed() {
@@ -311,7 +311,7 @@ void VisualBench::recordMeasurement() {
void VisualBench::postDraw(SkCanvas* canvas) {
fBenchmark->perCanvasPostDraw(canvas);
- fBenchmark.reset(NULL);
+ fBenchmark.reset(nullptr);
fCurrentSample = 0;
fFlushes = 1;
fLoops = 1;
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp
index f8d01a1d91..4cc819ded5 100644
--- a/tools/VisualBench/VisualBenchmarkStream.cpp
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp
@@ -13,7 +13,7 @@
#include "SkStream.h"
#include "VisualSKPBench.h"
-DEFINE_string2(match, m, NULL,
+DEFINE_string2(match, m, nullptr,
"[~][^]substring[$] [...] of bench name to run.\n"
"Multiple matches may be separated by spaces.\n"
"~ causes a matching bench to always be skipped\n"
@@ -27,8 +27,8 @@ DEFINE_string(skps, "skps", "Directory to read skps from.");
VisualBenchmarkStream::VisualBenchmarkStream()
: fBenches(BenchRegistry::Head())
, fGMs(skiagm::GMRegistry::Head())
- , fSourceType(NULL)
- , fBenchType(NULL)
+ , fSourceType(nullptr)
+ , fBenchType(nullptr)
, fCurrentSKP(0) {
for (int i = 0; i < FLAGS_skps.count(); i++) {
if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
@@ -51,13 +51,13 @@ bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture
}
SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path));
- if (stream.get() == NULL) {
+ if (stream.get() == nullptr) {
SkDebugf("Could not read %s.\n", path);
return false;
}
pic->reset(SkPicture::CreateFromStream(stream.get()));
- if (pic->get() == NULL) {
+ if (pic->get() == nullptr) {
SkDebugf("Could not read %s as an SkPicture.\n", path);
return false;
}
@@ -77,7 +77,7 @@ Benchmark* VisualBenchmarkStream::next() {
Benchmark* VisualBenchmarkStream::innerNext() {
while (fBenches) {
- Benchmark* bench = fBenches->factory()(NULL);
+ Benchmark* bench = fBenches->factory()(nullptr);
fBenches = fBenches->next();
if (bench->isVisual()) {
fSourceType = "bench";
@@ -88,7 +88,7 @@ Benchmark* VisualBenchmarkStream::innerNext() {
}
while (fGMs) {
- SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL));
+ SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr));
fGMs = fGMs->next();
if (gm->runAsBench()) {
fSourceType = "gm";
@@ -111,5 +111,5 @@ Benchmark* VisualBenchmarkStream::innerNext() {
return new VisualSKPBench(name.c_str(), pic.get());
}
- return NULL;
+ return nullptr;
}
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 865bb5184f..79cce56dca 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -195,7 +195,7 @@ static bool run_single_benchmark(const SkString& inputPath,
}
SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, proc));
- if (NULL == picture.get()) {
+ if (nullptr == picture.get()) {
SkString err;
err.printf("Could not read an SkPicture from %s\n", inputPath.c_str());
gLogger.logError(err);
@@ -337,13 +337,13 @@ static void setup_benchmark(sk_tools::PictureBenchmark* benchmark) {
gLogger.logError(errorString);
}
- if (NULL == renderer.get()) {
+ if (nullptr == renderer.get()) {
exit(-1);
}
if (FLAGS_timeIndividualTiles) {
sk_tools::TiledPictureRenderer* tiledRenderer = renderer->getTiledRenderer();
- if (NULL == tiledRenderer) {
+ if (nullptr == tiledRenderer) {
gLogger.logError("--timeIndividualTiles requires tiled rendering.\n");
exit(-1);
}
diff --git a/tools/chrome_fuzz.cpp b/tools/chrome_fuzz.cpp
index 94d276fb9b..f05c646351 100644
--- a/tools/chrome_fuzz.cpp
+++ b/tools/chrome_fuzz.cpp
@@ -34,7 +34,7 @@ static void run_test_case(const SkString& testdata, const SkBitmap& bitmap,
testdata.c_str(), testdata.size(), SkImageFilter::GetFlattenableType());
// Adding some info, but the test passed if we got here without any trouble
- if (flattenable != NULL) {
+ if (flattenable != nullptr) {
SkDebugf("Valid stream detected.\n");
// Let's see if using the filters can cause any trouble...
SkPaint paint;
diff --git a/tools/create_test_font.cpp b/tools/create_test_font.cpp
index 9193ba257e..1de08ac038 100644
--- a/tools/create_test_font.cpp
+++ b/tools/create_test_font.cpp
@@ -327,7 +327,7 @@ static int written_index(const FontDesc& fontDesc) {
}
static void generate_fonts() {
- FILE* out = NULL;
+ FILE* out = nullptr;
for (int index = 0; index < gFontsCount; ++index) {
FontDesc& fontDesc = gFonts[index];
if ((index & 3) == 0) {
@@ -391,7 +391,7 @@ static void generate_index(const char* defaultName) {
fprintf(out,
" { %sPoints, %sVerbs, %sCharCodes,\n"
" %sCharCodesCount, %sWidths,\n"
- " %sMetrics, \"Toy %s\", SkTypeface::k%s, NULL\n"
+ " %sMetrics, \"Toy %s\", SkTypeface::k%s, nullptr\n"
" },\n",
strip, strip, strip, strip, strip, strip, name, gStyleName[writ.fStyle]);
}
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index c1edb48adf..1ed9797396 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -32,14 +32,14 @@ static void usage() {
// Is the supplied paint simply a color?
static bool is_simple(const SkPaint& p) {
- return NULL == p.getPathEffect() &&
- NULL == p.getShader() &&
- NULL == p.getXfermode() &&
- NULL == p.getMaskFilter() &&
- NULL == p.getColorFilter() &&
- NULL == p.getRasterizer() &&
- NULL == p.getLooper() &&
- NULL == p.getImageFilter();
+ return nullptr == p.getPathEffect() &&
+ nullptr == p.getShader() &&
+ nullptr == p.getXfermode() &&
+ nullptr == p.getMaskFilter() &&
+ nullptr == p.getColorFilter() &&
+ nullptr == p.getRasterizer() &&
+ nullptr == p.getLooper() &&
+ nullptr == p.getImageFilter();
}
@@ -71,8 +71,8 @@ static bool check_0(SkDebugCanvas* canvas, int curCommand) {
SkColor dbmrColor = dbmrPaint->getColor() | 0xFF000000; // force opaque
// If either operation lacks a paint then the collapse is trivial
- return NULL == saveLayerPaint ||
- NULL == dbmrPaint ||
+ return nullptr == saveLayerPaint ||
+ nullptr == dbmrPaint ||
(is_simple(*saveLayerPaint) && dbmrColor == layerColor);
}
@@ -83,13 +83,13 @@ static void apply_0(SkDebugCanvas* canvas, int curCommand) {
(SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
const SkPaint* saveLayerPaint = saveLayer->paint();
- // if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
+ // if (nullptr == saveLayerPaint) the dbmr's paint doesn't need to be changed
if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkPaint* dbmrPaint = dbmr->paint();
- if (NULL == dbmrPaint) {
+ if (nullptr == dbmrPaint) {
// if the DBMR doesn't have a paint just use the saveLayer's
dbmr->setPaint(*saveLayerPaint);
} else if (saveLayerPaint) {
@@ -149,8 +149,8 @@ static bool check_1(SkDebugCanvas* canvas, int curCommand) {
// If either operation lacks a paint then the collapse is trivial
SkColor layerColor = saveLayerPaint->getColor() | 0xFF000000; // force opaque
- return NULL == saveLayerPaint ||
- NULL == dbmrPaint ||
+ return nullptr == saveLayerPaint ||
+ nullptr == dbmrPaint ||
(is_simple(*saveLayerPaint) && dbmrPaint->getColor() == layerColor);
}
@@ -161,13 +161,13 @@ static void apply_1(SkDebugCanvas* canvas, int curCommand) {
(SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
const SkPaint* saveLayerPaint = saveLayer->paint();
- // if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
+ // if (nullptr == saveLayerPaint) the dbmr's paint doesn't need to be changed
if (saveLayerPaint) {
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
SkPaint* dbmrPaint = dbmr->paint();
- if (NULL == dbmrPaint) {
+ if (nullptr == dbmrPaint) {
dbmr->setPaint(*saveLayerPaint);
} else {
SkColor newColor = SkColorSetA(dbmrPaint->getColor(),
@@ -367,7 +367,7 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
}
// The src->dest mapping needs to be 1-to-1
- if (NULL == dbmr->srcRect()) {
+ if (nullptr == dbmr->srcRect()) {
if (dbmr->bitmap().width() != dbmr->dstRect().width() ||
dbmr->bitmap().height() != dbmr->dstRect().height()) {
return false;
@@ -393,7 +393,7 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
SkPaint* dbmrPaint = dbmr->paint();
- if (NULL == dbmrPaint) {
+ if (nullptr == dbmrPaint) {
return true;
}
@@ -514,7 +514,7 @@ static bool check_8(SkDebugCanvas* canvas, int curCommand) {
}
// The src->dest mapping needs to be 1-to-1
- if (NULL == dbmr->srcRect()) {
+ if (nullptr == dbmr->srcRect()) {
if (dbmr->bitmap().width() != dbmr->dstRect().width() ||
dbmr->bitmap().height() != dbmr->dstRect().height()) {
return false;
@@ -629,7 +629,7 @@ static int filter_picture(const SkString& inFile, const SkString& outFile) {
inPicture.reset(SkPicture::CreateFromStream(&inStream));
}
- if (NULL == inPicture.get()) {
+ if (nullptr == inPicture.get()) {
SkDebugf("Could not read file %s\n", inFile.c_str());
return -1;
}
@@ -680,7 +680,7 @@ static int filter_picture(const SkString& inFile, const SkString& outFile) {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(inPicture->cullRect().width(),
inPicture->cullRect().height(),
- NULL, 0);
+ nullptr, 0);
debugCanvas.draw(canvas);
SkAutoTUnref<SkPicture> outPicture(recorder.endRecording());
diff --git a/tools/flags/SkCommandLineFlags.cpp b/tools/flags/SkCommandLineFlags.cpp
index 2ea45c2e71..fe3dfd193d 100644
--- a/tools/flags/SkCommandLineFlags.cpp
+++ b/tools/flags/SkCommandLineFlags.cpp
@@ -29,7 +29,7 @@ bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName,
void SkFlagInfo::SetDefaultStrings(SkCommandLineFlags::StringArray* pStrings,
const char* defaultValue) {
pStrings->reset();
- if (NULL == defaultValue) {
+ if (nullptr == defaultValue) {
return;
}
// If default is "", leave the array empty.
@@ -268,7 +268,7 @@ void SkCommandLineFlags::Parse(int argc, char** argv) {
if (!helpPrinted) {
bool flagMatched = false;
SkFlagInfo* flag = gHead;
- while (flag != NULL) {
+ while (flag != nullptr) {
if (flag->match(argv[i])) {
flagMatched = true;
switch (flag->getFlagType()) {
@@ -287,7 +287,7 @@ void SkCommandLineFlags::Parse(int argc, char** argv) {
flag->resetStrings();
// Add all arguments until another flag is reached.
while (i+1 < argc) {
- char* end = NULL;
+ char* end = nullptr;
// Negative numbers aren't flags.
ignore_result(strtod(argv[i+1], &end));
if (end == argv[i+1] && SkStrStartsWith(argv[i+1], '-')) {
@@ -331,8 +331,8 @@ void SkCommandLineFlags::Parse(int argc, char** argv) {
// Since all of the flags have been set, release the memory used by each
// flag. FLAGS_x can still be used after this.
SkFlagInfo* flag = gHead;
- gHead = NULL;
- while (flag != NULL) {
+ gHead = nullptr;
+ while (flag != nullptr) {
SkFlagInfo* next = flag->next();
delete flag;
flag = next;
diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h
index ae504cba81..bf8f1403d0 100644
--- a/tools/flags/SkCommandLineFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -181,7 +181,7 @@ private:
#define DEFINE_bool(name, defaultValue, helpString) \
bool FLAGS_##name; \
SK_UNUSED static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \
- NULL, \
+ nullptr, \
&FLAGS_##name, \
defaultValue, \
helpString)
@@ -201,7 +201,7 @@ SK_UNUSED static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name)
#define DEFINE_string(name, defaultValue, helpString) \
SkCommandLineFlags::StringArray FLAGS_##name; \
SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \
- NULL, \
+ nullptr, \
&FLAGS_##name, \
defaultValue, \
helpString)
@@ -283,7 +283,7 @@ public:
*/
static bool CreateIntFlag(const char* name, int32_t* pInt,
int32_t defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, NULL, kInt_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpString);
info->fIntValue = pInt;
*info->fIntValue = info->fDefaultInt = defaultValue;
return true;
@@ -294,7 +294,7 @@ public:
*/
static bool CreateDoubleFlag(const char* name, double* pDouble,
double defaultValue, const char* helpString) {
- SkFlagInfo* info = new SkFlagInfo(name, NULL, kDouble_FlagType, helpString);
+ SkFlagInfo* info = new SkFlagInfo(name, nullptr, kDouble_FlagType, helpString);
info->fDoubleValue = pDouble;
*info->fDoubleValue = info->fDefaultDouble = defaultValue;
return true;
@@ -407,17 +407,17 @@ private:
, fShortName(shortName)
, fFlagType(type)
, fHelpString(helpString)
- , fBoolValue(NULL)
+ , fBoolValue(nullptr)
, fDefaultBool(false)
- , fIntValue(NULL)
+ , fIntValue(nullptr)
, fDefaultInt(0)
- , fDoubleValue(NULL)
+ , fDoubleValue(nullptr)
, fDefaultDouble(0)
- , fStrings(NULL) {
+ , fStrings(nullptr) {
fNext = SkCommandLineFlags::gHead;
SkCommandLineFlags::gHead = this;
SkASSERT(name && strlen(name) > 1);
- SkASSERT(NULL == shortName || 1 == strlen(shortName));
+ SkASSERT(nullptr == shortName || 1 == strlen(shortName));
}
/**
diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp
index 7c7634f16d..9783dde373 100644
--- a/tools/flags/SkCommonFlags.cpp
+++ b/tools/flags/SkCommonFlags.cpp
@@ -26,7 +26,7 @@ DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" "
DEFINE_string(images, "", "Directory of images to decode.");
-DEFINE_string2(match, m, NULL,
+DEFINE_string2(match, m, nullptr,
"[~][^]substring[$] [...] of GM name to run.\n"
"Multiple matches may be separated by spaces.\n"
"~ causes a matching GM to always be skipped\n"
diff --git a/tools/gpuveto.cpp b/tools/gpuveto.cpp
index 4e9fdebd4b..204f44965b 100644
--- a/tools/gpuveto.cpp
+++ b/tools/gpuveto.cpp
@@ -45,7 +45,7 @@ int tool_main(int argc, char** argv) {
SkPicture::InstallPixelRefProc proc = &sk_tools::LazyDecodeBitmap;
SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, proc));
- if (NULL == picture.get()) {
+ if (nullptr == picture.get()) {
if (!FLAGS_quiet) {
SkDebugf("Could not read the SkPicture\n");
}
@@ -57,10 +57,10 @@ int tool_main(int argc, char** argv) {
SkPictureRecorder recorder;
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
- NULL, 0));
+ nullptr, 0));
SkAutoTUnref<SkPicture> recorded(recorder.endRecording());
- if (recorded->suitableForGpuRasterization(NULL)) {
+ if (recorded->suitableForGpuRasterization(nullptr)) {
SkDebugf("suitable\n");
} else {
SkDebugf("unsuitable\n");
diff --git a/tools/image_expectations.cpp b/tools/image_expectations.cpp
index 05a905dd58..cb0c03afc6 100644
--- a/tools/image_expectations.cpp
+++ b/tools/image_expectations.cpp
@@ -122,12 +122,12 @@ namespace sk_tools {
// ImageResultsAndExpectations class...
bool ImageResultsAndExpectations::readExpectationsFile(const char *jsonPath) {
- if (NULL == jsonPath) {
+ if (nullptr == jsonPath) {
SkDebugf("JSON expectations filename not specified\n");
return false;
}
SkFILE* filePtr = sk_fopen(jsonPath, kRead_SkFILE_Flag);
- if (NULL == filePtr) {
+ if (nullptr == filePtr) {
SkDebugf("JSON expectations file '%s' does not exist\n", jsonPath);
return false;
}
@@ -188,7 +188,7 @@ namespace sk_tools {
actualImage[kJsonKey_Image_ComparisonResult] = comparisonResult;
// Add this actual result to our collection.
- if (NULL == tileNumber) {
+ if (nullptr == tileNumber) {
fActualResults[sourceName][kJsonKey_Source_WholeImage] = actualImage;
} else {
fActualResults[sourceName][kJsonKey_Source_TiledImages][*tileNumber] = actualImage;
@@ -210,7 +210,7 @@ namespace sk_tools {
}
Json::Value expectedImage;
- if (NULL == tileNumber) {
+ if (nullptr == tileNumber) {
expectedImage = fExpectedResults[sourceName][kJsonKey_Source_WholeImage];
} else {
expectedImage = fExpectedResults[sourceName][kJsonKey_Source_TiledImages][*tileNumber];
@@ -242,7 +242,7 @@ namespace sk_tools {
/*static*/ bool ImageResultsAndExpectations::Parse(SkFILE *filePtr,
Json::Value *jsonRoot) {
SkAutoDataUnref dataRef(SkData::NewFromFILE(filePtr));
- if (NULL == dataRef.get()) {
+ if (nullptr == dataRef.get()) {
return false;
}
diff --git a/tools/image_expectations.h b/tools/image_expectations.h
index 422c64d4ed..a72d7a2c46 100644
--- a/tools/image_expectations.h
+++ b/tools/image_expectations.h
@@ -171,10 +171,10 @@ namespace sk_tools {
* @param sourceName name of the source file that generated this result
* @param fileName relative path to the image output file on local disk
* @param digest description of the image's contents
- * @param tileNumber if not NULL, pointer to tile number
+ * @param tileNumber if not nullptr, pointer to tile number
*/
void add(const char *sourceName, const char *fileName, ImageDigest &digest,
- const int *tileNumber=NULL);
+ const int *tileNumber=nullptr);
/**
* Adds a key/value pair to the descriptions dict within the summary of results.
@@ -195,12 +195,12 @@ namespace sk_tools {
* Returns the Expectation for this test.
*
* @param sourceName name of the source file that generated this result
- * @param tileNumber if not NULL, pointer to tile number
+ * @param tileNumber if not nullptr, pointer to tile number
*
* TODO(stephana): To make this work for GMs, we will need to add parameters for
* config, and maybe renderMode/builder?
*/
- Expectation getExpectation(const char *sourceName, const int *tileNumber=NULL);
+ Expectation getExpectation(const char *sourceName, const int *tileNumber=nullptr);
/**
* Writes the summary (as constructed so far) to a file.
diff --git a/tools/lua/lua_app.cpp b/tools/lua/lua_app.cpp
index f24570a829..6aea8ee437 100644
--- a/tools/lua/lua_app.cpp
+++ b/tools/lua/lua_app.cpp
@@ -33,7 +33,7 @@ int tool_main(int argc, char** argv) {
SkLua L;
for (int i = 1; i < argc; ++i) {
- SkData* data = NULL;
+ SkData* data = nullptr;
const void* ptr;
size_t len;
diff --git a/tools/lua/lua_pictures.cpp b/tools/lua/lua_pictures.cpp
index 315e4bfb89..6fa5813d77 100644
--- a/tools/lua/lua_pictures.cpp
+++ b/tools/lua/lua_pictures.cpp
@@ -42,7 +42,7 @@ DEFINE_bool2(quiet, q, false, "Silence all non-error related output");
static SkPicture* load_picture(const char path[]) {
SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path));
- SkPicture* pic = NULL;
+ SkPicture* pic = nullptr;
if (stream.get()) {
pic = SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeBitmap);
}
@@ -89,7 +89,7 @@ int tool_main(int argc, char** argv) {
for (int i = 0; i < FLAGS_luaFile.count(); ++i) {
SkAutoDataUnref data(SkData::NewFromFileName(FLAGS_luaFile[i]));
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
data.reset(SkData::NewEmpty());
}
if (!FLAGS_quiet) {
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 5c120b010d..9661daf2d0 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -16,7 +16,7 @@
namespace sk_tools {
void force_all_opaque(const SkBitmap& bitmap) {
- SkASSERT(NULL == bitmap.getTexture());
+ SkASSERT(nullptr == bitmap.getTexture());
SkASSERT(kN32_SkColorType == bitmap.colorType());
if (bitmap.getTexture() || kN32_SkColorType == bitmap.colorType()) {
return;
@@ -31,7 +31,7 @@ namespace sk_tools {
}
void replace_char(SkString* str, const char oldChar, const char newChar) {
- if (NULL == str) {
+ if (nullptr == str) {
return;
}
for (size_t i = 0; i < str->size(); ++i) {
diff --git a/tools/picture_utils.h b/tools/picture_utils.h
index b72f9d7b41..1373020a5b 100644
--- a/tools/picture_utils.h
+++ b/tools/picture_utils.h
@@ -39,7 +39,7 @@ namespace sk_tools {
*
* @param bm the bitmap to record
* @param dirPath directory within which to write the image file
- * @param subdirOrNull subdirectory within dirPath, or NULL to just write into dirPath
+ * @param subdirOrNull subdirectory within dirPath, or nullptr to just write into dirPath
* @param baseName last part of the filename
*
* @return true if written out successfully
diff --git a/tools/pinspect.cpp b/tools/pinspect.cpp
index 18c0d70cc4..5c04608c4e 100644
--- a/tools/pinspect.cpp
+++ b/tools/pinspect.cpp
@@ -20,7 +20,7 @@ static SkPicture* inspect(const char path[]) {
SkFILEStream stream(path);
if (!stream.isValid()) {
printf("-- Can't open '%s'\n", path);
- return NULL;
+ return nullptr;
}
printf("Opening '%s'...\n", path);
@@ -29,16 +29,16 @@ static SkPicture* inspect(const char path[]) {
int32_t header[3];
if (stream.read(header, sizeof(header)) != sizeof(header)) {
printf("-- Failed to read header (12 bytes)\n");
- return NULL;
+ return nullptr;
}
printf("version:%d width:%d height:%d\n", header[0], header[1], header[2]);
}
stream.rewind();
SkPicture* pic = SkPicture::CreateFromStream(&stream, &sk_tools::LazyDecodeBitmap);
- if (NULL == pic) {
+ if (nullptr == pic) {
SkDebugf("Could not create SkPicture: %s\n", path);
- return NULL;
+ return nullptr;
}
printf("picture cullRect: [%f %f %f %f]\n",
pic->cullRect().fLeft, pic->cullRect().fTop,
diff --git a/tools/render_pdfs_main.cpp b/tools/render_pdfs_main.cpp
index 9b80ef4d50..b182d8b408 100644
--- a/tools/render_pdfs_main.cpp
+++ b/tools/render_pdfs_main.cpp
@@ -120,13 +120,13 @@ static SkWStream* open_stream(const SkString& outputDir,
SkString outputPath;
if (!make_output_filepath(&outputPath, outputDir, inputFilename)) {
- return NULL;
+ return nullptr;
}
SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(outputPath.c_str()));
if (!stream.get() || !stream->isValid()) {
SkDebugf("Could not write to file %s\n", outputPath.c_str());
- return NULL;
+ return nullptr;
}
return stream.detach();
@@ -222,7 +222,7 @@ int tool_main_core(int argc, char** argv) {
SkAutoTUnref<SkPicture> picture(
SkPicture::CreateFromStream(&inputStream));
- if (NULL == picture.get()) {
+ if (nullptr == picture.get()) {
SkDebugf("Could not read an SkPicture from %s\n",
files[i].c_str());
++failures;
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 8cda966664..401c205d67 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -112,7 +112,7 @@ static void reset_image_file_base_name(const SkString& name) {
// Remove ".skp"
const char* cName = name.c_str();
const char* dot = strrchr(cName, '.');
- if (dot != NULL) {
+ if (dot != nullptr) {
gInputFileName.set(cName, dot - cName);
} else {
gInputFileName.set(name);
@@ -181,7 +181,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, proc));
- if (NULL == picture) {
+ if (nullptr == picture) {
SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str());
return false;
}
@@ -190,7 +190,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
SkPictureRecorder recorder;
picture->playback(recorder.beginRecording(picture->cullRect().width(),
picture->cullRect().height(),
- NULL, 0));
+ nullptr, 0));
SkAutoTUnref<SkPicture> other(recorder.endRecording());
}
@@ -228,7 +228,7 @@ static int MaxByteDiff(uint32_t v1, uint32_t v2) {
class AutoRestoreBbhType {
public:
AutoRestoreBbhType() {
- fRenderer = NULL;
+ fRenderer = nullptr;
fSavedBbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
}
@@ -254,31 +254,31 @@ private:
* Render the SKP file(s) within inputPath.
*
* @param inputPath path to an individual SKP file, or a directory of SKP files
- * @param writePath if not NULL, write all image(s) generated into this directory
- * @param mismatchPath if not NULL, write any image(s) not matching expectations into this directory
+ * @param writePath if not nullptr, write all image(s) generated into this directory
+ * @param mismatchPath if not nullptr, write any image(s) not matching expectations into this directory
* @param renderer PictureRenderer to use to render the SKPs
- * @param jsonSummaryPtr if not NULL, add the image(s) generated to this summary
+ * @param jsonSummaryPtr if not nullptr, add the image(s) generated to this summary
*/
static bool render_picture(const SkString& inputPath, const SkString* writePath,
const SkString* mismatchPath, sk_tools::PictureRenderer& renderer,
sk_tools::ImageResultsAndExpectations *jsonSummaryPtr) {
int diffs[256] = {0};
- SkBitmap* bitmap = NULL;
+ SkBitmap* bitmap = nullptr;
renderer.setJsonSummaryPtr(jsonSummaryPtr);
bool success = render_picture_internal(inputPath,
- FLAGS_writeWholeImage ? NULL : writePath,
- FLAGS_writeWholeImage ? NULL : mismatchPath,
+ FLAGS_writeWholeImage ? nullptr : writePath,
+ FLAGS_writeWholeImage ? nullptr : mismatchPath,
renderer,
- FLAGS_validate || FLAGS_writeWholeImage ? &bitmap : NULL);
+ FLAGS_validate || FLAGS_writeWholeImage ? &bitmap : nullptr);
- if (!success || ((FLAGS_validate || FLAGS_writeWholeImage) && bitmap == NULL)) {
+ if (!success || ((FLAGS_validate || FLAGS_writeWholeImage) && bitmap == nullptr)) {
SkDebugf("Failed to draw the picture.\n");
delete bitmap;
return false;
}
if (FLAGS_validate) {
- SkBitmap* referenceBitmap = NULL;
+ SkBitmap* referenceBitmap = nullptr;
sk_tools::PictureRenderer* referenceRenderer;
// If the renderer uses a BBoxHierarchy, then the reference renderer
// will be the same renderer, without the bbh.
@@ -297,10 +297,10 @@ static bool render_picture(const SkString& inputPath, const SkString* writePath,
}
SkAutoTUnref<sk_tools::PictureRenderer> aurReferenceRenderer(referenceRenderer);
- success = render_picture_internal(inputPath, NULL, NULL, *referenceRenderer,
+ success = render_picture_internal(inputPath, nullptr, nullptr, *referenceRenderer,
&referenceBitmap);
- if (!success || NULL == referenceBitmap || NULL == referenceBitmap->getPixels()) {
+ if (!success || nullptr == referenceBitmap || nullptr == referenceBitmap->getPixels()) {
SkDebugf("Failed to draw the reference picture.\n");
delete bitmap;
delete referenceBitmap;
@@ -363,13 +363,13 @@ static bool render_picture(const SkString& inputPath, const SkString* writePath,
jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), imageDigest);
if ((mismatchPath) && !mismatchPath->isEmpty() &&
!jsonSummaryPtr->getExpectation(inputFilename.c_str()).matches(imageDigest)) {
- success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath, NULL,
+ success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath, nullptr,
outputFilename);
}
}
if ((writePath) && !writePath->isEmpty()) {
- success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, NULL, outputFilename);
+ success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, nullptr, outputFilename);
}
}
delete bitmap;
@@ -443,7 +443,7 @@ int tool_main(int argc, char** argv) {
SkDebugf("%s\n", errorString.c_str());
}
- if (renderer.get() == NULL) {
+ if (renderer.get() == nullptr) {
exit(-1);
}
@@ -458,7 +458,7 @@ int tool_main(int argc, char** argv) {
mismatchPath.set(FLAGS_mismatchPath[0]);
}
sk_tools::ImageResultsAndExpectations jsonSummary;
- sk_tools::ImageResultsAndExpectations* jsonSummaryPtr = NULL;
+ sk_tools::ImageResultsAndExpectations* jsonSummaryPtr = nullptr;
if (FLAGS_writeJsonSummaryPath.count() == 1) {
jsonSummaryPtr = &jsonSummary;
if (FLAGS_readJsonSummaryPath.count() == 1) {
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 8d1eb44b92..a746d8b9fd 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -84,7 +84,7 @@ void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) {
tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal));
return;
}
- tf->reset(NULL);
+ tf->reset(nullptr);
return;
}
@@ -201,12 +201,12 @@ void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPain
SkTDArray<uint16_t> glyphs;
size_t len = strlen(text);
- glyphs.append(paint.textToGlyphs(text, len, NULL));
+ glyphs.append(paint.textToGlyphs(text, len, nullptr));
paint.textToGlyphs(text, len, glyphs.begin());
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.count(), x, y,
- NULL);
+ nullptr);
memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t));
}
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index b7a5dd78d0..2f70090e49 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -68,7 +68,7 @@ namespace sk_tool_utils {
/**
* Sets the paint to use a platform-independent text renderer
*/
- void set_portable_typeface(SkPaint* paint, const char* name = NULL,
+ void set_portable_typeface(SkPaint* paint, const char* name = nullptr,
SkTypeface::Style style = SkTypeface::kNormal);
/**
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index 6d6fda97c8..af52b37a4e 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -30,7 +30,7 @@ void release_portable_typefaces() {
SK_DECLARE_STATIC_MUTEX(gTestFontMutex);
SkTypeface* create_font(const char* name, SkTypeface::Style style) {
- SkTestFontData* fontData = NULL;
+ SkTestFontData* fontData = nullptr;
const SubFont* sub;
if (name) {
for (int index = 0; index < gSubFontsCount; ++index) {
diff --git a/tools/skdiff_image.cpp b/tools/skdiff_image.cpp
index 89f73810e7..9166988719 100644
--- a/tools/skdiff_image.cpp
+++ b/tools/skdiff_image.cpp
@@ -44,11 +44,11 @@ static void create_diff_images (DiffMetricProc dmp,
if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
- if (NULL == baseFileBits || NULL == comparisonFileBits) {
- if (NULL == baseFileBits) {
+ if (nullptr == baseFileBits || nullptr == comparisonFileBits) {
+ if (nullptr == baseFileBits) {
drp->fBase.fStatus = DiffResource::kCouldNotRead_Status;
}
- if (NULL == comparisonFileBits) {
+ if (nullptr == comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kCouldNotRead_Status;
}
drp->fResult = DiffRecord::kCouldNotCompare_Result;
@@ -314,7 +314,7 @@ int tool_main(int argc, char** argv) {
} else {
const char* baseLabelCstr = baseLabel.c_str();
const char* tab = strchr(baseLabelCstr, '\t');
- if (NULL == tab) {
+ if (nullptr == tab) {
outputFile = baseLabel;
} else {
outputFile.set(baseLabelCstr, tab - baseLabelCstr);
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index 4e360a8e49..00bcdfcda0 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -329,13 +329,13 @@ class AutoReleasePixels {
public:
AutoReleasePixels(DiffRecord* drp)
: fDrp(drp) {
- SkASSERT(drp != NULL);
+ SkASSERT(drp != nullptr);
}
~AutoReleasePixels() {
- fDrp->fBase.fBitmap.setPixelRef(NULL);
- fDrp->fComparison.fBitmap.setPixelRef(NULL);
- fDrp->fDifference.fBitmap.setPixelRef(NULL);
- fDrp->fWhite.fBitmap.setPixelRef(NULL);
+ fDrp->fBase.fBitmap.setPixelRef(nullptr);
+ fDrp->fComparison.fBitmap.setPixelRef(nullptr);
+ fDrp->fDifference.fBitmap.setPixelRef(nullptr);
+ fDrp->fWhite.fBitmap.setPixelRef(nullptr);
}
private:
@@ -345,7 +345,7 @@ private:
static void get_bounds(DiffResource& resource, const char* name) {
if (resource.fBitmap.empty() && !DiffResource::isStatusFailed(resource.fStatus)) {
SkAutoDataUnref fileBits(read_file(resource.fFullPath.c_str()));
- if (NULL == fileBits) {
+ if (nullptr == fileBits) {
SkDebugf("WARNING: couldn't read %s file <%s>\n", name, resource.fFullPath.c_str());
resource.fStatus = DiffResource::kCouldNotRead_Status;
} else {
@@ -477,12 +477,12 @@ static void create_diff_images (DiffMetricProc dmp,
if (comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kRead_Status;
}
- if (NULL == baseFileBits || NULL == comparisonFileBits) {
- if (NULL == baseFileBits) {
+ if (nullptr == baseFileBits || nullptr == comparisonFileBits) {
+ if (nullptr == baseFileBits) {
drp->fBase.fStatus = DiffResource::kCouldNotRead_Status;
VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, baseFiles[i]);
}
- if (NULL == comparisonFileBits) {
+ if (nullptr == comparisonFileBits) {
drp->fComparison.fStatus = DiffResource::kCouldNotRead_Status;
VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[j]);
}
diff --git a/tools/skdiff_utils.cpp b/tools/skdiff_utils.cpp
index e656e3c44b..1e2a727945 100644
--- a/tools/skdiff_utils.cpp
+++ b/tools/skdiff_utils.cpp
@@ -16,7 +16,7 @@
#include <memory>
bool are_buffers_equal(SkData* skdata1, SkData* skdata2) {
- if ((NULL == skdata1) || (NULL == skdata2)) {
+ if ((nullptr == skdata1) || (nullptr == skdata2)) {
return false;
}
if (skdata1->size() != skdata2->size()) {
@@ -39,7 +39,7 @@ bool get_bitmap(SkData* fileBits, DiffResource& resource, SkImageDecoder::Mode m
// In debug, the DLL will automatically be unloaded when this is deleted,
// but that shouldn't be a problem in release mode.
std::unique_ptr<SkImageDecoder> codec(SkImageDecoder::Factory(&stream));
- if (NULL == codec) {
+ if (nullptr == codec) {
SkDebugf("ERROR: no codec found for <%s>\n", resource.fFullPath.c_str());
resource.fStatus = DiffResource::kCouldNotDecode_Status;
return false;
diff --git a/tools/skdiff_utils.h b/tools/skdiff_utils.h
index 00ebf899a9..8b94117eef 100644
--- a/tools/skdiff_utils.h
+++ b/tools/skdiff_utils.h
@@ -15,13 +15,13 @@ class SkBitmap;
class SkData;
class SkString;
-/** Returns true if the two buffers passed in are both non-NULL,
+/** Returns true if the two buffers passed in are both non-nullptr,
* have the same length, and contain exactly the same byte values.
*/
bool are_buffers_equal(SkData* skdata1, SkData* skdata2);
/** Reads the file at the given path and returns its complete contents as an
- * SkData object (or returns NULL on error).
+ * SkData object (or returns nullptr on error).
*/
SkData* read_file(const char* file_path);
diff --git a/tools/skhello.cpp b/tools/skhello.cpp
index b46ba084ab..5614a56f5d 100644
--- a/tools/skhello.cpp
+++ b/tools/skhello.cpp
@@ -39,7 +39,7 @@ static bool do_surface(int w, int h, const char path[], const char text[],
SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
SkAutoDataUnref data(image->encode());
- if (NULL == data.get()) {
+ if (nullptr == data.get()) {
return false;
}
SkFILEWStream stream(path);
@@ -52,7 +52,7 @@ static bool do_document(int w, int h, const char path[], const char text[],
if (doc.get()) {
SkScalar width = SkIntToScalar(w);
SkScalar height = SkIntToScalar(h);
- doDraw(doc->beginPage(width, height, NULL), paint, text);
+ doDraw(doc->beginPage(width, height, nullptr), paint, text);
return true;
}
return false;
diff --git a/tools/skpdiff/SkCLImageDiffer.cpp b/tools/skpdiff/SkCLImageDiffer.cpp
index 1c5d5c56ea..f181682db5 100644
--- a/tools/skpdiff/SkCLImageDiffer.cpp
+++ b/tools/skpdiff/SkCLImageDiffer.cpp
@@ -60,15 +60,15 @@ bool SkCLImageDiffer::loadKernelStream(SkStream* stream, const char name[], cl_k
bool SkCLImageDiffer::loadKernelSource(const char source[], const char name[], cl_kernel* kernel) {
// Build the kernel source
size_t sourceLen = strlen(source);
- cl_program program = clCreateProgramWithSource(fContext, 1, &source, &sourceLen, NULL);
- cl_int programErr = clBuildProgram(program, 1, &fDevice, "", NULL, NULL);
+ cl_program program = clCreateProgramWithSource(fContext, 1, &source, &sourceLen, nullptr);
+ cl_int programErr = clBuildProgram(program, 1, &fDevice, "", nullptr, nullptr);
if (CL_SUCCESS != programErr) {
SkDebugf("Program creation failed: %s\n", cl_error_to_string(programErr));
// Attempt to get information about why the build failed
char buildLog[4096];
clGetProgramBuildInfo(program, fDevice, CL_PROGRAM_BUILD_LOG, sizeof(buildLog),
- buildLog, NULL);
+ buildLog, nullptr);
SkDebugf("Build log: %s\n", buildLog);
return false;
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index 5add0df515..8da346ed5c 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -22,7 +22,7 @@
#include "skpdiff_util.h"
SkDiffContext::SkDiffContext() {
- fDiffers = NULL;
+ fDiffers = nullptr;
fDifferCount = 0;
}
@@ -58,7 +58,7 @@ void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
// Delete whatever the last array of differs was
if (fDiffers) {
delete[] fDiffers;
- fDiffers = NULL;
+ fDiffers = nullptr;
fDifferCount = 0;
}
diff --git a/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp b/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp
index 2e5ab8f725..95ab9530ae 100644
--- a/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp
+++ b/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp
@@ -72,7 +72,7 @@ bool SkDifferentPixelsMetric::diff(SkBitmap* baseline, SkBitmap* test, bool comp
static const int kZero = 0;
// We know OpenCL won't write to it because we use CL_MEM_COPY_HOST_PTR
resultsBuffer = clCreateBuffer(fContext, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
- sizeof(int), (int*)&kZero, NULL);
+ sizeof(int), (int*)&kZero, nullptr);
// Set all kernel arguments
cl_int setArgErr = clSetKernelArg(fKernel, 0, sizeof(cl_mem), &baselineImage);
@@ -87,8 +87,8 @@ bool SkDifferentPixelsMetric::diff(SkBitmap* baseline, SkBitmap* test, bool comp
cl_event event;
const size_t workSize[] = { baseline->width(), baseline->height() };
cl_int enqueueErr;
- enqueueErr = clEnqueueNDRangeKernel(fCommandQueue, fKernel, 2, NULL, workSize,
- NULL, 0, NULL, &event);
+ enqueueErr = clEnqueueNDRangeKernel(fCommandQueue, fKernel, 2, nullptr, workSize,
+ nullptr, 0, nullptr, &event);
if (CL_SUCCESS != enqueueErr) {
SkDebugf("Enqueue failed: %s\n", cl_error_to_string(enqueueErr));
return false;
@@ -99,7 +99,7 @@ bool SkDifferentPixelsMetric::diff(SkBitmap* baseline, SkBitmap* test, bool comp
// Immediate read back the results
clEnqueueReadBuffer(fCommandQueue, resultsBuffer, CL_TRUE, 0,
- sizeof(int), &result->poiCount, 0, NULL, NULL);
+ sizeof(int), &result->poiCount, 0, nullptr, nullptr);
result->result *= (double)result->poiCount;
result->result = (1.0 - result->result);
diff --git a/tools/skpdiff/skpdiff_main.cpp b/tools/skpdiff/skpdiff_main.cpp
index b5ba31072d..90b4f715c5 100644
--- a/tools/skpdiff/skpdiff_main.cpp
+++ b/tools/skpdiff/skpdiff_main.cpp
@@ -87,7 +87,7 @@ static bool init_device_and_context(cl::Device* device, cl::Context* context) {
// Create a CL context and check for all errors
cl_int contextErr = CL_SUCCESS;
- *context = cl::Context(deviceList, NULL, error_notify, NULL, &contextErr);
+ *context = cl::Context(deviceList, nullptr, error_notify, nullptr, &contextErr);
if (contextErr != CL_SUCCESS) {
SkDebugf("Context creation failed: %s\n", cl_error_to_string(contextErr));
return false;
@@ -118,7 +118,7 @@ SkDifferentPixelsMetric gDiffPixel;
SkPMetric gPDiff;
// A null terminated array of pointer to every differ declared above
-SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL };
+SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, nullptr };
int tool_main(int argc, char * argv[]);
int tool_main(int argc, char * argv[]) {
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp
index 4b5d52110b..d33ca24a3a 100644
--- a/tools/skpdiff/skpdiff_util.cpp
+++ b/tools/skpdiff/skpdiff_util.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
# include <unistd.h>
# include <sys/time.h>
@@ -97,7 +99,7 @@ double get_seconds() {
return currentTime.tv_sec + (double)currentTime.tv_nsec / 1e9;
#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
struct timeval currentTime;
- gettimeofday(&currentTime, NULL);
+ gettimeofday(&currentTime, nullptr);
return currentTime.tv_sec + (double)currentTime.tv_usec / 1e6;
#else
return clock() / (double)CLOCKS_PER_SEC;
@@ -108,11 +110,11 @@ bool get_directory(const char path[], SkTArray<SkString>* entries) {
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
// Open the directory and check for success
DIR* dir = opendir(path);
- if (NULL == dir) {
+ if (nullptr == dir) {
return false;
}
- // Loop through dir entries until there are none left (i.e. readdir returns NULL)
+ // Loop through dir entries until there are none left (i.e. readdir returns nullptr)
struct dirent* entry;
while ((entry = readdir(dir))) {
// dirent only gives relative paths, we need to join them to the base path to check if they
@@ -167,7 +169,7 @@ bool glob_files(const char globPattern[], SkTArray<SkString>* entries) {
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX)
// TODO Make sure this works on windows. This may require use of FindNextFile windows function.
glob_t globBuffer;
- if (glob(globPattern, 0, NULL, &globBuffer) != 0) {
+ if (glob(globPattern, 0, nullptr, &globBuffer) != 0) {
return false;
}
@@ -190,13 +192,13 @@ bool glob_files(const char globPattern[], SkTArray<SkString>* entries) {
SkString get_absolute_path(const SkString& path) {
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
SkString fullPath(PATH_MAX + 1);
- if (realpath(path.c_str(), fullPath.writable_str()) == NULL) {
+ if (realpath(path.c_str(), fullPath.writable_str()) == nullptr) {
fullPath.reset();
}
return fullPath;
#elif defined(SK_BUILD_FOR_WIN32)
SkString fullPath(MAX_PATH);
- if (_fullpath(fullPath.writable_str(), path.c_str(), MAX_PATH) == NULL) {
+ if (_fullpath(fullPath.writable_str(), path.c_str(), MAX_PATH) == nullptr) {
fullPath.reset();
}
return fullPath;
diff --git a/tools/skpmaker.cpp b/tools/skpmaker.cpp
index 0e378ed088..8fa969a6f0 100644
--- a/tools/skpmaker.cpp
+++ b/tools/skpmaker.cpp
@@ -32,7 +32,7 @@ DEFINE_string(writePath, "", "Filepath to write the SKP into.");
static void make_skp(SkScalar width, SkScalar height, SkScalar border, SkColor color,
const char *writePath) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0);
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(SK_ColorBLACK);
diff --git a/tools/test_font_data.cpp b/tools/test_font_data.cpp
index 2db09b736b..ff0aaccc11 100644
--- a/tools/test_font_data.cpp
+++ b/tools/test_font_data.cpp
@@ -8514,59 +8514,59 @@ const SkPaint::FontMetrics TimesNewRomankBoldItalicMetrics = {
static SkTestFontData gTestFonts[] = {
{ CourierNewkNormalPoints, CourierNewkNormalVerbs, CourierNewkNormalCharCodes,
CourierNewkNormalCharCodesCount, CourierNewkNormalWidths,
- CourierNewkNormalMetrics, "Courier New", SkTypeface::kNormal, NULL
+ CourierNewkNormalMetrics, "Courier New", SkTypeface::kNormal, nullptr
},
{ CourierNewkBoldPoints, CourierNewkBoldVerbs, CourierNewkBoldCharCodes,
CourierNewkBoldCharCodesCount, CourierNewkBoldWidths,
- CourierNewkBoldMetrics, "Courier New", SkTypeface::kBold, NULL
+ CourierNewkBoldMetrics, "Courier New", SkTypeface::kBold, nullptr
},
{ CourierNewkItalicPoints, CourierNewkItalicVerbs, CourierNewkItalicCharCodes,
CourierNewkItalicCharCodesCount, CourierNewkItalicWidths,
- CourierNewkItalicMetrics, "Courier New", SkTypeface::kItalic, NULL
+ CourierNewkItalicMetrics, "Courier New", SkTypeface::kItalic, nullptr
},
{ CourierNewkBoldItalicPoints, CourierNewkBoldItalicVerbs, CourierNewkBoldItalicCharCodes,
CourierNewkBoldItalicCharCodesCount, CourierNewkBoldItalicWidths,
- CourierNewkBoldItalicMetrics, "Courier New", SkTypeface::kBoldItalic, NULL
+ CourierNewkBoldItalicMetrics, "Courier New", SkTypeface::kBoldItalic, nullptr
},
{ LiberationSanskNormalPoints, LiberationSanskNormalVerbs, LiberationSanskNormalCharCodes,
LiberationSanskNormalCharCodesCount, LiberationSanskNormalWidths,
- LiberationSanskNormalMetrics, "Liberation Sans", SkTypeface::kNormal, NULL
+ LiberationSanskNormalMetrics, "Liberation Sans", SkTypeface::kNormal, nullptr
},
{ LiberationSanskBoldPoints, LiberationSanskBoldVerbs, LiberationSanskBoldCharCodes,
LiberationSanskBoldCharCodesCount, LiberationSanskBoldWidths,
- LiberationSanskBoldMetrics, "Liberation Sans", SkTypeface::kBold, NULL
+ LiberationSanskBoldMetrics, "Liberation Sans", SkTypeface::kBold, nullptr
},
{ LiberationSanskItalicPoints, LiberationSanskItalicVerbs, LiberationSanskItalicCharCodes,
LiberationSanskItalicCharCodesCount, LiberationSanskItalicWidths,
- LiberationSanskItalicMetrics, "Liberation Sans", SkTypeface::kItalic, NULL
+ LiberationSanskItalicMetrics, "Liberation Sans", SkTypeface::kItalic, nullptr
},
{ LiberationSanskBoldItalicPoints, LiberationSanskBoldItalicVerbs, LiberationSanskBoldItalicCharCodes,
LiberationSanskBoldItalicCharCodesCount, LiberationSanskBoldItalicWidths,
- LiberationSanskBoldItalicMetrics, "Liberation Sans", SkTypeface::kBoldItalic, NULL
+ LiberationSanskBoldItalicMetrics, "Liberation Sans", SkTypeface::kBoldItalic, nullptr
},
{ HiraginoMaruGothicProkNormalPoints, HiraginoMaruGothicProkNormalVerbs, HiraginoMaruGothicProkNormalCharCodes,
HiraginoMaruGothicProkNormalCharCodesCount, HiraginoMaruGothicProkNormalWidths,
- HiraginoMaruGothicProkNormalMetrics, "Hiragino Maru Gothic Pro", SkTypeface::kNormal, NULL
+ HiraginoMaruGothicProkNormalMetrics, "Hiragino Maru Gothic Pro", SkTypeface::kNormal, nullptr
},
{ PapyruskNormalPoints, PapyruskNormalVerbs, PapyruskNormalCharCodes,
PapyruskNormalCharCodesCount, PapyruskNormalWidths,
- PapyruskNormalMetrics, "Papyrus", SkTypeface::kNormal, NULL
+ PapyruskNormalMetrics, "Papyrus", SkTypeface::kNormal, nullptr
},
{ TimesNewRomankNormalPoints, TimesNewRomankNormalVerbs, TimesNewRomankNormalCharCodes,
TimesNewRomankNormalCharCodesCount, TimesNewRomankNormalWidths,
- TimesNewRomankNormalMetrics, "Times New Roman", SkTypeface::kNormal, NULL
+ TimesNewRomankNormalMetrics, "Times New Roman", SkTypeface::kNormal, nullptr
},
{ TimesNewRomankBoldPoints, TimesNewRomankBoldVerbs, TimesNewRomankBoldCharCodes,
TimesNewRomankBoldCharCodesCount, TimesNewRomankBoldWidths,
- TimesNewRomankBoldMetrics, "Times New Roman", SkTypeface::kBold, NULL
+ TimesNewRomankBoldMetrics, "Times New Roman", SkTypeface::kBold, nullptr
},
{ TimesNewRomankItalicPoints, TimesNewRomankItalicVerbs, TimesNewRomankItalicCharCodes,
TimesNewRomankItalicCharCodesCount, TimesNewRomankItalicWidths,
- TimesNewRomankItalicMetrics, "Times New Roman", SkTypeface::kItalic, NULL
+ TimesNewRomankItalicMetrics, "Times New Roman", SkTypeface::kItalic, nullptr
},
{ TimesNewRomankBoldItalicPoints, TimesNewRomankBoldItalicVerbs, TimesNewRomankBoldItalicCharCodes,
TimesNewRomankBoldItalicCharCodesCount, TimesNewRomankBoldItalicWidths,
- TimesNewRomankBoldItalicMetrics, "Times New Roman", SkTypeface::kBoldItalic, NULL
+ TimesNewRomankBoldItalicMetrics, "Times New Roman", SkTypeface::kBoldItalic, nullptr
},
};
diff --git a/tools/test_font_index.cpp b/tools/test_font_index.cpp
index ec135c1499..b9bc24c63f 100644
--- a/tools/test_font_index.cpp
+++ b/tools/test_font_index.cpp
@@ -10,51 +10,51 @@
static SkTestFontData gTestFonts[] = {
{ LiberationMonoNormalPoints, LiberationMonoNormalVerbs, LiberationMonoNormalCharCodes,
LiberationMonoNormalCharCodesCount, LiberationMonoNormalWidths,
- LiberationMonoNormalMetrics, "Toy Liberation Mono", SkTypeface::kNormal, NULL
+ LiberationMonoNormalMetrics, "Toy Liberation Mono", SkTypeface::kNormal, nullptr
},
{ LiberationMonoBoldPoints, LiberationMonoBoldVerbs, LiberationMonoBoldCharCodes,
LiberationMonoBoldCharCodesCount, LiberationMonoBoldWidths,
- LiberationMonoBoldMetrics, "Toy Liberation Mono", SkTypeface::kBold, NULL
+ LiberationMonoBoldMetrics, "Toy Liberation Mono", SkTypeface::kBold, nullptr
},
{ LiberationMonoItalicPoints, LiberationMonoItalicVerbs, LiberationMonoItalicCharCodes,
LiberationMonoItalicCharCodesCount, LiberationMonoItalicWidths,
- LiberationMonoItalicMetrics, "Toy Liberation Mono", SkTypeface::kItalic, NULL
+ LiberationMonoItalicMetrics, "Toy Liberation Mono", SkTypeface::kItalic, nullptr
},
{ LiberationMonoBoldItalicPoints, LiberationMonoBoldItalicVerbs, LiberationMonoBoldItalicCharCodes,
LiberationMonoBoldItalicCharCodesCount, LiberationMonoBoldItalicWidths,
- LiberationMonoBoldItalicMetrics, "Toy Liberation Mono", SkTypeface::kBoldItalic, NULL
+ LiberationMonoBoldItalicMetrics, "Toy Liberation Mono", SkTypeface::kBoldItalic, nullptr
},
{ LiberationSansNormalPoints, LiberationSansNormalVerbs, LiberationSansNormalCharCodes,
LiberationSansNormalCharCodesCount, LiberationSansNormalWidths,
- LiberationSansNormalMetrics, "Toy Liberation Sans", SkTypeface::kNormal, NULL
+ LiberationSansNormalMetrics, "Toy Liberation Sans", SkTypeface::kNormal, nullptr
},
{ LiberationSansBoldPoints, LiberationSansBoldVerbs, LiberationSansBoldCharCodes,
LiberationSansBoldCharCodesCount, LiberationSansBoldWidths,
- LiberationSansBoldMetrics, "Toy Liberation Sans", SkTypeface::kBold, NULL
+ LiberationSansBoldMetrics, "Toy Liberation Sans", SkTypeface::kBold, nullptr
},
{ LiberationSansItalicPoints, LiberationSansItalicVerbs, LiberationSansItalicCharCodes,
LiberationSansItalicCharCodesCount, LiberationSansItalicWidths,
- LiberationSansItalicMetrics, "Toy Liberation Sans", SkTypeface::kItalic, NULL
+ LiberationSansItalicMetrics, "Toy Liberation Sans", SkTypeface::kItalic, nullptr
},
{ LiberationSansBoldItalicPoints, LiberationSansBoldItalicVerbs, LiberationSansBoldItalicCharCodes,
LiberationSansBoldItalicCharCodesCount, LiberationSansBoldItalicWidths,
- LiberationSansBoldItalicMetrics, "Toy Liberation Sans", SkTypeface::kBoldItalic, NULL
+ LiberationSansBoldItalicMetrics, "Toy Liberation Sans", SkTypeface::kBoldItalic, nullptr
},
{ LiberationSerifNormalPoints, LiberationSerifNormalVerbs, LiberationSerifNormalCharCodes,
LiberationSerifNormalCharCodesCount, LiberationSerifNormalWidths,
- LiberationSerifNormalMetrics, "Toy Liberation Serif", SkTypeface::kNormal, NULL
+ LiberationSerifNormalMetrics, "Toy Liberation Serif", SkTypeface::kNormal, nullptr
},
{ LiberationSerifBoldPoints, LiberationSerifBoldVerbs, LiberationSerifBoldCharCodes,
LiberationSerifBoldCharCodesCount, LiberationSerifBoldWidths,
- LiberationSerifBoldMetrics, "Toy Liberation Serif", SkTypeface::kBold, NULL
+ LiberationSerifBoldMetrics, "Toy Liberation Serif", SkTypeface::kBold, nullptr
},
{ LiberationSerifItalicPoints, LiberationSerifItalicVerbs, LiberationSerifItalicCharCodes,
LiberationSerifItalicCharCodesCount, LiberationSerifItalicWidths,
- LiberationSerifItalicMetrics, "Toy Liberation Serif", SkTypeface::kItalic, NULL
+ LiberationSerifItalicMetrics, "Toy Liberation Serif", SkTypeface::kItalic, nullptr
},
{ LiberationSerifBoldItalicPoints, LiberationSerifBoldItalicVerbs, LiberationSerifBoldItalicCharCodes,
LiberationSerifBoldItalicCharCodesCount, LiberationSerifBoldItalicWidths,
- LiberationSerifBoldItalicMetrics, "Toy Liberation Serif", SkTypeface::kBoldItalic, NULL
+ LiberationSerifBoldItalicMetrics, "Toy Liberation Serif", SkTypeface::kBoldItalic, nullptr
},
};
diff --git a/tools/timer/Timer.h b/tools/timer/Timer.h
index e28a515b54..9557596248 100644
--- a/tools/timer/Timer.h
+++ b/tools/timer/Timer.h
@@ -35,7 +35,7 @@ class SkGLContext;
*/
class Timer {
public:
- explicit Timer(SkGLContext* gl = NULL);
+ explicit Timer(SkGLContext* gl = nullptr);
void start();
void truncatedEnd();
diff --git a/tools/timer/TimerData.cpp b/tools/timer/TimerData.cpp
index 21529bc2e0..d1460f73fd 100644
--- a/tools/timer/TimerData.cpp
+++ b/tools/timer/TimerData.cpp
@@ -19,7 +19,7 @@ TimerData::TimerData(int maxNumTimings)
, fGpuTimes(maxNumTimings) {}
bool TimerData::appendTimes(Timer* timer) {
- SkASSERT(timer != NULL);
+ SkASSERT(timer != nullptr);
if (fCurrTiming >= fMaxNumTimings) {
return false;
}
diff --git a/tools/win_dbghelp.cpp b/tools/win_dbghelp.cpp
index 57389b430d..7291f369a9 100644
--- a/tools/win_dbghelp.cpp
+++ b/tools/win_dbghelp.cpp
@@ -45,7 +45,7 @@
#define CDB_PRINT_CALLSTACK_CURRENT_THREAD "? " MARKER_THREAD_CALLSTACK_START_NUMBER "; k; ? " MARKER_THREAD_CALLSTACK_STOP_NUMBER "; .ecxr; ? " MARKER_EXCEPTION_CALLSTACK_START_NUMBER "; k; ? " MARKER_EXCEPTION_CALLSTACK_STOP_NUMBER "; q"
static void strncpyOrSetBlank(char* dest, const char* src, size_t len) {
- const char* srcOrEmptyString = (NULL == src) ? "" : src;
+ const char* srcOrEmptyString = (nullptr == src) ? "" : src;
strncpy(dest, srcOrEmptyString, len);
}
@@ -105,7 +105,7 @@ static void printCallstack(const char* filename,
break;
} else if (started) {
// Filter messages. Calstack lines contain "exe/dll!function"
- if (strchr(line, '!') != NULL && strlen(line) > CDB_CALLSTACK_PREFIX) {
+ if (strchr(line, '!') != nullptr && strlen(line) > CDB_CALLSTACK_PREFIX) {
printf("%s", line + CDB_CALLSTACK_PREFIX); // fgets includes \n already.
}
}
@@ -139,7 +139,7 @@ int GenerateDumpAndPrintCallstack(EXCEPTION_POINTERS* pExceptionPointers) {
GetTempPath( dwBufferSize, szPath );
sprintf( szFileName, "%s%s", szPath, szAppName );
- CreateDirectory( szFileName, NULL );
+ CreateDirectory( szFileName, nullptr );
BUILD_UNIQUE_FILENAME(szFileName, ".dmp", szPath, szAppName, szVersion, stLocalTime);
BUILD_UNIQUE_FILENAME(szFileNameOutput, ".out", szPath, szAppName, szVersion, stLocalTime);
@@ -161,8 +161,8 @@ int GenerateDumpAndPrintCallstack(EXCEPTION_POINTERS* pExceptionPointers) {
hDumpFile,
MiniDumpWithDataSegs,
&ExpParam,
- NULL,
- NULL);
+ nullptr,
+ nullptr);
printf("MiniDump file: %s\n", szFileName);
printf("App exe and pdb: %s\n", getBinariesPath());
diff --git a/tools/win_lcid.cpp b/tools/win_lcid.cpp
index f4901719ec..8cb7463d49 100644
--- a/tools/win_lcid.cpp
+++ b/tools/win_lcid.cpp
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "windows.h"
#include "stdio.h"
@@ -12,7 +18,7 @@ BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) {
return (TRUE);
}
- LCID lcid = LocaleNameToLCID(pStr, NULL);
+ LCID lcid = LocaleNameToLCID(pStr, nullptr);
if (lcid == 0) {
wprintf(L"Error %d getting LCID\n", GetLastError());
return (TRUE);
@@ -27,5 +33,5 @@ BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) {
}
int main(int argc, wchar_t* argv[]) {
- EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, NULL, NULL);
+ EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, nullptr, nullptr);
}