| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
| 9 #include "GrYUVtoRGBEffect.h" | 9 #include "GrYUVtoRGBEffect.h" |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 : fCoordTransform(kLocal_GrCoordSet, GrCoordTransform::MakeDivByTextureWHMa
trix(yTexture), | 92 : fCoordTransform(kLocal_GrCoordSet, GrCoordTransform::MakeDivByTextureWHMa
trix(yTexture), |
| 93 yTexture) | 93 yTexture) |
| 94 , fYAccess(yTexture) | 94 , fYAccess(yTexture) |
| 95 , fUAccess(uTexture) | 95 , fUAccess(uTexture) |
| 96 , fVAccess(vTexture) | 96 , fVAccess(vTexture) |
| 97 , fColorSpace(colorSpace) { | 97 , fColorSpace(colorSpace) { |
| 98 this->addCoordTransform(&fCoordTransform); | 98 this->addCoordTransform(&fCoordTransform); |
| 99 this->addTextureAccess(&fYAccess); | 99 this->addTextureAccess(&fYAccess); |
| 100 this->addTextureAccess(&fUAccess); | 100 this->addTextureAccess(&fUAccess); |
| 101 this->addTextureAccess(&fVAccess); | 101 this->addTextureAccess(&fVAccess); |
| 102 this->setWillNotUseInputColor(); | |
| 103 } | 102 } |
| 104 | 103 |
| 105 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const { | 104 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const { |
| 106 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); | 105 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); |
| 107 return fYAccess.getTexture() == s.fYAccess.getTexture() && | 106 return fYAccess.getTexture() == s.fYAccess.getTexture() && |
| 108 fUAccess.getTexture() == s.fUAccess.getTexture() && | 107 fUAccess.getTexture() == s.fUAccess.getTexture() && |
| 109 fVAccess.getTexture() == s.fVAccess.getTexture() && | 108 fVAccess.getTexture() == s.fVAccess.getTexture() && |
| 110 fColorSpace == s.getColorSpace(); | 109 fColorSpace == s.getColorSpace(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 112 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
| 114 // YUV is opaque | 113 // YUV is opaque |
| 115 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A); | 114 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A, |
| 115 InvariantOutput::kWill_ReadInput); |
| 116 } | 116 } |
| 117 | 117 |
| 118 GrCoordTransform fCoordTransform; | 118 GrCoordTransform fCoordTransform; |
| 119 GrTextureAccess fYAccess; | 119 GrTextureAccess fYAccess; |
| 120 GrTextureAccess fUAccess; | 120 GrTextureAccess fUAccess; |
| 121 GrTextureAccess fVAccess; | 121 GrTextureAccess fVAccess; |
| 122 SkYUVColorSpace fColorSpace; | 122 SkYUVColorSpace fColorSpace; |
| 123 | 123 |
| 124 typedef GrFragmentProcessor INHERITED; | 124 typedef GrFragmentProcessor INHERITED; |
| 125 }; | 125 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 136 0.0f, 0.0f, 0.0f, 1.0}; | 136 0.0f, 0.0f, 0.0f, 1.0}; |
| 137 } | 137 } |
| 138 | 138 |
| 139 ////////////////////////////////////////////////////////////////////////////// | 139 ////////////////////////////////////////////////////////////////////////////// |
| 140 | 140 |
| 141 GrFragmentProcessor* | 141 GrFragmentProcessor* |
| 142 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, | 142 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, |
| 143 SkYUVColorSpace colorSpace) { | 143 SkYUVColorSpace colorSpace) { |
| 144 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); | 144 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); |
| 145 } | 145 } |
| OLD | NEW |