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

Unified Diff: src/gpu/glsl/GrGLSLShaderBuilder.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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/glsl/GrGLSLShaderBuilder.h
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
index ea36a56a7ad55e624288987e43efc5703e6d0358..a6ff96dd1b08e52540b96bc0507a33da62c3fd1f 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -15,6 +15,8 @@
#include <stdarg.h>
+class GrGLSLColorSpaceXformHelper;
+
/**
base class for all shaders builders
*/
@@ -37,7 +39,8 @@ public:
/** Version of above that appends the result to the shader code instead.*/
void appendTextureLookup(SamplerHandle,
const char* coordName,
- GrSLType coordType = kVec2f_GrSLType);
+ GrSLType coordType = kVec2f_GrSLType,
+ GrGLSLColorSpaceXformHelper* colorXformHelper = nullptr);
/** Does the work of appendTextureLookup and modulates the result by modulation. The result is
@@ -47,7 +50,18 @@ public:
void appendTextureLookupAndModulate(const char* modulation,
SamplerHandle,
const char* coordName,
- GrSLType coordType = kVec2f_GrSLType);
+ GrSLType coordType = kVec2f_GrSLType,
+ GrGLSLColorSpaceXformHelper* colorXformHelper = nullptr);
+
+ /** Adds a helper function to facilitate color gamut transformation, and produces code that
+ returns the srcColor transformed into a new gamut (via multiplication by the xform from
+ colorXformHelper). Premultiplied sources are also handled correctly (colorXformHelper
+ determines if the source is premultipled or not). */
+ void appendColorGamutXform(SkString* out, const char* srcColor,
+ GrGLSLColorSpaceXformHelper* colorXformHelper);
+
+ /** Version of above that appends the result to the shader code instead. */
+ void appendColorGamutXform(const char* srcColor, GrGLSLColorSpaceXformHelper* colorXformHelper);
/** Fetches an unfiltered texel from a sampler at integer coordinates. coordExpr must match the
dimensionality of the sampler and must be within the sampler's range. coordExpr is emitted

Powered by Google App Engine
This is Rietveld 408576698