diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-13 12:19:32 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-13 12:22:18 +0300 |
commit | 958d613f6681bd9463bcc60ecd1d7ad52407a9f0 (patch) | |
tree | e2bfb135f38a10af0c100bd97878c7db40181b3e /source/blender/editors/space_image/image_draw.c | |
parent | b72aef92c4fce0c7fc7cf6fca111d085ede99dbe (diff) |
Image editor: Show actual value of single-channel buffer in sample info
Previously if image only had single channel only z buffer value was displaying.
This isn't handy for cases when you've got single channel buffer which is not
a z buffer.
Also fixed possible read past the array.
Diffstat (limited to 'source/blender/editors/space_image/image_draw.c')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index aff0a4c3d44..e810f4db7dd 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -197,6 +197,19 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d dx += BLF_width(blf_mono_font, str, sizeof(str)); } + if (channels == 1 && (cp != NULL || fp != NULL)) { + if (fp != NULL) { + BLI_snprintf(str, sizeof(str), " Val:%-.3f |", fp[0]); + } + else if (cp != NULL) { + BLI_snprintf(str, sizeof(str), " Val:%-.3f |", cp[0] / 255.0f); + } + glColor3ub(255, 255, 255); + BLF_position(blf_mono_font, dx, dy, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str, sizeof(str)); + } + if (channels >= 3) { glColor3ubv(red); if (fp) |