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

Side by Side Diff: include/gpu/GrProcessorUnitTest.h

Issue 1338403003: Revert of Test that GrFragmentProcessors work without input colors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « no previous file | src/gpu/effects/GrExtractAlphaFragmentProcessor.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 2012 Google Inc. 2 * Copyright 2012 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 #ifndef GrProcessorUnitTest_DEFINED 8 #ifndef GrProcessorUnitTest_DEFINED
9 #define GrProcessorUnitTest_DEFINED 9 #define GrProcessorUnitTest_DEFINED
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 class GrProcessorTestFactory : SkNoncopyable { 61 class GrProcessorTestFactory : SkNoncopyable {
62 public: 62 public:
63 63
64 typedef const Processor* (*CreateProc)(GrProcessorTestData*); 64 typedef const Processor* (*CreateProc)(GrProcessorTestData*);
65 65
66 GrProcessorTestFactory(CreateProc createProc) { 66 GrProcessorTestFactory(CreateProc createProc) {
67 fCreateProc = createProc; 67 fCreateProc = createProc;
68 GetFactories()->push_back(this); 68 GetFactories()->push_back(this);
69 } 69 }
70 70
71 /** Pick a random factory function and create a processor. */ 71 static const Processor* CreateStage(GrProcessorTestData* data) {
72 static const Processor* Create(GrProcessorTestData* data) {
73 VerifyFactoryCount(); 72 VerifyFactoryCount();
74 SkASSERT(GetFactories()->count()); 73 SkASSERT(GetFactories()->count());
75 uint32_t idx = data->fRandom->nextRangeU(0, GetFactories()->count() - 1) ; 74 uint32_t idx = data->fRandom->nextRangeU(0, GetFactories()->count() - 1) ;
76 return CreateIdx(idx, data);
77 }
78
79 /** Number of registered factory functions */
80 static int Count() { return GetFactories()->count(); }
81
82 /** Use factory function at Index idx to create a processor. */
83 static const Processor* CreateIdx(int idx, GrProcessorTestData* data) {
84 GrProcessorTestFactory<Processor>* factory = (*GetFactories())[idx]; 75 GrProcessorTestFactory<Processor>* factory = (*GetFactories())[idx];
85 return factory->fCreateProc(data); 76 return factory->fCreateProc(data);
86 } 77 }
87 78
88 /* 79 /*
89 * A test function which verifies the count of factories. 80 * A test function which verifies the count of factories.
90 */ 81 */
91 static void VerifyFactoryCount(); 82 static void VerifyFactoryCount();
92 83
93 private: 84 private:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #define GR_DEFINE_XP_FACTORY_TEST(X) 131 #define GR_DEFINE_XP_FACTORY_TEST(X)
141 132
142 // The unit test relies on static initializers. Just declare the TestCreate func tion so that 133 // The unit test relies on static initializers. Just declare the TestCreate func tion so that
143 // its definitions will compile. 134 // its definitions will compile.
144 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \ 135 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
145 static const GrGeometryProcessor* TestCreate(GrProcessorTestData*) 136 static const GrGeometryProcessor* TestCreate(GrProcessorTestData*)
146 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X) 137 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X)
147 138
148 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 139 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
149 #endif 140 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698