| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrBezierEffect_DEFINED | 8 #ifndef GrBezierEffect_DEFINED |
| 9 #define GrBezierEffect_DEFINED | 9 #define GrBezierEffect_DEFINED |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 * were "not too thin" curves and ellipses then 2nd order may have an advantage
since | 53 * were "not too thin" curves and ellipses then 2nd order may have an advantage
since |
| 54 * only one geometry would need to be rendered. However no benches were run comp
aring | 54 * only one geometry would need to be rendered. However no benches were run comp
aring |
| 55 * chopped first order and non chopped 2nd order. | 55 * chopped first order and non chopped 2nd order. |
| 56 */ | 56 */ |
| 57 class GrGLConicEffect; | 57 class GrGLConicEffect; |
| 58 | 58 |
| 59 class GrConicEffect : public GrGeometryProcessor { | 59 class GrConicEffect : public GrGeometryProcessor { |
| 60 public: | 60 public: |
| 61 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 61 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 62 const GrDrawTargetCaps& caps) { | 62 const GrDrawTargetCaps& caps) { |
| 63 GR_CREATE_STATIC_PROCESSOR(gConicFillAA, GrConicEffect, (kFillAA_GrProce
ssorEdgeType)); | |
| 64 GR_CREATE_STATIC_PROCESSOR(gConicHairAA, GrConicEffect, (kHairlineAA_GrP
rocessorEdgeType)); | |
| 65 GR_CREATE_STATIC_PROCESSOR(gConicFillBW, GrConicEffect, (kFillBW_GrProce
ssorEdgeType)); | |
| 66 switch (edgeType) { | 63 switch (edgeType) { |
| 67 case kFillAA_GrProcessorEdgeType: | 64 case kFillAA_GrProcessorEdgeType: |
| 68 if (!caps.shaderDerivativeSupport()) { | 65 if (!caps.shaderDerivativeSupport()) { |
| 69 return NULL; | 66 return NULL; |
| 70 } | 67 } |
| 71 gConicFillAA->ref(); | 68 return SkNEW_ARGS(GrConicEffect, (kFillAA_GrProcessorEdgeType)); |
| 72 return gConicFillAA; | |
| 73 case kHairlineAA_GrProcessorEdgeType: | 69 case kHairlineAA_GrProcessorEdgeType: |
| 74 if (!caps.shaderDerivativeSupport()) { | 70 if (!caps.shaderDerivativeSupport()) { |
| 75 return NULL; | 71 return NULL; |
| 76 } | 72 } |
| 77 gConicHairAA->ref(); | 73 return SkNEW_ARGS(GrConicEffect, (kHairlineAA_GrProcessorEdgeTyp
e)); |
| 78 return gConicHairAA; | |
| 79 case kFillBW_GrProcessorEdgeType: | 74 case kFillBW_GrProcessorEdgeType: |
| 80 gConicFillBW->ref(); | 75 return SkNEW_ARGS(GrConicEffect, (kFillBW_GrProcessorEdgeType));
; |
| 81 return gConicFillBW; | |
| 82 default: | 76 default: |
| 83 return NULL; | 77 return NULL; |
| 84 } | 78 } |
| 85 } | 79 } |
| 86 | 80 |
| 87 virtual ~GrConicEffect(); | 81 virtual ~GrConicEffect(); |
| 88 | 82 |
| 89 virtual const char* name() const SK_OVERRIDE { return "Conic"; } | 83 virtual const char* name() const SK_OVERRIDE { return "Conic"; } |
| 90 | 84 |
| 91 inline const GrAttribute* inPosition() const { return fInPosition; } | 85 inline const GrAttribute* inPosition() const { return fInPosition; } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. | 120 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. |
| 127 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. | 121 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. |
| 128 * Requires shader derivative instruction support. | 122 * Requires shader derivative instruction support. |
| 129 */ | 123 */ |
| 130 class GrGLQuadEffect; | 124 class GrGLQuadEffect; |
| 131 | 125 |
| 132 class GrQuadEffect : public GrGeometryProcessor { | 126 class GrQuadEffect : public GrGeometryProcessor { |
| 133 public: | 127 public: |
| 134 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 128 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 135 const GrDrawTargetCaps& caps) { | 129 const GrDrawTargetCaps& caps) { |
| 136 GR_CREATE_STATIC_PROCESSOR(gQuadFillAA, GrQuadEffect, (kFillAA_GrProcess
orEdgeType)); | |
| 137 GR_CREATE_STATIC_PROCESSOR(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrPro
cessorEdgeType)); | |
| 138 GR_CREATE_STATIC_PROCESSOR(gQuadFillBW, GrQuadEffect, (kFillBW_GrProcess
orEdgeType)); | |
| 139 switch (edgeType) { | 130 switch (edgeType) { |
| 140 case kFillAA_GrProcessorEdgeType: | 131 case kFillAA_GrProcessorEdgeType: |
| 141 if (!caps.shaderDerivativeSupport()) { | 132 if (!caps.shaderDerivativeSupport()) { |
| 142 return NULL; | 133 return NULL; |
| 143 } | 134 } |
| 144 gQuadFillAA->ref(); | 135 return SkNEW_ARGS(GrQuadEffect, (kFillAA_GrProcessorEdgeType)); |
| 145 return gQuadFillAA; | |
| 146 case kHairlineAA_GrProcessorEdgeType: | 136 case kHairlineAA_GrProcessorEdgeType: |
| 147 if (!caps.shaderDerivativeSupport()) { | 137 if (!caps.shaderDerivativeSupport()) { |
| 148 return NULL; | 138 return NULL; |
| 149 } | 139 } |
| 150 gQuadHairAA->ref(); | 140 return SkNEW_ARGS(GrQuadEffect, (kHairlineAA_GrProcessorEdgeType
)); |
| 151 return gQuadHairAA; | |
| 152 case kFillBW_GrProcessorEdgeType: | 141 case kFillBW_GrProcessorEdgeType: |
| 153 gQuadFillBW->ref(); | 142 return SkNEW_ARGS(GrQuadEffect, (kFillBW_GrProcessorEdgeType)); |
| 154 return gQuadFillBW; | |
| 155 default: | 143 default: |
| 156 return NULL; | 144 return NULL; |
| 157 } | 145 } |
| 158 } | 146 } |
| 159 | 147 |
| 160 virtual ~GrQuadEffect(); | 148 virtual ~GrQuadEffect(); |
| 161 | 149 |
| 162 virtual const char* name() const SK_OVERRIDE { return "Quad"; } | 150 virtual const char* name() const SK_OVERRIDE { return "Quad"; } |
| 163 | 151 |
| 164 inline const GrAttribute* inPosition() const { return fInPosition; } | 152 inline const GrAttribute* inPosition() const { return fInPosition; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 * the fourth value is not used. Distance is calculated using a | 189 * the fourth value is not used. Distance is calculated using a |
| 202 * first order approximation from the taylor series. | 190 * first order approximation from the taylor series. |
| 203 * Coverage for AA is max(0, 1-distance). | 191 * Coverage for AA is max(0, 1-distance). |
| 204 */ | 192 */ |
| 205 class GrGLCubicEffect; | 193 class GrGLCubicEffect; |
| 206 | 194 |
| 207 class GrCubicEffect : public GrGeometryProcessor { | 195 class GrCubicEffect : public GrGeometryProcessor { |
| 208 public: | 196 public: |
| 209 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 197 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 210 const GrDrawTargetCaps& caps) { | 198 const GrDrawTargetCaps& caps) { |
| 211 GR_CREATE_STATIC_PROCESSOR(gCubicFillAA, GrCubicEffect, (kFillAA_GrProce
ssorEdgeType)); | |
| 212 GR_CREATE_STATIC_PROCESSOR(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrP
rocessorEdgeType)); | |
| 213 GR_CREATE_STATIC_PROCESSOR(gCubicFillBW, GrCubicEffect, (kFillBW_GrProce
ssorEdgeType)); | |
| 214 switch (edgeType) { | 199 switch (edgeType) { |
| 215 case kFillAA_GrProcessorEdgeType: | 200 case kFillAA_GrProcessorEdgeType: |
| 216 if (!caps.shaderDerivativeSupport()) { | 201 if (!caps.shaderDerivativeSupport()) { |
| 217 return NULL; | 202 return NULL; |
| 218 } | 203 } |
| 219 gCubicFillAA->ref(); | 204 return SkNEW_ARGS(GrCubicEffect, (kFillAA_GrProcessorEdgeType)); |
| 220 return gCubicFillAA; | |
| 221 case kHairlineAA_GrProcessorEdgeType: | 205 case kHairlineAA_GrProcessorEdgeType: |
| 222 if (!caps.shaderDerivativeSupport()) { | 206 if (!caps.shaderDerivativeSupport()) { |
| 223 return NULL; | 207 return NULL; |
| 224 } | 208 } |
| 225 gCubicHairAA->ref(); | 209 return SkNEW_ARGS(GrCubicEffect, (kHairlineAA_GrProcessorEdgeTyp
e)); |
| 226 return gCubicHairAA; | |
| 227 case kFillBW_GrProcessorEdgeType: | 210 case kFillBW_GrProcessorEdgeType: |
| 228 gCubicFillBW->ref(); | 211 return SkNEW_ARGS(GrCubicEffect, (kFillBW_GrProcessorEdgeType)); |
| 229 return gCubicFillBW; | |
| 230 default: | 212 default: |
| 231 return NULL; | 213 return NULL; |
| 232 } | 214 } |
| 233 } | 215 } |
| 234 | 216 |
| 235 virtual ~GrCubicEffect(); | 217 virtual ~GrCubicEffect(); |
| 236 | 218 |
| 237 virtual const char* name() const SK_OVERRIDE { return "Cubic"; } | 219 virtual const char* name() const SK_OVERRIDE { return "Cubic"; } |
| 238 | 220 |
| 239 inline const GrAttribute* inPosition() const { return fInPosition; } | 221 inline const GrAttribute* inPosition() const { return fInPosition; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 260 GrPrimitiveEdgeType fEdgeType; | 242 GrPrimitiveEdgeType fEdgeType; |
| 261 const GrAttribute* fInPosition; | 243 const GrAttribute* fInPosition; |
| 262 const GrAttribute* fInCubicCoeffs; | 244 const GrAttribute* fInCubicCoeffs; |
| 263 | 245 |
| 264 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 246 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 265 | 247 |
| 266 typedef GrGeometryProcessor INHERITED; | 248 typedef GrGeometryProcessor INHERITED; |
| 267 }; | 249 }; |
| 268 | 250 |
| 269 #endif | 251 #endif |
| OLD | NEW |