[Bf-blender-cvs] [ca66f44] gooseberry: Fix for color-wire auto-contrast

Campbell Barton noreply at git.blender.org
Sun Nov 9 00:58:23 CET 2014


Commit: ca66f4444d241064a13faa85e5e6ee465a15add8
Author: Campbell Barton
Date:   Sun Nov 9 01:01:26 2014 +0100
Branches: gooseberry
https://developer.blender.org/rBca66f4444d241064a13faa85e5e6ee465a15add8

Fix for color-wire auto-contrast

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

M	source/blender/editors/space_view3d/drawobject.c

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

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index cf34e77..6e698c4 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7125,8 +7125,6 @@ static void draw_object_wire_color_adjust_contrast(
         const int select_state,
         const short draw_type)
 {
-	const float contrast = 0.1f;
-
 	float rgb[3];
 
 	BLI_assert(draw_object_wire_grey != -1.0);
@@ -7143,17 +7141,18 @@ static void draw_object_wire_color_adjust_contrast(
 
 	/* when no solid --- ensure contrast */
 	if (draw_type <= OB_WIRE) {
+		const float contrast = 0.1f;
+
 		const float fill_bw = draw_object_wire_grey;
 		const float wire_bw = rgb_to_grayscale(rgb);
 		const float delta = wire_bw - fill_bw;
 
 		if (fabsf(delta) < contrast) {
 			if (delta > 0.0f) {
-				tint_neg(rgb, 1.0f - (delta * 2.0f));
+				add_v3_fl(rgb, (contrast - delta) / 2.0f);
 			}
 			else {
-				tint_pos(rgb, 1.0f - (delta * -2.0f));
-
+				add_v3_fl(rgb, (contrast + delta) / -2.0f);
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list