aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-15 09:58:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 09:58:37 -0700
commit6b13473dd4d5915309cc2caddbab2e22f2f21d5f (patch)
treeaac273be1dd6cf09cc94d103b739a35c65673650 /include
parent86498fbfcb93a9048bbe1c28cc0df40d8d0c96e9 (diff)
Move SkImageFilter over to storing sk_sps
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImageFilter.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index f8f62f1d84..dcd25bf91b 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -234,15 +234,15 @@ public:
* Returns the number of inputs this filter will accept (some inputs can
* be NULL).
*/
- int countInputs() const { return fInputCount; }
+ int countInputs() const { return fInputs.count(); }
/**
* Returns the input filter at a given index, or NULL if no input is
* connected. The indices used are filter-specific.
*/
SkImageFilter* getInput(int i) const {
- SkASSERT(i < fInputCount);
- return fInputs[i];
+ SkASSERT(i < fInputs.count());
+ return fInputs[i].get();
}
/**
@@ -332,12 +332,6 @@ protected:
sk_sp<SkImageFilter> getInput(int index) const { return fInputs[index]; }
- // If the caller wants a copy of the inputs, call this and it will transfer ownership
- // of the unflattened input filters to the caller. This is just a short-cut for copying
- // the inputs, calling ref() on each, and then waiting for Common's destructor to call
- // unref() on each.
- void detachInputs(SkImageFilter** inputs);
-
private:
CropRect fCropRect;
// most filters accept at most 2 input-filters
@@ -346,8 +340,6 @@ protected:
void allocInputs(int count);
};
- SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = nullptr);
-
SkImageFilter(sk_sp<SkImageFilter>* inputs, int inputCount, const CropRect* cropRect);
virtual ~SkImageFilter();
@@ -466,20 +458,21 @@ private:
friend class SkGraphics;
static void PurgeCache();
+ void init(sk_sp<SkImageFilter>* inputs, int inputCount, const CropRect* cropRect);
bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
bool usesSrcInput() const { return fUsesSrcInput; }
virtual bool affectsTransparentBlack() const { return false; }
- typedef SkFlattenable INHERITED;
- int fInputCount;
- SkImageFilter** fInputs;
+ SkAutoSTArray<2, sk_sp<SkImageFilter>> fInputs;
+
bool fUsesSrcInput;
CropRect fCropRect;
uint32_t fUniqueID; // Globally unique
mutable SkTArray<Cache::Key> fCacheKeys;
mutable SkMutex fMutex;
+ typedef SkFlattenable INHERITED;
};
/**