diff options
author | 2016-04-15 09:58:37 -0700 | |
---|---|---|
committer | 2016-04-15 09:58:37 -0700 | |
commit | 6b13473dd4d5915309cc2caddbab2e22f2f21d5f (patch) | |
tree | aac273be1dd6cf09cc94d103b739a35c65673650 /include | |
parent | 86498fbfcb93a9048bbe1c28cc0df40d8d0c96e9 (diff) |
Move SkImageFilter over to storing sk_sps
This CL also removes the old bare-pointer style ctor.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1894573002
Review URL: https://codereview.chromium.org/1894573002
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImageFilter.h | 21 |
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; }; /** |