aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkBlurDrawLooper.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-02-07 15:30:46 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-02-07 15:30:46 +0000
commit82065d667f64e232bcde2ad849756a6096fcbe6f (patch)
treeb286676278e48522d5a1e153ff5696d3f2088cc8 /src/effects/SkBlurDrawLooper.cpp
parent18908aacf360eaacf5e6a98dd57342adb98cf463 (diff)
remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with
SkSafeRef() and SkSafeUnref(). This is basically a bug waiting to happen. An optimizing compiler can remove checks for null on "this" if it chooses. However, SkRefCnt::safeRef() relies on precisely this check... void SkRefCnt::safeRef() { if (this) { this->ref(); } } Since a compiler might skip the if-clause, it breaks the intention of this method, hence its removal. static inline void SkSafeRef(SkRefCnt* obj) { if (obj) { obj->ref(); } } This form is not ignored by an optimizing compile, so we use it instead. git-svn-id: http://skia.googlecode.com/svn/trunk@762 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkBlurDrawLooper.cpp')
-rw-r--r--src/effects/SkBlurDrawLooper.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index 2af60971c3..a3c4eacb6f 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -11,12 +11,12 @@ SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy,
SkASSERT(flags <= kAll_BlurFlag);
if (radius > 0)
{
- uint32_t blurFlags = flags & kIgnoreTransform_BlurFlag ?
- SkBlurMaskFilter::kIgnoreTransform_BlurFlag :
+ uint32_t blurFlags = flags & kIgnoreTransform_BlurFlag ?
+ SkBlurMaskFilter::kIgnoreTransform_BlurFlag :
SkBlurMaskFilter::kNone_BlurFlag;
fBlur = SkBlurMaskFilter::Create(radius,
- SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMaskFilter::kNormal_BlurStyle,
blurFlags);
}
else
@@ -34,7 +34,7 @@ SkBlurDrawLooper::SkBlurDrawLooper(SkFlattenableReadBuffer& buffer)
SkBlurDrawLooper::~SkBlurDrawLooper()
{
- fBlur->safeUnref();
+ SkSafeUnref(fBlur);
}
void SkBlurDrawLooper::flatten(SkFlattenableWriteBuffer& buffer)