Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: src/effects/SkRectShaderImageFilter.cpp

Issue 675013003: Trying to be consistent when members are allowed to be NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed nits Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkRectShaderImageFilter.cpp
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index fb34ed0007152f124ae557a5567aad4effa3bed5..09417c8840f9fe8c0ef3ae6cfe1a789ed4064e56 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -20,20 +20,18 @@ SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe
flags = 0x0;
}
CropRect cropRect(rect, flags);
- return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect));
+ return s ? SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect)) : NULL;
}
SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect, uint32_t uniqueID) {
SkASSERT(s);
- return SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect, uniqueID));
+ return s ? SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect, uniqueID)) : NULL;
}
SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect,
uint32_t uniqueID)
: INHERITED(0, NULL, cropRect, uniqueID)
- , fShader(s) {
- SkASSERT(s);
- s->ref();
+ , fShader(SkRef(s)) {
}
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
@@ -55,7 +53,7 @@ void SkRectShaderImageFilter::flatten(SkWriteBuffer& buffer) const {
}
SkRectShaderImageFilter::~SkRectShaderImageFilter() {
- SkSafeUnref(fShader);
+ fShader->unref();
}
bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
@@ -78,7 +76,7 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
SkPaint paint;
SkMatrix matrix(ctx.ctm());
matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- paint.setShader(SkShader::CreateLocalMatrixShader(fShader, matrix))->unref();
+ SkSafeUnref(paint.setShader(SkShader::CreateLocalMatrixShader(fShader, matrix)));
SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bounds.height()));
canvas.drawRect(rect, paint);
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698