epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2010 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 11 | #ifndef GrSamplerState_DEFINED |
| 12 | #define GrSamplerState_DEFINED |
| 13 | |
tomhudson@google.com | 07eecdc | 2012-04-20 18:35:38 +0000 | [diff] [blame] | 14 | #include "GrCustomStage.h" |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 15 | #include "GrMatrix.h" |
tomhudson@google.com | 07eecdc | 2012-04-20 18:35:38 +0000 | [diff] [blame] | 16 | #include "GrTypes.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 17 | |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 18 | #define MAX_KERNEL_WIDTH 25 |
| 19 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 20 | class GrSamplerState { |
| 21 | public: |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 22 | enum Filter { |
| 23 | /** |
| 24 | * Read the closest src texel to the sample position |
| 25 | */ |
| 26 | kNearest_Filter, |
| 27 | /** |
| 28 | * Blend between closest 4 src texels to sample position (tent filter) |
| 29 | */ |
| 30 | kBilinear_Filter, |
| 31 | /** |
| 32 | * Average of 4 bilinear filterings spaced +/- 1 texel from sample |
| 33 | * position in x and y. Intended for averaging 16 texels in a downsample |
| 34 | * pass. (rasterizing such that texture samples fall exactly halfway |
bsalomon@google.com | 1f221a7 | 2011-08-23 20:54:07 +0000 | [diff] [blame] | 35 | * between texels in x and y spaced 4 texels apart.) Only supported |
| 36 | * on shader backends. |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 37 | */ |
| 38 | k4x4Downsample_Filter, |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 39 | /** |
| 40 | * Apply a separable convolution kernel. |
| 41 | */ |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 42 | kConvolution_Filter, |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 43 | /** |
| 44 | * Apply a dilate filter (max over a 1D radius). |
| 45 | */ |
| 46 | kDilate_Filter, |
| 47 | /** |
| 48 | * Apply an erode filter (min over a 1D radius). |
| 49 | */ |
| 50 | kErode_Filter, |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 51 | |
| 52 | kDefault_Filter = kNearest_Filter |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 55 | /** |
| 56 | * The intepretation of the texture matrix depends on the sample mode. The |
| 57 | * texture matrix is applied both when the texture coordinates are explicit |
| 58 | * and when vertex positions are used as texture coordinates. In the latter |
| 59 | * case the texture matrix is applied to the pre-view-matrix position |
| 60 | * values. |
| 61 | * |
| 62 | * kNormal_SampleMode |
| 63 | * The post-matrix texture coordinates are in normalize space with (0,0) at |
| 64 | * the top-left and (1,1) at the bottom right. |
| 65 | * kRadial_SampleMode |
| 66 | * The matrix specifies the radial gradient parameters. |
| 67 | * (0,0) in the post-matrix space is center of the radial gradient. |
| 68 | * kRadial2_SampleMode |
| 69 | * Matrix transforms to space where first circle is centered at the |
| 70 | * origin. The second circle will be centered (x, 0) where x may be |
| 71 | * 0 and is provided by setRadial2Params. The post-matrix space is |
| 72 | * normalized such that 1 is the second radius - first radius. |
| 73 | * kSweepSampleMode |
| 74 | * The angle from the origin of texture coordinates in post-matrix space |
| 75 | * determines the gradient value. |
| 76 | */ |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 77 | enum SampleMode { |
| 78 | kNormal_SampleMode, //!< sample color directly |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 79 | kRadial_SampleMode, //!< treat as radial gradient |
| 80 | kRadial2_SampleMode, //!< treat as 2-point radial gradient |
| 81 | kSweep_SampleMode, //!< treat as sweep gradient |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 82 | |
| 83 | kDefault_SampleMode = kNormal_SampleMode |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | /** |
| 87 | * Describes how a texture is sampled when coordinates are outside the |
| 88 | * texture border |
| 89 | */ |
| 90 | enum WrapMode { |
| 91 | kClamp_WrapMode, |
| 92 | kRepeat_WrapMode, |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 93 | kMirror_WrapMode, |
| 94 | |
| 95 | kDefault_WrapMode = kClamp_WrapMode |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | /** |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 99 | * For the filters which perform more than one texture sample (convolution, |
| 100 | * erode, dilate), this determines the direction in which the texture |
| 101 | * coordinates will be incremented. |
| 102 | */ |
| 103 | enum FilterDirection { |
| 104 | kX_FilterDirection, |
| 105 | kY_FilterDirection, |
| 106 | |
| 107 | kDefault_FilterDirection = kX_FilterDirection, |
| 108 | }; |
| 109 | /** |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 110 | * Default sampler state is set to clamp, use normal sampling mode, be |
| 111 | * unfiltered, and use identity matrix. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 112 | */ |
bsalomon@google.com | 6aab8e3 | 2011-06-21 20:32:12 +0000 | [diff] [blame] | 113 | GrSamplerState() |
tomhudson@google.com | b88bbd2 | 2012-05-01 12:48:07 +0000 | [diff] [blame] | 114 | : fRadial2CenterX1() |
bsalomon@google.com | 6aab8e3 | 2011-06-21 20:32:12 +0000 | [diff] [blame] | 115 | , fRadial2Radius0() |
tomhudson@google.com | b88bbd2 | 2012-05-01 12:48:07 +0000 | [diff] [blame] | 116 | , fRadial2PosRoot() |
| 117 | , fCustomStage (NULL) { |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 118 | this->reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 119 | } |
| 120 | |
tomhudson@google.com | 07eecdc | 2012-04-20 18:35:38 +0000 | [diff] [blame] | 121 | ~GrSamplerState() { |
| 122 | GrSafeUnref(fCustomStage); |
| 123 | } |
| 124 | |
tomhudson@google.com | 02b1ea2 | 2012-04-30 20:19:07 +0000 | [diff] [blame] | 125 | bool operator ==(const GrSamplerState& s) const { |
tomhudson@google.com | b88bbd2 | 2012-05-01 12:48:07 +0000 | [diff] [blame] | 126 | /* We must be bit-identical as far as the CustomStage; |
| 127 | there may be multiple CustomStages that will produce |
| 128 | the same shader code and so are equivalent. |
| 129 | Can't take the address of fWrapX because it's :8 */ |
| 130 | int bitwiseRegion = (intptr_t) &fCustomStage - (intptr_t) this; |
| 131 | GrAssert(sizeof(GrSamplerState) == |
| 132 | bitwiseRegion + sizeof(fCustomStage)); |
| 133 | return !memcmp(this, &s, bitwiseRegion) && |
| 134 | ((fCustomStage == s.fCustomStage) || |
| 135 | (fCustomStage && s.fCustomStage && |
tomhudson@google.com | d8f856c | 2012-05-10 12:13:36 +0000 | [diff] [blame] | 136 | (fCustomStage->getFactory() == |
| 137 | s.fCustomStage->getFactory()) && |
| 138 | fCustomStage->isEqual(s.fCustomStage))); |
tomhudson@google.com | 02b1ea2 | 2012-04-30 20:19:07 +0000 | [diff] [blame] | 139 | } |
| 140 | bool operator !=(const GrSamplerState& s) const { return !(*this == s); } |
| 141 | |
| 142 | GrSamplerState& operator =(const GrSamplerState s) { |
tomhudson@google.com | 1117559 | 2012-05-31 14:23:28 +0000 | [diff] [blame] | 143 | // memcpy() breaks refcounting |
| 144 | fWrapX = s.fWrapX; |
| 145 | fWrapY = s.fWrapY; |
| 146 | fFilterDirection = s.fFilterDirection; |
| 147 | fSampleMode = s.fSampleMode; |
| 148 | fFilter = s.fFilter; |
| 149 | fMatrix = s.fMatrix; |
| 150 | fSwapRAndB = s.fSwapRAndB; |
| 151 | fTextureDomain = s.fTextureDomain; |
| 152 | |
| 153 | fRadial2CenterX1 = s.fRadial2CenterX1; |
| 154 | fRadial2Radius0 = s.fRadial2Radius0; |
| 155 | fRadial2PosRoot = s.fRadial2PosRoot; |
| 156 | |
| 157 | fKernelWidth = s.fKernelWidth; |
tomhudson@google.com | 67794f5 | 2012-05-31 14:31:14 +0000 | [diff] [blame] | 158 | if (kConvolution_Filter == fFilter) { |
tomhudson@google.com | 1117559 | 2012-05-31 14:23:28 +0000 | [diff] [blame] | 159 | memcpy(fKernel, s.fKernel, MAX_KERNEL_WIDTH * sizeof(float)); |
| 160 | } |
| 161 | |
| 162 | fCustomStage = s.fCustomStage; |
| 163 | SkSafeRef(fCustomStage); |
| 164 | |
tomhudson@google.com | 02b1ea2 | 2012-04-30 20:19:07 +0000 | [diff] [blame] | 165 | return *this; |
| 166 | } |
| 167 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 168 | WrapMode getWrapX() const { return fWrapX; } |
| 169 | WrapMode getWrapY() const { return fWrapY; } |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 170 | FilterDirection getFilterDirection() const { return fFilterDirection; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 171 | SampleMode getSampleMode() const { return fSampleMode; } |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 172 | const GrMatrix& getMatrix() const { return fMatrix; } |
junov@google.com | 6acc9b3 | 2011-05-16 18:32:07 +0000 | [diff] [blame] | 173 | const GrRect& getTextureDomain() const { return fTextureDomain; } |
senorblanco@chromium.org | 64cc579 | 2011-05-19 19:58:58 +0000 | [diff] [blame] | 174 | bool hasTextureDomain() const {return SkIntToScalar(0) != fTextureDomain.right();} |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 175 | Filter getFilter() const { return fFilter; } |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 176 | int getKernelWidth() const { return fKernelWidth; } |
| 177 | const float* getKernel() const { return fKernel; } |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 178 | bool swapsRAndB() const { return fSwapRAndB; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 179 | |
| 180 | bool isGradient() const { |
| 181 | return kRadial_SampleMode == fSampleMode || |
| 182 | kRadial2_SampleMode == fSampleMode || |
| 183 | kSweep_SampleMode == fSampleMode; |
| 184 | } |
| 185 | |
| 186 | void setWrapX(WrapMode mode) { fWrapX = mode; } |
| 187 | void setWrapY(WrapMode mode) { fWrapY = mode; } |
| 188 | void setSampleMode(SampleMode mode) { fSampleMode = mode; } |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 189 | void setFilterDirection(FilterDirection mode) { fFilterDirection = mode; } |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 190 | |
| 191 | /** |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 192 | * Access the sampler's matrix. See SampleMode for explanation of |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 193 | * relationship between the matrix and sample mode. |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 194 | */ |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 195 | GrMatrix* matrix() { return &fMatrix; } |
| 196 | |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 197 | /** |
junov@google.com | 6acc9b3 | 2011-05-16 18:32:07 +0000 | [diff] [blame] | 198 | * Sets the sampler's texture coordinate domain to a |
| 199 | * custom rectangle, rather than the default (0,1). |
| 200 | * This option is currently only supported with kClamp_WrapMode |
| 201 | */ |
| 202 | void setTextureDomain(const GrRect& textureDomain) { fTextureDomain = textureDomain; } |
| 203 | |
| 204 | /** |
bsalomon@google.com | 0a97be2 | 2011-11-08 19:20:57 +0000 | [diff] [blame] | 205 | * Swaps the R and B components when reading from the texture. Has no effect |
| 206 | * if the texture is alpha only. |
| 207 | */ |
| 208 | void setRAndBSwap(bool swap) { fSwapRAndB = swap; } |
| 209 | |
| 210 | /** |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 211 | * Multiplies the current sampler matrix a matrix |
| 212 | * |
| 213 | * After this call M' = M*m where M is the old matrix, m is the parameter |
| 214 | * to this function, and M' is the new matrix. (We consider points to |
| 215 | * be column vectors so tex cood vector t is transformed by matrix X as |
| 216 | * t' = X*t.) |
| 217 | * |
| 218 | * @param matrix the matrix used to modify the matrix. |
| 219 | */ |
| 220 | void preConcatMatrix(const GrMatrix& matrix) { fMatrix.preConcat(matrix); } |
| 221 | |
| 222 | /** |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 223 | * Sets filtering type. |
| 224 | * @param filter type of filtering to apply |
bsalomon@google.com | c6cf723 | 2011-02-17 16:43:10 +0000 | [diff] [blame] | 225 | */ |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 226 | void setFilter(Filter filter) { fFilter = filter; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 227 | |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 228 | void reset(WrapMode wrapXAndY, |
| 229 | Filter filter, |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 230 | FilterDirection direction, |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 231 | const GrMatrix& matrix) { |
| 232 | fWrapX = wrapXAndY; |
| 233 | fWrapY = wrapXAndY; |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 234 | fSampleMode = kDefault_SampleMode; |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 235 | fFilter = filter; |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 236 | fFilterDirection = direction; |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 237 | fMatrix = matrix; |
| 238 | fTextureDomain.setEmpty(); |
| 239 | fSwapRAndB = false; |
tomhudson@google.com | 07eecdc | 2012-04-20 18:35:38 +0000 | [diff] [blame] | 240 | GrSafeSetNull(fCustomStage); |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 241 | } |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 242 | void reset(WrapMode wrapXAndY, Filter filter, const GrMatrix& matrix) { |
| 243 | this->reset(wrapXAndY, filter, kDefault_FilterDirection, matrix); |
| 244 | } |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 245 | void reset(WrapMode wrapXAndY, |
| 246 | Filter filter) { |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 247 | this->reset(wrapXAndY, filter, kDefault_FilterDirection, GrMatrix::I()); |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 248 | } |
bsalomon@google.com | 1e266f8 | 2011-12-12 16:11:33 +0000 | [diff] [blame] | 249 | void reset(const GrMatrix& matrix) { |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 250 | this->reset(kDefault_WrapMode, kDefault_Filter, kDefault_FilterDirection, matrix); |
bsalomon@google.com | aa814fe | 2011-12-12 18:45:07 +0000 | [diff] [blame] | 251 | } |
| 252 | void reset() { |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 253 | this->reset(kDefault_WrapMode, kDefault_Filter, kDefault_FilterDirection, GrMatrix::I()); |
bsalomon@google.com | 1e266f8 | 2011-12-12 16:11:33 +0000 | [diff] [blame] | 254 | } |
bsalomon@google.com | 9791291 | 2011-12-06 16:30:36 +0000 | [diff] [blame] | 255 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 256 | GrScalar getRadial2CenterX1() const { return fRadial2CenterX1; } |
| 257 | GrScalar getRadial2Radius0() const { return fRadial2Radius0; } |
bsalomon@google.com | e7160bf | 2011-11-10 15:28:16 +0000 | [diff] [blame] | 258 | bool isRadial2PosRoot() const { return SkToBool(fRadial2PosRoot); } |
bsalomon@google.com | 22c5dea | 2011-07-07 14:38:03 +0000 | [diff] [blame] | 259 | // do the radial gradient params lead to a linear (rather than quadratic) |
| 260 | // equation. |
| 261 | bool radial2IsDegenerate() const { return GR_Scalar1 == fRadial2CenterX1; } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 262 | |
| 263 | /** |
bsalomon@google.com | 5782d71 | 2011-01-21 21:03:59 +0000 | [diff] [blame] | 264 | * Sets the parameters for kRadial2_SampleMode. The texture |
| 265 | * matrix must be set so that the first point is at (0,0) and the second |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 266 | * point lies on the x-axis. The second radius minus the first is 1 unit. |
| 267 | * The additional parameters to define the gradient are specified by this |
| 268 | * function. |
| 269 | */ |
| 270 | void setRadial2Params(GrScalar centerX1, GrScalar radius0, bool posRoot) { |
| 271 | fRadial2CenterX1 = centerX1; |
| 272 | fRadial2Radius0 = radius0; |
| 273 | fRadial2PosRoot = posRoot; |
| 274 | } |
| 275 | |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 276 | void setConvolutionParams(int kernelWidth, const float* kernel) { |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 277 | GrAssert(kernelWidth >= 0 && kernelWidth <= MAX_KERNEL_WIDTH); |
| 278 | fKernelWidth = kernelWidth; |
| 279 | if (NULL != kernel) { |
| 280 | memcpy(fKernel, kernel, kernelWidth * sizeof(float)); |
| 281 | } |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | void setMorphologyRadius(int radius) { |
| 285 | GrAssert(radius >= 0 && radius <= MAX_KERNEL_WIDTH); |
| 286 | fKernelWidth = radius; |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 287 | } |
| 288 | |
tomhudson@google.com | 07eecdc | 2012-04-20 18:35:38 +0000 | [diff] [blame] | 289 | void setCustomStage(GrCustomStage* stage) { |
| 290 | GrSafeAssign(fCustomStage, stage); |
| 291 | } |
| 292 | GrCustomStage* getCustomStage() const { return fCustomStage; } |
| 293 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 294 | private: |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 295 | WrapMode fWrapX : 8; |
| 296 | WrapMode fWrapY : 8; |
| 297 | FilterDirection fFilterDirection : 8; |
| 298 | SampleMode fSampleMode : 8; |
| 299 | Filter fFilter : 8; |
| 300 | GrMatrix fMatrix; |
| 301 | bool fSwapRAndB; |
| 302 | GrRect fTextureDomain; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 303 | |
| 304 | // these are undefined unless fSampleMode == kRadial2_SampleMode |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 305 | GrScalar fRadial2CenterX1; |
| 306 | GrScalar fRadial2Radius0; |
| 307 | SkBool8 fRadial2PosRoot; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 308 | |
senorblanco@chromium.org | 027de5f | 2011-07-08 18:03:33 +0000 | [diff] [blame] | 309 | // These are undefined unless fFilter == kConvolution_Filter |
senorblanco@chromium.org | 05054f1 | 2012-03-02 21:05:45 +0000 | [diff] [blame] | 310 | uint8_t fKernelWidth; |
| 311 | float fKernel[MAX_KERNEL_WIDTH]; |
tomhudson@google.com | 02b1ea2 | 2012-04-30 20:19:07 +0000 | [diff] [blame] | 312 | |
tomhudson@google.com | 02b1ea2 | 2012-04-30 20:19:07 +0000 | [diff] [blame] | 313 | GrCustomStage* fCustomStage; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | #endif |
| 317 | |