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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = !overrides.readsCoverage(); | 89 fCoverageIgnored = !overrides.readsCoverage(); |
90 if (!overrides.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) const { |
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)); |
101 target->initDraw(gp, this->pipeline()); | 101 target->initDraw(gp, this->pipeline()); |
102 | 102 |
103 size_t vertexStride = gp->getVertexStride(); | 103 size_t vertexStride = gp->getVertexStride(); |
104 | 104 |
105 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint)
: 0) | 105 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint)
: 0) |
(...skipping 212 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 |