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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 const char* name() const override { return "QuadEdge"; } | 535 const char* name() const override { return "QuadEdge"; } |
536 | 536 |
537 const Attribute* inPosition() const { return fInPosition; } | 537 const Attribute* inPosition() const { return fInPosition; } |
538 const Attribute* inQuadEdge() const { return fInQuadEdge; } | 538 const Attribute* inQuadEdge() const { return fInQuadEdge; } |
539 GrColor color() const { return fColor; } | 539 GrColor color() const { return fColor; } |
540 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 540 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
541 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 541 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
542 bool usesLocalCoords() const { return fUsesLocalCoords; } | 542 bool usesLocalCoords() const { return fUsesLocalCoords; } |
543 | 543 |
544 class GLProcessor : public GrGLSLGeometryProcessor { | 544 class GLSLProcessor : public GrGLSLGeometryProcessor { |
545 public: | 545 public: |
546 GLProcessor() | 546 GLSLProcessor() |
547 : fColor(GrColor_ILLEGAL) {} | 547 : fColor(GrColor_ILLEGAL) {} |
548 | 548 |
549 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 549 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
550 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 550 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
551 GrGLSLGPBuilder* pb = args.fPB; | 551 GrGLSLGPBuilder* pb = args.fPB; |
552 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); | 552 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); |
553 | 553 |
554 // emit attributes | 554 // emit attributes |
555 vsBuilder->emitAttributes(qe); | 555 vsBuilder->emitAttributes(qe); |
556 | 556 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index,
transforms); | 623 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index,
transforms); |
624 } | 624 } |
625 | 625 |
626 private: | 626 private: |
627 GrColor fColor; | 627 GrColor fColor; |
628 UniformHandle fColorUniform; | 628 UniformHandle fColorUniform; |
629 | 629 |
630 typedef GrGLSLGeometryProcessor INHERITED; | 630 typedef GrGLSLGeometryProcessor INHERITED; |
631 }; | 631 }; |
632 | 632 |
633 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st override { | 633 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { |
634 GLProcessor::GenKey(*this, caps, b); | 634 GLSLProcessor::GenKey(*this, caps, b); |
635 } | 635 } |
636 | 636 |
637 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override
{ | 637 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { |
638 return new GLProcessor(); | 638 return new GLSLProcessor(); |
639 } | 639 } |
640 | 640 |
641 private: | 641 private: |
642 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix, bool usesLocalCoo
rds) | 642 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix, bool usesLocalCoo
rds) |
643 : fColor(color) | 643 : fColor(color) |
644 , fLocalMatrix(localMatrix) | 644 , fLocalMatrix(localMatrix) |
645 , fUsesLocalCoords(usesLocalCoords) { | 645 , fUsesLocalCoords(usesLocalCoords) { |
646 this->initClassID<QuadEdgeEffect>(); | 646 this->initClassID<QuadEdgeEffect>(); |
647 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); | 647 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
648 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); | 648 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1007 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
1008 AAConvexPathBatch::Geometry geometry; | 1008 AAConvexPathBatch::Geometry geometry; |
1009 geometry.fColor = GrRandomColor(random); | 1009 geometry.fColor = GrRandomColor(random); |
1010 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1010 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
1011 geometry.fPath = GrTest::TestPathConvex(random); | 1011 geometry.fPath = GrTest::TestPathConvex(random); |
1012 | 1012 |
1013 return AAConvexPathBatch::Create(geometry); | 1013 return AAConvexPathBatch::Create(geometry); |
1014 } | 1014 } |
1015 | 1015 |
1016 #endif | 1016 #endif |
OLD | NEW |