| 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 #include "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
| 9 | 9 |
| 10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); | 102 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); |
| 103 break; | 103 break; |
| 104 } | 104 } |
| 105 case kFillBW_GrEffectEdgeType: { | 105 case kFillBW_GrEffectEdgeType: { |
| 106 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x - %s.y*%s.z;\n", f
sName, fsName, | 106 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x - %s.y*%s.z;\n", f
sName, fsName, |
| 107 fsName, fsName); | 107 fsName, fsName); |
| 108 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); | 108 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); |
| 109 break; | 109 break; |
| 110 } | 110 } |
| 111 default: | 111 default: |
| 112 GrCrash("Shouldn't get here"); | 112 SkFAIL("Shouldn't get here"); |
| 113 } | 113 } |
| 114 | 114 |
| 115 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 115 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 116 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); | 116 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 GrGLEffect::EffectKey GrGLConicEffect::GenKey(const GrDrawEffect& drawEffect, co
nst GrGLCaps&) { | 119 GrGLEffect::EffectKey GrGLConicEffect::GenKey(const GrDrawEffect& drawEffect, co
nst GrGLCaps&) { |
| 120 const GrConicEffect& ce = drawEffect.castEffect<GrConicEffect>(); | 120 const GrConicEffect& ce = drawEffect.castEffect<GrConicEffect>(); |
| 121 return ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 121 return ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
| 122 } | 122 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); | 237 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); |
| 238 break; | 238 break; |
| 239 } | 239 } |
| 240 case kFillBW_GrEffectEdgeType: { | 240 case kFillBW_GrEffectEdgeType: { |
| 241 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsNa
me, fsName, | 241 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsNa
me, fsName, |
| 242 fsName); | 242 fsName); |
| 243 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); | 243 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); |
| 244 break; | 244 break; |
| 245 } | 245 } |
| 246 default: | 246 default: |
| 247 GrCrash("Shouldn't get here"); | 247 SkFAIL("Shouldn't get here"); |
| 248 } | 248 } |
| 249 | 249 |
| 250 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 250 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 251 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); | 251 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); |
| 252 | 252 |
| 253 | 253 |
| 254 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); | 254 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 GrGLEffect::EffectKey GrGLQuadEffect::GenKey(const GrDrawEffect& drawEffect, con
st GrGLCaps&) { | 257 GrGLEffect::EffectKey GrGLQuadEffect::GenKey(const GrDrawEffect& drawEffect, con
st GrGLCaps&) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); | 388 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2
.0*edgeAlpha);\n"); |
| 389 break; | 389 break; |
| 390 } | 390 } |
| 391 case kFillBW_GrEffectEdgeType: { | 391 case kFillBW_GrEffectEdgeType: { |
| 392 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x*%s.x - %s.y*%s.z;\
n", | 392 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x*%s.x - %s.y*%s.z;\
n", |
| 393 fsName, fsName, fsName, fsName, fsName); | 393 fsName, fsName, fsName, fsName, fsName); |
| 394 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); | 394 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n"); |
| 395 break; | 395 break; |
| 396 } | 396 } |
| 397 default: | 397 default: |
| 398 GrCrash("Shouldn't get here"); | 398 SkFAIL("Shouldn't get here"); |
| 399 } | 399 } |
| 400 | 400 |
| 401 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 401 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 402 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); | 402 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).
c_str()); |
| 403 } | 403 } |
| 404 | 404 |
| 405 GrGLEffect::EffectKey GrGLCubicEffect::GenKey(const GrDrawEffect& drawEffect, co
nst GrGLCaps&) { | 405 GrGLEffect::EffectKey GrGLCubicEffect::GenKey(const GrDrawEffect& drawEffect, co
nst GrGLCaps&) { |
| 406 const GrCubicEffect& ce = drawEffect.castEffect<GrCubicEffect>(); | 406 const GrCubicEffect& ce = drawEffect.castEffect<GrCubicEffect>(); |
| 407 return ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 407 return ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
| 408 } | 408 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 434 const GrDrawTargetCaps& caps, | 434 const GrDrawTargetCaps& caps, |
| 435 GrTexture*[]) { | 435 GrTexture*[]) { |
| 436 GrEffectRef* effect; | 436 GrEffectRef* effect; |
| 437 do { | 437 do { |
| 438 GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>( | 438 GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>( |
| 439 random->nextULessThan(kGrEff
ectEdgeTypeCnt)); | 439 random->nextULessThan(kGrEff
ectEdgeTypeCnt)); |
| 440 effect = GrCubicEffect::Create(edgeType, caps); | 440 effect = GrCubicEffect::Create(edgeType, caps); |
| 441 } while (NULL == effect); | 441 } while (NULL == effect); |
| 442 return effect; | 442 return effect; |
| 443 } | 443 } |
| OLD | NEW |