diff options
author | Robert Phillips <robertphillips@google.com> | 2017-04-21 12:24:00 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-21 17:12:17 +0000 |
commit | 9f5d4679e107ab83de635392798b3ddd62f48a12 (patch) | |
tree | 59c25bac71401ce32219d1e8c4362004a3d889a6 /src/gpu/GrColorSpaceXform.h | |
parent | 09419508669d203421f739b3105596655b7f0dcb (diff) |
Remove more headers from include/gpu
TBR=bsalomon@google.com
Change-Id: I93b28cfcb4d7b50c12e24ea81faab680bccce9ef
Reviewed-on: https://skia-review.googlesource.com/14036
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrColorSpaceXform.h')
-rw-r--r-- | src/gpu/GrColorSpaceXform.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gpu/GrColorSpaceXform.h b/src/gpu/GrColorSpaceXform.h new file mode 100644 index 0000000000..68cd3b0563 --- /dev/null +++ b/src/gpu/GrColorSpaceXform.h @@ -0,0 +1,45 @@ +/* + * 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 GrColorSpaceXform_DEFINED +#define GrColorSpaceXform_DEFINED + +#include "GrColor.h" +#include "SkMatrix44.h" +#include "SkRefCnt.h" + +class SkColorSpace; + + /** + * Represents a color gamut transformation (as a 4x4 color matrix) + */ +class GrColorSpaceXform : public SkRefCnt { +public: + GrColorSpaceXform(const SkMatrix44& srcToDst); + + static sk_sp<GrColorSpaceXform> Make(const SkColorSpace* src, const SkColorSpace* dst); + + const SkMatrix44& srcToDst() const { return fSrcToDst; } + + /** + * GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in its + * computed key. + */ + static uint32_t XformKey(const GrColorSpaceXform* xform) { + // Code generation changes if there is an xform, but it otherwise constant + return SkToBool(xform) ? 1 : 0; + } + + static bool Equals(const GrColorSpaceXform* a, const GrColorSpaceXform* b); + + GrColor4f apply(const GrColor4f& srcColor); + +private: + SkMatrix44 fSrcToDst; +}; + +#endif |