Style Cleanup

This commit is contained in:
2013-12-10 13:44:46 +11:00
parent 07d0926796
commit 8dc80e9d73
10 changed files with 37 additions and 35 deletions

View File

@@ -216,10 +216,10 @@ static const float EWA_WTS[EWA_MAXIDX + 1] = {
static void ellipse_bounds(float A, float B, float C, float F, float &xmax, float &ymax)
{
float denom = 4.0f*A*C - B*B;
float denom = 4.0f * A * C - B * B;
if (denom > 0.0f && A != 0.0f && C != 0.0f) {
xmax = sqrt(F)/(2.0f*A) * (sqrt(F*(4.0f*A - B*B/C)) + B*B*sqrt(F/(C*denom)));
ymax = sqrt(F)/(2.0f*C) * (sqrt(F*(4.0f*C - B*B/A)) + B*B*sqrt(F/(A*denom)));
xmax = sqrt(F) / (2.0f * A) * (sqrt(F * (4.0f * A - B * B / C)) + B * B * sqrt(F / (C * denom)));
ymax = sqrt(F) / (2.0f * C) * (sqrt(F * (4.0f * C - B * B / A)) + B * B * sqrt(F / (A * denom)));
}
else {
xmax = 0.0f;
@@ -227,18 +227,19 @@ static void ellipse_bounds(float A, float B, float C, float F, float &xmax, floa
}
}
static void ellipse_params(float Ux, float Uy, float Vx, float Vy, float &A, float &B, float &C, float &F, float &umax, float &vmax)
static void ellipse_params(float Ux, float Uy, float Vx, float Vy,
float &A, float &B, float &C, float &F, float &umax, float &vmax)
{
A = Vx*Vx + Vy*Vy;
B = -2.0f * (Ux*Vx + Uy*Vy);
C = Ux*Ux + Uy*Uy;
F = A*C - B*B * 0.25f;
A = Vx * Vx + Vy * Vy;
B = -2.0f * (Ux * Vx + Uy * Vy);
C = Ux * Ux + Uy * Uy;
F = A * C - B * B * 0.25f;
float factor = (F != 0.0f ? (float)(EWA_MAXIDX+1) / F : 0.0f);
float factor = (F != 0.0f ? (float)(EWA_MAXIDX + 1) / F : 0.0f);
A *= factor;
B *= factor;
C *= factor;
F = (float)(EWA_MAXIDX+1);
F = (float)(EWA_MAXIDX + 1);
ellipse_bounds(A, B, C, sqrtf(F), umax, vmax);
}
@@ -282,31 +283,31 @@ void MemoryBuffer::readEWA(float result[4], const float uv[2], const float deriv
/* note: if eccentricity gets clamped (see above),
* the ue/ve limits can also be lowered accordingly
*/
if (U0-u1 > EWA_MAXIDX) u1 = U0 - EWA_MAXIDX;
if (u2-U0 > EWA_MAXIDX) u2 = U0 + EWA_MAXIDX;
if (V0-v1 > EWA_MAXIDX) v1 = V0 - EWA_MAXIDX;
if (v2-V0 > EWA_MAXIDX) v2 = V0 + EWA_MAXIDX;
if (U0 - u1 > EWA_MAXIDX) u1 = U0 - EWA_MAXIDX;
if (u2 - U0 > EWA_MAXIDX) u2 = U0 + EWA_MAXIDX;
if (V0 - v1 > EWA_MAXIDX) v1 = V0 - EWA_MAXIDX;
if (v2 - V0 > EWA_MAXIDX) v2 = V0 + EWA_MAXIDX;
float DDQ = 2.f * A;
float DDQ = 2.0f * A;
float U = u1 - U0;
float ac1 = A * (2.f*U + 1.f);
float ac2 = A * U*U;
float ac1 = A * (2.0f * U + 1.0f);
float ac2 = A * U * U;
float BU = B * U;
float sum = 0.0f;
for (int v = v1; v <= v2; ++v) {
float V = v - V0;
float DQ = ac1 + B*V;
float Q = (C*V + BU)*V + ac2;
float DQ = ac1 + B * V;
float Q = (C * V + BU) * V + ac2;
for (int u = u1; u <= u2; ++u) {
if (Q < F) {
float tc[4];
const float wt = EWA_WTS[CLAMPIS((int)Q, 0, EWA_MAXIDX)];
switch (sampler) {
case COM_PS_NEAREST: read(tc, u, v); break;
case COM_PS_BILINEAR: readBilinear(tc, (float)u+ufac, (float)v+vfac); break;
case COM_PS_BICUBIC: readBilinear(tc, (float)u+ufac, (float)v+vfac); break; /* XXX no readBicubic method yet */
case COM_PS_BILINEAR: readBilinear(tc, (float)u + ufac, (float)v + vfac); break;
case COM_PS_BICUBIC: readBilinear(tc, (float)u + ufac, (float)v + vfac); break; /* XXX no readBicubic method yet */
default: zero_v4(tc); break;
}
madd_v4_v4fl(result, tc, wt);

View File

@@ -72,8 +72,8 @@ bool DisplaceOperation::read_displacement(float x, float y, float xscale, float
else {
float col[4];
m_inputVectorProgram->readSampled(col, x, y, COM_PS_BILINEAR);
r_u = origin[0] - col[0]*xscale + 0.5f;
r_v = origin[1] - col[1]*yscale + 0.5f;
r_u = origin[0] - col[0] * xscale + 0.5f;
r_v = origin[1] - col[1] * yscale + 0.5f;
return true;
}
}

View File

@@ -2344,7 +2344,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
int autocomplete = ui_textedit_autocomplete(C, but, data);
changed = autocomplete != AUTOCOMPLETE_NO_MATCH;
if(autocomplete == AUTOCOMPLETE_FULL_MATCH)
if (autocomplete == AUTOCOMPLETE_FULL_MATCH)
button_activate_state(C, but, BUTTON_STATE_EXIT);
update = true; /* do live update for tab key */
@@ -2595,7 +2595,7 @@ int ui_button_open_menu_direction(uiBut *but)
}
/* Hack for uiList LISTROW buttons to "give" events to overlaying TEX buttons (cltr-clic rename feature & co). */
static uiBut* ui_but_list_row_text_activate(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event,
static uiBut *ui_but_list_row_text_activate(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event,
uiButtonActivateType activate_type)
{
ARegion *ar = CTX_wm_region(C);

View File

@@ -1025,9 +1025,9 @@ static void area_move_set_limits(bScreen *sc, int dir, int winsizex, int winsize
int x1;
areamin = AREAMINX;
if(sa->v1->vec.x > 0)
if (sa->v1->vec.x > 0)
areamin += U.pixelsize;
if(sa->v4->vec.x < winsizex - 1)
if (sa->v4->vec.x < winsizex - 1)
areamin += U.pixelsize;
x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin;

View File

@@ -1253,7 +1253,7 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg_but)
{
SpaceFile *sfile = CTX_wm_space_file(C);
uiBut *but = (uiBut*)arg_but;
uiBut *but = arg_but;
char matched_file[FILE_MAX];
char filepath[sizeof(sfile->params->dir)];

View File

@@ -1880,7 +1880,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
if (support_undo) {
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
ED_image_undo_restore, ED_image_undo_free);
ED_image_undo_restore, ED_image_undo_free);
/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
* but better do this right in case someone copies this for a tool that uses partial redraw better */
ED_imapaint_clear_partial_redraw();

View File

@@ -402,8 +402,8 @@ static EnumPropertyItem *rna_Particule_Material_itemf(bContext *C, PointerRNA *U
int totitem = 0;
int i;
if (ob->totcol > 0){
for (i = 1; i<=ob->totcol; i++) {
if (ob->totcol > 0) {
for (i = 1; i <= ob->totcol; i++) {
ma = give_current_material(ob, i);
tmp.value = i;
tmp.icon = ICON_MATERIAL_DATA;

View File

@@ -352,7 +352,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
"Subdivide Edges", "Subdivide long edges to add mesh detail where needed"},
{SCULPT_DYNTOPO_COLLAPSE, "COLLAPSE", 0,
"Collapse Edges", "Collapse short edges to remove mesh detail where possible"},
{SCULPT_DYNTOPO_SUBDIVIDE|SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
{SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
"Subdivide Collapse", "Both subdivide long edges and collapse short edges to refine mesh detail"},
{0, NULL, 0, NULL, NULL}
};

View File

@@ -218,7 +218,8 @@ static void update(bNodeTree *ntree)
}
}
static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode) {
static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode)
{
/* Composite node will only show previews for input classes
* by default, other will be hidden
* but can be made visible with the show_preview option */

View File

@@ -367,7 +367,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
x = cursorx - drag->sx / 2;
if (cursory + drag->sy / 2 + padding + iconsize < winsizey)
y = cursory + drag->sy / 2 + padding;
y = cursory + drag->sy / 2 + padding;
else
y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize;
}
@@ -375,7 +375,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
x = cursorx - 2 * padding;
if (cursory + iconsize + iconsize < winsizey)
y = cursory + iconsize;
y = cursory + iconsize;
else
y = cursory - iconsize - 2 * UI_DPI_FAC;
}