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 "GrConfigConversionEffect.h" | 8 #include "GrConfigConversionEffect.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout
) const { | 123 void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout
) const { |
124 this->updateInvariantOutputForModulation(inout); | 124 this->updateInvariantOutputForModulation(inout); |
125 } | 125 } |
126 | 126 |
127 /////////////////////////////////////////////////////////////////////////////// | 127 /////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
129 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); | 129 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); |
130 | 130 |
131 GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random, | 131 GrFragmentProcessor* GrConfigConversionEffect::TestCreate(GrProcessorTestData* d
) { |
132 GrContext*, | 132 PMConversion pmConv = static_cast<PMConversion>(d->fRandom->nextULessThan(kP
MConversionCnt)); |
133 const GrCaps&, | |
134 GrTexture* textures[])
{ | |
135 PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMCon
versionCnt)); | |
136 bool swapRB; | 133 bool swapRB; |
137 if (kNone_PMConversion == pmConv) { | 134 if (kNone_PMConversion == pmConv) { |
138 swapRB = true; | 135 swapRB = true; |
139 } else { | 136 } else { |
140 swapRB = random->nextBool(); | 137 swapRB = d->fRandom->nextBool(); |
141 } | 138 } |
142 return SkNEW_ARGS(GrConfigConversionEffect, | 139 return SkNEW_ARGS(GrConfigConversionEffect, |
143 (textures[GrProcessorUnitTest::kSkiaPMText
ureIdx], | 140 (d->fTextures[GrProcessorUnitTest::kSkiaPM
TextureIdx], |
144 swapRB, | 141 swapRB, |
145 pmConv, | 142 pmConv, |
146 GrTest::TestMatrix(random))); | 143 GrTest::TestMatrix(d->fRandom))); |
147 } | 144 } |
148 | 145 |
149 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
150 | 147 |
151 void GrConfigConversionEffect::getGLProcessorKey(const GrGLSLCaps& caps, | 148 void GrConfigConversionEffect::getGLProcessorKey(const GrGLSLCaps& caps, |
152 GrProcessorKeyBuilder* b) const
{ | 149 GrProcessorKeyBuilder* b) const
{ |
153 GrGLConfigConversionEffect::GenKey(*this, caps, b); | 150 GrGLConfigConversionEffect::GenKey(*this, caps, b); |
154 } | 151 } |
155 | 152 |
156 GrGLFragmentProcessor* GrConfigConversionEffect::createGLInstance() const { | 153 GrGLFragmentProcessor* GrConfigConversionEffect::createGLInstance() const { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 kNone_PMConversion != pmConversion) { | 292 kNone_PMConversion != pmConversion) { |
296 // The PM conversions assume colors are 0..255 | 293 // The PM conversions assume colors are 0..255 |
297 return NULL; | 294 return NULL; |
298 } | 295 } |
299 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 296 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
300 swapRedAndBlue, | 297 swapRedAndBlue, |
301 pmConversion, | 298 pmConversion, |
302 matrix)); | 299 matrix)); |
303 } | 300 } |
304 } | 301 } |
OLD | NEW |