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

Side by Side Diff: include/gpu/GrColorSpaceXform.h

Issue 2337313002: (Some) gradients are gamma and gamut correct on GPU (Closed)
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 unified diff | Download patch
OLDNEW
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 "GrColor.h"
12 #include "SkMatrix44.h" 12 #include "SkMatrix44.h"
13 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
14 14
15 class SkColorSpace; 15 class SkColorSpace;
16 16
17 /** 17 /**
18 * Represents a color gamut transformation (as a 4x4 color matrix) 18 * Represents a color gamut transformation (as a 4x4 color matrix)
19 */ 19 */
20 class GrColorSpaceXform : public SkRefCnt { 20 class GrColorSpaceXform : public SkRefCnt {
21 public: 21 public:
22 GrColorSpaceXform(const SkMatrix44& srcToDst); 22 GrColorSpaceXform(const SkMatrix44& srcToDst);
23 23
24 static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst); 24 static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst);
25 25
26 const SkMatrix44& srcToDst() { return fSrcToDst; } 26 const SkMatrix44& srcToDst() const { return fSrcToDst; }
27 27
28 /** 28 /**
29 * 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
30 * computed key. 30 * computed key.
31 */ 31 */
32 static uint32_t XformKey(GrColorSpaceXform* xform) { 32 static uint32_t XformKey(GrColorSpaceXform* xform) {
33 // 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
34 return SkToBool(xform) ? 1 : 0; 34 return SkToBool(xform) ? 1 : 0;
35 } 35 }
36 36
37 static bool Equals(const GrColorSpaceXform* a, const GrColorSpaceXform* b);
38
37 GrColor4f apply(const GrColor4f& srcColor); 39 GrColor4f apply(const GrColor4f& srcColor);
38 40
39 private: 41 private:
40 SkMatrix44 fSrcToDst; 42 SkMatrix44 fSrcToDst;
41 }; 43 };
42 44
43 #endif 45 #endif
OLDNEW
« no previous file with comments | « no previous file | src/effects/gradients/SkGradientShader.cpp » ('j') | src/effects/gradients/SkGradientShaderPriv.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698