OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 const char* name() const SK_OVERRIDE { return "AAHairlineBatch"; } | 720 const char* name() const SK_OVERRIDE { return "AAHairlineBatch"; } |
721 | 721 |
722 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { | 722 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { |
723 // When this is called on a batch, there is only one geometry bundle | 723 // When this is called on a batch, there is only one geometry bundle |
724 out->setKnownFourComponents(fGeoData[0].fColor); | 724 out->setKnownFourComponents(fGeoData[0].fColor); |
725 } | 725 } |
726 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID
E { | 726 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID
E { |
727 out->setUnknownSingleComponent(); | 727 out->setUnknownSingleComponent(); |
728 } | 728 } |
729 | 729 |
730 void initBatchOpt(const GrBatchOpt& batchOpt) { | |
731 fBatchOpt = batchOpt; | |
732 } | |
733 | |
734 void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE { | 730 void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE { |
735 // Handle any color overrides | 731 // Handle any color overrides |
736 if (init.fColorIgnored) { | 732 if (init.fColorIgnored) { |
737 fGeoData[0].fColor = GrColor_ILLEGAL; | 733 fGeoData[0].fColor = GrColor_ILLEGAL; |
738 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | 734 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
739 fGeoData[0].fColor = init.fOverrideColor; | 735 fGeoData[0].fColor = init.fOverrideColor; |
740 } | 736 } |
741 | 737 |
742 // setup batch properties | 738 // setup batch properties |
743 fBatch.fColorIgnored = init.fColorIgnored; | 739 fBatch.fColorIgnored = init.fColorIgnored; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 802 |
807 struct BatchTracker { | 803 struct BatchTracker { |
808 GrColor fColor; | 804 GrColor fColor; |
809 uint8_t fCoverage; | 805 uint8_t fCoverage; |
810 SkRect fDevBounds; | 806 SkRect fDevBounds; |
811 bool fUsesLocalCoords; | 807 bool fUsesLocalCoords; |
812 bool fColorIgnored; | 808 bool fColorIgnored; |
813 bool fCoverageIgnored; | 809 bool fCoverageIgnored; |
814 }; | 810 }; |
815 | 811 |
816 GrBatchOpt fBatchOpt; | |
817 BatchTracker fBatch; | 812 BatchTracker fBatch; |
818 SkSTArray<1, Geometry, true> fGeoData; | 813 SkSTArray<1, Geometry, true> fGeoData; |
819 const GrIndexBuffer* fLinesIndexBuffer; | 814 const GrIndexBuffer* fLinesIndexBuffer; |
820 const GrIndexBuffer* fQuadsIndexBuffer; | 815 const GrIndexBuffer* fQuadsIndexBuffer; |
821 }; | 816 }; |
822 | 817 |
823 void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
ine* pipeline) { | 818 void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
ine* pipeline) { |
824 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. | 819 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. |
825 SkMatrix invert; | 820 SkMatrix invert; |
826 if (!this->viewMatrix().invert(&invert)) { | 821 if (!this->viewMatrix().invert(&invert)) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 geometry.fPath = path; | 1052 geometry.fPath = path; |
1058 SkDEBUGCODE(geometry.fDevBounds = devRect;) | 1053 SkDEBUGCODE(geometry.fDevBounds = devRect;) |
1059 geometry.fDevClipBounds = devClipBounds; | 1054 geometry.fDevClipBounds = devClipBounds; |
1060 | 1055 |
1061 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, | 1056 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, |
1062 fQuadsIndexBuffer)); | 1057 fQuadsIndexBuffer)); |
1063 target->drawBatch(pipelineBuilder, batch, &devRect); | 1058 target->drawBatch(pipelineBuilder, batch, &devRect); |
1064 | 1059 |
1065 return true; | 1060 return true; |
1066 } | 1061 } |
OLD | NEW |