| 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 "GrInvariantOutput.h" |
| 10 #include "GrTBackendProcessorFactory.h" | 11 #include "GrTBackendProcessorFactory.h" |
| 11 #include "GrSimpleTextureEffect.h" | 12 #include "GrSimpleTextureEffect.h" |
| 12 #include "gl/GrGLProcessor.h" | 13 #include "gl/GrGLProcessor.h" |
| 13 #include "gl/builders/GrGLProgramBuilder.h" | 14 #include "gl/builders/GrGLProgramBuilder.h" |
| 14 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
| 15 | 16 |
| 16 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { | 17 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { |
| 17 public: | 18 public: |
| 18 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory, | 19 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory, |
| 19 const GrProcessor& processor) | 20 const GrProcessor& processor) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const GrBackendFragmentProcessorFactory& GrConfigConversionEffect::getFactory()
const { | 119 const GrBackendFragmentProcessorFactory& GrConfigConversionEffect::getFactory()
const { |
| 119 return GrTBackendFragmentProcessorFactory<GrConfigConversionEffect>::getInst
ance(); | 120 return GrTBackendFragmentProcessorFactory<GrConfigConversionEffect>::getInst
ance(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const { | 123 bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const { |
| 123 const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>(); | 124 const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>(); |
| 124 return other.fSwapRedAndBlue == fSwapRedAndBlue && | 125 return other.fSwapRedAndBlue == fSwapRedAndBlue && |
| 125 other.fPMConversion == fPMConversion; | 126 other.fPMConversion == fPMConversion; |
| 126 } | 127 } |
| 127 | 128 |
| 128 void GrConfigConversionEffect::onComputeInvariantOutput(InvariantOutput* inout)
const { | 129 void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout
) const { |
| 129 this->updateInvariantOutputForModulation(inout); | 130 this->updateInvariantOutputForModulation(inout); |
| 130 } | 131 } |
| 131 | 132 |
| 132 /////////////////////////////////////////////////////////////////////////////// | 133 /////////////////////////////////////////////////////////////////////////////// |
| 133 | 134 |
| 134 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); | 135 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); |
| 135 | 136 |
| 136 GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random, | 137 GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random, |
| 137 GrContext*, | 138 GrContext*, |
| 138 const GrDrawTargetCaps
&, | 139 const GrDrawTargetCaps
&, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 kNone_PMConversion != pmConversion) { | 275 kNone_PMConversion != pmConversion) { |
| 275 // The PM conversions assume colors are 0..255 | 276 // The PM conversions assume colors are 0..255 |
| 276 return NULL; | 277 return NULL; |
| 277 } | 278 } |
| 278 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 279 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
| 279 swapRedAndBlue, | 280 swapRedAndBlue, |
| 280 pmConversion, | 281 pmConversion, |
| 281 matrix)); | 282 matrix)); |
| 282 } | 283 } |
| 283 } | 284 } |
| OLD | NEW |