| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 * were "not too thin" curves and ellipses then 2nd order may have an advantage
since | 52 * were "not too thin" curves and ellipses then 2nd order may have an advantage
since |
| 53 * only one geometry would need to be rendered. However no benches were run comp
aring | 53 * only one geometry would need to be rendered. However no benches were run comp
aring |
| 54 * chopped first order and non chopped 2nd order. | 54 * chopped first order and non chopped 2nd order. |
| 55 */ | 55 */ |
| 56 class GrGLConicEffect; | 56 class GrGLConicEffect; |
| 57 | 57 |
| 58 class GrConicEffect : public GrGeometryProcessor { | 58 class GrConicEffect : public GrGeometryProcessor { |
| 59 public: | 59 public: |
| 60 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 60 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 61 const GrDrawTargetCaps& caps) { | 61 const GrDrawTargetCaps& caps) { |
| 62 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicFillAA, GrConicEffect, | 62 GR_CREATE_STATIC_PROCESSOR(gConicFillAA, GrConicEffect, (kFillAA_GrProce
ssorEdgeType)); |
| 63 (kFillAA_GrProcessorEdgeType)); | 63 GR_CREATE_STATIC_PROCESSOR(gConicHairAA, GrConicEffect, (kHairlineAA_GrP
rocessorEdgeType)); |
| 64 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicHairAA, GrConicEffect, | 64 GR_CREATE_STATIC_PROCESSOR(gConicFillBW, GrConicEffect, (kFillBW_GrProce
ssorEdgeType)); |
| 65 (kHairlineAA_GrProcessorEdgeType)); | |
| 66 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicFillBW, GrConicEffect, | |
| 67 (kFillBW_GrProcessorEdgeType)); | |
| 68 switch (edgeType) { | 65 switch (edgeType) { |
| 69 case kFillAA_GrProcessorEdgeType: | 66 case kFillAA_GrProcessorEdgeType: |
| 70 if (!caps.shaderDerivativeSupport()) { | 67 if (!caps.shaderDerivativeSupport()) { |
| 71 return NULL; | 68 return NULL; |
| 72 } | 69 } |
| 73 gConicFillAA->ref(); | 70 gConicFillAA->ref(); |
| 74 return gConicFillAA; | 71 return gConicFillAA; |
| 75 case kHairlineAA_GrProcessorEdgeType: | 72 case kHairlineAA_GrProcessorEdgeType: |
| 76 if (!caps.shaderDerivativeSupport()) { | 73 if (!caps.shaderDerivativeSupport()) { |
| 77 return NULL; | 74 return NULL; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. | 121 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. |
| 125 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. | 122 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. |
| 126 * Requires shader derivative instruction support. | 123 * Requires shader derivative instruction support. |
| 127 */ | 124 */ |
| 128 class GrGLQuadEffect; | 125 class GrGLQuadEffect; |
| 129 | 126 |
| 130 class GrQuadEffect : public GrGeometryProcessor { | 127 class GrQuadEffect : public GrGeometryProcessor { |
| 131 public: | 128 public: |
| 132 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 129 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 133 const GrDrawTargetCaps& caps) { | 130 const GrDrawTargetCaps& caps) { |
| 134 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadFillAA, GrQuadEffect, | 131 GR_CREATE_STATIC_PROCESSOR(gQuadFillAA, GrQuadEffect, (kFillAA_GrProcess
orEdgeType)); |
| 135 (kFillAA_GrProcessorEdgeType)); | 132 GR_CREATE_STATIC_PROCESSOR(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrPro
cessorEdgeType)); |
| 136 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadHairAA, GrQuadEffect, | 133 GR_CREATE_STATIC_PROCESSOR(gQuadFillBW, GrQuadEffect, (kFillBW_GrProcess
orEdgeType)); |
| 137 (kHairlineAA_GrProcessorEdgeType)); | |
| 138 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadFillBW, GrQuadEffect, | |
| 139 (kFillBW_GrProcessorEdgeType)); | |
| 140 switch (edgeType) { | 134 switch (edgeType) { |
| 141 case kFillAA_GrProcessorEdgeType: | 135 case kFillAA_GrProcessorEdgeType: |
| 142 if (!caps.shaderDerivativeSupport()) { | 136 if (!caps.shaderDerivativeSupport()) { |
| 143 return NULL; | 137 return NULL; |
| 144 } | 138 } |
| 145 gQuadFillAA->ref(); | 139 gQuadFillAA->ref(); |
| 146 return gQuadFillAA; | 140 return gQuadFillAA; |
| 147 case kHairlineAA_GrProcessorEdgeType: | 141 case kHairlineAA_GrProcessorEdgeType: |
| 148 if (!caps.shaderDerivativeSupport()) { | 142 if (!caps.shaderDerivativeSupport()) { |
| 149 return NULL; | 143 return NULL; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 * the fourth value is not used. Distance is calculated using a | 192 * the fourth value is not used. Distance is calculated using a |
| 199 * first order approximation from the taylor series. | 193 * first order approximation from the taylor series. |
| 200 * Coverage for AA is max(0, 1-distance). | 194 * Coverage for AA is max(0, 1-distance). |
| 201 */ | 195 */ |
| 202 class GrGLCubicEffect; | 196 class GrGLCubicEffect; |
| 203 | 197 |
| 204 class GrCubicEffect : public GrGeometryProcessor { | 198 class GrCubicEffect : public GrGeometryProcessor { |
| 205 public: | 199 public: |
| 206 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, | 200 static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType, |
| 207 const GrDrawTargetCaps& caps) { | 201 const GrDrawTargetCaps& caps) { |
| 208 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicFillAA, GrCubicEffect, | 202 GR_CREATE_STATIC_PROCESSOR(gCubicFillAA, GrCubicEffect, (kFillAA_GrProce
ssorEdgeType)); |
| 209 (kFillAA_GrProcessorEdgeType)); | 203 GR_CREATE_STATIC_PROCESSOR(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrP
rocessorEdgeType)); |
| 210 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicHairAA, GrCubicEffect, | 204 GR_CREATE_STATIC_PROCESSOR(gCubicFillBW, GrCubicEffect, (kFillBW_GrProce
ssorEdgeType)); |
| 211 (kHairlineAA_GrProcessorEdgeType)); | |
| 212 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicFillBW, GrCubicEffect, | |
| 213 (kFillBW_GrProcessorEdgeType)); | |
| 214 switch (edgeType) { | 205 switch (edgeType) { |
| 215 case kFillAA_GrProcessorEdgeType: | 206 case kFillAA_GrProcessorEdgeType: |
| 216 if (!caps.shaderDerivativeSupport()) { | 207 if (!caps.shaderDerivativeSupport()) { |
| 217 return NULL; | 208 return NULL; |
| 218 } | 209 } |
| 219 gCubicFillAA->ref(); | 210 gCubicFillAA->ref(); |
| 220 return gCubicFillAA; | 211 return gCubicFillAA; |
| 221 case kHairlineAA_GrProcessorEdgeType: | 212 case kHairlineAA_GrProcessorEdgeType: |
| 222 if (!caps.shaderDerivativeSupport()) { | 213 if (!caps.shaderDerivativeSupport()) { |
| 223 return NULL; | 214 return NULL; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 247 |
| 257 GrPrimitiveEdgeType fEdgeType; | 248 GrPrimitiveEdgeType fEdgeType; |
| 258 const GrShaderVar& fInCubicCoeffs; | 249 const GrShaderVar& fInCubicCoeffs; |
| 259 | 250 |
| 260 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 251 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 261 | 252 |
| 262 typedef GrGeometryProcessor INHERITED; | 253 typedef GrGeometryProcessor INHERITED; |
| 263 }; | 254 }; |
| 264 | 255 |
| 265 #endif | 256 #endif |
| OLD | NEW |