| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkImageFilter_DEFINED | 8 #ifndef SkImageFilter_DEFINED |
| 9 #define SkImageFilter_DEFINED | 9 #define SkImageFilter_DEFINED |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 * If this fails (i.e. corrupt buffer or contents) then return false an
d common will | 221 * If this fails (i.e. corrupt buffer or contents) then return false an
d common will |
| 222 * be left uninitialized. | 222 * be left uninitialized. |
| 223 * If this returns true, then inputCount() is the number of found input
filters, each | 223 * If this returns true, then inputCount() is the number of found input
filters, each |
| 224 * of which may be NULL or a valid imagefilter. | 224 * of which may be NULL or a valid imagefilter. |
| 225 */ | 225 */ |
| 226 bool unflatten(SkReadBuffer&, int expectedInputs); | 226 bool unflatten(SkReadBuffer&, int expectedInputs); |
| 227 | 227 |
| 228 const CropRect& cropRect() const { return fCropRect; } | 228 const CropRect& cropRect() const { return fCropRect; } |
| 229 int inputCount() const { return fInputs.count(); } | 229 int inputCount() const { return fInputs.count(); } |
| 230 SkImageFilter** inputs() const { return fInputs.get(); } | 230 SkImageFilter** inputs() const { return fInputs.get(); } |
| 231 uint32_t uniqueID() const { return fUniqueID; } | |
| 232 | 231 |
| 233 SkImageFilter* getInput(int index) const { return fInputs[index]; } | 232 SkImageFilter* getInput(int index) const { return fInputs[index]; } |
| 234 | 233 |
| 235 // If the caller wants a copy of the inputs, call this and it will trans
fer ownership | 234 // If the caller wants a copy of the inputs, call this and it will trans
fer ownership |
| 236 // of the unflattened input filters to the caller. This is just a short-
cut for copying | 235 // of the unflattened input filters to the caller. This is just a short-
cut for copying |
| 237 // the inputs, calling ref() on each, and then waiting for Common's dest
ructor to call | 236 // the inputs, calling ref() on each, and then waiting for Common's dest
ructor to call |
| 238 // unref() on each. | 237 // unref() on each. |
| 239 void detachInputs(SkImageFilter** inputs); | 238 void detachInputs(SkImageFilter** inputs); |
| 240 | 239 |
| 241 private: | 240 private: |
| 242 CropRect fCropRect; | 241 CropRect fCropRect; |
| 243 // most filters accept at most 2 input-filters | 242 // most filters accept at most 2 input-filters |
| 244 SkAutoSTArray<2, SkImageFilter*> fInputs; | 243 SkAutoSTArray<2, SkImageFilter*> fInputs; |
| 245 uint32_t fUniqueID; | |
| 246 | 244 |
| 247 void allocInputs(int count); | 245 void allocInputs(int count); |
| 248 }; | 246 }; |
| 249 | 247 |
| 250 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe
ct = NULL, uint32_t uniqueID = 0); | 248 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe
ct = NULL); |
| 251 | 249 |
| 252 virtual ~SkImageFilter(); | 250 virtual ~SkImageFilter(); |
| 253 | 251 |
| 254 /** | 252 /** |
| 255 * Constructs a new SkImageFilter read from an SkReadBuffer object. | 253 * Constructs a new SkImageFilter read from an SkReadBuffer object. |
| 256 * | 254 * |
| 257 * @param inputCount The exact number of inputs expected for this SkImag
eFilter object. | 255 * @param inputCount The exact number of inputs expected for this SkImag
eFilter object. |
| 258 * -1 can be used if the filter accepts any number of
inputs. | 256 * -1 can be used if the filter accepts any number of
inputs. |
| 259 * @param rb SkReadBuffer object from which the SkImageFilter is
read. | 257 * @param rb SkReadBuffer object from which the SkImageFilter is
read. |
| 260 */ | 258 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 */ | 349 */ |
| 352 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 350 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
| 353 Common localVar; \ | 351 Common localVar; \ |
| 354 do { \ | 352 do { \ |
| 355 if (!localVar.unflatten(buffer, expectedCount)) { \ | 353 if (!localVar.unflatten(buffer, expectedCount)) { \ |
| 356 return NULL; \ | 354 return NULL; \ |
| 357 } \ | 355 } \ |
| 358 } while (0) | 356 } while (0) |
| 359 | 357 |
| 360 #endif | 358 #endif |
| OLD | NEW |