[Bf-blender-cvs] [60ce602] blender2.8: Fix missing conversion of uchar color to float

Julian Eisel noreply at git.blender.org
Tue Nov 22 14:44:17 CET 2016


Commit: 60ce60238046a355ccf7200cbce2e0e6a60b19ec
Author: Julian Eisel
Date:   Tue Nov 22 14:40:57 2016 +0100
Branches: blender2.8
https://developer.blender.org/rB60ce60238046a355ccf7200cbce2e0e6a60b19ec

Fix missing conversion of uchar color to float

Decided to just pass float [4] args, so no type conversion is needed at all.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_eyedropper.c
M	source/blender/editors/interface/interface_style.c
M	source/blender/windowmanager/intern/wm_dragdrop.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 7031aab..57d6166 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1052,7 +1052,7 @@ void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *
 void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str);
 void UI_fontstyle_draw_simple_backdrop(
         const struct uiFontStyle *fs, float x, float y, const char *str,
-        const unsigned char fg[4], const unsigned char bg[4]);
+        const float col_fg[4], const float col_bg[4]);
 
 int UI_fontstyle_string_width(const struct uiFontStyle *fs, const char *str);
 int UI_fontstyle_height_max(const struct uiFontStyle *fs);
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index d7f06b7..9c80858 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -139,8 +139,8 @@ static void eyedropper_draw_cursor_text(const struct bContext *C, ARegion *ar, c
 	wmWindow *win = CTX_wm_window(C);
 	int x = win->eventstate->x;
 	int y = win->eventstate->y;
-	const unsigned char fg[4] = {255, 255, 255, 255};
-	const unsigned char bg[4] = {0, 0, 0, 50};
+	const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+	const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
 
 
 	if ((name[0] == '\0') ||
@@ -154,7 +154,7 @@ static void eyedropper_draw_cursor_text(const struct bContext *C, ARegion *ar, c
 
 	y += U.widget_unit;
 
-	UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, fg, bg);
+	UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, col_fg, col_bg);
 }
 
 
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index fd127ac..0df115d 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -293,7 +293,7 @@ void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const cha
  */
 void UI_fontstyle_draw_simple_backdrop(
         const uiFontStyle *fs, float x, float y, const char *str,
-        const unsigned char fg[4], const unsigned char bg[4])
+        const float col_fg[4], const float col_bg[4])
 {
 	if (fs->kerning == 1)
 		BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
@@ -314,9 +314,9 @@ void UI_fontstyle_draw_simple_backdrop(
 		        (y + decent) - margin,
 		        x + width + margin,
 		        (y + decent) + height + margin,
-		        margin, bg);
+		        margin, (float *)col_bg);
 
-		glColor4ubv(fg);
+		glColor4fv(col_fg);
 	}
 
 
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 3a53906..85a313b 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -268,10 +268,10 @@ void wm_drags_check_ops(bContext *C, wmEvent *event)
 static void wm_drop_operator_draw(const char *name, int x, int y)
 {
 	const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
-	const unsigned char fg[4] = {255, 255, 255, 255};
-	const unsigned char bg[4] = {0, 0, 0, 50};
+	const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+	const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
 
-	UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, fg, bg);
+	UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, col_fg, col_bg);
 }
 
 static const char *wm_drag_name(wmDrag *drag)




More information about the Bf-blender-cvs mailing list