Make SkColorToHSV and SkHSVToColor "perfect" inverses
authorLeon Scroggins III <scroggo@google.com>
Wed, 11 Jan 2017 17:59:43 +0000 (12:59 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 11 Jan 2017 18:12:36 +0000 (18:12 +0000)
commit1252ec4bdaaa2bf0d1d3b2df8df735eb879427c2
tree2f0b4d24ec98b7dc9dcc182a91bbf7624ac35c7c
parentd081ff314f07104adacaadc3d0f8f13dc741f016
Make SkColorToHSV and SkHSVToColor "perfect" inverses

For all possible opaque SkColors, make converting to HSV and back return
the original SkColor.

In SkHSVToColor, store values as normalized floats (instead of
converting to byte values) as long as possible.

Add a test that cycles through all opaque SkColors and verifies correct
conversion.

BUG=b/33737498

Change-Id: I7ff61a999a271565a9ffe82ae3c9676fc49d67e3
Reviewed-on: https://skia-review.googlesource.com/6720
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
gn/tests.gni
src/core/SkColor.cpp
tests/HSVRoundTripTest.cpp [new file with mode: 0644]