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 GrProcessorDataManager; |
20 class GrTexture; | 20 class GrTexture; |
21 class SkBaseDevice; | 21 class SkBaseDevice; |
22 class SkBitmap; | 22 class SkBitmap; |
23 class SkColorFilter; | 23 class SkColorFilter; |
24 struct SkIPoint; | 24 struct SkIPoint; |
25 | 25 |
26 /** | 26 /** |
27 * 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 |
28 * 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 |
29 * 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... |
334 * If effect is non-NULL, a new GrProcessor instance is stored | 334 * If effect is non-NULL, a new GrProcessor instance is stored |
335 * 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 |
336 * caller to unref it. | 336 * caller to unref it. |
337 * | 337 * |
338 * 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 |
339 * in the texture. "matrix" is a transformation to apply to filter | 339 * in the texture. "matrix" is a transformation to apply to filter |
340 * 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 |
341 * 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, |
342 * so returning "true" indicates support for all possible matrices. | 342 * so returning "true" indicates support for all possible matrices. |
343 */ | 343 */ |
344 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*
, GrTexture*, | 344 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManag
er*, GrTexture*, |
345 const SkMatrix&, const SkIRect& bounds) con
st; | 345 const SkMatrix&, const SkIRect& bounds) con
st; |
346 | 346 |
347 private: | 347 private: |
348 friend class SkGraphics; | 348 friend class SkGraphics; |
349 static void PurgeCache(); | 349 static void PurgeCache(); |
350 | 350 |
351 bool usesSrcInput() const { return fUsesSrcInput; } | 351 bool usesSrcInput() const { return fUsesSrcInput; } |
352 | 352 |
353 typedef SkFlattenable INHERITED; | 353 typedef SkFlattenable INHERITED; |
354 int fInputCount; | 354 int fInputCount; |
355 SkImageFilter** fInputs; | 355 SkImageFilter** fInputs; |
356 bool fUsesSrcInput; | 356 bool fUsesSrcInput; |
357 CropRect fCropRect; | 357 CropRect fCropRect; |
358 uint32_t fUniqueID; // Globally unique | 358 uint32_t fUniqueID; // Globally unique |
359 }; | 359 }; |
360 | 360 |
361 /** | 361 /** |
362 * 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. |
363 */ | 363 */ |
364 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 364 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
365 Common localVar; \ | 365 Common localVar; \ |
366 do { \ | 366 do { \ |
367 if (!localVar.unflatten(buffer, expectedCount)) { \ | 367 if (!localVar.unflatten(buffer, expectedCount)) { \ |
368 return NULL; \ | 368 return NULL; \ |
369 } \ | 369 } \ |
370 } while (0) | 370 } while (0) |
371 | 371 |
372 #endif | 372 #endif |
OLD | NEW |