Index: src/gpu/effects/GrConvexPolyEffect.cpp |
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp |
index 69dbafda8271a54c3a150783c13154998a7fd562..13df7bc4bd6fbf14cac1d4cb6e9ac90926bc65b1 100644 |
--- a/src/gpu/effects/GrConvexPolyEffect.cpp |
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp |
@@ -111,32 +111,32 @@ void GLAARectEffect::emitCode(EmitArgs& args) { |
"rect", |
&rectName); |
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
- const char* fragmentPos = fsBuilder->fragmentPosition(); |
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
+ const char* fragmentPos = fragBuilder->fragmentPosition(); |
if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) { |
// The amount of coverage removed in x and y by the edges is computed as a pair of negative |
// numbers, xSub and ySub. |
- fsBuilder->codeAppend("\t\tfloat xSub, ySub;\n"); |
- fsBuilder->codeAppendf("\t\txSub = min(%s.x - %s.x, 0.0);\n", fragmentPos, rectName); |
- fsBuilder->codeAppendf("\t\txSub += min(%s.z - %s.x, 0.0);\n", rectName, fragmentPos); |
- fsBuilder->codeAppendf("\t\tySub = min(%s.y - %s.y, 0.0);\n", fragmentPos, rectName); |
- fsBuilder->codeAppendf("\t\tySub += min(%s.w - %s.y, 0.0);\n", rectName, fragmentPos); |
+ fragBuilder->codeAppend("\t\tfloat xSub, ySub;\n"); |
+ fragBuilder->codeAppendf("\t\txSub = min(%s.x - %s.x, 0.0);\n", fragmentPos, rectName); |
+ fragBuilder->codeAppendf("\t\txSub += min(%s.z - %s.x, 0.0);\n", rectName, fragmentPos); |
+ fragBuilder->codeAppendf("\t\tySub = min(%s.y - %s.y, 0.0);\n", fragmentPos, rectName); |
+ fragBuilder->codeAppendf("\t\tySub += min(%s.w - %s.y, 0.0);\n", rectName, fragmentPos); |
// Now compute coverage in x and y and multiply them to get the fraction of the pixel |
// covered. |
- fsBuilder->codeAppendf("\t\tfloat alpha = (1.0 + max(xSub, -1.0)) * (1.0 + max(ySub, -1.0));\n"); |
+ fragBuilder->codeAppendf("\t\tfloat alpha = (1.0 + max(xSub, -1.0)) * (1.0 + max(ySub, -1.0));\n"); |
} else { |
- fsBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); |
- fsBuilder->codeAppendf("\t\talpha *= (%s.x - %s.x) > -0.5 ? 1.0 : 0.0;\n", fragmentPos, rectName); |
- fsBuilder->codeAppendf("\t\talpha *= (%s.z - %s.x) > -0.5 ? 1.0 : 0.0;\n", rectName, fragmentPos); |
- fsBuilder->codeAppendf("\t\talpha *= (%s.y - %s.y) > -0.5 ? 1.0 : 0.0;\n", fragmentPos, rectName); |
- fsBuilder->codeAppendf("\t\talpha *= (%s.w - %s.y) > -0.5 ? 1.0 : 0.0;\n", rectName, fragmentPos); |
+ fragBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); |
+ fragBuilder->codeAppendf("\t\talpha *= (%s.x - %s.x) > -0.5 ? 1.0 : 0.0;\n", fragmentPos, rectName); |
+ fragBuilder->codeAppendf("\t\talpha *= (%s.z - %s.x) > -0.5 ? 1.0 : 0.0;\n", rectName, fragmentPos); |
+ fragBuilder->codeAppendf("\t\talpha *= (%s.y - %s.y) > -0.5 ? 1.0 : 0.0;\n", fragmentPos, rectName); |
+ fragBuilder->codeAppendf("\t\talpha *= (%s.w - %s.y) > -0.5 ? 1.0 : 0.0;\n", rectName, fragmentPos); |
} |
if (GrProcessorEdgeTypeIsInverseFill(aare.getEdgeType())) { |
- fsBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n"); |
+ fragBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n"); |
} |
- fsBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor, |
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
+ fragBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor, |
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
} |
void GLAARectEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
@@ -197,26 +197,26 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) { |
"edges", |
cpe.getEdgeCount(), |
&edgeArrayName); |
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
- fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n"); |
- fsBuilder->codeAppend("\t\tfloat edge;\n"); |
- const char* fragmentPos = fsBuilder->fragmentPosition(); |
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
+ fragBuilder->codeAppend("\t\tfloat alpha = 1.0;\n"); |
+ fragBuilder->codeAppend("\t\tfloat edge;\n"); |
+ const char* fragmentPos = fragBuilder->fragmentPosition(); |
for (int i = 0; i < cpe.getEdgeCount(); ++i) { |
- fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n", |
- edgeArrayName, i, fragmentPos, fragmentPos); |
+ fragBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n", |
+ edgeArrayName, i, fragmentPos, fragmentPos); |
if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) { |
- fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); |
+ fragBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); |
} else { |
- fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); |
+ fragBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); |
} |
- fsBuilder->codeAppend("\t\talpha *= edge;\n"); |
+ fragBuilder->codeAppend("\t\talpha *= edge;\n"); |
} |
if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) { |
- fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); |
+ fragBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); |
} |
- fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, |
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
+ fragBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, |
+ (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); |
} |
void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman, |