diff options
Diffstat (limited to 'source/blender/editors/space_image/image_draw.c')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 3932caeeba6..0dcfa9e3bcc 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -41,6 +41,7 @@ #include "PIL_time.h" #include "BLI_threads.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "IMB_imbuf.h" @@ -129,26 +130,27 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf) { char str[256]; - int ofs; - - ofs= sprintf(str, "X: %4d Y: %4d ", x, y); + int ofs= 0; + + ofs += BLI_snprintf(str, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y); if(cp) - ofs+= sprintf(str+ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); if(fp) { if(channels==4) - ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); else if(channels==1) - ofs+= sprintf(str+ofs, "| Val: %.3f ", fp[0]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Val: %.3f ", fp[0]); else if(channels==3) - ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); } if(zp) - ofs+= sprintf(str+ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); if(zpf) - ofs+= sprintf(str+ofs, "| Z: %.3f ", *zpf); - + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.3f ", *zpf); + (void)ofs; + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); |