Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 const GrDrawTargetCaps&, \ | 81 const GrDrawTargetCaps&, \ |
| 82 GrTexture* dummyTextures[2]) | 82 GrTexture* dummyTextures[2]) |
| 83 | 83 |
| 84 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \ | 84 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \ |
| 85 static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory SK_UNUSED; \ | 85 static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory SK_UNUSED; \ |
| 86 static GrFragmentProcessor* TestCreate(SkRandom*, \ | 86 static GrFragmentProcessor* TestCreate(SkRandom*, \ |
| 87 GrContext*, \ | 87 GrContext*, \ |
| 88 const GrDrawTargetCaps&, \ | 88 const GrDrawTargetCaps&, \ |
| 89 GrTexture* dummyTextures[2]) | 89 GrTexture* dummyTextures[2]) |
| 90 | 90 |
| 91 #define GR_DECLARE_XP_FACTORY_TEST \ | |
| 92 static GrProcessorTestFactory<GrXPFactory> gTestFactory SK_UNUSED; \ | |
| 93 static GrXPFactory* TestCreate(SkRandom*, \ | |
| 94 GrContext*, \ | |
| 95 const GrDrawTargetCaps&, \ | |
| 96 GrTexture* dummyTextures[2]) | |
| 97 | |
| 98 | |
| 91 /** GrProcessor subclasses should insert this macro in their implementation file . They must then | 99 /** GrProcessor subclasses should insert this macro in their implementation file . They must then |
| 92 * also implement this static function: | 100 * also implement this static function: |
| 93 * GrProcessor* TestCreate(SkRandom*, | 101 * GrProcessor* TestCreate(SkRandom*, |
| 94 * GrContext*, | 102 * GrContext*, |
| 95 * const GrDrawTargetCaps&, | 103 * const GrDrawTargetCaps&, |
| 96 * GrTexture* dummyTextures[2]); | 104 * GrTexture* dummyTextures[2]); |
| 97 * dummyTextures[] are valid textures that can optionally be used to construct G rTextureAccesses. | 105 * dummyTextures[] are valid textures that can optionally be used to construct G rTextureAccesses. |
| 98 * The first texture has config kSkia8888_GrPixelConfig and the second has | 106 * The first texture has config kSkia8888_GrPixelConfig and the second has |
| 99 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition al textures using | 107 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition al textures using |
| 100 * the GrContext. | 108 * the GrContext. |
| 101 */ | 109 */ |
| 102 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect) \ | 110 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect) \ |
| 103 GrProcessorTestFactory<GrFragmentProcessor> Effect :: gTestFactory(Effect :: TestCreate) | 111 GrProcessorTestFactory<GrFragmentProcessor> Effect :: gTestFactory(Effect :: TestCreate) |
| 104 | 112 |
| 113 #define GR_DEFINE_XP_FACTORY_TEST(Factory) \ | |
| 114 GrProcessorTestFactory<GrXPFactory> Factory :: gTestFactory(Factory :: TestC reate) | |
| 115 | |
| 105 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect) \ | 116 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect) \ |
| 106 GrProcessorTestFactory<GrGeometryProcessor> Effect :: gTestFactory(Effect :: TestCreate) | 117 GrProcessorTestFactory<GrGeometryProcessor> Effect :: gTestFactory(Effect :: TestCreate) |
| 107 | 118 |
| 108 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 119 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 109 | 120 |
| 110 // The unit test relies on static initializers. Just declare the TestCreate func tion so that | 121 // The unit test relies on static initializers. Just declare the TestCreate func tion so that |
| 111 // its definitions will compile. | 122 // its definitions will compile. |
| 112 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \ | 123 #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \ |
| 113 static GrFragmentProcessor* TestCreate(SkRandom*, \ | 124 static GrFragmentProcessor* TestCreate(SkRandom*, \ |
| 114 GrContext*, \ | 125 GrContext*, \ |
| 115 const GrDrawTargetCaps&, \ | 126 const GrDrawTargetCaps&, \ |
| 116 GrTexture* dummyTextures[2]) | 127 GrTexture* dummyTextures[2]) |
| 117 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X) | 128 #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X) |
| 118 | 129 |
| 119 // The unit test relies on static initializers. Just declare the TestCreate func tion so that | 130 // The unit test relies on static initializers. Just declare the TestCreate func tion so that |
| 120 // its definitions will compile. | 131 // its definitions will compile. |
| 132 #define GR_DECLARE_XP_FACTORY_TEST \ | |
| 133 static GrXPFactory* TestCreate(SkRandom*, \ | |
| 134 GrContext*, \ | |
| 135 const GrDrawTargetCaps&, \ | |
| 136 GrTexture* dummyTextures[2]) | |
|
joshualitt
2014/12/08 19:46:40
alignment
egdaniel
2014/12/09 21:10:46
Done.
| |
| 137 #define GR_DEFINE_XP_FACTORY_TEST(X) | |
| 138 | |
| 139 // The unit test relies on static initializers. Just declare the TestCreate func tion so that | |
| 140 // its definitions will compile. | |
| 121 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \ | 141 #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \ |
| 122 static GrGeometryProcessor* TestCreate(SkRandom*, \ | 142 static GrGeometryProcessor* TestCreate(SkRandom*, \ |
| 123 GrContext*, \ | 143 GrContext*, \ |
| 124 const GrDrawTargetCaps&, \ | 144 const GrDrawTargetCaps&, \ |
| 125 GrTexture* dummyTextures[2]) | 145 GrTexture* dummyTextures[2]) |
| 126 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X) | 146 #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X) |
| 127 | 147 |
| 128 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 148 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 129 #endif | 149 #endif |
| OLD | NEW |