Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tests
HSVRoundTripTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
include/core/SkColor.h
"
9
#include "
include/core/SkScalar.h
"
10
#include "
include/core/SkTypes.h
"
11
#include "
include/private/base/SkCPUTypes.h
"
12
#include "
tests/Test.h
"
13
14
DEF_TEST
(ColorToHSVRoundTrip,
reporter
) {
15
SkScalar
hsv[3];
16
for
(
U8CPU
r = 0; r <= 255; r++) {
17
for
(
U8CPU
g = 0; g <= 255; g++) {
18
for
(
U8CPU
b
= 0;
b
<= 255;
b
++) {
19
SkColor
color
=
SkColorSetRGB
(r, g,
b
);
20
SkColorToHSV
(
color
, hsv);
21
SkColor
result
=
SkHSVToColor
(0xFF, hsv);
22
if
(
result
!=
color
) {
23
ERRORF
(
reporter
,
"HSV roundtrip mismatch!\n"
24
"\toriginal: %X\n"
25
"\tHSV: %f, %f, %f\n"
26
"\tresult: %X\n"
,
27
color
, hsv[0], hsv[1], hsv[2],
result
);
28
}
29
}
30
}
31
}
32
}
reporter
reporter
Definition
FontMgrTest.cpp:39
color
SkColor4f color
Definition
ImageShaderTest.cpp:28
SkCPUTypes.h
U8CPU
unsigned U8CPU
Definition
SkCPUTypes.h:18
SkColor.h
SkColor
uint32_t SkColor
Definition
SkColor.h:37
SkColorSetRGB
#define SkColorSetRGB(r, g, b)
Definition
SkColor.h:57
SkHSVToColor
SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3])
Definition
SkColor.cpp:78
SkColorToHSV
static void SkColorToHSV(SkColor color, SkScalar hsv[3])
Definition
SkColor.h:169
SkScalar.h
SkTypes.h
Test.h
DEF_TEST
#define DEF_TEST(name, reporter)
Definition
Test.h:312
ERRORF
#define ERRORF(r,...)
Definition
Test.h:293
SkScalar
float SkScalar
Definition
extension.cpp:12
b
static bool b
Definition
ffi_native_test_module.c:74
result
GAsyncResult * result
Definition
fl_text_input_plugin.cc:106
Generated on Fri Apr 26 2024 06:17:45 for Flutter Engine by
1.9.8