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 "GrDrawVerticesBatch.h" | 8 #include "GrDrawVerticesBatch.h" |
9 | 9 |
10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 out->setUnknownFourComponents(); | 86 out->setUnknownFourComponents(); |
87 } else { | 87 } else { |
88 out->setKnownFourComponents(fGeoData[0].fColor); | 88 out->setKnownFourComponents(fGeoData[0].fColor); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void GrDrawVerticesBatch::getInvariantOutputCoverage(GrInitInvariantOutput* out)
const { | 92 void GrDrawVerticesBatch::getInvariantOutputCoverage(GrInitInvariantOutput* out)
const { |
93 out->setKnownSingleComponent(0xff); | 93 out->setKnownSingleComponent(0xff); |
94 } | 94 } |
95 | 95 |
96 void GrDrawVerticesBatch::initBatchTracker(const GrPipelineInfo& init) { | 96 void GrDrawVerticesBatch::initBatchTracker(const GrPipelineOptimizations& opt) { |
97 // Handle any color overrides | 97 // Handle any color overrides |
98 if (!init.readsColor()) { | 98 if (!opt.readsColor()) { |
99 fGeoData[0].fColor = GrColor_ILLEGAL; | 99 fGeoData[0].fColor = GrColor_ILLEGAL; |
100 } | 100 } |
101 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 101 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
102 | 102 |
103 // setup batch properties | 103 // setup batch properties |
104 fBatch.fColorIgnored = !init.readsColor(); | 104 fBatch.fColorIgnored = !opt.readsColor(); |
105 fBatch.fColor = fGeoData[0].fColor; | 105 fBatch.fColor = fGeoData[0].fColor; |
106 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 106 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
107 fBatch.fCoverageIgnored = !init.readsCoverage(); | 107 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
108 } | 108 } |
109 | 109 |
110 void GrDrawVerticesBatch::generateGeometry(GrBatchTarget* batchTarget) { | 110 void GrDrawVerticesBatch::generateGeometry(GrBatchTarget* batchTarget) { |
111 int colorOffset = -1, texOffset = -1; | 111 int colorOffset = -1, texOffset = -1; |
112 SkAutoTUnref<const GrGeometryProcessor> gp( | 112 SkAutoTUnref<const GrGeometryProcessor> gp( |
113 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &co
lorOffset, | 113 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &co
lorOffset, |
114 &texOffset, this->color(), this->viewMatrix(), | 114 &texOffset, this->color(), this->viewMatrix(), |
115 this->coverageIgnored())); | 115 this->coverageIgnored())); |
116 | 116 |
117 batchTarget->initDraw(gp, this->pipeline()); | 117 batchTarget->initDraw(gp, this->pipeline()); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 geometry.fColor = GrRandomColor(random); | 339 geometry.fColor = GrRandomColor(random); |
340 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, | 340 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, |
341 positions.begin(), vertexCount, | 341 positions.begin(), vertexCount, |
342 indices.begin(), hasIndices ? vertexCount
: 0, | 342 indices.begin(), hasIndices ? vertexCount
: 0, |
343 colors.begin(), | 343 colors.begin(), |
344 texCoords.begin(), | 344 texCoords.begin(), |
345 bounds); | 345 bounds); |
346 } | 346 } |
347 | 347 |
348 #endif | 348 #endif |
OLD | NEW |