| 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 |
| 11 #include "GrCoordTransform.h" | 11 #include "GrCoordTransform.h" |
| 12 #include "GrInvariantOutput.h" |
| 12 #include "GrProcessor.h" | 13 #include "GrProcessor.h" |
| 13 #include "gl/GrGLProcessor.h" | 14 #include "gl/GrGLProcessor.h" |
| 14 #include "GrTBackendProcessorFactory.h" | 15 #include "GrTBackendProcessorFactory.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 class YUVtoRGBEffect : public GrFragmentProcessor { | 19 class YUVtoRGBEffect : public GrFragmentProcessor { |
| 19 public: | 20 public: |
| 20 static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, | 21 static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, |
| 21 GrTexture* vTexture, SkYUVColorSpace colo
rSpace) { | 22 GrTexture* vTexture, SkYUVColorSpace colo
rSpace) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 this->addTextureAccess(&fYAccess); | 100 this->addTextureAccess(&fYAccess); |
| 100 this->addTextureAccess(&fUAccess); | 101 this->addTextureAccess(&fUAccess); |
| 101 this->addTextureAccess(&fVAccess); | 102 this->addTextureAccess(&fVAccess); |
| 102 } | 103 } |
| 103 | 104 |
| 104 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const { | 105 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const { |
| 105 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); | 106 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); |
| 106 return fColorSpace == s.getColorSpace(); | 107 return fColorSpace == s.getColorSpace(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 110 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
| 110 // YUV is opaque | 111 // YUV is opaque |
| 111 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A, | 112 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A, |
| 112 InvariantOutput::kWillNot_ReadInput); | 113 GrInvariantOutput::kWillNot_ReadInput); |
| 113 } | 114 } |
| 114 | 115 |
| 115 GrCoordTransform fCoordTransform; | 116 GrCoordTransform fCoordTransform; |
| 116 GrTextureAccess fYAccess; | 117 GrTextureAccess fYAccess; |
| 117 GrTextureAccess fUAccess; | 118 GrTextureAccess fUAccess; |
| 118 GrTextureAccess fVAccess; | 119 GrTextureAccess fVAccess; |
| 119 SkYUVColorSpace fColorSpace; | 120 SkYUVColorSpace fColorSpace; |
| 120 | 121 |
| 121 typedef GrFragmentProcessor INHERITED; | 122 typedef GrFragmentProcessor INHERITED; |
| 122 }; | 123 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 133 0.0f, 0.0f, 0.0f, 1.0}; | 134 0.0f, 0.0f, 0.0f, 1.0}; |
| 134 } | 135 } |
| 135 | 136 |
| 136 ////////////////////////////////////////////////////////////////////////////// | 137 ////////////////////////////////////////////////////////////////////////////// |
| 137 | 138 |
| 138 GrFragmentProcessor* | 139 GrFragmentProcessor* |
| 139 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, | 140 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, |
| 140 SkYUVColorSpace colorSpace) { | 141 SkYUVColorSpace colorSpace) { |
| 141 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); | 142 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); |
| 142 } | 143 } |
| OLD | NEW |