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

Side by Side Diff: src/gpu/glsl/GrGLSLColorSpaceXformHelper.h

Issue 2329553002: Cleanup GPU gamut transformation code (Closed)
Patch Set: Switch from float[16] to SkMatrix44 Created 4 years, 3 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/GrSimpleTextureEffect.cpp ('k') | src/gpu/glsl/GrGLSLProgramDataManager.h » ('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 2016 Google Inc. 2 * Copyright 2016 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 #ifndef GrGLSLColorSpaceXformHelper_DEFINED 8 #ifndef GrGLSLColorSpaceXformHelper_DEFINED
9 #define GrGLSLColorSpaceXformHelper_DEFINED 9 #define GrGLSLColorSpaceXformHelper_DEFINED
10 10
11 #include "GrColorSpaceXform.h" 11 #include "GrColorSpaceXform.h"
12 #include "GrGLSLUniformHandler.h" 12 #include "GrGLSLUniformHandler.h"
13 13
14 /** 14 /**
15 * Stack helper class to assist with using GrColorSpaceXform within an FP's emit Code function. 15 * Stack helper class to assist with using GrColorSpaceXform within an FP's emit Code function.
16 * This injects the uniform declaration, and stores the information needed to ge nerate correct 16 * This injects the uniform declaration, and stores the information needed to ge nerate correct
17 * gamut-transformation shader code. 17 * gamut-transformation shader code.
18 */ 18 */
19 class GrGLSLColorSpaceXformHelper : public SkNoncopyable { 19 class GrGLSLColorSpaceXformHelper : public SkNoncopyable {
20 public: 20 public:
21 GrGLSLColorSpaceXformHelper(GrGLSLUniformHandler* uniformHandler, 21 GrGLSLColorSpaceXformHelper(GrGLSLUniformHandler* uniformHandler,
22 GrColorSpaceXform* colorSpaceXform, 22 GrColorSpaceXform* colorSpaceXform,
23 GrGLSLProgramDataManager::UniformHandle* handle) { 23 GrGLSLProgramDataManager::UniformHandle* handle) {
24 SkASSERT(uniformHandler && handle); 24 SkASSERT(uniformHandler && handle);
25 if (colorSpaceXform) { 25 if (colorSpaceXform) {
26 *handle = uniformHandler->addUniform(kFragment_GrShaderFlag, kMat44f _GrSLType, 26 *handle = uniformHandler->addUniform(kFragment_GrShaderFlag, kMat44f _GrSLType,
27 kDefault_GrSLPrecision, "ColorX form", 27 kDefault_GrSLPrecision, "ColorX form",
28 &fXformMatrix); 28 &fXformMatrix);
29 fAlphaType = colorSpaceXform->alphaType();
30 } else { 29 } else {
31 fXformMatrix = nullptr; 30 fXformMatrix = nullptr;
32 } 31 }
33 } 32 }
34 33
35 const char* getXformMatrix() const { return fXformMatrix; } 34 const char* getXformMatrix() const { return fXformMatrix; }
36 SkAlphaType alphaType() const { return fAlphaType; }
37 35
38 private: 36 private:
39 const char* fXformMatrix; 37 const char* fXformMatrix;
40 SkAlphaType fAlphaType;
41 }; 38 };
42 39
43 #endif 40 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrSimpleTextureEffect.cpp ('k') | src/gpu/glsl/GrGLSLProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698