From: Petri H. <phi...@us...> - 2013-09-30 10:51:14
|
# HG changeset patch # User Petri Hintukainen <phi...@us...> # Date 1380537818 -10800 # Node ID af733135197b4332413467ee5f3ef11b645e211a # Branch default # Parent aaa8fdaeea5b53e535a64d738a62207b3853fefe goom: Mark data static const. Use union to fix initialization. diff --git a/src/post/goom/convolve_fx.c b/src/post/goom/convolve_fx.c --- a/src/post/goom/convolve_fx.c +++ b/src/post/goom/convolve_fx.c @@ -64,7 +64,7 @@ } } -static void set_motif(ConvData *data, Motif motif) +static void set_motif(ConvData *data, const Motif motif) { int i,j; for (i=0;i<CONV_MOTIF_W;++i) for (j=0;j<CONV_MOTIF_W;++j) @@ -100,7 +100,7 @@ data->theta = 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 @@ 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; } } --git a/src/post/goom/motif_goom1.h b/src/post/goom/motif_goom1.h --- 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 @@ 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 - }; + }}; --git a/src/post/goom/motif_goom2.h b/src/post/goom/motif_goom2.h --- 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 @@ 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 - }; + }}; |