diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-05 19:30:05 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-05 19:30:05 +0100 |
commit | 6e51f46781346a86d4862936ba8b7fa75ae58126 (patch) | |
tree | 91204d219102ae86d72c51f06011ffdec0fc5ed1 | |
parent | Cleanup and style update (avoid typedef) (diff) | |
download | redshift-ng-6e51f46781346a86d4862936ba8b7fa75ae58126.tar.gz redshift-ng-6e51f46781346a86d4862936ba8b7fa75ae58126.tar.bz2 redshift-ng-6e51f46781346a86d4862936ba8b7fa75ae58126.tar.xz |
Nicer X macros
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r-- | src/colorramp.c | 3 | ||||
-rw-r--r-- | src/common.h | 16 | ||||
-rw-r--r-- | src/gamma-coopgamma.c | 12 |
3 files changed, 15 insertions, 16 deletions
diff --git a/src/colorramp.c b/src/colorramp.c index 41233d5..80f11fd 100644 --- a/src/colorramp.c +++ b/src/colorramp.c @@ -38,5 +38,4 @@ for (i = 0; i < size_b; i++) gamma_b[i] = F((double)i / size_b, b, 2) * (MAX);\ } -LIST_RAMPS_STOP_VALUE_TYPES -#undef X +LIST_RAMPS_STOP_VALUE_TYPES(X,) diff --git a/src/common.h b/src/common.h index 895fedc..2633c83 100644 --- a/src/common.h +++ b/src/common.h @@ -158,19 +158,19 @@ struct location_provider { }; -#define LIST_RAMPS_STOP_VALUE_TYPES\ - X(u8, uint8_t, UINT8_MAX + 1ULL, UINT8_MAX, 8)\ - X(u16, uint16_t, UINT16_MAX + 1ULL, UINT16_MAX, 16)\ - X(u32, uint32_t, UINT32_MAX + 1ULL, UINT32_MAX, 32)\ - X(u64, uint64_t, UINT64_MAX, UINT64_MAX, 64)\ - X(float, float, 1, 1, -1)\ +#define LIST_RAMPS_STOP_VALUE_TYPES(X, D)\ + X(u8, uint8_t, UINT8_MAX + 1ULL, UINT8_MAX, 8) D\ + X(u16, uint16_t, UINT16_MAX + 1ULL, UINT16_MAX, 16) D\ + X(u32, uint32_t, UINT32_MAX + 1ULL, UINT32_MAX, 32) D\ + X(u64, uint64_t, UINT64_MAX, UINT64_MAX, 64) D\ + X(float, float, 1, 1, -1) D\ X(double, double, 1, 1, -2) #define X(SUFFIX, TYPE, MAX, TRUE_MAX, DEPTH)\ void colorramp_fill_##SUFFIX(TYPE *gamma_r, TYPE *gamma_g, TYPE *gamma_b,\ size_t size_r, size_t size_g, size_t size_b,\ - const struct color_setting *setting); -LIST_RAMPS_STOP_VALUE_TYPES + const struct color_setting *setting) +LIST_RAMPS_STOP_VALUE_TYPES(X, ;); #undef X diff --git a/src/gamma-coopgamma.c b/src/gamma-coopgamma.c index 5b18c95..387e29b 100644 --- a/src/gamma-coopgamma.c +++ b/src/gamma-coopgamma.c @@ -270,8 +270,8 @@ coopgamma_start(struct gamma_state *state, enum program_mode mode) #define X(SUFFIX, TYPE, MAX, TRUE_MAX, DEPTH)\ case DEPTH:\ crtc->rampsize = sizeof(TYPE);\ - break; - LIST_RAMPS_STOP_VALUE_TYPES + break + LIST_RAMPS_STOP_VALUE_TYPES(X, ;); #undef X default: if (info.depth > 0) @@ -325,8 +325,8 @@ coopgamma_start(struct gamma_state *state, enum program_mode mode) d /= crtc->plain_ramps.SUFFIX.blue_size;\ crtc->plain_ramps.SUFFIX.blue[j] = d * TRUE_MAX;\ }\ - break; - LIST_RAMPS_STOP_VALUE_TYPES + break + LIST_RAMPS_STOP_VALUE_TYPES(X, ;); #undef X default: abort(); @@ -529,8 +529,8 @@ coopgamma_set_temperature(struct gamma_state *state, const struct color_setting filter->ramps.u8.green_size,\ filter->ramps.u8.blue_size,\ setting);\ - break; - LIST_RAMPS_STOP_VALUE_TYPES + break + LIST_RAMPS_STOP_VALUE_TYPES(X, ;); #undef X default: abort(); |