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

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

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: warning fixed 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 983
984 // createGeom transforms the geometry to device space when the matrix do es not have 984 // createGeom transforms the geometry to device space when the matrix do es not have
985 // perspective. 985 // perspective.
986 if (target->getDrawState().getViewMatrix().hasPerspective()) { 986 if (target->getDrawState().getViewMatrix().hasPerspective()) {
987 asr.set(target, GrDrawTarget::kPreserve_ASRInit); 987 asr.set(target, GrDrawTarget::kPreserve_ASRInit);
988 } else if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) { 988 } else if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) {
989 return false; 989 return false;
990 } 990 }
991 GrDrawState* drawState = target->drawState(); 991 GrDrawState* drawState = target->drawState();
992 992
993 static const int kEdgeAttrIndex = 1;
994
995 // Check devBounds 993 // Check devBounds
996 SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices() , 994 SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices() ,
997 kVertsPerQuad * quadCnt + kVertsPerQ uad * conicCnt)); 995 kVertsPerQuad * quadCnt + kVertsPerQ uad * conicCnt));
998 996
999 if (quadCnt > 0) { 997 if (quadCnt > 0) {
1000 GrEffect* hairQuadEffect = GrQuadEffect::Create(kHairlineAA_GrEffect EdgeType, 998 GrEffect* hairQuadEffect = GrQuadEffect::Create(kHairlineAA_GrEffect EdgeType,
1001 *target->caps()); 999 *target->caps());
1002 SkASSERT(hairQuadEffect); 1000 SkASSERT(hairQuadEffect);
1003 GrDrawState::AutoRestoreEffects are(drawState); 1001 GrDrawState::AutoRestoreEffects are(drawState);
1004 target->setIndexSourceToBuffer(fQuadsIndexBuffer); 1002 target->setIndexSourceToBuffer(fQuadsIndexBuffer);
1005 drawState->setGeometryProcessor(hairQuadEffect, kEdgeAttrIndex)->unr ef(); 1003 drawState->setGeometryProcessor(hairQuadEffect)->unref();
1006 int quads = 0; 1004 int quads = 0;
1007 while (quads < quadCnt) { 1005 while (quads < quadCnt) {
1008 int n = SkTMin(quadCnt - quads, kNumQuadsInIdxBuffer); 1006 int n = SkTMin(quadCnt - quads, kNumQuadsInIdxBuffer);
1009 target->drawIndexed(kTriangles_GrPrimitiveType, 1007 target->drawIndexed(kTriangles_GrPrimitiveType,
1010 kVertsPerQuad*quads, // startV 1008 kVertsPerQuad*quads, // startV
1011 0, // startI 1009 0, // startI
1012 kVertsPerQuad*n, // vCount 1010 kVertsPerQuad*n, // vCount
1013 kIdxsPerQuad*n, // iCount 1011 kIdxsPerQuad*n, // iCount
1014 &devBounds); 1012 &devBounds);
1015 quads += n; 1013 quads += n;
1016 } 1014 }
1017 } 1015 }
1018 1016
1019 if (conicCnt > 0) { 1017 if (conicCnt > 0) {
1020 GrDrawState::AutoRestoreEffects are(drawState); 1018 GrDrawState::AutoRestoreEffects are(drawState);
1021 GrEffect* hairConicEffect = GrConicEffect::Create(kHairlineAA_GrEffe ctEdgeType, 1019 GrEffect* hairConicEffect = GrConicEffect::Create(kHairlineAA_GrEffe ctEdgeType,
1022 *target->caps()); 1020 *target->caps());
1023 SkASSERT(hairConicEffect); 1021 SkASSERT(hairConicEffect);
1024 drawState->setGeometryProcessor(hairConicEffect, 1, 2)->unref(); 1022 drawState->setGeometryProcessor(hairConicEffect)->unref();
1025 int conics = 0; 1023 int conics = 0;
1026 while (conics < conicCnt) { 1024 while (conics < conicCnt) {
1027 int n = SkTMin(conicCnt - conics, kNumQuadsInIdxBuffer); 1025 int n = SkTMin(conicCnt - conics, kNumQuadsInIdxBuffer);
1028 target->drawIndexed(kTriangles_GrPrimitiveType, 1026 target->drawIndexed(kTriangles_GrPrimitiveType,
1029 kVertsPerQuad*(quadCnt + conics), // startV 1027 kVertsPerQuad*(quadCnt + conics), // startV
1030 0, // startI 1028 0, // startI
1031 kVertsPerQuad*n, // vCount 1029 kVertsPerQuad*n, // vCount
1032 kIdxsPerQuad*n, // iCount 1030 kIdxsPerQuad*n, // iCount
1033 &devBounds); 1031 &devBounds);
1034 conics += n; 1032 conics += n;
1035 } 1033 }
1036 } 1034 }
1037 } 1035 }
1038 1036
1039 target->resetIndexSource(); 1037 target->resetIndexSource();
1040 1038
1041 return true; 1039 return true;
1042 } 1040 }
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