From d45716228fdf01459e4b583cb4c3f94435eca302 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Mon, 30 Sep 2013 13:43:38 +0300 Subject: goom: Mark data static const. Use union to fix initialization. --- src/post/goom/convolve_fx.c | 8 ++++---- src/post/goom/motif_goom1.h | 7 +++++-- src/post/goom/motif_goom2.h | 7 +++++-- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/post/goom/convolve_fx.c b/src/post/goom/convolve_fx.c index ee36dfd0b..ada619155 100644 --- a/src/post/goom/convolve_fx.c +++ b/src/post/goom/convolve_fx.c @@ -64,7 +64,7 @@ static void compute_tables(VisualFX *_this, PluginInfo *info) } } -static void set_motif(ConvData *data, Motif motif) +static void set_motif(ConvData *data, const Motif motif) { int i,j; for (i=0;itheta = 0; data->ftheta = 0.0; data->visibility = 1.0; - set_motif(data, CONV_MOTIF2); + set_motif(data, CONV_MOTIF2.motif); data->inverse_motif = 0; _this->params = &data->params; @@ -296,9 +296,9 @@ static void convolve_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo switch (goom_irand(info->gRandom, 300)) { case 1: - set_motif(data, CONV_MOTIF1); data->inverse_motif = 1; break; + set_motif(data, CONV_MOTIF1.motif); data->inverse_motif = 1; break; case 2: - set_motif(data, CONV_MOTIF2); data->inverse_motif = 0; break; + set_motif(data, CONV_MOTIF2.motif); data->inverse_motif = 0; break; } } diff --git a/src/post/goom/motif_goom1.h b/src/post/goom/motif_goom1.h index b4a9f3f1d..0a40a35c2 100644 --- a/src/post/goom/motif_goom1.h +++ b/src/post/goom/motif_goom1.h @@ -1,4 +1,7 @@ -static Motif CONV_MOTIF1 = { +static const union { + const char u8[sizeof(Motif)]; + const Motif motif; +} CONV_MOTIF1 = {{ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, @@ -1023,4 +1026,4 @@ static Motif CONV_MOTIF1 = { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 - }; + }}; diff --git a/src/post/goom/motif_goom2.h b/src/post/goom/motif_goom2.h index 4bde2a3d0..2d507c9dd 100644 --- a/src/post/goom/motif_goom2.h +++ b/src/post/goom/motif_goom2.h @@ -1,4 +1,7 @@ -static Motif CONV_MOTIF2 = { +static const union { + const char u8[sizeof(Motif)]; + const Motif motif; +} CONV_MOTIF2 = {{ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, @@ -1023,4 +1026,4 @@ static Motif CONV_MOTIF2 = { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 - }; + }}; -- cgit v1.2.3