| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrConvexPolyEffect.h" | 8 #include "GrConvexPolyEffect.h" |
| 9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
| 10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n", | 205 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n", |
| 206 edgeArrayName, i, fragmentPos, fragmentPos); | 206 edgeArrayName, i, fragmentPos, fragmentPos); |
| 207 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) { | 207 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) { |
| 208 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); | 208 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); |
| 209 } else { | 209 } else { |
| 210 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); | 210 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); |
| 211 } | 211 } |
| 212 fsBuilder->codeAppend("\t\talpha *= edge;\n"); | 212 fsBuilder->codeAppend("\t\talpha *= edge;\n"); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Woe is me. See skbug.com/2149. | 215 // Woe is me. See https://bug.skia.org/2149 . |
| 216 if (kTegra2_GrGLRenderer == args.fBuilder->ctxInfo().renderer()) { | 216 if (kTegra2_GrGLRenderer == args.fBuilder->ctxInfo().renderer()) { |
| 217 fsBuilder->codeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n
"); | 217 fsBuilder->codeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n
"); |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) { | 220 if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) { |
| 221 fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); | 221 fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); |
| 222 } | 222 } |
| 223 fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, | 223 fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, |
| 224 (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")
).c_str()); | 224 (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")
).c_str()); |
| 225 } | 225 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 GrFragmentProcessor* fp; | 353 GrFragmentProcessor* fp; |
| 354 do { | 354 do { |
| 355 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 355 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 356 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 356 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 357 fp = GrConvexPolyEffect::Create(edgeType, count, edges); | 357 fp = GrConvexPolyEffect::Create(edgeType, count, edges); |
| 358 } while (nullptr == fp); | 358 } while (nullptr == fp); |
| 359 return fp; | 359 return fp; |
| 360 } | 360 } |
| OLD | NEW |