Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 16952006: Replace fixed-size array of effect stages in GrDrawState with two appendable arrays, one for color,… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698