diff options
author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-09-17 11:39:43 +0900 |
commit | f8fe33acfac01064112fd2b5da680abfb5190b97 (patch) | |
tree | fcf75ef930800a948e5a3ba015d6759889f2284d /quantum/color.c | |
parent | c339d670684674165b422a0168bfd2016ff2e6ef (diff) |
clang-format changes
Diffstat (limited to 'quantum/color.c')
-rw-r--r-- | quantum/color.c | 117 |
1 files changed, 56 insertions, 61 deletions
diff --git a/quantum/color.c b/quantum/color.c index a309da379a..847129736d 100644 --- a/quantum/color.c +++ b/quantum/color.c @@ -14,81 +14,76 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - #include "color.h" #include "led_tables.h" #include "progmem.h" -RGB hsv_to_rgb( HSV hsv ) -{ - RGB rgb; - uint8_t region, remainder, p, q, t; - uint16_t h, s, v; +RGB hsv_to_rgb(HSV hsv) { + RGB rgb; + uint8_t region, remainder, p, q, t; + uint16_t h, s, v; - if ( hsv.s == 0 ) - { + if (hsv.s == 0) { #ifdef USE_CIE1931_CURVE - rgb.r = rgb.g = rgb.b = pgm_read_byte( &CIE1931_CURVE[hsv.v] ); + rgb.r = rgb.g = rgb.b = pgm_read_byte(&CIE1931_CURVE[hsv.v]); #else - rgb.r = hsv.v; - rgb.g = hsv.v; - rgb.b = hsv.v; + rgb.r = hsv.v; + rgb.g = hsv.v; + rgb.b = hsv.v; #endif - return rgb; - } + return rgb; + } - h = hsv.h; - s = hsv.s; - v = hsv.v; + h = hsv.h; + s = hsv.s; + v = hsv.v; - region = h * 6 / 255; - remainder = (h * 2 - region * 85) * 3; + region = h * 6 / 255; + remainder = (h * 2 - region * 85) * 3; - p = (v * (255 - s)) >> 8; - q = (v * (255 - ((s * remainder) >> 8))) >> 8; - t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; + p = (v * (255 - s)) >> 8; + q = (v * (255 - ((s * remainder) >> 8))) >> 8; + t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; - switch ( region ) - { - case 6: - case 0: - rgb.r = v; - rgb.g = t; - rgb.b = p; - break; - case 1: - rgb.r = q; - rgb.g = v; - rgb.b = p; - break; - case 2: - rgb.r = p; - rgb.g = v; - rgb.b = t; - break; - case 3: - rgb.r = p; - rgb.g = q; - rgb.b = v; - break; - case 4: - rgb.r = t; - rgb.g = p; - rgb.b = v; - break; - default: - rgb.r = v; - rgb.g = p; - rgb.b = q; - break; - } + switch (region) { + case 6: + case 0: + rgb.r = v; + rgb.g = t; + rgb.b = p; + break; + case 1: + rgb.r = q; + rgb.g = v; + rgb.b = p; + break; + case 2: + rgb.r = p; + rgb.g = v; + rgb.b = t; + break; + case 3: + rgb.r = p; + rgb.g = q; + rgb.b = v; + break; + case 4: + rgb.r = t; + rgb.g = p; + rgb.b = v; + break; + default: + rgb.r = v; + rgb.g = p; + rgb.b = q; + break; + } #ifdef USE_CIE1931_CURVE - rgb.r = pgm_read_byte( &CIE1931_CURVE[rgb.r] ); - rgb.g = pgm_read_byte( &CIE1931_CURVE[rgb.g] ); - rgb.b = pgm_read_byte( &CIE1931_CURVE[rgb.b] ); + rgb.r = pgm_read_byte(&CIE1931_CURVE[rgb.r]); + rgb.g = pgm_read_byte(&CIE1931_CURVE[rgb.g]); + rgb.b = pgm_read_byte(&CIE1931_CURVE[rgb.b]); #endif - return rgb; + return rgb; } - |