quiet warnings for using uninialized color var in ED_image_draw_info().

This commit is contained in:
Campbell Barton
2012-01-20 14:33:03 +00:00
parent 0b412e4136
commit 605aa16dd7
4 changed files with 32 additions and 24 deletions

View File

@@ -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 */

View File

@@ -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;
}
else
else if (cp) {
rgb_uchar_to_float(col, cp);
}
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);

View File

@@ -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];

View File

@@ -1334,7 +1334,7 @@ typedef struct ImageSampleInfo {
int channels;
int color_manage;
char col[4];
unsigned char col[4];
float colf[4];
int draw;