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 | |
parent | 0b412e41368824f47cdd6643c86e4acaf28728e5 (diff) |
quiet warnings for using uninialized color var in ED_image_draw_info().
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/ED_image.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 40 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 2 |
4 files changed, 31 insertions, 23 deletions
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 2058479bed8..05cde05f25c 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -67,8 +67,8 @@ int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit) /* UI level image (texture) updating... render calls own stuff (too) */ void ED_image_update_frame(const struct Main *mainp, int cfra); -void ED_image_draw_info(struct 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(struct ARegion *ar, int color_manage, int channels, int x, int y, + const unsigned char cp[4], const float fp[4], int *zp, float *zpf); #endif /* ED_IMAGE_H */ 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); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 2a8a5b3452f..1ac5ba56145 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1780,12 +1780,12 @@ typedef struct ImageSampleInfo { int x, y; int channels; - char col[4]; + unsigned char col[4]; float colf[4]; int z; float zf; - char *colp; + unsigned char *colp; float *colfp; int *zp; float *zfp; @@ -1820,7 +1820,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event) if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) { float *fp; - char *cp; + unsigned char *cp; int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y); CLAMP(x, 0, ibuf->x-1); @@ -1837,7 +1837,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event) info->zfp= NULL; if(ibuf->rect) { - cp= (char *)(ibuf->rect + y*ibuf->x + x); + cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x); info->col[0]= cp[0]; info->col[1]= cp[1]; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 5beac4ea212..3301f89ab7a 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1334,7 +1334,7 @@ typedef struct ImageSampleInfo { int channels; int color_manage; - char col[4]; + unsigned char col[4]; float colf[4]; int draw; |