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