| 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 fragBuilder->codeAppendf(" %s = vec4(normalize(circleEdge.xy)
, distanceToOuterEdge, %s);", | 183 fragBuilder->codeAppendf(" %s = vec4(normalize(circleEdge.xy)
, distanceToOuterEdge, %s);", |
| 184 args.fDistanceVectorName, innerEdgeDist
ance); | 184 args.fDistanceVectorName, innerEdgeDist
ance); |
| 185 fragBuilder->codeAppend ("}"); | 185 fragBuilder->codeAppend ("}"); |
| 186 } | 186 } |
| 187 if (cgp.fInClipPlane) { | 187 if (cgp.fInClipPlane) { |
| 188 fragBuilder->codeAppend("float clip = clamp(circleEdge.z * dot(c
ircleEdge.xy, clipPlane.xy) + clipPlane.z, 0.0, 1.0);"); | 188 fragBuilder->codeAppend("float clip = clamp(circleEdge.z * dot(c
ircleEdge.xy, clipPlane.xy) + clipPlane.z, 0.0, 1.0);"); |
| 189 if (cgp.fInIsectPlane) { | 189 if (cgp.fInIsectPlane) { |
| 190 fragBuilder->codeAppend("clip *= clamp(circleEdge.z * dot(ci
rcleEdge.xy, isectPlane.xy) + isectPlane.z, 0.0, 1.0);"); | 190 fragBuilder->codeAppend("clip *= clamp(circleEdge.z * dot(ci
rcleEdge.xy, isectPlane.xy) + isectPlane.z, 0.0, 1.0);"); |
| 191 } | 191 } |
| 192 if (cgp.fInUnionPlane) { | 192 if (cgp.fInUnionPlane) { |
| 193 fragBuilder->codeAppend("clip += (1-clip)*clamp(circleEdge.z
* dot(circleEdge.xy, unionPlane.xy) + unionPlane.z, 0.0, 1.0);"); | 193 fragBuilder->codeAppend("clip += (1.0 - clip)*clamp(circleEd
ge.z * dot(circleEdge.xy, unionPlane.xy) + unionPlane.z, 0.0, 1.0);"); |
| 194 } | 194 } |
| 195 fragBuilder->codeAppend("edgeAlpha *= clip;"); | 195 fragBuilder->codeAppend("edgeAlpha *= clip;"); |
| 196 } | 196 } |
| 197 fragBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCovera
ge); | 197 fragBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCovera
ge); |
| 198 } | 198 } |
| 199 | 199 |
| 200 static void GenKey(const GrGeometryProcessor& gp, | 200 static void GenKey(const GrGeometryProcessor& gp, |
| 201 const GrGLSLCaps&, | 201 const GrGLSLCaps&, |
| 202 GrProcessorKeyBuilder* b) { | 202 GrProcessorKeyBuilder* b) { |
| 203 const CircleGeometryProcessor& cgp = gp.cast<CircleGeometryProcessor
>(); | 203 const CircleGeometryProcessor& cgp = gp.cast<CircleGeometryProcessor
>(); |
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 } | 1961 } |
| 1962 | 1962 |
| 1963 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1963 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
| 1964 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1964 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 1965 GrColor color = GrRandomColor(random); | 1965 GrColor color = GrRandomColor(random); |
| 1966 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1966 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 1967 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1967 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 #endif | 1970 #endif |
| OLD | NEW |