diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 14:48:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 14:48:24 +0400 |
commit | 385e5eb92edab8d8a50941c457dee971185c7af3 (patch) | |
tree | eeb740ced34ccbee41fa8266e53a6e336e18a713 /source/blender/blenkernel/intern/brush.c | |
parent | a2ed2b36f3ba2abfb2f473dfde2a9e20d01ad96d (diff) |
code cleanup: color/bw conversion - use BLI color function.
change modifier to use the average of the RGB since perceptual conversion isn't really needed for modifiers.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index dc13404dfaf..f019287144d 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -1301,14 +1301,12 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side) * if the texture didn't give an RGB value, copy the intensity across */ if (hasrgb & TEX_RGB) - texres.tin = (0.35f * texres.tr + 0.45f * - texres.tg + 0.2f * texres.tb); - - texres.tin = texres.tin * 255.0f; - ((char *)texcache)[(iy * side + ix) * 4] = (char)texres.tin; - ((char *)texcache)[(iy * side + ix) * 4 + 1] = (char)texres.tin; - ((char *)texcache)[(iy * side + ix) * 4 + 2] = (char)texres.tin; - ((char *)texcache)[(iy * side + ix) * 4 + 3] = (char)texres.tin; + texres.tin = rgb_to_grayscale(&texres.tr); + + ((char *)texcache)[(iy * side + ix) * 4] = + ((char *)texcache)[(iy * side + ix) * 4 + 1] = + ((char *)texcache)[(iy * side + ix) * 4 + 2] = + ((char *)texcache)[(iy * side + ix) * 4 + 3] = (char)(texres.tin * 255.0f); } } } |