Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: src/gpu/effects/GrYUVEffect.cpp

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrYUVEffect.h" 8 #include "GrYUVEffect.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 GrGLSLProgramDataManager::UniformHandle fMatrixUni; 145 GrGLSLProgramDataManager::UniformHandle fMatrixUni;
146 146
147 typedef GrGLSLFragmentProcessor INHERITED; 147 typedef GrGLSLFragmentProcessor INHERITED;
148 }; 148 };
149 149
150 private: 150 private:
151 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture , 151 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture ,
152 const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFi lterMode, 152 const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFi lterMode,
153 SkYUVColorSpace colorSpace, bool nv12) 153 SkYUVColorSpace colorSpace, bool nv12)
154 : fYTransform(kLocal_GrCoordSet, yuvMatrix[0], yTexture, GrTextureParams ::kNone_FilterMode) 154 : fYTransform(kLocal_GrCoordSet, yuvMatrix[0], yTexture, GrTextureParams ::kNone_FilterMode)
155 , fYAccess(yTexture) 155 , fYAccess(yTexture, nullptr)
156 , fUTransform(kLocal_GrCoordSet, yuvMatrix[1], uTexture, uvFilterMode) 156 , fUTransform(kLocal_GrCoordSet, yuvMatrix[1], uTexture, uvFilterMode)
157 , fUAccess(uTexture, uvFilterMode) 157 , fUAccess(uTexture, nullptr, uvFilterMode)
158 , fVAccess(vTexture, uvFilterMode) 158 , fVAccess(vTexture, nullptr, uvFilterMode)
159 , fColorSpace(colorSpace) 159 , fColorSpace(colorSpace)
160 , fNV12(nv12) { 160 , fNV12(nv12) {
161 this->initClassID<YUVtoRGBEffect>(); 161 this->initClassID<YUVtoRGBEffect>();
162 this->addCoordTransform(&fYTransform); 162 this->addCoordTransform(&fYTransform);
163 this->addTextureAccess(&fYAccess); 163 this->addTextureAccess(&fYAccess);
164 this->addCoordTransform(&fUTransform); 164 this->addCoordTransform(&fUTransform);
165 this->addTextureAccess(&fUAccess); 165 this->addTextureAccess(&fUAccess);
166 if (!fNV12) { 166 if (!fNV12) {
167 fVTransform = GrCoordTransform(kLocal_GrCoordSet, yuvMatrix[2], vTex ture, uvFilterMode); 167 fVTransform = GrCoordTransform(kLocal_GrCoordSet, yuvMatrix[2], vTex ture, uvFilterMode);
168 this->addCoordTransform(&fVTransform); 168 this->addCoordTransform(&fVTransform);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return sk_sp<GrFragmentProcessor>( 395 return sk_sp<GrFragmentProcessor>(
396 new RGBToYUVEffect(std::move(rgbFP), colorSpace, RGBToYUVEffect::kU_Outp utChannels)); 396 new RGBToYUVEffect(std::move(rgbFP), colorSpace, RGBToYUVEffect::kU_Outp utChannels));
397 } 397 }
398 398
399 sk_sp<GrFragmentProcessor> 399 sk_sp<GrFragmentProcessor>
400 GrYUVEffect::MakeRGBToV(sk_sp<GrFragmentProcessor> rgbFP, SkYUVColorSpace colorS pace) { 400 GrYUVEffect::MakeRGBToV(sk_sp<GrFragmentProcessor> rgbFP, SkYUVColorSpace colorS pace) {
401 SkASSERT(rgbFP); 401 SkASSERT(rgbFP);
402 return sk_sp<GrFragmentProcessor>( 402 return sk_sp<GrFragmentProcessor>(
403 new RGBToYUVEffect(std::move(rgbFP), colorSpace, RGBToYUVEffect::kV_Outp utChannels)); 403 new RGBToYUVEffect(std::move(rgbFP), colorSpace, RGBToYUVEffect::kV_Outp utChannels));
404 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698