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