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

Unified Diff: include/gpu/GrColorSpaceXform.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 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 c1fb166f47cce383eb8574a6a672ed4e500326cf..38b5ccfc08fcd7739f229fb7870efd4ec08f1e76 100644
--- a/include/gpu/GrColorSpaceXform.h
+++ b/include/gpu/GrColorSpaceXform.h
@@ -8,43 +8,33 @@
#ifndef GrColorSpaceXform_DEFINED
#define GrColorSpaceXform_DEFINED
-#include "SkImageInfo.h"
+#include "SkMatrix44.h"
#include "SkRefCnt.h"
class SkColorSpace;
-class SkMatrix44;
/**
* Represents a color gamut transformation (as a 4x4 color matrix)
*/
class GrColorSpaceXform : public SkRefCnt {
public:
- GrColorSpaceXform(const SkMatrix44& srcToDst, SkAlphaType srcAlphaType);
+ GrColorSpaceXform(const SkMatrix44& srcToDst);
- static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst,
- SkAlphaType srcAlphaType);
+ static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst);
- const float* srcToDst() { return fSrcToDst; }
- SkAlphaType alphaType() const { return fSrcAlphaType; }
+ const SkMatrix44& srcToDst() { return fSrcToDst; }
/**
* GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in its
* 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;
+ // Code generation changes if there is an xform, but it otherwise constant
+ return SkToBool(xform) ? 1 : 0;
}
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;
+ SkMatrix44 fSrcToDst;
};
#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