Flutter Engine
The Flutter Engine
Functions
HSVRoundTripTest.cpp File Reference
#include "include/core/SkColor.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkCPUTypes.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

 DEF_TEST (ColorToHSVRoundTrip, reporter)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( ColorToHSVRoundTrip  ,
reporter   
)

Definition at line 14 of file HSVRoundTripTest.cpp.

14 {
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++) {
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
Definition: FontMgrTest.cpp:39
unsigned U8CPU
Definition: SkCPUTypes.h:18
uint32_t SkColor
Definition: SkColor.h:37
#define SkColorSetRGB(r, g, b)
Definition: SkColor.h:57
SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3])
Definition: SkColor.cpp:78
static void SkColorToHSV(SkColor color, SkScalar hsv[3])
Definition: SkColor.h:169
#define ERRORF(r,...)
Definition: Test.h:293
DlColor color
float SkScalar
Definition: extension.cpp:12
static bool b
GAsyncResult * result