diff options
Diffstat (limited to 'src/core')
49 files changed, 197 insertions, 199 deletions
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp index f4e79fa828..4712abb2b2 100644 --- a/src/core/SkBBoxHierarchyRecord.cpp +++ b/src/core/SkBBoxHierarchyRecord.cpp @@ -34,9 +34,9 @@ SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* b SaveFlags flags) { // For now, assume all filters affect transparent black. // FIXME: This could be made less conservative as an optimization. - bool paintAffectsTransparentBlack = NULL != paint && - ((NULL != paint->getImageFilter()) || - (NULL != paint->getColorFilter())); + bool paintAffectsTransparentBlack = paint && + ((paint->getImageFilter()) || + (paint->getColorFilter())); SkRect drawBounds; if (paintAffectsTransparentBlack) { SkIRect deviceBounds; diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index adb69da1de..e28c6fdc34 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -153,12 +153,12 @@ bool SkBitmap::setAlphaType(SkAlphaType newAlphaType) { } void SkBitmap::updatePixelsFromRef() const { - if (NULL != fPixelRef) { + if (fPixelRef) { if (fPixelLockCount > 0) { SkASSERT(fPixelRef->isLocked()); void* p = fPixelRef->pixels(); - if (NULL != p) { + if (p) { p = (char*)p + fPixelRefOrigin.fY * fRowBytes + fPixelRefOrigin.fX * fInfo.bytesPerPixel(); @@ -221,7 +221,7 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, int dx, int dy) { } void SkBitmap::lockPixels() const { - if (NULL != fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) { + if (fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) { fPixelRef->lockPixels(); this->updatePixelsFromRef(); } @@ -231,7 +231,7 @@ void SkBitmap::lockPixels() const { void SkBitmap::unlockPixels() const { SkASSERT(NULL == fPixelRef || fPixelLockCount > 0); - if (NULL != fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) { + if (fPixelRef && 1 == sk_atomic_dec(&fPixelLockCount)) { fPixelRef->unlockPixels(); this->updatePixelsFromRef(); } @@ -376,7 +376,7 @@ bool SkBitmap::installMaskPixels(const SkMask& mask) { /////////////////////////////////////////////////////////////////////////////// void SkBitmap::freePixels() { - if (NULL != fPixelRef) { + if (fPixelRef) { if (fPixelLockCount > 0) { fPixelRef->unlockPixels(); } @@ -1103,7 +1103,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, SkMaskFilter* filter = paint ? paint->getMaskFilter() : NULL; // compute our (larger?) dst bounds if we have a filter - if (NULL != filter) { + if (filter) { identity.reset(); srcM.fImage = NULL; if (!filter->filterMask(&dstM, srcM, identity, NULL)) { @@ -1366,7 +1366,7 @@ void SkBitmap::toString(SkString* str) const { str->appendf(" pixels:%p", this->getPixels()); } else { const char* uri = pr->getURI(); - if (NULL != uri) { + if (uri) { str->appendf(" uri:\"%s\"", uri); } else { str->appendf(" pixelref:%p", pr); diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 068a107153..6c1dc30449 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -188,12 +188,12 @@ bool SkBitmapProcState::possiblyScaleImage() { } - SkASSERT(NULL != fScaledBitmap.getPixels()); + SkASSERT(fScaledBitmap.getPixels()); fScaledBitmap.setImmutable(); SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight, fScaledBitmap); } - SkASSERT(NULL != fScaledBitmap.getPixels()); + SkASSERT(fScaledBitmap.getPixels()); fBitmap = &fScaledBitmap; // set the inv matrix type to translate-only; diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp index 0fd2c7baf3..3501ac8a87 100644 --- a/src/core/SkBitmapScaler.cpp +++ b/src/core/SkBitmapScaler.cpp @@ -315,7 +315,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, *resultPtr = result; resultPtr->lockPixels(); - SkASSERT(NULL != resultPtr->getPixels()); + SkASSERT(resultPtr->getPixels()); return true; } diff --git a/src/core/SkBitmap_scroll.cpp b/src/core/SkBitmap_scroll.cpp index 00a72aa1ca..54158c2bec 100644 --- a/src/core/SkBitmap_scroll.cpp +++ b/src/core/SkBitmap_scroll.cpp @@ -15,7 +15,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, return false; } - if (NULL != subset) { + if (subset) { SkBitmap tmp; return this->extractSubset(&tmp, *subset) && @@ -29,14 +29,14 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, // check if there's nothing to do if ((dx | dy) == 0 || width <= 0 || height <= 0) { - if (NULL != inval) { + if (inval) { inval->setEmpty(); } return true; } // compute the inval region now, before we see if there are any pixels - if (NULL != inval) { + if (inval) { SkIRect r; r.set(0, 0, width, height); diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index b2da6aec6a..b9e9917891 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -700,7 +700,7 @@ public: virtual void toString(SkString* str) const SK_OVERRIDE { str->append("Sk3DShader: ("); - if (NULL != fProxy) { + if (fProxy) { str->append("Proxy: "); fProxy->toString(str); } @@ -875,7 +875,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device, shader = shader3D; } - if (NULL != mode) { + if (mode) { switch (interpret_xfermode(*paint, mode, device.colorType())) { case kSrcOver_XferInterp: mode = NULL; diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp index a91c0df0de..8771c199ef 100644 --- a/src/core/SkBlitter_RGB16.cpp +++ b/src/core/SkBlitter_RGB16.cpp @@ -1037,7 +1037,7 @@ SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint, SkXfermode* mode = paint.getXfermode(); // we require a shader if there is an xfermode, handled by our caller - SkASSERT(NULL == mode || NULL != shader); + SkASSERT(NULL == mode || shader); if (shader) { SkASSERT(shaderContext != NULL); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 87cadf4bba..cdc9489afc 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -83,7 +83,7 @@ struct DeviceCM { DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas) : fNext(NULL) { - if (NULL != device) { + if (device) { device->ref(); device->onAttachToCanvas(canvas); } @@ -92,7 +92,7 @@ struct DeviceCM { } ~DeviceCM() { - if (NULL != fDevice) { + if (fDevice) { fDevice->onDetachFromCanvas(); fDevice->unref(); } @@ -165,7 +165,7 @@ public: DeviceCM* fTopLayer; MCRec(const MCRec* prev) { - if (NULL != prev) { + if (prev) { fMatrix = prev->fMatrix; fRasterClip = prev->fRasterClip; @@ -769,7 +769,7 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags, op = SkRegion::kReplace_Op; } SkIRect ir; - if (NULL != bounds) { + if (bounds) { SkRect r; this->getTotalMatrix().mapRect(&r, *bounds); @@ -923,7 +923,7 @@ void SkCanvas::internalRestore() { since if we're being recorded, we don't want to record this (the recorder will have already recorded the restore). */ - if (NULL != layer) { + if (layer) { if (layer->fNext) { const SkIPoint& origin = layer->fDevice->getOrigin(); this->internalDrawDevice(layer->fDevice, origin.x(), origin.y(), @@ -1647,7 +1647,7 @@ bool SkCanvas::getClipBounds(SkRect* bounds) const { return false; } - if (NULL != bounds) { + if (bounds) { SkRect r; // adjust it outwards in case we are antialiasing const int inset = 1; @@ -1668,7 +1668,7 @@ bool SkCanvas::getClipDeviceBounds(SkIRect* bounds) const { return false; } - if (NULL != bounds) { + if (bounds) { *bounds = clip.getBounds(); } return true; @@ -1695,9 +1695,9 @@ SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) { GrContext* SkCanvas::getGrContext() { #if SK_SUPPORT_GPU SkBaseDevice* device = this->getTopDevice(); - if (NULL != device) { + if (device) { GrRenderTarget* renderTarget = device->accessRenderTarget(); - if (NULL != renderTarget) { + if (renderTarget) { return renderTarget->getContext(); } } @@ -1740,7 +1740,7 @@ void SkCanvas::clear(SkColor color) { } void SkCanvas::onDiscard() { - if (NULL != fSurfaceBase) { + if (fSurfaceBase) { fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); } } @@ -2244,7 +2244,7 @@ void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath& } void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { - if (NULL != blob) { + if (blob) { this->onDrawTextBlob(blob, x, y, paint); } } @@ -2412,19 +2412,19 @@ void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, /////////////////////////////////////////////////////////////////////////////// void SkCanvas::EXPERIMENTAL_optimize(const SkPicture* picture) { SkBaseDevice* device = this->getDevice(); - if (NULL != device) { + if (device) { device->EXPERIMENTAL_optimize(picture); } } void SkCanvas::drawPicture(const SkPicture* picture) { - if (NULL != picture) { + if (picture) { this->onDrawPicture(picture, NULL, NULL); } } void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) { - if (NULL != picture) { + if (picture) { if (matrix && matrix->isIdentity()) { matrix = NULL; } @@ -2435,7 +2435,7 @@ void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) { SkBaseDevice* device = this->getTopDevice(); - if (NULL != device) { + if (device) { // Canvas has to first give the device the opportunity to render // the picture itself. if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) { @@ -2551,17 +2551,17 @@ SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri : fCanvas(canvas) , fSaveCount(canvas->getSaveCount()) { - if (NULL != paint) { + if (paint) { SkRect newBounds = bounds; if (matrix) { matrix->mapRect(&newBounds); } canvas->saveLayer(&newBounds, paint); - } else if (NULL != matrix) { + } else if (matrix) { canvas->save(); } - if (NULL != matrix) { + if (matrix) { canvas->concat(*matrix); } } diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index 85746b2eaf..3093c314f4 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -597,7 +597,7 @@ void SkClipStack::restoreTo(int saveCount) { void SkClipStack::getBounds(SkRect* canvFiniteBound, BoundsType* boundType, bool* isIntersectionOfRects) const { - SkASSERT(NULL != canvFiniteBound && NULL != boundType); + SkASSERT(canvFiniteBound && boundType); Element* element = (Element*)fDeque.back(); @@ -605,7 +605,7 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound, // the clip is wide open - the infinite plane w/ no pixels un-writeable canvFiniteBound->setEmpty(); *boundType = kInsideOut_BoundsType; - if (NULL != isIntersectionOfRects) { + if (isIntersectionOfRects) { *isIntersectionOfRects = false; } return; @@ -613,13 +613,13 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound, *canvFiniteBound = element->fFiniteBound; *boundType = element->fFiniteBoundType; - if (NULL != isIntersectionOfRects) { + if (isIntersectionOfRects) { *isIntersectionOfRects = element->fIsIntersectionOfRects; } } bool SkClipStack::intersectRectWithClip(SkRect* rect) const { - SkASSERT(NULL != rect); + SkASSERT(rect); SkRect bounds; SkClipStack::BoundsType bt; @@ -667,7 +667,7 @@ void SkClipStack::pushElement(const Element& element) { SkDeque::Iter iter(fDeque, SkDeque::Iter::kBack_IterStart); Element* prior = (Element*) iter.prev(); - if (NULL != prior) { + if (prior) { if (prior->canBeIntersectedInPlace(fSaveCount, element.getOp())) { switch (prior->fType) { case Element::kEmpty_Type: @@ -766,7 +766,7 @@ const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) { const SkClipStack::Element* element = NULL; for (element = (const SkClipStack::Element*) fIter.prev(); - NULL != element; + element; element = (const SkClipStack::Element*) fIter.prev()) { if (op == element->fOp) { @@ -806,7 +806,7 @@ void SkClipStack::getConservativeBounds(int offsetX, int maxHeight, SkRect* devBounds, bool* isIntersectionOfRects) const { - SkASSERT(NULL != devBounds); + SkASSERT(devBounds); devBounds->setLTRB(0, 0, SkIntToScalar(maxWidth), SkIntToScalar(maxHeight)); diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp index b8e7b059e8..4d0a7950b2 100644 --- a/src/core/SkColorTable.cpp +++ b/src/core/SkColorTable.cpp @@ -31,7 +31,7 @@ SkColorTable::SkColorTable(const SkColorTable& src) : INHERITED() { SkColorTable::SkColorTable(const SkPMColor colors[], int count, SkAlphaType at) : f16BitCache(NULL), fAlphaType(SkToU8(at)) { - SkASSERT(0 == count || NULL != colors); + SkASSERT(0 == count || colors); if (count < 0) { count = 0; diff --git a/src/core/SkDeque.cpp b/src/core/SkDeque.cpp index d210dcf20b..27f3efcba4 100644 --- a/src/core/SkDeque.cpp +++ b/src/core/SkDeque.cpp @@ -100,7 +100,7 @@ void* SkDeque::push_front() { SkASSERT(NULL == fBack); fFront = fBack = begin; } else { - SkASSERT(NULL != fBack); + SkASSERT(fBack); fFront = begin; } @@ -141,7 +141,7 @@ void* SkDeque::push_back() { SkASSERT(NULL == fFront); fFront = fBack = end; } else { - SkASSERT(NULL != fFront); + SkASSERT(fFront); fBack = end; } @@ -169,14 +169,14 @@ void SkDeque::pop_front() { if (begin < fFrontBlock->fEnd) { first->fBegin = begin; - SkASSERT(NULL != first->fBegin); + SkASSERT(first->fBegin); fFront = first->fBegin; } else { first->fBegin = first->fEnd = NULL; // mark as empty if (NULL == first->fNext) { fFront = fBack = NULL; } else { - SkASSERT(NULL != first->fNext->fBegin); + SkASSERT(first->fNext->fBegin); fFront = first->fNext->fBegin; } } @@ -203,14 +203,14 @@ void SkDeque::pop_back() { if (end > last->fBegin) { last->fEnd = end; - SkASSERT(NULL != last->fEnd); + SkASSERT(last->fEnd); fBack = last->fEnd - fElemSize; } else { last->fBegin = last->fEnd = NULL; // mark as empty if (NULL == last->fPrev) { fFront = fBack = NULL; } else { - SkASSERT(NULL != last->fPrev->fEnd); + SkASSERT(last->fPrev->fEnd); fBack = last->fPrev->fEnd - fElemSize; } } @@ -293,14 +293,14 @@ void SkDeque::Iter::reset(const SkDeque& d, IterStart startLoc) { if (kFront_IterStart == startLoc) { // initialize the iterator to start at the front fCurBlock = d.fFrontBlock; - while (NULL != fCurBlock && NULL == fCurBlock->fBegin) { + while (fCurBlock && NULL == fCurBlock->fBegin) { fCurBlock = fCurBlock->fNext; } fPos = fCurBlock ? fCurBlock->fBegin : NULL; } else { // initialize the iterator to start at the back fCurBlock = d.fBackBlock; - while (NULL != fCurBlock && NULL == fCurBlock->fEnd) { + while (fCurBlock && NULL == fCurBlock->fEnd) { fCurBlock = fCurBlock->fPrev; } fPos = fCurBlock ? fCurBlock->fEnd - fElemSize : NULL; diff --git a/src/core/SkDistanceFieldGen.cpp b/src/core/SkDistanceFieldGen.cpp index ef0ee86d59..92cf1af20d 100755 --- a/src/core/SkDistanceFieldGen.cpp +++ b/src/core/SkDistanceFieldGen.cpp @@ -332,8 +332,8 @@ static unsigned char pack_distance_field_val(float dist, float distanceMagnitude static bool generate_distance_field_from_image(unsigned char* distanceField, const unsigned char* copyPtr, int width, int height) { - SkASSERT(NULL != distanceField); - SkASSERT(NULL != copyPtr); + SkASSERT(distanceField); + SkASSERT(copyPtr); // we expand our temp data by one more on each side to simplify // the scanning code -- will always be treated as infinitely far away @@ -462,8 +462,8 @@ static bool generate_distance_field_from_image(unsigned char* distanceField, bool SkGenerateDistanceFieldFromA8Image(unsigned char* distanceField, const unsigned char* image, int width, int height, int rowBytes) { - SkASSERT(NULL != distanceField); - SkASSERT(NULL != image); + SkASSERT(distanceField); + SkASSERT(image); // create temp data SkAutoSMalloc<1024> copyStorage((width+2)*(height+2)*sizeof(char)); @@ -490,8 +490,8 @@ bool SkGenerateDistanceFieldFromA8Image(unsigned char* distanceField, bool SkGenerateDistanceFieldFromBWImage(unsigned char* distanceField, const unsigned char* image, int width, int height, int rowBytes) { - SkASSERT(NULL != distanceField); - SkASSERT(NULL != image); + SkASSERT(distanceField); + SkASSERT(image); // create temp data SkAutoSMalloc<1024> copyStorage((width+2)*(height+2)*sizeof(char)); diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index d0d4f0718a..3532efd7e5 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -628,7 +628,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count, } case SkCanvas::kLines_PointMode: #ifndef SK_DISABLE_DASHING_OPTIMIZATION - if (2 == count && NULL != paint.getPathEffect()) { + if (2 == count && paint.getPathEffect()) { // most likely a dashed line - see if it is one of the ones // we can accelerate SkStrokeRec rec(paint); @@ -939,7 +939,7 @@ bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix& matrix, SkScalar len0 = fast_len(dst[0]); SkScalar len1 = fast_len(dst[1]); if (len0 <= SK_Scalar1 && len1 <= SK_Scalar1) { - if (NULL != coverage) { + if (coverage) { *coverage = SkScalarAve(len0, len1); } return true; @@ -2130,7 +2130,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int indexCount, const SkPaint& paint) const { - SkASSERT(0 == count || NULL != vertices); + SkASSERT(0 == count || vertices); // abort early if there is nothing to draw if (count < 3 || (indices && indexCount < 3) || fRC->isEmpty()) { @@ -2168,7 +2168,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, // setup the custom shader (if needed) SkAutoTUnref<SkComposeShader> composeShader; - if (NULL != colors) { + if (colors) { if (NULL == textures) { // just colors (no texture) shader = p.setShader(&triShader); @@ -2198,9 +2198,9 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, VertState state(count, indices, indexCount); VertState::Proc vertProc = state.chooseProc(vmode); - if (NULL != textures || NULL != colors) { + if (textures || colors) { while (vertProc(&state)) { - if (NULL != textures) { + if (textures) { SkMatrix tempM; if (texture_to_matrix(state, vertices, textures, &tempM)) { SkShader::ContextRec rec(*fBitmap, p, *fMatrix); @@ -2210,7 +2210,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, } } } - if (NULL != colors) { + if (colors) { // Find the context for triShader. SkTriColorShader::TriColorShaderContext* triColorShaderContext; diff --git a/src/core/SkEdge.cpp b/src/core/SkEdge.cpp index dd5ab5fbc6..ac0ca58c22 100644 --- a/src/core/SkEdge.cpp +++ b/src/core/SkEdge.cpp @@ -66,7 +66,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip, return 0; } // are we completely above or below the clip? - if (NULL != clip && (top >= clip->fBottom || bot <= clip->fTop)) { + if (clip && (top >= clip->fBottom || bot <= clip->fTop)) { return 0; } diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp index ae17be5a02..b0c1697d2b 100644 --- a/src/core/SkFlattenable.cpp +++ b/src/core/SkFlattenable.cpp @@ -114,7 +114,7 @@ SkFlattenable::Factory SkFlattenable::NameToFactory(const char name[]) { } bool SkFlattenable::NameToType(const char name[], SkFlattenable::Type* type) { - SkASSERT(NULL != type); + SkASSERT(type); InitializeFlattenablesIfNeeded(); #ifdef SK_DEBUG report_no_entries(__FUNCTION__); diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 3d29f9f38b..ab816f9407 100755 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -339,7 +339,7 @@ const void* SkGlyphCache::findImage(const SkGlyph& glyph) { const_cast<SkGlyph&>(glyph).fImage = fGlyphAlloc.alloc(size, SkChunkAlloc::kReturnNil_AllocFailType); // check that alloc() actually succeeded - if (NULL != glyph.fImage) { + if (glyph.fImage) { fScalerContext->getImage(glyph); // TODO: the scaler may have changed the maskformat during // getImage (e.g. from AA or LCD to BW) which means we may have @@ -373,10 +373,10 @@ const void* SkGlyphCache::findDistanceField(const SkGlyph& glyph) { } const void* image = this->findImage(glyph); // now generate the distance field - if (NULL != image) { + if (image) { const_cast<SkGlyph&>(glyph).fDistanceField = fGlyphAlloc.alloc(size, SkChunkAlloc::kReturnNil_AllocFailType); - if (NULL != glyph.fDistanceField) { + if (glyph.fDistanceField) { SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); if (SkMask::kA8_Format == maskFormat) { // make the distance field from the image diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index 551d8f78dc..7008e7b42f 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -60,10 +60,10 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) { #ifdef SK_DEBUG // In all cases, we need the sizes array - SkASSERT(NULL != sizes); + SkASSERT(sizes); - bool isValidWithPlanes = (NULL != planes) && (NULL != rowBytes) && - ((NULL != planes[0]) && (NULL != planes[1]) && (NULL != planes[2]) && + bool isValidWithPlanes = (planes) && (rowBytes) && + ((planes[0]) && (planes[1]) && (planes[2]) && (0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2])); bool isValidWithoutPlanes = ((NULL == planes) || diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp index ae29310aea..f4ba969662 100644 --- a/src/core/SkMallocPixelRef.cpp +++ b/src/core/SkMallocPixelRef.cpp @@ -30,7 +30,7 @@ static bool is_valid(const SkImageInfo& info, SkColorTable* ctable) { if (kIndex8_SkColorType == info.fColorType && NULL == ctable) { return false; } - if (kIndex8_SkColorType != info.fColorType && NULL != ctable) { + if (kIndex8_SkColorType != info.fColorType && ctable) { return false; } #endif diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h index 08ed97f913..fb67c1abc0 100644 --- a/src/core/SkMaskGamma.h +++ b/src/core/SkMaskGamma.h @@ -194,9 +194,7 @@ public: ~SkTMaskPreBlend() { } /** True if this PreBlend should be applied. When false, fR, fG, and fB are NULL. */ - bool isApplicable() const { - return NULL != this->fG; - } + bool isApplicable() const { return SkToBool(this->fG); } const uint8_t* fR; const uint8_t* fG; diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp index 814f16a5ea..2a295870dd 100644 --- a/src/core/SkMatrix.cpp +++ b/src/core/SkMatrix.cpp @@ -1766,15 +1766,15 @@ bool SkDecomposeUpper2x2(const SkMatrix& matrix, sin1 = -sin1; } - if (NULL != scale) { + if (scale) { scale->fX = SkDoubleToScalar(w1); scale->fY = SkDoubleToScalar(w2); } - if (NULL != rotation1) { + if (rotation1) { rotation1->fX = cos1; rotation1->fY = sin1; } - if (NULL != rotation2) { + if (rotation2) { rotation2->fX = cos2; rotation2->fY = sin2; } diff --git a/src/core/SkMessageBus.h b/src/core/SkMessageBus.h index f36c42b4c7..1290ea965f 100644 --- a/src/core/SkMessageBus.h +++ b/src/core/SkMessageBus.h @@ -85,7 +85,7 @@ void SkMessageBus<Message>::Inbox::receive(const Message& m) { template<typename Message> void SkMessageBus<Message>::Inbox::poll(SkTDArray<Message>* messages) { - SkASSERT(NULL != messages); + SkASSERT(messages); messages->reset(); SkAutoMutexAcquire lock(fMessagesMutex); messages->swap(fMessages); diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp index 50af2b717e..eb1e55e550 100644 --- a/src/core/SkMultiPictureDraw.cpp +++ b/src/core/SkMultiPictureDraw.cpp @@ -38,12 +38,12 @@ void SkMultiPictureDraw::add(SkCanvas* canvas, data->picture = SkRef(picture); data->canvas = SkRef(canvas); - if (NULL != matrix) { + if (matrix) { data->matrix = *matrix; } else { data->matrix.setIdentity(); } - if (NULL != paint) { + if (paint) { data->paint = SkNEW_ARGS(SkPaint, (*paint)); } else { data->paint = NULL; diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index d19efb0aa4..5d7c2cc3eb 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1040,7 +1040,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache, SkMeasureCacheProc glyphCacheProc; glyphCacheProc = this->getMeasureCacheProc(kForward_TextBufferDirection, - NULL != bounds); + bounds); int xyIndex; JoinBoundsProc joinBoundsProc; @@ -1298,7 +1298,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength, return 0; } - SkASSERT(NULL != textData); + SkASSERT(textData); if (NULL == widths && NULL == bounds) { return this->countText(textData, byteLength); @@ -1312,7 +1312,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength, SkGlyphCache* cache = autoCache.getCache(); SkMeasureCacheProc glyphCacheProc; glyphCacheProc = paint.getMeasureCacheProc(kForward_TextBufferDirection, - NULL != bounds); + bounds); const char* text = (const char*)textData; const char* stop = text + byteLength; @@ -2311,7 +2311,7 @@ void SkPaint::toString(SkString* str) const { str->append("<dl><dt>SkPaint:</dt><dd><dl>"); SkTypeface* typeface = this->getTypeface(); - if (NULL != typeface) { + if (typeface) { SkDynamicMemoryWStream ostream; typeface->serialize(&ostream); SkAutoTUnref<SkData> data(ostream.copyToData()); @@ -2343,60 +2343,60 @@ void SkPaint::toString(SkString* str) const { str->append("</dd>"); SkPathEffect* pathEffect = this->getPathEffect(); - if (NULL != pathEffect) { + if (pathEffect) { str->append("<dt>PathEffect:</dt><dd>"); str->append("</dd>"); } SkShader* shader = this->getShader(); - if (NULL != shader) { + if (shader) { str->append("<dt>Shader:</dt><dd>"); shader->toString(str); str->append("</dd>"); } SkXfermode* xfer = this->getXfermode(); - if (NULL != xfer) { + if (xfer) { str->append("<dt>Xfermode:</dt><dd>"); xfer->toString(str); str->append("</dd>"); } SkMaskFilter* maskFilter = this->getMaskFilter(); - if (NULL != maskFilter) { + if (maskFilter) { str->append("<dt>MaskFilter:</dt><dd>"); maskFilter->toString(str); str->append("</dd>"); } SkColorFilter* colorFilter = this->getColorFilter(); - if (NULL != colorFilter) { + if (colorFilter) { str->append("<dt>ColorFilter:</dt><dd>"); colorFilter->toString(str); str->append("</dd>"); } SkRasterizer* rasterizer = this->getRasterizer(); - if (NULL != rasterizer) { + if (rasterizer) { str->append("<dt>Rasterizer:</dt><dd>"); str->append("</dd>"); } SkDrawLooper* looper = this->getLooper(); - if (NULL != looper) { + if (looper) { str->append("<dt>DrawLooper:</dt><dd>"); looper->toString(str); str->append("</dd>"); } SkImageFilter* imageFilter = this->getImageFilter(); - if (NULL != imageFilter) { + if (imageFilter) { str->append("<dt>ImageFilter:</dt><dd>"); str->append("</dd>"); } SkAnnotation* annotation = this->getAnnotation(); - if (NULL != annotation) { + if (annotation) { str->append("<dt>Annotation:</dt><dd>"); str->append("</dd>"); } diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index c0049cad55..b89aec31fa 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -1914,7 +1914,7 @@ void SkPath::RawIter::setPath(const SkPath& path) { } SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) { - SkASSERT(NULL != pts); + SkASSERT(pts); if (fVerbs == fVerbStop) { return kDone_Verb; } @@ -2007,7 +2007,7 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) { SkDEBUGCODE(this->validate();) buffer.skipToAlign4(); sizeRead = buffer.pos(); - } else if (NULL != pathRef) { + } else if (pathRef) { // If the buffer is not valid, pathRef should be NULL sk_throw(); } diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index e60f618b4f..64f6fb86da 100644 --- a/src/core/SkPathRef.cpp +++ b/src/core/SkPathRef.cpp @@ -343,7 +343,7 @@ SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb, } if (SkPath::kConic_Verb == verb) { - SkASSERT(NULL != weights); + SkASSERT(weights); *weights = fConicWeights.append(numVbs); } diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index e80a17bd22..9cfa6a062e 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -234,7 +234,7 @@ bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason, (fNumAAConcavePaths - fNumAAHairlineConcavePaths) < kNumAAConcavePathsTol; - if (!ret && NULL != reason) { + if (!ret && reason) { if (!suitableForDash) { if (0 != sampleCount) { *reason = "Can't use multisample on dash effect."; @@ -296,7 +296,7 @@ void SkPicture::EXPERIMENTAL_addAccelData(const SkPicture::AccelData* data) cons // fRecord OK const SkPicture::AccelData* SkPicture::EXPERIMENTAL_getAccelData( SkPicture::AccelData::Key key) const { - if (NULL != fAccelData.get() && fAccelData->getKey() == key) { + if (fAccelData.get() && fAccelData->getKey() == key) { return fAccelData.get(); } return NULL; @@ -328,20 +328,20 @@ const SkMatrix& SkPicture::OperationList::matrix(int index) const { // fRecord OK void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) const { - SkASSERT(NULL != canvas); - SkASSERT(NULL != fData.get() || NULL != fRecord.get()); + SkASSERT(canvas); + SkASSERT(fData.get() || fRecord.get()); // If the query contains the whole picture, don't bother with the BBH. SkRect clipBounds = { 0, 0, 0, 0 }; (void)canvas->getClipBounds(&clipBounds); const bool useBBH = !clipBounds.contains(this->cullRect()); - if (NULL != fData.get()) { + if (fData.get()) { SkPicturePlayback playback(this); playback.setUseBBH(useBBH); playback.draw(canvas, callback); } - if (NULL != fRecord.get()) { + if (fRecord.get()) { SkRecordDraw(*fRecord, canvas, useBBH ? fBBH.get() : NULL, callback); } } @@ -531,10 +531,10 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { // If we're a new-format picture, backport to old format for serialization. SkAutoTDelete<SkPicture> oldFormat; - if (NULL == data && NULL != fRecord.get()) { + if (NULL == data && fRecord.get()) { oldFormat.reset(backport(*fRecord, this->cullRect())); data = oldFormat->fData.get(); - SkASSERT(NULL != data); + SkASSERT(data); } SkPictInfo info; @@ -542,7 +542,7 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { SkASSERT(sizeof(SkPictInfo) == 32); stream->write(&info, sizeof(info)); - if (NULL != data) { + if (data) { stream->writeBool(true); data->serialize(stream, encoder); } else { @@ -556,10 +556,10 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const { // If we're a new-format picture, backport to old format for serialization. SkAutoTDelete<SkPicture> oldFormat; - if (NULL == data && NULL != fRecord.get()) { + if (NULL == data && fRecord.get()) { oldFormat.reset(backport(*fRecord, this->cullRect())); data = oldFormat->fData.get(); - SkASSERT(NULL != data); + SkASSERT(data); } SkPictInfo info; @@ -569,7 +569,7 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const { buffer.writeRect(info.fCullRect); buffer.writeUInt(info.fFlags); - if (NULL != data) { + if (data) { buffer.writeBool(true); data->flatten(buffer); } else { @@ -584,7 +584,7 @@ bool SkPicture::suitableForGpuRasterization(GrContext* context, const char **rea return fAnalysis.suitableForGpuRasterization(reason, 0); } if (NULL == fData.get()) { - if (NULL != reason) { + if (reason) { *reason = "Missing internal data."; } return false; @@ -657,7 +657,7 @@ SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHi // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single // thread. void SkPicture::addDeletionListener(DeletionListener* listener) const { - SkASSERT(NULL != listener); + SkASSERT(listener); *fDeletionListeners.append() = SkRef(listener); } diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp index 1d19f352f4..937173c519 100644 --- a/src/core/SkPictureContentInfo.cpp +++ b/src/core/SkPictureContentInfo.cpp @@ -27,7 +27,7 @@ bool SkPictureContentInfo::suitableForGpuRasterization(GrContext* context, const bool ret = suitableForDash && (fNumAAConcavePaths - fNumAAHairlineConcavePaths) < kNumAAConcavePaths; - if (!ret && NULL != reason) { + if (!ret && reason) { if (!suitableForDash) { if (0 != sampleCount) { *reason = "Can't use multisample on dash effect."; @@ -66,7 +66,7 @@ void SkPictureContentInfo::onDrawPath(const SkPath& path, const SkPaint& paint) } void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) { - if (NULL != paint && NULL != paint->getPathEffect()) { + if (paint && paint->getPathEffect()) { ++fNumPaintWithPathEffectUses; } } diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp index e5a004ef3a..a2d10e3b9b 100644 --- a/src/core/SkPictureData.cpp +++ b/src/core/SkPictureData.cpp @@ -30,7 +30,7 @@ SkPictureData::SkPictureData(const SkPictInfo& info) void SkPictureData::initForPlayback() const { // ensure that the paths bounds are pre-computed - if (NULL != fPathHeap.get()) { + if (fPathHeap.get()) { for (int i = 0; i < fPathHeap->count(); i++) { (*fPathHeap.get())[i].updateBoundsCache(); } @@ -53,7 +53,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record, SkSafeRef(fStateTree); fContentInfo.set(record.fContentInfo); - if (NULL != fBoundingHierarchy) { + if (fBoundingHierarchy) { fBoundingHierarchy->flushDeferredInserts(); } diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h index 019bfb2f9a..d2b5b4af67 100644 --- a/src/core/SkPictureData.h +++ b/src/core/SkPictureData.h @@ -142,7 +142,7 @@ public: void initIterator(SkPictureStateTree::Iterator* iter, const SkTDArray<void*>& draws, SkCanvas* canvas) const { - if (NULL != fStateTree) { + if (fStateTree) { fStateTree->initIterator(iter, draws, canvas); } } diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 78b65d6d7b..308ce9ec3f 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -83,7 +83,7 @@ bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter, SkCanvas* canvas, const SkPicture::OperationList *activeOpsList) { - if (NULL != activeOpsList) { + if (activeOpsList) { if (0 == activeOpsList->numOps()) { return false; // nothing to draw } @@ -150,7 +150,7 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) SkAutoCanvasRestore acr(canvas, false); while (!reader.eof()) { - if (NULL != callback && callback->abortDrawing()) { + if (callback && callback->abortDrawing()) { return; } diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 6114fee5e7..cdfa8efe18 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -68,7 +68,7 @@ protected: public: AutoResetOpID(SkPicturePlayback* playback) : fPlayback(playback) { } ~AutoResetOpID() { - if (NULL != fPlayback) { + if (fPlayback) { fPlayback->resetOpID(); } } diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 67bd9a548b..a6b6f61393 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -190,7 +190,7 @@ void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint // op + bool for 'bounds' size_t size = 2 * kUInt32Size; - if (NULL != bounds) { + if (bounds) { size += sizeof(*bounds); // + rect } // + paint index + flags @@ -558,12 +558,12 @@ static void apply_optimization_to_bbh(PictureRecordOptType opt, SkPictureStateTr SkBBoxHierarchy* boundingHierarchy) { switch (opt) { case kCollapseSaveLayer_OptType: - if (NULL != stateTree) { + if (stateTree) { stateTree->saveCollapsed(); } break; case kRewind_OptType: - if (NULL != boundingHierarchy) { + if (boundingHierarchy) { boundingHierarchy->rewindInserts(); } // Note: No need to touch the state tree for this to work correctly. @@ -596,7 +596,7 @@ void SkPictureRecord::willRestore() { if (fOptsEnabled) { for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) { if (0 != (gPictureRecordOpts[opt].fFlags & kSkipIfBBoxHierarchy_Flag) - && NULL != fBoundingHierarchy) { + && fBoundingHierarchy) { continue; } if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) { @@ -972,7 +972,7 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* // id + paint index + bitmap index + bool for 'src' + flags size_t size = 5 * kUInt32Size; - if (NULL != src) { + if (src) { size += sizeof(*src); // + rect } size += sizeof(dst); // + rect @@ -1264,7 +1264,7 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, if (indexCount > 0) { flags |= DRAW_VERTICES_HAS_INDICES; } - if (NULL != xfer) { + if (xfer) { SkXfermode::Mode mode; if (xfer->asMode(&mode) && SkXfermode::kModulate_Mode != mode) { flags |= DRAW_VERTICES_HAS_XFER; @@ -1318,15 +1318,15 @@ void SkPictureRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors // op + paint index + patch 12 control points + flag + patch 4 colors + 4 texture coordinates size_t size = 2 * kUInt32Size + SkPatchUtils::kNumCtrlPts * sizeof(SkPoint) + kUInt32Size; uint32_t flag = 0; - if (NULL != colors) { + if (colors) { flag |= DRAW_VERTICES_HAS_COLORS; size += SkPatchUtils::kNumCorners * sizeof(SkColor); } - if (NULL != texCoords) { + if (texCoords) { flag |= DRAW_VERTICES_HAS_TEXS; size += SkPatchUtils::kNumCorners * sizeof(SkPoint); } - if (NULL != xmode) { + if (xmode) { SkXfermode::Mode mode; if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) { flag |= DRAW_VERTICES_HAS_XFER; @@ -1341,10 +1341,10 @@ void SkPictureRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors this->addInt(flag); // write optional parameters - if (NULL != colors) { + if (colors) { fWriter.write(colors, SkPatchUtils::kNumCorners * sizeof(SkColor)); } - if (NULL != texCoords) { + if (texCoords) { fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint)); } if (flag & DRAW_VERTICES_HAS_XFER) { diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index 92deac36d2..77274e675e 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -35,11 +35,11 @@ SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar const SkISize size = SkISize::Make(width, height); - if (NULL != bbhFactory) { + if (bbhFactory) { // We don't need to hold a ref on the BBH ourselves, but might as well for // consistency with EXPERIMENTAL_beginRecording(), which does need to. fBBH.reset((*bbhFactory)(width, height)); - SkASSERT(NULL != fBBH.get()); + SkASSERT(fBBH.get()); fPictureRecord.reset(SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordFlags, fBBH.get()))); } else { fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (size, recordFlags))); @@ -54,9 +54,9 @@ SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala fCullWidth = width; fCullHeight = height; - if (NULL != bbhFactory) { + if (bbhFactory) { fBBH.reset((*bbhFactory)(width, height)); - SkASSERT(NULL != fBBH.get()); + SkASSERT(fBBH.get()); } fRecord.reset(SkNEW(SkRecord)); @@ -65,7 +65,7 @@ SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala } SkCanvas* SkPictureRecorder::getRecordingCanvas() { - if (NULL != fRecorder.get()) { + if (fRecorder.get()) { return fRecorder.get(); } return fPictureRecord.get(); @@ -74,12 +74,12 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() { SkPicture* SkPictureRecorder::endRecording() { SkPicture* picture = NULL; - if (NULL != fRecord.get()) { + if (fRecord.get()) { picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, fRecord.detach(), fBBH.get())); } - if (NULL != fPictureRecord.get()) { + if (fPictureRecord.get()) { fPictureRecord->endRecording(); const bool deepCopyOps = false; picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, @@ -90,7 +90,7 @@ SkPicture* SkPictureRecorder::endRecording() { } void SkPictureRecorder::internalOnly_EnableOpts(bool enableOpts) { - if (NULL != fPictureRecord.get()) { + if (fPictureRecord.get()) { fPictureRecord->internalOnly_EnableOpts(enableOpts); } } @@ -100,11 +100,11 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { return; } - if (NULL != fRecord.get()) { + if (fRecord.get()) { SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); } - if (NULL != fPictureRecord.get()) { + if (fPictureRecord.get()) { const bool deepCopyOps = true; SkPicture picture(fCullWidth, fCullHeight, *fPictureRecord.get(), deepCopyOps); diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index a7b5412b5a..03eeb74c52 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -22,7 +22,7 @@ SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod const SkMatrix* localMatrix, const SkRect* tile) : INHERITED(localMatrix) , fPicture(SkRef(picture)) - , fTile(NULL != tile ? *tile : picture->cullRect()) + , fTile(tile ? *tile : picture->cullRect()) , fTmx(tmx) , fTmy(tmy) { } @@ -42,7 +42,7 @@ SkPictureShader::~SkPictureShader() { SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy, const SkMatrix* localMatrix, const SkRect* tile) { - if (!picture || picture->cullRect().isEmpty() || (NULL != tile && tile->isEmpty())) { + if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) { return NULL; } return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile)); diff --git a/src/core/SkPictureStateTree.cpp b/src/core/SkPictureStateTree.cpp index d2f0e6efcd..704a04ebee 100644 --- a/src/core/SkPictureStateTree.cpp +++ b/src/core/SkPictureStateTree.cpp @@ -46,7 +46,7 @@ void SkPictureStateTree::appendSaveLayer(size_t offset) { } void SkPictureStateTree::saveCollapsed() { - SkASSERT(NULL != fLastRestoredNode); + SkASSERT(fLastRestoredNode); SkASSERT(SkToBool(fLastRestoredNode->fFlags & \ (Node::kSaveLayer_Flag | Node::kSave_Flag))); SkASSERT(fLastRestoredNode->fParent == fCurrentState.fNode); @@ -102,7 +102,7 @@ void SkPictureStateTree::Iterator::init(const SkTDArray<void*>& draws, SkCanvas* } void SkPictureStateTree::Iterator::setCurrentMatrix(const SkMatrix* matrix) { - SkASSERT(NULL != matrix); + SkASSERT(matrix); if (matrix == fCurrentMatrix) { return; diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp index 8a6d0564af..5fee0e80c2 100644 --- a/src/core/SkPoint.cpp +++ b/src/core/SkPoint.cpp @@ -224,7 +224,7 @@ SkScalar SkPoint::distanceToLineBetweenSqd(const SkPoint& a, SkScalar uLengthSqd = u.lengthSqd(); SkScalar det = u.cross(v); - if (NULL != side) { + if (side) { SkASSERT(-1 == SkPoint::kLeft_Side && 0 == SkPoint::kOn_Side && 1 == kRight_Side); diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp index 77f94e2eed..17872badc3 100644 --- a/src/core/SkRTree.cpp +++ b/src/core/SkRTree.cpp @@ -75,7 +75,7 @@ void SkRTree::insert(void* data, const SkRect& fbounds, bool defer) { Branch* newSibling = insert(fRoot.fChild.subtree, &newBranch); fRoot.fBounds = this->computeBounds(fRoot.fChild.subtree); - if (NULL != newSibling) { + if (newSibling) { Node* oldRoot = fRoot.fChild.subtree; Node* newRoot = this->allocateNode(oldRoot->fLevel + 1); newRoot->fNumChildren = 2; @@ -143,7 +143,7 @@ SkRTree::Branch* SkRTree::insert(Node* root, Branch* branch, uint16_t level) { root->child(childIndex)->fBounds = this->computeBounds( root->child(childIndex)->fChild.subtree); } - if (NULL != toInsert) { + if (toInsert) { if (root->fNumChildren == fMaxChildren) { // handle overflow by splitting. TODO: opportunistic reinsertion diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index 3845a5c3dc..ac1e429f12 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -14,7 +14,7 @@ void SkRecordDraw(const SkRecord& record, SkDrawPictureCallback* callback) { SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); - if (NULL != bbh) { + if (bbh) { // Draw only ops that affect pixels in the canvas's current clip. // The SkRecord and BBH were recorded in identity space. This canvas // is not necessarily in that same space. getClipBounds() returns us @@ -28,7 +28,7 @@ void SkRecordDraw(const SkRecord& record, SkRecords::Draw draw(canvas); for (int i = 0; i < ops.count(); i++) { - if (NULL != callback && callback->abortDrawing()) { + if (callback && callback->abortDrawing()) { return; } record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds below. @@ -37,7 +37,7 @@ void SkRecordDraw(const SkRecord& record, // Draw all ops. SkRecords::Draw draw(canvas); for (unsigned i = 0; i < record.count(); i++) { - if (NULL != callback && callback->abortDrawing()) { + if (callback && callback->abortDrawing()) { return; } record.visit<void>(i, draw); @@ -154,7 +154,7 @@ public: } // Finally feed all stored bounds into the BBH. They'll be returned in this order. - SkASSERT(NULL != bbh); + SkASSERT(bbh); for (uintptr_t i = 0; i < record.count(); i++) { if (!fBounds[i].isEmpty()) { bbh->insert((void*)i, fBounds[i], true/*ok to defer*/); diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp index 7ffdfffbaf..73f788cd17 100644 --- a/src/core/SkResourceCache.cpp +++ b/src/core/SkResourceCache.cpp @@ -222,7 +222,7 @@ const SkResourceCache::Rec* SkResourceCache::addAndLock(Rec* rec) { SkASSERT(rec); // See if we already have this key (racy inserts, etc.) const Rec* existing = this->findAndLock(rec->getKey()); - if (NULL != existing) { + if (existing) { SkDELETE(rec); return existing; } @@ -242,7 +242,7 @@ void SkResourceCache::add(Rec* rec) { SkASSERT(rec); // See if we already have this key (racy inserts, etc.) const Rec* existing = this->findAndLock(rec->getKey()); - if (NULL != existing) { + if (existing) { SkDELETE(rec); this->unlock(existing); return; @@ -414,9 +414,9 @@ void SkResourceCache::validate() const { } SkASSERT(NULL == fHead->fPrev); - SkASSERT(NULL != fHead->fNext); + SkASSERT(fHead->fNext); SkASSERT(NULL == fTail->fNext); - SkASSERT(NULL != fTail->fPrev); + SkASSERT(fTail->fPrev); size_t used = 0; int count = 0; diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp index b32d68e734..0d95061b6b 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp @@ -727,7 +727,7 @@ void SkScan::FillTriangle(const SkPoint pts[], const SkRasterClip& clip, SkScanClipper clipper(blitter, clipRgn, ir); blitter = clipper.getBlitter(); - if (NULL != blitter) { + if (blitter) { sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir); } } diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp index a4ae41c689..142d6ca299 100644 --- a/src/core/SkSpriteBlitter_ARGB32.cpp +++ b/src/core/SkSpriteBlitter_ARGB32.cpp @@ -135,12 +135,12 @@ public: do { const SkPMColor* tmp = src; - if (NULL != colorFilter) { + if (colorFilter) { colorFilter->filterSpan(src, width, fBuffer); tmp = fBuffer; } - if (NULL != xfermode) { + if (xfermode) { xfermode->xfer32(dst, tmp, width, NULL); } else { fProc32(dst, tmp, width, fAlpha); @@ -183,10 +183,10 @@ public: do { fillbuffer(buffer, src, width); - if (NULL != colorFilter) { + if (colorFilter) { colorFilter->filterSpan(buffer, width, buffer); } - if (NULL != xfermode) { + if (xfermode) { xfermode->xfer32(dst, buffer, width, NULL); } else { fProc32(dst, buffer, width, fAlpha); diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp index 5069bb0a7e..ca9f51f061 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp @@ -255,7 +255,7 @@ SkStreamAsset* SkFILEStream::duplicate() const { return new SkMemoryStream(); } - if (NULL != fData.get()) { + if (fData.get()) { return new SkMemoryStream(fData); } diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h index 496dc8d141..23544c8b86 100644 --- a/src/core/SkTDynamicHash.h +++ b/src/core/SkTDynamicHash.h @@ -114,13 +114,13 @@ public: // Remove the entry with this key. We require that an entry with this key is present. void remove(const Key& key) { - SkASSERT(NULL != this->find(key)); + SkASSERT(this->find(key)); this->innerRemove(key); SkASSERT(this->validate()); } void rewind() { - if (NULL != fArray) { + if (fArray) { sk_bzero(fArray, sizeof(T*)* fCapacity); } fCount = 0; @@ -177,7 +177,7 @@ private: deleted++; } else if (Empty() != fArray[i]) { count++; - SKTDYNAMICHASH_CHECK(NULL != this->find(GetKey(*fArray[i]))); + SKTDYNAMICHASH_CHECK(this->find(GetKey(*fArray[i]))); } } SKTDYNAMICHASH_CHECK(count == fCount); diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h index e2b9691430..5cb74cf72b 100644 --- a/src/core/SkTLList.h +++ b/src/core/SkTLList.h @@ -53,7 +53,7 @@ public: this->validate(); typename NodeList::Iter iter; Node* node = iter.init(fList, Iter::kHead_IterStart); - while (NULL != node) { + while (node) { SkTCast<T*>(node->fObj)->~T(); Block* block = node->fBlock; node = iter.next(); @@ -126,7 +126,7 @@ public: void popHead() { this->validate(); Node* node = fList.head(); - if (NULL != node) { + if (node) { this->removeNode(node); } this->validate(); @@ -135,7 +135,7 @@ public: void popTail() { this->validate(); Node* node = fList.head(); - if (NULL != node) { + if (node) { this->removeNode(node); } this->validate(); @@ -175,7 +175,7 @@ public: for (Iter a(*this, Iter::kHead_IterStart), b(list, Iter::kHead_IterStart); a.get(); a.next(), b.next()) { - SkASSERT(NULL != b.get()); // already checked that counts match. + SkASSERT(b.get()); // already checked that counts match. if (!(*a.get() == *b.get())) { return false; } @@ -219,7 +219,7 @@ public: Node* getNode() { return INHERITED::get(); } T* nodeToObj(Node* node) { - if (NULL != node) { + if (node) { return reinterpret_cast<T*>(node->fObj); } else { return NULL; @@ -243,7 +243,7 @@ private: Node* createNode() { Node* node = fFreeList.head(); - if (NULL != node) { + if (node) { fFreeList.remove(node); ++node->fBlock->fNodesInUse; } else { @@ -263,7 +263,7 @@ private: } void removeNode(Node* node) { - SkASSERT(NULL != node); + SkASSERT(node); fList.remove(node); SkTCast<T*>(node->fObj)->~T(); if (0 == --node->fBlock->fNodesInUse) { @@ -369,7 +369,7 @@ template <typename T> void *operator new(size_t, SkTLList<T>* list, typename SkTLList<T>::Placement placement, const typename SkTLList<T>::Iter& location) { - SkASSERT(NULL != list); + SkASSERT(list); if (SkTLList<T>::kBefore_Placement == placement) { return list->internalAddBefore(location); } else { diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp index f7bf3048c3..3f78a2434c 100755 --- a/src/core/SkTLS.cpp +++ b/src/core/SkTLS.cpp @@ -45,7 +45,7 @@ void SkTLS::Destructor(void* ptr) { SkTLSRec* next = rec->fNext; SkDELETE(rec); rec = next; - } while (NULL != rec); + } while (rec); } void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) { diff --git a/src/core/SkTMultiMap.h b/src/core/SkTMultiMap.h index c0b59ba0b9..70076f0cad 100644 --- a/src/core/SkTMultiMap.h +++ b/src/core/SkTMultiMap.h @@ -37,7 +37,7 @@ public: void insert(const Key& key, T* value) { ValueList* list = fHash.find(key); - if (NULL != list) { + if (list) { // The new ValueList entry is inserted as the second element in the // linked list, and it will contain the value of the first element. ValueList* newEntry = SkNEW_ARGS(ValueList, (list->fValue)); @@ -57,19 +57,19 @@ public: ValueList* list = fHash.find(key); // Since we expect the caller to be fully aware of what is stored, just // assert that the caller removes an existing value. - SkASSERT(NULL != list); + SkASSERT(list); ValueList* prev = NULL; while (list->fValue != value) { prev = list; list = list->fNext; } - if (NULL != list->fNext) { + if (list->fNext) { ValueList* next = list->fNext; list->fValue = next->fValue; list->fNext = next->fNext; SkDELETE(next); - } else if (NULL != prev) { + } else if (prev) { prev->fNext = NULL; SkDELETE(list); } else { @@ -82,7 +82,7 @@ public: T* find(const Key& key) const { ValueList* list = fHash.find(key); - if (NULL != list) { + if (list) { return list->fValue; } return NULL; @@ -91,7 +91,7 @@ public: template<class FindPredicate> T* find(const Key& key, const FindPredicate f) { ValueList* list = fHash.find(key); - while (NULL != list) { + while (list) { if (f(list->fValue)){ return list->fValue; } diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp index d928d7bc25..ee110c7d07 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -112,7 +112,7 @@ const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) { SkTextBlob::RunIterator::RunIterator(const SkTextBlob* blob) : fBlob(blob) , fIndex(0) { - SkASSERT(NULL != blob); + SkASSERT(blob); } bool SkTextBlob::RunIterator::done() const { @@ -194,7 +194,7 @@ SkTextBlobBuilder::~SkTextBlobBuilder() { } void SkTextBlobBuilder::updateDeferredBounds() { - SkASSERT(!fDeferredBounds || (NULL != fRuns && !fRuns->empty())); + SkASSERT(!fDeferredBounds || (fRuns && !fRuns->empty())); if (!fDeferredBounds) { return; @@ -249,7 +249,7 @@ void SkTextBlobBuilder::allocInternal(const SkPaint &font, fGlyphBuffer.append(count); fPosBuffer.append(count * posScalarsPerGlyph); - SkASSERT(NULL != fRuns && !fRuns->empty()); + SkASSERT(fRuns && !fRuns->empty()); SkTextBlob::Run& run = fRuns->back(); run.count += count; @@ -264,7 +264,7 @@ void SkTextBlobBuilder::allocInternal(const SkPaint &font, SkASSERT(NULL == fCurrentRunBuffer.pos || fCurrentRunBuffer.pos >= fPosBuffer.begin()); if (!fDeferredBounds) { - if (NULL != bounds) { + if (bounds) { fBounds.join(*bounds); } else { fDeferredBounds = true; @@ -301,7 +301,7 @@ const SkTextBlob* SkTextBlobBuilder::build() { if (fGlyphBuffer.count() > 0) { // we have some glyphs, construct a real blob - SkASSERT(NULL != fRuns && !fRuns->empty()); + SkASSERT(fRuns && !fRuns->empty()); this->updateDeferredBounds(); diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp index eff718b20f..b063071932 100644 --- a/src/core/SkUtils.cpp +++ b/src/core/SkUtils.cpp @@ -193,7 +193,7 @@ int SkUTF8_CountUnichars(const char utf8[]) { } int SkUTF8_CountUnichars(const char utf8[], size_t byteLength) { - SkASSERT(NULL != utf8 || 0 == byteLength); + SkASSERT(utf8 || 0 == byteLength); int count = 0; const char* stop = utf8 + byteLength; @@ -206,7 +206,7 @@ int SkUTF8_CountUnichars(const char utf8[], size_t byteLength) { } SkUnichar SkUTF8_ToUnichar(const char utf8[]) { - SkASSERT(NULL != utf8); + SkASSERT(utf8); const uint8_t* p = (const uint8_t*)utf8; int c = *p; @@ -227,7 +227,7 @@ SkUnichar SkUTF8_ToUnichar(const char utf8[]) { } SkUnichar SkUTF8_NextUnichar(const char** ptr) { - SkASSERT(NULL != ptr && NULL != *ptr); + SkASSERT(ptr && *ptr); const uint8_t* p = (const uint8_t*)*ptr; int c = *p; @@ -249,7 +249,7 @@ SkUnichar SkUTF8_NextUnichar(const char** ptr) { } SkUnichar SkUTF8_PrevUnichar(const char** ptr) { - SkASSERT(NULL != ptr && NULL != *ptr); + SkASSERT(ptr && *ptr); const char* p = *ptr; diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index b10b5e1328..91aa84706b 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -840,7 +840,7 @@ public: } else { dstColor = fsBuilder->dstColor(); } - SkASSERT(NULL != dstColor); + SkASSERT(dstColor); // We don't try to optimize for this case at all if (NULL == inputColor) { @@ -1298,7 +1298,7 @@ void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst, SkXfermodeProc proc = fProc; - if (NULL != proc) { + if (proc) { if (NULL == aa) { for (int i = count - 1; i >= 0; --i) { dst[i] = proc(src[i], dst[i]); @@ -1326,7 +1326,7 @@ void SkProcCoeffXfermode::xfer16(uint16_t* SK_RESTRICT dst, SkXfermodeProc proc = fProc; - if (NULL != proc) { + if (proc) { if (NULL == aa) { for (int i = count - 1; i >= 0; --i) { SkPMColor dstC = SkPixel16ToPixel32(dst[i]); @@ -1355,7 +1355,7 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst, SkXfermodeProc proc = fProc; - if (NULL != proc) { + if (proc) { if (NULL == aa) { for (int i = count - 1; i >= 0; --i) { SkPMColor res = proc(src[i], dst[i] << SK_A32_SHIFT); @@ -1381,9 +1381,9 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst, #if SK_SUPPORT_GPU bool SkProcCoeffXfermode::asNewEffect(GrEffect** effect, GrTexture* background) const { if (XferEffect::IsSupportedMode(fMode)) { - if (NULL != effect) { + if (effect) { *effect = XferEffect::Create(fMode, background); - SkASSERT(NULL != *effect); + SkASSERT(*effect); } return true; } @@ -1594,7 +1594,7 @@ void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst, if (count <= 0) { return; } - if (NULL != aa) { + if (aa) { return this->INHERITED::xfer32(dst, src, count, aa); } @@ -1641,7 +1641,7 @@ void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst, if (count <= 0) { return; } - if (NULL != aa) { + if (aa) { return this->INHERITED::xfer32(dst, src, count, aa); } |