OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "GrPipelineBuilder.h" | 21 #include "GrPipelineBuilder.h" |
22 #include "GrStrokeInfo.h" | 22 #include "GrStrokeInfo.h" |
23 #include "SkGeometry.h" | 23 #include "SkGeometry.h" |
24 #include "SkPathPriv.h" | 24 #include "SkPathPriv.h" |
25 #include "SkString.h" | 25 #include "SkString.h" |
26 #include "SkTraceEvent.h" | 26 #include "SkTraceEvent.h" |
27 #include "batches/GrVertexBatch.h" | 27 #include "batches/GrVertexBatch.h" |
28 #include "glsl/GrGLSLGeometryProcessor.h" | 28 #include "glsl/GrGLSLGeometryProcessor.h" |
29 #include "glsl/GrGLSLProgramBuilder.h" | 29 #include "glsl/GrGLSLProgramBuilder.h" |
30 #include "glsl/GrGLSLProgramDataManager.h" | 30 #include "glsl/GrGLSLProgramDataManager.h" |
| 31 #include "glsl/GrGLSLVarying.h" |
31 | 32 |
32 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { | 33 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { |
33 } | 34 } |
34 | 35 |
35 struct Segment { | 36 struct Segment { |
36 enum { | 37 enum { |
37 // These enum values are assumed in member functions below. | 38 // These enum values are assumed in member functions below. |
38 kLine = 0, | 39 kLine = 0, |
39 kQuad = 1, | 40 kQuad = 1, |
40 } fType; | 41 } fType; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 544 |
544 class GLSLProcessor : public GrGLSLGeometryProcessor { | 545 class GLSLProcessor : public GrGLSLGeometryProcessor { |
545 public: | 546 public: |
546 GLSLProcessor() | 547 GLSLProcessor() |
547 : fColor(GrColor_ILLEGAL) {} | 548 : fColor(GrColor_ILLEGAL) {} |
548 | 549 |
549 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 550 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
550 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 551 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
551 GrGLSLGPBuilder* pb = args.fPB; | 552 GrGLSLGPBuilder* pb = args.fPB; |
552 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; | 553 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; |
| 554 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; |
553 | 555 |
554 // emit attributes | 556 // emit attributes |
555 vertBuilder->emitAttributes(qe); | 557 varyingHandler->emitAttributes(qe); |
556 | 558 |
557 GrGLSLVertToFrag v(kVec4f_GrSLType); | 559 GrGLSLVertToFrag v(kVec4f_GrSLType); |
558 args.fPB->addVarying("QuadEdge", &v); | 560 varyingHandler->addVarying("QuadEdge", &v); |
559 vertBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fNa
me); | 561 vertBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fNa
me); |
560 | 562 |
561 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 563 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
562 // Setup pass through color | 564 // Setup pass through color |
563 if (!qe.colorIgnored()) { | 565 if (!qe.colorIgnored()) { |
564 this->setupUniformColor(pb, fragBuilder, args.fOutputColor, &fCo
lorUniform); | 566 this->setupUniformColor(pb, fragBuilder, args.fOutputColor, &fCo
lorUniform); |
565 } | 567 } |
566 | 568 |
567 // Setup position | 569 // Setup position |
568 this->setupPosition(pb, vertBuilder, gpArgs, qe.inPosition()->fName)
; | 570 this->setupPosition(pb, vertBuilder, gpArgs, qe.inPosition()->fName)
; |
569 | 571 |
570 // emit transforms | 572 // emit transforms |
571 this->emitTransforms(args.fPB, | 573 this->emitTransforms(args.fPB, |
572 vertBuilder, | 574 vertBuilder, |
| 575 varyingHandler, |
573 gpArgs->fPositionVar, | 576 gpArgs->fPositionVar, |
574 qe.inPosition()->fName, | 577 qe.inPosition()->fName, |
575 qe.localMatrix(), | 578 qe.localMatrix(), |
576 args.fTransformsIn, | 579 args.fTransformsIn, |
577 args.fTransformsOut); | 580 args.fTransformsOut); |
578 | 581 |
579 SkAssertResult(fragBuilder->enableFeature( | 582 SkAssertResult(fragBuilder->enableFeature( |
580 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur
e)); | 583 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur
e)); |
581 fragBuilder->codeAppendf("float edgeAlpha;"); | 584 fragBuilder->codeAppendf("float edgeAlpha;"); |
582 | 585 |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1014 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
1012 AAConvexPathBatch::Geometry geometry; | 1015 AAConvexPathBatch::Geometry geometry; |
1013 geometry.fColor = GrRandomColor(random); | 1016 geometry.fColor = GrRandomColor(random); |
1014 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1017 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
1015 geometry.fPath = GrTest::TestPathConvex(random); | 1018 geometry.fPath = GrTest::TestPathConvex(random); |
1016 | 1019 |
1017 return AAConvexPathBatch::Create(geometry); | 1020 return AAConvexPathBatch::Create(geometry); |
1018 } | 1021 } |
1019 | 1022 |
1020 #endif | 1023 #endif |
OLD | NEW |