Index: src/effects/SkColorFilterImageFilter.cpp |
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp |
index 2a8df5c672109a4aee428e9801af6c305c0c89d4..806dd5dd010b7758b49a108d87185af77066adff 100755 |
--- a/src/effects/SkColorFilterImageFilter.cpp |
+++ b/src/effects/SkColorFilterImageFilter.cpp |
@@ -60,6 +60,9 @@ bool matrix_needs_clamping(SkScalar matrix[20]) { |
SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, |
SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID) { |
SkASSERT(cf); |
+ if (NULL == cf) { |
+ return NULL; |
+ } |
SkScalar colorMatrix[20], inputMatrix[20]; |
SkColorFilter* inputColorFilter; |
if (input && cf->asColorMatrix(colorMatrix) |
@@ -78,9 +81,7 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, |
SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, |
SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID) |
- : INHERITED(1, &input, cropRect, uniqueID), fColorFilter(cf) { |
- SkASSERT(cf); |
- SkSafeRef(cf); |
+ : INHERITED(1, &input, cropRect, uniqueID), fColorFilter(SkRef(cf)) { |
} |
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
@@ -102,7 +103,7 @@ void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const { |
} |
SkColorFilterImageFilter::~SkColorFilterImageFilter() { |
- SkSafeUnref(fColorFilter); |
+ fColorFilter->unref(); |
} |
bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, |