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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /** | 70 /** |
71 * Returns true if the filter can be expressed a single-pass | 71 * Returns true if the filter can be expressed a single-pass |
72 * GrEffect, used to process this filter on the GPU, or false if | 72 * GrEffect, used to process this filter on the GPU, or false if |
73 * not. | 73 * not. |
74 * | 74 * |
75 * If effect is non-NULL, a new GrEffect instance is stored | 75 * If effect is non-NULL, a new GrEffect instance is stored |
76 * in it. The caller assumes ownership of the stage, and it is up to the | 76 * in it. The caller assumes ownership of the stage, and it is up to the |
77 * caller to unref it. | 77 * caller to unref it. |
78 * | 78 * |
79 * The effect can assume its vertexCoords space maps 1-to-1 with texels | 79 * The effect can assume its vertexCoords space maps 1-to-1 with texels |
80 * in the texture. "offset" is the delta between the source and | 80 * in the texture. "matrix" is a transformation to apply to filter |
81 * destination rect's origins, when cropped processing is being performed. | 81 * parameters before they are used in the effect. Note that this function |
| 82 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, |
| 83 * so returning "true" indicates support for all possible matrices. |
82 */ | 84 */ |
83 virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkIPoint& o
ffset) const; | 85 virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix& m
atrix) const; |
84 | 86 |
85 /** | 87 /** |
86 * Returns true if the filter can be processed on the GPU. This is most | 88 * Returns true if the filter can be processed on the GPU. This is most |
87 * often used for multi-pass effects, where intermediate results must be | 89 * often used for multi-pass effects, where intermediate results must be |
88 * rendered to textures. For single-pass effects, use asNewEffect(). | 90 * rendered to textures. For single-pass effects, use asNewEffect(). |
89 * The default implementation returns asNewEffect(NULL, NULL). | 91 * The default implementation returns asNewEffect(NULL, NULL, SkMatrix::I()
). |
90 */ | 92 */ |
91 virtual bool canFilterImageGPU() const; | 93 virtual bool canFilterImageGPU() const; |
92 | 94 |
93 /** | 95 /** |
94 * Process this image filter on the GPU. This is most often used for | 96 * Process this image filter on the GPU. This is most often used for |
95 * multi-pass effects, where intermediate results must be rendered to | 97 * multi-pass effects, where intermediate results must be rendered to |
96 * textures. For single-pass effects, use asNewEffect(). src is the | 98 * textures. For single-pass effects, use asNewEffect(). src is the |
97 * source image for processing, as a texture-backed bitmap. result is | 99 * source image for processing, as a texture-backed bitmap. result is |
98 * the destination bitmap, which should contain a texture-backed pixelref | 100 * the destination bitmap, which should contain a texture-backed pixelref |
99 * on success. offset is the amount to translate the resulting image | 101 * on success. offset is the amount to translate the resulting image |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 explicit SkImageFilter(SkFlattenableReadBuffer& rb); | 154 explicit SkImageFilter(SkFlattenableReadBuffer& rb); |
153 | 155 |
154 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; | 156 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; |
155 | 157 |
156 // Default impl returns false | 158 // Default impl returns false |
157 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 159 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
158 SkBitmap* result, SkIPoint* offset); | 160 SkBitmap* result, SkIPoint* offset); |
159 // Default impl copies src into dst and returns true | 161 // Default impl copies src into dst and returns true |
160 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); | 162 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); |
161 | 163 |
162 // Sets rect to the intersection of rect and the crop rect. If there | 164 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of |
163 // is no overlap, returns false and leaves rect unchanged. | 165 // "rect" and the transformed crop rect. If there is no overlap, returns |
164 bool applyCropRect(SkIRect* rect) const; | 166 // false and leaves "rect" unchanged. |
| 167 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; |
165 | 168 |
166 private: | 169 private: |
167 typedef SkFlattenable INHERITED; | 170 typedef SkFlattenable INHERITED; |
168 int fInputCount; | 171 int fInputCount; |
169 SkImageFilter** fInputs; | 172 SkImageFilter** fInputs; |
170 SkIRect fCropRect; | 173 SkIRect fCropRect; |
171 }; | 174 }; |
172 | 175 |
173 #endif | 176 #endif |
OLD | NEW |