diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-14 12:39:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-14 12:39:59 +0400 |
commit | 935ca611c30c1a2c5efb30d68f240b59de71febf (patch) | |
tree | e04cb641948d473c6e3627b4e45f4ffdf3f2a3bd /source/blender/editors/interface/interface_regions.c | |
parent | 16a54c9b8f1d972091b739b7b292c67a0fd2349c (diff) |
[#22830] Hex colour number (COLOUR BALANCE) is out the range in video strip
- use FTOCHAR macro which clamps values above 1.0 (rather then wrapping)
- also fixes a problem rounding down where white would display as FEFEFE rather then FFFFFF
the report also mentions how editing colors above 255 is broken but think this isnt worth trying to support.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a2a7f4bf77a..f17a3371df1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1600,7 +1600,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - sprintf(col, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); + sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -1861,8 +1861,8 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR } rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - - sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); + + sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); |