| 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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (localCoords) { | 58 if (localCoords) { |
| 59 installedGeo.fLocalCoords.append(vertexCount, localCoords); | 59 installedGeo.fLocalCoords.append(vertexCount, localCoords); |
| 60 } | 60 } |
| 61 fVertexCount = vertexCount; | 61 fVertexCount = vertexCount; |
| 62 fIndexCount = indexCount; | 62 fIndexCount = indexCount; |
| 63 fPrimitiveType = primitiveType; | 63 fPrimitiveType = primitiveType; |
| 64 | 64 |
| 65 this->setBounds(bounds); | 65 this->setBounds(bounds); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void GrDrawVerticesBatch::getInvariantOutputColor(GrInitInvariantOutput* out) co
nst { | 68 void GrDrawVerticesBatch::computePipelineOptimizations(GrInitInvariantOutput* co
lor, |
| 69 GrInitInvariantOutput* co
verage, |
| 70 GrBatchToXPOverrides* ove
rrides) const { |
| 69 // When this is called on a batch, there is only one geometry bundle | 71 // When this is called on a batch, there is only one geometry bundle |
| 70 if (fVariableColor) { | 72 if (fVariableColor) { |
| 71 out->setUnknownFourComponents(); | 73 color->setUnknownFourComponents(); |
| 72 } else { | 74 } else { |
| 73 out->setKnownFourComponents(fGeoData[0].fColor); | 75 color->setKnownFourComponents(fGeoData[0].fColor); |
| 74 } | 76 } |
| 77 coverage->setKnownSingleComponent(0xff); |
| 78 overrides->fUsePLSDstRead = false; |
| 75 } | 79 } |
| 76 | 80 |
| 77 void GrDrawVerticesBatch::getInvariantOutputCoverage(GrInitInvariantOutput* out)
const { | 81 void GrDrawVerticesBatch::initBatchTracker(const GrXPOverridesForBatch& override
s) { |
| 78 out->setKnownSingleComponent(0xff); | |
| 79 } | |
| 80 | |
| 81 void GrDrawVerticesBatch::initBatchTracker(const GrPipelineOptimizations& opt) { | |
| 82 SkASSERT(fGeoData.count() == 1); | 82 SkASSERT(fGeoData.count() == 1); |
| 83 GrColor overrideColor; | 83 GrColor overrideColor; |
| 84 if (opt.getOverrideColorIfSet(&overrideColor)) { | 84 if (overrides.getOverrideColorIfSet(&overrideColor)) { |
| 85 fGeoData[0].fColor = overrideColor; | 85 fGeoData[0].fColor = overrideColor; |
| 86 fGeoData[0].fColors.reset(); | 86 fGeoData[0].fColors.reset(); |
| 87 fVariableColor = false; | 87 fVariableColor = false; |
| 88 } | 88 } |
| 89 fCoverageIgnored = !opt.readsCoverage(); | 89 fCoverageIgnored = !overrides.readsCoverage(); |
| 90 if (!opt.readsLocalCoords()) { | 90 if (!overrides.readsLocalCoords()) { |
| 91 fGeoData[0].fLocalCoords.reset(); | 91 fGeoData[0].fLocalCoords.reset(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 void GrDrawVerticesBatch::onPrepareDraws(Target* target) { | 95 void GrDrawVerticesBatch::onPrepareDraws(Target* target) { |
| 96 bool hasLocalCoords = !fGeoData[0].fLocalCoords.isEmpty(); | 96 bool hasLocalCoords = !fGeoData[0].fLocalCoords.isEmpty(); |
| 97 int colorOffset = -1, texOffset = -1; | 97 int colorOffset = -1, texOffset = -1; |
| 98 SkAutoTUnref<const GrGeometryProcessor> gp( | 98 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 99 set_vertex_attributes(hasLocalCoords, &colorOffset, &texOffset, fViewMat
rix, | 99 set_vertex_attributes(hasLocalCoords, &colorOffset, &texOffset, fViewMat
rix, |
| 100 fCoverageIgnored)); | 100 fCoverageIgnored)); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 geometry.fColor = GrRandomColor(random); | 318 geometry.fColor = GrRandomColor(random); |
| 319 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, | 319 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, |
| 320 positions.begin(), vertexCount, | 320 positions.begin(), vertexCount, |
| 321 indices.begin(), hasIndices ? vertexCount
: 0, | 321 indices.begin(), hasIndices ? vertexCount
: 0, |
| 322 colors.begin(), | 322 colors.begin(), |
| 323 texCoords.begin(), | 323 texCoords.begin(), |
| 324 bounds); | 324 bounds); |
| 325 } | 325 } |
| 326 | 326 |
| 327 #endif | 327 #endif |
| OLD | NEW |