| OLD | NEW |
| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const GrDrawTargetCaps&,
\ | 142 const GrDrawTargetCaps&,
\ |
| 143 GrTexture* dummyTextures[2]) | 143 GrTexture* dummyTextures[2]) |
| 144 | 144 |
| 145 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
\ | 145 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
\ |
| 146 static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory SK_UNUSED;
\ | 146 static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory SK_UNUSED;
\ |
| 147 static GrFragmentProcessor* TestCreate(SkRandom*,
\ | 147 static GrFragmentProcessor* TestCreate(SkRandom*,
\ |
| 148 GrContext*,
\ | 148 GrContext*,
\ |
| 149 const GrDrawTargetCaps&,
\ | 149 const GrDrawTargetCaps&,
\ |
| 150 GrTexture* dummyTextures[2]) | 150 GrTexture* dummyTextures[2]) |
| 151 | 151 |
| 152 #define GR_DECLARE_XP_FACTORY_TEST
\ | |
| 153 static GrProcessorTestFactory<GrXPFactory> gTestFactory SK_UNUSED;
\ | |
| 154 static GrXPFactory* TestCreate(SkRandom*,
\ | |
| 155 GrContext*,
\ | |
| 156 const GrDrawTargetCaps&,
\ | |
| 157 GrTexture* dummyTextures[2]) | |
| 158 | |
| 159 | |
| 160 /** GrProcessor subclasses should insert this macro in their implementation file
. They must then | 152 /** GrProcessor subclasses should insert this macro in their implementation file
. They must then |
| 161 * also implement this static function: | 153 * also implement this static function: |
| 162 * GrProcessor* TestCreate(SkRandom*, | 154 * GrProcessor* TestCreate(SkRandom*, |
| 163 * GrContext*, | 155 * GrContext*, |
| 164 * const GrDrawTargetCaps&, | 156 * const GrDrawTargetCaps&, |
| 165 * GrTexture* dummyTextures[2]); | 157 * GrTexture* dummyTextures[2]); |
| 166 * dummyTextures[] are valid textures that can optionally be used to construct G
rTextureAccesses. | 158 * dummyTextures[] are valid textures that can optionally be used to construct G
rTextureAccesses. |
| 167 * The first texture has config kSkia8888_GrPixelConfig and the second has | 159 * The first texture has config kSkia8888_GrPixelConfig and the second has |
| 168 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition
al textures using | 160 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition
al textures using |
| 169 * the GrContext. | 161 * the GrContext. |
| 170 */ | 162 */ |
| 171 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect)
\ | 163 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect)
\ |
| 172 GrProcessorTestFactory<GrFragmentProcessor> Effect :: gTestFactory(Effect ::
TestCreate) | 164 GrProcessorTestFactory<GrFragmentProcessor> Effect :: gTestFactory(Effect ::
TestCreate) |
| 173 | 165 |
| 174 #define GR_DEFINE_XP_FACTORY_TEST(Factory)
\ | |
| 175 GrProcessorTestFactory<GrXPFactory> Factory :: gTestFactory(Factory :: TestC
reate) | |
| 176 | |
| 177 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect)
\ | 166 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect)
\ |
| 178 GrProcessorTestFactory<GrGeometryProcessor> Effect :: gTestFactory(Effect ::
TestCreate) | 167 GrProcessorTestFactory<GrGeometryProcessor> Effect :: gTestFactory(Effect ::
TestCreate) |
| 179 | 168 |
| 180 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 169 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 181 | 170 |
| 182 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that | 171 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that |
| 183 // its definitions will compile. | 172 // its definitions will compile. |
| 184 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
\ | 173 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
\ |
| 185 static GrFragmentProcessor* TestCreate(SkRandom*,
\ | 174 static GrFragmentProcessor* TestCreate(SkRandom*,
\ |
| 186 GrContext*,
\ | 175 GrContext*,
\ |
| 187 const GrDrawTargetCaps&,
\ | 176 const GrDrawTargetCaps&,
\ |
| 188 GrTexture* dummyTextures[2]) | 177 GrTexture* dummyTextures[2]) |
| 189 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X) | 178 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X) |
| 190 | 179 |
| 191 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that | 180 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that |
| 192 // its definitions will compile. | 181 // its definitions will compile. |
| 193 #define GR_DECLARE_XP_FACTORY_TEST
\ | |
| 194 static GrXPFactory* TestCreate(SkRandom*,
\ | |
| 195 GrContext*,
\ | |
| 196 const GrDrawTargetCaps&,
\ | |
| 197 GrTexture* dummyTextures[2]) | |
| 198 #define GR_DEFINE_XP_FACTORY_TEST(X) | |
| 199 | |
| 200 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that | |
| 201 // its definitions will compile. | |
| 202 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST
\ | 182 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST
\ |
| 203 static GrGeometryProcessor* TestCreate(SkRandom*,
\ | 183 static GrGeometryProcessor* TestCreate(SkRandom*,
\ |
| 204 GrContext*,
\ | 184 GrContext*,
\ |
| 205 const GrDrawTargetCaps&,
\ | 185 const GrDrawTargetCaps&,
\ |
| 206 GrTexture* dummyTextures[2]) | 186 GrTexture* dummyTextures[2]) |
| 207 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X) | 187 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X) |
| 208 | 188 |
| 209 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 189 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 210 #endif | 190 #endif |
| OLD | NEW |