diff options
author | Mike Klein <mtklein@google.com> | 2014-07-09 09:04:07 -0400 |
---|---|---|
committer | Mike Klein <mtklein@google.com> | 2014-07-09 09:04:07 -0400 |
commit | 874a62acef5ec2ecccdbb99ec4d86402a3341e6a (patch) | |
tree | 984dbc899480cb2dcaa578c08594266f2f9500cb /src/core/SkImageFilter.cpp | |
parent | 0b544ae222aab1c5d9122a8dfe2800451b31d979 (diff) |
Revert "Remove ability for Release code to call getRefCnt() or getWeakRefCnt()."
This reverts commit 4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443.
BUG=skia:
Review URL: https://codereview.chromium.org/382523002
Diffstat (limited to 'src/core/SkImageFilter.cpp')
-rw-r--r-- | src/core/SkImageFilter.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 64603b4cb5..8402a55a22 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -361,10 +361,7 @@ static uint32_t compute_hash(const uint32_t* data, int count) { class CacheImpl : public SkImageFilter::Cache { public: - explicit CacheImpl(int minChildren) : fMinChildren(minChildren) { - SkASSERT(fMinChildren <= 2); - } - + explicit CacheImpl(int minChildren) : fMinChildren(minChildren) {} virtual ~CacheImpl(); bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; void set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) SK_OVERRIDE; @@ -407,10 +404,7 @@ void CacheImpl::remove(const SkImageFilter* key) { } void CacheImpl::set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) { - if (fMinChildren < 2 || !key->unique()) { - // We take !key->unique() as a signal that there are probably at least 2 refs on the key, - // meaning this filter probably has at least two children and is worth caching when - // fMinChildren is 2. If fMinChildren is less than two, we'll just always cache. + if (key->getRefCnt() >= fMinChildren) { fData.add(new Value(key, result, offset)); } } |