[Bf-blender-cvs] [b7f72aecdad] greasepencil-object: GPencil: Replace wrong values in luminance

Antonio Vazquez noreply at git.blender.org
Tue Nov 19 23:04:24 CET 2019


Commit: b7f72aecdadb8efa96b733fa8c78299fdc4b456d
Author: Antonio Vazquez
Date:   Tue Nov 19 19:54:13 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb7f72aecdadb8efa96b733fa8c78299fdc4b456d

GPencil: Replace wrong values in luminance

The code is disabled but want to keep the right formula.

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

M	source/blender/blenkernel/intern/paint.c

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

diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 831f6da8d2c..39570b3613c 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -662,8 +662,8 @@ static int palettecolor_compare_hsv(const void *a1, const void *a2)
 
 #if 0
   /* Luminance. */
-  float lum1 = sqrt(0.241f * ps1->h + 0.691f * ps1->s + 0.068f * ps1->v);
-  float lum2 = sqrt(0.241f * ps2->h + 0.691f * ps2->s + 0.068f * ps2->v);
+  float lum1 = (0.2126f * ps1->rgb[0] + 0.7152f * ps1->rgb[1] + 0.0722f * ps1->rgb[2]);
+  float lum2 = (0.2126f * ps2->rgb[0] + 0.7152f * ps2->rgb[1] + 0.0722f * ps2->rgb[2]);
   if (lum1 > lum2) {
     return 1;
   }



More information about the Bf-blender-cvs mailing list