[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31572] trunk/blender/source/blender/ editors/interface/interface_widgets.c: Fix: Colour picker wheel wasn' t gamma corrected - drawing too dark

Matt Ebb matt at mke3.net
Wed Aug 25 09:49:12 CEST 2010


Revision: 31572
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31572
Author:   broken
Date:     2010-08-25 09:49:12 +0200 (Wed, 25 Aug 2010)

Log Message:
-----------
Fix: Colour picker wheel wasn't gamma corrected - drawing too dark

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-08-25 07:43:38 UTC (rev 31571)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-08-25 07:49:12 UTC (rev 31572)
@@ -1638,7 +1638,11 @@
 	float centx, centy, radius;
 	float rgb[3], hsv[3], hsvo[3], col[3], colcent[3];
 	int a, tot= 32;
+	int color_profile = but->block->color_profile;
 	
+	if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+		color_profile = BLI_PR_NONE;
+	
 	radstep= 2.0f*M_PI/(float)tot;
 	centx= (float)(rect->xmin + rect->xmax)/2;
 	centy= (float)(rect->ymin + rect->ymax)/2;
@@ -1656,7 +1660,10 @@
 	/* exception: if 'lock' is set
 	 * lock the value of the color wheel to 1.
 	 * Useful for color correction tools where you're only interested in hue. */
-	if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f;
+	if (but->flag & UI_BUT_COLOR_LOCK)
+		hsv[2] = 1.f;
+	else if (color_profile)
+		hsv[2] = linearrgb_to_srgb(hsv[2]);
 	
 	hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
 	
@@ -1884,11 +1891,8 @@
 	float rgb[3], hsv[3], v, range;
 	int color_profile = but->block->color_profile;
 	
-	if (but->rnaprop) {
-		if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
-			color_profile = BLI_PR_NONE;
-		}
-	}
+	if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+		color_profile = BLI_PR_NONE;
 
 	ui_get_but_vectorf(but, rgb);
 	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);





More information about the Bf-blender-cvs mailing list