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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 private: | 74 private: |
75 SkMatrix fCTM; | 75 SkMatrix fCTM; |
76 SkIRect fClipBounds; | 76 SkIRect fClipBounds; |
77 Cache* fCache; | 77 Cache* fCache; |
78 }; | 78 }; |
79 | 79 |
80 class Proxy { | 80 class Proxy { |
81 public: | 81 public: |
82 virtual ~Proxy() {}; | 82 virtual ~Proxy() {}; |
83 | 83 |
| 84 /** |
| 85 * The returned device will be zero-initialized (transparent black) |
| 86 */ |
84 virtual SkBaseDevice* createDevice(int width, int height) = 0; | 87 virtual SkBaseDevice* createDevice(int width, int height) = 0; |
85 // returns true if the proxy can handle this filter natively | 88 // returns true if the proxy can handle this filter natively |
86 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; | 89 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; |
87 // returns true if the proxy handled the filter itself. if this returns | 90 // returns true if the proxy handled the filter itself. if this returns |
88 // false then the filter's code will be called. | 91 // false then the filter's code will be called. |
89 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, | 92 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, |
90 const Context&, | 93 const Context&, |
91 SkBitmap* result, SkIPoint* offset) = 0; | 94 SkBitmap* result, SkIPoint* offset) = 0; |
92 virtual const SkSurfaceProps* surfaceProps() const = 0; | 95 virtual const SkSurfaceProps* surfaceProps() const = 0; |
93 }; | 96 }; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 * parameters before they are used in the effect. Note that this function | 340 * parameters before they are used in the effect. Note that this function |
338 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, | 341 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, |
339 * so returning "true" indicates support for all possible matrices. | 342 * so returning "true" indicates support for all possible matrices. |
340 */ | 343 */ |
341 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, | 344 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, |
342 const SkIRect& bounds) const; | 345 const SkIRect& bounds) const; |
343 | 346 |
344 private: | 347 private: |
345 bool usesSrcInput() const { return fUsesSrcInput; } | 348 bool usesSrcInput() const { return fUsesSrcInput; } |
346 | 349 |
| 350 // Hack to optimize how we saveLayer, remove when no longer needed by SkCanv
as |
| 351 bool mayDrawWithMatrix() const { return this->onMayDrawWithMatrix(); } |
| 352 // Return true if the subclass may draw the src transformed (e.g. w/ matrix) |
| 353 virtual bool onMayDrawWithMatrix() const { return false; } |
| 354 friend class SkCanvas; |
| 355 |
347 typedef SkFlattenable INHERITED; | 356 typedef SkFlattenable INHERITED; |
348 int fInputCount; | 357 int fInputCount; |
349 SkImageFilter** fInputs; | 358 SkImageFilter** fInputs; |
350 bool fUsesSrcInput; | 359 bool fUsesSrcInput; |
351 CropRect fCropRect; | 360 CropRect fCropRect; |
352 uint32_t fUniqueID; // Globally unique | 361 uint32_t fUniqueID; // Globally unique |
353 }; | 362 }; |
354 | 363 |
355 /** | 364 /** |
356 * Helper to unflatten the common data, and return NULL if we fail. | 365 * Helper to unflatten the common data, and return NULL if we fail. |
357 */ | 366 */ |
358 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 367 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
359 Common localVar; \ | 368 Common localVar; \ |
360 do { \ | 369 do { \ |
361 if (!localVar.unflatten(buffer, expectedCount)) { \ | 370 if (!localVar.unflatten(buffer, expectedCount)) { \ |
362 return NULL; \ | 371 return NULL; \ |
363 } \ | 372 } \ |
364 } while (0) | 373 } while (0) |
365 | 374 |
366 #endif | 375 #endif |
OLD | NEW |