Go to the source code of this file.
◆ DEF_TEST() [1/3]
DEF_TEST |
( |
srgb_edge_cases |
, |
|
|
r |
|
|
) |
| |
Definition at line 53 of file SRGBTest.cpp.
53 {
54
55 float colors[4][4] = { {0,1,1,1}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
57
59
61 linear = sRGB->makeLinearGamma();
63
65
68 p.appendConstantColor(&alloc,
color);
69 steps.apply(&p);
70 p.append(SkRasterPipelineOp::store_f32, &dst);
72
73 if (
color[0] != 0.0f) {
74 ERRORF(r,
"expected to_srgb() to map 0.0f to 0.0f, got %f",
color[0]);
75 }
76 if (
color[1] != 1.0f) {
80 ERRORF(r,
"expected to_srgb() to map 1.0f to 1.0f, got %f (%08x)",
color[1],
x);
81 }
82}
static sk_sp< SkColorSpace > MakeSRGB()
PODArray< SkColor > colors
static sk_sp< SkShader > linear(sk_sp< SkShader > shader)
◆ DEF_TEST() [2/3]
DEF_TEST |
( |
srgb_roundtrip |
, |
|
|
r |
|
|
) |
| |
Definition at line 23 of file SRGBTest.cpp.
23 {
24 uint32_t reds[256];
25 for (int i = 0; i < 256; i++) {
26 reds[i] = i;
27 }
28
30
32 linear = sRGB->makeLinearGamma();
34
37
39 p.append(SkRasterPipelineOp::load_8888, &ptr);
40 linearize.apply(&p);
41 reencode .apply(&p);
42 p.append(SkRasterPipelineOp::store_8888, &ptr);
43
45
46 for (int i = 0; i < 256; i++) {
47 if (reds[i] != (uint32_t)i) {
48 ERRORF(r,
"%d doesn't round trip, %u", i, reds[i]);
49 }
50 }
51}
◆ DEF_TEST() [3/3]
DEF_TEST |
( |
srgb_roundtrip_extended |
, |
|
|
r |
|
|
) |
| |
Definition at line 85 of file SRGBTest.cpp.
85 {
86 static const int kSteps = 128;
88
89 auto expected = [=](int i) {
90 float scale = 10000.0f / (3*kSteps);
95 1.0f,
96 };
97 };
98
99 for (int i = 0; i < kSteps; i++) {
100 rgba[i] = expected(i);
101 }
102
104
108
111
113 p.append(SkRasterPipelineOp::load_f32, &ptr);
114 linearize.apply(&p);
115 reencode .apply(&p);
116 p.append(SkRasterPipelineOp::store_f32, &ptr);
118
119 auto close = [=](
float x,
float y) {
121 || (
x/
y < 1.001f &&
y/
x < 1.001f);
122 };
123
124 for (int i = 0; i < kSteps; i++) {
126 #if 0
127 SkDebugf(
"got %g %g %g, want %g %g %g\n",
129 want.fR, want.fG, want.fB);
130 #endif
134 }
135}
static const uint32_t rgba[kNumPixels]
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define REPORTER_ASSERT(r, cond,...)