diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 16:21:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-27 16:21:13 +0400 |
commit | 2ab62ce126651c600a8039de0dd95a4e3c02ea47 (patch) | |
tree | 7bd05d0ffa253332de7328d77e0d712fea6ae880 /source | |
parent | aa6301674471500f74d3984d6d17d82ad5e8724f (diff) |
code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function.
... without this some editors dont parse the source so well.
Diffstat (limited to 'source')
18 files changed, 109 insertions, 83 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index e4309a64e56..d26a722b628 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -275,9 +275,9 @@ static int ccg_edgebase(int level) /***/ -#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } -#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } -#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } +#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0 +#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } (void)0 +#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0 /***/ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 25e34bf1879..26516b62aa3 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1310,7 +1310,7 @@ void clear_id_newpoins(void) } } -#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } +#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0 static void lib_indirect_test_id(ID *id, Library *lib) { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index a60bb98ac18..669ae4f198a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -103,11 +103,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, MDeformVert *dverts, /* assume totvert length */ const short do_verbose, const short do_fixes) { -# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } +# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) -# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } -# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } +# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 +# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 MVert *mv = mverts; MEdge *me; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 66dd23e76b9..cd5efb9951b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3751,9 +3751,14 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co return 1; } -#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \ + if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \ + if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \ + if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { @@ -3884,26 +3889,26 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex else ptex->time = texture_value_blend(def, ptex->time, value, mtex->timefac, blend); } - SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac) - SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac) - SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac) - SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac) - SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac) - SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac) - SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac) - SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac) + SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac); + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); + SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac); + SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac); + SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac); + SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac); + SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac); + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); } } - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); } /************************************************/ /* Particle State */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 90d17e53349..91023513d4d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -99,8 +99,15 @@ # include "BLI_winstuff.h" #endif -#define PTCACHE_DATA_FROM(data, type, from) if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); } -#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); } +#define PTCACHE_DATA_FROM(data, type, from) \ + if (data[type]) { \ + memcpy(data[type], from, ptcache_data_size[type]); \ + } (void)0 + +#define PTCACHE_DATA_TO(data, type, index, to) \ + if (data[type]) { \ + memcpy(to, (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), ptcache_data_size[type]); \ + } (void)0 /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 02065c4b86f..22672db9edb 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -135,7 +135,7 @@ #endif #ifndef SWAP -# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } +# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0 #endif #ifndef CLAMP diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index d027a3da2ef..f027fb57842 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -114,7 +114,7 @@ /* some math and copy defines */ #ifndef SWAP -# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } +# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0 #endif #define ABS(a) ( (a) < 0 ? (-(a)) : (a) ) diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index a828ab5b3f4..a265505cc8f 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -38,7 +38,7 @@ #include "BLI_kdtree.h" #ifndef SWAP -# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } +# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0 #endif typedef struct KDTreeNode { diff --git a/source/blender/blenpluginapi/util.h b/source/blender/blenpluginapi/util.h index 8a049350bc6..68f9626ac24 100644 --- a/source/blender/blenpluginapi/util.h +++ b/source/blender/blenpluginapi/util.h @@ -75,7 +75,7 @@ #define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) ) #define MAX4(x,y,z,a) MAX2( MAX2((x),(y)) , MAX2((z),(a)) ) -#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } +#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } (void)0 #define ABS(x) ((x) < 0 ? -(x) : (x)) #define FLOOR(x) ((int)(x) - ((x) < 0 && (x) != (int)(x))) diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index a629312e732..20b95ea55d6 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -475,8 +475,8 @@ static void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node) } #else -#define NodeDegreeDecrement(rg, node) {node->degree--; } -#define NodeDegreeIncrement(rg, node) {node->degree++; } +# define NodeDegreeDecrement(rg, node) {node->degree--; } (void)0 +# define NodeDegreeIncrement(rg, node) {node->degree++; } (void)0 #endif void repositionNodes(ReebGraph *rg) diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index bdb70696742..3020fe6985a 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -43,9 +43,9 @@ struct Scene; /* --------- BezTriple Selection ------------- */ -#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } -#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } -#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; } +#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } (void)0 +#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } (void)0 +#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; } (void)0 /* --------- Tool Flags ------------ */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5394cb46049..d26c8cefdf0 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -81,7 +81,7 @@ /* avoid unneeded calls to ui_get_but_val */ #define UI_BUT_VALUE_UNSET DBL_MAX -#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value) = ui_get_but_val(_but); } +#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value) = ui_get_but_val(_but); } (void)0 /* * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt @@ -660,8 +660,8 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut /* typically the same pointers, but not on undo/redo */ /* XXX some menu buttons store button itself in but->poin. Ugly */ if (oldbut->poin != (char *)oldbut) { - SWAP(char *, oldbut->poin, but->poin) - SWAP(void *, oldbut->func_argN, but->func_argN) + SWAP(char *, oldbut->poin, but->poin); + SWAP(void *, oldbut->func_argN, but->func_argN); } /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position @@ -1090,7 +1090,7 @@ static void ui_is_but_sel(uiBut *but, double *value) if (but->bit) { int lvalue; - UI_GET_BUT_VALUE_INIT(but, *value) + UI_GET_BUT_VALUE_INIT(but, *value); lvalue = (int)*value; if (BTST(lvalue, (but->bitnr)) ) is_push = is_true; else is_push = !is_true; @@ -1111,18 +1111,18 @@ static void ui_is_but_sel(uiBut *but, double *value) case BUT_TOGDUAL: case ICONTOG: case OPTION: - UI_GET_BUT_VALUE_INIT(but, *value) + UI_GET_BUT_VALUE_INIT(but, *value); if (*value != (double)but->hardmin) is_push = 1; break; case ICONTOGN: case TOGN: case OPTIONN: - UI_GET_BUT_VALUE_INIT(but, *value) + UI_GET_BUT_VALUE_INIT(but, *value); if (*value == 0.0) is_push = 1; break; case ROW: case LISTROW: - UI_GET_BUT_VALUE_INIT(but, *value) + UI_GET_BUT_VALUE_INIT(but, *value); /* support for rna enum buts */ if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) { if ((int)*value & (int)but->hardmax) is_push = 1; @@ -2171,7 +2171,7 @@ void ui_check_but(uiBut *but) /* only update soft range while not editing */ if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) { - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); ui_set_but_soft_range(but, value); } @@ -2182,7 +2182,7 @@ void ui_check_but(uiBut *but) case SCROLL: case NUMSLI: case HSVSLI: - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin); else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax); break; @@ -2190,7 +2190,7 @@ void ui_check_but(uiBut *but) case NUMABS: { double value_abs; - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); value_abs = fabs(value); if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin); else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax); @@ -2206,14 +2206,14 @@ void ui_check_but(uiBut *but) case ICONROW: if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); but->iconadd = (int)value - (int)(but->hardmin); } break; case ICONTEXTROW: if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); but->iconadd = (int)value - (int)(but->hardmin); } break; @@ -2230,7 +2230,7 @@ void ui_check_but(uiBut *but) case ICONTEXTROW: if (but->x2 - but->x1 > 24) { - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); ui_set_name_menu(but, (int)value); } break; @@ -2240,7 +2240,7 @@ void ui_check_but(uiBut *but) case HSVSLI: case NUMABS: - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); if (ui_is_but_float(but)) { if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); @@ -2271,7 +2271,7 @@ void ui_check_but(uiBut *but) case LABEL: if (ui_is_but_float(but)) { int prec; - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); prec = ui_but_float_precision(but, value); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } @@ -2299,7 +2299,7 @@ void ui_check_but(uiBut *but) strcat(but->drawstr, "Press a key"); } else { - UI_GET_BUT_VALUE_INIT(but, value) + UI_GET_BUT_VALUE_INIT(but, value); strcat(but->drawstr, WM_key_event_string((short)value)); } break; diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 19864ed58cf..40b653a62fd 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -455,7 +455,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op) ob->shapenr++; } - SWAP(float, kb_other->pos, kb->pos) /* for absolute shape keys */ + SWAP(float, kb_other->pos, kb->pos); /* for absolute shape keys */ } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 3efdf76f233..51f047b94ff 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -180,28 +180,29 @@ extern void node_ID_title_cb(void *node_v, void *unused_v); /* soms macros for color handling */ typedef float fRGB[4]; /* clear color */ -#define fRGB_clear(c) { c[0]=c[1]=c[2]=0.f; } +#define fRGB_clear(c) { c[0]=c[1]=c[2]=0.f; } (void)0 /* copy c2 to c1 */ -#define fRGB_copy(c1, c2) { c1[0]=c2[0]; c1[1]=c2[1]; c1[2]=c2[2]; c1[3]=c2[3]; } +#define fRGB_copy(c1, c2) { c1[0]=c2[0]; c1[1]=c2[1]; c1[2]=c2[2]; c1[3]=c2[3]; } (void)0 /* add c2 to c1 */ -#define fRGB_add(c1, c2) { c1[0]+=c2[0]; c1[1]+=c2[1]; c1[2]+=c2[2]; } +#define fRGB_add(c1, c2) { c1[0]+=c2[0]; c1[1]+=c2[1]; c1[2]+=c2[2]; } (void)0 /* subtract c2 from c1 */ -#define fRGB_sub(c1, c2) { c1[0]-=c2[0]; c1[1]-=c2[1]; c1[2]-=c2[2]; } +#define fRGB_sub(c1, c2) { c1[0]-=c2[0]; c1[1]-=c2[1]; c1[2]-=c2[2]; } (void)0 /* multiply c by float value s */ -#define fRGB_mult(c, s) { c[0]*=s; c[1]*=s; c[2]*=s; } +#define fRGB_mult(c, s) { c[0]*=s; c[1]*=s; c[2]*=s; } (void)0 /* multiply c2 by s and add to c1 */ -#define fRGB_madd(c1, c2, s) { c1[0]+=c2[0]*s; c1[1]+=c2[1]*s; c1[2]+=c2[2]*s; } +#define fRGB_madd(c1, c2, s) { c1[0]+=c2[0]*s; c1[1]+=c2[1]*s; c1[2]+=c2[2]*s; } (void)0 /* multiply c2 by color c1 */ -#define fRGB_colormult(c, cs) { c[0]*=cs[0]; c[1]*=cs[1]; c[2]*=cs[2]; } +#define fRGB_colormult(c, cs) { c[0]*=cs[0]; c[1]*=cs[1]; c[2]*=cs[2]; } (void)0 /* multiply c2 by color c3 and add to c1 */ -#define fRGB_colormadd(c1, c2, c3) { c1[0]+=c2[0]*c3[0]; c1[1]+=c2[1]*c3[1]; c1[2]+=c2[2]*c3[2]; } +#define fRGB_colormadd(c1, c2, c3) { c1[0]+=c2[0]*c3[0]; c1[1]+=c2[1]*c3[1]; c1[2]+=c2[2]*c3[2]; } (void)0 /* multiply c2 by color rgb, rgb as separate arguments */ -#define fRGB_rgbmult(c, r, g, b) { c[0]*=(r); c[1]*=(g); c[2]*=(b); } +#define fRGB_rgbmult(c, r, g, b) { c[0]*=(r); c[1]*=(g); c[2]*=(b); } (void)0 /* swap colors c1 & c2 */ #define fRGB_swap(c1, c2) { float _t=c1[0]; c1[0]=c2[0]; c2[0]=_t;\ - _t=c1[1]; c1[1]=c2[1]; c2[1]=_t;\ - _t=c1[2]; c1[2]=c2[2]; c2[2]=_t;\ - _t=c1[3]; c1[3]=c2[3]; c3[3]=_t;} + _t=c1[1]; c1[1]=c2[1]; c2[1]=_t;\ + _t=c1[2]; c1[2]=c2[2]; c2[2]=_t;\ + _t=c1[3]; c1[3]=c2[3]; c3[3]=_t;\ + } (void)0 void qd_getPixel(CompBuf* src, int x, int y, float* col); void qd_setPixel(CompBuf* src, int x, int y, float* col); diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index a66165d4680..284b386ca33 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -34,11 +34,6 @@ #include "render_types.h" - -/* vector defines */ - -#define CROSS(dest, a, b) { dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0]; } - struct HaloRen; struct ShadeInput; struct ShadeResult; diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c index 151464064cb..b282cc8459f 100644 --- a/source/blender/render/intern/source/pixelblending.c +++ b/source/blender/render/intern/source/pixelblending.c @@ -306,17 +306,27 @@ void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, in /* loop unroll */ -#define MASKFILT(i, j) val= lfilt[i][j]; if (val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; } +#define MASKFILT(i, j) \ + val = lfilt[i][j]; \ + if (val != 0.0f) { \ + float *fp = fpoin[i][j]; \ + fp[0] += val * r; \ + fp[1] += val * g; \ + fp[2] += val * b; \ + fp[3] += val * al; \ + } (void)0 - MASKFILT(0, 0) - MASKFILT(0, 1) - MASKFILT(0, 2) - MASKFILT(1, 0) - MASKFILT(1, 1) - MASKFILT(1, 2) - MASKFILT(2, 0) - MASKFILT(2, 1) - MASKFILT(2, 2) + MASKFILT(0, 0); + MASKFILT(0, 1); + MASKFILT(0, 2); + MASKFILT(1, 0); + MASKFILT(1, 1); + MASKFILT(1, 2); + MASKFILT(2, 0); + MASKFILT(2, 1); + MASKFILT(2, 2); + +#undef MASKFILT } void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize) diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index f842dc0ff1b..82f2add7c3d 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -451,11 +451,19 @@ static float area_lamp_energy(float (*area)[3], const float co[3], const float v Normalize_d(vec[3]); /* cross product */ +#define CROSS(dest, a, b) \ + { dest[0]= a[1] * b[2] - a[2] * b[1]; \ + dest[1]= a[2] * b[0] - a[0] * b[2]; \ + dest[2]= a[0] * b[1] - a[1] * b[0]; \ + } (void)0 + CROSS(cross[0], vec[0], vec[1]); CROSS(cross[1], vec[1], vec[2]); CROSS(cross[2], vec[2], vec[3]); CROSS(cross[3], vec[3], vec[0]); +#undef CROSS + Normalize_d(cross[0]); Normalize_d(cross[1]); Normalize_d(cross[2]); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 8484e82c66c..ecde9bb2de8 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1982,7 +1982,7 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3 /* ************** ZMASK ******************************** */ -#define EXTEND_PIXEL(a) if (temprectp[a]) {z+= rectz[a]; tot++;} +#define EXTEND_PIXEL(a) if (temprectp[a]) { z += rectz[a]; tot++; } (void)0 /* changes the zbuffer to be ready for z-masking: applies an extend-filter, and then clears */ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg) |