Commit c2846f69 authored by Benjamin Otte's avatar Benjamin Otte

Make goom not use aggregate returns

parent 412cc103
......@@ -27,97 +27,85 @@ empty_fct (PluginParam * dummy)
{
}
PluginParam
goom_secure_param (void)
void
goom_secure_param (PluginParam * p)
{
PluginParam p;
p.changed = empty_fct;
p.change_listener = empty_fct;
p.user_data = 0;
p.name = p.desc = 0;
p.rw = 1;
return p;
p->changed = empty_fct;
p->change_listener = empty_fct;
p->user_data = 0;
p->name = p->desc = 0;
p->rw = 1;
}
PluginParam
goom_secure_f_param (const char *name)
void
goom_secure_f_param (PluginParam * p, const char *name)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_FLOATVAL;
FVAL (p) = 0.5f;
FMIN (p) = 0.0f;
FMAX (p) = 1.0f;
FSTEP (p) = 0.01f;
return p;
secure_param (p);
p->name = name;
p->type = PARAM_FLOATVAL;
FVAL (*p) = 0.5f;
FMIN (*p) = 0.0f;
FMAX (*p) = 1.0f;
FSTEP (*p) = 0.01f;
}
PluginParam
goom_secure_f_feedback (const char *name)
void
goom_secure_f_feedback (PluginParam * p, const char *name)
{
PluginParam p = secure_f_param (name);
secure_f_param (p, name);
p.rw = 0;
return p;
p->rw = 0;
}
PluginParam
goom_secure_s_param (const char *name)
void
goom_secure_s_param (PluginParam * p, const char *name)
{
PluginParam p = secure_param ();
secure_param (p);
p.name = name;
p.type = PARAM_STRVAL;
SVAL (p) = 0;
return p;
p->name = name;
p->type = PARAM_STRVAL;
SVAL (*p) = 0;
}
PluginParam
goom_secure_b_param (const char *name, int value)
void
goom_secure_b_param (PluginParam * p, const char *name, int value)
{
PluginParam p = secure_param ();
secure_param (p);
p.name = name;
p.type = PARAM_BOOLVAL;
BVAL (p) = value;
return p;
p->name = name;
p->type = PARAM_BOOLVAL;
BVAL (*p) = value;
}
PluginParam
goom_secure_i_param (const char *name)
void
goom_secure_i_param (PluginParam * p, const char *name)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_INTVAL;
IVAL (p) = 50;
IMIN (p) = 0;
IMAX (p) = 100;
ISTEP (p) = 1;
return p;
secure_param (p);
p->name = name;
p->type = PARAM_INTVAL;
IVAL (*p) = 50;
IMIN (*p) = 0;
IMAX (*p) = 100;
ISTEP (*p) = 1;
}
PluginParam
goom_secure_i_feedback (const char *name)
void
goom_secure_i_feedback (PluginParam * p, const char *name)
{
PluginParam p = secure_i_param (name);
secure_i_param (p, name);
p.rw = 0;
return p;
p->rw = 0;
}
PluginParameters
goom_plugin_parameters (const char *name, int nb)
void
goom_plugin_parameters (PluginParameters * p, const char *name, int nb)
{
PluginParameters p;
p.name = (char *) name;
p.desc = "";
p.nbParams = nb;
p.params = (PluginParam **) malloc (nb * sizeof (PluginParam *));
return p;
p->name = name;
p->desc = "";
p->nbParams = nb;
p->params = malloc (nb * sizeof (PluginParam *));
}
void
......
......@@ -102,19 +102,19 @@ convolve_init (VisualFX * _this, PluginInfo * info)
data = (ConvData *) malloc (sizeof (ConvData));
_this->fx_data = (void *) data;
data->light = secure_f_param ("Screen Brightness");
secure_f_param (&data->light, "Screen Brightness");
data->light.param.fval.max = 300.0f;
data->light.param.fval.step = 1.0f;
data->light.param.fval.value = 100.0f;
data->factor_adj_p = secure_f_param ("Flash Intensity");
secure_f_param (&data->factor_adj_p, "Flash Intensity");
data->factor_adj_p.param.fval.max = 200.0f;
data->factor_adj_p.param.fval.step = 1.0f;
data->factor_adj_p.param.fval.value = 70.0f;
data->factor_p = secure_f_feedback ("Factor");
secure_f_feedback (&data->factor_p, "Factor");
data->params = plugin_parameters ("Bright Flash", 5);
plugin_parameters (&data->params, "Bright Flash", 5);
data->params.params[0] = &data->light;
data->params.params[1] = &data->factor_adj_p;
data->params.params[2] = 0;
......@@ -233,9 +233,8 @@ create_output_with_brightness (VisualFX * _this, Pixel * src, Pixel * dest,
ytex -= s;
iff2 =
ifftab[(int) data->
conv_motif[(ytex >> 16) & CONV_MOTIF_WMASK][(xtex >> 16) &
CONV_MOTIF_WMASK]];
ifftab[(int) data->conv_motif[(ytex >> 16) & CONV_MOTIF_WMASK][(xtex
>> 16) & CONV_MOTIF_WMASK]];
#define sat(a) ((a)>0xFF?0xFF:(a))
f0 = src[i].val;
......@@ -358,14 +357,12 @@ convolve_apply (VisualFX * _this, Pixel * src, Pixel * dest, PluginInfo * info)
*/
}
VisualFX
convolve_create (void)
void
convolve_create (VisualFX * vfx)
{
VisualFX vfx = {
convolve_init,
convolve_free,
convolve_apply,
NULL
};
return vfx;
vfx->init = convolve_init;
vfx->free = convolve_free;
vfx->apply = convolve_apply;
vfx->fx_data = NULL;
vfx->params = NULL;
}
......@@ -176,10 +176,9 @@ typedef struct _ZOOM_FILTER_FX_WRAPPER_DATA
static inline v2g
zoomVector (ZoomFilterFXWrapperData * data, float X, float Y)
static inline void
zoomVector (v2g * vecteur, ZoomFilterFXWrapperData * data, float X, float Y)
{
v2g vecteur;
float vx, vy;
float sq_dist = X * X + Y * Y;
......@@ -260,10 +259,8 @@ zoomVector (ZoomFilterFXWrapperData * data, float X, float Y)
/* TODO : Water Mode */
// if (data->waveEffect)
vecteur.x = vx;
vecteur.y = vy;
return vecteur;
vecteur->x = vx;
vecteur->y = vy;
}
......@@ -303,7 +300,9 @@ makeZoomBufferStripe (ZoomFilterFXWrapperData * data, int INTERLACE_INCR)
float X = -((float) data->middleX) * ratio;
for (x = 0; x < data->prevX; x++) {
v2g vector = zoomVector (data, X, Y);
v2g vector;
zoomVector (&vector, data, X, Y);
/* Finish and avoid null displacement */
if (fabs (vector.x) < min)
......@@ -803,9 +802,9 @@ zoomFilterVisualFXWrapper_init (struct _VISUAL_FX *_this, PluginInfo * info)
data->wave = data->wavesp = 0;
data->enabled_bp = secure_b_param ("Enabled", 1);
secure_b_param (&data->enabled_bp, "Enabled", 1);
data->params = plugin_parameters ("Zoom Filter", 1);
plugin_parameters (&data->params, "Zoom Filter", 1);
data->params.params[0] = &data->enabled_bp;
_this->params = &data->params;
......@@ -840,17 +839,14 @@ zoomFilterVisualFXWrapper_apply (struct _VISUAL_FX *_this, Pixel * src,
{
}
VisualFX
zoomFilterVisualFXWrapper_create (void)
void
zoomFilterVisualFXWrapper_create (VisualFX * fx)
{
VisualFX fx;
fx.init = zoomFilterVisualFXWrapper_init;
fx.free = zoomFilterVisualFXWrapper_free;
fx.apply = zoomFilterVisualFXWrapper_apply;
fx.params = NULL;
fx.fx_data = NULL;
return fx;
fx->init = zoomFilterVisualFXWrapper_init;
fx->free = zoomFilterVisualFXWrapper_free;
fx->apply = zoomFilterVisualFXWrapper_apply;
fx->params = NULL;
fx->fx_data = NULL;
}
......
......@@ -112,33 +112,33 @@ fs_init (VisualFX * _this, PluginInfo * info)
data->stars = (Star *) malloc (data->maxStars * sizeof (Star));
data->nbStars = 0;
data->max_age_p = secure_i_param ("Fireworks Smallest Bombs");
secure_i_param (&data->max_age_p, "Fireworks Smallest Bombs");
IVAL (data->max_age_p) = 80;
IMIN (data->max_age_p) = 0;
IMAX (data->max_age_p) = 100;
ISTEP (data->max_age_p) = 1;
data->min_age_p = secure_i_param ("Fireworks Largest Bombs");
secure_i_param (&data->min_age_p, "Fireworks Largest Bombs");
IVAL (data->min_age_p) = 99;
IMIN (data->min_age_p) = 0;
IMAX (data->min_age_p) = 100;
ISTEP (data->min_age_p) = 1;
data->nbStars_limit_p = secure_i_param ("Max Number of Particules");
secure_i_param (&data->nbStars_limit_p, "Max Number of Particules");
IVAL (data->nbStars_limit_p) = 512;
IMIN (data->nbStars_limit_p) = 0;
IMAX (data->nbStars_limit_p) = data->maxStars;
ISTEP (data->nbStars_limit_p) = 64;
data->fx_mode_p = secure_i_param ("FX Mode");
secure_i_param (&data->fx_mode_p, "FX Mode");
IVAL (data->fx_mode_p) = data->fx_mode;
IMIN (data->fx_mode_p) = 1;
IMAX (data->fx_mode_p) = 3;
ISTEP (data->fx_mode_p) = 1;
data->nbStars_p = secure_f_feedback ("Number of Particules (% of Max)");
secure_f_feedback (&data->nbStars_p, "Number of Particules (% of Max)");
data->params = plugin_parameters ("Particule System", 7);
plugin_parameters (&data->params, "Particule System", 7);
data->params.params[0] = &data->fx_mode_p;
data->params.params[1] = &data->nbStars_limit_p;
data->params.params[2] = 0;
......@@ -350,14 +350,12 @@ fs_apply (VisualFX * _this, Pixel * src, Pixel * dest, PluginInfo * info)
}
}
VisualFX
flying_star_create (void)
void
flying_star_create (VisualFX * vfx)
{
VisualFX vfx = {
fs_init,
fs_free,
fs_apply,
NULL
};
return vfx;
vfx->init = fs_init;
vfx->free = fs_free;
vfx->apply = fs_apply;
vfx->fx_data = NULL;
vfx->params = NULL;
}
......@@ -97,15 +97,15 @@ typedef struct _PARAM {
#define IMAX(p) ((p).param.ival.max)
#define ISTEP(p) ((p).param.ival.step)
PluginParam goom_secure_param(void);
void goom_secure_param(PluginParam *p);
PluginParam goom_secure_f_param(const char *name);
PluginParam goom_secure_i_param(const char *name);
PluginParam goom_secure_b_param(const char *name, int value);
PluginParam goom_secure_s_param(const char *name);
void goom_secure_f_param(PluginParam *p, const char *name);
void goom_secure_i_param(PluginParam *p, const char *name);
void goom_secure_b_param(PluginParam *p, const char *name, int value);
void goom_secure_s_param(PluginParam *p, const char *name);
PluginParam goom_secure_f_feedback(const char *name);
PluginParam goom_secure_i_feedback(const char *name);
void goom_secure_f_feedback(PluginParam *p, const char *name);
void goom_secure_i_feedback(PluginParam *p, const char *name);
void goom_set_str_param_value(PluginParam *p, const char *str);
void goom_set_list_param_value(PluginParam *p, const char *str);
......@@ -117,7 +117,7 @@ typedef struct _PARAMETERS {
PluginParam **params;
} PluginParameters;
PluginParameters goom_plugin_parameters(const char *name, int nb);
void goom_plugin_parameters(PluginParameters *p, const char *name, int nb);
void goom_plugin_parameters_free(PluginParameters *p);
#define secure_param goom_secure_param
......
......@@ -91,16 +91,16 @@ goom_init (guint32 resx, guint32 resy)
goomInfo->cycle = 0;
goomInfo->star_fx = flying_star_create ();
flying_star_create (&goomInfo->star_fx);
goomInfo->star_fx.init (&goomInfo->star_fx, goomInfo);
goomInfo->zoomFilter_fx = zoomFilterVisualFXWrapper_create ();
zoomFilterVisualFXWrapper_create (&goomInfo->zoomFilter_fx);
goomInfo->zoomFilter_fx.init (&goomInfo->zoomFilter_fx, goomInfo);
goomInfo->tentacles_fx = tentacle_fx_create ();
tentacle_fx_create (&goomInfo->tentacles_fx);
goomInfo->tentacles_fx.init (&goomInfo->tentacles_fx, goomInfo);
goomInfo->convolve_fx = convolve_create ();
convolve_create (&goomInfo->convolve_fx);
goomInfo->convolve_fx.init (&goomInfo->convolve_fx, goomInfo);
plugin_info_add_visual (goomInfo, 0, &goomInfo->zoomFilter_fx);
......@@ -108,7 +108,7 @@ goom_init (guint32 resx, guint32 resy)
plugin_info_add_visual (goomInfo, 2, &goomInfo->star_fx);
plugin_info_add_visual (goomInfo, 3, &goomInfo->convolve_fx);
goomInfo->ifs_fx = ifs_visualfx_create ();
ifs_visualfx_create (&goomInfo->ifs_fx);
goomInfo->ifs_fx.init (&goomInfo->ifs_fx, goomInfo);
goomInfo->gmline1 = goom_lines_init (goomInfo, resx, goomInfo->screen.height,
......
......@@ -24,7 +24,7 @@
#include "goom_visual_fx.h"
#include "goom_graphic.h"
VisualFX zoomFilterVisualFXWrapper_create(void);
void zoomFilterVisualFXWrapper_create(VisualFX *fx);
struct _ZOOM_FILTER_DATA
{
......
......@@ -22,8 +22,8 @@
#include "goom_visual_fx.h"
#include "goom_plugin_info.h"
VisualFX convolve_create (void);
VisualFX flying_star_create (void);
void convolve_create (VisualFX *vfx);
void flying_star_create (VisualFX *vfx);
void zoom_filter_c(int sizeX, int sizeY, Pixel *src, Pixel *dest, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]);
......
......@@ -762,15 +762,13 @@ ifs_vfx_free (VisualFX * _this)
free (data);
}
VisualFX
ifs_visualfx_create (void)
void
ifs_visualfx_create (VisualFX * vfx)
{
VisualFX vfx;
vfx.init = ifs_vfx_init;
vfx.free = ifs_vfx_free;
vfx.apply = ifs_vfx_apply;
vfx.fx_data = NULL;
vfx.params = NULL;
return vfx;
vfx->init = ifs_vfx_init;
vfx->free = ifs_vfx_free;
vfx->apply = ifs_vfx_apply;
vfx->fx_data = NULL;
vfx->params = NULL;
}
......@@ -37,7 +37,7 @@
#include "goom_plugin_info.h"
#include "goom_visual_fx.h"
VisualFX ifs_visualfx_create(void);
void ifs_visualfx_create(VisualFX *vfx);
/* init ifs for a (width)x(height) output. * /
void init_ifs (PluginInfo *goomInfo, int width, int height);
......
......@@ -120,27 +120,27 @@ plugin_info_init (PluginInfo * pp, int nbVisuals)
p.sound.timeSinceLastBigGoom = 1;
p.sound.cycle = 0;
p.sound.volume_p = secure_f_feedback ("Sound Volume");
p.sound.accel_p = secure_f_feedback ("Sound Acceleration");
p.sound.speed_p = secure_f_feedback ("Sound Speed");
p.sound.goom_limit_p = secure_f_feedback ("Goom Limit");
p.sound.last_goom_p = secure_f_feedback ("Goom Detection");
p.sound.last_biggoom_p = secure_f_feedback ("Big Goom Detection");
p.sound.goom_power_p = secure_f_feedback ("Goom Power");
p.sound.biggoom_speed_limit_p = secure_i_param ("Big Goom Speed Limit");
secure_f_feedback (&p.sound.volume_p, "Sound Volume");
secure_f_feedback (&p.sound.accel_p, "Sound Acceleration");
secure_f_feedback (&p.sound.speed_p, "Sound Speed");
secure_f_feedback (&p.sound.goom_limit_p, "Goom Limit");
secure_f_feedback (&p.sound.last_goom_p, "Goom Detection");
secure_f_feedback (&p.sound.last_biggoom_p, "Big Goom Detection");
secure_f_feedback (&p.sound.goom_power_p, "Goom Power");
secure_i_param (&p.sound.biggoom_speed_limit_p, "Big Goom Speed Limit");
IVAL (p.sound.biggoom_speed_limit_p) = 10;
IMIN (p.sound.biggoom_speed_limit_p) = 0;
IMAX (p.sound.biggoom_speed_limit_p) = 100;
ISTEP (p.sound.biggoom_speed_limit_p) = 1;
p.sound.biggoom_factor_p = secure_i_param ("Big Goom Factor");
secure_i_param (&p.sound.biggoom_factor_p, "Big Goom Factor");
IVAL (p.sound.biggoom_factor_p) = 10;
IMIN (p.sound.biggoom_factor_p) = 0;
IMAX (p.sound.biggoom_factor_p) = 100;
ISTEP (p.sound.biggoom_factor_p) = 1;
p.sound.params = plugin_parameters ("Sound", 11);
plugin_parameters (&p.sound.params, "Sound", 11);
p.nbParams = 0;
p.params = NULL;
......
......@@ -72,8 +72,8 @@ tentacle_fx_init (VisualFX * _this, PluginInfo * info)
TentacleFXData *data = (TentacleFXData *) malloc (sizeof (TentacleFXData));
data->enabled_bp = secure_b_param ("Enabled", 1);
data->params = plugin_parameters ("3D Tentacles", 1);
secure_b_param (&data->enabled_bp, "Enabled", 1);
plugin_parameters (&data->params, "3D Tentacles", 1);
data->params.params[0] = &data->enabled_bp;
data->cycle = 0.0f;
......@@ -125,17 +125,14 @@ tentacle_fx_free (VisualFX * _this)
free (_this->fx_data);
}
VisualFX
tentacle_fx_create (void)
void
tentacle_fx_create (VisualFX * fx)
{
VisualFX fx;
fx.init = tentacle_fx_init;
fx.apply = tentacle_fx_apply;
fx.free = tentacle_fx_free;
fx.fx_data = NULL;
fx.params = NULL;
return fx;
fx->init = tentacle_fx_init;
fx->apply = tentacle_fx_apply;
fx->free = tentacle_fx_free;
fx->fx_data = NULL;
fx->params = NULL;
}
/* ----- */
......
......@@ -21,6 +21,6 @@
#include "goom_visual_fx.h"
VisualFX tentacle_fx_create(void);
void tentacle_fx_create(VisualFX *fx);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment