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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 uint8_t fCoverage; | 679 uint8_t fCoverage; |
680 SkMatrix fViewMatrix; | 680 SkMatrix fViewMatrix; |
681 SkPath fPath; | 681 SkPath fPath; |
682 SkIRect fDevClipBounds; | 682 SkIRect fDevClipBounds; |
683 }; | 683 }; |
684 | 684 |
685 static GrDrawBatch* Create(const Geometry& geometry) { return new AAHairline
Batch(geometry); } | 685 static GrDrawBatch* Create(const Geometry& geometry) { return new AAHairline
Batch(geometry); } |
686 | 686 |
687 const char* name() const override { return "AAHairlineBatch"; } | 687 const char* name() const override { return "AAHairlineBatch"; } |
688 | 688 |
689 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 689 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 690 GrInitInvariantOutput* coverage, |
| 691 GrBatchToXPOverrides* overrides) const ove
rride { |
690 // When this is called on a batch, there is only one geometry bundle | 692 // When this is called on a batch, there is only one geometry bundle |
691 out->setKnownFourComponents(fGeoData[0].fColor); | 693 color->setKnownFourComponents(fGeoData[0].fColor); |
692 } | 694 coverage->setUnknownSingleComponent(); |
693 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 695 overrides->fUsePLSDstRead = true; |
694 out->setUnknownSingleComponent(); | |
695 } | 696 } |
696 | 697 |
697 private: | 698 private: |
698 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 699 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
699 // Handle any color overrides | 700 // Handle any color overrides |
700 if (!opt.readsColor()) { | 701 if (!overrides.readsColor()) { |
701 fGeoData[0].fColor = GrColor_ILLEGAL; | 702 fGeoData[0].fColor = GrColor_ILLEGAL; |
702 } | 703 } |
703 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 704 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
704 | 705 |
705 // setup batch properties | 706 // setup batch properties |
706 fBatch.fColorIgnored = !opt.readsColor(); | 707 fBatch.fColorIgnored = !overrides.readsColor(); |
707 fBatch.fColor = fGeoData[0].fColor; | 708 fBatch.fColor = fGeoData[0].fColor; |
708 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); | 709 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
709 fBatch.fCoverageIgnored = !opt.readsCoverage(); | 710 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
710 fBatch.fCoverage = fGeoData[0].fCoverage; | 711 fBatch.fCoverage = fGeoData[0].fCoverage; |
711 } | 712 } |
712 | 713 |
713 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 714 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
714 | 715 |
715 void onPrepareDraws(Target*) override; | 716 void onPrepareDraws(Target*) override; |
716 | 717 |
717 typedef SkTArray<SkPoint, true> PtArray; | 718 typedef SkTArray<SkPoint, true> PtArray; |
718 typedef SkTArray<int, true> IntArray; | 719 typedef SkTArray<int, true> IntArray; |
719 typedef SkTArray<float, true> FloatArray; | 720 typedef SkTArray<float, true> FloatArray; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 GrColor color = GrRandomColor(random); | 993 GrColor color = GrRandomColor(random); |
993 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 994 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
994 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
995 SkPath path = GrTest::TestPath(random); | 996 SkPath path = GrTest::TestPath(random); |
996 SkIRect devClipBounds; | 997 SkIRect devClipBounds; |
997 devClipBounds.setEmpty(); | 998 devClipBounds.setEmpty(); |
998 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
999 } | 1000 } |
1000 | 1001 |
1001 #endif | 1002 #endif |
OLD | NEW |