reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkImageFilter_DEFINED |
| 9 | #define SkImageFilter_DEFINED |
| 10 | |
| 11 | #include "SkFlattenable.h" |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 12 | #include "SkMatrix.h" |
senorblanco@chromium.org | 194d775 | 2013-07-24 22:19:24 +0000 | [diff] [blame] | 13 | #include "SkRect.h" |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 14 | |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 15 | class SkBitmap; |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 16 | class SkColorFilter; |
robertphillips@google.com | 1f2f338 | 2013-08-29 11:54:56 +0000 | [diff] [blame] | 17 | class SkBaseDevice; |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 18 | struct SkIPoint; |
bsalomon@google.com | 0ac6af4 | 2013-01-16 15:16:18 +0000 | [diff] [blame] | 19 | class GrEffectRef; |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 20 | class GrTexture; |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 21 | |
| 22 | /** |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 23 | * Base class for image filters. If one is installed in the paint, then |
| 24 | * all drawing occurs as usual, but it is as if the drawing happened into an |
| 25 | * offscreen (before the xfermode is applied). This offscreen bitmap will |
| 26 | * then be handed to the imagefilter, who in turn creates a new bitmap which |
| 27 | * is what will finally be drawn to the device (using the original xfermode). |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 28 | */ |
senorblanco@chromium.org | 54e01b2 | 2011-11-16 18:20:47 +0000 | [diff] [blame] | 29 | class SK_API SkImageFilter : public SkFlattenable { |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 30 | public: |
robertphillips@google.com | 0456e0b | 2012-06-27 14:03:26 +0000 | [diff] [blame] | 31 | SK_DECLARE_INST_COUNT(SkImageFilter) |
| 32 | |
senorblanco@chromium.org | 3f1f2a3 | 2013-10-16 18:07:48 +0000 | [diff] [blame] | 33 | class CropRect { |
| 34 | public: |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 35 | enum CropEdge { |
| 36 | kHasLeft_CropEdge = 0x01, |
| 37 | kHasTop_CropEdge = 0x02, |
| 38 | kHasRight_CropEdge = 0x04, |
| 39 | kHasBottom_CropEdge = 0x08, |
| 40 | kHasAll_CropEdge = 0x0F, |
| 41 | }; |
| 42 | CropRect() {} |
| 43 | explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {} |
senorblanco@chromium.org | 3f1f2a3 | 2013-10-16 18:07:48 +0000 | [diff] [blame] | 44 | uint32_t flags() const { return fFlags; } |
| 45 | const SkRect& rect() const { return fRect; } |
| 46 | private: |
| 47 | SkRect fRect; |
| 48 | uint32_t fFlags; |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 49 | }; |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 50 | |
commit-bot@chromium.org | f7efa50 | 2014-04-11 18:57:00 +0000 | [diff] [blame^] | 51 | class Cache : public SkRefCnt { |
| 52 | public: |
| 53 | // By default, we cache only image filters with 2 or more children. |
| 54 | static Cache* Create(int minChildren = 2); |
| 55 | virtual ~Cache() {} |
| 56 | virtual bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) = 0; |
| 57 | virtual void set(const SkImageFilter* key, |
| 58 | const SkBitmap& result, const SkIPoint& offset) = 0; |
| 59 | }; |
| 60 | |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 61 | class Context { |
| 62 | public: |
commit-bot@chromium.org | f7efa50 | 2014-04-11 18:57:00 +0000 | [diff] [blame^] | 63 | Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache) : |
| 64 | fCTM(ctm), fClipBounds(clipBounds), fCache(cache) { |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 65 | } |
| 66 | const SkMatrix& ctm() const { return fCTM; } |
| 67 | const SkIRect& clipBounds() const { return fClipBounds; } |
commit-bot@chromium.org | f7efa50 | 2014-04-11 18:57:00 +0000 | [diff] [blame^] | 68 | Cache* cache() const { return fCache; } |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 69 | private: |
| 70 | SkMatrix fCTM; |
| 71 | SkIRect fClipBounds; |
commit-bot@chromium.org | f7efa50 | 2014-04-11 18:57:00 +0000 | [diff] [blame^] | 72 | Cache* fCache; |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 73 | }; |
| 74 | |
reed@google.com | 76dd277 | 2012-01-05 21:15:07 +0000 | [diff] [blame] | 75 | class Proxy { |
| 76 | public: |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 77 | virtual ~Proxy() {}; |
| 78 | |
robertphillips@google.com | 1f2f338 | 2013-08-29 11:54:56 +0000 | [diff] [blame] | 79 | virtual SkBaseDevice* createDevice(int width, int height) = 0; |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 80 | // returns true if the proxy can handle this filter natively |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 81 | virtual bool canHandleImageFilter(const SkImageFilter*) = 0; |
reed@google.com | 76dd277 | 2012-01-05 21:15:07 +0000 | [diff] [blame] | 82 | // returns true if the proxy handled the filter itself. if this returns |
| 83 | // false then the filter's code will be called. |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 84 | virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 85 | const Context&, |
reed@google.com | 76dd277 | 2012-01-05 21:15:07 +0000 | [diff] [blame] | 86 | SkBitmap* result, SkIPoint* offset) = 0; |
| 87 | }; |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Request a new (result) image to be created from the src image. |
| 91 | * If the src has no pixels (isNull()) then the request just wants to |
| 92 | * receive the config and width/height of the result. |
| 93 | * |
| 94 | * The matrix is the current matrix on the canvas. |
| 95 | * |
| 96 | * Offset is the amount to translate the resulting image relative to the |
senorblanco@chromium.org | 6776b82 | 2014-01-03 21:48:22 +0000 | [diff] [blame] | 97 | * src when it is drawn. This is an out-param. |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 98 | * |
| 99 | * If the result image cannot be created, return false, in which case both |
| 100 | * the result and offset parameters will be ignored by the caller. |
| 101 | */ |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 102 | bool filterImage(Proxy*, const SkBitmap& src, const Context&, |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 103 | SkBitmap* result, SkIPoint* offset) const; |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 104 | |
| 105 | /** |
reed@google.com | 32d25b6 | 2011-12-20 16:19:00 +0000 | [diff] [blame] | 106 | * Given the src bounds of an image, this returns the bounds of the result |
| 107 | * image after the filter has been applied. |
| 108 | */ |
senorblanco@chromium.org | c4b12f1 | 2014-02-05 17:51:22 +0000 | [diff] [blame] | 109 | bool filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const; |
reed@google.com | 32d25b6 | 2011-12-20 16:19:00 +0000 | [diff] [blame] | 110 | |
| 111 | /** |
senorblanco@chromium.org | 302cffb | 2012-08-01 20:16:34 +0000 | [diff] [blame] | 112 | * Returns true if the filter can be processed on the GPU. This is most |
| 113 | * often used for multi-pass effects, where intermediate results must be |
bsalomon@google.com | 8ea78d8 | 2012-10-24 20:11:30 +0000 | [diff] [blame] | 114 | * rendered to textures. For single-pass effects, use asNewEffect(). |
senorblanco@chromium.org | 7938bae | 2013-10-18 20:08:14 +0000 | [diff] [blame] | 115 | * The default implementation returns asNewEffect(NULL, NULL, SkMatrix::I(), |
| 116 | * SkIRect()). |
reed@google.com | 15356a6 | 2011-11-03 19:29:08 +0000 | [diff] [blame] | 117 | */ |
senorblanco@chromium.org | 302cffb | 2012-08-01 20:16:34 +0000 | [diff] [blame] | 118 | virtual bool canFilterImageGPU() const; |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 119 | |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 120 | /** |
skia.committer@gmail.com | 3284017 | 2013-04-09 07:01:27 +0000 | [diff] [blame] | 121 | * Process this image filter on the GPU. This is most often used for |
senorblanco@chromium.org | d043cce | 2013-04-08 19:43:22 +0000 | [diff] [blame] | 122 | * multi-pass effects, where intermediate results must be rendered to |
| 123 | * textures. For single-pass effects, use asNewEffect(). src is the |
| 124 | * source image for processing, as a texture-backed bitmap. result is |
| 125 | * the destination bitmap, which should contain a texture-backed pixelref |
skia.committer@gmail.com | de2e4e8 | 2013-07-11 07:01:01 +0000 | [diff] [blame] | 126 | * on success. offset is the amount to translate the resulting image |
commit-bot@chromium.org | 7b32070 | 2013-07-10 21:22:18 +0000 | [diff] [blame] | 127 | * relative to the src when it is drawn. The default implementation does |
| 128 | * single-pass processing using asNewEffect(). |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 129 | */ |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 130 | virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&, |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 131 | SkBitmap* result, SkIPoint* offset) const; |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 132 | |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 133 | /** |
sugoi@google.com | a1c511b | 2013-02-21 15:02:28 +0000 | [diff] [blame] | 134 | * Returns whether this image filter is a color filter and puts the color filter into the |
sugoi@google.com | 4b6d432 | 2013-02-21 20:26:50 +0000 | [diff] [blame] | 135 | * "filterPtr" parameter if it can. Does nothing otherwise. |
| 136 | * If this returns false, then the filterPtr is unchanged. |
| 137 | * If this returns true, then if filterPtr is not null, it must be set to a ref'd colorfitler |
| 138 | * (i.e. it may not be set to NULL). |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 139 | */ |
sugoi@google.com | 4b6d432 | 2013-02-21 20:26:50 +0000 | [diff] [blame] | 140 | virtual bool asColorFilter(SkColorFilter** filterPtr) const; |
senorblanco@chromium.org | 9f25de7 | 2012-10-10 20:36:13 +0000 | [diff] [blame] | 141 | |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 142 | /** |
| 143 | * Returns the number of inputs this filter will accept (some inputs can |
| 144 | * be NULL). |
| 145 | */ |
| 146 | int countInputs() const { return fInputCount; } |
| 147 | |
| 148 | /** |
| 149 | * Returns the input filter at a given index, or NULL if no input is |
| 150 | * connected. The indices used are filter-specific. |
| 151 | */ |
| 152 | SkImageFilter* getInput(int i) const { |
| 153 | SkASSERT(i < fInputCount); |
| 154 | return fInputs[i]; |
| 155 | } |
| 156 | |
senorblanco@chromium.org | 194d775 | 2013-07-24 22:19:24 +0000 | [diff] [blame] | 157 | /** |
senorblanco@chromium.org | 3f1f2a3 | 2013-10-16 18:07:48 +0000 | [diff] [blame] | 158 | * Returns whether any edges of the crop rect have been set. The crop |
| 159 | * rect is set at construction time, and determines which pixels from the |
| 160 | * input image will be processed. The size of the crop rect should be |
| 161 | * used as the size of the destination image. The origin of this rect |
| 162 | * should be used to offset access to the input images, and should also |
| 163 | * be added to the "offset" parameter in onFilterImage and |
| 164 | * filterImageGPU(). (The latter ensures that the resulting buffer is |
| 165 | * drawn in the correct location.) |
senorblanco@chromium.org | 194d775 | 2013-07-24 22:19:24 +0000 | [diff] [blame] | 166 | */ |
senorblanco@chromium.org | 3f1f2a3 | 2013-10-16 18:07:48 +0000 | [diff] [blame] | 167 | bool cropRectIsSet() const { return fCropRect.flags() != 0x0; } |
senorblanco@chromium.org | 194d775 | 2013-07-24 22:19:24 +0000 | [diff] [blame] | 168 | |
senorblanco@chromium.org | 336d1d7 | 2014-01-27 21:03:17 +0000 | [diff] [blame] | 169 | // Default impl returns union of all input bounds. |
| 170 | virtual void computeFastBounds(const SkRect&, SkRect*) const; |
| 171 | |
senorblanco@chromium.org | 6aa6fec | 2014-03-03 22:13:56 +0000 | [diff] [blame] | 172 | #ifdef SK_SUPPORT_GPU |
| 173 | /** |
| 174 | * Wrap the given texture in a texture-backed SkBitmap. |
| 175 | */ |
| 176 | static void WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result); |
| 177 | |
| 178 | /** |
| 179 | * Recursively evaluate this filter on the GPU. If the filter has no GPU |
| 180 | * implementation, it will be processed in software and uploaded to the GPU. |
| 181 | */ |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 182 | bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkBitmap& src, const Context&, |
senorblanco@chromium.org | 6aa6fec | 2014-03-03 22:13:56 +0000 | [diff] [blame] | 183 | SkBitmap* result, SkIPoint* offset) const; |
| 184 | #endif |
| 185 | |
commit-bot@chromium.org | c0b7e10 | 2013-10-23 17:06:21 +0000 | [diff] [blame] | 186 | SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) |
| 187 | |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 188 | protected: |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 189 | SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL); |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 190 | |
senorblanco@chromium.org | c2e8cef | 2012-10-22 15:07:14 +0000 | [diff] [blame] | 191 | // Convenience constructor for 1-input filters. |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 192 | explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL); |
senorblanco@chromium.org | c2e8cef | 2012-10-22 15:07:14 +0000 | [diff] [blame] | 193 | |
| 194 | // Convenience constructor for 2-input filters. |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 195 | SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect = NULL); |
senorblanco@chromium.org | 9f25de7 | 2012-10-10 20:36:13 +0000 | [diff] [blame] | 196 | |
| 197 | virtual ~SkImageFilter(); |
| 198 | |
commit-bot@chromium.org | c84728d | 2013-12-04 20:07:47 +0000 | [diff] [blame] | 199 | /** |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 200 | * Constructs a new SkImageFilter read from an SkReadBuffer object. |
commit-bot@chromium.org | c84728d | 2013-12-04 20:07:47 +0000 | [diff] [blame] | 201 | * |
| 202 | * @param inputCount The exact number of inputs expected for this SkImageFilter object. |
| 203 | * -1 can be used if the filter accepts any number of inputs. |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 204 | * @param rb SkReadBuffer object from which the SkImageFilter is read. |
commit-bot@chromium.org | c84728d | 2013-12-04 20:07:47 +0000 | [diff] [blame] | 205 | */ |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 206 | explicit SkImageFilter(int inputCount, SkReadBuffer& rb); |
senorblanco@chromium.org | 9f25de7 | 2012-10-10 20:36:13 +0000 | [diff] [blame] | 207 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 208 | virtual void flatten(SkWriteBuffer& wb) const SK_OVERRIDE; |
reed@google.com | 32d25b6 | 2011-12-20 16:19:00 +0000 | [diff] [blame] | 209 | |
senorblanco@chromium.org | 6776b82 | 2014-01-03 21:48:22 +0000 | [diff] [blame] | 210 | /** |
| 211 | * This is the virtual which should be overridden by the derived class |
| 212 | * to perform image filtering. |
| 213 | * |
| 214 | * src is the original primitive bitmap. If the filter has a connected |
| 215 | * input, it should recurse on that input and use that in place of src. |
| 216 | * |
| 217 | * The matrix is the current matrix on the canvas. |
| 218 | * |
| 219 | * Offset is the amount to translate the resulting image relative to the |
| 220 | * src when it is drawn. This is an out-param. |
| 221 | * |
| 222 | * If the result image cannot be created, this should false, in which |
| 223 | * case both the result and offset parameters will be ignored by the |
| 224 | * caller. |
| 225 | */ |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 226 | virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 227 | SkBitmap* result, SkIPoint* offset) const; |
senorblanco@chromium.org | c4b12f1 | 2014-02-05 17:51:22 +0000 | [diff] [blame] | 228 | // Given the bounds of the destination rect to be filled in device |
| 229 | // coordinates (first parameter), and the CTM, compute (conservatively) |
| 230 | // which rect of the source image would be required (third parameter). |
| 231 | // Used for clipping and temp-buffer allocations, so the result need not |
| 232 | // be exact, but should never be smaller than the real answer. The default |
| 233 | // implementation recursively unions all input bounds, or returns false if |
| 234 | // no inputs. |
| 235 | virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const; |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 236 | |
senorblanco@chromium.org | 1182529 | 2014-03-14 17:44:41 +0000 | [diff] [blame] | 237 | /** Computes source bounds as the src bitmap bounds offset by srcOffset. |
| 238 | * Apply the transformed crop rect to the bounds if any of the |
| 239 | * corresponding edge flags are set. Intersects the result against the |
| 240 | * context's clipBounds, and returns the result in "bounds". If there is |
| 241 | * no intersection, returns false and leaves "bounds" unchanged. |
| 242 | */ |
| 243 | bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcOffset, |
| 244 | SkIRect* bounds) const; |
| 245 | |
| 246 | /** Same as the above call, except that if the resulting crop rect is not |
| 247 | * entirely contained by the source bitmap's bounds, it creates a new |
| 248 | * bitmap in "result" and pads the edges with transparent black. In that |
| 249 | * case, the srcOffset is modified to be the same as the bounds, since no |
| 250 | * further adjustment is needed by the caller. This version should only |
| 251 | * be used by filters which are not capable of processing a smaller |
| 252 | * source bitmap into a larger destination. |
| 253 | */ |
| 254 | bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoint* srcOffset, |
| 255 | SkIRect* bounds, SkBitmap* result) const; |
senorblanco@chromium.org | 194d775 | 2013-07-24 22:19:24 +0000 | [diff] [blame] | 256 | |
senorblanco@chromium.org | 1aa6872 | 2013-10-17 19:35:09 +0000 | [diff] [blame] | 257 | /** |
| 258 | * Returns true if the filter can be expressed a single-pass |
| 259 | * GrEffect, used to process this filter on the GPU, or false if |
| 260 | * not. |
| 261 | * |
| 262 | * If effect is non-NULL, a new GrEffect instance is stored |
| 263 | * in it. The caller assumes ownership of the stage, and it is up to the |
| 264 | * caller to unref it. |
| 265 | * |
| 266 | * The effect can assume its vertexCoords space maps 1-to-1 with texels |
| 267 | * in the texture. "matrix" is a transformation to apply to filter |
| 268 | * parameters before they are used in the effect. Note that this function |
| 269 | * will be called with (NULL, NULL, SkMatrix::I()) to query for support, |
| 270 | * so returning "true" indicates support for all possible matrices. |
| 271 | */ |
senorblanco@chromium.org | 7938bae | 2013-10-18 20:08:14 +0000 | [diff] [blame] | 272 | virtual bool asNewEffect(GrEffectRef** effect, |
| 273 | GrTexture*, |
| 274 | const SkMatrix& matrix, |
| 275 | const SkIRect& bounds) const; |
senorblanco@chromium.org | 1aa6872 | 2013-10-17 19:35:09 +0000 | [diff] [blame] | 276 | |
senorblanco@chromium.org | 6aa6fec | 2014-03-03 22:13:56 +0000 | [diff] [blame] | 277 | |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 278 | private: |
senorblanco@chromium.org | 54e01b2 | 2011-11-16 18:20:47 +0000 | [diff] [blame] | 279 | typedef SkFlattenable INHERITED; |
senorblanco@chromium.org | 8d21f6c | 2012-10-12 19:14:06 +0000 | [diff] [blame] | 280 | int fInputCount; |
senorblanco@chromium.org | 9f25de7 | 2012-10-10 20:36:13 +0000 | [diff] [blame] | 281 | SkImageFilter** fInputs; |
senorblanco@chromium.org | b295fb6 | 2013-10-10 13:51:19 +0000 | [diff] [blame] | 282 | CropRect fCropRect; |
reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame] | 283 | }; |
| 284 | |
| 285 | #endif |