| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 690 // When this is called on a batch, there is only one geometry bundle | 690 // When this is called on a batch, there is only one geometry bundle |
| 691 out->setKnownFourComponents(fGeoData[0].fColor); | 691 out->setKnownFourComponents(fGeoData[0].fColor); |
| 692 } | 692 } |
| 693 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 693 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 694 out->setUnknownSingleComponent(); | 694 out->setUnknownSingleComponent(); |
| 695 } | 695 } |
| 696 | 696 |
| 697 private: |
| 697 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 698 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 698 // Handle any color overrides | 699 // Handle any color overrides |
| 699 if (!opt.readsColor()) { | 700 if (!opt.readsColor()) { |
| 700 fGeoData[0].fColor = GrColor_ILLEGAL; | 701 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 701 } | 702 } |
| 702 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 703 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 703 | 704 |
| 704 // setup batch properties | 705 // setup batch properties |
| 705 fBatch.fColorIgnored = !opt.readsColor(); | 706 fBatch.fColorIgnored = !opt.readsColor(); |
| 706 fBatch.fColor = fGeoData[0].fColor; | 707 fBatch.fColor = fGeoData[0].fColor; |
| 707 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); | 708 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 708 fBatch.fCoverageIgnored = !opt.readsCoverage(); | 709 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 709 fBatch.fCoverage = fGeoData[0].fCoverage; | 710 fBatch.fCoverage = fGeoData[0].fCoverage; |
| 710 } | 711 } |
| 711 | 712 |
| 712 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 713 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 713 | 714 |
| 714 private: | |
| 715 void onPrepareDraws(Target*) override; | 715 void onPrepareDraws(Target*) override; |
| 716 | 716 |
| 717 typedef SkTArray<SkPoint, true> PtArray; | 717 typedef SkTArray<SkPoint, true> PtArray; |
| 718 typedef SkTArray<int, true> IntArray; | 718 typedef SkTArray<int, true> IntArray; |
| 719 typedef SkTArray<float, true> FloatArray; | 719 typedef SkTArray<float, true> FloatArray; |
| 720 | 720 |
| 721 AAHairlineBatch(const Geometry& geometry) { | 721 AAHairlineBatch(const Geometry& geometry) { |
| 722 this->initClassID<AAHairlineBatch>(); | 722 this->initClassID<AAHairlineBatch>(); |
| 723 fGeoData.push_back(geometry); | 723 fGeoData.push_back(geometry); |
| 724 | 724 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 GrColor color = GrRandomColor(random); | 991 GrColor color = GrRandomColor(random); |
| 992 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 992 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 993 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 993 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 994 SkPath path = GrTest::TestPath(random); | 994 SkPath path = GrTest::TestPath(random); |
| 995 SkIRect devClipBounds; | 995 SkIRect devClipBounds; |
| 996 devClipBounds.setEmpty(); | 996 devClipBounds.setEmpty(); |
| 997 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 997 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
| 998 } | 998 } |
| 999 | 999 |
| 1000 #endif | 1000 #endif |
| OLD | NEW |