| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 batchTarget->caps(), | 862 batchTarget->caps(), |
| 863 *geometryProcessorLocalM, | 863 *geometryProcessorLocalM, |
| 864 this->coverage())); | 864 this->coverage())); |
| 865 | 865 |
| 866 // This is hand inlined for maximum performance. | 866 // This is hand inlined for maximum performance. |
| 867 PREALLOC_PTARRAY(128) lines; | 867 PREALLOC_PTARRAY(128) lines; |
| 868 PREALLOC_PTARRAY(128) quads; | 868 PREALLOC_PTARRAY(128) quads; |
| 869 PREALLOC_PTARRAY(128) conics; | 869 PREALLOC_PTARRAY(128) conics; |
| 870 IntArray qSubdivs; | 870 IntArray qSubdivs; |
| 871 FloatArray cWeights; | 871 FloatArray cWeights; |
| 872 int quadCount = 0; |
| 872 | 873 |
| 873 int instanceCount = fGeoData.count(); | 874 int instanceCount = fGeoData.count(); |
| 874 for (int i = 0; i < instanceCount; i++) { | 875 for (int i = 0; i < instanceCount; i++) { |
| 875 const Geometry& args = fGeoData[i]; | 876 const Geometry& args = fGeoData[i]; |
| 876 gather_lines_and_quads(args.fPath, args.fViewMatrix, args.fDevClipBounds
, | 877 quadCount += gather_lines_and_quads(args.fPath, args.fViewMatrix, args.f
DevClipBounds, |
| 877 &lines, &quads, &conics, &qSubdivs, &cWeights); | 878 &lines, &quads, &conics, &qSubdivs,
&cWeights); |
| 878 } | 879 } |
| 879 | 880 |
| 880 int quadCount = quads.count() / 3; | |
| 881 int lineCount = lines.count() / 2; | 881 int lineCount = lines.count() / 2; |
| 882 int conicCount = conics.count() / 3; | 882 int conicCount = conics.count() / 3; |
| 883 | 883 |
| 884 // do lines first | 884 // do lines first |
| 885 if (lineCount) { | 885 if (lineCount) { |
| 886 batchTarget->initDraw(lineGP, pipeline); | 886 batchTarget->initDraw(lineGP, pipeline); |
| 887 | 887 |
| 888 // TODO remove this when batch is everywhere | 888 // TODO remove this when batch is everywhere |
| 889 GrPipelineInfo init; | 889 GrPipelineInfo init; |
| 890 init.fColorIgnored = fBatch.fColorIgnored; | 890 init.fColorIgnored = fBatch.fColorIgnored; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 size_t vertexStride = sizeof(BezierVertex); | 938 size_t vertexStride = sizeof(BezierVertex); |
| 939 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni
cCount; | 939 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni
cCount; |
| 940 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 940 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
| 941 vertexCount, | 941 vertexCount, |
| 942 &vertexBuffer, | 942 &vertexBuffer, |
| 943 &firstVertex); | 943 &firstVertex); |
| 944 | 944 |
| 945 // Setup vertices | 945 // Setup vertices |
| 946 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); | 946 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); |
| 947 | 947 |
| 948 // is this the same as quadcount? TODO | |
| 949 int unsubdivQuadCnt = quads.count() / 3; | 948 int unsubdivQuadCnt = quads.count() / 3; |
| 950 for (int i = 0; i < unsubdivQuadCnt; ++i) { | 949 for (int i = 0; i < unsubdivQuadCnt; ++i) { |
| 951 SkASSERT(qSubdivs[i] >= 0); | 950 SkASSERT(qSubdivs[i] >= 0); |
| 952 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts); | 951 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts); |
| 953 } | 952 } |
| 954 | 953 |
| 955 // Start Conics | 954 // Start Conics |
| 956 for (int i = 0; i < conicCount; ++i) { | 955 for (int i = 0; i < conicCount; ++i) { |
| 957 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts); | 956 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts); |
| 958 } | 957 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 geometry.fPath = path; | 1051 geometry.fPath = path; |
| 1053 SkDEBUGCODE(geometry.fDevBounds = devRect;) | 1052 SkDEBUGCODE(geometry.fDevBounds = devRect;) |
| 1054 geometry.fDevClipBounds = devClipBounds; | 1053 geometry.fDevClipBounds = devClipBounds; |
| 1055 | 1054 |
| 1056 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, | 1055 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, |
| 1057 fQuadsIndexBuffer)); | 1056 fQuadsIndexBuffer)); |
| 1058 target->drawBatch(pipelineBuilder, batch, &devRect); | 1057 target->drawBatch(pipelineBuilder, batch, &devRect); |
| 1059 | 1058 |
| 1060 return true; | 1059 return true; |
| 1061 } | 1060 } |
| OLD | NEW |