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