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

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

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrYUVtoRGBEffect.h" 9 #include "GrYUVtoRGBEffect.h"
10 10
(...skipping 10 matching lines...) Expand all
21 GrTexture* vTexture, SkYUVColorSpace colo rSpace) { 21 GrTexture* vTexture, SkYUVColorSpace colo rSpace) {
22 return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSp ace)); 22 return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSp ace));
23 } 23 }
24 24
25 static const char* Name() { return "YUV to RGB"; } 25 static const char* Name() { return "YUV to RGB"; }
26 26
27 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE { 27 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE {
28 return GrTBackendFragmentProcessorFactory<YUVtoRGBEffect>::getInstance() ; 28 return GrTBackendFragmentProcessorFactory<YUVtoRGBEffect>::getInstance() ;
29 } 29 }
30 30
31 virtual void getConstantColorComponents(GrColor* color,
32 uint32_t* validFlags) const SK_OVERR IDE {
33 // YUV is opaque
34 *color = 0xFF;
35 *validFlags = kA_GrColorComponentFlag;
36 }
37
31 SkYUVColorSpace getColorSpace() const { 38 SkYUVColorSpace getColorSpace() const {
32 return fColorSpace; 39 return fColorSpace;
33 } 40 }
34 41
35 class GLProcessor : public GrGLFragmentProcessor { 42 class GLProcessor : public GrGLFragmentProcessor {
36 public: 43 public:
37 static const GrGLfloat kJPEGConversionMatrix[16]; 44 static const GrGLfloat kJPEGConversionMatrix[16];
38 static const GrGLfloat kRec601ConversionMatrix[16]; 45 static const GrGLfloat kRec601ConversionMatrix[16];
39 46
40 // this class always generates the same code. 47 // this class always generates the same code.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 110 }
104 111
105 virtual bool onIsEqual(const GrProcessor& sBase) const { 112 virtual bool onIsEqual(const GrProcessor& sBase) const {
106 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); 113 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>();
107 return fYAccess.getTexture() == s.fYAccess.getTexture() && 114 return fYAccess.getTexture() == s.fYAccess.getTexture() &&
108 fUAccess.getTexture() == s.fUAccess.getTexture() && 115 fUAccess.getTexture() == s.fUAccess.getTexture() &&
109 fVAccess.getTexture() == s.fVAccess.getTexture() && 116 fVAccess.getTexture() == s.fVAccess.getTexture() &&
110 fColorSpace == s.getColorSpace(); 117 fColorSpace == s.getColorSpace();
111 } 118 }
112 119
113 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE {
114 // YUV is opaque
115 inout->fColor = 0xFF;
116 inout->fValidFlags = kA_GrColorComponentFlag;
117 inout->fIsSingleComponent = false;
118 }
119
120 GrCoordTransform fCoordTransform; 120 GrCoordTransform fCoordTransform;
121 GrTextureAccess fYAccess; 121 GrTextureAccess fYAccess;
122 GrTextureAccess fUAccess; 122 GrTextureAccess fUAccess;
123 GrTextureAccess fVAccess; 123 GrTextureAccess fVAccess;
124 SkYUVColorSpace fColorSpace; 124 SkYUVColorSpace fColorSpace;
125 125
126 typedef GrFragmentProcessor INHERITED; 126 typedef GrFragmentProcessor INHERITED;
127 }; 127 };
128 128
129 const GrGLfloat YUVtoRGBEffect::GLProcessor::kJPEGConversionMatrix[16] = { 129 const GrGLfloat YUVtoRGBEffect::GLProcessor::kJPEGConversionMatrix[16] = {
130 1.0f, 0.0f, 1.402f, -0.701f, 130 1.0f, 0.0f, 1.402f, -0.701f,
131 1.0f, -0.34414f, -0.71414f, 0.529f, 131 1.0f, -0.34414f, -0.71414f, 0.529f,
132 1.0f, 1.772f, 0.0f, -0.886f, 132 1.0f, 1.772f, 0.0f, -0.886f,
133 0.0f, 0.0f, 0.0f, 1.0}; 133 0.0f, 0.0f, 0.0f, 1.0};
134 const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec601ConversionMatrix[16] = { 134 const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec601ConversionMatrix[16] = {
135 1.164f, 0.0f, 1.596f, -0.87075f, 135 1.164f, 0.0f, 1.596f, -0.87075f,
136 1.164f, -0.391f, -0.813f, 0.52925f, 136 1.164f, -0.391f, -0.813f, 0.52925f,
137 1.164f, 2.018f, 0.0f, -1.08175f, 137 1.164f, 2.018f, 0.0f, -1.08175f,
138 0.0f, 0.0f, 0.0f, 1.0}; 138 0.0f, 0.0f, 0.0f, 1.0};
139 } 139 }
140 140
141 ////////////////////////////////////////////////////////////////////////////// 141 //////////////////////////////////////////////////////////////////////////////
142 142
143 GrFragmentProcessor* 143 GrFragmentProcessor*
144 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT exture, 144 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT exture,
145 SkYUVColorSpace colorSpace) { 145 SkYUVColorSpace colorSpace) {
146 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); 146 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace);
147 } 147 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698