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 GrEffectUnitTest_DEFINED | 8 #ifndef GrEffectUnitTest_DEFINED |
9 #define GrEffectUnitTest_DEFINED | 9 #define GrEffectUnitTest_DEFINED |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 private: | 60 private: |
61 CreateProc fCreateProc; | 61 CreateProc fCreateProc; |
62 static SkTArray<GrEffectTestFactory*, true>* GetFactories(); | 62 static SkTArray<GrEffectTestFactory*, true>* GetFactories(); |
63 }; | 63 }; |
64 | 64 |
65 /** GrEffect subclasses should insert this macro in their declaration to be incl
uded in the | 65 /** GrEffect subclasses should insert this macro in their declaration to be incl
uded in the |
66 * program generation unit test. | 66 * program generation unit test. |
67 */ | 67 */ |
68 #define GR_DECLARE_EFFECT_TEST
\ | 68 #define GR_DECLARE_EFFECT_TEST
\ |
69 static GrEffectTestFactory gTestFactory;
\ | 69 static GrEffectTestFactory gTestFactory;
\ |
70 static GrEffectRef* TestCreate(SkRandom*,
\ | 70 static GrEffectRef* TestCreate(SkRandom*,
\ |
71 GrContext*,
\ | 71 GrContext*,
\ |
72 const GrDrawTargetCaps&,
\ | 72 const GrDrawTargetCaps&,
\ |
73 GrTexture* dummyTextures[2]) | 73 GrTexture* dummyTextures[2]) |
74 | 74 |
75 /** GrEffect subclasses should insert this macro in their implementation file. T
hey must then | 75 /** GrEffect subclasses should insert this macro in their implementation file. T
hey must then |
76 * also implement this static function: | 76 * also implement this static function: |
77 * GrEffect* TestCreate(SkRandom*, | 77 * GrEffect* TestCreate(SkRandom*, |
78 * GrContext*, | 78 * GrContext*, |
79 * const GrDrawTargetCaps&, | 79 * const GrDrawTargetCaps&, |
80 * GrTexture* dummyTextures[2]); | 80 * GrTexture* dummyTextures[2]); |
81 * dummyTextures[] are valid textures that can optionally be used to construct G
rTextureAccesses. | 81 * dummyTextures[] are valid textures that can optionally be used to construct G
rTextureAccesses. |
82 * The first texture has config kSkia8888_GrPixelConfig and the second has | 82 * The first texture has config kSkia8888_GrPixelConfig and the second has |
83 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition
al textures using | 83 * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create addition
al textures using |
84 * the GrContext. | 84 * the GrContext. |
85 */ | 85 */ |
86 #define GR_DEFINE_EFFECT_TEST(Effect)
\ | 86 #define GR_DEFINE_EFFECT_TEST(Effect)
\ |
87 GrEffectTestFactory Effect :: gTestFactory(Effect :: TestCreate) | 87 GrEffectTestFactory Effect :: gTestFactory(Effect :: TestCreate) |
88 | 88 |
89 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 89 #else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
90 | 90 |
91 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that | 91 // The unit test relies on static initializers. Just declare the TestCreate func
tion so that |
92 // its definitions will compile. | 92 // its definitions will compile. |
93 #define GR_DECLARE_EFFECT_TEST
\ | 93 #define GR_DECLARE_EFFECT_TEST
\ |
94 static GrEffectRef* TestCreate(SkRandom*,
\ | 94 static GrEffectRef* TestCreate(SkRandom*,
\ |
95 GrContext*,
\ | 95 GrContext*,
\ |
96 const GrDrawTargetCaps&,
\ | 96 const GrDrawTargetCaps&,
\ |
97 GrTexture* dummyTextures[2]) | 97 GrTexture* dummyTextures[2]) |
98 #define GR_DEFINE_EFFECT_TEST(X) | 98 #define GR_DEFINE_EFFECT_TEST(X) |
99 | 99 |
100 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 100 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
101 #endif | 101 #endif |
OLD | NEW |