Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
GrColorSpaceXform Class Reference

#include <GrColorSpaceXform.h>

Inheritance diagram for GrColorSpaceXform:
SkRefCnt SkRefCntBase

Public Member Functions

 GrColorSpaceXform (const SkColorSpaceXformSteps &steps)
 
const SkColorSpaceXformStepssteps () const
 
SkColor4f apply (const SkColor4f &srcColor)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< GrColorSpaceXformMake (SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
 
static sk_sp< GrColorSpaceXformMake (const GrColorInfo &srcInfo, const GrColorInfo &dstInfo)
 
static uint32_t XformKey (const GrColorSpaceXform *xform)
 
static bool Equals (const GrColorSpaceXform *a, const GrColorSpaceXform *b)
 

Friends

class GrGLSLColorSpaceXformHelper
 

Detailed Description

Represents a color space transformation

Definition at line 30 of file GrColorSpaceXform.h.

Constructor & Destructor Documentation

◆ GrColorSpaceXform()

GrColorSpaceXform::GrColorSpaceXform ( const SkColorSpaceXformSteps steps)
inline

Definition at line 32 of file GrColorSpaceXform.h.

32: fSteps(steps) {}
const SkColorSpaceXformSteps & steps() const

Member Function Documentation

◆ apply()

SkColor4f GrColorSpaceXform::apply ( const SkColor4f srcColor)

Definition at line 82 of file GrColorSpaceXform.cpp.

82 {
83 SkColor4f result = srcColor;
84 fSteps.apply(result.vec());
85 return result;
86}
GAsyncResult * result
void apply(float rgba[4]) const

◆ Equals()

bool GrColorSpaceXform::Equals ( const GrColorSpaceXform a,
const GrColorSpaceXform b 
)
static

Definition at line 54 of file GrColorSpaceXform.cpp.

54 {
55 if (a == b) {
56 return true;
57 }
58
59 if (!a || !b || a->fSteps.flags.mask() != b->fSteps.flags.mask()) {
60 return false;
61 }
62
63 if (a->fSteps.flags.linearize &&
64 0 != memcmp(&a->fSteps.srcTF, &b->fSteps.srcTF, sizeof(a->fSteps.srcTF))) {
65 return false;
66 }
67
68 if (a->fSteps.flags.gamut_transform &&
69 0 != memcmp(&a->fSteps.src_to_dst_matrix, &b->fSteps.src_to_dst_matrix,
70 sizeof(a->fSteps.src_to_dst_matrix))) {
71 return false;
72 }
73
74 if (a->fSteps.flags.encode &&
75 0 != memcmp(&a->fSteps.dstTFInv, &b->fSteps.dstTFInv, sizeof(a->fSteps.dstTFInv))) {
76 return false;
77 }
78
79 return true;
80}
static bool b
struct MyStruct a[10]

◆ Make() [1/2]

sk_sp< GrColorSpaceXform > GrColorSpaceXform::Make ( const GrColorInfo srcInfo,
const GrColorInfo dstInfo 
)
static

Definition at line 32 of file GrColorSpaceXform.cpp.

33 {
34 return Make(srcInfo.colorSpace(), srcInfo.alphaType(),
35 dstInfo.colorSpace(), dstInfo.alphaType());
36}
SkColorSpace * colorSpace() const
Definition: GrColorInfo.cpp:48
SkAlphaType alphaType() const
Definition: GrColorInfo.h:44
static sk_sp< GrColorSpaceXform > Make(SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)

◆ Make() [2/2]

sk_sp< GrColorSpaceXform > GrColorSpaceXform::Make ( SkColorSpace src,
SkAlphaType  srcAT,
SkColorSpace dst,
SkAlphaType  dstAT 
)
static

Definition at line 25 of file GrColorSpaceXform.cpp.

26 {
27 SkColorSpaceXformSteps steps(src, srcAT, dst, dstAT);
28 return steps.flags.mask() == 0 ? nullptr /* Noop transform */
29 : sk_make_sp<GrColorSpaceXform>(steps);
30}
dst
Definition: cp.py:12
constexpr uint32_t mask() const

◆ steps()

const SkColorSpaceXformSteps & GrColorSpaceXform::steps ( ) const
inline

Definition at line 39 of file GrColorSpaceXform.h.

39{ return fSteps; }

◆ XformKey()

uint32_t GrColorSpaceXform::XformKey ( const GrColorSpaceXform xform)
static

GrFragmentProcessor::addToKey() must call this and include the returned value in its computed key.

Definition at line 38 of file GrColorSpaceXform.cpp.

38 {
39 // Code generation depends on which steps we apply,
40 // and the kinds of transfer functions (if we're applying those).
41 if (!xform) { return 0; }
42
43 const SkColorSpaceXformSteps& steps(xform->fSteps);
44 uint32_t key = steps.flags.mask();
45 if (steps.flags.linearize) {
47 }
48 if (steps.flags.encode) {
50 }
51 return key;
52}
skcms_TFType skcms_TransferFunction_getType(const skcms_TransferFunction *tf)
Definition: skcms.cc:183
skcms_TransferFunction srcTF
skcms_TransferFunction dstTFInv

Friends And Related Function Documentation

◆ GrGLSLColorSpaceXformHelper

friend class GrGLSLColorSpaceXformHelper
friend

Definition at line 52 of file GrColorSpaceXform.h.


The documentation for this class was generated from the following files: