| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrPLSPathRenderer.h" | 8 #include "GrPLSPathRenderer.h" |
| 9 | 9 |
| 10 #include "SkChunkAlloc.h" | 10 #include "SkChunkAlloc.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { | 415 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { |
| 416 return new GLSLProcessor(*this); | 416 return new GLSLProcessor(*this); |
| 417 } | 417 } |
| 418 | 418 |
| 419 private: | 419 private: |
| 420 PLSAATriangleEffect(const SkMatrix& localMatrix, bool usesLocalCoords) | 420 PLSAATriangleEffect(const SkMatrix& localMatrix, bool usesLocalCoords) |
| 421 : fLocalMatrix(localMatrix) | 421 : fLocalMatrix(localMatrix) |
| 422 , fUsesLocalCoords(usesLocalCoords) { | 422 , fUsesLocalCoords(usesLocalCoords) { |
| 423 this->initClassID<PLSAATriangleEffect>(); | 423 this->initClassID<PLSAATriangleEffect>(); |
| 424 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType, | 424 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttrib
Type, |
| 425 kHigh_GrSLPrecision)); | 425 kHigh_GrSLPrecision); |
| 426 fInVertex1 = &this->addVertexAttrib(Attribute("inVertex1", kVec2f_GrVert
exAttribType, | 426 fInVertex1 = &this->addVertexAttrib("inVertex1", kVec2f_GrVertexAttribTy
pe, |
| 427 kHigh_GrSLPrecision)); | 427 kHigh_GrSLPrecision); |
| 428 fInVertex2 = &this->addVertexAttrib(Attribute("inVertex2", kVec2f_GrVert
exAttribType, | 428 fInVertex2 = &this->addVertexAttrib("inVertex2", kVec2f_GrVertexAttribTy
pe, |
| 429 kHigh_GrSLPrecision)); | 429 kHigh_GrSLPrecision); |
| 430 fInVertex3 = &this->addVertexAttrib(Attribute("inVertex3", kVec2f_GrVert
exAttribType, | 430 fInVertex3 = &this->addVertexAttrib("inVertex3", kVec2f_GrVertexAttribTy
pe, |
| 431 kHigh_GrSLPrecision)); | 431 kHigh_GrSLPrecision); |
| 432 fInWindings = &this->addVertexAttrib(Attribute("inWindings", kInt_GrVert
exAttribType, | 432 fInWindings = &this->addVertexAttrib("inWindings", kInt_GrVertexAttribTy
pe, |
| 433 kLow_GrSLPrecision)); | 433 kLow_GrSLPrecision); |
| 434 this->setWillReadFragmentPosition(); | 434 this->setWillReadFragmentPosition(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 const Attribute* fInPosition; | 437 const Attribute* fInPosition; |
| 438 const Attribute* fInVertex1; | 438 const Attribute* fInVertex1; |
| 439 const Attribute* fInVertex2; | 439 const Attribute* fInVertex2; |
| 440 const Attribute* fInVertex3; | 440 const Attribute* fInVertex3; |
| 441 const Attribute* fInWindings; | 441 const Attribute* fInWindings; |
| 442 SkMatrix fLocalMatrix; | 442 SkMatrix fLocalMatrix; |
| 443 bool fUsesLocalCoords; | 443 bool fUsesLocalCoords; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { | 605 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) cons
t override { |
| 606 return new GLSLProcessor(*this); | 606 return new GLSLProcessor(*this); |
| 607 } | 607 } |
| 608 | 608 |
| 609 private: | 609 private: |
| 610 PLSQuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords) | 610 PLSQuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords) |
| 611 : fLocalMatrix(localMatrix) | 611 : fLocalMatrix(localMatrix) |
| 612 , fUsesLocalCoords(usesLocalCoords) { | 612 , fUsesLocalCoords(usesLocalCoords) { |
| 613 this->initClassID<PLSQuadEdgeEffect>(); | 613 this->initClassID<PLSQuadEdgeEffect>(); |
| 614 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType, | 614 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttrib
Type, |
| 615 kHigh_GrSLPrecision)); | 615 kHigh_GrSLPrecision); |
| 616 fInUV = &this->addVertexAttrib(Attribute("inUV", kVec2f_GrVertexAttribTy
pe, | 616 fInUV = &this->addVertexAttrib("inUV", kVec2f_GrVertexAttribType, kHigh_
GrSLPrecision); |
| 617 kHigh_GrSLPrecision)); | 617 fInEndpoint1 = &this->addVertexAttrib("inEndpoint1", kVec2f_GrVertexAttr
ibType, |
| 618 fInEndpoint1 = &this->addVertexAttrib(Attribute("inEndpoint1", kVec2f_Gr
VertexAttribType, | 618 kHigh_GrSLPrecision); |
| 619 kHigh_GrSLPrecision)); | 619 fInEndpoint2 = &this->addVertexAttrib("inEndpoint2", kVec2f_GrVertexAttr
ibType, |
| 620 fInEndpoint2 = &this->addVertexAttrib(Attribute("inEndpoint2", kVec2f_Gr
VertexAttribType, | 620 kHigh_GrSLPrecision); |
| 621 kHigh_GrSLPrecision)); | 621 fInWindings = &this->addVertexAttrib("inWindings", kInt_GrVertexAttribT
ype, |
| 622 fInWindings = &this->addVertexAttrib(Attribute("inWindings", kInt_GrVer
texAttribType, | 622 kLow_GrSLPrecision); |
| 623 kLow_GrSLPrecision)); | |
| 624 this->setWillReadFragmentPosition(); | 623 this->setWillReadFragmentPosition(); |
| 625 } | 624 } |
| 626 | 625 |
| 627 const Attribute* fInPosition; | 626 const Attribute* fInPosition; |
| 628 const Attribute* fInUV; | 627 const Attribute* fInUV; |
| 629 const Attribute* fInEndpoint1; | 628 const Attribute* fInEndpoint1; |
| 630 const Attribute* fInEndpoint2; | 629 const Attribute* fInEndpoint2; |
| 631 const Attribute* fInWindings; | 630 const Attribute* fInWindings; |
| 632 SkMatrix fLocalMatrix; | 631 SkMatrix fLocalMatrix; |
| 633 bool fUsesLocalCoords; | 632 bool fUsesLocalCoords; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 754 } |
| 756 | 755 |
| 757 private: | 756 private: |
| 758 PLSFinishEffect(GrColor color, bool useEvenOdd, const SkMatrix& localMatrix, | 757 PLSFinishEffect(GrColor color, bool useEvenOdd, const SkMatrix& localMatrix, |
| 759 bool usesLocalCoords) | 758 bool usesLocalCoords) |
| 760 : fColor(color) | 759 : fColor(color) |
| 761 , fUseEvenOdd(useEvenOdd) | 760 , fUseEvenOdd(useEvenOdd) |
| 762 , fLocalMatrix(localMatrix) | 761 , fLocalMatrix(localMatrix) |
| 763 , fUsesLocalCoords(usesLocalCoords) { | 762 , fUsesLocalCoords(usesLocalCoords) { |
| 764 this->initClassID<PLSFinishEffect>(); | 763 this->initClassID<PLSFinishEffect>(); |
| 765 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType, | 764 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttrib
Type, |
| 766 kHigh_GrSLPrecision)); | 765 kHigh_GrSLPrecision); |
| 767 } | 766 } |
| 768 | 767 |
| 769 const Attribute* fInPosition; | 768 const Attribute* fInPosition; |
| 770 GrColor fColor; | 769 GrColor fColor; |
| 771 bool fUseEvenOdd; | 770 bool fUseEvenOdd; |
| 772 SkMatrix fLocalMatrix; | 771 SkMatrix fLocalMatrix; |
| 773 bool fUsesLocalCoords; | 772 bool fUsesLocalCoords; |
| 774 | 773 |
| 775 typedef GrGeometryProcessor INHERITED; | 774 typedef GrGeometryProcessor INHERITED; |
| 776 }; | 775 }; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 969 |
| 971 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { | 970 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { |
| 972 GrColor color = GrRandomColor(random); | 971 GrColor color = GrRandomColor(random); |
| 973 SkMatrix vm = GrTest::TestMatrixInvertible(random); | 972 SkMatrix vm = GrTest::TestMatrixInvertible(random); |
| 974 SkPath path = GrTest::TestPathConvex(random); | 973 SkPath path = GrTest::TestPathConvex(random); |
| 975 | 974 |
| 976 return new PLSPathBatch(color, path, vm); | 975 return new PLSPathBatch(color, path, vm); |
| 977 } | 976 } |
| 978 | 977 |
| 979 #endif | 978 #endif |
| OLD | NEW |