Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 191194eb509904ee623d95888b58e8acf0dcc0d5..3f1d1c806dc0a3fc50e11dbe0942cd4823704c66 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -32,7 +32,7 @@ GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { |
fVerticesPerInstance = di.fVerticesPerInstance; |
fIndicesPerInstance = di.fIndicesPerInstance; |
- if (NULL != di.fDevBounds) { |
+ if (di.fDevBounds) { |
SkASSERT(di.fDevBounds == &di.fDevBoundsStorage); |
fDevBoundsStorage = di.fDevBoundsStorage; |
fDevBounds = &fDevBoundsStorage; |
@@ -91,7 +91,7 @@ GrDrawTarget::GrDrawTarget(GrContext* context) |
: fClip(NULL) |
, fContext(context) |
, fGpuTraceMarkerCount(0) { |
- SkASSERT(NULL != context); |
+ SkASSERT(context); |
fDrawState = &fDefaultDrawState; |
// We assume that fDrawState always owns a ref to the object it points at. |
@@ -135,7 +135,7 @@ const GrClipData* GrDrawTarget::getClip() const { |
} |
void GrDrawTarget::setDrawState(GrDrawState* drawState) { |
- SkASSERT(NULL != fDrawState); |
+ SkASSERT(fDrawState); |
if (NULL == drawState) { |
drawState = &fDefaultDrawState; |
} |
@@ -152,7 +152,7 @@ bool GrDrawTarget::reserveVertexSpace(size_t vertexSize, |
GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); |
bool acquired = false; |
if (vertexCount > 0) { |
- SkASSERT(NULL != vertices); |
+ SkASSERT(vertices); |
this->releasePreviousVertexSource(); |
geoSrc.fVertexSrc = kNone_GeometrySrcType; |
@@ -164,7 +164,7 @@ bool GrDrawTarget::reserveVertexSpace(size_t vertexSize, |
geoSrc.fVertexSrc = kReserved_GeometrySrcType; |
geoSrc.fVertexCount = vertexCount; |
geoSrc.fVertexSize = vertexSize; |
- } else if (NULL != vertices) { |
+ } else if (vertices) { |
*vertices = NULL; |
} |
return acquired; |
@@ -175,7 +175,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount, |
GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); |
bool acquired = false; |
if (indexCount > 0) { |
- SkASSERT(NULL != indices); |
+ SkASSERT(indices); |
this->releasePreviousIndexSource(); |
geoSrc.fIndexSrc = kNone_GeometrySrcType; |
@@ -184,7 +184,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount, |
if (acquired) { |
geoSrc.fIndexSrc = kReserved_GeometrySrcType; |
geoSrc.fIndexCount = indexCount; |
- } else if (NULL != indices) { |
+ } else if (indices) { |
*indices = NULL; |
} |
return acquired; |
@@ -218,10 +218,10 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(int vertexCount, |
bool GrDrawTarget::geometryHints(int32_t* vertexCount, |
int32_t* indexCount) const { |
- if (NULL != vertexCount) { |
+ if (vertexCount) { |
*vertexCount = -1; |
} |
- if (NULL != indexCount) { |
+ if (indexCount) { |
*indexCount = -1; |
} |
return false; |
@@ -387,7 +387,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, |
} |
} |
- SkASSERT(NULL != drawState.getRenderTarget()); |
+ SkASSERT(drawState.getRenderTarget()); |
if (drawState.hasGeometryProcessor()) { |
const GrEffect* effect = drawState.getGeometryProcessor()->getEffect(); |
@@ -432,7 +432,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(GrDeviceCoordTexture* dstCopy, const |
const GrClipData* clip = this->getClip(); |
clip->getConservativeBounds(rt, ©Rect); |
- if (NULL != drawBounds) { |
+ if (drawBounds) { |
SkIRect drawIBounds; |
drawBounds->roundOut(&drawIBounds); |
if (!copyRect.intersect(drawIBounds)) { |
@@ -488,7 +488,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type, |
info.fVerticesPerInstance = 0; |
info.fIndicesPerInstance = 0; |
- if (NULL != devBounds) { |
+ if (devBounds) { |
info.setDevBounds(*devBounds); |
} |
// TODO: We should continue with incorrect blending. |
@@ -515,7 +515,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type, |
info.fVerticesPerInstance = 0; |
info.fIndicesPerInstance = 0; |
- if (NULL != devBounds) { |
+ if (devBounds) { |
info.setDevBounds(*devBounds); |
} |
// TODO: We should continue with incorrect blending. |
@@ -528,7 +528,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type, |
void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) { |
// TODO: extract portions of checkDraw that are relevant to path stenciling. |
- SkASSERT(NULL != path); |
+ SkASSERT(path); |
SkASSERT(this->caps()->pathRenderingSupport()); |
SkASSERT(!SkPath::IsInverseFillType(fill)); |
this->onStencilPath(path, fill); |
@@ -536,7 +536,7 @@ void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) { |
void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) { |
// TODO: extract portions of checkDraw that are relevant to path rendering. |
- SkASSERT(NULL != path); |
+ SkASSERT(path); |
SkASSERT(this->caps()->pathRenderingSupport()); |
const GrDrawState* drawState = &getDrawState(); |
@@ -563,9 +563,9 @@ void GrDrawTarget::drawPaths(const GrPathRange* pathRange, |
const float transforms[], PathTransformType transformsType, |
SkPath::FillType fill) { |
SkASSERT(this->caps()->pathRenderingSupport()); |
- SkASSERT(NULL != pathRange); |
- SkASSERT(NULL != indices); |
- SkASSERT(NULL != transforms); |
+ SkASSERT(pathRange); |
+ SkASSERT(indices); |
+ SkASSERT(transforms); |
// Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt |
// instead for it to just copy the entire dst. Realistically this is a moot |
@@ -645,7 +645,7 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, |
info.fVerticesPerInstance = verticesPerInstance; |
// Set the same bounds for all the draws. |
- if (NULL != devBounds) { |
+ if (devBounds) { |
info.setDevBounds(*devBounds); |
} |
// TODO: We should continue with incorrect blending. |
@@ -694,7 +694,7 @@ void GrDrawTarget::onDrawRect(const SkRect& rect, |
const SkRect* localRect, |
const SkMatrix* localMatrix) { |
- set_vertex_attributes(this->drawState(), NULL != localRect); |
+ set_vertex_attributes(this->drawState(), SkToBool(localRect)); |
AutoReleaseGeometry geo(this, 4, 0); |
if (!geo.succeeded()) { |
@@ -704,13 +704,13 @@ void GrDrawTarget::onDrawRect(const SkRect& rect, |
size_t vstride = this->drawState()->getVertexStride(); |
geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride); |
- if (NULL != localRect) { |
+ if (localRect) { |
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + |
sizeof(SkPoint)); |
coords->setRectFan(localRect->fLeft, localRect->fTop, |
localRect->fRight, localRect->fBottom, |
vstride); |
- if (NULL != localMatrix) { |
+ if (localMatrix) { |
localMatrix->mapPointsWithStride(coords, vstride, 4); |
} |
} |
@@ -737,7 +737,7 @@ GrDrawTarget::AutoStateRestore::AutoStateRestore(GrDrawTarget* target, |
} |
GrDrawTarget::AutoStateRestore::~AutoStateRestore() { |
- if (NULL != fDrawTarget) { |
+ if (fDrawTarget) { |
fDrawTarget->setDrawState(fSavedState); |
fSavedState->unref(); |
} |
@@ -817,7 +817,7 @@ bool GrDrawTarget::AutoReleaseGeometry::set(GrDrawTarget* target, |
this->reset(); |
fTarget = target; |
bool success = true; |
- if (NULL != fTarget) { |
+ if (fTarget) { |
fTarget = target; |
success = target->reserveVertexAndIndexSpace(vertexCount, |
indexCount, |
@@ -828,16 +828,16 @@ bool GrDrawTarget::AutoReleaseGeometry::set(GrDrawTarget* target, |
this->reset(); |
} |
} |
- SkASSERT(success == (NULL != fTarget)); |
+ SkASSERT(success == SkToBool(fTarget)); |
return success; |
} |
void GrDrawTarget::AutoReleaseGeometry::reset() { |
- if (NULL != fTarget) { |
- if (NULL != fVertices) { |
+ if (fTarget) { |
+ if (fVertices) { |
fTarget->resetVertexSource(); |
} |
- if (NULL != fIndices) { |
+ if (fIndices) { |
fTarget->resetIndexSource(); |
} |
fTarget = NULL; |
@@ -912,8 +912,8 @@ bool GrDrawTarget::copySurface(GrSurface* dst, |
GrSurface* src, |
const SkIRect& srcRect, |
const SkIPoint& dstPoint) { |
- SkASSERT(NULL != dst); |
- SkASSERT(NULL != src); |
+ SkASSERT(dst); |
+ SkASSERT(src); |
SkIRect clippedSrcRect; |
SkIPoint clippedDstPoint; |
@@ -937,8 +937,8 @@ bool GrDrawTarget::canCopySurface(GrSurface* dst, |
GrSurface* src, |
const SkIRect& srcRect, |
const SkIPoint& dstPoint) { |
- SkASSERT(NULL != dst); |
- SkASSERT(NULL != src); |
+ SkASSERT(dst); |
+ SkASSERT(src); |
SkIRect clippedSrcRect; |
SkIPoint clippedDstPoint; |
@@ -965,7 +965,7 @@ bool GrDrawTarget::onCanCopySurface(GrSurface* dst, |
SkASSERT(dstPoint.fX + srcRect.width() <= dst->width() && |
dstPoint.fY + srcRect.height() <= dst->height()); |
- return !dst->isSameAs(src) && NULL != dst->asRenderTarget() && NULL != src->asTexture(); |
+ return !dst->isSameAs(src) && dst->asRenderTarget() && src->asTexture(); |
} |
bool GrDrawTarget::onCopySurface(GrSurface* dst, |