| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrColorSpaceXform_DEFINED | 8 #ifndef GrColorSpaceXform_DEFINED |
| 9 #define GrColorSpaceXform_DEFINED | 9 #define GrColorSpaceXform_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" |
| 11 #include "SkMatrix44.h" | 12 #include "SkMatrix44.h" |
| 12 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 13 | 14 |
| 14 class SkColorSpace; | 15 class SkColorSpace; |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * Represents a color gamut transformation (as a 4x4 color matrix) | 18 * Represents a color gamut transformation (as a 4x4 color matrix) |
| 18 */ | 19 */ |
| 19 class GrColorSpaceXform : public SkRefCnt { | 20 class GrColorSpaceXform : public SkRefCnt { |
| 20 public: | 21 public: |
| 21 GrColorSpaceXform(const SkMatrix44& srcToDst); | 22 GrColorSpaceXform(const SkMatrix44& srcToDst); |
| 22 | 23 |
| 23 static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst); | 24 static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst); |
| 24 | 25 |
| 25 const SkMatrix44& srcToDst() { return fSrcToDst; } | 26 const SkMatrix44& srcToDst() { return fSrcToDst; } |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * GrGLSLFragmentProcessor::GenKey() must call this and include the returned
value in its | 29 * GrGLSLFragmentProcessor::GenKey() must call this and include the returned
value in its |
| 29 * computed key. | 30 * computed key. |
| 30 */ | 31 */ |
| 31 static uint32_t XformKey(GrColorSpaceXform* xform) { | 32 static uint32_t XformKey(GrColorSpaceXform* xform) { |
| 32 // Code generation changes if there is an xform, but it otherwise consta
nt | 33 // Code generation changes if there is an xform, but it otherwise consta
nt |
| 33 return SkToBool(xform) ? 1 : 0; | 34 return SkToBool(xform) ? 1 : 0; |
| 34 } | 35 } |
| 35 | 36 |
| 37 GrColor4f apply(const GrColor4f& srcColor); |
| 38 |
| 36 private: | 39 private: |
| 37 SkMatrix44 fSrcToDst; | 40 SkMatrix44 fSrcToDst; |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 #endif | 43 #endif |
| OLD | NEW |