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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 fVariableColor = false; | 56 fVariableColor = false; |
57 } | 57 } |
58 | 58 |
59 if (localCoords) { | 59 if (localCoords) { |
60 mesh.fLocalCoords.append(vertexCount, localCoords); | 60 mesh.fLocalCoords.append(vertexCount, localCoords); |
61 } | 61 } |
62 fVertexCount = vertexCount; | 62 fVertexCount = vertexCount; |
63 fIndexCount = indexCount; | 63 fIndexCount = indexCount; |
64 fPrimitiveType = primitiveType; | 64 fPrimitiveType = primitiveType; |
65 | 65 |
66 this->setBounds(bounds); | 66 IsZeroArea zeroArea; |
| 67 if (GrIsPrimTypeLines(primitiveType) || kPoints_GrPrimitiveType == primitive
Type) { |
| 68 zeroArea = IsZeroArea::kYes; |
| 69 } else { |
| 70 zeroArea = IsZeroArea::kNo; |
| 71 } |
| 72 this->setBounds(bounds, HasAABloat::kNo, zeroArea); |
67 } | 73 } |
68 | 74 |
69 void GrDrawVerticesBatch::computePipelineOptimizations(GrInitInvariantOutput* co
lor, | 75 void GrDrawVerticesBatch::computePipelineOptimizations(GrInitInvariantOutput* co
lor, |
70 GrInitInvariantOutput* co
verage, | 76 GrInitInvariantOutput* co
verage, |
71 GrBatchToXPOverrides* ove
rrides) const { | 77 GrBatchToXPOverrides* ove
rrides) const { |
72 // When this is called on a batch, there is only one mesh | 78 // When this is called on a batch, there is only one mesh |
73 if (fVariableColor) { | 79 if (fVariableColor) { |
74 color->setUnknownFourComponents(); | 80 color->setUnknownFourComponents(); |
75 } else { | 81 } else { |
76 color->setKnownFourComponents(fMeshes[0].fColor); | 82 color->setKnownFourComponents(fMeshes[0].fColor); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (!fVariableColor) { | 199 if (!fVariableColor) { |
194 if (that->fVariableColor || that->fMeshes[0].fColor != fMeshes[0].fColor
) { | 200 if (that->fVariableColor || that->fMeshes[0].fColor != fMeshes[0].fColor
) { |
195 fVariableColor = true; | 201 fVariableColor = true; |
196 } | 202 } |
197 } | 203 } |
198 | 204 |
199 fMeshes.push_back_n(that->fMeshes.count(), that->fMeshes.begin()); | 205 fMeshes.push_back_n(that->fMeshes.count(), that->fMeshes.begin()); |
200 fVertexCount += that->fVertexCount; | 206 fVertexCount += that->fVertexCount; |
201 fIndexCount += that->fIndexCount; | 207 fIndexCount += that->fIndexCount; |
202 | 208 |
203 this->joinBounds(that->bounds()); | 209 this->joinBounds(*that); |
204 return true; | 210 return true; |
205 } | 211 } |
206 | 212 |
207 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 213 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
208 | 214 |
209 #ifdef GR_TEST_UTILS | 215 #ifdef GR_TEST_UTILS |
210 | 216 |
211 #include "GrBatchTest.h" | 217 #include "GrBatchTest.h" |
212 | 218 |
213 static uint32_t seed_vertices(GrPrimitiveType type) { | 219 static uint32_t seed_vertices(GrPrimitiveType type) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 317 |
312 viewMatrix.mapRect(&bounds); | 318 viewMatrix.mapRect(&bounds); |
313 | 319 |
314 GrColor color = GrRandomColor(random); | 320 GrColor color = GrRandomColor(random); |
315 return new GrDrawVerticesBatch(color, type, viewMatrix, positions.begin(), v
ertexCount, | 321 return new GrDrawVerticesBatch(color, type, viewMatrix, positions.begin(), v
ertexCount, |
316 indices.begin(), hasIndices ? vertexCount : 0
, | 322 indices.begin(), hasIndices ? vertexCount : 0
, |
317 colors.begin(), texCoords.begin(), bounds); | 323 colors.begin(), texCoords.begin(), bounds); |
318 } | 324 } |
319 | 325 |
320 #endif | 326 #endif |
OLD | NEW |