| 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 "GrRectBatch.h" | 8 #include "GrRectBatch.h" |
| 9 | 9 |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 48 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 49 | 49 |
| 50 // setup batch properties | 50 // setup batch properties |
| 51 fBatch.fColorIgnored = !init.readsColor(); | 51 fBatch.fColorIgnored = !init.readsColor(); |
| 52 fBatch.fColor = fGeoData[0].fColor; | 52 fBatch.fColor = fGeoData[0].fColor; |
| 53 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 53 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
| 54 fBatch.fCoverageIgnored = !init.readsCoverage(); | 54 fBatch.fCoverageIgnored = !init.readsCoverage(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 57 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 58 SkAutoTUnref<const GrGeometryProcessor> gp(this->createRectGP()); | 58 SkAutoTUnref<const GrGeometryProcessor> gp(this->createRectGP()); |
| 59 if (!gp) { | 59 if (!gp) { |
| 60 SkDebugf("Could not create GrGeometryProcessor\n"); | 60 SkDebugf("Could not create GrGeometryProcessor\n"); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 batchTarget->initDraw(gp, pipeline); | 64 batchTarget->initDraw(gp, this->pipeline()); |
| 65 | 65 |
| 66 int instanceCount = fGeoData.count(); | 66 int instanceCount = fGeoData.count(); |
| 67 size_t vertexStride = gp->getVertexStride(); | 67 size_t vertexStride = gp->getVertexStride(); |
| 68 SkASSERT(this->hasLocalRect() ? | 68 SkASSERT(this->hasLocalRect() ? |
| 69 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorLo
calCoordAttr) : | 69 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorLo
calCoordAttr) : |
| 70 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr)); | 70 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr)); |
| 71 QuadHelper helper; | 71 QuadHelper helper; |
| 72 void* vertices = helper.init(batchTarget, vertexStride, instanceCount); | 72 void* vertices = helper.init(batchTarget, vertexStride, instanceCount); |
| 73 | 73 |
| 74 if (!vertices) { | 74 if (!vertices) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (hasLocalMatrix) { | 259 if (hasLocalMatrix) { |
| 260 localMatrix = GrTest::TestMatrix(random); | 260 localMatrix = GrTest::TestMatrix(random); |
| 261 } | 261 } |
| 262 | 262 |
| 263 return GrRectBatch::Create(color, viewMatrix, rect, | 263 return GrRectBatch::Create(color, viewMatrix, rect, |
| 264 hasLocalRect ? &localRect : NULL, | 264 hasLocalRect ? &localRect : NULL, |
| 265 hasLocalMatrix ? &localMatrix : NULL); | 265 hasLocalMatrix ? &localMatrix : NULL); |
| 266 } | 266 } |
| 267 | 267 |
| 268 #endif | 268 #endif |
| OLD | NEW |