| 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" |
| 11 #include "GrBatchTarget.h" | 11 #include "GrBatchTarget.h" |
| 12 #include "GrBatchTest.h" | 12 #include "GrBatchTest.h" |
| 13 #include "GrBufferAllocPool.h" | |
| 14 #include "GrContext.h" | 13 #include "GrContext.h" |
| 15 #include "GrDefaultGeoProcFactory.h" | 14 #include "GrDefaultGeoProcFactory.h" |
| 16 #include "GrDrawTargetCaps.h" | 15 #include "GrDrawTargetCaps.h" |
| 17 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
| 18 #include "GrPathUtils.h" | 17 #include "GrPathUtils.h" |
| 19 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
| 20 #include "GrProcessor.h" | 19 #include "GrProcessor.h" |
| 21 #include "GrResourceProvider.h" | 20 #include "GrResourceProvider.h" |
| 22 #include "GrVertexBuffer.h" | 21 #include "GrVertexBuffer.h" |
| 23 #include "SkGeometry.h" | 22 #include "SkGeometry.h" |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 init.fOverrideColor = GrColor_ILLEGAL; | 862 init.fOverrideColor = GrColor_ILLEGAL; |
| 864 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 863 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 865 init.fUsesLocalCoords = this->usesLocalCoords(); | 864 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 866 lineGP->initBatchTracker(batchTarget->currentBatchTracker(), init); | 865 lineGP->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 867 | 866 |
| 868 const GrVertexBuffer* vertexBuffer; | 867 const GrVertexBuffer* vertexBuffer; |
| 869 int firstVertex; | 868 int firstVertex; |
| 870 | 869 |
| 871 size_t vertexStride = lineGP->getVertexStride(); | 870 size_t vertexStride = lineGP->getVertexStride(); |
| 872 int vertexCount = kLineSegNumVertices * lineCount; | 871 int vertexCount = kLineSegNumVertices * lineCount; |
| 873 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 872 void *vertices = batchTarget->makeVertSpace(vertexStride, vertexCount, |
| 874 vertexCount, | 873 &vertexBuffer, &firstVertex)
; |
| 875 &vertexBuffer, | |
| 876 &firstVertex); | |
| 877 | 874 |
| 878 if (!vertices || !linesIndexBuffer) { | 875 if (!vertices || !linesIndexBuffer) { |
| 879 SkDebugf("Could not allocate vertices\n"); | 876 SkDebugf("Could not allocate vertices\n"); |
| 880 return; | 877 return; |
| 881 } | 878 } |
| 882 | 879 |
| 883 SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex)); | 880 SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex)); |
| 884 | 881 |
| 885 LineVertex* verts = reinterpret_cast<LineVertex*>(vertices); | 882 LineVertex* verts = reinterpret_cast<LineVertex*>(vertices); |
| 886 for (int i = 0; i < lineCount; ++i) { | 883 for (int i = 0; i < lineCount; ++i) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 901 | 898 |
| 902 if (quadCount || conicCount) { | 899 if (quadCount || conicCount) { |
| 903 const GrVertexBuffer* vertexBuffer; | 900 const GrVertexBuffer* vertexBuffer; |
| 904 int firstVertex; | 901 int firstVertex; |
| 905 | 902 |
| 906 SkAutoTUnref<const GrIndexBuffer> quadsIndexBuffer( | 903 SkAutoTUnref<const GrIndexBuffer> quadsIndexBuffer( |
| 907 ref_quads_index_buffer(batchTarget->resourceProvider())); | 904 ref_quads_index_buffer(batchTarget->resourceProvider())); |
| 908 | 905 |
| 909 size_t vertexStride = sizeof(BezierVertex); | 906 size_t vertexStride = sizeof(BezierVertex); |
| 910 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni
cCount; | 907 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni
cCount; |
| 911 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 908 void *vertices = batchTarget->makeVertSpace(vertexStride, vertexCount, |
| 912 vertexCount, | 909 &vertexBuffer, &firstVertex)
; |
| 913 &vertexBuffer, | |
| 914 &firstVertex); | |
| 915 | 910 |
| 916 if (!vertices || !quadsIndexBuffer) { | 911 if (!vertices || !quadsIndexBuffer) { |
| 917 SkDebugf("Could not allocate vertices\n"); | 912 SkDebugf("Could not allocate vertices\n"); |
| 918 return; | 913 return; |
| 919 } | 914 } |
| 920 | 915 |
| 921 // Setup vertices | 916 // Setup vertices |
| 922 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); | 917 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); |
| 923 | 918 |
| 924 int unsubdivQuadCnt = quads.count() / 3; | 919 int unsubdivQuadCnt = quads.count() / 3; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 GrColor color = GrRandomColor(random); | 1023 GrColor color = GrRandomColor(random); |
| 1029 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1024 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 1030 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 1025 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 1031 SkPath path = GrTest::TestPath(random); | 1026 SkPath path = GrTest::TestPath(random); |
| 1032 SkIRect devClipBounds; | 1027 SkIRect devClipBounds; |
| 1033 devClipBounds.setEmpty(); | 1028 devClipBounds.setEmpty(); |
| 1034 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 1029 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
| 1035 } | 1030 } |
| 1036 | 1031 |
| 1037 #endif | 1032 #endif |
| OLD | NEW |