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 "GrDrawAtlasBatch.h" | 8 #include "GrDrawAtlasBatch.h" |
9 #include "GrBatchFlushState.h" | 9 #include "GrBatchFlushState.h" |
10 #include "GrBatchTest.h" | 10 #include "GrBatchTest.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewM
atrix); | 51 return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewM
atrix); |
52 } | 52 } |
53 | 53 |
54 void GrDrawAtlasBatch::onPrepareDraws(Target* target) const { | 54 void GrDrawAtlasBatch::onPrepareDraws(Target* target) const { |
55 // Setup geometry processor | 55 // Setup geometry processor |
56 SkAutoTUnref<const GrGeometryProcessor> gp(set_vertex_attributes(this->hasCo
lors(), | 56 SkAutoTUnref<const GrGeometryProcessor> gp(set_vertex_attributes(this->hasCo
lors(), |
57 this->color
(), | 57 this->color
(), |
58 this->viewM
atrix(), | 58 this->viewM
atrix(), |
59 this->cover
ageIgnored())); | 59 this->cover
ageIgnored())); |
60 | 60 |
61 target->initDraw(gp, this->pipeline()); | 61 target->initDraw(gp); |
62 | 62 |
63 int instanceCount = fGeoData.count(); | 63 int instanceCount = fGeoData.count(); |
64 size_t vertexStride = gp->getVertexStride(); | 64 size_t vertexStride = gp->getVertexStride(); |
65 SkASSERT(vertexStride == sizeof(SkPoint) + sizeof(SkPoint) | 65 SkASSERT(vertexStride == sizeof(SkPoint) + sizeof(SkPoint) |
66 + (this->hasColors() ? sizeof(GrColor) : 0)); | 66 + (this->hasColors() ? sizeof(GrColor) : 0)); |
67 | 67 |
68 QuadHelper helper; | 68 QuadHelper helper; |
69 int numQuads = this->quadCount(); | 69 int numQuads = this->quadCount(); |
70 void* verts = helper.init(target, vertexStride, numQuads); | 70 void* verts = helper.init(target, vertexStride, numQuads); |
71 if (!verts) { | 71 if (!verts) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 259 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
260 | 260 |
261 GrDrawAtlasBatch::Geometry geometry; | 261 GrDrawAtlasBatch::Geometry geometry; |
262 geometry.fColor = GrRandomColor(random); | 262 geometry.fColor = GrRandomColor(random); |
263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be
gin(), | 263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be
gin(), |
264 texRects.begin(), hasColors ? colors.begin()
: nullptr); | 264 texRects.begin(), hasColors ? colors.begin()
: nullptr); |
265 } | 265 } |
266 | 266 |
267 #endif | 267 #endif |
OLD | NEW |