| 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 #include "GrAAStrokeRectBatch.h" | 8 #include "GrAAStrokeRectBatch.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void init() { this->updateBounds(&fBounds, fGeoData[0]); } | 100 void init() { this->updateBounds(&fBounds, fGeoData[0]); } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 void updateBounds(SkRect* bounds, const Geometry& geo) { | 103 void updateBounds(SkRect* bounds, const Geometry& geo) { |
| 104 // If we have miterstroke then we inset devOutside and outset devOutside
Assist, so we need | 104 // If we have miterstroke then we inset devOutside and outset devOutside
Assist, so we need |
| 105 // the join for proper bounds | 105 // the join for proper bounds |
| 106 *bounds = geo.fDevOutside; | 106 *bounds = geo.fDevOutside; |
| 107 bounds->join(geo.fDevOutsideAssist); | 107 bounds->join(geo.fDevOutsideAssist); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void onPrepareDraws(Target*) override; | 110 void onPrepareDraws(Target*) const override; |
| 111 void initBatchTracker(const GrXPOverridesForBatch&) override; | 111 void initBatchTracker(const GrXPOverridesForBatch&) override; |
| 112 | 112 |
| 113 AAStrokeRectBatch(const SkMatrix& viewMatrix,bool miterStroke) | 113 AAStrokeRectBatch(const SkMatrix& viewMatrix,bool miterStroke) |
| 114 : INHERITED(ClassID()) { | 114 : INHERITED(ClassID()) { |
| 115 fViewMatrix = viewMatrix; | 115 fViewMatrix = viewMatrix; |
| 116 fMiterStroke = miterStroke; | 116 fMiterStroke = miterStroke; |
| 117 } | 117 } |
| 118 | 118 |
| 119 static const int kMiterIndexCnt = 3 * 24; | 119 static const int kMiterIndexCnt = 3 * 24; |
| 120 static const int kMiterVertexCnt = 16; | 120 static const int kMiterVertexCnt = 16; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); | 175 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 176 | 176 |
| 177 // setup batch properties | 177 // setup batch properties |
| 178 fBatch.fColorIgnored = !overrides.readsColor(); | 178 fBatch.fColorIgnored = !overrides.readsColor(); |
| 179 fBatch.fColor = fGeoData[0].fColor; | 179 fBatch.fColor = fGeoData[0].fColor; |
| 180 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); | 180 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
| 181 fBatch.fCoverageIgnored = !overrides.readsCoverage(); | 181 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
| 182 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); | 182 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void AAStrokeRectBatch::onPrepareDraws(Target* target) { | 185 void AAStrokeRectBatch::onPrepareDraws(Target* target) const { |
| 186 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 186 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 187 | 187 |
| 188 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp
haForCoverage, | 188 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp
haForCoverage, |
| 189 this->viewM
atrix(), | 189 this->viewM
atrix(), |
| 190 this->usesL
ocalCoords(), | 190 this->usesL
ocalCoords(), |
| 191 this->cover
ageIgnored())); | 191 this->cover
ageIgnored())); |
| 192 if (!gp) { | 192 if (!gp) { |
| 193 SkDebugf("Couldn't create GrGeometryProcessor\n"); | 193 SkDebugf("Couldn't create GrGeometryProcessor\n"); |
| 194 return; | 194 return; |
| 195 } | 195 } |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 SkRect inside = outside; | 656 SkRect inside = outside; |
| 657 inside.inset(strokeWidth, strokeWidth); | 657 inside.inset(strokeWidth, strokeWidth); |
| 658 | 658 |
| 659 GrColor color = GrRandomColor(random); | 659 GrColor color = GrRandomColor(random); |
| 660 | 660 |
| 661 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid
e, outsideAssist, | 661 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid
e, outsideAssist, |
| 662 inside, miterStroke, inside.isFinite() &&
inside.isEmpty()); | 662 inside, miterStroke, inside.isFinite() &&
inside.isEmpty()); |
| 663 } | 663 } |
| 664 | 664 |
| 665 #endif | 665 #endif |
| OLD | NEW |