Chromium Code Reviews| Index: include/core/SkImageFilter.h | 
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h | 
| index f8f62f1d845c62865dfb5ecb8771868ca3e7b6a2..dcd25bf91bf492f3b9c2937c7c778410be6153b0 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]; } | 
| 
 
reed1
2016/04/15 16:33:43
why does this getInput return sp, and the earlier
 
robertphillips
2016/04/15 16:56:04
Callers of this method intend to take a ref on the
 
 | 
| - // 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; | 
| }; | 
| /** |