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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 template<> | 70 template<> |
71 void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() { | 71 void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() { |
72 if (kXPFactoryCount != GetFactories()->count()) { | 72 if (kXPFactoryCount != GetFactories()->count()) { |
73 SkFAIL("Wrong number of xp factory factories!"); | 73 SkFAIL("Wrong number of xp factory factories!"); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 #endif | 77 #endif |
78 | 78 |
79 namespace GrProcessorUnitTest { | |
80 const SkMatrix& TestMatrix(SkRandom* random) { | |
81 static SkMatrix gMatrices[5]; | |
82 static bool gOnce; | |
83 if (!gOnce) { | |
84 gMatrices[0].reset(); | |
85 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); | |
86 gMatrices[2].setRotate(SkIntToScalar(17)); | |
87 gMatrices[3].setRotate(SkIntToScalar(185)); | |
88 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); | |
89 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); | |
90 gMatrices[4].setRotate(SkIntToScalar(215)); | |
91 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); | |
92 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); | |
93 gOnce = true; | |
94 } | |
95 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(
gMatrices)))]; | |
96 } | |
97 } | |
98 | |
99 | 79 |
100 // We use a global pool protected by a mutex(spinlock). Chrome may use the same
GrContext on | 80 // We use a global pool protected by a mutex(spinlock). Chrome may use the same
GrContext on |
101 // different threads. The GrContext is not used concurrently on different thread
s and there is a | 81 // different threads. The GrContext is not used concurrently on different thread
s and there is a |
102 // memory barrier between accesses of a context on different threads. Also, ther
e may be multiple | 82 // memory barrier between accesses of a context on different threads. Also, ther
e may be multiple |
103 // GrContexts and those contexts may be in use concurrently on different threads
. | 83 // GrContexts and those contexts may be in use concurrently on different threads
. |
104 namespace { | 84 namespace { |
105 SK_DECLARE_STATIC_SPINLOCK(gProcessorSpinlock); | 85 SK_DECLARE_STATIC_SPINLOCK(gProcessorSpinlock); |
106 class MemoryPoolAccessor { | 86 class MemoryPoolAccessor { |
107 public: | 87 public: |
108 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); } | 88 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 150 |
171 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ | 151 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ |
172 this->onComputeInvariantOutput(inout); | 152 this->onComputeInvariantOutput(inout); |
173 } | 153 } |
174 | 154 |
175 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 155 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
176 | 156 |
177 // Initial static variable from GrXPFactory | 157 // Initial static variable from GrXPFactory |
178 int32_t GrXPFactory::gCurrXPFClassID = | 158 int32_t GrXPFactory::gCurrXPFClassID = |
179 GrXPFactory::kIllegalXPFClassID; | 159 GrXPFactory::kIllegalXPFClassID; |
OLD | NEW |