| 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 #ifndef GrAAStrokeRectBatch_DEFINED | 8 #ifndef GrAAStrokeRectBatch_DEFINED |
| 9 #define GrAAStrokeRectBatch_DEFINED | 9 #define GrAAStrokeRectBatch_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrTypes.h" | 12 #include "GrTypes.h" |
| 13 #include "GrVertexBatch.h" | 13 #include "GrVertexBatch.h" |
| 14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
| 15 #include "SkRect.h" | 15 #include "SkRect.h" |
| 16 | 16 |
| 17 class GrResourceProvider; | 17 class GrResourceProvider; |
| 18 | 18 |
| 19 class GrAAStrokeRectBatch : public GrVertexBatch { | 19 class GrAAStrokeRectBatch : public GrVertexBatch { |
| 20 public: | 20 public: |
| 21 DEFINE_BATCH_CLASS_ID |
| 22 |
| 21 // TODO support AA rotated stroke rects by copying around view matrices | 23 // TODO support AA rotated stroke rects by copying around view matrices |
| 22 struct Geometry { | 24 struct Geometry { |
| 23 GrColor fColor; | 25 GrColor fColor; |
| 24 SkRect fDevOutside; | 26 SkRect fDevOutside; |
| 25 SkRect fDevOutsideAssist; | 27 SkRect fDevOutsideAssist; |
| 26 SkRect fDevInside; | 28 SkRect fDevInside; |
| 27 bool fMiterStroke; | 29 bool fMiterStroke; |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMat
rix) { | 32 static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMat
rix) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 43 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 42 out->setUnknownSingleComponent(); | 44 out->setUnknownSingleComponent(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 47 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 void onPrepareDraws(Target*) override; | 50 void onPrepareDraws(Target*) override; |
| 49 void initBatchTracker(const GrPipelineOptimizations&) override; | 51 void initBatchTracker(const GrPipelineOptimizations&) override; |
| 50 | 52 |
| 51 GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix) { | 53 GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix) |
| 52 this->initClassID<GrAAStrokeRectBatch>(); | 54 : INHERITED(ClassID()) { |
| 53 fBatch.fViewMatrix = viewMatrix; | 55 fBatch.fViewMatrix = viewMatrix; |
| 54 fGeoData.push_back(geometry); | 56 fGeoData.push_back(geometry); |
| 55 | 57 |
| 56 // If we have miterstroke then we inset devOutside and outset devOutside
Assist, so we need | 58 // If we have miterstroke then we inset devOutside and outset devOutside
Assist, so we need |
| 57 // the join for proper bounds | 59 // the join for proper bounds |
| 58 fBounds = geometry.fDevOutside; | 60 fBounds = geometry.fDevOutside; |
| 59 fBounds.join(geometry.fDevOutsideAssist); | 61 fBounds.join(geometry.fDevOutsideAssist); |
| 60 } | 62 } |
| 61 | 63 |
| 62 | 64 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 GrColor fColor; | 100 GrColor fColor; |
| 99 bool fUsesLocalCoords; | 101 bool fUsesLocalCoords; |
| 100 bool fColorIgnored; | 102 bool fColorIgnored; |
| 101 bool fCoverageIgnored; | 103 bool fCoverageIgnored; |
| 102 bool fMiterStroke; | 104 bool fMiterStroke; |
| 103 bool fCanTweakAlphaForCoverage; | 105 bool fCanTweakAlphaForCoverage; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 BatchTracker fBatch; | 108 BatchTracker fBatch; |
| 107 SkSTArray<1, Geometry, true> fGeoData; | 109 SkSTArray<1, Geometry, true> fGeoData; |
| 110 |
| 111 typedef GrVertexBatch INHERITED; |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 | 114 |
| 111 #endif | 115 #endif |
| OLD | NEW |