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

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

Issue 509153002: Initial change to create GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: last warning Created 6 years, 3 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
« 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 * 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 "GrContext.h" 10 #include "GrContext.h"
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // Check devBounds 995 // Check devBounds
996 SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices() , 996 SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices() ,
997 kVertsPerQuad * quadCnt + kVertsPerQ uad * conicCnt)); 997 kVertsPerQuad * quadCnt + kVertsPerQ uad * conicCnt));
998 998
999 if (quadCnt > 0) { 999 if (quadCnt > 0) {
1000 GrEffect* hairQuadEffect = GrQuadEffect::Create(kHairlineAA_GrEffect EdgeType, 1000 GrEffect* hairQuadEffect = GrQuadEffect::Create(kHairlineAA_GrEffect EdgeType,
1001 *target->caps()); 1001 *target->caps());
1002 SkASSERT(NULL != hairQuadEffect); 1002 SkASSERT(NULL != hairQuadEffect);
1003 GrDrawState::AutoRestoreEffects are(drawState); 1003 GrDrawState::AutoRestoreEffects are(drawState);
1004 target->setIndexSourceToBuffer(fQuadsIndexBuffer); 1004 target->setIndexSourceToBuffer(fQuadsIndexBuffer);
1005 drawState->addCoverageEffect(hairQuadEffect, kEdgeAttrIndex)->unref( ); 1005 drawState->setGeometryProcessor(hairQuadEffect, kEdgeAttrIndex)->unr ef();
1006 int quads = 0; 1006 int quads = 0;
1007 while (quads < quadCnt) { 1007 while (quads < quadCnt) {
1008 int n = SkTMin(quadCnt - quads, kNumQuadsInIdxBuffer); 1008 int n = SkTMin(quadCnt - quads, kNumQuadsInIdxBuffer);
1009 target->drawIndexed(kTriangles_GrPrimitiveType, 1009 target->drawIndexed(kTriangles_GrPrimitiveType,
1010 kVertsPerQuad*quads, // startV 1010 kVertsPerQuad*quads, // startV
1011 0, // startI 1011 0, // startI
1012 kVertsPerQuad*n, // vCount 1012 kVertsPerQuad*n, // vCount
1013 kIdxsPerQuad*n, // iCount 1013 kIdxsPerQuad*n, // iCount
1014 &devBounds); 1014 &devBounds);
1015 quads += n; 1015 quads += n;
1016 } 1016 }
1017 } 1017 }
1018 1018
1019 if (conicCnt > 0) { 1019 if (conicCnt > 0) {
1020 GrDrawState::AutoRestoreEffects are(drawState); 1020 GrDrawState::AutoRestoreEffects are(drawState);
1021 GrEffect* hairConicEffect = GrConicEffect::Create(kHairlineAA_GrEffe ctEdgeType, 1021 GrEffect* hairConicEffect = GrConicEffect::Create(kHairlineAA_GrEffe ctEdgeType,
1022 *target->caps()); 1022 *target->caps());
1023 SkASSERT(NULL != hairConicEffect); 1023 SkASSERT(NULL != hairConicEffect);
1024 drawState->addCoverageEffect(hairConicEffect, 1, 2)->unref(); 1024 drawState->setGeometryProcessor(hairConicEffect, 1, 2)->unref();
1025 int conics = 0; 1025 int conics = 0;
1026 while (conics < conicCnt) { 1026 while (conics < conicCnt) {
1027 int n = SkTMin(conicCnt - conics, kNumQuadsInIdxBuffer); 1027 int n = SkTMin(conicCnt - conics, kNumQuadsInIdxBuffer);
1028 target->drawIndexed(kTriangles_GrPrimitiveType, 1028 target->drawIndexed(kTriangles_GrPrimitiveType,
1029 kVertsPerQuad*(quadCnt + conics), // startV 1029 kVertsPerQuad*(quadCnt + conics), // startV
1030 0, // startI 1030 0, // startI
1031 kVertsPerQuad*n, // vCount 1031 kVertsPerQuad*n, // vCount
1032 kIdxsPerQuad*n, // iCount 1032 kIdxsPerQuad*n, // iCount
1033 &devBounds); 1033 &devBounds);
1034 conics += n; 1034 conics += n;
1035 } 1035 }
1036 } 1036 }
1037 } 1037 }
1038 1038
1039 target->resetIndexSource(); 1039 target->resetIndexSource();
1040 1040
1041 return true; 1041 return true;
1042 } 1042 }
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