| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrAAConvexPathRenderer.h" | 8 #include "GrAAConvexPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrAAConvexTessellator.h" | 10 #include "GrAAConvexTessellator.h" |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 572 |
| 573 // emit transforms | 573 // emit transforms |
| 574 this->emitTransforms(vertBuilder, | 574 this->emitTransforms(vertBuilder, |
| 575 varyingHandler, | 575 varyingHandler, |
| 576 uniformHandler, | 576 uniformHandler, |
| 577 gpArgs->fPositionVar, | 577 gpArgs->fPositionVar, |
| 578 qe.inPosition()->fName, | 578 qe.inPosition()->fName, |
| 579 qe.localMatrix(), | 579 qe.localMatrix(), |
| 580 args.fFPCoordTransformHandler); | 580 args.fFPCoordTransformHandler); |
| 581 | 581 |
| 582 SkAssertResult(fragBuilder->enableFeature( | |
| 583 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur
e)); | |
| 584 fragBuilder->codeAppendf("float edgeAlpha;"); | 582 fragBuilder->codeAppendf("float edgeAlpha;"); |
| 585 | 583 |
| 586 // keep the derivative instructions outside the conditional | 584 // keep the derivative instructions outside the conditional |
| 587 fragBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); | 585 fragBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); |
| 588 fragBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); | 586 fragBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); |
| 589 fragBuilder->codeAppendf("if (%s.z > 0.0 && %s.w > 0.0) {", v.fsIn()
, v.fsIn()); | 587 fragBuilder->codeAppendf("if (%s.z > 0.0 && %s.w > 0.0) {", v.fsIn()
, v.fsIn()); |
| 590 // today we know z and w are in device space. We could use derivativ
es | 588 // today we know z and w are in device space. We could use derivativ
es |
| 591 fragBuilder->codeAppendf("edgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0
);", v.fsIn(), | 589 fragBuilder->codeAppendf("edgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0
);", v.fsIn(), |
| 592 v.fsIn()); | 590 v.fsIn()); |
| 593 fragBuilder->codeAppendf ("} else {"); | 591 fragBuilder->codeAppendf ("} else {"); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 | 1008 |
| 1011 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1009 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
| 1012 GrColor color = GrRandomColor(random); | 1010 GrColor color = GrRandomColor(random); |
| 1013 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 1011 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 1014 SkPath path = GrTest::TestPathConvex(random); | 1012 SkPath path = GrTest::TestPathConvex(random); |
| 1015 | 1013 |
| 1016 return new AAConvexPathBatch(color, viewMatrix, path); | 1014 return new AAConvexPathBatch(color, viewMatrix, path); |
| 1017 } | 1015 } |
| 1018 | 1016 |
| 1019 #endif | 1017 #endif |
| OLD | NEW |