Flutter Engine
The Flutter Engine
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
12#include "tests/Test.h"
13
14DEF_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++) {
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
DEF_TEST(ColorToHSVRoundTrip, reporter)
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