| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAAHairLinePathRenderer.h" | 9 #include "GrAAHairLinePathRenderer.h" |
| 10 | 10 |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 first = false; | 864 first = false; |
| 865 } else { | 865 } else { |
| 866 actualBounds.growToInclude(pos.fX, pos.fY); | 866 actualBounds.growToInclude(pos.fX, pos.fY); |
| 867 } | 867 } |
| 868 } | 868 } |
| 869 if (!first) { | 869 if (!first) { |
| 870 GrAssert(tolDevBounds.contains(actualBounds)); | 870 GrAssert(tolDevBounds.contains(actualBounds)); |
| 871 } | 871 } |
| 872 #endif | 872 #endif |
| 873 | 873 |
| 874 target->setIndexSourceToBuffer(fLinesIndexBuffer); | 874 { |
| 875 int lines = 0; | 875 GrDrawState::AutoRestoreEffects are(drawState); |
| 876 int nBufLines = fLinesIndexBuffer->maxQuads(); | 876 target->setIndexSourceToBuffer(fLinesIndexBuffer); |
| 877 drawState->setEffect(kEdgeEffectStage, hairLineEffect, kEdgeAttrIndex)->unre
f(); | 877 int lines = 0; |
| 878 while (lines < lineCnt) { | 878 int nBufLines = fLinesIndexBuffer->maxQuads(); |
| 879 int n = GrMin(lineCnt - lines, nBufLines); | 879 drawState->addCoverageEffect(hairLineEffect, kEdgeAttrIndex)->unref(); |
| 880 target->drawIndexed(kTriangles_GrPrimitiveType, | 880 while (lines < lineCnt) { |
| 881 kVertsPerLineSeg*lines, // startV | 881 int n = GrMin(lineCnt - lines, nBufLines); |
| 882 0, // startI | 882 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 883 kVertsPerLineSeg*n, // vCount | 883 kVertsPerLineSeg*lines, // startV |
| 884 kIdxsPerLineSeg*n, | 884 0, // startI |
| 885 &devBounds); // iCount | 885 kVertsPerLineSeg*n, // vCount |
| 886 lines += n; | 886 kIdxsPerLineSeg*n, |
| 887 &devBounds); // iCount |
| 888 lines += n; |
| 889 } |
| 887 } | 890 } |
| 888 | 891 |
| 889 target->setIndexSourceToBuffer(fQuadsIndexBuffer); | 892 target->setIndexSourceToBuffer(fQuadsIndexBuffer); |
| 890 int quads = 0; | 893 int quads = 0; |
| 891 drawState->setEffect(kEdgeEffectStage, hairQuadEffect, kEdgeAttrIndex)->unre
f(); | 894 drawState->addCoverageEffect(hairQuadEffect, kEdgeAttrIndex)->unref(); |
| 892 while (quads < quadCnt) { | 895 while (quads < quadCnt) { |
| 893 int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer); | 896 int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer); |
| 894 target->drawIndexed(kTriangles_GrPrimitiveType, | 897 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 895 4 * lineCnt + kVertsPerQuad*quads, // startV | 898 4 * lineCnt + kVertsPerQuad*quads, // startV |
| 896 0, // startI | 899 0, // startI |
| 897 kVertsPerQuad*n, // vCount | 900 kVertsPerQuad*n, // vCount |
| 898 kIdxsPerQuad*n, // iCount | 901 kIdxsPerQuad*n, // iCount |
| 899 &devBounds); | 902 &devBounds); |
| 900 quads += n; | 903 quads += n; |
| 901 } | 904 } |
| 902 target->resetIndexSource(); | 905 target->resetIndexSource(); |
| 903 | 906 |
| 904 return true; | 907 return true; |
| 905 } | 908 } |
| OLD | NEW |