| 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 "GrNonAAStrokeRectBatch.h" | 8 #include "GrNonAAStrokeRectBatch.h" |
| 9 | 9 |
| 10 #include "GrBatchTest.h" | 10 #include "GrBatchTest.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 SkScalar fStrokeWidth; | 47 SkScalar fStrokeWidth; |
| 48 GrColor fColor; | 48 GrColor fColor; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static NonAAStrokeRectBatch* Create() { | 51 static NonAAStrokeRectBatch* Create() { |
| 52 return new NonAAStrokeRectBatch; | 52 return new NonAAStrokeRectBatch; |
| 53 } | 53 } |
| 54 | 54 |
| 55 const char* name() const override { return "GrStrokeRectBatch"; } | 55 const char* name() const override { return "GrStrokeRectBatch"; } |
| 56 | 56 |
| 57 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 57 void computeBatchToXPOverrides(GrInitInvariantOutput* color, GrInitInvariant
Output* coverage, |
| 58 bool* usePLSDstRead) const { |
| 58 // When this is called on a batch, there is only one geometry bundle | 59 // When this is called on a batch, there is only one geometry bundle |
| 59 out->setKnownFourComponents(fGeoData[0].fColor); | 60 color->setKnownFourComponents(fGeoData[0].fColor); |
| 60 } | 61 coverage->setKnownSingleComponent(0xff); |
| 61 | 62 *usePLSDstRead = false; |
| 62 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | |
| 63 out->setKnownSingleComponent(0xff); | |
| 64 } | 63 } |
| 65 | 64 |
| 66 void append(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, | 65 void append(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, |
| 67 SkScalar strokeWidth) { | 66 SkScalar strokeWidth) { |
| 68 Geometry& geometry = fGeoData.push_back(); | 67 Geometry& geometry = fGeoData.push_back(); |
| 69 geometry.fViewMatrix = viewMatrix; | 68 geometry.fViewMatrix = viewMatrix; |
| 70 geometry.fRect = rect; | 69 geometry.fRect = rect; |
| 71 geometry.fStrokeWidth = strokeWidth; | 70 geometry.fStrokeWidth = strokeWidth; |
| 72 geometry.fColor = color; | 71 geometry.fColor = color; |
| 73 } | 72 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 DRAW_BATCH_TEST_DEFINE(NonAAStrokeRectBatch) { | 243 DRAW_BATCH_TEST_DEFINE(NonAAStrokeRectBatch) { |
| 245 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 244 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 246 GrColor color = GrRandomColor(random); | 245 GrColor color = GrRandomColor(random); |
| 247 SkRect rect = GrTest::TestRect(random); | 246 SkRect rect = GrTest::TestRect(random); |
| 248 SkScalar strokeWidth = random->nextBool() ? 0.0f : 1.0f; | 247 SkScalar strokeWidth = random->nextBool() ? 0.0f : 1.0f; |
| 249 | 248 |
| 250 return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeWidth,
random->nextBool()); | 249 return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeWidth,
random->nextBool()); |
| 251 } | 250 } |
| 252 | 251 |
| 253 #endif | 252 #endif |
| OLD | NEW |