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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 693 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
694 // When this is called on a batch, there is only one geometry bundle | 694 // When this is called on a batch, there is only one geometry bundle |
695 out->setKnownFourComponents(fGeoData[0].fColor); | 695 out->setKnownFourComponents(fGeoData[0].fColor); |
696 } | 696 } |
697 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 697 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
698 out->setUnknownSingleComponent(); | 698 out->setUnknownSingleComponent(); |
699 } | 699 } |
700 | 700 |
701 void initBatchTracker(const GrPipelineInfo& init) override { | 701 void initBatchTracker(const GrPipelineInfo& init) override { |
702 // Handle any color overrides | 702 // Handle any color overrides |
703 if (!init.readsColor()) { | 703 if (init.fColorIgnored) { |
704 fGeoData[0].fColor = GrColor_ILLEGAL; | 704 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 705 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 706 fGeoData[0].fColor = init.fOverrideColor; |
705 } | 707 } |
706 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
707 | 708 |
708 // setup batch properties | 709 // setup batch properties |
709 fBatch.fColorIgnored = !init.readsColor(); | 710 fBatch.fColorIgnored = init.fColorIgnored; |
710 fBatch.fColor = fGeoData[0].fColor; | 711 fBatch.fColor = fGeoData[0].fColor; |
711 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 712 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
712 fBatch.fCoverageIgnored = !init.readsCoverage(); | 713 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
713 fBatch.fCoverage = fGeoData[0].fCoverage; | 714 fBatch.fCoverage = fGeoData[0].fCoverage; |
714 } | 715 } |
715 | 716 |
716 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override; | 717 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override; |
717 | 718 |
718 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 719 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
719 | 720 |
720 private: | 721 private: |
721 typedef SkTArray<SkPoint, true> PtArray; | 722 typedef SkTArray<SkPoint, true> PtArray; |
722 typedef SkTArray<int, true> IntArray; | 723 typedef SkTArray<int, true> IntArray; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 GrColor color = GrRandomColor(random); | 997 GrColor color = GrRandomColor(random); |
997 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 998 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
998 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 999 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
999 SkPath path = GrTest::TestPath(random); | 1000 SkPath path = GrTest::TestPath(random); |
1000 SkIRect devClipBounds; | 1001 SkIRect devClipBounds; |
1001 devClipBounds.setEmpty(); | 1002 devClipBounds.setEmpty(); |
1002 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 1003 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
1003 } | 1004 } |
1004 | 1005 |
1005 #endif | 1006 #endif |
OLD | NEW |