| 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 "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkColorFilter; | 15 class SkColorFilter; |
| 16 class SkDevice; | 16 class SkDevice; |
| 17 class SkMatrix; | 17 class SkMatrix; |
| 18 struct SkIPoint; | 18 struct SkIPoint; |
| 19 class SkShader; | 19 class SkShader; |
| 20 class GrEffectRef; | 20 class GrEffectRef; |
| 21 class GrTexture; | 21 class GrTexture; |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Experimental. | |
| 25 * | |
| 26 * Base class for image filters. If one is installed in the paint, then | 24 * 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 | 25 * 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 | 26 * offscreen (before the xfermode is applied). This offscreen bitmap will |
| 29 * then be handed to the imagefilter, who in turn creates a new bitmap which | 27 * then be handed to the imagefilter, who in turn creates a new bitmap which |
| 30 * is what will finally be drawn to the device (using the original xfermode). | 28 * is what will finally be drawn to the device (using the original xfermode). |
| 31 * | |
| 32 * THIS SIGNATURE IS TEMPORARY | |
| 33 * | |
| 34 * There are several weaknesses in this function signature: | |
| 35 * 1. Does not expose the destination/target device, so filters that can draw | |
| 36 * directly to it are unable to take advantage of that optimization. | |
| 37 * 2. Does not expose a way to create a "compabitible" image (i.e. gpu -> gpu) | |
| 38 * 3. As with #1, the filter is unable to "read" the dest (which would be slow) | |
| 39 * | |
| 40 * Therefore, we should not create any real dependencies on this API yet -- it | |
| 41 * is being checked in as a check-point so we can explore these and other | |
| 42 * considerations. | |
| 43 */ | 29 */ |
| 44 class SK_API SkImageFilter : public SkFlattenable { | 30 class SK_API SkImageFilter : public SkFlattenable { |
| 45 public: | 31 public: |
| 46 SK_DECLARE_INST_COUNT(SkImageFilter) | 32 SK_DECLARE_INST_COUNT(SkImageFilter) |
| 47 | 33 |
| 48 class Proxy { | 34 class Proxy { |
| 49 public: | 35 public: |
| 50 virtual ~Proxy() {}; | 36 virtual ~Proxy() {}; |
| 51 | 37 |
| 52 virtual SkDevice* createDevice(int width, int height) = 0; | 38 virtual SkDevice* createDevice(int width, int height) = 0; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 bool applyCropRect(SkIRect* rect) const; | 164 bool applyCropRect(SkIRect* rect) const; |
| 179 | 165 |
| 180 private: | 166 private: |
| 181 typedef SkFlattenable INHERITED; | 167 typedef SkFlattenable INHERITED; |
| 182 int fInputCount; | 168 int fInputCount; |
| 183 SkImageFilter** fInputs; | 169 SkImageFilter** fInputs; |
| 184 SkIRect fCropRect; | 170 SkIRect fCropRect; |
| 185 }; | 171 }; |
| 186 | 172 |
| 187 #endif | 173 #endif |
| OLD | NEW |