| 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 |
| 11 #include "SkFilterQuality.h" | 11 #include "SkFilterQuality.h" |
| 12 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkRect.h" | 14 #include "SkRect.h" |
| 15 #include "SkSurfaceProps.h" | 15 #include "SkSurfaceProps.h" |
| 16 #include "SkTemplates.h" | 16 #include "SkTemplates.h" |
| 17 | 17 |
| 18 class GrFragmentProcessor; | 18 class GrFragmentProcessor; |
| 19 class GrShaderDataManager; |
| 19 class GrTexture; | 20 class GrTexture; |
| 20 class SkBaseDevice; | 21 class SkBaseDevice; |
| 21 class SkBitmap; | 22 class SkBitmap; |
| 22 class SkColorFilter; | 23 class SkColorFilter; |
| 23 struct SkIPoint; | 24 struct SkIPoint; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * Base class for image filters. If one is installed in the paint, then | 27 * Base class for image filters. If one is installed in the paint, then |
| 27 * all drawing occurs as usual, but it is as if the drawing happened into an | 28 * all drawing occurs as usual, but it is as if the drawing happened into an |
| 28 * offscreen (before the xfermode is applied). This offscreen bitmap will | 29 * offscreen (before the xfermode is applied). This offscreen bitmap will |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 * If effect is non-NULL, a new GrProcessor instance is stored | 334 * If effect is non-NULL, a new GrProcessor instance is stored |
| 334 * in it. The caller assumes ownership of the stage, and it is up to the | 335 * in it. The caller assumes ownership of the stage, and it is up to the |
| 335 * caller to unref it. | 336 * caller to unref it. |
| 336 * | 337 * |
| 337 * The effect can assume its vertexCoords space maps 1-to-1 with texels | 338 * The effect can assume its vertexCoords space maps 1-to-1 with texels |
| 338 * in the texture. "matrix" is a transformation to apply to filter | 339 * in the texture. "matrix" is a transformation to apply to filter |
| 339 * 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 |
| 340 * 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, |
| 341 * so returning "true" indicates support for all possible matrices. | 342 * so returning "true" indicates support for all possible matrices. |
| 342 */ | 343 */ |
| 343 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, | 344 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*
, GrTexture*, |
| 344 const SkIRect& bounds) const; | 345 const SkMatrix&, const SkIRect& bounds) con
st; |
| 345 | 346 |
| 346 private: | 347 private: |
| 347 friend class SkGraphics; | 348 friend class SkGraphics; |
| 348 static void PurgeCache(); | 349 static void PurgeCache(); |
| 349 | 350 |
| 350 bool usesSrcInput() const { return fUsesSrcInput; } | 351 bool usesSrcInput() const { return fUsesSrcInput; } |
| 351 | 352 |
| 352 typedef SkFlattenable INHERITED; | 353 typedef SkFlattenable INHERITED; |
| 353 int fInputCount; | 354 int fInputCount; |
| 354 SkImageFilter** fInputs; | 355 SkImageFilter** fInputs; |
| 355 bool fUsesSrcInput; | 356 bool fUsesSrcInput; |
| 356 CropRect fCropRect; | 357 CropRect fCropRect; |
| 357 uint32_t fUniqueID; // Globally unique | 358 uint32_t fUniqueID; // Globally unique |
| 358 }; | 359 }; |
| 359 | 360 |
| 360 /** | 361 /** |
| 361 * Helper to unflatten the common data, and return NULL if we fail. | 362 * Helper to unflatten the common data, and return NULL if we fail. |
| 362 */ | 363 */ |
| 363 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 364 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
| 364 Common localVar; \ | 365 Common localVar; \ |
| 365 do { \ | 366 do { \ |
| 366 if (!localVar.unflatten(buffer, expectedCount)) { \ | 367 if (!localVar.unflatten(buffer, expectedCount)) { \ |
| 367 return NULL; \ | 368 return NULL; \ |
| 368 } \ | 369 } \ |
| 369 } while (0) | 370 } while (0) |
| 370 | 371 |
| 371 #endif | 372 #endif |
| OLD | NEW |