| 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 882 |
| 883 SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex)); | 883 SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex)); |
| 884 | 884 |
| 885 LineVertex* verts = reinterpret_cast<LineVertex*>(vertices); | 885 LineVertex* verts = reinterpret_cast<LineVertex*>(vertices); |
| 886 for (int i = 0; i < lineCount; ++i) { | 886 for (int i = 0; i < lineCount; ++i) { |
| 887 add_line(&lines[2*i], toSrc, this->coverage(), &verts); | 887 add_line(&lines[2*i], toSrc, this->coverage(), &verts); |
| 888 } | 888 } |
| 889 | 889 |
| 890 { | 890 { |
| 891 int linesLeft = lineCount; | 891 int linesLeft = lineCount; |
| 892 GrDrawTarget::DrawInfo info; | 892 GrVertices info; |
| 893 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIn
dexBuffer, | 893 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIn
dexBuffer, |
| 894 firstVertex, kLineSegNumVertices, kIdxsPerLineSeg
, &linesLeft, | 894 firstVertex, kLineSegNumVertices, kIdxsPerLineSeg
, &linesLeft, |
| 895 kLineSegsNumInIdxBuffer); | 895 kLineSegsNumInIdxBuffer); |
| 896 do { | 896 do { |
| 897 batchTarget->draw(info); | 897 batchTarget->draw(info); |
| 898 } while (info.nextInstances(&linesLeft, kLineSegsNumInIdxBuffer)); | 898 } while (info.nextInstances(&linesLeft, kLineSegsNumInIdxBuffer)); |
| 899 } | 899 } |
| 900 } | 900 } |
| 901 | 901 |
| 902 if (quadCount || conicCount) { | 902 if (quadCount || conicCount) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 // TODO remove this when batch is everywhere | 938 // TODO remove this when batch is everywhere |
| 939 GrPipelineInfo init; | 939 GrPipelineInfo init; |
| 940 init.fColorIgnored = fBatch.fColorIgnored; | 940 init.fColorIgnored = fBatch.fColorIgnored; |
| 941 init.fOverrideColor = GrColor_ILLEGAL; | 941 init.fOverrideColor = GrColor_ILLEGAL; |
| 942 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 942 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 943 init.fUsesLocalCoords = this->usesLocalCoords(); | 943 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 944 quadGP->initBatchTracker(batchTarget->currentBatchTracker(), init); | 944 quadGP->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 945 | 945 |
| 946 { | 946 { |
| 947 int quadsLeft = quadCount; | 947 int quadsLeft = quadCount; |
| 948 GrDrawTarget::DrawInfo info; | 948 GrVertices info; |
| 949 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, qua
dsIndexBuffer, | 949 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, qua
dsIndexBuffer, |
| 950 firstVertex, kQuadNumVertices, kIdxsPerQuad,
&quadsLeft, | 950 firstVertex, kQuadNumVertices, kIdxsPerQuad,
&quadsLeft, |
| 951 kQuadsNumInIdxBuffer); | 951 kQuadsNumInIdxBuffer); |
| 952 do { | 952 do { |
| 953 batchTarget->draw(info); | 953 batchTarget->draw(info); |
| 954 } while (info.nextInstances(&quadsLeft, kQuadsNumInIdxBuffer)); | 954 } while (info.nextInstances(&quadsLeft, kQuadsNumInIdxBuffer)); |
| 955 firstVertex += quadCount * kQuadNumVertices; | 955 firstVertex += quadCount * kQuadNumVertices; |
| 956 } | 956 } |
| 957 } | 957 } |
| 958 | 958 |
| 959 if (conicCount > 0) { | 959 if (conicCount > 0) { |
| 960 batchTarget->initDraw(conicGP, pipeline); | 960 batchTarget->initDraw(conicGP, pipeline); |
| 961 | 961 |
| 962 // TODO remove this when batch is everywhere | 962 // TODO remove this when batch is everywhere |
| 963 GrPipelineInfo init; | 963 GrPipelineInfo init; |
| 964 init.fColorIgnored = fBatch.fColorIgnored; | 964 init.fColorIgnored = fBatch.fColorIgnored; |
| 965 init.fOverrideColor = GrColor_ILLEGAL; | 965 init.fOverrideColor = GrColor_ILLEGAL; |
| 966 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 966 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 967 init.fUsesLocalCoords = this->usesLocalCoords(); | 967 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 968 conicGP->initBatchTracker(batchTarget->currentBatchTracker(), init); | 968 conicGP->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 969 | 969 |
| 970 { | 970 { |
| 971 int conicsLeft = conicCount; | 971 int conicsLeft = conicCount; |
| 972 GrDrawTarget::DrawInfo info; | 972 GrVertices info; |
| 973 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, qua
dsIndexBuffer, | 973 info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, qua
dsIndexBuffer, |
| 974 firstVertex, kQuadNumVertices, kIdxsPerQuad, &
conicsLeft, | 974 firstVertex, kQuadNumVertices, kIdxsPerQuad, &
conicsLeft, |
| 975 kQuadsNumInIdxBuffer); | 975 kQuadsNumInIdxBuffer); |
| 976 do { | 976 do { |
| 977 batchTarget->draw(info); | 977 batchTarget->draw(info); |
| 978 } while (info.nextInstances(&conicsLeft, kQuadsNumInIdxBuffer)); | 978 } while (info.nextInstances(&conicsLeft, kQuadsNumInIdxBuffer)); |
| 979 } | 979 } |
| 980 } | 980 } |
| 981 } | 981 } |
| 982 } | 982 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 GrColor color = GrRandomColor(random); | 1028 GrColor color = GrRandomColor(random); |
| 1029 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1029 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 1030 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 1030 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 1031 SkPath path = GrTest::TestPath(random); | 1031 SkPath path = GrTest::TestPath(random); |
| 1032 SkIRect devClipBounds; | 1032 SkIRect devClipBounds; |
| 1033 devClipBounds.setEmpty(); | 1033 devClipBounds.setEmpty(); |
| 1034 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 1034 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 #endif | 1037 #endif |
| OLD | NEW |