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

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

Issue 2180803005: Add color gamut xform helpers to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@xform-storage
Patch Set: Rebase 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
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 "GrGLSLUniformHandler.h" 12 #include "GrGLSLUniformHandler.h"
12 13
13 class GrColorSpaceXform;
14
15 /** 14 /**
16 * 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
17 * gamut-transformation shader code.
17 */ 18 */
18 class GrGLSLColorSpaceXformHelper : public SkNoncopyable { 19 class GrGLSLColorSpaceXformHelper : public SkNoncopyable {
19 public: 20 public:
20 GrGLSLColorSpaceXformHelper(GrGLSLUniformHandler* uniformHandler, 21 GrGLSLColorSpaceXformHelper(GrGLSLUniformHandler* uniformHandler,
21 GrColorSpaceXform* colorSpaceXform, 22 GrColorSpaceXform* colorSpaceXform,
22 GrGLSLProgramDataManager::UniformHandle* handle) { 23 GrGLSLProgramDataManager::UniformHandle* handle) {
23 SkASSERT(uniformHandler && handle); 24 SkASSERT(uniformHandler && handle);
24 if (colorSpaceXform) { 25 if (colorSpaceXform) {
25 *handle = uniformHandler->addUniform(kFragment_GrShaderFlag, kMat44f _GrSLType, 26 *handle = uniformHandler->addUniform(kFragment_GrShaderFlag, kMat44f _GrSLType,
26 kDefault_GrSLPrecision, "ColorX form", 27 kDefault_GrSLPrecision, "ColorX form",
27 &fXformMatrix); 28 &fXformMatrix);
29 fAlphaType = colorSpaceXform->alphaType();
28 } else { 30 } else {
29 fXformMatrix = nullptr; 31 fXformMatrix = nullptr;
30 } 32 }
31 } 33 }
32 34
33 const char* getXformMatrix() const { return fXformMatrix; } 35 const char* getXformMatrix() const { return fXformMatrix; }
36 SkAlphaType alphaType() const { return fAlphaType; }
34 37
35 private: 38 private:
36 const char* fXformMatrix; 39 const char* fXformMatrix;
40 SkAlphaType fAlphaType;
37 }; 41 };
38 42
39 #endif 43 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698