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 */ | |
87 virtual SkBaseDevice* createDevice(int width, int height) = 0; | 84 virtual SkBaseDevice* createDevice(int width, int height) = 0; |
88 // returns true if the proxy can handle this filter natively | 85 // returns true if the proxy can handle this filter natively |
89 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; | 86 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; |
90 // returns true if the proxy handled the filter itself. if this returns | 87 // returns true if the proxy handled the filter itself. if this returns |
91 // false then the filter's code will be called. | 88 // false then the filter's code will be called. |
92 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, | 89 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, |
93 const Context&, | 90 const Context&, |
94 SkBitmap* result, SkIPoint* offset) = 0; | 91 SkBitmap* result, SkIPoint* offset) = 0; |
95 virtual const SkSurfaceProps* surfaceProps() const = 0; | 92 virtual const SkSurfaceProps* surfaceProps() const = 0; |
96 }; | 93 }; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 * parameters before they are used in the effect. Note that this function | 337 * parameters before they are used in the effect. Note that this function |
341 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, | 338 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, |
342 * so returning "true" indicates support for all possible matrices. | 339 * so returning "true" indicates support for all possible matrices. |
343 */ | 340 */ |
344 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, | 341 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, |
345 const SkIRect& bounds) const; | 342 const SkIRect& bounds) const; |
346 | 343 |
347 private: | 344 private: |
348 bool usesSrcInput() const { return fUsesSrcInput; } | 345 bool usesSrcInput() const { return fUsesSrcInput; } |
349 | 346 |
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 | |
356 typedef SkFlattenable INHERITED; | 347 typedef SkFlattenable INHERITED; |
357 int fInputCount; | 348 int fInputCount; |
358 SkImageFilter** fInputs; | 349 SkImageFilter** fInputs; |
359 bool fUsesSrcInput; | 350 bool fUsesSrcInput; |
360 CropRect fCropRect; | 351 CropRect fCropRect; |
361 uint32_t fUniqueID; // Globally unique | 352 uint32_t fUniqueID; // Globally unique |
362 }; | 353 }; |
363 | 354 |
364 /** | 355 /** |
365 * Helper to unflatten the common data, and return NULL if we fail. | 356 * Helper to unflatten the common data, and return NULL if we fail. |
366 */ | 357 */ |
367 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 358 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
368 Common localVar; \ | 359 Common localVar; \ |
369 do { \ | 360 do { \ |
370 if (!localVar.unflatten(buffer, expectedCount)) { \ | 361 if (!localVar.unflatten(buffer, expectedCount)) { \ |
371 return NULL; \ | 362 return NULL; \ |
372 } \ | 363 } \ |
373 } while (0) | 364 } while (0) |
374 | 365 |
375 #endif | 366 #endif |
OLD | NEW |