diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-27 18:52:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-27 18:52:16 +0400 |
commit | 8d7c3f8a7e6de7625b3631cd91242fbefa98cf3a (patch) | |
tree | e839ba73dfdff4795060b63fa88c1fdecdf03b73 /source/blender/editors/interface/interface_draw.c | |
parent | 0b9f67061ce34e6147a013cc7025bb194c4e693e (diff) |
interface: floats were being implicitly promoted to doubles, adjust to use floats (in most cases) otherwise cast to double.
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 659bb41eec0..f8ce278814f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -144,9 +144,9 @@ static void round_box_shade_col(float *col1, float *col2, float fac) { float col[3]; - col[0]= (fac*col1[0] + (1.0-fac)*col2[0]); - col[1]= (fac*col1[1] + (1.0-fac)*col2[1]); - col[2]= (fac*col1[2] + (1.0-fac)*col2[2]); + col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]); + col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]); + col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]); glColor3fv(col); } @@ -170,12 +170,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - coltop[0]= color[0]+shadetop; if(coltop[0]>1.0) coltop[0]= 1.0; - coltop[1]= color[1]+shadetop; if(coltop[1]>1.0) coltop[1]= 1.0; - coltop[2]= color[2]+shadetop; if(coltop[2]>1.0) coltop[2]= 1.0; - coldown[0]= color[0]+shadedown; if(coldown[0]<0.0) coldown[0]= 0.0; - coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0; - coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0; + coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f; + coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f; + coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f; + coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f; + coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f; + coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f; glShadeModel(GL_SMOOTH); glBegin(mode); @@ -277,12 +277,12 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glGetFloatv(GL_CURRENT_COLOR, color); /* 'shade' defines strength of shading */ - colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0) colLeft[0]= 1.0; - colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0) colLeft[1]= 1.0; - colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0) colLeft[2]= 1.0; - colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0) colRight[0]= 0.0; - colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0) colRight[1]= 0.0; - colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0) colRight[2]= 0.0; + colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0f) colLeft[0]= 1.0f; + colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0f) colLeft[1]= 1.0f; + colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0f) colLeft[2]= 1.0f; + colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0f) colRight[0]= 0.0f; + colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0f) colRight[1]= 0.0f; + colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0f) colRight[2]= 0.0f; glShadeModel(GL_SMOOTH); glBegin(mode); @@ -951,9 +951,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* min max */ for (c=0; c<3; c++) { if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) - glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75); + glColor3f(colors[c][0]*0.75f, colors[c][1]*0.75f, colors[c][2]*0.75f); else - glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75); + glColor3f(colorsycc[c][0]*0.75f, colorsycc[c][1]*0.75f, colorsycc[c][2]*0.75f); min= yofs+scopes->minmax[c][0]*h; max= yofs+scopes->minmax[c][1]*h; CLAMP(min, rect.ymin, rect.ymax); @@ -986,15 +986,15 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl rgb_to_yuv(r,g,b, &y, &u, &v); if (u>0 && v>=0) tangle=atanf(v/u); - else if (u>0 && v<0) tangle=atanf(v/u)+2*M_PI; - else if (u<0) tangle=atanf(v/u)+M_PI; - else if (u==0 && v>0) tangle=M_PI/2.0f; - else if (u==0 && v<0) tangle=-M_PI/2.0f; + else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI; + else if (u<0) tangle=atanf(v/u) + (float)M_PI; + else if (u==0 && v > 0.0f) tangle= (float)M_PI/2.0f; + else if (u==0 && v < 0.0f) tangle=-(float)M_PI/2.0f; tampli= sqrtf(u*u+v*v); /* small target vary by 2.5 degree and 2.5 IRE unit */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 2.5*M_PI/180.0f; + dangle= 2.5f*(float)M_PI/180.0f; dampli= 2.5f/200.0f; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); @@ -1005,9 +1005,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl glEnd(); /* big target vary by 10 degree and 20% amplitude */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 10*M_PI/180.0f; - dampli= 0.2*tampli; - dangle2= 5.0f*M_PI/180.0f; + dangle= 10.0f*(float)M_PI/180.0f; + dampli= 0.2f*tampli; + dangle2= 5.0f*(float)M_PI/180.0f; dampli2= 0.5f*dampli; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle)); @@ -1131,13 +1131,13 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) sizey= rect->ymax-y1; /* first background, to show tranparency */ - dx= sizex/12.0; + dx= sizex/12.0f; v1[0]= x1; for(a=0; a<12; a++) { if(a & 1) glColor3f(0.3, 0.3, 0.3); else glColor3f(0.8, 0.8, 0.8); - glRectf(v1[0], y1, v1[0]+dx, y1+0.5*sizey); + glRectf(v1[0], y1, v1[0]+dx, y1+0.5f*sizey); if(a & 1) glColor3f(0.8, 0.8, 0.8); else glColor3f(0.3, 0.3, 0.3); - glRectf(v1[0], y1+0.5*sizey, v1[0]+dx, y1+sizey); + glRectf(v1[0], y1+0.5f*sizey, v1[0]+dx, y1+sizey); v1[0]+= dx; } @@ -1178,9 +1178,9 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) /* help lines */ v1[0]= v2[0]=v3[0]= x1; v1[1]= y1; - v1a[1]= y1+0.25*sizey; - v2[1]= y1+0.5*sizey; - v2a[1]= y1+0.75*sizey; + v1a[1]= y1+0.25f*sizey; + v2[1]= y1+0.5f*sizey; + v2a[1]= y1+0.75f*sizey; v3[1]= y1+sizey; @@ -1330,7 +1330,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o glBegin(GL_LINES); dx= step*zoomx; fx= rect->xmin + zoomx*(-offsx); - if(fx > rect->xmin) fx -= dx*( floor(fx-rect->xmin)); + if(fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin)); while(fx < rect->xmax) { glVertex2f(fx, rect->ymin); glVertex2f(fx, rect->ymax); @@ -1339,7 +1339,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o dy= step*zoomy; fy= rect->ymin + zoomy*(-offsy); - if(fy > rect->ymin) fy -= dy*( floor(fy-rect->ymin)); + if(fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin)); while(fy < rect->ymax) { glVertex2f(rect->xmin, fy); glVertex2f(rect->xmax, fy); @@ -1379,8 +1379,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax-scissor_new.xmin, scissor_new.ymax-scissor_new.ymin); /* calculate offset and zoom */ - zoomx= (rect->xmax-rect->xmin-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin); - zoomy= (rect->ymax-rect->ymin-2.0*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin); + zoomx= (rect->xmax-rect->xmin-2.0f*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin); + zoomy= (rect->ymax-rect->ymin-2.0f*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin); offsx= cumap->curr.xmin-but->aspect/zoomx; offsy= cumap->curr.ymin-but->aspect/zoomy; @@ -1540,9 +1540,9 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glBegin(GL_POLYGON); glColor4ub(0, 0, 0, alpha); glVertex2f(maxx, miny); - glVertex2f(maxx, maxy-0.3*shadsize); + glVertex2f(maxx, maxy-0.3f*shadsize); glColor4ub(0, 0, 0, 0); - glVertex2f(maxx+shadsize, maxy-0.75*shadsize); + glVertex2f(maxx+shadsize, maxy-0.75f*shadsize); glVertex2f(maxx+shadsize, miny); glEnd(); @@ -1552,18 +1552,18 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glVertex2f(maxx, miny); glColor4ub(0, 0, 0, 0); glVertex2f(maxx+shadsize, miny); - glVertex2f(maxx+0.7*shadsize, miny-0.7*shadsize); + glVertex2f(maxx+0.7f*shadsize, miny-0.7f*shadsize); glVertex2f(maxx, miny-shadsize); glEnd(); /* bottom quad */ glBegin(GL_POLYGON); glColor4ub(0, 0, 0, alpha); - glVertex2f(minx+0.3*shadsize, miny); + glVertex2f(minx+0.3f*shadsize, miny); glVertex2f(maxx, miny); glColor4ub(0, 0, 0, 0); glVertex2f(maxx, miny-shadsize); - glVertex2f(minx+0.5*shadsize, miny-shadsize); + glVertex2f(minx+0.5f*shadsize, miny-shadsize); glEnd(); glDisable(GL_BLEND); |