Flutter Engine
The Flutter Engine
Functions
SurfaceManager.cpp File Reference
#include "include/core/SkCanvas.h"
#include "src/core/SkColorSpacePriv.h"
#include "tools/ToolUtils.h"
#include "tools/testrunners/common/surface_manager/SurfaceManager.h"

Go to the source code of this file.

Functions

static std::string identify_gamut (SkColorSpace *cs)
 
static std::string identify_transfer_fn (SkColorSpace *cs)
 

Function Documentation

◆ identify_gamut()

static std::string identify_gamut ( SkColorSpace cs)
static

Definition at line 15 of file SurfaceManager.cpp.

15 {
16 if (!cs) {
17 return "untagged";
18 }
19
20 skcms_Matrix3x3 gamut;
21 if (cs->toXYZD50(&gamut)) {
23 for (int i = 0; i < 3; i++) {
24 for (int j = 0; j < 3; j++) {
25 if (x.vals[i][j] != y.vals[i][j]) {
26 return false;
27 }
28 }
29 }
30 return true;
31 };
32
33 if (eq(gamut, SkNamedGamut::kSRGB)) {
34 return "sRGB";
35 }
36 if (eq(gamut, SkNamedGamut::kAdobeRGB)) {
37 return "Adobe";
38 }
39 if (eq(gamut, SkNamedGamut::kDisplayP3)) {
40 return "P3";
41 }
42 if (eq(gamut, SkNamedGamut::kRec2020)) {
43 return "2020";
44 }
45 if (eq(gamut, SkNamedGamut::kXYZ)) {
46 return "XYZ";
47 }
48 if (eq(gamut, gNarrow_toXYZD50)) {
49 return "narrow";
50 }
51 return "other";
52 }
53 return "non-XYZ";
54}
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
Definition: M44Test.cpp:18
static constexpr skcms_Matrix3x3 gNarrow_toXYZD50
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
double y
double x
static constexpr skcms_Matrix3x3 kSRGB
Definition: SkColorSpace.h:67
static constexpr skcms_Matrix3x3 kAdobeRGB
Definition: SkColorSpace.h:77
static constexpr skcms_Matrix3x3 kXYZ
Definition: SkColorSpace.h:99
static constexpr skcms_Matrix3x3 kRec2020
Definition: SkColorSpace.h:93
static constexpr skcms_Matrix3x3 kDisplayP3
Definition: SkColorSpace.h:87

◆ identify_transfer_fn()

static std::string identify_transfer_fn ( SkColorSpace cs)
static

Definition at line 58 of file SurfaceManager.cpp.

58 {
59 if (!cs) {
60 return "untagged";
61 }
62
64 return x.g == y.g && x.a == y.a && x.b == y.b && x.c == y.c && x.d == y.d && x.e == y.e &&
65 x.f == y.f;
66 };
67
69 cs->transferFn(&tf);
70 switch (skcms_TransferFunction_getType(&tf)) {
72 if (tf.a == 1 && tf.b == 0 && tf.c == 0 && tf.d == 0 && tf.e == 0 && tf.f == 0) {
73 return SkStringPrintf("gamma %.3g", tf.g).c_str();
74 }
76 return "sRGB";
77 }
79 return "2020";
80 }
81 return SkStringPrintf("%.3g %.3g %.3g %.3g %.3g %.3g %.3g",
82 tf.g,
83 tf.a,
84 tf.b,
85 tf.c,
86 tf.d,
87 tf.e,
88 tf.f)
89 .c_str();
90
92 if (eq(tf, SkNamedTransferFn::kPQ)) {
93 return "PQ";
94 }
95 return SkStringPrintf("PQish %.3g %.3g %.3g %.3g %.3g %.3g",
96 tf.a,
97 tf.b,
98 tf.c,
99 tf.d,
100 tf.e,
101 tf.f)
102 .c_str();
103
105 if (eq(tf, SkNamedTransferFn::kHLG)) {
106 return "HLG";
107 }
108 return SkStringPrintf("HLGish %.3g %.3g %.3g %.3g %.3g (%.3g)",
109 tf.a,
110 tf.b,
111 tf.c,
112 tf.d,
113 tf.e,
114 tf.f + 1)
115 .c_str();
116
118 break;
120 break;
121 }
122 return "non-numeric";
123}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
void transferFn(float gabcdef[7]) const
const char * c_str() const
Definition: SkString.h:133
static constexpr skcms_TransferFunction kRec2020
Definition: SkColorSpace.h:54
static constexpr skcms_TransferFunction kSRGB
Definition: SkColorSpace.h:45
static constexpr skcms_TransferFunction kHLG
Definition: SkColorSpace.h:60
static constexpr skcms_TransferFunction kPQ
Definition: SkColorSpace.h:57
skcms_TFType skcms_TransferFunction_getType(const skcms_TransferFunction *tf)
Definition: skcms.cc:183
@ skcms_TFType_Invalid
Definition: skcms_public.h:55
@ skcms_TFType_HLGish
Definition: skcms_public.h:58
@ skcms_TFType_sRGBish
Definition: skcms_public.h:56
@ skcms_TFType_HLGinvish
Definition: skcms_public.h:59
@ skcms_TFType_PQish
Definition: skcms_public.h:57