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

Unified Diff: include/gpu/GrColorSpaceXform.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
« no previous file with comments | « no previous file | src/gpu/GrColorSpaceXform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrColorSpaceXform.h
diff --git a/include/gpu/GrColorSpaceXform.h b/include/gpu/GrColorSpaceXform.h
index 177230c87c8df72656a38df7f2727980f7dffc27..c1fb166f47cce383eb8574a6a672ed4e500326cf 100644
--- a/include/gpu/GrColorSpaceXform.h
+++ b/include/gpu/GrColorSpaceXform.h
@@ -8,6 +8,7 @@
#ifndef GrColorSpaceXform_DEFINED
#define GrColorSpaceXform_DEFINED
+#include "SkImageInfo.h"
#include "SkRefCnt.h"
class SkColorSpace;
@@ -18,15 +19,32 @@ class SkMatrix44;
*/
class GrColorSpaceXform : public SkRefCnt {
public:
- GrColorSpaceXform(const SkMatrix44& srcToDst);
+ GrColorSpaceXform(const SkMatrix44& srcToDst, SkAlphaType srcAlphaType);
- static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst);
+ static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst,
+ SkAlphaType srcAlphaType);
const float* srcToDst() { return fSrcToDst; }
+ SkAlphaType alphaType() const { return fSrcAlphaType; }
+
+ /**
+ * GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in its
bsalomon 2016/09/07 14:46:37 The GrGLSLFragmentProcessor::GenKey() thing is sor
+ * computed key.
+ */
+ static uint32_t XformKey(GrColorSpaceXform* xform) {
+ if (!xform) {
+ return 0;
+ }
+ // Code generation just depends on whether the alpha type is premul or not
+ return kPremul_SkAlphaType == xform->fSrcAlphaType ? 1 : 2;
+ }
private:
// We store the column-major form of the srcToDst matrix, for easy uploading to uniforms
float fSrcToDst[16];
+
+ // Alpha type of the source. If it's premul, we need special handling
+ SkAlphaType fSrcAlphaType;
};
#endif
« no previous file with comments | « no previous file | src/gpu/GrColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698