Fix #36980: Color space issue when displaying pixel color in a render
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 7 Oct 2013 08:06:19 +0000 (08:06 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 7 Oct 2013 08:06:19 +0000 (08:06 +0000)
HSV values were calculated from a linear space color, which is
not so much useful and correct. Now RGB(A) buffers will use
color managed color for HSV values.

Still not sure which color to use for HSV when there's only one
channel in a buffer. This part left unchanged for now.

source/blender/editors/space_image/image_draw.c

index b64ece99b0f72eb520c5cbe4a4263180dc07598e..89e579553393b815311d621996af797da202e878 100644 (file)
@@ -358,14 +358,8 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
                dx += BLF_width(blf_mono_font, str);
        }
        else if (channels >= 3) {
-               if (fp) {
-                       rgb_to_hsv(fp[0], fp[1], fp[2], &hue, &sat, &val);
-                       rgb_to_yuv(fp[0], fp[1], fp[2], &lum, &u, &v);
-               }
-               else if (cp) {
-                       rgb_to_hsv((float)cp[0] / 255.0f, (float)cp[1] / 255.0f, (float)cp[2] / 255.0f, &hue, &sat, &val);
-                       rgb_to_yuv((float)cp[0] / 255.0f, (float)cp[1] / 255.0f, (float)cp[2] / 255.0f, &lum, &u, &v);
-               }
+               rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
+               rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v);
 
                BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
                BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);