From 4765c57828d17baa56fe9a1e9e239e256cfcb789 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Wed, 4 Sep 2019 02:49:04 +0200 Subject: [PATCH] filter-sdf-effects: Don't define structs in nameless unions --- source/filters/filter-sdf-effects.cpp | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source/filters/filter-sdf-effects.cpp b/source/filters/filter-sdf-effects.cpp index b9e94ec5..95b031b7 100644 --- a/source/filters/filter-sdf-effects.cpp +++ b/source/filters/filter-sdf-effects.cpp @@ -479,12 +479,13 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data) obs_data_get_bool(data, ST_SHADOW_OUTER) && (obs_data_get_double(data, ST_SHADOW_OUTER_ALPHA) >= std::numeric_limits::epsilon()); { + struct cs { + uint8_t r, g, b, a; + }; union { uint32_t color; uint8_t channel[4]; - struct c { - uint8_t r, g, b, a; - } c; + cs c; }; color = uint32_t(obs_data_get_int(data, ST_SHADOW_OUTER_COLOR)); this->_outer_shadow_color.x = float_t(c.r / 255.0); @@ -503,12 +504,13 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data) obs_data_get_bool(data, ST_SHADOW_INNER) && (obs_data_get_double(data, ST_SHADOW_INNER_ALPHA) >= std::numeric_limits::epsilon()); { + struct cs { + uint8_t r, g, b, a; + }; union { uint32_t color; uint8_t channel[4]; - struct c { - uint8_t r, g, b, a; - } c; + cs c; }; color = uint32_t(obs_data_get_int(data, ST_SHADOW_INNER_COLOR)); this->_inner_shadow_color.x = float_t(c.r / 255.0); @@ -527,12 +529,13 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data) obs_data_get_bool(data, ST_GLOW_OUTER) && (obs_data_get_double(data, ST_GLOW_OUTER_ALPHA) >= std::numeric_limits::epsilon()); { + struct cs { + uint8_t r, g, b, a; + }; union { uint32_t color; uint8_t channel[4]; - struct c { - uint8_t r, g, b, a; - } c; + cs c; }; color = uint32_t(obs_data_get_int(data, ST_GLOW_OUTER_COLOR)); this->_outer_glow_color.x = float_t(c.r / 255.0); @@ -553,12 +556,13 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data) obs_data_get_bool(data, ST_GLOW_INNER) && (obs_data_get_double(data, ST_GLOW_INNER_ALPHA) >= std::numeric_limits::epsilon()); { + struct cs { + uint8_t r, g, b, a; + }; union { uint32_t color; uint8_t channel[4]; - struct c { - uint8_t r, g, b, a; - } c; + cs c; }; color = uint32_t(obs_data_get_int(data, ST_GLOW_INNER_COLOR)); this->_inner_glow_color.x = float_t(c.r / 255.0); @@ -578,12 +582,13 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data) this->_outline = obs_data_get_bool(data, ST_OUTLINE) && (obs_data_get_double(data, ST_OUTLINE_ALPHA) >= std::numeric_limits::epsilon()); { + struct cs { + uint8_t r, g, b, a; + }; union { uint32_t color; uint8_t channel[4]; - struct c { - uint8_t r, g, b, a; - } c; + cs c; }; color = uint32_t(obs_data_get_int(data, ST_OUTLINE_COLOR)); this->_outline_color.x = float_t(c.r / 255.0);