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

Side by Side Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 2248323003: Simplify adding attributes to GrGeometryProcessor (Closed) Base URL: https://chromium.googlesource.com/skia.git@xformhelper
Patch Set: Revert removal of fAttribNames Created 4 years, 4 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/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.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 2014 Google Inc. 2 * Copyright 2014 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 "GrDashingEffect.h" 8 #include "GrDashingEffect.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 943
944 DashingCircleEffect::DashingCircleEffect(GrColor color, 944 DashingCircleEffect::DashingCircleEffect(GrColor color,
945 AAMode aaMode, 945 AAMode aaMode,
946 const SkMatrix& localMatrix, 946 const SkMatrix& localMatrix,
947 bool usesLocalCoords) 947 bool usesLocalCoords)
948 : fColor(color) 948 : fColor(color)
949 , fLocalMatrix(localMatrix) 949 , fLocalMatrix(localMatrix)
950 , fUsesLocalCoords(usesLocalCoords) 950 , fUsesLocalCoords(usesLocalCoords)
951 , fAAMode(aaMode) { 951 , fAAMode(aaMode) {
952 this->initClassID<DashingCircleEffect>(); 952 this->initClassID<DashingCircleEffect>();
953 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 953 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType );
954 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType)); 954 fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttrib Type);
955 fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", 955 fInCircleParams = &this->addVertexAttrib("inCircleParams", kVec2f_GrVertexAt tribType);
956 kVec2f_GrVertexAttribType ));
957 } 956 }
958 957
959 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); 958 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
960 959
961 sk_sp<GrGeometryProcessor> DashingCircleEffect::TestCreate(GrProcessorTestData* d) { 960 sk_sp<GrGeometryProcessor> DashingCircleEffect::TestCreate(GrProcessorTestData* d) {
962 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec t::kAAModeCnt)); 961 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec t::kAAModeCnt));
963 return DashingCircleEffect::Make(GrRandomColor(d->fRandom), 962 return DashingCircleEffect::Make(GrRandomColor(d->fRandom),
964 aaMode, GrTest::TestMatrix(d->fRandom), 963 aaMode, GrTest::TestMatrix(d->fRandom),
965 d->fRandom->nextBool()); 964 d->fRandom->nextBool());
966 } 965 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1176
1178 DashingLineEffect::DashingLineEffect(GrColor color, 1177 DashingLineEffect::DashingLineEffect(GrColor color,
1179 AAMode aaMode, 1178 AAMode aaMode,
1180 const SkMatrix& localMatrix, 1179 const SkMatrix& localMatrix,
1181 bool usesLocalCoords) 1180 bool usesLocalCoords)
1182 : fColor(color) 1181 : fColor(color)
1183 , fLocalMatrix(localMatrix) 1182 , fLocalMatrix(localMatrix)
1184 , fUsesLocalCoords(usesLocalCoords) 1183 , fUsesLocalCoords(usesLocalCoords)
1185 , fAAMode(aaMode) { 1184 , fAAMode(aaMode) {
1186 this->initClassID<DashingLineEffect>(); 1185 this->initClassID<DashingLineEffect>();
1187 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 1186 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType );
1188 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType)); 1187 fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttrib Type);
1189 fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt tribType)); 1188 fInRectParams = &this->addVertexAttrib("inRect", kVec4f_GrVertexAttribType);
1190 } 1189 }
1191 1190
1192 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); 1191 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
1193 1192
1194 sk_sp<GrGeometryProcessor> DashingLineEffect::TestCreate(GrProcessorTestData* d) { 1193 sk_sp<GrGeometryProcessor> DashingLineEffect::TestCreate(GrProcessorTestData* d) {
1195 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec t::kAAModeCnt)); 1194 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec t::kAAModeCnt));
1196 return DashingLineEffect::Make(GrRandomColor(d->fRandom), 1195 return DashingLineEffect::Make(GrRandomColor(d->fRandom),
1197 aaMode, GrTest::TestMatrix(d->fRandom), 1196 aaMode, GrTest::TestMatrix(d->fRandom),
1198 d->fRandom->nextBool()); 1197 d->fRandom->nextBool());
1199 } 1198 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 p.setStrokeWidth(SkIntToScalar(1)); 1285 p.setStrokeWidth(SkIntToScalar(1));
1287 p.setStrokeCap(cap); 1286 p.setStrokeCap(cap);
1288 p.setPathEffect(GrTest::TestDashPathEffect::Make(intervals, 2, phase)); 1287 p.setPathEffect(GrTest::TestDashPathEffect::Make(intervals, 2, phase));
1289 1288
1290 GrStyle style(p); 1289 GrStyle style(p);
1291 1290
1292 return GrDashingEffect::CreateDashLineBatch(color, viewMatrix, pts, aaMode, style); 1291 return GrDashingEffect::CreateDashLineBatch(color, viewMatrix, pts, aaMode, style);
1293 } 1292 }
1294 1293
1295 #endif 1294 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698