diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-04 05:02:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-04 05:02:15 +0400 |
commit | ec8a26e040966bec61ab08ae1d4acbf41db08a5c (patch) | |
tree | e0aa18e52762b3abd2b487c3e3665c97b115d678 /source/blender | |
parent | 5f46fdadfd84c3c2ba15d184d47f24f3525c3ae4 (diff) |
use 'const float' when passing readonly colors, and include array size.
Diffstat (limited to 'source/blender')
4 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 8ec3ad567a2..25391a34689 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -867,7 +867,7 @@ DO_INLINE int get_bin_float(float f) return bin; } -DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, float *rgb, float *ycc) +DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, const float rgb[3], const float ycc[3]) { float yuv[3]; diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index c2bc2cf6af1..2f4c2549cf3 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -66,7 +66,7 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect); void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size); void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha); -void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb); +void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]); void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha); void UI_icons_free(void); void UI_icons_free_drawinfo(void *drawinfo); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index d028fcd93ae..ba7c12d164b 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -858,7 +858,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco prv_img->w[size], prv_img->h[size]); } -static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float rgb[3], short is_preview) { ImBuf *ima = NULL; @@ -911,7 +911,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), } } -static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb) +static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, const float rgb[3]) { float x1, x2, y1, y2; @@ -954,7 +954,7 @@ static int get_draw_size(enum eIconSizes size) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) { bTheme *btheme = UI_GetTheme(); Icon *icon = NULL; @@ -1147,7 +1147,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0); } -void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb) +void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]) { int draw_size = get_draw_size(ICON_SIZE_ICON); icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index b5d56f278e5..7c012204739 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1845,7 +1845,7 @@ void ui_set_but_hsv(uiBut *but) } /* also used by small picker, be careful with name checks below... */ -static void ui_update_block_buts_rgb(uiBlock *block, float *rgb) +static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3]) { uiBut *bt; float *hsv = ui_block_hsv_get(block); @@ -2051,7 +2051,7 @@ static void square_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, in /* a HS circle, V slider, rgb/hsv/hex sliders */ -static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyRNA *prop) +static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop) { static short colormode = 0; /* temp? 0=rgb, 1=hsv, 2=hex */ uiBut *bt; @@ -2070,19 +2070,19 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* existence of profile means storage is in linear color space, with display correction */ if (block->color_profile == BLI_PR_NONE) { BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip)); - copy_v3_v3(rgb_gamma, rgb); + copy_v3_v3(rgb_gamma, rgba); } else { BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip)); /* make an sRGB version, for Hex code */ - linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); + linearrgb_to_srgb_v3_v3(rgb_gamma, rgba); } /* sneaky way to check for alpha */ - rgb[3] = FLT_MAX; + rgba[3] = FLT_MAX; RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision); - RNA_property_float_get_array(ptr, prop, rgb); + RNA_property_float_get_array(ptr, prop, rgba); switch (U.color_picker_type) { case USER_CP_CIRCLE: @@ -2134,12 +2134,12 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv); uiBlockEndAlign(block); - if (rgb[3] != FLT_MAX) { + if (rgba[3] != FLT_MAX) { bt = uiDefButR_prop(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha"); uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); } else { - rgb[3] = 1.0f; + rgba[3] = 1.0f; } BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); @@ -2148,7 +2148,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2); + rgb_to_hsv(rgba[0], rgba[1], rgba[2], hsv, hsv + 1, hsv + 2); picker_new_hide_reveal(block, colormode); } |