[Bf-blender-cvs] [c3f3b95] temp_viewport_fx_merge: cleanup

Mike Erwin noreply at git.blender.org
Thu Apr 2 02:29:18 CEST 2015


Commit: c3f3b958dc0b1d361fd3d600f2b64683a7dc0232
Author: Mike Erwin
Date:   Wed Apr 1 20:15:32 2015 -0400
Branches: temp_viewport_fx_merge
https://developer.blender.org/rBc3f3b958dc0b1d361fd3d600f2b64683a7dc0232

cleanup

no functional change

===================================================================

M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8e9e9c6..442ce85 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -72,7 +72,7 @@
  * - return: array of [size][2][x,y] points, the edges of the roundbox, + UV coords
  *
  * - draw black box with alpha 0 on exact button boundbox
- * - for ever AA step:
+ * - for every AA step:
  *    - draw the inner part for a round filled box, with color blend codes or texture coords
  *    - draw outline in outline color
  *    - draw outer part, bottom half, extruded 1 pixel to bottom, for emboss shadow
@@ -549,12 +549,12 @@ static void widget_menu_trias(uiWidgetTrias *tria, const rcti *rect)
 {
 	float centx, centy, size;
 	int a;
-		
+
 	/* center position and size */
 	centx = rect->xmax - 0.32f * BLI_rcti_size_y(rect);
 	centy = rect->ymin + 0.50f * BLI_rcti_size_y(rect);
-	size = 0.4f * (float)BLI_rcti_size_y(rect);
-	
+	size = 0.4f * BLI_rcti_size_y(rect);
+
 	for (a = 0; a < 6; a++) {
 		tria->vec[a][0] = size * menu_tria_vert[a][0] + centx;
 		tria->vec[a][1] = size * menu_tria_vert[a][1] + centy;
@@ -587,7 +587,6 @@ static void widget_check_trias(uiWidgetTrias *tria, const rcti *rect)
 /* prepares shade colors */
 static void shadecolors4(char coltop[4], char coldown[4], const char *color, short shadetop, short shadedown)
 {
-	
 	coltop[0] = CLAMPIS(color[0] + shadetop, 0, 255);
 	coltop[1] = CLAMPIS(color[1] + shadetop, 0, 255);
 	coltop[2] = CLAMPIS(color[2] + shadetop, 0, 255);
@@ -783,6 +782,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 		                               wcol->item[1],
 		                               wcol->item[2],
 		                               (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)};
+
 		/* for each AA step */
 		for (j = 0; j < WIDGET_AA_JITTER; j++) {
 			gpuTranslate(jit[j][0], jit[j][1], 0.0f);
@@ -801,7 +801,6 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 	}
 
 	glDisable(GL_BLEND);
-	
 }
 
 /* *********************** text/icon ************************************** */
@@ -1217,7 +1216,6 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
 			but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs, sizeof(but->drawstr) - but->ofs);
 			if (but->strwidth < 10) break;
 		}
-		
 	}
 
 
@@ -1384,7 +1382,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 				t = 0;
 			}
 
-			glColor3f(0.20, 0.6, 0.9);
+			glColor3f(0.2, 0.6, 0.9);
 
 			tx = rect->xmin + t + 2;
 			ty = rect->ymin + 2;
@@ -2190,7 +2188,6 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
 
 static void ui_hsv_cursor(float x, float y)
 {
-	
 	gpuPushMatrix();
 	gpuTranslate(x, y, 0.0f);
 	
@@ -2205,7 +2202,6 @@ static void ui_hsv_cursor(float x, float y)
 	glDisable(GL_LINE_SMOOTH);
 	
 	gpuPopMatrix();
-	
 }
 
 void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect,
@@ -2280,12 +2276,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
 	 * Useful for color correction tools where you're only interested in hue. */
 	if (but->flag & UI_BUT_COLOR_LOCK) {
 		if (U.color_picker_type == USER_CP_CIRCLE_HSV)
-			hsv[2] = 1.f;
+			hsv[2] = 1.0f;
 		else
 			hsv[2] = 0.5f;
 	}
 	
-	ui_color_picker_to_rgb(0.f, 0.f, hsv[2], colcent, colcent + 1, colcent + 2);
+	ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2);
 
 	glShadeModel(GL_SMOOTH);
 
@@ -2331,7 +2327,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
 void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha)
 {
 	/* allows for 4 steps (red->yellow) */
-	const float color_step = (1.0 / 48.0);
+	const float color_step = 1.0f / 48.0f;
 	int a;
 	float h = hsv[0], s = hsv[1], v = hsv[2];
 	float dx, dy, sx1, sx2, sy;
@@ -2361,26 +2357,26 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
 			hsv_to_rgb(0.0, 1.0, v,   &col1[3][0], &col1[3][1], &col1[3][2]);
 			break;
 		case UI_GRAD_H:
-			hsv_to_rgb(0.0, 1.0, 1.0,   &col1[0][0], &col1[0][1], &col1[0][2]);
+			hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
 			copy_v3_v3(col1[1], col1[0]);
 			copy_v3_v3(col1[2], col1[0]);
 			copy_v3_v3(col1[3], col1[0]);
 			break;
 		case UI_GRAD_S:
-			hsv_to_rgb(1.0, 0.0, 1.0,   &col1[1][0], &col1[1][1], &col1[1][2]);
+			hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
 			copy_v3_v3(col1[0], col1[1]);
 			copy_v3_v3(col1[2], col1[1]);
 			copy_v3_v3(col1[3], col1[1]);
 			break;
 		case UI_GRAD_V:
-			hsv_to_rgb(1.0, 1.0, 0.0,   &col1[2][0], &col1[2][1], &col1[2][2]);
+			hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]);
 			copy_v3_v3(col1[0], col1[2]);
 			copy_v3_v3(col1[1], col1[2]);
 			copy_v3_v3(col1[3], col1[2]);
 			break;
 		default:
 			assert(!"invalid 'type' argument");
-			hsv_to_rgb(1.0, 1.0, 1.0,   &col1[2][0], &col1[2][1], &col1[2][2]);
+			hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]);
 			copy_v3_v3(col1[0], col1[2]);
 			copy_v3_v3(col1[1], col1[2]);
 			copy_v3_v3(col1[3], col1[2]);
@@ -2419,23 +2415,21 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
 				hsv_to_rgb(dx_next, 1.0, v,   &col1[3][0], &col1[3][1], &col1[3][2]);
 				break;
 			case UI_GRAD_H:
-			{
 				/* annoying but without this the color shifts - could be solved some other way
 				 * - campbell */
-				hsv_to_rgb(dx_next, 1.0, 1.0,   &col1[0][0], &col1[0][1], &col1[0][2]);
+				hsv_to_rgb(dx_next, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
 				copy_v3_v3(col1[1], col1[0]);
 				copy_v3_v3(col1[2], col1[0]);
 				copy_v3_v3(col1[3], col1[0]);
 				break;
-			}
 			case UI_GRAD_S:
-				hsv_to_rgb(h, dx, 1.0,   &col1[1][0], &col1[1][1], &col1[1][2]);
+				hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
 				copy_v3_v3(col1[0], col1[1]);
 				copy_v3_v3(col1[2], col1[1]);
 				copy_v3_v3(col1[3], col1[1]);
 				break;
 			case UI_GRAD_V:
-				hsv_to_rgb(h, 1.0, dx,   &col1[2][0], &col1[2][1], &col1[2][2]);
+				hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]);
 				copy_v3_v3(col1[0], col1[2]);
 				copy_v3_v3(col1[1], col1[2]);
 				copy_v3_v3(col1[3], col1[2]);
@@ -2466,7 +2460,6 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
 	}
 	
 	glShadeModel(GL_FLAT);
-	
 }
 
 bool ui_but_is_colorpicker_display_space(uiBut *but)
@@ -2513,7 +2506,6 @@ void ui_hsvcube_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float *x
 	/* cursor */
 	*xp = rect->xmin + x * BLI_rcti_size_x(rect);
 	*yp = rect->ymin + y * BLI_rcti_size_y(rect);
-
 }
 
 static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect)
@@ -2594,9 +2586,8 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
 	x = rect->xmin + 0.5f * BLI_rcti_size_x(rect);
 	y = rect->ymin + v    * BLI_rcti_size_y(rect);
 	CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
-	
+
 	ui_hsv_cursor(x, y);
-	
 }
 
 
@@ -2681,7 +2672,8 @@ bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
 	BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], &coord_array[0][0], resol, sizeof(float[2]));
 	BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], &coord_array[0][1], resol, sizeof(float[2]));
 
-	return 1;
+	/* TODO: why return anything if always true? */
+	return true;
 }
 
 #define LINK_RESOL  24
@@ -2690,9 +2682,10 @@ void ui_draw_link_bezier(const rcti *rect)
 	float coord_array[LINK_RESOL + 1][2];
 
 	if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
+#if 0 /* unused */
 		/* we can reuse the dist variable here to increment the GL curve eval amount*/
-		// const float dist = 1.0f / (float)LINK_RESOL; // UNUSED
-
+		const float dist = 1.0f / (float)LINK_RESOL;
+#endif
 		glEnable(GL_BLEND);
 		glEnable(GL_LINE_SMOOTH);
 
@@ -2703,7 +2696,6 @@ void ui_draw_link_bezier(const rcti *rect)
 
 		glDisable(GL_BLEND);
 		glDisable(GL_LINE_SMOOTH);
-
 	}
 }
 
@@ -2967,7 +2959,6 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
 		rect->xmax -= toffs;
 		rect->xmin += toffs;
 	}
-
 }
 
 /* I think 3 is sufficient border to indicate keyed status */
@@ -3082,7 +3073,6 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
 	round_box_edges(&wtb, roundboxalign, rect, rad);
 	
 	widgetbase_draw(&wtb, wcol);
-
 }
 
 
@@ -3278,7 +3268,6 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
 	round_box_edges(&wtb, roundboxalign, rect, rad);
 	
 	widgetbase_draw(&wtb, wcol);
-
 }
 
 static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -3319,7 +3308,6 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
 	round_box_edges(&wtb, roundboxalign, rect, rad);
 	
 	widgetbase_draw(&wtb, wcol);
-
 }
 
 static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -3363,7 +3351,6 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
 	wtb.outline = 1;
 	wtb.inner = 0;
 	widgetbase_draw(&wtb, &wt->wcol);
-	
 }
 
 static uiWidgetType *widget_type(uiWidgetTypeEnum type)
@@ -3930,7 +3917,6 @@ static void draw_disk_shaded(
 		glVertex2f(c * radius_ext, s * radius_ext);
 	}
 	glEnd();
-
 }
 
 void ui_draw_pie_center(uiBlock *block)
@@ -4019,7 +4005,6 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
 		wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
 	else
 		wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
-	
 }




More information about the Bf-blender-cvs mailing list