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 #include "GrProcessor.h" | 8 #include "GrProcessor.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 * problems on android. | 25 * problems on android. |
26 */ | 26 */ |
27 template<> | 27 template<> |
28 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>* | 28 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>* |
29 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() { | 29 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() { |
30 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori
es; | 30 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori
es; |
31 return &gFactories; | 31 return &gFactories; |
32 } | 32 } |
33 | 33 |
34 template<> | 34 template<> |
35 SkTArray<GrProcessorTestFactory<GrXPFactory>*, true>* | 35 SkTArray<GrProcessorTestFactory<GrXferProcessor>*, true>* |
36 GrProcessorTestFactory<GrXPFactory>::GetFactories() { | 36 GrProcessorTestFactory<GrXferProcessor>::GetFactories() { |
37 static SkTArray<GrProcessorTestFactory<GrXPFactory>*, true> gFactories; | 37 static SkTArray<GrProcessorTestFactory<GrXferProcessor>*, true> gFactories; |
38 return &gFactories; | 38 return &gFactories; |
39 } | 39 } |
40 | 40 |
41 template<> | 41 template<> |
42 SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true>* | 42 SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true>* |
43 GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() { | 43 GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() { |
44 static SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true> gFactori
es; | 44 static SkTArray<GrProcessorTestFactory<GrGeometryProcessor>*, true> gFactori
es; |
45 return &gFactories; | 45 return &gFactories; |
46 } | 46 } |
47 | 47 |
48 /* | 48 /* |
49 * To ensure we always have successful static initialization, before creating fr
om the factories | 49 * To ensure we always have successful static initialization, before creating fr
om the factories |
50 * we verify the count is as expected. If a new factory is added, then these nu
mbers must be | 50 * we verify the count is as expected. If a new factory is added, then these nu
mbers must be |
51 * manually adjusted. | 51 * manually adjusted. |
52 */ | 52 */ |
53 static const int kFPFactoryCount = 37; | 53 static const int kFPFactoryCount = 37; |
54 static const int kGPFactoryCount = 14; | 54 static const int kGPFactoryCount = 14; |
55 static const int kXPFactoryCount = 1; | 55 static const int kXPFactoryCount = 0; |
56 | 56 |
57 template<> | 57 template<> |
58 void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() { | 58 void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() { |
59 if (kFPFactoryCount != GetFactories()->count()) { | 59 if (kFPFactoryCount != GetFactories()->count()) { |
60 SkFAIL("Wrong number of fragment processor factories!"); | 60 SkFAIL("Wrong number of fragment processor factories!"); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 template<> | 64 template<> |
65 void GrProcessorTestFactory<GrGeometryProcessor>::VerifyFactoryCount() { | 65 void GrProcessorTestFactory<GrGeometryProcessor>::VerifyFactoryCount() { |
66 if (kGPFactoryCount != GetFactories()->count()) { | 66 if (kGPFactoryCount != GetFactories()->count()) { |
67 SkFAIL("Wrong number of geometry processor factories!"); | 67 SkFAIL("Wrong number of geometry processor factories!"); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 template<> | 71 template<> |
72 void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() { | 72 void GrProcessorTestFactory<GrXferProcessor>::VerifyFactoryCount() { |
73 if (kXPFactoryCount != GetFactories()->count()) { | 73 if (kXPFactoryCount != GetFactories()->count()) { |
74 SkFAIL("Wrong number of xp factory factories!"); | 74 SkFAIL("Wrong number of xfer processor factories!"); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 #endif | 78 #endif |
79 | 79 |
80 namespace GrProcessorUnitTest { | 80 namespace GrProcessorUnitTest { |
81 const SkMatrix& TestMatrix(SkRandom* random) { | 81 const SkMatrix& TestMatrix(SkRandom* random) { |
82 static SkMatrix gMatrices[5]; | 82 static SkMatrix gMatrices[5]; |
83 static bool gOnce; | 83 static bool gOnce; |
84 if (!gOnce) { | 84 if (!gOnce) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 void GrGeometryData::operator delete(void* target) { | 187 void GrGeometryData::operator delete(void* target) { |
188 GrProcessor_Globals::GetTLS()->release(target); | 188 GrProcessor_Globals::GetTLS()->release(target); |
189 } | 189 } |
190 | 190 |
191 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 191 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
192 | 192 |
193 // Initial static variable from GrXPFactory | 193 // Initial static variable from GrXPFactory |
194 int32_t GrXPFactory::gCurrXPFClassID = | 194 int32_t GrXPFactory::gCurrXPFClassID = |
195 GrXPFactory::kIllegalXPFClassID; | 195 GrXPFactory::kIllegalXPFClassID; |
196 | 196 |
OLD | NEW |