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

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

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDisableColorXP.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 "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 , fAAMode(aaMode) { 950 , fAAMode(aaMode) {
951 this->initClassID<DashingCircleEffect>(); 951 this->initClassID<DashingCircleEffect>();
952 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 952 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType));
953 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType)); 953 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType));
954 fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", 954 fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams",
955 kVec2f_GrVertexAttribType )); 955 kVec2f_GrVertexAttribType ));
956 } 956 }
957 957
958 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); 958 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
959 959
960 GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random, 960 GrGeometryProcessor* DashingCircleEffect::TestCreate(GrProcessorTestData* d) {
961 GrContext*, 961 DashAAMode aaMode = static_cast<DashAAMode>(d->fRandom->nextULessThan(kDashA AModeCount));
962 const GrCaps& caps, 962 return DashingCircleEffect::Create(GrRandomColor(d->fRandom),
963 GrTexture*[]) { 963 aaMode, GrTest::TestMatrix(d->fRandom),
964 DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAMod eCount)); 964 d->fRandom->nextBool());
965 return DashingCircleEffect::Create(GrRandomColor(random),
966 aaMode, GrTest::TestMatrix(random),
967 random->nextBool());
968 } 965 }
969 966
970 ////////////////////////////////////////////////////////////////////////////// 967 //////////////////////////////////////////////////////////////////////////////
971 968
972 class GLDashingLineEffect; 969 class GLDashingLineEffect;
973 970
974 /* 971 /*
975 * This effect will draw a dashed line. The width of the dash is given by the st rokeWidth and the 972 * This effect will draw a dashed line. The width of the dash is given by the st rokeWidth and the
976 * length and spacing by the DashInfo. Both of the previous two parameters are i n device space. 973 * length and spacing by the DashInfo. Both of the previous two parameters are i n device space.
977 * This effect also requires the setting of a vec2 vertex attribute for the the four corners of the 974 * This effect also requires the setting of a vec2 vertex attribute for the the four corners of the
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 , fUsesLocalCoords(usesLocalCoords) 1185 , fUsesLocalCoords(usesLocalCoords)
1189 , fAAMode(aaMode) { 1186 , fAAMode(aaMode) {
1190 this->initClassID<DashingLineEffect>(); 1187 this->initClassID<DashingLineEffect>();
1191 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 1188 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType));
1192 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType)); 1189 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe rtexAttribType));
1193 fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt tribType)); 1190 fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt tribType));
1194 } 1191 }
1195 1192
1196 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); 1193 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
1197 1194
1198 GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random, 1195 GrGeometryProcessor* DashingLineEffect::TestCreate(GrProcessorTestData* d) {
1199 GrContext*, 1196 DashAAMode aaMode = static_cast<DashAAMode>(d->fRandom->nextULessThan(kDashA AModeCount));
1200 const GrCaps& caps, 1197 return DashingLineEffect::Create(GrRandomColor(d->fRandom),
1201 GrTexture*[]) { 1198 aaMode, GrTest::TestMatrix(d->fRandom),
1202 DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAMod eCount)); 1199 d->fRandom->nextBool());
1203 return DashingLineEffect::Create(GrRandomColor(random),
1204 aaMode, GrTest::TestMatrix(random), random- >nextBool());
1205 } 1200 }
1206 1201
1207 ////////////////////////////////////////////////////////////////////////////// 1202 //////////////////////////////////////////////////////////////////////////////
1208 1203
1209 static GrGeometryProcessor* create_dash_gp(GrColor color, 1204 static GrGeometryProcessor* create_dash_gp(GrColor color,
1210 DashAAMode dashAAMode, 1205 DashAAMode dashAAMode,
1211 DashCap cap, 1206 DashCap cap,
1212 const SkMatrix& localMatrix, 1207 const SkMatrix& localMatrix,
1213 bool usesLocalCoords) { 1208 bool usesLocalCoords) {
1214 switch (cap) { 1209 switch (cap) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 info.fIntervals = intervals; 1290 info.fIntervals = intervals;
1296 info.fCount = 2; 1291 info.fCount = 2;
1297 info.fPhase = phase; 1292 info.fPhase = phase;
1298 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); 1293 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info);
1299 SkASSERT(success); 1294 SkASSERT(success);
1300 1295
1301 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); 1296 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT);
1302 } 1297 }
1303 1298
1304 #endif 1299 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDisableColorXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698