| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAALinearizingConvexPathRenderer.h" | 9 #include "GrAALinearizingConvexPathRenderer.h" |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 const char* name() const override { return "AAConvexBatch"; } | 132 const char* name() const override { return "AAConvexBatch"; } |
| 133 | 133 |
| 134 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 134 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 135 // When this is called on a batch, there is only one geometry bundle | 135 // When this is called on a batch, there is only one geometry bundle |
| 136 out->setKnownFourComponents(fGeoData[0].fColor); | 136 out->setKnownFourComponents(fGeoData[0].fColor); |
| 137 } | 137 } |
| 138 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 138 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 139 out->setUnknownSingleComponent(); | 139 out->setUnknownSingleComponent(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 private: |
| 142 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 143 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 143 // Handle any color overrides | 144 // Handle any color overrides |
| 144 if (!opt.readsColor()) { | 145 if (!opt.readsColor()) { |
| 145 fGeoData[0].fColor = GrColor_ILLEGAL; | 146 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 146 } | 147 } |
| 147 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 148 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 148 | 149 |
| 149 // setup batch properties | 150 // setup batch properties |
| 150 fBatch.fColorIgnored = !opt.readsColor(); | 151 fBatch.fColorIgnored = !opt.readsColor(); |
| 151 fBatch.fColor = fGeoData[0].fColor; | 152 fBatch.fColor = fGeoData[0].fColor; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 indexCount += currentIndices; | 248 indexCount += currentIndices; |
| 248 } | 249 } |
| 249 draw(target, this->pipeline(), vertexCount, vertexStride, vertices, inde
xCount, | 250 draw(target, this->pipeline(), vertexCount, vertexStride, vertices, inde
xCount, |
| 250 indices); | 251 indices); |
| 251 free(vertices); | 252 free(vertices); |
| 252 free(indices); | 253 free(indices); |
| 253 } | 254 } |
| 254 | 255 |
| 255 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 256 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 256 | 257 |
| 257 private: | |
| 258 AAFlatteningConvexPathBatch(const Geometry& geometry) { | 258 AAFlatteningConvexPathBatch(const Geometry& geometry) { |
| 259 this->initClassID<AAFlatteningConvexPathBatch>(); | 259 this->initClassID<AAFlatteningConvexPathBatch>(); |
| 260 fGeoData.push_back(geometry); | 260 fGeoData.push_back(geometry); |
| 261 | 261 |
| 262 // compute bounds | 262 // compute bounds |
| 263 fBounds = geometry.fPath.getBounds(); | 263 fBounds = geometry.fPath.getBounds(); |
| 264 geometry.fViewMatrix.mapRect(&fBounds); | 264 geometry.fViewMatrix.mapRect(&fBounds); |
| 265 } | 265 } |
| 266 | 266 |
| 267 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 267 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 333 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
| 334 AAFlatteningConvexPathBatch::Geometry geometry; | 334 AAFlatteningConvexPathBatch::Geometry geometry; |
| 335 geometry.fColor = GrRandomColor(random); | 335 geometry.fColor = GrRandomColor(random); |
| 336 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 336 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 337 geometry.fPath = GrTest::TestPathConvex(random); | 337 geometry.fPath = GrTest::TestPathConvex(random); |
| 338 | 338 |
| 339 return AAFlatteningConvexPathBatch::Create(geometry); | 339 return AAFlatteningConvexPathBatch::Create(geometry); |
| 340 } | 340 } |
| 341 | 341 |
| 342 #endif | 342 #endif |
| OLD | NEW |