interface: floats were being implicitly promoted to doubles, adjust to use floats (in most cases) otherwise cast to double.

This commit is contained in:
2011-03-27 14:52:16 +00:00
parent 0b9f67061c
commit 8d7c3f8a7e
14 changed files with 217 additions and 213 deletions

View File

@@ -173,7 +173,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
/* for each AA step */
for(j=0; j<8; j++) {
glTranslatef(1.0*jit[j][0], 1.0*jit[j][1], 0.0f);
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
glBegin(GL_POLYGON);
glVertex2f(x1, y1);
@@ -181,7 +181,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glVertex2f(x3, y3);
glEnd();
glTranslatef(-1.0*jit[j][0], -1.0*jit[j][1], 0.0f);
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
glDisable(GL_BLEND);
@@ -696,7 +696,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* for each AA step */
if(wtb->outline) {
for(j=0; j<8; j++) {
glTranslatef(1.0*jit[j][0], 1.0*jit[j][1], 0.0f);
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
/* outline */
glColor4ub(wcol->outline[0], wcol->outline[1], wcol->outline[2], 32);
@@ -720,7 +720,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glEnd();
}
glTranslatef(-1.0*jit[j][0], -1.0*jit[j][1], 0.0f);
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
}
@@ -728,7 +728,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
if(wtb->tria1.tot || wtb->tria2.tot) {
/* for each AA step */
for(j=0; j<8; j++) {
glTranslatef(1.0*jit[j][0], 1.0*jit[j][1], 0.0f);
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
if(wtb->tria1.tot) {
glColor4ub(wcol->item[0], wcol->item[1], wcol->item[2], 32);
@@ -739,7 +739,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
widget_trias_draw(&wtb->tria2);
}
glTranslatef(-1.0*jit[j][0], -1.0*jit[j][1], 0.0f);
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
}
}
@@ -1700,7 +1700,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
else
*valdist= 1.0f;
*valrad= atan2(mx, my)/(2.0f*M_PI) + 0.5f;
*valrad= atan2f(mx, my)/(2.0f*(float)M_PI) + 0.5f;
}
static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
@@ -1715,7 +1715,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
radstep= 2.0f*M_PI/(float)tot;
radstep= 2.0f*(float)M_PI/(float)tot;
centx= (float)(rect->xmin + rect->xmax)/2;
centy= (float)(rect->ymin + rect->ymax)/2;
@@ -1773,14 +1773,14 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glPopMatrix();
/* cursor */
ang= 2.0f*M_PI*hsvo[0] + 0.5f*M_PI;
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
if(but->flag & UI_BUT_COLOR_CUBIC)
radius= (1.0f - pow(1.0f - hsvo[1], 3.0f)) *radius;
radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius;
else
radius= hsvo[1] * radius;
ui_hsv_cursor(centx + cos(-ang)*radius, centy + sin(-ang)*radius);
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
}
@@ -1845,7 +1845,7 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
/* old below */
for(dx=0.0; dx<1.0; dx+= 0.05) {
for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
// previous color
VECCOPY(col0[0], col1[0]);
VECCOPY(col0[1], col1[1]);
@@ -1894,7 +1894,7 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
// rect
sx1= rect->xmin + dx*(rect->xmax-rect->xmin);
sx2= rect->xmin + (dx+0.05)*(rect->xmax-rect->xmin);
sx2= rect->xmin + (dx+0.05f)*(rect->xmax-rect->xmin);
sy= rect->ymin;
dy= (rect->ymax-rect->ymin)/3.0;
@@ -1959,8 +1959,8 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
/* cursor */
x= rect->xmin + x*(rect->xmax-rect->xmin);
y= rect->ymin + y*(rect->ymax-rect->ymin);
CLAMP(x, rect->xmin+3.0, rect->xmax-3.0);
CLAMP(y, rect->ymin+3.0, rect->ymax-3.0);
CLAMP(x, rect->xmin+3.0f, rect->xmax-3.0f);
CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
ui_hsv_cursor(x, y);
@@ -2009,7 +2009,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
/* cursor */
x= rect->xmin + 0.5f * (rect->xmax-rect->xmin);
y= rect->ymin + v * (rect->ymax-rect->ymin);
CLAMP(y, rect->ymin+3.0, rect->ymax-3.0);
CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
ui_hsv_cursor(x, y);
@@ -2039,7 +2039,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
{
uiWidgetBase wtb;
float rad= 0.5f*(rect->ymax - rect->ymin);
float textofs = rad*0.75;
float textofs = rad*0.75f;
if(state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
@@ -2210,8 +2210,8 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
if(horizontal) {
fac= (rect->xmax - rect->xmin)/(size);
rect1.xmin= rect1.xmin + ceil(fac*(value - but->softmin));
rect1.xmax= rect1.xmin + ceil(fac*(but->a1 - but->softmin));
rect1.xmin= rect1.xmin + ceilf(fac*((float)value - but->softmin));
rect1.xmax= rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
/* ensure minimium size */
min= rect->ymax - rect->ymin;
@@ -2227,8 +2227,8 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
}
else {
fac= (rect->ymax - rect->ymin)/(size);
rect1.ymax= rect1.ymax - ceil(fac*(value - but->softmin));
rect1.ymin= rect1.ymax - ceil(fac*(but->a1 - but->softmin));
rect1.ymax= rect1.ymax - ceilf(fac*((float)value - but->softmin));
rect1.ymin= rect1.ymax - ceilf(fac*(but->a1 - but->softmin));
/* ensure minimium size */
min= rect->xmax - rect->xmin;
@@ -2325,7 +2325,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
rect1= *rect;
value= ui_get_but_val(but);
fac= (value-but->softmin)*(rect1.xmax - rect1.xmin - offs)/(but->softmax - but->softmin);
fac= ((float)value-but->softmin)*(rect1.xmax - rect1.xmin - offs)/(but->softmax - but->softmin);
/* left part of slider, always rounded */
rect1.xmax= rect1.xmin + ceil(offs+1.0f);