From 96fcdcc219d2a0d3579719b84b28bede76efba64 Mon Sep 17 00:00:00 2001 From: halcanary Date: Thu, 27 Aug 2015 07:41:13 -0700 Subject: Style Change: NULL->nullptr DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002 --- src/gpu/GrAAConvexPathRenderer.cpp | 2 +- src/gpu/GrAADistanceFieldPathRenderer.cpp | 8 +- src/gpu/GrAAHairLinePathRenderer.cpp | 6 +- src/gpu/GrAllocator.h | 6 +- src/gpu/GrAtlas.cpp | 24 +- src/gpu/GrAtlas.h | 2 +- src/gpu/GrAtlasTextBlob.h | 2 +- src/gpu/GrAtlasTextContext.cpp | 48 +- src/gpu/GrBatchAtlas.cpp | 12 +- src/gpu/GrBatchAtlas.h | 2 +- src/gpu/GrBatchFontCache.cpp | 12 +- src/gpu/GrBatchFontCache.h | 10 +- src/gpu/GrBlurUtils.cpp | 14 +- src/gpu/GrBufferedDrawTarget.cpp | 4 +- src/gpu/GrBufferedDrawTarget.h | 4 +- src/gpu/GrClipMaskCache.h | 12 +- src/gpu/GrClipMaskManager.cpp | 38 +- src/gpu/GrClipMaskManager.h | 4 +- src/gpu/GrContext.cpp | 36 +- src/gpu/GrContextFactory.cpp | 10 +- src/gpu/GrContextFactory.h | 4 +- src/gpu/GrDefaultGeoProcFactory.cpp | 10 +- src/gpu/GrDefaultGeoProcFactory.h | 4 +- src/gpu/GrDefaultPathRenderer.cpp | 10 +- src/gpu/GrDrawContext.cpp | 16 +- src/gpu/GrDrawTarget.cpp | 12 +- src/gpu/GrDrawTarget.h | 6 +- src/gpu/GrFontScaler.cpp | 8 +- src/gpu/GrGeometryBuffer.h | 10 +- src/gpu/GrGlyph.h | 4 +- src/gpu/GrGpu.cpp | 22 +- src/gpu/GrGpu.h | 16 +- src/gpu/GrGpuFactory.cpp | 4 +- src/gpu/GrGpuResource.cpp | 8 +- src/gpu/GrGpuResourceRef.cpp | 10 +- src/gpu/GrInOrderCommandBuilder.cpp | 4 +- src/gpu/GrLayerCache.cpp | 28 +- src/gpu/GrLayerCache.h | 18 +- src/gpu/GrLayerHoister.cpp | 4 +- src/gpu/GrMemoryPool.cpp | 12 +- src/gpu/GrOvalRenderer.cpp | 20 +- src/gpu/GrPathRange.h | 2 +- src/gpu/GrPathRendererChain.cpp | 2 +- src/gpu/GrPathRendering.cpp | 4 +- src/gpu/GrPathUtils.h | 10 +- src/gpu/GrPendingProgramElement.h | 2 +- src/gpu/GrPipelineBuilder.cpp | 2 +- src/gpu/GrPipelineBuilder.h | 12 +- src/gpu/GrPrimitiveProcessor.h | 2 +- src/gpu/GrRecordReplaceDraw.cpp | 8 +- src/gpu/GrReducedClip.cpp | 2 +- src/gpu/GrReducedClip.h | 8 +- src/gpu/GrRenderTarget.cpp | 6 +- src/gpu/GrReorderCommandBuilder.cpp | 2 +- src/gpu/GrReorderCommandBuilder.h | 2 +- src/gpu/GrResourceCache.cpp | 20 +- src/gpu/GrResourceProvider.cpp | 12 +- src/gpu/GrResourceProvider.h | 4 +- src/gpu/GrSWMaskHelper.cpp | 14 +- src/gpu/GrSoftwarePathRenderer.cpp | 8 +- src/gpu/GrStencilAndCoverPathRenderer.cpp | 2 +- src/gpu/GrStencilAndCoverTextContext.cpp | 24 +- src/gpu/GrStrokeInfo.cpp | 2 +- src/gpu/GrSurface.cpp | 4 +- src/gpu/GrTRecorder.h | 20 +- src/gpu/GrTargetCommands.h | 2 +- src/gpu/GrTessellatingPathRenderer.cpp | 150 ++--- src/gpu/GrTest.cpp | 14 +- src/gpu/GrTextBlobCache.h | 4 +- src/gpu/GrTextContext.cpp | 10 +- src/gpu/GrTextureProvider.cpp | 18 +- src/gpu/GrVertices.h | 4 +- src/gpu/SkGpuDevice.cpp | 88 +-- src/gpu/SkGpuDevice.h | 6 +- src/gpu/SkGr.cpp | 58 +- src/gpu/SkGrPixelRef.cpp | 32 +- src/gpu/batches/GrAAFillRectBatch.cpp | 2 +- src/gpu/batches/GrCopySurfaceBatch.cpp | 2 +- src/gpu/batches/GrDrawVerticesBatch.cpp | 4 +- src/gpu/batches/GrVertexBatch.cpp | 6 +- src/gpu/batches/GrVertexBatch.h | 2 +- src/gpu/effects/GrBezierEffect.cpp | 6 +- src/gpu/effects/GrBezierEffect.h | 18 +- src/gpu/effects/GrBicubicEffect.h | 4 +- src/gpu/effects/GrBitmapTextGeoProc.cpp | 2 +- src/gpu/effects/GrConfigConversionEffect.cpp | 6 +- src/gpu/effects/GrConvexPolyEffect.cpp | 14 +- src/gpu/effects/GrConvexPolyEffect.h | 6 +- src/gpu/effects/GrCoverageSetOpXP.cpp | 4 +- src/gpu/effects/GrCustomXfermode.cpp | 6 +- src/gpu/effects/GrDashingEffect.cpp | 8 +- src/gpu/effects/GrDistanceFieldGeoProc.cpp | 10 +- src/gpu/effects/GrOvalEffect.cpp | 4 +- src/gpu/effects/GrPorterDuffXferProcessor.cpp | 6 +- src/gpu/effects/GrRRectEffect.cpp | 14 +- src/gpu/effects/GrRRectEffect.h | 2 +- src/gpu/effects/GrTextureDomain.h | 4 +- src/gpu/effects/GrTextureStripAtlas.cpp | 64 +- src/gpu/effects/GrTextureStripAtlas.h | 6 +- src/gpu/effects/GrYUVtoRGBEffect.cpp | 2 +- src/gpu/gl/GrGLAssembleInterface.cpp | 38 +- src/gpu/gl/GrGLBufferImpl.cpp | 36 +- src/gpu/gl/GrGLCaps.cpp | 12 +- src/gpu/gl/GrGLContext.cpp | 8 +- src/gpu/gl/GrGLCreateNativeInterface_none.cpp | 2 +- src/gpu/gl/GrGLCreateNullInterface.cpp | 10 +- src/gpu/gl/GrGLDefaultInterface_none.cpp | 2 +- src/gpu/gl/GrGLExtensions.cpp | 8 +- src/gpu/gl/GrGLFragmentProcessor.h | 2 +- src/gpu/gl/GrGLGpu.cpp | 68 +-- src/gpu/gl/GrGLGpu.h | 6 +- src/gpu/gl/GrGLGpuProgramCache.cpp | 16 +- src/gpu/gl/GrGLIndexBuffer.cpp | 2 +- src/gpu/gl/GrGLInterface.cpp | 662 ++++++++++----------- src/gpu/gl/GrGLNameAllocator.cpp | 18 +- src/gpu/gl/GrGLNoOpInterface.cpp | 6 +- src/gpu/gl/GrGLPath.cpp | 2 +- src/gpu/gl/GrGLPathRange.cpp | 2 +- src/gpu/gl/GrGLPathRendering.cpp | 14 +- src/gpu/gl/GrGLUtil.cpp | 12 +- src/gpu/gl/GrGLVertexArray.cpp | 2 +- src/gpu/gl/GrGLVertexArray.h | 2 +- src/gpu/gl/GrGLVertexBuffer.cpp | 2 +- src/gpu/gl/SkGLContext.cpp | 14 +- src/gpu/gl/SkNullGLContext.cpp | 16 +- .../android/GrGLCreateNativeInterface_android.cpp | 4 +- src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 8 +- src/gpu/gl/angle/SkANGLEGLContext.cpp | 4 +- src/gpu/gl/builders/GrGLFragmentShaderBuilder.h | 2 +- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 18 +- src/gpu/gl/builders/GrGLProgramBuilder.h | 10 +- src/gpu/gl/builders/GrGLShaderBuilder.cpp | 2 +- src/gpu/gl/builders/GrGLShaderBuilder.h | 2 +- src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp | 2 +- src/gpu/gl/debug/GrBufferObj.h | 2 +- src/gpu/gl/debug/GrDebugGL.cpp | 32 +- src/gpu/gl/debug/GrDebugGL.h | 4 +- src/gpu/gl/debug/GrFrameBufferObj.h | 18 +- src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 40 +- src/gpu/gl/debug/GrTextureUnitObj.h | 2 +- src/gpu/gl/debug/SkDebugGLContext.h | 4 +- src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp | 4 +- src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp | 12 +- src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp | 8 +- src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp | 12 +- src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp | 2 +- src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp | 2 +- src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp | 16 +- src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp | 8 +- src/gpu/gl/mesa/SkMesaGLContext.cpp | 14 +- src/gpu/gl/mesa/SkMesaGLContext.h | 4 +- src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp | 2 +- src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp | 14 +- src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp | 30 +- src/gpu/glsl/GrGLSL.h | 2 +- src/gpu/glsl/GrGLSLCaps.cpp | 4 +- 156 files changed, 1249 insertions(+), 1249 deletions(-) (limited to 'src/gpu') 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 fallbackTxt; SkTDArray 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* 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* fallbackTxt, SkTDArray* 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 texture(context->textureProvider()->createTexture(desc, true, NULL, 0)); + SkAutoTUnref 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(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(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 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(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 glyphs( static_cast( 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 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( sk_malloc_throw(sizeof(TAlign) * (length_of::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::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::alloc_back(int dataLength) { template class GrTRecorder::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::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::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 { // 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(src, head, NULL); + remove(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(v, *tail, NULL, head, tail); + insert(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 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 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 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, ¶ms, &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 outAlloc(NULL); + SkAutoTDeleteArray 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(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 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(bm.width()) || encodedHeight != static_cast(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(); 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 readTex(context->textureProvider()->createTexture(desc, true, NULL, 0)); + SkAutoTUnref readTex(context->textureProvider()->createTexture(desc, true, nullptr, 0)); if (!readTex.get()) { return; } - SkAutoTUnref tempTex(context->textureProvider()->createTexture(desc, true, NULL, 0)); + SkAutoTUnref 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( 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(); @@ -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(); @@ -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 SkTDynamicHashcount()) { 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(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(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(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(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(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(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(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(surface->asRenderTarget()); - if (NULL == rt) { + if (nullptr == rt) { SkASSERT(surface->asTexture()); GrGLuint texID = static_cast(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 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(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(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(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(versionStr)); if (version < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync")) { - return NULL; + return nullptr; } ret->fGLFenceSync = reinterpret_cast( 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( 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(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 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 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 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 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 static GrGLFuncPtr glx_get(void* ctx, const char name[]) { - SkASSERT(NULL == ctx); + SkASSERT(nullptr == ctx); SkASSERT(glXGetCurrentContext()); return glXGetProcAddress(reinterpret_cast(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 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 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(NULL)) - , fImage(NULL) { + : fContext(static_cast(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 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(NULL); + fContext = static_cast(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(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 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; } -- cgit v1.2.3