diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-20 18:33:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-20 18:33:03 +0400 |
commit | 605aa16dd76c8c2e6eb62dc1686af81e40568c81 (patch) | |
tree | 44b1c9ad63f5636385b84b020438a7a0003368bc /source/blender/editors/space_image/image_draw.c | |
parent | 0b412e41368824f47cdd6643c86e4acaf28728e5 (diff) |
quiet warnings for using uninialized color var in ED_image_draw_info().
Diffstat (limited to 'source/blender/editors/space_image/image_draw.c')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 41fc861f8e4..9ec9c5ef0e0 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -111,7 +111,8 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) } /* used by node view too */ -void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) +void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int y, + const unsigned char cp[4], const float fp[4], int *zp, float *zpf) { char str[256]; float dx= 6; @@ -211,39 +212,46 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int /* color rectangle */ if (channels==1) { - if (fp) + if (fp) { col[0] = col[1] = col[2] = fp[0]; - else if (cp) + } + else if (cp) { col[0] = col[1] = col[2] = (float)cp[0]/255.0f; - else + } + else { col[0] = col[1] = col[2] = 0.0f; + } + col[3] = 1.0f; } else if (channels==3) { - if (fp) + if (fp) { copy_v3_v3(col, fp); + } else if (cp) { - col[0] = (float)cp[0]/255.0f; - col[1] = (float)cp[1]/255.0f; - col[2] = (float)cp[2]/255.0f; + rgb_uchar_to_float(col, cp); } - else + else { zero_v3(col); + } + col[3] = 1.0f; } else if (channels==4) { if (fp) copy_v4_v4(col, fp); else if (cp) { - col[0] = (float)cp[0]/255.0f; - col[1] = (float)cp[1]/255.0f; - col[2] = (float)cp[2]/255.0f; - col[3] = (float)cp[3]/255.0f; + rgba_uchar_to_float(col, cp); } - else + else { zero_v4(col); + } } + else { + BLI_assert(0); + zero_v4(col); + } + if (color_manage) { - linearrgb_to_srgb_v3_v3(finalcol, col); - finalcol[3] = col[3]; + linearrgb_to_srgb_v4(finalcol, col); } else { copy_v4_v4(finalcol, col); |