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

Unified Diff: src/gpu/glsl/GrGLSLColorSpaceXformHelper.h

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More progress & refactoring 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | src/image/SkImageShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
diff --git a/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h b/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
new file mode 100644
index 0000000000000000000000000000000000000000..940be571260f51969ed1576ace6feb56db259e1e
--- /dev/null
+++ b/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrGLSLColorSpaceXformHelper_DEFINED
+#define GrGLSLColorSpaceXformHelper_DEFINED
+
+#include "GrGLSLUniformHandler.h"
+
+class GrColorSpaceXform;
+
+/**
+ * Stack helper class to assist with using GrColorSpaceXform within an FP's emitCode function.
+ */
+class GrGLSLColorSpaceXformHelper : public SkNoncopyable {
+public:
+ GrGLSLColorSpaceXformHelper(GrGLSLUniformHandler* uniformHandler,
+ GrColorSpaceXform* colorSpaceXform,
+ GrGLSLProgramDataManager::UniformHandle* handle) {
+ SkASSERT(uniformHandler && handle);
+ if (colorSpaceXform) {
+ *handle = uniformHandler->addUniform(kFragment_GrShaderFlag, kMat44f_GrSLType,
+ kDefault_GrSLPrecision, "ColorXform",
+ &fXformMatrix);
+ } else {
+ fXformMatrix = nullptr;
+ }
+ }
+
+ const char* getXformMatrix() const { return fXformMatrix; }
+
+private:
+ const char* fXformMatrix;
+};
+
+#endif
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | src/image/SkImageShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698